Posts

Showing posts from January, 2014

GSON just to read a JsonObject tree from Json data doesn't work -

i'm using gson project. in particular use code generate json strings: gson gs = new gson(); jsonobject cmdobj = new jsonobject(); cmdobj.addproperty("cmd", cmd); cmdobj.add("arg", args); string cmdstr = cmdobj.tostring(); which produces like: {"cmd":"handshake","arg":{"protocol":"syncmanager","servername":"12345678910"}} then on client machine reads json data: string cmdstr = readcommand(this.is); gson gs = new gson(); jsonobject jsobj = gs.fromjson(cmdstr, jsonobject.class); jsonelement cmd = jsobj.get("cmd"); jsonobject args = jsobj.get("arg").getasjsonobject(); the problem jsobj should contain parsed object doesn't contain ( if tostring() prints {} ). why this? want jsonobject tree had on other side, not object serialization. clues? jsonobject jsobj = new gson().fromjson(cmdstr

c# - Why does this code compile without error even though the class is marked Obsoleted? -

this visual studio 2008. has static class extensions. public class dummy { public readonly int x; public dummy(int x) { this.x = x; } public override string tostring() { return x.tostring(); } } [obsolete("do not use", true)] public static class extensions { public static int squared(this dummy dummy) { return dummy.x * dummy.x; } } class program { static void main(string[] args) { var d = new dummy(42); console.writeline(string.format("{0}^2={1}", d, d.squared())); } } that repros in vs2010 well. looks bug. i'll entered in database. you can work around bug putting attribute on actual method. thanks report!

java - JTable autoscrolling to bottom -

i have jpanel containing 3 jscrollpanes(each contains jtable) added boxlayout, see 3 tables in page , load data dynamically, code logic same 3 tables , column names , cell rendering different, each tables wanted have auto scrolling bottom of table when new rows added table, first 2 tables work perfect , scrollbar goes bottom of table, last table's scroll bar weird things! use same scrolling method 3 tables first 2 works not work! any ideas? i removed column adding code clearity idea; private jscrollpane fillthirdtable(arraylist<displayvariable> displaylist) { defaulttablemodel model = new defaulttablemodel(); tooltiptable answer = new tooltiptable(model); answer.setrowheight(60); answer.setautoresizemode(jtable.auto_resize_off); answer.setsize(1300, 400); defaulttablecellrenderer dtcr = new defaulttablecellrenderer(); dtcr.sethorizontalalignment(swingconstants.center); answer.getcolumn("display variable id").setc

objective c - Made a change in Interface Builder, Xcode is not showing it -

so here interface looks @ moment: start interface http://i54.tinypic.com/25876mr.png here have changed in interface builder: desired interface http://i51.tinypic.com/24qms9l.png this shown after run in xcode: resulting interface http://i54.tinypic.com/25876mr.png obviously 2 programs not communicating - if point me in right direction great. thanks heaps! if stuff isn't in sync, try cleaning build. product>clean should trick.

iphone - How to add value into array overtime user click on next button in xcode? -

when user click next button, generate random number , store number array. array storing last number only. should initialize array outside 'next' function? moreover, 'back button' read array last in number. please advise. - (ibaction)next:(id)sender { // additional setup after loading view nib. //generate random number - result range of 0-10 int randomnumber = (arc4random() % 10); // add random number array [myarray addobject:[nsnumber numberwithint:randomnumber]]; // easy way in array nslog([myarray description]); nsstring *filename = [nsstring stringwithformat:@"file_no_%d", randomnumber +1]; //render complete file-path out of our filename, main-bundle , file- extension nsstring *filepath=[[nsbundle mainbundle] pathforresource:filename oftype:@"txt"]; //fetch text content file nsstring *mytext= [nsstring stringwithcontentsoffile:filepath

GIT: pulling alway fails on the first trial and works on the second -

in our project use git manage our code base. have 1 central online repository, against developers push , pull. running git tortoise git on windows, i'm having following strange issue: when pulling, first attempt pull fails (with error message pasted below), , subsequent attempt succeed. nothing changed in between. i'm using git shallow understanding of principles, have know basic use cycle. me please solve riddle git.exe pull -v --progress "origin" remote: compressing objects: 10% (40/393) /393) /393) /393) /393) /393) /393) /393) 393) 393) remote: compressing objects: 21% (83/393) /393) /393) /393) /393) /393) /393) /393) /393) /393) remote: compressing objects: 31% (122/393) 8/393) 4/393) 1/393) 7/393) 3/393) /393) /393) /393) remote: compressing objects: 41% (162/393) 8/393) 4/393) 0/393) 6/393) 2/393) 8/393) 4/393) 0/393) remote: compressing objects: 51% (201/393) 7/393

cocoa - Disappearing NSManagedObjects -

i working on document based application. when opening saved file, load in nsmanagedobjectcontext view controller. view controller needs observe changed on property "depth" on objects of type. when view controller gets context, gets these objects, adds observer of value on each, , keeps them in array keep track. whenever core data sends contextdidchange notification, add created objects array after observing them. deleted objects, remove view controller observer , remove them array. this works great until close document , reopen it. when happens, objects added array. observation works fine. however, second first "nsmanagedobjectcontextobjectsdidchangenotification" comes in, of nsmanagedobjects somehow no longer in array set up. on delete, crash telling me can't remove observer that's not observer. it's strange. why nsmanagedobjets gone? don't release array or funny business @ all. when close document , reopen it, getting

iphone - iOS Simulator on Mac doesn't show Email or ActiveSync options -

i'm trying test email access in iphone ipad simulator , there doesn't appear way use "email" pop3 or activesync sdk's simulator. how configure simulator email access? you don't. simulator not meant full-featured reproduction of real iphone or ipod touch, hence name "simulator" instead of "emulator". that's 1 of missing features.

Optimizing a big MySQL aggregate query for analytics -

i'm trying build out basic marketing analytics tools , want provide "transactions date @ day n" summary each campaign code. is there way make query more efficient? each day_n column want count transactions made before or on day. select c.campaign_code, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 1) day_1, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 2) day_2, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 3) day_3, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 4) day_4, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 5) day_5, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 6) day_6, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 7) day_7, (select count(*) _t_transactions campaign_code=c.campaign_code , day <= 14) day_14, (select count(*) _t_transactions campaign

ruby on rails - Error installing passenger on OSX: Curl development headers with SSL support not found -

i getting "curl development headers ssl support" error when trying install passenger nginx module on osx machine. i downloaded curl-7.19.7 apple , installed fine. what's going on?? the default apple installation includes binaries, not development headers. when build package source (even apple's open source packages) includes headers, can build native extensions. therefore, when manually install apple's nginx packages, need build extension. kinda happens when try install mysql gem on os x server if haven't installed apple's mysql source packages. b0rked until build apple's (modified) source.

jvm - How much is to much PERM in Java (1.5GB seems high) -

we run large java based application under heavy development. every 3 6 months seems have increase size of perm memory or risk running out of memory either when application starts or shortly after coming online. application hosted in jboss 4.2 , tomcat servers. our current setting are: -server -xms12g -xmx12g -xx:maxpermsize=1536m -xx:+useconcmarksweepgc -xx:+cmsincrementalmode i can wonder if seems awful high. the perm memory seems fill on startup. anywhere between 90 99% using jstat. our web application consists of 30 plus individual war files. in jboss these deployed 1 large 300mb+ ear file. is normal large application perm? that hella lot of permgen space. if fills right away, implies inconceivable number of classes. there lot of duplication in libraries across 30 war files? save lot of space loading common libraries common classloader closer root, rather in each separare webapp. try installing common libraries in server directories.

.net - Populating dropdown from the XML in C# -

i have got below xml format me , using .net 2.0. <?xml version="1.0" encoding="utf-8"?> <publicationslist> <publication tcmid="tcm:0-226-1"> <name>00 primary parent</name> </publication> <publication tcmid="tcm:0-227-1"> <name>01 group parent</name> </publication> <publication tcmid="tcm:0-228-1"> <name>02 developer library</name> </publication> <publication tcmid="tcm:0-229-1"> <name>03c content library</name> </publication> </publicationslist> now want populate dropdownlist above xml, dropdownlist text "name" node value , dropdownlist value "tcmid" attribute value using method in c#. please suggest!! you this using linq xdocument xdoc = xdocument.load(@"yourxmlfile.xml"); var query = xele in xdoc.descendants("pub

c# - DateTime Value to null -

hey, kind of tough explain because don't know how happening. have datepicker box when page loaded date box set null. once user chooses date , clicks submit button - page reloading , working should fine time format of zeros appears date : 5/11/2011 00:00:00 is there way can rid of zeros in post or methods or way possible? here how code looks in aspx page: begin date: <%:html.editorfor(b => b.begindate)%><%:html.validationmessagefor(b => b.begindate)%> end date: <%:html.editorfor(e => e.enddate)%><%:html.validationmessagefor(e => e.enddate)%> my viewmodel: public datetime? begindate { get; set; } public datetime? enddate { get; set; } this based off of darin's answer: in viewmodel: [displayformat(applyformatineditmode = true, dataformatstring ="{0:dd/mm/yyyy}")] public datetime? begindate { get; set; } [displayformat(applyformatineditmode = true, dataformatstring = "{0:dd/mm/yyyy}")] public

MySQL - WORKBENCH - to generate Catalog diff -

hi have problem using generate catalog diff in database tab, in mysql workbench, using ver5.2.33, option generate catalog option has been disabled, while other option like, forward eng, reverse eng, synchronize model, works fine.. still used existing model only, need solve this.. plz asap. option generate catalog diff been disabled... i using version 5.2.35 ce should similar yours make sure tabs closed. ( simplicity , lack of confusion ) now on "home" should icon of house on tab, go ahead , select new eer diagram on page, going click on menu database , select "create diff catalog" here choose option live both connections the next screen select live database then on next screen select database wish compare. the next screen select live database wish compare to then on next screen select database wish compare. the next screen show differences, may take little while them appear. me, took 30 seconds 25mb database if know steps , cannot seem r

iphone - How can I write an iOS application that displays mail from my GMail account? -

how can write ios application displays mail gmail account? you use libetpan . it's library mail client. , gmail uses imap, can use imap part of libetpan.

store - How to do a "while quantity is greater than zero loop" -

so using gift certificate module satchmo store , in order send multiple gift certificate codes equal number of items purchased need add loop doing "while quantity greater 0 loop" here code, loop being added right before "price=order_item.unit_price" def order_success(self, order, order_item): log.debug("order success called, creating gift certs on order: %s", order) message = "" email = "" detl in order_item.orderitemdetail_set.all(): if detl.name == "email": email = detl.value elif detl.name == "message": message = detl.value price=order_item.unit_price log.debug("creating gc %s", price) gc = giftcertificate( order = order, start_balance= price, purchased_by = order.contact, valid=true, message=message,

COBOL Question - UNICODE -

we looking convert our legacy cobol code ansii unicode have come across problem changing pic x fields pic n , setting nsymbol(national) cause problems when data structures contain redefines or rename statement elementary data items using pic 9 fields. 01 ws-record pic n(26). 01 ws-record-1 redefines ws-record. 02 ws-num pic 9(6). 02 ws-data pic n(20). move n"123456abcdefghijklm" ws-record. in above string being moved in utf-16 format, therefore field ws-num corrupt contain x"310032003300" invalid numeric, ws-data contain x"3400350036004100..etc the question is, when using national (utf-16) data types how can numerics handled correct data after has been redefined. i can sort of work doing following invalid data in other ws-record. move 123456 ws-num. move n"abcdefghijklm" ws_data. the above correct, if examine ws-record see ???abcdefghijklm ??? x"313233343536" in hexi-decimal. our problem have multiple data records dependin

bytearray - Android get image from url SingleClientConnManager problem -

i using following code images of logo , save in database. defaulthttpclient mhttpclient = new defaulthttpclient(); httpget mhttpget; httpresponse mhttpresponse; httpentity entity; (int reportscount = 0; reportscount < reportsarr.length; reportscount++) { //make request our image mhttpget = new httpget(reportsarr[reportscount][1]); byte[] categorylogoarr = null; try { mhttpresponse = mhttpclient.execute(mhttpget); if (mhttpresponse.getstatusline().getstatuscode() == httpstatus.sc_ok) { entity = mhttpresponse.getentity(); logoarr= entityutils.tobytearray(entity); } } catch (clientprotocolexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } long categoryid = datahelper.addcategory(reportsarr[reportscount][0], categorylogoarr); } the first image added perfectly, rest of cases not working , giving following

c# - Display FormCollection with ASP.NET MVC -

i have form using html.beginform() on view. have in controller actionresult handle post. need kick results view. can kick off new view, don't know how pass data , once there don't know how display it. here's have in actionresult. [httppost] public actionresult index(formcollection collection) { viewbag.title = "confirm order"; return view("orderconfirmation", collection); } if return view("orderconfirmation"); go view know got working. don't know how pass data. right have typed same model form causes errors because formcollection not same obviously. if remove typed line above works, have no idea how loop through collection @ point. thanks help. use viewmodel , stongly typed view. can pass model second view. public actionresult index(order order) { return view("orderconfirmation", order); } asp.net mvc automatically create order instance , fill properties po

iphone - How to play video in black/white -

possible duplicate: how apply black , white effect color video in ios hi, can me how play video in black/white mode. thanks. unfortunatly, doesnt seem mpmovieplayercontroller gives ability adjust such feature, not possible right build in movie player.

linux - Distinguish directory name or path to the directory -

i have shell script takes directory-name or path directory command-line, , create directory. if want identify argument valid path or directory-name, how can achieve this? if directory-name passed directory created in location script being executed, , if path directory created on path. distinction necessary script. thanks , regards. dir=$(dirname -- "$1") if test "$dir" != '.'; echo 'path' else echo 'directory' fi

Trying to manipulate images using Python -

i trying learn python, first code have written: #!/usr/bin/python # filename: read_image.py f=open('1.raw','r+b') image=f.read() f.close() f=open('copy.raw','w+b') f.write(image) f.close() in range(1,256): image[i]=0 in first part reading '.raw' image binary file , making copy of it. part works fine on own , copy of image after execution of code. wish manipulate image, starters trying blacken first line of image, following error: traceback (most recent call last): file "c:/python32/read_image.py", line 15, in <module> image[i]=0 typeerror: 'bytes' object not support item assignment i tried using 'int' type variables copying image them, error persists except instead of 'bytes' object not support assignment, 'int' object not support assignment. how should go solving problem? please note grayscale image, , pixel values range 0 255, tr

c# - Understanding Entity Framework 4.1 Conventions -

are there decent articles online explain in detail how conventions work in ef 4.1? there article linked scott gu's blog, dated 2010, think in ctp 4. not sure if conventions have beem modified since then. don't understand how works. example how know use table skilltype if have code (what for?): public dbset<skilltype> skilltypes { get; set; } this 1 of confusions, there foreign keys, primary keys, etc. need familiarise myself these conventions goof articles can read please let me know. did google , couldn't solid , concrete. there no real walkthrough. can find basic description of conventions in msdn. my answer on msdn forum posts links conventions. there big change in conventions since ctp5. first of cannot add custom conventions more - feature removed final version. if define dbset in example not job convention define table. there mechanism (probably using reflection) finds defined sets in contexts , starts mapping generation.

javascript - Select box with 50+ word select -

i have number of subtopics select using select / dropdown box. problem have each subtopic 30-50 words long. know of way can have multi-line selects within select box? right can show select because of page size have data trucated. i guess maybe jquery has solution not sure i'm not familiar jquery you better use autocomplete to make dropdown elements multi-line, edit css of .ac_results li making taller (for instance, change line-height )

how to listen "android.intent.action.CAMERA_BUTTON" broadcast action in android device which do not have hardware camera button -

how can listen or receive "android.intent.action.camera_button" broadcast action in android device not have hardware camera button. you can't: intent generated hardware camera button, not button within camera app.

iphone - Upload photo on twitPic and facebook -

hello using twit pic in app.i want upload selected photo facebook ..how this.if upload how know user logged in @ fb? you try framework such sharekit facilitate sharing image on facebook. don't think there way tell if user logged in without requesting permission access account, perhaps via facebook sdk.

python - Reflect the QPixmap -

i have object qpixmap, how reflection without qimage? using qimage (pyqt4): tmp_image = qimage("./templates/{type}/{name}.png".format(type=tpl_type, name=tpl_name)) pixmap_reflect = qpixmap().fromimage(tmp_image.mirrored(horizontal=true, vertical=false)) you should able use qpixmap's transformed() ( see this ), using scale transform (a scale of (1,-1) should trick think). i'm assuming functionality available in pyqt. don't use myself.

asp.net mvc 3 - MVC3 missing in Visual Studio 2010 SP1 -

i had vs 2010 ultimate installed. had no mvc3. installed sp1, should have installed updates mvc3 - right ? but after installation, still don't have mvc3 option in new project window. what's wrong here? mvc3 optional download: http://www.asp.net/mvc

c# - Convert PDF To Image - library or command line - free -

how can convert each pages of pdf's file in c#, using free command line or free library? thank you example commandlines ghostscript converting multipage pdf images (1 image per page): gswin32c ^ -o gray_page_%03d.png ^ -sdevice=pnggray ^ input.pdf . gswin32c ^ -o page_%03d.png ^ -sdevice=png256 ^ input.pdf . gswin32c ^ -o page_with_alphachannel_%03d.png ^ -sdevice=pngalpha ^ input.pdf . gswin32c ^ -o cmyk_page_%03d.jpeg ^ -sdevice=jpegcmyk ^ -djpegq=80 ^ input.pdf . gswin32c ^ -o rgb_page_%03d.jpeg ^ -sdevice=jpeg ^ -djpegq=100 ^ input.pdf . gswin32c ^ -o tiffg4_page_%03d.tiff ^ -sdevice=tiffg4 ^ input.pdf . gswin32c ^ -o tiffg32nc_page_%03d.tiff ^ -sdevice=tiff32nc ^ -scompression=lzw ^ input.pdf ...and many more possible.... if need control resolutions , page sizes (and not rely on ghostscript's defaults) add these parameters: -r600x600 gives horizontal , vertical resolutio

join - LINQ to Entities joining on instance rather than id generates nasty SQL -

can explain why join entity rather id generates ugly sql when conceptually doing you'd think same thing? e.g. by id from companydirector in companydirectors join contactaddress in contactaddresses on companydirector.contactaddress.id equals contactaddress.id select new {companydirector, contactaddress} generates from [company] [extent1] inner join [address] [extent2] on [extent1].[contact_address_id] = [extent2].[contact_address_id] by instance from companydirector in companydirectors join contactaddress in contactaddresses on companydirector.contactaddress equals contactaddress select new {companydirector, contactaddress} generates from [company] [extent1] inner join [address] [extent2] on exists (select 1 [c1] ( select 1 x ) [singlerowtable1] left outer join (select [extent3].[contact_address_id] [contact_address_id] [address] [extent3] [extent1].[contact_address_id] = [extent3].[contact_address_id] ) [proje

c# - Retrieving data from database in silverlight -

i need display data database <stackpanel orientation="horizontal"> <textblock text="topaggregate:" fontweight="bold" foreground="#ff0f274e" height="25" width="80" fontsize="10" verticalalignment="center"/> <textblock text="{binding converter={staticresource mydictionaryconverter}, converterparameter=, mode=oneway}" fontweight="bold" foreground="#ff0f274e" height="25" width="240" fontsize="10" verticalalignment="center"></textblock> </stackpanel> these lead have achieving this, need know converter parameter should be? the converter parameter should column name in table of data want retrieve

Not geting value while Parsing Json String in C# -

i getting json string "jasoncontent" nytimes. when write following code can values of total , offset interested in results,but getting nothing results.the string receiving { "offset": "0", "results": [ { "body": " news goes here", "byline": "by sana siwolop", "date": "20110511", "title": "square feet; chelsea piers, manhattan sports center, expands close home", "url": "http:\/\/www.nytimes.com\/2011\/05\/11\/realestate\/commercial\/chelsea-piers-a-manhattan-sports-center-expands-close-to-home.html" }, { "body": "news 2 goes here", "byline": "by rob hughes", "date": "20110511", "title": "on soccer; racial politics rear head in french soccer", "url": "http:\/\/www.nytimes

c# - EF 4, how to add partial classes -

i needed extend ef partial classes, because want add functionality able use oracle's sequences , don't know how use partial class thing, made seperate .cs file , name 1 of auto-generated classes follows: namespace glassstoredal { public partial class car { private int _sequences; public int sequences { { return _sequences; } set { _sequences = value; } } } } now assumed that, on bll - references glassstoredal - can find "sequences" property , apparently goes wrong, appreciate here. here generated partial class , should have sequences property there? [edmentitytypeattribute(namespacename="model", name="car")] [serializable()] [datacontractattribute(isreference=true)] public partial class car : entityobject { #region factory method /// <summary> /// create new car object. /// </summary> /// <param name="id">initial value

xml - Why do I get the error message "element … not processed" when parsing a KML with Geo::KML? -

use geo::kml; $data = geo::kml->readkml("test1.kml"); use data::dumper; $data::dumper::indent = 1; print dumper $data; i using code , test1.kml file available http://pastebin.com/lbzwlylc . getting error: error: element `{http://www.opengis.net/kml/2.2}document' not processed @ {http://www.opengis.net/kml/2.2}kml if pastebin full contents of parsing, might because missing closing </folder> , </kml> tags. might consistent error message (though i'd expect refer folder) - document/folder element under not processed (because isn't closed).

version control - How to prevent git stash dropping changes to files with the "assume unchanged" bit? -

i have used git update-index --assume-unchanged on files keep changes them being committed. when using git stash in repository, changes stashed along other outstanding changes. expected behaviour, git stash pop doesn't bring them back, changes lost. anyone know how either prevent files assume unchanged bit having changes stashed? alternatively perhaps know how make sure changes stashed against files @ least brought back? assume-unchanged performance hack, , represents promise file has not changed. if change file bets off. should either rearchitect repo don't commit these files (perhaps commit filename.sample , .gitignore filename) or play tricks branches files not want shared rest of world off on branch or otherwise hidden. i have seen/thought of 4 suggestions on how hide these changes. 1: use smudge/clean filter change file want on checkout , clean on checkin. ugly. 2: create local configuration branch described in http://thomasrast.ch/git/local-c

html - How do I disable form fields using CSS? -

is possible disable form fields using css? of course know attribute disabled, possible specify in css rule? - <input type="text" name="username" value="admin" > <style type="text/css"> input[name=username] { disabled: true; /* not work */ } </style> the reason i'm asking that, have application form fields autogenerated, , fields hidden/shown based on rules (which run in javascript). want extend support disabling/enabling fields, way rules written directly manipulate style properties of form fields. have extend rule engine change attributes style of form fields , somehow seems less ideal. it's curious have visible , display properties in css not enable/disable. there in still-under-works html5 standard, or non-standard (browser specific)? since rules running in javascript, why not disable them using javascript (or in examples case, jquery)? $('#fieldid').attr('disabled', 'd

Implementing cascading stored procedures in SQL Server 2008 -

how can maintain transaction across cascading stored procedures? i using sql server 2008. you can wrap whole thing in transaction, , work, have make sure child/nested stored procedures rollback transaction, otherwise cause deadlock. this: create procedure [dbo].[parent] begin transaction begin try exec child end try begin catch if @@trancount > 0 rollback end catch commit create procedure [dbo].[child] begin transaction begin try --do inserts here end try begin catch if @@trancount > 0 rollback raiserror('error occured',16,1) end catch commit

c++ - Static linking failed although the name exists -

i'm trying link static library, libcovis.a. looks fine still have undefined reference `covig_publicdemo::moins::reset()' i checked name exists in library $nm libcovis.a | grep reset ... _zn16covig_publicdemo5moins5resetev ... i'm using linking arguments -l/path/to/libcovis.a -lcovis what doing wrong ? edit: error might else, if gcc main.cpp -i/usr/include/opencv -i/usr/include/cairo -i../../source -o slam -rdynamic -lglu -lgl -lsm -lice -lx11 -lxext -lglut -lxi -lxml2 -lboost_filesystem-mt -llapack -lblas -lcv -lcxcore -lcvaux -lhighgui -lcairo ../../source/libcovis.a ../../source/contrib/gnuplot_i/libcovis_contrib_gnuplot_i.a -lgl2ps it works ! but when i'm in kdevelop using cmake, doesn't work anymore. use cmake_exe_linker_flags:string=-rdynamic -lglu -lgl -lsm -lice -lx11 -lxext -lglut -lxi -lxml2 -lboost_filesystem-mt -llapack -lblas -lcv -lcxcore -lcvaux -lhighgui -lcairo /usr/local/src/covis-0.0.0-1/sou

enumeration - Why does enumerating DirectoryEntry children only return 20 results on a WinNT domain? C# -

i'm using following code find computers in given winnt domain, since directorysearcher not supported on winnt domains; protected void scandomain(string domainname, bool islocaldomain) { directoryentry parententry = new directoryentry(); if(islocaldomain) { try { parententry.path = "winnt://" + domainname; int numresults = 0; foreach (directoryentry childentry in parententry.children) { switch (childentry.schemaclassname) { case "computer": debug.writeline(childentry.name); numresults++; break; } } if (numresults == 0) { debug.writeline("no results."); } } catch (exception ex) { debug.writeline("failed."); } }

c# - Compressing an Outlook PST programmatically -

this article resource can find says api compressing pst file not exposed. can verify or provide information otherwise? thanks my understanding link posted correct. there no api compacting pst. depending on how many items in pst have, 1 option may create new pst , move items over, delete old pst. granted, that's not elegant solution means, it's option.

Rails 3: Set a route as 'get' -

i have route as: match 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_xpto" the goal make request outside. however, route not being set get. how can make get? change match get : get 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_xpto" or add :via option match 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_xpto", :via => :get

actionscript 3 - Flex ModuleManager unload module -

i use modulemanager load module, class: public class loadmodule { private static var info:imoduleinfo; private static var display:ivisualelement; private static var downloadbar:progressbar; private static var parent:group; public function loadmodule() { } //load module public static function load(url:string, parent:group, bar:boolean = true):void { loadmodule.parent = parent; info = modulemanager.getmodule(url); info.addeventlistener(moduleevent.ready, readyhandler); info.addeventlistener(moduleevent.setup, setuphandler); info.addeventlistener(moduleevent.error, errorhandler); info.load(null, null, null, parent.modulefactory); } //add display object private static function readyhandler(event:moduleevent):void { loadmodule.display = event.currenttarget.factory.create() ivisualelement;

Rails 3 - Cheddargetter or Chargify Sample -

if have implemented recurring billing solution w/api of cheddargetter or chargify, can nuby out w/ sample code or highlight key points in mvc in rails 3? i have been studying api doc, yet still struggling. kind appreciated. linda i've used wrapper cheddar getter: https://github.com/hashrocket/mousetrap this should started: http://support.cheddargetter.com/discussions/problems/155-cheddargetter-beginner

Extjs 4 combobox default value -

i'm migrating application extjs 3 4 version. have several comboboxes @ formpanel, , i've used hiddenname , stuff submit valuefield instead of displayfield. all adaptation works fine (value field submitting), can't set default values comboboxes, shown empty after page load. previously, did specifying 'value' parameter in config. there ideas how fix that? my code - model , store: ext.define('idnamepair', { extend: 'ext.data.model', fields: [ {name: 'id', type: 'string'}, {name: 'name', type: 'string'} ] }); var dirvaluesstore = new ext.data.store({ model: 'idnamepair', proxy: { type: 'ajax', url: '../filtervalues.json', reader: { type: 'json', root: 'dir' } }, autoload: true }); combo config: { triggeraction: 'all', id: 'dir_id', fieldlabe

java - Using a queue to solve TSP (Branch and Bound) -

i'm working on branch , bound algorithm traveling salesman problem , i've run little hitch. i'm using pretty standard queue nodes representing subsets of vertices (paths). i'm pretty sure have whole thing worked out, @ moment have public class queue, , underneath private class node, of properties: current path, lower bound, etc. however, in main program, initialize queue of nodes , create 2 starting nodes, error "node cannot resolved type". assumed because within queue class , not accessible main program, when move out, errors everywhere else on items connected node. i hope makes sense, i'm not sure how else explain it, else seems fine. here's snippet of code clarification: `public class queue<item> implements iterable<item> { private int n; // number of elements on queue private node first; // beginning of queue private node last; // end of queue // helper linked list class public class node {

google app engine - authentication redirect with offline webapp (gae python, html5) -

to gae+html5 gurus out there :) when user logs on gae hosted application, credentials stored locally in cookie (correct?). after cookie expires (e.g. if users hits logout on browser tab), no login_required protected methods work. regular webapp require re-authentication next time user navigates login_protected url automatically redirecting login screen. what right way cached webapp handling this? my test simple login_protected page accessed chrome , ios browser. it's cached , accessible offline expected. then, (while online) , after authentication expires, server log shows 302 response followed 200 response of authentication dialog page, of course no authentication happens. thanks! if using google authentication provide access page . means if logged in 1 of other google services. cookie still exists in browser. login_required assume logged on based on cookie. seeing redirection google's page that's 302. if want can manage sessions on own , chec

asp.net - dependency injection using unity on custom session store provider -

i made custom sessionstatestore provider, dependencies not resolving. used unity di. i googled lot problem , got useful hints, still can't right. the providers constructed , managed framework, , there no opportunity intercept construction provide additional dependency injection override initialize() method in custom provider, , dependency injection there there's similar problem , decent solution here , here (structuremap, not unity), can't right. please help. thanks. providers painful things . there's no nice way address problem, practical way handle provider composition root - in other words, if entry point of application. within provider can compose of services. if use di container (like unity) can store container instance in httpcontext , there compose object graph within provider.

.net - WCF: Using the same code for SOAP and JSON implementation? -

i have taken on development on .net wcf project. among other things, project contains 3 files: iapi.cs <= defining interfaces jsonapi.svc.cs <= implementing interface json soapapi.svc.cs <= implementing interface soap the 2 implementation files identical - @ least code in implementation of methods identical. quite new wcf programming, strikes me odd, need duplicate code, implement json soap. is there way merge 1 implementation , let framework decide if data transported soap or json? / carsten defines 2 endpoints, same contract service implementation. defines first use soap, second use json : <service name="yourservice"> <endpoint address="rest" binding="webhttpbinding" contract="iyourservice" behaviorconfiguration="restbehavior"/> <endpoint address="soap" bindi

java - How to use Ant to download/unpack jars from a single list of jars? -

how can use ant download , unpack java jars while specifying list of jars once? key here having 1 list of jars , generating: a list of urls download task a classpath/fileset of same jars locally i'd specify list of jars once. <property name="dependency.lib.dir" location="dependencies" /> <mkdir dir="${dependency.lib.dir}" /> <get dest="${dependency.lib.dir}"> <url url="http://server1/lib1.jar"/> <url url="http://server2/lib2.jar"/> </get> <fileset id="dependency.libs" dir="${dependency.lib.dir}"> <include name="*.jar" /> </fileset> <path id="project.debug.classpath"> <fileset refid="dependency.libs" /> </path> you can add additional sub-elements <path> if have local lib directory.

php - Youtube or Flash File audio extraction? -

hey everyone, wondering if there current class or library in web language (php, perl, etc.) able extract audio flash files or youtube links directly. thanks time! the easiest way extract audio video use ffmpeg . there php extension available, have found easier (due installation woes) call binary directly exec() . here great tutorial stripping audio video file: http://howto-pages.org/ffmpeg/#strip from tutorial: ffmpeg -i mandelbrot.flv -vn -acodec pcm_s16le -ar 44100 -ac 2 mandelbrot.wav now if "flash files" mean swf, matter entirely.

visual studio 2010 - How to perceive in code if developer pressed F5 or Ctrl-F5 -

how can perceive in code (c#) if developer pressed f5 or ctrl-f5 prior execute solution in vs2010? if (f5pressed) {do something} else {do other thing} static void main(string[] args) { if (system.diagnostics.debugger.isattached) console.writeline("f5"); else console.writeline("ctrl f5"); string s = console.readline(); } this works in general case, not asked for. other debuggers attached, if run exe double clicking report crtl f5 pressed.

JSF Datatable and SelectBooleanCheckBox -

i have scenario have give option user select applications , related profiles. user should select @ least 1 application , 1 profile , can select more one. each application has own profiles , there can multiple applications. userbean has list of applicationvo , applicationvo has isselected (boolean), application id (int), application name(string) , profile list. profile list has list of profilevo , profilevo has isselected(boolean), profile id(int) , profile name(string). i new jsf , tried use datatable , selectbooleancheckbox works fine. @ point not sure how validate , display error message in same jsp remaining user entered data intact. not sure how update bean options checked/unchecked user. when user clicks submit validations should be: at least 1 application should selected if application selected, @ least 1 profile should selected profile check boxes should disabled until application selected when user unchecks application check box, profiles check box should disabled

php - Callback function -

i have callback function function loops through comments of article in blog. tried switch "threaded/nested" comments , therefore extended callback function. far works, can't rid of feeling, didn't write according best php-practice (and performance). i use css framework , have math .span-xy classes assign single comments. start input value global constant , output eg. span-12 parent comment. have reduce/rise value per +/- (int) 1 every level of nesting. came building arrays, counting them, iterating through , building temp arrays every comment. question: there easier way around this? <!-- final html mark-up output: list of comments (threaded/nested) --> <ul> <li id="1" class="push-<?php echo $push; ?> span-<?php echo $span; ?>">comment - parent</li> <li id="2">comment - child of #1 <ul class="children"> <li id="3">comment -

c# - Parsing a regex -

i having trouble writing regular expression in c#; purpose extract words start '@' given string can stored in type of data structure. if string "the quick @brown fox jumps on lazy @dog", i'd array contains 2 elements: brown , dog. needs handle edge cases properly. example, if it's @@brown, should still produce 'brown' not '@brown'. something c#: string quick = "the quick @brown fox jumps on lazy @dog @@dog"; matchcollection results = regex.matches(quick, "@\\w+"); foreach (match m in results) { literal1.text += m.value.replace("@", ""); } takes care of edge case too. (@@dog => dog)

iframe - facebook app all integrated in one page (no reloading) -

i developing ui facebook app. basically, game shown on canvas page , has navigation in tab form. what need when user clicks "friends" invite people, page show on game(the game still in background, , running should be). page must not reload. placed url of friends requests in src of <iframe> , using jquery hide/show divs problem <iframe> contain header, footer , facebook.com, want content because user on facebook. there better approach i'm doing? how accomplish this? a visual example navigation of "city of wonders" facebook app. you'll need write server side script uses facebook api list of friends. generate html necessary display , use information. also, instead of using <iframe></iframe> you use <div> , , use javascript populate it's innerhtml (via ajax).

swing - Best way to view/edit a property file in Java GUI? -

i trying create gui tool edit few property files, each property file contains large amount of lines. what's best swing controls in java should use in order load these property files. thanks, you present editable jtable 2 columns, 1 property key, 1 property value

In java, what's the relationship between field and class? -

please refer api. link is: http://download.carrot2.org/stable/javadoc/org/carrot2/text/preprocessing/pipeline/completepreprocessingpipeline.html class completepreprocessingpipeline field summary documentassigner documentassigner document assigner used algorithm, contains bindable attributes. then found example using completepreprocessingpipeline way completepreprocessingpipeline().documentassigner()exactphraseassignment(true) i not understand relationship between "completepreprocessingpipeline" , "documentassigner" in terms of "field vs.class". a class contains fields. instance of class have fields. http://download.oracle.com/javase/tutorial/java/javaoo/classes.html in first example, bicycle class has 3 fields cadence, dear , speed. this standard java code structure, nothing special it. suggest learn java , javadocs may make more sense.

jquery - Open Colorbox on page load -

i have been trying make colorbox work on page load, can see loading plain background. used code $.fn.colorbox({id:'', title:'',open:true}); you can find demo here http://www.bloggermint.com/demos/popupsub/colorbox/example5/index.html edited: <script type="text/javascript"> $(document).ready(function(){ $.colorbox({width:"30%", inline:true, href:"#subscribe"}); }); </script>

vb.net - LINQ-to-SQL Generic GetByIDs method -

i'm using object it's primary key value. i'm trying find way create similar method getbyids can pass ienumerable(of object) , ids.contains(pk), there's no contains expression. anyone know how this? public function getbyid(of t class)(byval pk object) t dim itemparam = expression.parameter(gettype(t), "item") return gettable(of t).single( expression.lambda(of func(of t, boolean))( expression.equal( expression.property(itemparam, getprimarykeyname(of t)), expression.constant(pk) ), new parameterexpression() {itemparam} ) ) end function public function getprimarykeyname(of t)() string return mapping.gettable(gettype(t)).rowtype.identitymembers(0).name end function you need use expression.call update - different overload expression.call(typeof(enumerable), "contains", new type[] { expressi

python - Sqlalchemy: Get some columns aliased -

i have question i'm sure it's quick answer, haven't been able find googling... i have class product defined declarative sqlalchemy: class product(declarativebase): __tablename__ = "products" _brand = column("brand", unicode(128)) _series = column("series", string(128)) _price = column("price", float) _description = column("description", unicodetext) _manufacturerid = column("manufacturer_id", integer, foreignkey("manufacturers.id"), key="manufacturerid") _manufacturer = relationship("manufacturer", uselist=false, backref=backref("_products", collection_class=set) ) and a point, want columns of products, such _brand , _manufacturerid, instead of retrieving named _manufacturerid want called _manufacturer (mainly "hide" relationship thing). i don't know how that... like: session.query(product.prod

mysql - Explain inexplicable deadlock -

first of all, don't see how getting any deadlock @ all, since using no explicit locking, there's 1 table involved, there's separate process each insert, select, , update rows, 1 row inserted or updated @ time, , each process (perhaps once minute) runs @ all. it's email queue: create table `emails_queue` ( `id` varchar(40) not null, `email_address` varchar(128) default null, `body` text, `status_time` timestamp not null default current_timestamp on update current_timestamp, `status` enum('pending','inprocess','sent','discarded','failed') default null, key `status` (`status`), key `status_time` (`status`,`status_time`) ) engine=innodb default charset=latin1 the generating process, in response user action every 90 seconds, insert table, setting status "pending". there's monitoring process every minute checks number of "pending" , "failed" emails not excessive. takes less

jquery - Page loading bar until the entire page has loaded? -

possible duplicate: loading bar while script runs hi, have page has alot of images , wondering if there way delay display of images until entire page has loaded, loading bar maybe, using jquery? great thankyou. sure easy jquery. use window.load event determine when images loaded, show content: html <html> <body> <div id="loading"></div> <div id="container"> <img src="http://www.playirishlottery.co.uk/wp-content/uploads/image-2.jpg"/> </div> </body> </html> jquery $(window).load(function() { //show(); }); function show() { $('#loading').hide(); $('#container').fadein(); }; settimeout(show, 3000); in above example i've used settimeout demonstrate. in reality remove , uncomment show() in in .load function fiddle: http://jsfiddle.net/xm6v9/

Parallelize downloads across hostnames and Django -

i want achieve speed load of images. don't know this, please read here . is there django can me regarding this, in way ? i'm thinking how automatize url creation static content. i'm follow next pattern: <script src="{{static_url}}scripts/jquery.js" type="text/javascript"></script> i first thought sequentially set static_url "http://cdnx.mydomain.com/", x numbers 1 4, break caching, because have no guaranty that, example, jquery served cdn2. or wrong ? any ideas ? you want custom template tag take care of looping, , store information in user's session. use cache backend this, you. may this: last_cdn=4 cdn_format = "http://cdn%s.mydomain.com/%s" @register.simple_tag(takes_context=true) def cdn_url(context, url): request = context['request'] ## assumes request in context. current_cdn = request.session.get('current_cdn', 0) current_cdn += 1 if current_cdn > last