Posts

Showing posts from June, 2011

objective c - How do i navigate to another view through a button in a NSTableCell? -

i have got button in custom table cell, want navigate view. view has different view if press tablecell. has solved before? you can push view in button click event eg: [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes];

javascript - ie7 cookies not being blocked on my site -

i adding feature website client, showing div on login page if cookies disabled. first started testing within chrome, turned off cookies, , after if (document.cookies == "") { // show div tell users cookies disabled on machine. } everything works. in codebehind on page_load attempting set cookie protected void page_load(object sender, eventargs e) { response.cookies["test"].value = "test"; response.cookies["test"].expires = datetime.now.adddays(1); } all seems in chrome land. next, go on ie7, block cookies, , safety sake, delete history , cookies in case. expected see div didn't. so, added else if (document.cookies == "" ) { } read cookie in javascript , sure enough there test cookie. i went tools -> internnet options -> privacy tab -> , moved slider way top, 'block cookies'. in privacy tab, clicked 'advanced' button , set both first party cookies , third party cookies prompt. i...

xsd - XML Schema 1.1 Attribute Grouping Constraints -

in using xml schema 1.1, i'd define attribute group occurs entirely together, i.e. attributes in attributegroup either present or not-present. in following example, i'd <anelement> have both attributes ( attr_one , attr_two ) present or neither attribute present, never single attribute present. <attributegroup name="attrgroup"> <attribute name="attr_one" /> <attribute name="attr_one" /> </attributegroup> <element name="anelement"> <complextype> <attributegroup ref="attrgroup" /> </complextype> </element> as understand it, xml schema 1.0 cannot specify these attribute relationships (correct?). best way specify them in xsd 1.1? figure can use assert specify relationship, following: <element name="anelement"> <complextype> <attributegroup ref="attrgroup" /> <assert test="(@attr_one , @attr...

c# - Access to the value of a Custom Attribute -

ive got custom attribute: [attributeusage(attributetargets.method, allowmultiple=false, inherited = true)] class methodtestingattibute : attribute { public string value{ get; private set; } public methodtestingattibute (string value) { this.value= value; } } to used this: [methodtestingattibute("2")] public int m1() {return 3; } and dificulty take value of "2" of methodtestingattibute object result = method.invoke(obj, new type[] {}); // here return now want compare result value of method testingattibute. how can that? im trying go road without success: method.getcustomattributes(typeof(methodtestattibute), true)[0]... what access field of custoum attribute? var attribute = (methodtestingattibute) typeof (vehicles) .getmethod("m1") .getcustomattributes(typeof (methodtestingattibute), false).first(); console.writeline(attribute.value);

R: how to write a loop to get a matrix? -

thanks wonderful solution suggested diliop previous question. how pair-wise "sequence similarity score" ~1000 proteins? to build upon answer, tried write loop pair-wise "sequence similarity score" 1000 proteins following code. for (i in 1:1000){ score <- score(pairwisealignment(seqs[[i]]$seq, seqs[[i+1]]$seq, substitutionmatrix=blosum100, gapopening=0, gapextension=-5))} however, difficult me convert each score data.frame , list out score automatically? seq1 seq2 score seq1 seq3 score seq1 seq4 score .... seq1000 seq1000 score could expert give me more hints how 1000 x 1000 proteins? this appears task can expand.grid , apply: seqs <-c("seq1","seq2","seq3"); dat <- expand.grid(seqs,seqs, stringsasfactors=false) dat apply(dat, 1, function(seq) paste(seq[1], seq[2], sep="--") ) #[1] "seq1--seq1" "seq2--seq1" "seq3--seq1" "seq1--seq2" "seq2--seq2...

Drupal's category (taxonomy) name of article (node)? -

developing custom drupal's theme. contain custom node.tpl.php file. how can , print related taxonomy names of selected node? tnx in adv! edit: doh, apologies, i'm seeing drupal 7 tag, specifically. appears thread has possible solutions: http://drupal.org/node/909968 with d6 (not 100% d7) in node's template .php files (and similarly, in view or anywhere have access node's properties custom php, view or block), can use following: // returns array of taxonomy objects given node $tax_terms = taxonomy_node_get_terms($node); // prints each term name foreach ($tax_terms $tax) { print $tax->name; } also, there's few useful drupal functions cases this: // print_r's properties of given node, similar devel dpr($node); // using in above 'for' give properties of each taxonomy object dpr($tax); here's website lists few more of these functions.

xcode - Pass Variables to a Function in Objective C -

firstly, let me explain have googled this, , can't seem find clear answer this; believe because using incorrect terminology. i moving ball location in cocos2d/chipmunk ipad app this: // determine speed of target int minduration = 2.0; int maxduration = 4.0; int rangeduration = maxduration - minduration; int actualduration = (arc4random() % rangeduration) + minduration; nslog([nsstring stringwithformat:@"%d",actualduration]); // create actions id actionmove = [ccmoveto actionwithduration:0.2 position:ccp(location.x, location.y)]; id actionmovedone = [cccallfuncn actionwithtarget:self selector:@selector(spritemovefinished:)]; [ball runaction:[ccsequence actions:actionmove, actionmovedone, nil]]; [ball retain]; i want put piece of code function (perhaps called "method" in obj-c, ...

css - jquery mobile extra spacing on bottom of div -

getting unwanted spacing on bottom of divs. desire: - - - - - - - - - - - - - - - - - - - | | | | button1 | button2 | | | | - - - - - - - - - - - - - - - - - - - | title | - - - - - - - - - - - - - - - - - - - | | | page info.... | but i'm getting - - - - - - - - - - - - - - - - - - - | | | | button1 | button2 | | | | - - - - - - - - - - - - - - - - - - - 5px gap - - - - - - - - - - - - - - - - - - - | title | - - - - - - - - - - - - - - - - - - - | | | page info.... | note: wanted style background put before content div. <div data-role="page"> <style> .topwrapper{ width:100%;...

r - Why is a paleoTS function not working? -

i have loaded paleots in r (2.13.0) , tried use fit3models.joint function, can't. tried reinstalling assures me paleots there! appreciated: error: not find function "fit3models.joint" > utils:::menuinstallpkgs() warning: package 'paleots' in use , not installed not enough information yet. see no evidence fit3models.joint function in paleots package: did mean fit3models ... ? or fit3models(...,method='joint') (based on looking @ examples in ?fit3models ? install.packages("paleots") library("paleots") ls(pos=2) [1] "add.ou.curves" "akaike.wts" "as.paleots" [4] "as.paleotsfit" "cat.paleots" "comparemodels" [7] "fit3models" "fitgpunc" "fit.sgs" [10] "ic" "ln.paleots" "logl.co...

java - commons-httpclient removed port 80 from the Host header after executeMethod -

i created httpmethod specified host , port , execute httpclient.executemethod(). however, time host receive it, port truncated host header in http request. the host header information in httpmethod prior executing following: user-agent: me host: stackoverflow.com:80 at time received host: user-agent: jakarta commons-httpclient/3.1 host: stackoverflow.com i have seen posting can set user-agent in httpclient prior executing. but, i've tried host via hostconfiguration, , no luck. has seen problem before , resolved such host not change? this not happened when used other httpclient package, or when hit different port. found answer: how can override "host" header in request when using apache commons httpclient

how can i parse a string using c -

given below string char test[1000]="$gpgsa,a,3,14,20,22,25,31,32,,,,,,,2.4,1.4,1.9*3a $gpgsv,4,1,16,31,76,060,35,14,28,070,34,20,32,309,32,32,61,309,32*72\n $gpgsv,4,2,16,25,21,053,29,24,37,258,29,23,14,277,27,12,,,21*44\n $gpgsv,4,3,16,22,13,133,20,11,20,272,,16,11,161,,30,,,*4f\ n$gpgsv,4,4,16,29,,,,28,,,,27,,,,26,,,*7e\n $gpgga,150427.8,4001.022852,n,10505.269674,w,1,06,1.4,1559.6,m,-21.0,m,,*53\n $pqxfi,150427.8,4001.022852,n,10505.269674,w,1559.6,35.12,25.46,2.05*4a\n $gpvtg,nan,t,nan,m,0.0,n,0.0,k,a*23\n $gprmc,150427.8,a,4001.022852,n,10505.269674,w,0.0,,280611,,,a*50"; i want string "$gpgga,150427.8,4001.022852,n,10505.269674,w,1,06,1.4,1559.6,m,-21.0,m,,*53\n" from above big string using c language. please me out. you line want, didn't why. if line makes line after, comment on how you'd find it. but basically, you'll want separate string lines. can use strtok() break on \n . can examine l...

How can I create a backup of my Exchange emails? -

i have microsoft exchange account through college, , mailbox close full. i'd download messages local machine , archive them can access them later if needed. it seems me should using pop3, have no idea start. note: using ubuntu 11.04, can boot win7 if necessary. there free product called mailstore should trick. find @ http://www.mailstore.com

how to make php json decode pagination -

i looking php json pagination method/class. here code. how make each 2 json data group, pagination? $body = file_get_contents("out_file.txt"); $json = json_decode($body,true); foreach($json $data){ echo $data['name'].' '; } out_file.txt [ {"name":"text1","num":"1"}, {"name":"text2","num":"2"}, {"name":"text3","num":"3"}, {"name":"text4","num":"4"}, {"name":"text5","num":"5"}, {"name":"text6","num":"6"} ] i need divide data this: page1 text1 text2 page2 text3 text4 page3 text5 text6 json data not "display" medium... it's data transfer format. how pageination of data within json body you, that's true of data structure, not json. given sample json s...

Question about Google Analytics Tracking (w/ Rails) -

i've got google analytics setup on rails project, , i've got "a single domain (default)" selected tracking options. i've copied , pasted js code layout application. now, if use locally, analytics track local use well? the reason i'm asking we've been running tests on our dev computers using rspec, , there seems spike in analytics. these spikes seem show unique visitors. i'd appreciate insight on this. thanks! yes, track local visits well. should use ruby conditional statement exclude local conneciton. example, @ bottom of layout file <% if !request.local? %> source codes google analytics <% end %> this way, google analytics not printed if connection made local.

cruisecontrol.net - cruise control .net : xcopy not working for copying files to remote server -

i trying copy folder remote machine using xcopy. command executed via cruise control task. can run xcopy source destonremotemachine if running command prompt. if executing cruise control .net, complaining "invalid drive specification" error. i tried : > <exec > executable="c:\windows\system32\xcopy.exe"> > <basedirectory>$(base)\project</basedirectory> > <buildargs>.\*.* remotemachine\project /y</buildargs> > <buildtimeoutseconds>10</buildtimeoutseconds> > <successexitcodes>-1,0,1</successexitcodes> > </exec> and : <exec executable="c:\windows\system32\cmd.exe"> <basedirectory>$(base)\project</basedirectory> <buildargs>/c xcopy $(base)\project\*.* remotemachine /y</buildargs> <buildtimeoutseconds>30</buildtimeoutseconds> ...

java - Maven: Does project inheritance or aggregation better support this scenario? -

i porting project ant maven. project consists of core set of classes gets jar'd , used 3-4 other subprojects. importantly (i think?), core jar has own configuration gets set @ build time, , each subproject has configuration set @ build time. in old ant system, anytime built 1 of subprojects like... ant -dconfiguration=stage clean dist ...it build core jar using same (stage) configuration, , copy classes dir of subproject's build. i'd duplicate functionality using maven. reading i've done, seems maven can handle using either project inheritance or aggregation. chief differences between 2 methods, , recommend use case i've described? inheritance used sharing common things between projects, such 3rd party library dependency or properties, or scm locations. aggregation used build projects group. want aggregation, doesn't mean won't using inheritance factor out common stuff. update: keep in mind maven not building (unlike ant), dependency...

PHP Exceptions redirected to custom error page -

the functions have written throwing exceptions if can't job. productive environment thought redirect exception nice looking error page. therefore i'm thinking of setting exception handler set_exception_handler on beginning of every script. how error page know error occured? thought of putting error code url header("location: error.php?code=1234") . while in development phase not set exception handler, every exception printed onto php default error screen uncaugt exception: ... usefull informations. i have read exceptions in php - try/catch or set_exception_handler? don't know how write front controller script , think maybe effort. i'm php beginner likes handle errors in right way, i'm not sure if i'm doing right or wrong. think it's ok doing above described or have other suggestions? thank you! don't redirect. in exception handler function output error page @ point (or include php file includes error page html). want set ...

c# - How to tell ASP.NET not to insert in the request the value of a control? -

my question might sound strange, however, need do. consider having textbox, , want not go server side, must stay there, in client, control must not partecipate request. how this? thankyou you can't have server control doesn't post back. way use <input type="text"/> , put outside asp.net form. can't imagine want though. edit: it has occurred me use javascript move textbox outside asp.net form, leave <asp:textbox/> can set properties server side.

jquery - make divs load multiple times on page randomly -

let me give quick story. have made page. (very simple - 2 divs different background image, see here .) anyway, need make when new page loads, 2 divs have load in random order on , over, filling entire screen content. there's no pattern of first div , second, it's randomly generated. sort of huge grid, 2 divs repeated no pattern. my question is...is possible? assume i'd need know jquery, have no knowledge of it. can please help? thanks guys, appreciate everything! if want side-by-side, did it. check here: http://jsfiddle.net/ravan/x3fmc/ how wors: width , heigth of document, 2 loops (one top, other left) clone 2 initial divs , append page.

tortoisesvn - Creating multiple svn repos on single SVN Server -

i got svn server setup project good. need setup repository in same server project b. any guidelines please? you have installed server , setup project in it, believe in following manner: http://svn.exampel.com/repos/ | |- projecta | |- branches |- tags |- trunk to add repository in same server, go root directory , create folder structure this: http://svn.exampel.com/repos/ | |- projecta | |- branches |- tags |- trunk | |- projectb | |- branches |- tags |- trunk simple!. there no other configuration invoved , can start using them seperate repositories. called multi-repisotory layout . note: revision number shared both of these, i.e., revision number complete tree , there unified revision number both projects

ruby on rails - How to raise error if cap deploy was not invoked using bundle exec -

i encountered subtle issue capistrano deployment gem dependencies , enforce how capistrano invoked. how can detect capistrano invoked using 'bundle exec' this: bundle exec cap app deploy and not this: cap app deploy i raise error in latter case detecting method of invocation @ top of deploy.rb file. it appears bundler sets $bundle_bin_path , $bundle_gemfile environment variables when running executables. example, this: env >/tmp/1 bundler exec env >/tmp/2 diff -u /tmp/[12] you'll see differences in environment. so in deployment script, can this: abort "you must run using 'bundle exec ...'" unless env['bundle_bin_path'] || env['bundle_gemfile'] hope helps.

php - Return a row number from an ordered list with MySQL -

i'm working on implementing "high scores" section in game. high scores, i'm displaying top ten. no problem. problem want show user rank is. user ranked 300, there way mysql order list, find username, , somehow return how far down list or have copy entire database array or , count rows until hit user? well, if displaying top 10, think simplest , quickest way assign rank in php. so, fetch list of top 10 scorers in desc order of scores, read list php array , rank (array index + 1). however, if wish assign ranks users there way of doing this; used in 1 of implementations. i'm not sure though if there direct way of doing so. here: create temporary table, user_rank following columns: id pk auto_increment user_id rank smallint unsigned retrieve list of users in desc order of scores, top scorers on top store list step2 in temp table user_rank user_rank . id gives rank every user you may steps2-3 in same query, like: insert `user_rank` (`u...

javascript - Edge detection and removal -

i new image processing. developing web application. need take image (free hand drawings) , remove parts of it. example, take image of cat , remove except eye. p.s-> developing pictionary game based authentication system. requires user select image co-relating password, , morph detecting edges , removing parts of , store cue , display him, makes sense him , not attacker. edge detection done via process called convolution. there various convolution matrixes defined, 1 of edge detection. you're going have up, , how convolution in java: see java.awt.image.convolveop start. how remove 'everything except' question.

c# - Parallel ForEach, and Queues -

is possible have parallel each loop process items in queue such it: only removes items being processed pauses until new items added queue edit: in regards system.threading.tasks' parallel.foreach functionality subscribe queue using reactive extensions , execute each item in new task. won't have block or wait new item since pushed on subscribe lambda , execution/processing parallel. http://rxwiki.wikidot.com/101samples

android - nullpointer exception on connectivitymanager -

public boolean isonline() { connectivitymanager cm = (connectivitymanager) getsystemservice(context.connectivity_service); return cm.getactivenetworkinfo().isconnectedorconnecting();} i'm getting nullpointer on return cm.getactivenetworkinfo . i tried this.getsystemservice didn't work. maybe because activity extends super activity i've created , i'm grabbing context incorrectly...? tried getbasecontext() too with 2 methods chained on return line, sure it's connectivitymanager coming null? it's valid connectivitymanager.getactivenetworkinfo() return null instead of valid networkinfo object when there no active network. if comes null , call networkinfo.isconnectedorconnecting() throwing exception.

kohana 3.1 orm validation on updating user details -

i'm running update_user form through $user = orm::factory('user', $id)->update_user($this->request->post(), array( 'username', 'password', 'email' )); and pre-populating form fields username , email current user, , leaving password blank in-order 'unchanged' but on submission picking validation messages create_user 'user' model so i'm getting: "username taken" "email address taken" "password can't blank" does know how suppose round this? $user = $this->get_user(); if ( ! $user->loaded()) { throw new exception_deny; } if ($_post) { try { $user->update_user($_post, array( 'username', 'email', 'password', )); } catch (orm_validation_exception $e) { $this->add_errors($e);...

java - Spring with class.forname() -

if application managed spring container, can developer still use class.forname() create instance of particular class? or violate spring container , result in exception? yes can use it. resulting object not managed spring, however.

recursion - Recursive containers in C++? -

possible duplicate: are c++ recursive type definitions possible, in particular can put vector<t> within definition of t ? i looking through code , noticed data structure similar following: class treenode { std::vector<treenode> subnodes; }; as can see, container instantiated treenode before treenode has been defined. code compiles under both gcc , msvc, remember seeing saying not guaranteed behaviour. unfortunately can't find in standard discussing @ all. how such containers able implemented? behaviour guaranteed standard? if not guaranteed standard, alternatives have design? this fine because std::vector<t> class doesn't contain concrete instances of type t in it: it's typically implemented using pointers. template instantiation std::vector<treenode> not require full definition of treenode . std::vector<t> implemented triplet of pointers (though not required standard): template <typename t> cl...

php - Javascript Pop Menu (Twitter Style). Add Check in & Check out Callender in the form -

i know, how can add check in , check out date calender, in twitter styled sign pop menu ( http://aext.net/example/twitterlogin/# ). used menu in travel website, that's why need check in , check out dates.... thanks rod firstly, has nothing php @ all, it's plain javascript(jquery). there seldom jquery calendar plugins, http://www.overset.com/2008/05/12/multiday-calendar-datepicker-jquery-plugin/ or others. can't guess expecting calendar, standart "functions" surely included in of them.the choice of plugin on you. cheers

c# - Displaying a result in a textbox on a button click (ASP.Net) -

i new asp.net , simple scenario: currently in web application have 1 button , 1 textbox in web application. when click button want display result in text box. how should this? if you're using asp.net webforms can add click event handler button set text box's text: protected void button1_click(object sender, eventargs e) { mytextbox.text = "text display"; } you can either use autowireup event handler wired button, or explicitly assign event handler event in page_load() method. the easiest way assign event button declare in .aspx code this: <asp:button id="button1" runat="server" onclick="button1_click" text="button" /> it done automatically if doubleclick button in designer mode.

asp.net - What are possible architecture options for large scale web applications -

i assigned task develop large scale social web application facebook, twitter etc, using asp.net c# before development based on 3 tier architecture (i.e presentation layer, business logic layer, , data access layer) project confused because first large scale project :( i want know other possible architectural choices have? i know difficult answer such question, want have resource, study each possible option , finally, choose 1 suits requirement. did little rnd on internet didn't succeed much. you should check out windows azure. offers hosting, 3 types of scalable (but not relational) storage in form of blobs (or files / images / raw), queues (for distributed communication) , table storage (to maintain 'entity' data in non-relational manner). there sql azure relational storage , appfabric hybrid (on-prem/cloud) application addressibility , access control claims-based identity management. it has built-in diagnostics , if know c#/asp.net/asp.net mvc no...

regex - Using re module in python to extract data between two brackets -

this test string "transparent url(http://www.google.com/chart?chs=630x100&cht=bvs&chxt=x&chxl=0:%7c1840%7c1860%7c1880%7c1900%7c1920%7c1940%7c1960%7c1980%7c2000%7c&chxr=0,0,100&chxs=0,676767,11.3000002,0,tl,676767,676767&chd=e:d9aacpfjgwaagdlfcefgbvhllsczged5gokwdkcxjmf2fwfferfwezgcejhlenjdj9i0hqdje-mak2j9nmi9iaftnaioktgog2iykbfvlejmmlhdifhxg.iphrk2i9ulroi8sfhrftecirqpowxgphvxqkbcbhg8idwivkkety..aaaaaaaa&chbh=7,0,0&chg=11.11,0,5,6&chxp=0,0.0,11.1,22.2,33.3,44.4,55.6,66.7,77.8,88.9&chco=3366cc,bbcced&chm=r,bbbbbb,0,0.9954,1.0%7ch,bbbbbb,0,1.0,1.0,1&chxs=0,000000,11,-1&hl=en)" i want extract data in between 2 brackets - 1 after url in first line , closing bracket @ end- using re module of python jcomeau@intrepid:/tmp$ python python 2.6.7 (r267:88850, jun 13 2011, 22:03:32) [gcc 4.6.1 20110608 (prerelease)] on linux2 type "help", "copyright", "credits" or "license" more in...

drop down menu - How to set a value dynamically for dropdownlist in code behind C# -

i need set value "y" dropdownlist control dynamically.when tried selectedvalue gave error object reference null .plz help first make sure y there inside asp:dropdownlist . this if (dropdownlist1.items.findbyvalue("y") != null) { dropdownlist1.items.findbyvalue("y").selected = true; }

android - How to display sensor values -

how check whether there sensor type accerelerometer,magenetic compass in android emulator. whether there default sensor present in android emulator or need connect sensor simulator android emulator. import android.app.activity; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.os.bundle; //import android.widget.linearlayout; //import android.util.log; import android.widget.textview; public class sujaproactivity extends activity implements sensoreventlistener { sensormanager sensormanager ; private sensor accsensor; private textview outputx; private textview outputy; private textview outputz; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); sensormanager = (sensormanager) getsystemservice(sensor_service); accsensor = sensormanager.getsensorlist( ...

Haskell let in/where and if indentation -

i have function: issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x] filterlength = length ( filter (\z -> z == 0) derivelist .... after filterlength want check how filterlength, try: issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x] filterlength = length ( filter (\z -> z == 0) derivelist in if filterlength == 2 true i error: parse error (possibly incorrect indentation) failed, modules loaded: none. how can put indentation correctly if , in? thank you. this compile: issimplenumber :: int -> bool issimplenumber x = let derivelist = map (\y -> (x `mod` y)) [1 .. x] filterlength = length ( filter (\z -> z == 0) derivelist ) in filterlength == 2 main = print $ issimplenumber 5 ...

graphics - open source convert for .b3d model file -

is there tool converting .b3d .obj file or there specification .b3d model file? introduction on b3d file format can found here. http://www.blitzbasic.com/sdkspecs/sdkspecs/b3dfile_specs.txt , obj file format can easy searched using google.

.net - Good Resources on CorDbg & Mdbg -

i looking resources of information cordbg & mdbg debuggers in .net stuff msil(cil). i think msdn might resource learn stuff: coredbg mdbg compiling msil also, can try reading on of stuff on wikipedia: common intermediate language (cil)

web applications - Web app integrity under mysql heavy load -

we have machine heavy cpu load on myqsl process on server 1. our webapp on server 2 seemed bypass rights logic , expose data if no check done on db side. can app miss sql queries because db server under heavy load ? can mysql loose consistency ? probably not. more likely, application detected error database(maybe timeout), not handling error properly. check application exception handling logic carefully.

asp.net - Download (Excel Export) with Generic Handler without physically writing a file and without session variable possible? -

i have gridview , want on asp.net web application page , want export data excel. without updatepanels worked following code: httpcontext.current.response.clear(); httpcontext.current.response.addheader( "content-disposition", string.format("attachment; filename={0}", filename)); httpcontext.current.response.contenttype = "application/msexcel"; using (stringwriter sw = new stringwriter()) { using (htmltextwriter htw = new htmltextwriter(sw)) { // gridview stuff. // [...] // render htmlwriter response httpcontext.current.response.write(sw.tostring()); httpcontext.current.response.end(); } } with updatepanels no longer possible think have use generic handler (*.ashx). is somehow possible pass data generic handler without using session variables or way of doing this? i d...

python - Do all iterators cache? How about csv.Reader? -

we know following code loading data line-by-line rather loading them in memory. i.e. line alread read somehow marked 'deletable' os def filegen( file ): line in file: yield line open("somefile") file: line in filegen( file ): print line but there anyway verify if still true if modify definition of filegen following? def filegen( file ): line in csv.reader( file ): yield line how know if csv.reader cache data loaded? regards, john the reliable way find out csv.reader doing read source. see _csv.c , lines 773 onwards. you'll see reader object has pointer underlying iterator (typically file iterator), , calls pyiter_next each time needs line. not read ahead or otherwise cache data loads. another way find out csv.reader doing make mock file object can report when being queried. example: class mockfile: def __init__(self): self.line = 0 def __iter__(self): return self def next(self): ...

c# - EXcel VSTO - Transferring a list object onto a worksheet -

i have vsto add in looking implement. i click button , list of products, names, etc placed onto worksheet. i understand go through each individual item in list , write cell cell, there way of literally 'dumping' data onto worksheet? apologies if thick question. nope, there no easy way 'dump' data. you're going have hard way. google examples, it's easy enough. http://www.google.nl/search?q=c%23+export+data+to+excel

c++ - Template parameter deduction with function pointers and references -

possible duplicate: why qualifiers of template arguments stripped when deducing type? consider following c++ code: void f(int&); template <typename t> void tpl(void (*)(t), t); void bar(int& x) { tpl(&f, x); } compilation using gcc 4.6.0 fails following error message: fntpl.cpp: in function ‘void bar(int&)’: fntpl.cpp:7:11: error: no matching function call ‘tpl(void (*)(int&), int&)’ fntpl.cpp:7:11: note: candidate is: fntpl.cpp:3:46: note: template<class t> void tpl(void (*)(t), t) if state template parameters explicitely ( tpl<int&>(&f, x) ), works. why doesn't template argument deduction work in case? because these fundamentally different void f(int&); and void (*)(t) the compiler has deduced t int , looks for: void f(int); which nothing intention, change function pointer this: template <typename t> void tpl(void (*)(t&), t); and compiler happy...

html5 - what is "drawing context" exactly ? what is the role of getcontext() method? -

what getcontext() method , drawing context exactly? why pass string "2d" getcontext() method? context way choose going canvas. for moment can use getcontext 2d (2dcanvas) or 3d (webgl). html5 specification say's getcontext : "returns object exposes api drawing on canvas. first argument specifies desired api. subsequent arguments handled api." you can find specifications each api there : http://wiki.whatwg.org/wiki/canvascontexts it know "webgl" correct name api moment, experimental should use "experimental-webgl" start creating webgl content

Serial Port device protocol safe practice: Identification, polling -

i'm creating simple device sends data windows pc on serial com ports. i'd software able scan available com ports until recognizes device. problem is, if pc tries initiate handshake device other mine, may interpret commands [wrongly, of course]. the solution see device periodically broadcast sort of identifier, perhaps 5 times per second or so, application needs listen identifier rather risk corrupting device connected com port. when application loads, listens on each available com port until device recognised. sound reasonable? thanks imo whatever direction on initiate handshake, problem same. if send handshake device , application on pc listening corresponding serial port, has risks badly interpret data sending. so software on both side should protected against incoherent data receive outside.

python - Indentation error : unexpected error -

i new python , have written code in notepad++. have used spaces instead of tab , guess have used correct indentation format. still thie error. dont understand doing wrong. here code, #!/usr/bin/python import sys import shutil import sys def usage() : print "labelfile transcriptionfile phonemefile" def main(argv = none) : if len(sys.argv) !=3 : usage() else : labelfile = sys.argv[1] transcriptionfile = sys.argv[2] phonemefile = sys.argv[3] if (os.path.exists(labelfile)) : infile = open(labelfile, "r") tfile = open(transcriptionfile, "w") pfile = open(phonemefile, "w") line in iter(infile) : list = line.split() tlist = list.pop(3) plist = list[2] tfile.write(" ".join(list) + "\n") pfile.write("".join(list) + " ") infile.close() tfile.close() pfile.close() if __name__ == ...

python - Decoding response while opening a URL -

i using following code open url , retrieve it's response : def get_issue_report(query): request = urllib2.request(query) response = urllib2.urlopen(request) response_headers = response.info() print response.read() the response follows : <?xml version='1.0' encoding='utf-8'?><entry xmlns='http://www.w3.org/2005/atom' xmlns:gd='http://schemas.google.com/g/2005' xmlns:issues='http://schemas.google.com/projecthosting/issues/2009' gd:etag='w/&quot;duufqh47ecl7ima9wxbbfeg.&quot;'><id>http://code.google.com/feeds/issues/p/chromium/issues/full/2</id><published>2008-08-30t16:00:21.000z</published><updated>2010-03-13t05:13:31.000z</updated><title>testing if chromium id works</title><content type='html'>&lt;b&gt;what steps reproduce problem?&lt;/b&gt; &lt;b&gt;1.&lt;/b&gt; &lt;b&gt;2.&lt;/b&g...

asp.net listview and findcontrol -

Image
i have listview , need bind dropdown list in list view listitemcollection built using function bindpages(). when clicked on addnew link not able bind dropdown. <asp:listview datakeynames="menuid" onitemcommand="lvparentmenus_itemcommand" onsorting="lvparentmenus_sorting" ondatabound="lvparentmenus_databound" datasourceid="sqldatasource1" id="lvparentmenus" runat="server"> <layouttemplate> <table border="0" id="listview" width="100%" class="grid" cellpadding="0" cellspacing="0"> <thead> <tr class="listingheader "> <td width="10%" style="text-align: center; !important"> ...

wcf - How can I prevent VS2010 to create a new binding each time I update a service reference? -

i'm developing winforms client application wcf service in c # 3.5 , visual studio 2010. every time use " update service reference " in ide, considering have working binding in app.config , additional binding entry generated same name , trailing "1". my app.config on client side : <bindings> <wshttpbinding> <binding name="wshttpbinding_iissuetracker" closetimeout="00:01:00"... after "update service reference", have : <bindings> <wshttpbinding> <binding name="wshttpbinding_iissuetracker" closetimeout="00:01:00"... <binding name="wshttpbinding_iissuetracker1" closetimeout="00:01:00"... so need remove unused binding time. this driving me nut. there way disable behaviour ? the way solved move service reference separate library, , delete (newly generated) app.config library project after executing update service reference...

java - Creating a generic object using a Class<?> variable -

i have generic class a, , i'm in method have create instance of based on class given object is. is, have: public void (object obj) { class<?> c = obj.getclass(); a<c> = ...; } however, on third line eclipse says c cannot resolved type. when remove generic parameter, "a raw type. references generic type should parameterized." what correct way go here? thanks. public <c> void (object b) { class<c> c = b.getclass(); a<c> = ...; } or better public <c> void (c b) { class<c> c = b.getclass(); a<c> = ...; } or if need class public <c> void (class<c> clazz) { a<c> = ...; }

javascript - necessary to remove event handlers by hand? -

morning, when using element#observe() , necessary call element#stopobserving() rid of event handler? or inbuilt mechanism realize handler no longer necessary when element gets removed in way ( .update() on parent, not .remove() ) ? updating large dynamic lists several bindings per entry every , then. drawbacks when using like ul.update(''); data.each(.. ul.insert(x); x.bind(..); ..); thanks! if element no longer part of dom garbage collection deal it's handlers, depend on browser. i suggest not worry out of control , @ using event.on() instead.

c# - Pop up warning message -

i have nice pop warning says "are sure want overwrite file? yes no. there way telerik or ajax tool kit?. want able control on server side c# thank you one way 1) create div popup 2) display popup when events occurs (like button click) 3) if users click ok doing somethings on server side 4) if users click no hide div here code, sorry if there error don't have environment on hands. <head> <script type="text/javascript"> function showconfirm() { var popup = document.getelementbyid('popup'); popup.style.display = ''; } function hide() { var popup = document.getelementbyid('popup'); popup.style.display = 'none'; } </script> </head> <body> <form runat="server" id="form1"> <div id="popup" style="display:none"> <p>bla bla bla</p> <asp:button id="btn_ok" runat="server" onclick=...

What is the Best Way to Store some data in Java? (Array vs ArrayList) -

so currently, extracting 2 different attributes xml file in java (for project) related each other , printing them out console. however, want able store these in way in referencing 1 value retrieve it's corresponding counterpart. example: id: rid11 & target: image3 id: rid10 & target: image2 id: rid9 & target: image1 with 3 values, i'd want way store each line, when reference "rid" it's corresponding "target" value. thinking using either array or arraylist, i'm not sure better purposes or how go referencing 1 value , getting other. offer me advice? thank in advance. if keys unique, use map . map<string, string> mak = new hashmap<string, string>(); map.put("rid11","image3"); map.put("rid10","image2"); map.put("rid9","image1"); reference: java tutorial > map interface otherwise, create custom object holds key , value , create list (or set ?...

drupal - Formatting a String Entity for HTTP Post in Android -

i having few problems setting string entity need send drupal server. in php request need send looks following $data = array( 'node' => array( 'field_fan_registration_id' => array(0 => array('value' => $registration_id))) ); i cant work out how set array within array in android , set string entity of http post. can hep me out?

addclass - Jquery Add/remove Class of seperate div on click -

#bottomtoolbar #facet-container #tb-facets .info-toolbar #rv-active { position:relative; } .tb-1-5 { display:none; } <div id="bottomtoolbar"> <div id="facet-container"> <ul id="tb-facets"> <li class="info-toolbar"> <a id="info-tb-1">recently viewed</a> <div id="rv-active" class="tb-1-5">hello world</div></li> <li class="info-toolbar">favorites</li> <li class="info-toolbar">wish list</li> </ul> </div> </div> $('#info-tb-1').bind('click', function() { $('#rv-active').removeclass('tb-1-5'); }); what i'm trying show div when click on "a" element. need change remove display: none; thanks have tried using .show() ? $('#info-tb-1').click(function() { $('#rv-active').show(); }); ...

hover - creating css tooltip formatting issue with underlines in a tag -

i'm trying created pure css tooltip. have test code here: http://jsfiddle.net/rbdn4/ the problem in chrome, text underlining on tooltip despite having text-decoration: none; line in css. any suggestions on how stop? link should underline, .tooltip text should not. chrome applies link's text-decoration <div> because child of <a> . add wrapper element around <a> , make tooltip <div> sibling instead of child of <a> . show tooltip when wrapper :hover ed. oh, , make css make sense! html <span class="wrap"> <a href="#">this text</a> <div class="tooltip"> tooltip</div> </span> css .tooltip { color: #000000; display: none; left: 50px; padding: 10px; position: absolute; top: 40px; width: 250px; text-decoration: none; z-index: 100; } span.wrap:hover .tooltip { display: block; } demo: http://jsfiddle.net/m...

nstimer - My timer is 5 seconds faster per minute! cant find the mistake -

i got displayed min seconds , 1/100 seconds in format 1:12.4 [nstimer scheduledtimerwithtimeinterval:1.0/10 target:self selector:@selector(zeitmessung) userinfo:nil repeats:yes]; -(void)zeitmessung{ zeitmisec +=1; if (zeitmisec==9) { zeitsec+=1; zeitmisec=0; } if (zeitsec==59) { zeitmin +=1; zeitsec =0; } if (zeitsec<10) { nsstring *nsstime = [nsstring stringwithformat:@"%i:0%i.%i",zeitmin,zeitsec,zeitmisec]; lbltime.text= nsstime; }else{ nsstring *nsstime = [nsstring stringwithformat:@"%i:%i.%i",zeitmin,zeitsec,zeitmisec]; lbltime.text= nsstime; } } your if statments little out, turn on @ .9 seconds , 59 seconds. you need if (zeitmisec==10){...} and if (zeitsec==60){...}

How to pass parameters to a partial view in ASP.NET MVC? -

suppose have partial view: your name <strong>@firstname @lastname</strong> which accessible through child action like: [childactiononly] public actionresult fullname(string firstname, string lastname) { } and want use partial view inside view with: @html.renderpartial("fullname") in other words, want able pass firstname ans lastname view partial view. how should that? use overload ( renderpartialextensions.renderpartial on msdn ): public static void renderpartial( htmlhelper htmlhelper, string partialviewname, object model ) so: @{html.renderpartial( "fullname", new { firstname = model.firstname, lastname = model.lastname}); }

asp.net - LinkButton OnClick event not firing when hosted on IIS -

i have usercontrol has listview, , in each row there linkbutton onclick command set. the problem is, onclick event fired when run project in visualstudio 2010s environment, not fired when host codebase on iis. page_load fired, not linkbutton onclick event itself. has come across before? i've had situations stuff doesn't work under vs worked under iis due vs webserver limitations, never other way round. visual studio 2010 , both iis7 , iis7.5. integreted apppools on iis, running .net 4.0 code.

Assign a Get-WebAppPoolState returned value to a variable in Powershell -

this code: import-module webadministration get-webapppoolstate apppoolname produces following output: value - - stopped but code: import-module webadministration $state = get-webapppoolstate apppoolname write-host $state produces output: microsoft.iis.powershell.framework.codeproperty when state of app pool using get-webapppoolstate, need boolean value of sort assign variable can use in conditional statement. i cant use microsoft.iis.powershell.framework.codeproperty line. how correct this? get-webapppoolstate not returning string object of type codeproperty. you'll want value property object, i.e.: $state = (get-webapppoolstate apppoolname).value; i presume display converter kicking in first case when gets written output why stopped displayed not writing host default object representation (which type name) instead.

php - image in seperate page with other images at bottom -

on sites, if click image within post, image in new page images in post @ bottom. how replicate behavior? i have code don't know whether correct or not. don't know add this. can explain add exactly? $attachments = get_children(array('post_parent' => $post->id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'asc', 'orderby' => 'menu_order id')); foreach($attachments $att_id => $attachment) { $full_img_url = wp_get_attachment_url($attachment->id); // code here } what you're describing default feature "galleries" of e.g. twentyten default theme (given don't misunderstand you). in or around line 58 of loop.php file you'll find: <?php /* how display...

c# - Mobile phone, Redirect adding %20 to parameter -

i have mobile app few folders. these folders used variables add parameters: //get url string url = httpcontext.current.request.url.absolutepath; //location string location = ""; //check if string contains / if (url.contains('/')) { //get location string[] words = url.split('/'); //set location location = words[1]; //now check if string contains ? if (location.contains('?')) { //remove ? string[] removeq = location.split('?'); //reset location location = removeq[0]; } } after path url have redirect depending on phone type: if (request.useragent.toupper().contains("blackberry")) { //now check version if (double.parse(request.browser.version) <= 5) ...

java - Multi-Connection bluetooth application -

i developing j2me midp 2.0 game can can played on bluetooth, similar tic tac toe players exchange turns until game over, problem want give both players ability restart game or quit @ time have 1 connection transferring game related data, , wonder if have 2 separate connections between 2 devices @ same time, 1 eg. game management (restart, quit, etc ..) , other game data separate logic. or put way : possible have multiple bluetooth connections between 2 midp devices @ same time ? in advance i think bluetooth.via j2me mobile application midp device connected @ 1 device , @ @ time 1 connection enabled.so there no chance of going multiple connections.

r - Convert data.frame to xts object and preserve types -

is there way create xts object data.frame , preserve data type? numerics being converted character. post 2009 suggests merging columns existing xts: http://r.789695.n4.nabble.com/as-xts-convert-all-my-numeric-data-to-character-td975564.html it wasn't clear whether way this. seems bit of hack , cumbersome large data frames. think out-of-the-box xts respect datatypes. no, can't. xts/zoo objects matrix index attribute , can't mix types in matrix. we've considered creating xts-data.frame class primary concern of xts speed , memory efficiency. data.frames not speed , memory efficient, hasn't been priority.

windows - C# WinForms: On New Form Load Choose Tab Visibility -

i'm having trouble setting visibility of tab when file loaded in application. when user launches app displays welcome tab, i'm trying when user selects file -> open loads file in new editor form fine can't seem figure out how make load form , set visibility of editor tab. if (this.openeditordialog.showdialog(this) == dialogresult.ok && editform != null) { editform.close(); editform = new editorform(this); editform.openfile(this.openeditordialog.filename); editform.closing += new canceleventhandler(editorform_closing); editform.show(); } i've tried doing editform.editortab.show(); activecontrol = editform.editortab no avail. many in advance. the tabcontrol has selectedtab property: check msdn that. know have sample, need find it. ...oops, selecttab : here on msdn void setvisibletab(tabpage tabpage) { mytabcontrol.selecttab(tabpage); }

asp.net - how do you set a url routing routevalue to a hyperlink's navigate url property in an aspx page? -

if following routes: routes.mappageroute( "build", // route name "build", // route url "~/build.aspx" // web page handle route ); routes.mappageroute( "type", // route name "build/{type}", // route url "~/build.aspx" // web page handle route ); routes.mappageroute( "project", // route name "build/{type}/{project}", // route url "~/build.aspx" // web page handle route ); routes.mappageroute( "task", // route name "task/{type}/{project}", // route url "~/task.aspx" // web page handle route ); how set hyperlinks navigate url in .aspx (not code behind) route named 'task' type = 'tool' , project = 'excel'? for example, in grid view template field: <asp:tem...

scala - Minimal full SBT project with plugins -

so sbt (0.10) produces weirdest errors when try create project has kind of configuration, not copying wiki examples works… is there nice collection of minimal, working sbt projects? (not basic/quick .sbt stuff full .scala files in project/ ) wiki snippets seem outdated or wrong somehow… my attempt @ integrating scalariform failed sbt not being able compile import sbt._ in project/plugins/plugins.scala ?! (without other custom files in tree. should have worked far understand it…) basically need project scalariform , -deprecated compiler option (that didn't work in quick mode…) if use sbt 0.10.x (xsbt), you'll have wait bit. plugin not compatible: https://github.com/harrah/xsbt/wiki/sbt-0.10-plugins-list if use sbt 0.7.x , instructions on sbt-scalariform github page should work.

c# - How to make primitives correctly overlay sprites in DirectX (2D) -

i've got problem rendering sprites , primitives in direct3d9. i'm trying make simple 2d game using sprites, i've found out i'll need primitives draw simple squares, lines, etc. problem overlaying. if draw primitives using device.drawuserprimitives() , fine, primitives rendered correctly. if draw sprites using sprite.draw() , it's fine. if want draw both sprites , primitives, sprites automatically overlays primitives or make them black. i've tried disabling z buffer, disabling writing in z buffer while rendering sprites, etc. same. managed make primitives overlay sprites changing z position, primitives black... :( note, please, i've tried rendering primitives both before , after drawing sprites. didn't help. i'll post here snippets of drawing sprites , primitives (variable names changed understand i'm drawing if don't know c# , slimdx): msprite.begin(spriteflags.objectspace | spriteflags.donotmodifyrenderstate); msprite.draw(tex...