Posts

Showing posts from August, 2015

grails - GORM 1-to-many relationship -- 3 tables created rather than 2 -

all my problem i'm creating 1-to-many relationship in gorm , expect 2 database tables created backing objects. 3 created makes sql queries overly complex. i've created close variant on 1-to-many in gorm documentation: class status { list errormessage static hasmany = [errormessage:errormessage] } and error message class: class errormessage { string message static belongsto = status } i expected create 2 database tables: create table status { id number(19,0), version number(19,0), //other fields } create table error_message { id number(19,0), version number(19,0), status_id number(19,0), message varchar(255) //other fields } but wants third table, create table status_text { status_text_id number(19,0), text_idx number(19,0), text_id number(19,0) } adding status errormessage (a hack don't want errormessage have reference status) class removes third table keeps second foreign key resulting in tex

debugging - Debugger that can visualise the stack with a block diagram -

i debugging tool able visualise current stack frame (bytes between rsp , rbp) block diagram. something this, real execution values in cells: http://abrickshort.files.wordpress.com/2006/11/stackframe.jpg does such software exist? i'm using unix system. ps. aware of gdb's "examine bytes" function. that's use now, pretty diagrams show supervisor. cheers gdb won't able give diagram off-the-shelf, info frame n gives need: (gdb) info frame 2 stack frame @ 0x7ffff7fe3fe0: rip = 0x3cbd806ccb in start_thread (pthread_create.c:301); saved rip 0x3cbd0e0c2d called frame @ 0x0, caller of frame @ 0x7ffff7fe3ed0 source language c. arglist @ 0x7ffff7fe3ec8, args: arg=0x7ffff7fe4700 locals @ 0x7ffff7fe3ec8, previous frame's sp 0x7ffff7fe3fe0 saved registers: rbx @ 0x7ffff7fe3fd0, rip @ 0x7ffff7fe3fd8

html - height of div equals to "0" -

have simple html code: <body> <div id="container"> <div id="left"> text here </div> <div id="right"> , text here </div> </div> </body> and styles: div#left { float: left; background: #e2e2e2; } div#right { float: right; background: #1469ab; } i want have height of div #container equal heights of it's content, 0. how implement behavior? you should apply non-structural clearing container easyclearing http://www.positioniseverything.net/easyclearing.html otherwise can specify height: auto; overflow: hidden container

iphone - Preload images/sound to avoid lag -

im developing game have player shoots objects. when player shoots sound played. , when hits object generates explosion animation sound. im using uiimageviews draw player , object , use audioservicesplaysystemsound play sounds. the problem i'm experiencing game "lags" first time shoot , first time hit object. think because these objects not yet loaded in memory because it's first time these objects generated problems occur. after first time game doesn't suffer lag. is there way preload these objects in memory game doesn't lag each time new object generated first time? just place creation of uiimage instances , calls of audioservicescreatesystemsoundid() in method runs before gameplay starts. long resources small enough fit memory, should it. you should listen memory warnings, though, , release objects not in use free memory possible. user prefers slight lag when reloading these objects on app crashing because ran out of memory.

android - using big files from res/raw -

i trying develop dictionary application uses source files res/raw. works when use smaller file, not file have use cca 5mb. i decided split in parts , use way because appears android has file size limits assets folder(1mb?). doesnt work way, loads in program not dictionary files. seems problem? going in wrong way this? private void loadwords() throws ioexception { final resources resources = mhelpercontext.getresources(); inputstream inputstream = resources.openrawresource(r.raw.definitions1); bufferedreader reader = new bufferedreader(new inputstreamreader(inputstream)); ucitaj(reader); inputstream inputstream2 = resources.openrawresource(r.raw.definitions2); bufferedreader reader2 = new bufferedreader(new inputstreamreader(inputstream2)); ucitaj(reader2); inputstream inputstream3 = resources.openrawresource(r.raw.definitions3); bufferedreader reader3 = new bufferedreader(new inputstreamreader(inputst

CSS alignment: horizontal blocking? -

i working on cms template , try find out if possible @ all. not able find on net, maybe used wrong keywords. have model given: http://img833.imageshack.us/img833/4979/alignmentmockup.jpg <div> #1 fixed 'banner' container aligned left. <div> #2 container fixed width. supposed centered using whole site measurement (scale #2) shall not overlap <div> #1 (scale #1). problem : when browser window small (e.g. resized, mobile browser), container overlaps <div> #1 . depending on z-index, 1 of them on top of other. approach 1 : both container on same z-index. <div> #2 has margin:0 auto; but not stop them overlapping. approach 2 : both styled position: relative; float: left; z-index: 10 but <div> #2 does not align websites center anymore. since resticted template end working on, cannot add additional containers want. have access portion of html-file right between <body> , beginning of websites functions. can add

Java LinkedList Iterators: Why are they returning only Objects? -

here, i'll post code: int len = internallist.size(); listiterator<e> forward = internallist.listiterator( 0 ); listiterator<e> backward = internallist.listiterator( len ); while( forward.hasnext() && backward.hasprevious() ) { e next = forward.next(); e prev = backward.previous(); // when object references same, expect @ // center of list (for odd-numbered lists?); we're done if( next == prev ) return true; // otherwise, if object values aren't same, we're not // palindrome if( !((e)next).equals( prev ) ) return false; } and here's internal list: private linkedlist<e> internallist; so problem last if statement checks object's equals() method; not e's equals(). if forcibly casting doesn't work, does? the correct implementation of equals(object) chosen @ runtime, due runtime polymorphism. why th

c# - How to save a sftp server connection in web.config? -

whats best way store sftp server connection credentials in web.config? consists of 4 things: ip user password port thanks :-) you can put in <appsettings> section . for example: <configuration> <appsettings> <add key="sftp ip" value="127.0.0.1" /> </appsettings> </configuration> string ip = configurationmanager.appsettings["sftp ip"];

Disable validation for jaxb 1 marshaller -

how disable validation on marshaller jaxb1? you set validationeventhandler on marshaller ignored events: marshaller.seteventhandler(new ignoringvalidationeventhandler()); the validationeventhandler like: import javax.xml.bind.validationevent; import javax.xml.bind.validationeventhandler; public class ignoringvalidationeventhandler implements validationeventhandler { public boolean handleevent(validationevent event) { return true; } } note: if new application recommend using jaxb 2 (jsr-222) instead of jaxb 1.

c# - NHibernate + Fluent NHibernate exception -

problem : there searches can stored in db. each search has collection of filters. there roles. each role may have (nullable column) default search assigned it. also, each search visible 0 or many roles (many-to-many relationship). when try access search filters, nh tries access filters.defaultsearchid, doesn't exist in filters table. db: create table [dbo].[searches] ( id int identity(1,1) primary key, description nvarchar(2000) not null ); create table [dbo].[filters] ( id int identity(1,1) primary key, description nvarchar(2000) not null, searchid int not null references searches(id) ); create table [dbo].[roles] ( id int identity(1,1) primary key, name nvarchar(255) not null, defaultsearchid int null references searches(id) ); create table [dbo].[searchesroles] ( searchid int not null references searches(id), roleid int not null references roles(id) ); entities: public class search { public virtual int id { get;

c# - What are the non-dev cases of SQL Server User Instances (vs CE and other embedded databases)? -

what cases of non-development practical (production use (design, development , deployment) of sql server (express edition) user instances? i.e. when deploy them production not sql server ce (compact edition) or other embedded database? related question: what in sql server user instances make them impossible in non-express editions? pretty same sql server ce, it's desirable data store more robust. bear in mind things reporting services available sql server express not ce, can make difference desirability of 1 on other.

excel - C# and XML spreadsheet simple question -

hello guys have 1675 line code. want when user click button textbox.text insert xml spreadsheet , create on desktop. possible? how can insert text in current xml spreadsheet row? for example: ` <cell ss:styleid="s38"/> <cell ss:styleid="s39"> <data ss:type="string">ვაშლიჯვარი</data> </cell> <cell ss:styleid="s36"/>` please me, advice important me or give tutorials. you can open excel xml file using linq xml. can modify xml dom require. have correlate cells in excel worksheet xml elements. can save modified xml dom create new , modified excel xml file. here small example going: var xdocument = xdocument.load("el-zednadebi.xml"); // xml elements in "ss" namespace. xnamespace ss = "urn:schemas-microsoft-com:office:spreadsheet"; var rows = xdocument.root.element(ss + "worksheet") .element(ss + "table").elements(ss + "

sql - Oracle query plan efficiency problem -

the following query given in pl/sql procedure . select e.data e e.external_id in (select * table (p_external_ids)). the type of p_external_ids create or replace type "varchar2table" table of varchar2(4000 char) . oracle inefficiently executes query using full table scan. hints on query did not , necessary indexes in place. replacing select * part hardcoded ids reduce query running time factor of 20 , when number of rows in table 200 000 . for reference takes 0.3 sec execute select * table clause, , around 0.015 ms single hardcoded id. what suggested efficient ways (key search) write stored procedure extract data table multiple ids ? provided collection type must used pass in list of ids stored procedure. what hints did try? can post fast , slow query plan? one of general issues using pl/sql collections in sql cbo guesses incorrectly @ number of elements in collection , chooses wrong plan result. helpful in cases use cardinality hint, i.e.

c# - Change background colour of dropdownlist selected item in ASP.NET with CSS -

i change background colour of selected item in dropdownlists, listboxes, , textboxes. possible css? thanks update just tried css: ::-moz-selection { background-color:#8cca1e; color:black; } works great selected text not hover colours or selected item colours on dropdownlists or listboxes. you can set background colors .aspx page specifying either cssclass, or backcolor property.. looks like: <asp:listbox cssclass="mylistbox" backcolor="#e0e0e0"></asp:listbox> setting selected item little trickier... don't believe there attribute directly. can set in javascript, or jquery, like: // never mind, won't work <script type="text/javascript"> $(document).ready(function() { $('#mylistbox').click(function() { $("#mylistbox option:selected").css("background-color", "#e0e0e0"); }); }); </script> i'll test make sure works... if need st

string - how to pass a complex chain as an argument to a batch 'index1','index2','index3' -

i want pass string 'index1','index2','index3' batch test2.cmd 1 'index1','index2','index3' 3 and if test2.cmd echo %1 echo %2 echo %3 i'd see echo 1 echo 'index1','index2','index3' echo 3 but not work... cause see echo 1 echo'index1' echo 'index2' how can fix please? just enclose string in double quotes: test2.cmd 1 "'index1','index2','index3'" 3 edit answer comment: also change test2.cmd echo %1 echo %~2 echo %3

System.OutOfMemoryException with entity framework -

when refresh entity framework big table, system.outofmemoryexception. is there better way refresh ef big tables? i'm using .net 3.5 like darin says refreshing of model not load of rows. since refreshing model in code, suspect there may in code loading rows, or has infinate loop. you can edit ef model directly opening file , editing xml. need carefull if this.

c# - How to use LINQ to query from a list of objects into an existing object? -

i'm not sure if possible in linq, have following scenario: i'm calling sharepoint list service multiple times multiple queries. populating single object , properties of queries. using linq query xelement returned. know if call gets point, there ever 1 item returned linq query. have query new object , set properties of main object new object (from linq), each web service call. (the below code sample contains small portion of 'action' item properties need queried , set.) is there way make below statement 'select' existing 'action' object? var item = (from listitem in result.getsplistitems() select new contractaction { title = listitem.getspfieldvalue("title"), description = listitem.getspfieldvalue("description"), deliveryorderid = sphelper.getfirstlookupid(listitem.getspfieldvalue("delivery order")), estimatedvalue = ((listite

sql server 2008 - SSIS: How to skip rows during import? -

in 2000 dtstransformstat_ok. there equivalent of in bids 2008? you may find better in ssis. in data flow task, can use conditional split component. in conditional split, can create condition(s) , pass rows different outputs based on condition. can ignore, or discard, rows don't meet conditions. if must use script component in data flow, can @ asynchronous inputs/outputs. default script component synchronous, means each row enters script component, 1 row exits. when set script component asynchronous, script code responsible controlling rows , columns exit script. so, can use conditions in script determine rows skipped. for asynchronous script component, create new script component transformation. edit component , select inputs , outputs tab. select output 0 branch , alter synchronousinputid property none. expand treeview under output 0 branch , add list of columns define output row. then, start writing script.

jquery - How to add 2 jScrollPane to my page and each one has different CSS? -

i have on page 2 divs uses jscrollpane , want each 1 have own track bar, default property exist in css file , applied 2 divs. i want add specific track bar second div without interacting withe first one. how can that? thanks wrap second scroll pane in element class or id , target css rules tracks nested inside that. e.g. (assuming using jscrollpane 2 ): <div id="wrapper"> <div class="scroll-pane"> [content] </div> </div> then in css: #wrapper .jsptrack { background: red; } this effect track within div id of "wrapper". hope helps!

c - List insertion, disjoint n parallel? -

i have been searching concurrent linked list implementations/academic papers allow concurrent insertions disjoint places in list. prefer lock based approach. unfortunately, implementations i've checked out far use list based locking opposed akin node based locking. any people? edit 1: initial responses. using node based locking means insertion after node or deleting node need lock previous , next node. entirely possible time thread 1 tries lock previous node got deleted in thread 2. how guard against such accidents? i'm not able recommend libraries c specifically, if end doing potentially avoid having have thousands of locks re-using small number of locks , "hashing" decide use each node. you'd quite number of cases there wouldn't contention if number of locks suitably larger number of nodes little space overhead (and it's fixed, not per node). update, edit 1 you work around having per-list multiple reader, single write lock, ( rwloc

unix - Can not populate zsh autocompletion with simple ls output -

the problem can't find way populate boxes array. here's code: local expl declare -a boxes boxes = $(ls $home/.vagrant/boxes --color=none) _wanted boxes expl 'help' compadd $boxes throws exception: vagrant __box_list:13: command not found: boxes __box_list:13: command not found: boxes __box_list:13: command not found: boxes ls command works fine if tried manually: ls $home/.vagrant/boxes --color=none lucid32 lucid64 where mistake? zsh doesn't seem spaces around = . boxes=$(ls $home/.vagrant/boxes --color=none) works, gets step further, maybe.

model - Data modelling of group and users -

i have web app lets users create groups. on front page of app user can - without registering - create group , add other users group entering names list of text inputs. user created group supposed able invite people on list adding email each of names. reason want user provide names , ivitations email later want user able try out app , functionality before registration. so have 2 models group , user many-to-many relationship. user model requires unique email address can't create new user objects each user in group. how 1 make sure temporary users added groups mapped users created through invitation or if invited person has user in app? i thinking creating profile model have name , belong group , user way each user have profile each of groups he/she belongs to. can't think of alternative there must one... you need tools dump dat info brain database model :) http://wb.mysql.com/ or http://www.sequelpro.com/ then need abstract application. http://datamappe

Linq check to see is there any NULLs in a set of DataRows? -

i have set datarows , want check if of fields in of rows has null value in it. came below, i'm not sure because i'm nesting all. result.asenumerable().asqueryable().all(o => o.itemarray.all(i=>i == dbnull.value)) hard tell because can't put "watch" in lambdas. actually need use any (in code return true if values null) , asqueryable() useless in case. bool nullfound = result.asenumerable() .any(o => o.itemarray.any(i=>i == dbnull.value || == null)); then, if need list of rows value null, following: var rowswithnulls = result.asenumerable() .where(o => o.itemarray.any(i=>i == dbnull.value || == null)) .tolist(); p.s. i added null check more safe, if sure have dbnull.value , can remove it.

Streaming pipes in Python -

i'm trying convert output of vmstat csv file using python, use convert csv , add date , time coloumns: vmstat 5 | python myscript.py >> vmstat.log the problem i'm having blocks while trying iterate sys.stdin. seems input buffer doesn't flushed. don't want endlessly loop around , burn processor time i'm trying measure this. here's simple demonstration blocks on line 3: import sys line in sys.stdin: sys.stdout.write(line) sys.stdout.flush() is there easy way access stream grep does, without pausing while input buffer fills up? vmstat 5,does not close stdout, python buffer still waiting more data. use instead: for line in iter(sys.stdin.readline, ""): print line

Which image for steganography? -

which images suitable image steganography (storing behind image)? in particular jpeg,bmp or tiff ? jpeg lossy possible lose data if hidden behind image?(using ls* strong text * technique) technically of these can used, more see jpeg in use in wild. because steganography introducing imperfections in image hide message, imperfections less noticeable in lossy format, whereas if had off pixels in bitmapped image, 1 more notice discrepancy. your question being lossy applies if tries resave image. example if opened image secret message hidden in in photoshop , saved out jpeg, image change , destroy message. not case when sending file via e-mail or web (except in case of isps implement jpeg compression speed browsing speeds slower connections dialup).

visual studio 2010 - What's the proper method of deploying the Corecon API with my app? -

i have winforms app instantiates wp7 emulator. works great locally (of course). i've created vm test installations , xcopies. getting following exception upon attempts pull emulator app in vm: "could not load file or assembly 'microsoft.visualstudio.deviceconnectivity.interop.10.0, version=10.0.0.0..." i have microsoft.smartdevice.connectivity assembly set copy local, it's along ride. nothing else shows up. i looking corecon api instllation separate visual studio install, wasn't able find one. seems solve issue since assembly in question sitting in gac. am going have resort referencing assembly manually in project? or there better way? your issue running emulator inside vm. the emulator vm , running inside vm not offficially supported. different people have had differing levels of success using different virtualization technologies may have success different one.

SharePoint list view created from multiple lists on the same site -

i want create sharepoint list/ view comprimised of multiple columns different lists on same site. do have create separate list or can create view? reason why doing able use reporting webparts require single list input. you can use data view webpart available in spd join multiple list data in single view or create separate list

Determining unique Bluetooth MAC address for iPhone and Android -

is possible determine unique bluetooth mac address iphone , android (and lesser extent, other smartphones) within app on said device? assumption mac address universally unique correct? a general yes or no helpful. example code in case of iphone or android extremely helpful. yes bluetooth mac address unique. in android can use getaddress() api on bluetoothadaptor. returns mac address string. on iphone looks there no public api read mac address , see thread

Why does executing a Stored Procedure With SubSonic 2.1 Inconsistently Populate sp.cmd? -

i need execute stored procedure subsonic 2.1 deletes records following code: var sp = dal.sps.uspdeleteimportapplication(); sp.execute(); sometimes following error: "message":"object reference not set instance of object.","stacktrace":" @ subsonic.dataservice.executequery(querycommand cmd) in c:\svn\subsonicproject\trunk\subsonic\dataproviders\dataservice.cs:line 542 @ subsonic.storedprocedure.execute() in c:\svn\subsonicproject\trunk\subsonic\activerecord\storedprocedure.cs:line 277 when stepping through code debugger, i've noted dataprovider return stored procedure null _cmd object, if step through again can procedure execute. my other stored procedures work consistently no errors. there i'm overlooking? under conditions data provider not connection string?

privileges - "The requested operation requires elevation" message after setup -

i created setup program 1 application in inno setup , i'm trying run application after install, message under windows 7 : the requested operation requires elevation . i know it's because of admin privileges. there way overcome (except of running setup.exe administrator) ? this occurring because executable marked requiring elevation. if try run application [run] section postinstall flag, can add shellexec flag. if inno setup start application shellexecute function rather createprocess . make windows bring uac , run application elevated privileges if needed.

c# - converting string to uint -

i trying read in hex value text box , put in uint, code: uint32 x = convert.touint32(location_txtbox.tostring()); why, want pass x unmanaged code , function header requires dword. i'm getting 'input string not in correct format error? trying input values such 0x7c or 0x777 keep getting errors? thanks. use overload of convert.touint32 specify base of conversion. should work or without leading "0x". uint32 x = convert.touint32(location_txtbox.text, 16);

jQuery load various id's into sections of the page -

in wordpress have page set pull in random post, using jquery i'm looking pull in sections of (random) page various sections on current (home) page @ moment code below: $('#wrongquote').load('random/index.php #wrongsaying' + '?nocache=' + math.floor(math.random()*10001)); $('#sayingby').load('random/index.php #author' + '?nocache=' + math.floor(math.random()*10001)); $('#actualquote').load('random/index.php #actualsaying' + '?nocache=' + math.floor(math.random()*10001)); the trouble pulling in random #wrongsaying, #author , #actualsaying... need random, matching #wrongsaying / #author / #actualsaying so guess need page 'random/index.php #wrongsaying' take div#x , insert div#a, div#f div#e , on... any ideas / appreciated! andy i wouldn't use .load() 3 requests here, i'd loading , make one request server using $.get() , this: $.get('random/index.php', { nocache: m

java - JTable contents and database table in one report -

i new jasprreports. learned jtable contents jasperreport using, jasperfillmanager.fillreport(jasperreport, new hashmap(), new jrtablemodeldatasource(table.getmodel())); and oracle sql contents report using, jasperfillmanager.fillreport(jasperreport, new hashmap(), connection); my question is, possible both of them in 1 report? for example, have jtable contents following: emp_no, emp_name, emp_salary which main content of table , want in header sql table department department_no, department_name any ideas? found workaround... i getting contents of table database java using jdbc, , using params hashmap pass contents report. got idea here .

java - Scraping through CSS selectors -

i need write scraper in java + groovy.. i wondering if able parse html documents , select informations need through simple css selectors (instead going through whole document tree , manually select need) exists? nokogiri ruby, give idea of need.. thanks in advance! i loading page qt webkit , including jquery. it's hack works use case. needed solution requires no configuration - sudo apt-get install libqt4-webkit , you're ready go.

ActionScript 2 load another SWF that loads other files - relative path/url problem -

few facts first: 1. can use actionscript 2. 2. files within same domain (i.e "http://www.example.com"). i have loader swf acts selection tool (" auto_magic.swf ") located @ "/" in website (the root folder). user selects tool needs (it's mechanical diagnostic system) , main movie loads (currently use loadmovie() - suggest else if needed). tool located @ " /tools/[tools_name]/tool_main.swf ". now, "tool_main.swf" loading fine. problem "tool_main.swf" needs load other files located in folder , example tries load "config.xml", flash isn't looking "config.xml" in tool's dedicated folder - instead it's looking file @ root folder "/" "auto_magic.swf" located, because movie's main swf coming there. to make worst cannot modify tool's swf ("tool_main.swf") because it's coming third party. is there solution? far see need 1 of these solutions

java - Map from object to a dynamic string -

right have 60 message types passed getstuff(message) method of class implements containerofthings . there multiple variations of containerofthings such boxofstuff , bagoftricks both of realize getstuff(message) method generates string based on member variables. result may have pre-pended or post-pended data such labels or concatenated data. see code below. public class boxofstuff implements containerofthings { private string var1; private string var2; private string varn; public string getstuff(message message) { if (message.equals(message.get_stuff1)) return var1; else if (message.equals(message.get_stuff2)) return "var2 is: " + var2; else if (message.equals(message.get_stuffn)) return varn + "\n"; // etc. each message.get_* } // getters , setters each var* } public class message { private string id = null; private message(string id) { t

Django: More helpful error messages for DoesNotExist errors? -

is possible coax django giving more information doesnotexist errors? for example, really nice if include query… like: >>> foo.objects.get(id="example_id") ... doesnotexist: no objects matching id="example_id" found sure, can sql django has executed. see http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running

database - Deleting a php file -

i'm not sure how this, have file defines (and creates) database, want run once (on installation) , not every time index.php page run, best way think? thinking of deleting file index.php when file (db_define.php) run successfully. usually instruct person installing software run such script manually part of installation procedure. however, if insist on having done automatically, might smarter check if db exists, or if correct version (according versioning stuff have in place... have db version stored in db, right?) , not run script in case.

Syntax of a return statement in Java -

this in 1 of practice exams. return search(p,key,0,p.length-1) !=null; how if statements? if (search(p,key,0,p.length-1) !=null) { return true; } return false;

asp.net - Lost connection does not return error with jQuery AJAX on live site but on dev? -

i using following code post data asp.net 2.0 site asp.net 2.0 web service post data server: $.ajax({ type: "post", url: "synchronisecustomers.asmx/synchronisecustomers", data: json.stringify(customerobj), contenttype: "application/json; charset=utf-8", datatype: "json", error: function (xhr, status) { // if not successfull }, success: function (msg) { deletecustomer(customer.id); } }); i have javascript function check if have connection or not, if have run synchronisation (pulling data web kit browser local database): function checkconnection() { var = new image(); i.onload = synchronise; i.onerror = fail; i.src = 'http://myurl.com/ping.gif?d=' + escape(date()); settimeout("checkconnection()", 60000); // execute every minute } thing is, if run locally , drop internet connection web service returns 500 error (like want do) , deletecustomer(custome

Automating Linkedin oAuth usin Curl and PHP -

i trying automate process of authenticating linkedin login in order perform public search people on linkedin. first try explain doing. i using 4 files: oauth.php (required) linkedin.php (php linkedin library) auth.php (which gets oauth token linkedin lib file) callback url demo.php?params (which, after successful authenticaton, prints current user's profile , search results using params) the authentication url https://api.linkedin.com/uas/oauth/authorize?oauth_token=$oauthtoken . i did 2 things, neither seems work; are: i using curl automate process of going authentication url, posting fields (username, password, oauth token, csrftoken, duration, sourcealias, etc., came know firebug). the 2 things change here oauth token , csrftoken (by parsing content in authentication url). able both, each time page loads, , trying print response curl_exec. trying post email , password, , trying print response. for reference here auth.php : function extract_unit(

Different view for different subdomains in Rails -

i building rails application need usability test of 3 different views same application. thought switch out default view path depending on subdomain. for example, i'd able define paths like: option1.mysite.com => views/option_1 option2.mysite.com => views/option_2 option3.mysite.com => views/option_3 i'd keep models , controllers same, switch out views depending on subdomain. might best way this? we this: session[:site] = case request.subdomains.last when "a" "a" when "b" "b" when "c" "c" end that's part of set_site method in our application controller. every request checks see if session[:site] set; if not, calls set_site set it. in case, need introduce logic in views present things differently depending on value of session[:site] , it's better if actual view html same , major difference in css. load different css files depending on value of session[

api - Android: What is the purpose of android:pathPattern if I can't filter http scheme? -

i want capture intents specific uri pattern uses http scheme. not want chooser dialog pop up. the android api advertises filtering of intents based on pattern matching of path part of uri: http://developer.android.com/guide/topics/manifest/data-element.html however, when try specify pattern path other ".*" (which pops chooser, i'm trying avoid), doesn't work, , browser automatically handles intent. so, question is, purpose of pathpattern/pathprefix if, http scheme, either auto resolves browser, or pops chooser anyways? i want capture intents specific uri pattern uses http scheme. not want chooser dialog pop up. and, as told you , not possible, security hole. however, when try specify pattern path other ".*" (which pops chooser, i'm trying avoid), doesn't work, , browser automatically handles intent. here example of pattern, more simple wildcard, presumably works. so, question is, purpose of pathpattern/pathpre

.net - number of Saturdays and Sundays of a specific year and month -

using visual basic .net, how can find number of saturdays , sundays of specific year , month? i have created function uses calculation method calculate sats , sundays. have not tested death. have tested performance of both , calculation method (below) , iteration method in @p.campbell's answer, result in milliseconds 10,000 calls were. calculation: 7 iteration: 39 hope helps. dave dim month integer = 12 dim year integer = 2011 'calculate start , end of month dim current new datetime(year, month, 1) dim ending datetime = current.addmonths(1) 'ints hold results dim numsat integer = 0 dim numsun integer = 0 'numbers used in calculation dim datediff integer = (ending.date - current.date).days dim firstday dayofweek = current.dayofweek 'figure out how many whole weeks in month, there must sat , sunday in each ' note integer devision numsat = datediff / 7 numsun = datediff / 7 &#

Releasing an ASP.NET MVC 3 OpenId StarterKit under Open Source License -

i've build asp.net mvc 3 (rc @ moment) site uses openid login system. still learning openid while implementing commented code heavily. result site let's users login/register openid, add other openids account , remove them. little project can used starting point new project use openid login system. can used resource people learn openid with. i decided release project open source. first open source project , need decided license use. want people able use purpose wish for. can learn it, use commercial or non-commercial projects , make own forks of code. nice others able contribute project stuff bug fixes on sites github. i'd copyright owner of code under control. example code in github repository (i'll call main code base). i've heard need every contributor, adds code code base, give me copyright contribution. how work? i use other licensed (mostly open source) resources in projects. here's list , licenses: dotnetopenauth (ms-pl) t4mvc (part of mvccontr

Unstage changes in Git to a specific file -

i've made changes specific file in repository, , committed changes. under 1 commit. in 1 commit, made changes several other files. how unstage changes made one specific file , not of files changed in commit? unstage isn't right word here - refers removing changes index (the staging area), implication haven't been committed. since changes have been committed, you're asking how check out version of file previous commit: git checkout head^ path/to/file head current commit, , head^ first parent of head .

c# - Can you open a view in asp.net MVC that does not have the view engine's extension? -

i want include code in javascript file inside of asp.net mvc page view (the view javascript result described here . want consolidation reasons javascript, lower loading overhead of complex gui ria, make compression more efficient, , make debugging easier. the issue using ext designer create gui. every time project exported creates 2 .js files per class, , since gui pretty complex have quite lot of .js files already. so idea consolidate (at runtime) javascript files 1 have main javascriptviewresult razor view contain html.renderpartial() view calls .js files. however, if call html.renderpartial("gui/baselayout.js") , exception because tries find "gui/baselayout.js.cshtml". is there way force asp.net mvc not add view engine's extension renderpartial call, or there better way concatenate .js files 1 outputted script file? you can try writing own extension method htmlhelper reads in .js files , concatenates them. doing per-request can bit c

command line - How to remember username/password when calling tf.exe? -

i use tf.exe command latest codes keeps asking username/password - there way make credentials remembered? i've looked @ tf.exe argument list no options allowing pass-in username/password. please help! i think need adding parameter /login , i.e. /login:domain\username,yourpassword , tf.exe command. example: tf.exe $/path/to/source/on/tfsserver /recursive /login:domain\username,yourpassword hope helps!

c# - how to edit column value before binding to gridview after retriving from database? -

after retrieved set of datatable database, need edit rows value before binding gridview. example, set of datatable retrived database. eg: [userid], [useremail] --> 1 , james@hotmail.com i change "james@hotmail.com" "james" bind gridview. every rows of [useremail] separated mail extension (@hotmail.com) ... how should do..? something should work: datatable dt = getmydatatable(); foreach (datarow dr in dt.rows) { string email = convert.tostring(dr["email"]); email = email.substring(0, email.indexof('@')); dr["email"] = email; }

Android GStreamer fails to stream http url -

i trying build music app on android device gstreamer ported on it. when try mp3 url streaming on http, failed handle stream (however, works fine on android devices base media framework, opencore). wanted know whether gstreamer supports http url streaming, or there other way of doing it. thanks in advance yes gstreamer can play http, need check if there proper http source plugin install, gst-inspect | grep http. there 1 souphttpsrc element that, check if there.

python - (py)cairo - fill -

is there way fill outside of closed path (polygon)? background: i'd render maps coastlines - need fill sea blue color, thought easiest , in situation efficient fill outside of coastline polygon blue color. thanks in advance! you can add rectangle covering whole drawing area coastline path , set fill rule cairo.fill_rule_even_odd . calling fill() after fills area outside original path. (if choose correct orientation rectangle can skip setting fill rule.)

SharePoint - Using a Content Query Webpart across site collections -

this quite simple question ask, answer straight forward! can use content query webpart on site collection read data site collection b? if it's not supports right out of box, there configuration options can use make happen? thanks. no configuration option enable have cross site content query webpart. you can either create custom web part or buy 1 (several options out there, here one if decide create own web part, find code online you. here example .

asp.net - Adding User controls on runtime - accessing the controls -

i'm trying add user controls on page. thats easy, this. usercontrol block = (categoryblock) loadcontrol("categoryblock.ascx"); panel1.controls.add(block); but want access label controls , more inside categoryblock.ascx. how ? i cant this, block.l_itemname.text = "blabla"; i managed user findcontrol("l_itemname") rather have intellisense. create following property in user control: public string itemname() { get() { return l_itemname.text; } set(string value) { l_itemname.text = value; } } this make able block.itemname = "" or string temp = block.itemname i hope help

Java Generics with Wildcards Not Compiling -

i'm having trouble understanding finer points of java generics wildcards. specifically, why doesn't compile. public class test { abstract class function<a, b> { abstract b call(a a); } interface propertytype { string bubbles(); } class apartment implements propertytype { @override public string bubbles() { return "bubbles"; } } public void invokefunctiononalist() { list<apartment> apts = new arraylist<apartment>(); functionloop(apts, new function<apartment, string>() { @override string call(apartment a) { return a.bubbles(); } }); } public void functionloop(list<? extends propertytype> list, function<? extends propertytype, string> t) { (propertytype p : list) { t.call(p); } } } your compiler not know if using same type

c# - Problem in using multiple sql queries on single button click -

i using following code , works fine. protected void button2_click(object sender, eventargs e) { string = dropdownlist1.selecteditem.value; string b = dropdownlist3.selecteditem.value.padleft(3, '0'); string c = textbox2.text.padleft(5,'0').tostring(); string d = textbox3.text.tostring(); string digit = a+ b + c + d; try { myconn = new odbcconnection("driver={mysql odbc 3.51 driver};server=localhost;database=testcase;user=root;password=root;option=3;"); myconn.open(); //** string sql = "select * testcase.main reg_no =?"; //** odbccommand cmd = new odbccommand(sql, myconn); //** cmd.parameters.addwithvalue("?", digit); myreader = cmd.executereader(); //** while (myreader.read()) { string f = myre

ruby on rails - heroku not working /heroku/commands/pgbackups.rb:9:in `<class:Pgbackups>': uninitialized constant Heroku::Command::Pgbackups::Help (NameError) -

if tipe heroku in console, become this: ~onemore~>heroku /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:9:in `': uninitialized constant heroku::command::pgbackups::help (nameerror) from /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:6:in `<module:command>' /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/commands/pgbackups.rb:5:in `<top (required)>' <internal:lib/rubygems/custom_require>:29:in `require' <internal:lib/rubygems/custom_require>:29:in `require' /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `block in <top (required)>' /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `each' /home/koli/.rvm/gems/ruby-1.9.2-p0@onemore/gems/heroku-1.13.1/lib/heroku/command.rb:5:in `<top (required)>' <internal:li

overlay - What programming languages have access to the WinAPI? -

i'm looking start new programming language , first task want overlay text on applications window, similar guy in post: overlay text on else's window - hud clearly post, can done in vb.net, , extrapolating that, can safely assume c++\c# can similarly. my question is; there other languages can same? can ruby it? :) i'm looking following capabilities: enumerate open windows find 1 want overlay on top of. overlay text on 3rd party apps window. (rich text bonus) detect window bounds can resize text when user resizes window. allow click-through of created text doesn't interfere 3rd party apps functionality. any ideas? if want use ruby, have 2 options: ironruby , " classic ruby ". i guess ironruby preferred option on windows runs on top of .net , has access full windows api through that. if .net needs , need simple, classic ruby might better fit. for classic ruby , check out these pages: ruby , microsoft windows microsoft win

phonecalls - How can I record voice and record Call in Android? -

please me if know how record voice, , record voice of both caller , calle during phone call. if knows give me hint. yes possible this final mediarecorder callrecorder = new mediarecorder(); callrecorder.setaudiosource(mediarecorder.audiosource.voice_call); callrecorder.setoutputformat(mediarecorder.outputformat.mpeg_4); callrecorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); callrecorder.setoutputfile(filepath); try { callrecorder.prepare(); } catch (illegalstateexception e) { system.out.println("an illegalstateexception has occured in prepare!"); // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { //throwing i/o exception system.out.println("an ioexception has occured in prepare!"); // todo auto-generated catch block e.printstacktrace(); } try { callrecorder.start(); } catch(illegalstateexception e) { e.printstacktrace(); //here thorowing illegal state exception

SubSonic 2.x Substring of a column -

how write subsonic query similar c#.net: select * users substr(last_name,1,1) = 's'; i don't want use "like" eats performance. don't think can this, can use subsonic execute query though. how here: http://subsonicproject.com/docs/codinghorror

how to identify incoming call using android? -

i want record incoming call,any body knows please give idea that,other wise give idea how know incoming call, thanks all i believe should write broadcast receiver i.e. make class , extend broadcastreceiver public class myclass extends broadcastreceiver { // functions here } in manifest.xml file write <receiver android:name="myclass"> <intent-filter> <action android:name="android.intent.action.answer">/action> </intent-filter> </receiver> this call myclass ever call received

Java JPA "Error compiling the query" when it uses an enum -

the following jpa query doesn't compile: @namedquery(name = "psa.findbysourcesystem", query = "select p psa p p.sourcesystem.id = :sourcesystemid") p.sourcesystem following enum: public enum sourcesystem { first(3, "abc"), second(9, "def"), third(17, "ghi"); private int id; private string code; ... } and mapped in psa's base class: public class psabase implements serializable { @column(name = "sourcesystemid") @enumerated(enumtype.ordinal) protected sourcesystem sourcesystem; ... } the query compiles , runs fine if replace p.sourcesystem.id in query more benign. thank in advance help. it shouldn't compile. you have resolve required enum value manually before passing query parameter: @namedquery(name = "psa.findbysourcesystem", query = "select p psa p p.sourcesystem = :sourcesystem") . public enum sourcesystem {

jquery - Find element that has either class 1 or class 2 -

i'm trying find text inside element class either myclass1 or myclass2. var mytext = $(this).find('.myclass1:first').text(); this works fine unsure if/how can check 1 of 2 classes (my element have 1 class out of these 2 mentioned). thanks help! if want first 1 found ( but one ) use var mytext = $(this).find('.myclass1,.myclass2').eq(0).text(); if want first of each kind ( two results ) @ answer provided @jelbourn .

multithreading - Problem with delay setText label java -

i have big problem java program. try implement simple software. there label , wanna stamp text in label must separate 2 sec. i have seen problem thread , swing , implemented code result not change. can me please thanks public void stampchips1(int numberdecrement){ actionlistener taskperformer = new actionlistener() { public void actionperformed(actionevent evt) { jlabel1.settext("l'avversario ha deciso di togliere : . "); } }; new javax.swing.timer(2000, taskperformer).start(); actionlistener taskperformer2 = new actionlistener() { public void actionperformed(actionevent evt) { jlabel1.settext("l'avversario ha deciso di togliere : . . "); } }; new javax.swing.timer(2000, taskperformer2).start(); actionlistener taskperformer3 = new actionlistener() { public void actionperformed(actionevent evt) {

grails - How to populate Cmd Object with subset of properties from Domain class? -

i developing webflow based workflow , during initialisation action trying populate set of command objects single domain class, each command object containing subset of fields available in domain class... there's lot of fields see.. what i'm struggling how populate 'properties' of each command object matching properties domain class. has had experience , knows how accomplish ? thanks dave you following: class domain { string lastname string firstname int age } class command { string lastname int age } def domain = new domain(lastname:'last', firstname:'first', age:33) def command = new command() command.properties.findall{ !["metaclass","class"].contains(it.key)}.each { k,v -> command[k] = domain[k] } assert 33 == command.age assert 'last' == command.lastname the problem .properties includes 'class' , 'metaclass'. setting these 2 bad idea, they're ge

javascript - Cannot Set Property ... of undefined --- bizarre -

Image
i'm getting bizarre error in chrome... check out screenshot below. i define record using object literal syntax. i try setting "id" property , exception. i've tried both : record['id'] = 'wtf'; and also record.id = 'wtf'; i use type of syntax on place in script.... going on here ? bug in chrome ? edit : i've solved problem now, i'm still not sure why happening. moved definition of record occur outside of if block. know occurring ? thought variable declarations scoped function , therefore shouldn't issue. the problem dl less or equal zero, statement initializes record doesn't executed. indentation, looks intended both statements part of if block, no braces, record['id'] = 'wtf'; statement gets executed no matter what. by moving variable initialization outside if statement, forced happen in case , moved assignment inside if block (which, i'm assuming wanted). probably b

FileMaker - Finding Primary Key of First Related Record -

i'm using script create new invoice record. i'd automatically set invoice's fclient fcontactid column id of client's first contact. in script, how find/compute id of client's first contact? setfield calculated result of min(contact_invoice contact::contactid) didn't work. tables: client - primary key: clientid contact - has foreign key: fclientid (a client can have many contacts) invoice - has foreign keys: fclientid & fcontactid (an invoice associated 1 client , 1 of that client's contacts) thank you, ben you want set "fclientid", description sound more you're wanting set fcontactid. right? if that's case, have invoice, related client, directly related contact. you're doing right, if it's not working context isn't right. context @ time invoice table, related contact needs accessible there. you use auto enter calc instead of script set this. bonus let select valid context , related table

Visual Studio 2010 - New Tabbed Window -

is there way create new code window in visual studio 2010 tabbed container other code windows. as far can see windows stack on top of each other once they're undocked main window , tab when placed on original visual studio screen. i find hinders multi monitor code screens. thanks. you can if install latest productivity power pack . feature called "floating tab wells" within extension.

ajax - h:dataTable content displayed on .jsf page load,instead of commandLink click only -

looks simple,but doesn't work) when .jsf page loaded ,values db shown. dao impl chunk: public list<product> getproducts() { return gethibernatetemplate().find("from product"); } managed bean chunk: public list<product> getproducts() { return this.getproductmanager().getproducts(); } i intented,that f:ajax work click only: <h:form> <h:commandlink value="show" action="nothing"> <f:ajax render="pr"/> </h:commandlink> <h:datatable var="product" id="pr" value="#{showproducts.products}"> <h:column>#{product.name}</h:column> </h:datatable> </h:form> and data visible on page,when it's loaded. firebug can see,that data refreshed click, ajax it's work. do need additional attributes h:datatable element table con

How to deduce login PHP parameters for Programmatic POST -

i'm using c# log on website. have helpful code sample c# bit, requires pass php script login parameters in format similar "username=myusername&password=mypassword". don't know php nor have access script. there way deduce markup parameters script expecting? here's basis of c# code: login website, via c# thanks in advance. <form id="login" method="post" action="http://mysite.com/forums/index.php?app=core&amp;module=global&amp;section=login&amp;do=process"> <input type="hidden" value="990ea6a14ea49e853634fbdc5015a024" name="auth_key"> <input type="hidden" value="http://www.mysite.com/" name="referer"> <div id="regular_signin"> <a id="_regularsignin"></a> <h3 class="bar">enter sign in name , password</h3>