Posts

Showing posts from April, 2013

rest - How do you RESTfully Create and Delete at the Same Time? -

let's have trip planning application, , each trip composed of "path" resources (representing route driven, example) composed series of points. can crud these resources using requests (just example): post /trips/1234/paths <path> <point>32,32</point> <point>32,34</point> <point>34,34</point> </path> delete /trips/1234/paths/3 now consider want able split path 2 paths. in aobve example, might want pick point (32,34) split on, result in 2 paths - 1 ends @ point, 1 starts @ point. means single action creates 2 new resources, , simultaneously, deletes (the path split). so if path in example above path in system, , split single call, system contain 2 new paths , original gone. example: <path> <point>32,32</point> <point>32,34</point> </path> <path> <point>32,34</point> <point>34,34</point> </path> i'm struggling how handled r...

Linq To Entities using a view is returning duplicated values -

i using linq on view in sql server database. concrete sentence following: var valoresfiltrados = context.vdonotuse_v2.select(donotuse => donotuse).where(donotuse => donotuse.platformvalue.equals(platform) && donotuse.bank.equals(bank) && donotuse.languagevalue.equals("cze_cz")).orderby(donotuse => donotuse.id); where vdonotuse view's entity. sentece returning duplicated values (the first ids example 12170, 12171, 12170, 12171, 12204...) , values not ordered, can see in example. however, if use sqldataadapter following sentence (which sure equivalent linq one), works , returns correct values: "select * vdonotuse_v2 platformvalue = '" + platform + "' , bank = '" + bank + "' , languagevalue = 'cze_cz' order id asc" of course, both of them using same connection , database. does knows why happening? you need make sure have set entity keys in entity datamodel view correctly. fi...

git - Get url of current path in Terminal SSH -

i having trouble using git on own server. having trouble add origin path (remote add) entering wrong url. finding out correct path .git repository on server, should able enter remote add , should find git repository. so, know how can current path of folder browsing via ssh? thanks if remote host unix-like, type pwd .

objective c - Makes pointer from integer without a cast warning in singleton int -

objective-c, xcode ios in class, want assign singleton integer's value. right have: [exglobal sharedmysingleton].tetracountex = tetracount; i've got warning before, , have been able resolve it, seems have different letting compiler know tetracountex integer. don't know how. that error result of trying store number pointer. out posting code how tetracountex declared can guess problem is. on reason may tetracountex defined nsnumber , if case use [exglobal sharedmysingleton].tetracountex = [nsnumber numberwithint:tetracount]; //or numberwithinteger: or appropriate type and other reason may accidentally declaring tetracountex pointer //remove * if case @property(nonatomic, assign) int *tetracountex;

java - Problem with tree into jboss -

i've application works fine @ seam 2.2.20... jboss 4.2.3 , richfaces 3.3.1. problem need use jboss 5.0.0 , when use tree brokes.. so, said, have rich:tree e rich:recursivetreenodesadaptor and works @ jboss 4.2.3 doesnt @ 5.0.0. when use jboss 5.0.0 tree loads, error caused by: java.lang.classcastexception: org.richfaces.component.html.htmltree cannot cast org.richfaces.component.html.htmltree i've tryed use tree primfaces, , happens same... work @ jboss 4.2.3 doesnt @ jboss 5.0.0 "same" error... caused by: java.lang.classcastexception: org.primefaces.model.treenode cannot cast org.primefaces.model.treenode its jboss configuration couldnt find @ google... someone knows reason problem?

Why does Go use its own Code generator? -

the current, official compiler go (http://code.google.com/p/go/) uses handcrafted, arguably arcane code generator, includes injecting custom sections elf binary. this approach has spawned quite few bugs related utilities directly read and/or write elf information, such ldd , objdump or strip . i believe have been prevented using welltested crossplatform code generator, such llvm, , use linking facilities shipped os, such ld on unix/linux (or ld.exe on windows w/ mingw), or link.exe on windows visual studio. so why go use own code generator? reinventing wheel? or there more important reasons behind it? for information on how use gccgo, more traditional compiler using gcc end, see setting , using gccgo . the go language specification compiler agnostic. can choose available compilers, write 1 yourself, or contribute llvm go frontend project. for historical perspective on go compiler technology, read answer question: what compiler technology used build compiler...

c# - Saving Insertions into a database -

i updating database using c# & sql. when insert value table exists in table until close connection. how save values inserted? here code using: conn = new system.data.sqlclient.sqlconnection(); conn.connectionstring = "data source=.\\sqlexpress; attachdbfilename=|datadirectory|\\unmapped.mdf;integrated security=true;user instance=true"; string sql = "insert unmappedteamstable values ('value1', 'value2', 'pw')"; sqlcommand insertcommand = new sqlcommand(sql, conn); conn.open(); insertcommand.executenonquery(); conn.close(); thanks set brakepoint , see if query running or not. i think code not executing properly.

Paravirtualizing linux on an ARM platform -

i want learn how port linux arm platform, , wondering if guys have tips or resources on how that? writing boot file setting interrupt vector, writing linker script , having executable system running. i thinking of buying developer board learn this, maybe beagle board uses arm cortex processor , has big user community. idea? not familiar linux or porting operating systems in general, tips on how started nice! what want in end virtualize linux kernels privileged operations run in hypervisor. have hypervisor run beneath freertos. freertos privileged operations (very few operations) have been changed trap hypervisor generating swi interrupt leads hypervisor. want extend linux instead more complex , alot bigger. best regards mr gigu i start here... http://elinux.org/beagleboard from have seen, beagle board seems 1 of supported boards 'community-wise' @ level. as far questions goes, not totally sure is. if diving embedded os , linux stuff , want have fun, ...

iphone - Why doesn't my view reload? -

so have 2 search bars, couple of buttons , tableview below (yes, these) in 1 view. , have navigation bar on top of button. for particular operation, remove search bars, buttons , display 1 uitableviewcell in view. if press edit, want whole view reloaded, not tableview want view have search bars , buttons , navigation screen. i did [self.view reloadinputviews] in ibaction of edit button. control goes here, view not reloaded. why? reloadinputviews used views firstresponders. self.view not first responder @ time. why want using "reloadinputviews", wouldn't easier use: [self.view setneedslayout] ?

javascript - jQuery looping through .children of .children -

i've been looking on asked questions , can't seem find solution scenario... i'd able loop through children , children of children, etc... the markup design looks similar this <div> <div> <label></label> </div> <div> <label></label> </div> <div> <label></label> </div> </div> i'd able select labels within specific div, regardless of direct parent. i'd able select labels within specific div, regardless of direct parent. it's css selector notation . assuming <div> has id of mydiv : $('#mydiv label').each(function () { // stuff });

(Are there) PERFORMANCE advantages of python socketserver over regular socket object? -

thanks interesting responses far. in light of said responses have changed question bit. guess need know is, socketserver opposed straight-up socket library designed handle both periods of latency , stress, i.e. does have additional mechanisms or features justify implicitly advertised status "server," or easier use? everyone seems recommending socketserver i'm still not entirely clear why, opposed socket. thanks!!! i've built server programs in python based on standard socket library http://docs.python.org/library/socket.html i've noticed seem work fine except without load have tendency go sleep after while. guess may not issue in production (no doubt there plenty of other issues) would know if using right code job here. looking around saw python provides socketserver library - http://docs.python.org/library/socketserver.html the socket library provides ability listen multiple connections, typically...

asp.net - CommandField: Can I prohibit Update and Cancel when Edit clicked -

i using vs2010, .net 4. first column in gridview commandfield on initial rendering shows edit delete , set default linkbuttons. when edit clicked have popup form when accepted updates database. problem commandfield shows update , cancel dont want. is there way prevent update , cancel when edit clicked. thanks in advance help. this partial gridview: <asp:gridview runat="server" id="lstcomponents" width="100%" borderwidth="1px" borderstyle="none" enableviewstate="true" autogeneratecolumns="false" datakeynames="componentid,componentname,componenttype,ipaddress" cellpadding="0" cellspacing="0" onrowdatabound="lstcomponents_rowdatabound" allowsorting="false" headerstyle-cssclass="listheader" headerstyle-forecolor="white" onselectedindexchanging="lstcomponents_selectedindexchanging" onrowediting="lstcomponents_rowediting...

model view controller - web development - MVC and it's limitations -

mvc sets clear distinction between model, view , controller. for model, adays, web frameworks provides ability map model directly database entities (orm), which, imho, end causing performance issues @ runtime due direct database i/o. the thing is, if that's case, why model orm pupular , every web frameworks want support either organically or not. to web site has huge amount of traffic, won't work. what's work around? connect directly database not wise solution here. what's question? is idea use direct db access webpages? a: no. is idea use orm's? a: debatable : see how can design java web application without orm , without embedded sql is idea use mvc model? a: yes - has nothing "direct" database access - it's separating application logic model , display. (put simply). and rationale not putting database logic inside webpages has nothing performance - it's security/maintainability etc etc. calling usp webp...

php - Generate and save a custom cookie on the serverside -

i generate cookie (on server side there won't browser) specific name/values , save in text file (e.g fopen ). later i'm planning to use cookie curl . problem don't understand what's cookie format , how should save . when on cookies saved curl have # netscape http cookie file # http://www.netscape.com/newsref/std/cookie_spec.html # file generated libcurl! edit @ own risk. www.example.com false / false 0 asp.net_sessionid 3ddldk5iccxrj45fsl2ctrd www.example.com false / false 32522347 sccouscix 548913113 i don't understand spaces , method should use generate working cookie . proof of concept generate simple cookie name : exampleid , value 000000000 exampleid 000000000 / www.example.org update make sure question understood: need generate custom cookie not 1 curl generated other websites. found original netscape cookie specification on curl website http://xiix.wordpress.com/2006/03/23/mozilla...

uinavigationcontroller - adding nav controllor to tabbar controllor iPhone -

i have tabbar controllor , trying add navigation each control. in xcode 3 able change controllor nav controllor in attribute inspection. how in xcode 4? there couple of ways this. can either in ib or allocate view controller specific tabs. na. these. just create new classes subclass of navigation controller go specific tabs in ib, , assign class respective class it's view. example. tab 1, click tab1 , select class mynavigationcontroller (which should subclass of uinavigationcontroller ).

c# - Async operation completes, but result is not send to browser -

i want implement webchat. the backend dual wcf channel. dual channel works in console or winforms, , works on web. can @ least send , receive messages. as base used this blog post so, async operation completes. when debug result, see messages ready send browser. [asynctimeout(chatserver.maxwaitseconds * 1020)] // timeout bit longer internal wait public void indexasync() { chatsession chatsession = this.getchatsession(); if (chatsession != null) { this.asyncmanager.outstandingoperations.increment(); try { chatsession.checkformessagesasync(msgs => { this.asyncmanager.parameters["response"] = new chatresponse { messages = msgs }; this.asyncmanager.outstandingoperations.decrement(); }); } catch (exception ex) { logger.errorexception("failed check messages.", ex); } } } public actionresult indexcompleted(chatresponse response) { try { if (response != null) { ...

console java wizard framework? -

i want create console wizard (analog of existent ui wizard users not have x-server installed). should like: select language: [e] english [i] italian [r] russian can use kind of library or simple should write myself scratch? the charva project might close looking for. it renders full java gui in nothing ascii characters. here few screenshots .

python - Improve subplot size/spacing with many subplots in matplotlib -

Image
very similar this question difference figure can large needs be. i need generate whole bunch of vertically-stacked plots in matplotlib. result saved using figsave , viewed on webpage, don't care how tall final image long subplots spaced don't overlap. no matter how big allow figure be, subplots seem overlap. my code looks like import matplotlib.pyplot plt import my_other_module titles, x_lists, y_lists = my_other_module.get_data() fig = plt.figure(figsize=(10,60)) i, y_list in enumerate(y_lists): plt.subplot(len(titles), 1, i) plt.xlabel("some x label") plt.ylabel("some y label") plt.title(titles[i]) plt.plot(x_lists[i],y_list) fig.savefig('out.png', dpi=100) try using plt.tight_layout as quick example: import matplotlib.pyplot plt fig, axes = plt.subplots(nrows=4, ncols=4) fig.tight_layout() # or equivalently, "plt.tight_layout()" plt.show() without tight layout with tight layout...

pdf - What are my options to print an email to TIFF from Outlook via an addin? -

we have process @ our company processes tiff images. have project want able capture emails people have received , let them pass on our imaging process. right forwarding email isn't option our initial thought create outlook addin create , send image of email our internal webservice , work. i'm developing on windows 7 vs2010 , outlook 2007. i have basic addin framework setup - seems work ok. addin there, popping regular windows form can stuff. i'm running problems. first going leverage built-in microsoft office document image writer can write tiffs. however, doesn't appear installed part of office 2007 on windows 7. found references didn't work on win7 64bit in first place, , microsoft phasing out in favor of xps printer anyway. then moved on thinking maybe use pdfcreator. sort of works, except looks have have pdfcreator installed on client machine, too. hoping bundle dll , pdfcreator natively "print", seems rely on setting active printer ...

javascript - What/when does a call to the jQuery AJAX method return? -

a little background: i trying implement , ajax powered slickgrid. there isn't documentation used this example base . in example there following code hits desired web service data: req = $.jsonp({ url: url, callbackparameter: "callback", cache: true, // digg doesn't accept autogenerated cachebuster param success: onsuccess, error: function(){ onerror(frompage, topage) } }); req.frompage = frompage; req.topage = topage; i'm not sure jsonp does i've read appears similar ajax method in jquery except returns json , allows cross domain requests. webservice happen calling returns xml changed chunk of code to: req = $.ajax({ url: "/_vti_bin/lists.asmx", type: "post", datatype: "xml"...

Binding MySQL to local port over SSH - works in console, not via PHP shell_exec() in Mac OSX -

i running osx 10.6.7 , trying connect remote mysql server via ssh run php scripts. currently, run following commands no problem: ssh -i /users/xxxx/key.pem user@data.server.com -l 53306:localhost:3306 -f sleep 60 >> logfile mysql -u user -p -h 127.0.0.1 -p 53306 after authenticate password, works perfectly. (so long it's before sleep timeout, of course.) when run php script, however... $shell = shell_exec("ssh -i /users/xxxx/key1.pem user@data.server.com -l 53306:localhost:3306 -f sleep 60 >> logfile"); $mysqli = mysqli_connect('127.0.0.1', 'user', 'password', 'database', 53306); i connection refused. when omit shell_exec(), same error. when echo $shell, nothing outputted. key1.pem has chmod 400 permission, copy of key.pem, , ran chown _www on it. same errors if try use key.pem or key1.pem. tried 440 permissions no luck. thanks help; driving me nuts. why need password if you're using private key? ...

How to hide/show a control using AJAX (AjaxControlToolkit) and C# -

i know must sound basic i'm stumped here. i'm trying show hyperlink once process has completed. , process asyncfileupload. in aspx page, want create have hidden on initial page load. if set style="display: none;" seems work after file upload, nothing do, make control visible again. when file uploaded, calls function called fileuploadcomplete. it's in here no matter do, hyperlink won't display. any appreciated :) thank you, dave here aspx code (with added javascript) <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="optionsplaceholder" runat="server"> <script language="javascript" type="text/javascript"> function showlink() { $("#openfile").show(); } </script> </asp:content> <asp:content id=...

sql - MySQL not using indexes; using filesort -

mysql appears not using indexes , using filesort on following query: select `tweets`.* `tweets` (`tweets`.contest_id = 159) order tweet_id asc, tweeted_at desc limit 100 offset 0 i have indexes on contest_id, tweet_id , tweeted_at when execute explain extended , returns "using where; using filesort". how can improve query? when mix asc , desc sorting, mysql cannot use indexes optimize group by statement. also, using multiple keys sort result in not being able optimize query indexes. from docs: http://dev.mysql.com/doc/refman/5.6/en/order-by-optimization.html in cases, mysql cannot use indexes resolve order by, although still uses indexes find rows match clause. these cases include following: you use order on different keys: select * t1 order key1, key2; ... you mix asc , desc: select * t1 order key_part1 desc, key_part2 asc; if 2 columns ordering on not part of same key, doing both of ab...

Drop Down CSS Menu? -

i installed drop down menu on main menu bar , noticed something. h1 header directly below moves on page when activate drop down menu. it's drop down menu pushes text out of way because in way. header or text moves when drop down menu released. happens on other pages text below. causing , how can correct it? it's impossible 100% certainty without seeing markup, i'd guess nested list (ul) in menu doesn't have it's position set absolute. setting absolute takes out of flow of page appears above other content rather forcing content below down. show markup , can certain.

kernel - Question about writing my own system call in FreeBSD -

ok, finish reading implementation of kill(2) of freebsd, , trying write own "kill". system call takes uid , signum , sends signal processes owned uid, excluding calling process. how can pass uid system call? in kill(2), pid in argument struct kill_args . there structure contains uid way struct kill_args contains pid ? if not, can define structure outside kernel? it's easy, kind of involved process. here's module installs system call. include bunch of stuff #include <sys/types.h> #include <sys/param.h> #include <sys/proc.h> #include <sys/module.h> #include <sys/sysent.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/sysproto.h> define structure hold arguments struct mykill_args { int pid; int signo; }; define handling function static int mykill(struct thread *td, void *args) { struct mykill_args *uap = args; uprintf("mykill called. pid=%d, signo=%d\n...

python - Is there a more "Pythonic" way to combine CSV elements? -

basically using python cron read data web , place in csv list in form of: ..... ###1309482902.37 entry1,36,257.21,16.15,16.168 entry2,4,103.97,16.36,16.499 entry3,2,114.83,16.1,16.3 entry4,130.69,15.6737,16.7498 entry5,5.20,14.4,17 $$$ ###1309482902.37 entry1,36,257.21,16.15,16.168 entry2,4,103.97,16.36,16.499 entry3,2,114.83,16.1,16.3 entry4,130.69,15.6737,16.7498 entry5,5.20,14.4,17 $$$ ..... my code regex search , itterate through matches between ### , $$$, go through each match line line, taking each line , splitting commas. can see entries have 4 commas, have 5. because dumb , didn't realize web source puts commas in it's 4 digit numbers. ie entry1,36,257.21,16.15,16.168 is suposed be entry1,36257.21,16.15,16.168 i collected lot of data , not want rewrite, thought of cumbersome workaround. there more pythonic way this? === contents = ifp.read() #pull entries market data entry in re.finditer("###(.*\n)*?\$\$\$",contents): dataset = ...

search - Best way to pre-process text messages using Hadoop -

i using hadoop process text messages(sms). not sure of best way pre-process these data can efficient search. example, after preprocessing data if searches 'ny' able display messages containing word 'ny'. advisable write pre-processed data xml file , not database. note: have around 200k text messages in .csv file. the way import preprocessed data hdfs first import data (csv file in case) database , create table view fine-tunes needs. import data hdfs using sqoop. more information on sqoop can found here http://www.cloudera.com/blog/2009/06/introducing-sqoop/ for doing sqoop import database take @ http://archive.cloudera.com/cdh/3/sqoop/sqoopuserguide.html#_connecting_to_a_database_server

ConfigParser problem Python -

i'm having problem append config file. here's want create; [section1] val1 = val2 val3 = val4 but when run following code see configparser.nosectionerror: no section: 'section1' import configparser cfg = configparser.rawconfigparser() cfg.set("section1", "val1", "val2") f = open("example.cfg", "a") cfg.write(f) if add if not cfg.has_section("section1"): cfg.add_section("section1") and then, get; [section1] val1 = val2 [section1] val3 = val4 could point me i'm doing wrong? thanks i fleshed out code put bit. reading existing file before checking section? also, should writing whole file @ once. don't append. import configparser cfg = configparser.configparser() cfg.read('example.cfg') if not cfg.has_section('section1'): cfg.add_section('section1') cfg.set('section1', 'val1', 'val2') cfg.set('sectio...

How to execute a exe file using fitnesse -

i want call exe file in fitnesse test case. help me in calling exe file in test cases with fitnesse, you'll need write fixture run exe (and/or find fitnesse plugin you). easiest way write simple fixture , run runtime.getruntime().exec(<cmd>);

html - problem with border-collapse property in IE7 -

i have table 2 rows , 2 cols. 1st row: col1 = 2 spans col2 = 3 spans 2nd row: col1 = 3 spans col2 = 5 spans i have set border-collapse property of table collapse .i getting borders cells except last cell extends more 1st row.i tried using border-top-width:1px , still not display top boder last cell. please help. thanks ~anand do every td/th have content inside? mean not tags (spans), text. in browsers have such problems? does code this: <style> table { border: 1px solid #000; border-collapse: collapse; } th, td { border: 1px solid #000; } </style>   <table cellpadding="0" cellspacing="0"> <tr> <td>something></td> <td>something></td> </tr> <tr> <td>something></td> <td>something></td> </tr> </table> check styles applyed table , td's in firebug or developerstool....

Calling c++ object in callback function of c library -

i using c library, uses callback functions. is there way can access calling object of c++ class ? edit: i using c-client lib. have function mm_log. void mm_log(char* string, long err_flag) which getting internally called library. want check on imap stream getting called. more info can download library ftp://ftp.cac.washington.edu/imap all (good) c library functions want callback have void* user_data pointer part of function , callback parameter. pass pointer object function , gets passed in callback. example: typedef void (*callback)(void*); void dumb_api_call(callback cb, void* user_data){ cb(user_data); } struct foo{}; void my_callback(void* my_data){ foo* my_foo = static_cast<foo*>(my_data); } int main(){ foo my_foo; dumb_api_call(my_callback, &my_foo); }

php - Submit an array of values with SimpleTest -

i'm trying submit simple form has array of fields: <form> <input type='text' name='article[]' id='article1' /> <input type='text' name='article[]' id='article2' /> <input type='text' name='article[]' id='article3' /> so, how set different fields using simpletest? (p.s. i've seen question: simpletest php scriptable browser... how test submit form has [ ] in form name (basically in array format)? doesn't answer question). i figured out 1 way of doing use setfieldbyid. change code to: $form->setfieldbyid('article1', 'some article text 1'); $form->setfieldbyid('article2', 'some article text 2'); and on. works assumes can generate unique ids each field -- not difficult.

putc in c programming in files -

im creating own library on file handling make more flexible,but got stucked @ these point watch these below program int filewrite(char *filename,unsigned char number) { file *dill; if((dill=fopen(filename,"r"))==0) return(0);// error no such file exists returns 0 else { if(number==0) { dill=fopen(filename,"w"); while(number!='x') { number=getche(); putc(number,dill); } } else { dill=fopen(filename,"a+"); while(number!='x') { number=getche(); putc(number,dill); } } } } for instance made condition not equal x if enter x letter gets terminated, want used too.but condition put use letters numbers , special symbols when writing file becuase if hit enter goes next line not terminating , want use enter...

jquery - Clear javascript on dynamic load -

i have javascript plugin special image scroller. scroller contains bunch of timeout methods , lot of variables values set timeouts. everything works perfectly, site working on required pages loaded dynamically. problem when instance change language on site made jquery load function meaning content dynamically loaded onto site - , image slider aswell. now here big problem! when load image slider second time dynamically previous values remains timers , else. is there way clear in javascript plugin if page reload? i have tried lot of stuff far little appreciated! thanks lot! you might want reload scripts: <script class="persistent" type="text/javascript"> function reloadscripts() { [].foreach.call(document.queryselectorall('script:not(.persistent)'), function(oldscript) { var newscript = document.createelement('script'); newscript.text = oldscript.text; for(var i=0; i<oldscript.attribute...

python - Threading HTTP requests (with proxies) -

i've looked @ similar questions, there seems whole lot of disagreement on best way handle threading http. what want do: i'm using python 2.7, , want try , thread http requests (specifically, posting something), socks5 proxy each. code have works, rather slow since it's waiting each request (to proxy server, web server) finish before starting another. each thread making different request different socks proxy. so far i've purely been using urllib2. looked modules pycurl, extremely difficult install python 2.7 on windows, want support , coding on. i'd willing use other module though. i've looked @ these questions in particular: python urllib2.urlopen() slow, need better way read several urls python - example of urllib2 asynchronous / threaded request using https many of examples received downvotes , arguing. assuming commenters correct, making client asynchronous framework twisted sounds fastest thing use. however, googled ferociously, , not provid...

javascript - Pop up window opened from code behind is not getting closed -

i opening pop code behind(which using waiting image while processing) after doing activity in background ,when activity done closing pop . problem after activity on pop not getting closed. doing wrong, here code snippet:- system.text.stringbuilder sb = new system.text.stringbuilder(); sb.append("<script language='javascript'>"); sb.append("var win="); sb.append("window.open('waitingimage.aspx', 'wait',"); sb.append("'width=800, height=600, menubar=no, resizable=no');window.focus();<"); sb.append("/script>"); type t = this.gettype(); if (!clientscript.isclientscriptblockregistered(t, "popupscript")) { clientscript.registerclientscriptblock(t,"popupscript", sb.tostring()); } //pop opened.. processing :- uploadfiles(); ...

android - Street starting and ending point - lan/lat -

i searched 1 quite time: want when having lan/lat of "start" of street, lan/lat of "end" of street, possible using android location api? or using google maps api? and connected question is: can above info when having lan/lat of point on street(not "start/end" of street)?

cocoa touch - Accurate progress displayed with UIProgressView for ASIHTTPRequest in an ASINetworkQueue -

summary: want track progress of file downloads progress bars inside cells of tableview. i'm using asihttprequest in asinetworkqueue handle downloads. works, progress bars stay @ 0%, , jump directly @ 100% @ end of each download. details: set asihttprequest requests , asinetworkqueue way: [only extract of code] - (void) startdownloadoffiles:(nsarray *) filesarray { (filetodownload *afile in filesarray) { asihttprequest *downloadafilerequest = [asihttprequest requestwithurl:afile.url]; uiprogressview *theprogressview = [[uiprogressview alloc] initwithframe:cgrectmake(20.0f, 34.0f, 280.0f, 9.0f)]; [downloadafilerequest setdownloadprogressdelegate:theprogressview]; [downloadafilerequest setuserinfo: [nsdictionary dictionarywithobjectsandkeys:afile.filename, @"filename", theprogressview, @"progressview", nil]]; [theprogressview release]; ...

transactions - WCF service writes log only if client receives results -

i'm working on wcf service our new code interoperate legacy system. process goes this: client calls service request legacy system. service writes request database. legacy system services request db in own time , writes results db (updating status flag results ready ). client retrieves results calling second service method, polls db until ready flag set. just before returning results, service updates status flag client has results , related db rows can deleted. my concern race condition @ last step. can see happening: service updates status client has results . client times out after waiting service poll db. service tries return results. hilarity ensues. one way solve have 3 service calls instead of two: second call retrieves results, , last 1 explicit acknowledgement client has them. i'd know whether there way doesn't impose "protocol" burden on client though. i've looked briefly using transactions in wcf, , sounds might able need. clie...

python - How to retrieve the xml which has been created using the minidom? -

xml.dom.minidom import document def generatexml(): # create minidom document doc = document() # create <discover> base element discover = doc.createelement("discover") doc.appendchild(discover) # create main <host> element host = doc.createelement("host") host.appendchild(discover) # create main <ip> element ip = doc.createelement("ip") ip.appendchild(host) # assign <ip> element ip address ipaddrr = doc.createtextnode('10.193.184.72') ip.appendchild(ipaddrr) # create main <hostname> element hostname = doc.createelement("hostname") hostname.appendchild(host) # assign <hostname> element hostname hostname_value = doc.createtextnode('darknight') hostname.appendchild(hostname_value) # create main <ostype> element ostype = doc.createelement("ostype") ostype.appendchild(host) ...

c - xmlNodeGetContent introduces newlines -

it seems xmlnodegetcontent introduces newlines, there shouldn't be. this node dump: element td attribute width text content=100% attribute bgcolor text content=#ffffff element font attribute face text content=arial,helvetica element font attribute color text content=#0000ff element font attribute size text content=-1 element b element br text content= element hr element font attribute face text content=arial,helvetica element font attribute color text content=#0000ff element font attribute size text content=-1 element b text content=love element br text content= element ul element li element small element font attribute color text content=#ff0000 tex...

Initializing object variables - a Java approach, a Python approach? -

i have object needs have 4-5 values passed it. illustrate: class swoosh(): spam = '' eggs = '' swallow = '' coconut = '' [... methods ...] right now, way use swoosh is: swoosh = swoosh() swoosh.set_spam('spam!') swoosh.set_eggs('eggs!') swoosh.set_swallow('swallow!') swoosh.set_coconut('migrated.') i'm having doubts whether pythonic or java influence. or necessary? also, in case you're wondering why i'm using setters instead of accessing object variables - basic validation has done there, hence set_ methods. i reckon provide different way initialize swoosh - provide __init__() accept dict / list ? anyway, i'm looking help/advice more experienced stuff. thanks in advance input on this. firstly you're using old style classes. really, really should using new style classes inherit object : class swoosh(object): defining __init__ method takes argume...

javascript - Why is my JS random ints generator so wrong when I give him one negative and one positive number? -

so use such script random int generation inside of range function randominrange(start, end) { if ((start >= 0) && (end >= 0)) { return math.round(math.abs(start) + (math.random() * (math.abs(end) - math.abs(start)))); } else if ((start <= 0) && (end <= 0)) { return 0 - (math.round(math.abs(start) + (math.random() * (math.abs(end) - math.abs(start))))); } else { return math.round(((start) + math.random() * (end - start))); } } you can see @ work here . positive ranges correct, negative correct bad , wrong results mixed. why , how fix it? i try use formula math.round(start + math.random() * (end - start)); ok, found problem, you're performing algebra on strings (since in code $('fnt').value value of input box, string), not numbers, things + end concatenating strings , not adding numeric content. in particular example, have: math.round(((start) + math.random() * (end - start))) which evaluates...

search - Change XSLT of the SearchResultWebPart during the FeatureActivated -

i have piece of code changes xslt of searchresultwebpart @ sharepoint 2010 search center result page (spfileitem - spfile of search result page) : splimitedwebpartmanager wpmanager = spfileitem.getlimitedwebpartmanager(personalizationscope.shared); foreach (webpart wpitem in wpmanager.webparts) { if (wpitem coreresultswebpart) { ((coreresultswebpart)wpitem).uselocationvisualization = false; ((coreresultswebpart)wpitem).xsl = somexsl; wpmanager.savechanges(wpitem); } spfileitem.update(); spfileitem.checkin(consts.checkincomment, spcheckintype.majorcheckin); but, code doesn't work if called on feature activated (gives invalidoperationexception - incorrect object state). works in console application. after reflecting, found out there piece of code inside searchresultwebpart, checks if webpart wasn't initialized - throws mentioned above exception on setting xsl property. know how work problem out? me it'd quite convenient xsl change @ featureac...

svn - TortoiseSvn symbolic links to seperate folder in repository -

im not sure if title describes asking ill give shot here: what have -mysvnrepository +    project 1 folder +    project 2 folder -     shared file folder -        toolkitdefinitions.cs what looking for -mysvnrepository -    project 1 folder -        symoblic link toolkitdefinitions.cs -    project 2 folder -        symoblic link toolkitdefinitions.cs -     shared file folder -        toolkitdefinitions.cs the point have dll maintaining in want coworkers have latest versions without having seprate copies in project 1, project 2, project 3... etc. is possible? i'm not 100% sure understand right, think want can done using externals - @ least on directory level, not files though. s...

syntax - What does a := (colon equals) in VB.NET do? -

possible duplicate: what use of := syntax? i've tried hunting down mdsn documentation := in vb.net scoured google linked dead msdn page... purpose of := be? it names arguments, allowing call method arguments in order other specified in method definition. for example: sub foo (byval x long, byval y long) debug.print (string.format("{0}, {1}", x.tostring, y.tostring)) end function can called order of arguments reversed using names: foo (y:=999, x:=111) prints: 111, 999 this useful when have long list of optional arguments, want specify few of them, , want specify not first ones.

objective c - Multiple Substrings in String -

i´m working on app displays 6 pictures website. these pictures change on time extracted sourcecode of said website , managed pull first of 6 pictures code: nserror *error = nil; nsstring *deviantstringpopular; deviantstringpopular = [nsstring stringwithcontentsofurl:[nsurl urlwithstring:@"http://browse.deviantart.com/?order=24"] encoding:nsisolatin1stringencoding error:&error]; nsstring *popularcontent; nsrange popularurlrange1 = [deviantstringpopular rangeofstring:@"super_img=\""]; nsrange popularurlrange2 = [deviantstringpopular rangeofstring:@"\" super_w"]; int lengt = popularurlrange2.location - popularurlrange1.location - popularurlrange1.length; int location = popularurlrange1.location + popularurlrange1.length; nsrange endrange; endrange.location = location; endrange.length = lengt; popularcontent = [deviantstringpopular substringwithrang...

php - Notice: Undefined offset: 0 in -

i getting php error, mean? notice: undefined offset: 0 in c:\xampp\htdocs\mywebsite\reddit_vote_tut\src\votes.php on line 41 from code: <?php include("config.php"); function getallvotes($id) { $votes = array(); $q = "select * entries id = $id"; $r = mysql_query($q); if(mysql_num_rows($r)==1)//id found in table { $row = mysql_fetch_assoc($r); $votes[0] = $row['votes_up']; $votes[1] = $row['votes_down']; } return $votes; } function geteffectivevotes($id) { $votes = getallvotes($id); $effectivevote = $votes[0] - $votes[1]; //error thrown here return $effectivevote; } $id = $_post['id']; $action = $_post['action']; //get current votes $cur_votes = getallvotes($id); //ok, update votes if($action=='vote_up') //voting { $votes_up = $cur_votes[0]+1; //and error thrown here $q = "update threa...

java - Big O - for anew beginner -

possible duplicate: plain english explanation of big o i asked knowledge of how use big o notation , stumped because had never come across big o before. have read wikipedia page big o , looked @ of questions posted in stackoverflow don't understand. my question: can provide explanation of big o in simplest form , provide example of how use in following java method: public int getscore(int[] dice) { int[][] dups; dups = possibledups(dice); // set catscore (int[] : dups) { (int k = 0; k < i.length; k++) { if (i[k] > 0) { switch (i[k]) { case 1: catscore = category.ones; break; case 2: catscore = category.twos; break; case 3: catscore = category.threes; break; case 4: catscore = ...

html - PHP CodeIgniter CSS -

i downloaded html theme website , i'm trying put in codeigniter project. copy , pasted .html file downloaded theme folder view "index_v.php". copied css folder directly views folder. index_v.php file calls .css file this <link rel="stylesheet" href="style.css"> yet when load page doesn't load .css file. you're running issue relative paths. if url /users/welcome/ , it's looking file /users/welcome/style.css solutions: use full url: <link rel="stylesheet" href="http://example.com/style.css"> use ci's link_tag() prepend base url path use absolute path: <link rel="stylesheet" href="/style.css"> if unable access file directly, check .htaccess file if using it. ci installations use this: rewritecond $1 !^(index\.php|public|robots\.txt) rewriterule ^(.*)$ /index.php?/$1 [l] with rule, there 2 files , 1 directory allowed direct access (index.php, direct...

objective c - public objects and use of property -

i'm bit confused; if object declared in .h file considered automatically "public" right? use @property in .h file, however, edit them? don't understand: use getter/setter private objects, why use @property objects declared in .h file , considered "public"? second thing, found example: don't understand why use @synthesize primarykey in code: http://staging.icodeblog.com/wp-content/uploads/2008/08/9-todom1.png , why don't use @property database object? it not correct if object (ivar) declared in .h file, public. if getter/setter methods provided, otherwise not. indeed, @property / @synthesize directives facilities meant declare , define default getter/setter methods. so, instead of writing them yourself, use directives. it worth noting declaring properties possibility of using dot notation refer properties of objects. , clarify lot, retain / assign / copy specifiers, how memory meant managed properties. (and, of course, @syn...

entity framework 4.1 - Configuring EF code first without a foreign key -

i have following model: public class product { public long id { get; set; } public string name { get; set; } public virtual icollection<catalog> matches { get; set; } } public class catalog { public long id { get; set; } public string title { get; set; } } using entity framework code first configure using: public dbset<product> products { get; set; } public dbset<catalog> catalogs { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { // not rules setup yet } currently when ef creates database creates nullable foreign key in catalogs table called product_id. there way configure ef not create foreign key in catalog table? the catalog table contains imported items catalog should have no relation products table. @ run time search query fired each product , result added catalog collection of product object. for purpose exclude matches collection model, either data annotation... public class ...

javascript - How to trigger a delayed jQuery event? -

i'm writing workaround web form. given problem hitting submit pops out loading animation. content saved, form still shown, loading animation. the idea trigger event, 2-3 seconds after submit click, reset form content , hide loading animation. how suggest approach this? thank you. use callback functions in events chain them - way make sure action has completed, instead of trying run of them @ same time. if post code can more. there's .delay() function, think callbacks more appropriate, because process event driven , not time driven. have more flexibility in case in process goes wrong, instead of statically resetting after click.