Posts

Showing posts from May, 2013

asp.net - Is there a way to send a parameter though a button? -

i have link witch yo change button, link passes though parameter , looks follows: @html.actionlink("view", "print", new { id = item.salescontractid }) i want replace button parameter { id = item.salescontractid } my button looks follows: <input type="button" value="print" id="btnfromindexprint" /> could show me how ca go doing this? this how page looks can see i'm trying achive: @model ienumerable<contract.models.tbsalescontract> <!doctype html> <html> <head> <title>index</title> </head> <body> <p> @html.actionlink("create new", "edit") </p> <table> <tr> <th> company </th> <th> trading </th> <th> created </th> ...

javascript - JQuery find index of focused input -

how can find index of focused input field? have code: var forma = $('form#mali_oglas'), pomoc = $('div[role=pomoc]'), input = forma.find('input[type!=hidden], textarea'); index = input.focus().index(); console.log(index); all number of input elements in form (15 @ moment). http://jsfiddle.net/iambriansreed/qyuhv/ jquery var f = $('form'); f.click(function(){ $('#index').val($(':input:focus',f).index()); });​ html <form> <input value="hello"/><br/> <textarea></textarea><br/> <input/><br/> <input/><br/> <select><option>option</option></select><br/> <input/><br/> </form><br/><br/> field index focus: <input id="index"/> ​

XPath get texts inside a "might existed" tag -

i have html contains tags below: <div id="snt">text1</div> <div id="snt">text2</div> <div id="snt"><span style='color: #efffff'>text3</span></div> <div id="snt"><span style='color: #efffff'>text4</span></div> how can all text s included in <div> tags using xpath? i.e.: text1 text2 text3 text4 use : //div[@id='snt']//text() this selects text node descendent of div element in xml document, has id attribute string value string "snt" . if want excclude whitespace-only text nodes selection, use: //div[@id='snt']//text()[normalize-space()] this similar first xpath expression, each selected text node must have additional predicate satisfied -- value of normalize-space() function upon string contents non-empty string. the value of normalize-space() function empty string when argument empty...

eclipse - Fetch data from XML file located in sdcard (Android) -

this first post here :-). developing application android in eclipse. my question have put xml file in sdcard elements id,first name , lastname. form ui have 1 textbox , button. user enter id in textbox , on click event of button should fetch data based on id. , display in textview. any please?? thanks in advance. :-) here sample of xml file given me, <tblinsurees xmlns="urn:schemas-microsoft-com:sql:sqlrowset1"> <id>1</id> <lastname>family 1 (1-42-167)</lastname> <othernames>fammem1</othernames> <dob>01-01-85</dob> <photofilename xsi:nil="true" /> </tblinsurees> - <tblinsurees xmlns="urn:schemas-microsoft-com:sql:sqlrowset1"> <id>2</id> <lastname>family 2 (1-4-16)</lastname> <othernames>fammem1</othernames> <dob>01-01-85</dob> <photofilename xsi:nil="true" /> </tblinsurees...

c# - What is simplest way to bind this database content to WPF controls? -

i new wpf. i have database table 2 columns: category, type. primary key combination (category, type). type subordinate category, meaning 1 category containing multiple type. now, in wpf ui, have 2 combobox controls. first bind distinct category list in db table. have done binding control db view of distinct(category). second needs show type list belonging category selected in first control. i did research have no idea how it. tried creating stored procedure select wanted type value list based on category given, don't know how pass selected category stored procedure in xaml. must use code rather xaml it? suggestion? thanks lot i create object hold categories contain each type possible category. like... public class category { public observablecollection<string> types { get; set; } } then when initialize every category, can set types allowed in... public class myclass { public observablecollection<category> categories { get; set; } ...

What is the best way to use python code from Scala (or Java)? -

possible duplicate: java python integration there code written in python , need use scala. code uses native c. possible use scala or java without having rewrite much? i intend use code black-box without understanding, prefer not rather somehow generate jar can import in code. why not try jython ?you directly compile python code java classes or call python code java through interface.

c++ - Can't convert from one data type to the same? -

i'm trying implement own set template, , have issues trying breadth- first search using queue template works independently. the weird part error in set template when trying compile. why can't convert 1 pointer different 1 same data type? error c2440: '=' : cannot convert 'set<t>::node<t> *' 'set<t>::node<t> *' [ t=std::string ] types pointed unrelated; conversion requires reinterpret_cast, c-style cast or function-style cast c:\users\programming\set\set.h(96) : while compiling class template member function 'void set<t>::print(set<t>::node<t> *)' [ t=std::string ] c:\users\programming\set\main.cpp(13) : see reference class template instantiation 'set<t>' being compiled [ t=std::string ] queue class template template <typename t> class queue ... t* front() { if (first !...

.net - Can't update WCF Service Reference - Service Works -

i can't update wcf-service reference after adding new method. if undo changes won't work, too. if call uri: http://192.168.1.175:8001/ws can see xml-file service methods. client application can communicate server. if enter uri in "wcftestclient.exe" i'll same error when i'll update service reference: http-status 503: service unavailable. help appreciated.... :) i ran issue today. after poking around on web came conclusion there being cached somewhere. search computer instances of service's dll (found 19, btw) , deleted of them. after rebuilding, started working should.

php - <expandproperties /> and encoding with phing -

i have static application (html/js) must put online in 2 different languages. while it's not hard copy whole directory twice , replace each string, it's kind of boring , expect see regular changes on project. thus considered building 2 versions of project (fr , nl) phing. idea use <filterchain><expandproperties /> , , load translations property files. it works quite well, 1 thing: unicode characters represented \uxxx , which, obviously, not want... any idea on how can fix ? excerpt of build.xml can found here: http://pastebin.com/2uwhahvi solution : turns out it's alright phing. problem ide replaced character transparently \uxxx equivalent. if having same problem, try opening file simple text editor.

strange CSS webkit-transform-scale hover in Chrome -

i'm new coding, experienced on computer. on following website i'm creating enlarge-on-hover effect, written in css alone. link: http://3514.linux3.testsider.dk/da/produkter/skumdetektorer if take in chrome @ 1st, 4th, 5th, 6th, 7th... images, have serious stacking/layer/priotrity problem on hover. every browser worked fine 1 week ago, chrome started acting up... i had same problem browsers @ first, later on fixed searching internet , found z-index setting answer 'page-priority' problem. i tried searching every corner of internet, every word related subject, have found nothing. following code used on site: <style type="text/css"> .hovergallery img { -webkit-transform:scale(1); /*webkit:scale down image 0.8x original size*/ -moz-transform:scale(1); /*mozilla scale version*/ -o-transform:scale(1); /*opera scale version*/ -webkit-transition-duration:0.5s; /*webkit:animation duration*/ -moz-transition-duration:0.5s; /*mo...

xml - soapui and expected results in XQuery expression -

an excerpt of xml: <ns4:meldingen> <ns4:meldingkey> <ns4:nummer></ns4:nummer> <ns4:locale></ns4:locale> <ns4:kanaal></ns4:kanaal> <ns4:severity>error</ns4:severity> <ns4:argumenten> <ns4:argument></ns4:argument> </ns4:argumenten> <ns4:module></ns4:module> <ns4:routine></ns4:routine> </ns4:meldingkey> </ns4:meldingen> xquery script returning data : <result> { $x in //meldingen/meldingkey return<severity>{data($x/severity/text())}</severity> } </result> my expected results more 1 match: <result> <severity>succes</severity> </result> <result> <severity>succeswitherrors</severity...

windows - schtasks: setting a working directory? -

i have program trying run on logon dependent on files in same directory resides. manually running program command line, have cd'd to, runs should. however, if schedule task run program error program complains not finding file needs. question(s) is/are: 1.) working directory of scheduled task location of program? 2.) if not, how set working directory location of program? here code using schedule task: schtasks /create /tn "test" /tr $mylocation\test.exe /sc onlogon /rl highest where "$mylocation" powershell variable set reference directory of program. i've got around in past using batch file. there's neat trick can use in batch file give directory tha batch file located in. so, can run app want. create batch file following contents , place in directory next app, set it's path value /tr argument. %~dp0\test.exe strictly speaking, backslash isn't required %~dp0 includes trailing backslash anyway. think makes batch file bit mo...

asp.net mvc - Viewing Reports without ReportViewer Control -

having js web application (asp.net mvc, talking via rest server) cannot use server-side reportviewer control open reports generated microsoft reporting services. i searching ways open reports without making reporting services public. no option pregenerate reports , linking them. my first idea setting route server-side controller creates web request (calling reporting services necessary parameters), caches response , returns client. not sure if best solutions. does had same task , might share his/her solution? thank you! oskar in fact, reports may have subreports, have load data server it's best choice use reportviewer control. solution create plain old web forms apsx having control included until there updated/new control microsoft. works pretty good.

c# - Given a source code, Can we find what .NET DLLs do we need? -

let's want write program takes c# source code file ( 1 single .cs file, not complicated) , want program analyze source code , result tell me .net dlls need methods used in source file. technically possible? so example if in source file there console.writeline() method want able tell me "mscorlib.dll" needed. in order need write compiler. way determine dll's needed first determine ever identifier / name in source file binds to. once you've established names bind can understand dlls necessary (assuming there dll list choose from). understanding name binding though requires program understand ... c# syntax name binding rules overload resolution rules in short, need compiler :)

c# - Multi-Select File Uploader -

i'm trying come viable (and simpler better) solution multi-select file upload control. breeze except few things... the user needs able literally select multiple files in dialog, not 1 one. can't use open source code. (but javascript/jquery ok) cant use third-party library microsoft doesn't support. (please don't bother "why can't you?" comments.) i don't have lot of experience making own controls. (and i'd assume if there simple way modifying "open" control, found tutorial.) thanks. edit: answer questions... i haven't tried of outside of researching. not sure of start these limitations. i can't use html5. in fact, need ie7 compatibility. no multiple attribute. how telerik's multi-file upload ? believe ms certified partner. -j

java - How to bypass scanner check next element (if that makes sense) -

i trying create continuous thread server recieves/sends messages client when try check next element gets stuck: public void run() { try { try { arraylist<socket> connections = parent.getconnections(); in = new scanner(socket.getinputstream()); while(true) { if(in.hasnextline()) // gets stuck here { string message = in.nextline(); system.out.println("client said " + message); } } } { socket.close(); } } catch(exception e) { e.printstacktrace(); } how make loop not stuck @ specified point assuming want able deal 'lines', i'd start this: public class socketreader implements runnable { private final inputstream stream; private final queue<string> destination; private volatile boolean ac...

c - Using Accelerate framework to perform FFTs -

there few lines of code in this onset detection program make use of fftw3 library difficult incorporate ios. replace using accelerate framework . in onsetdshelpers.h there member variable: fftwf_plan fftplan; and in onsetdshelpers.c there couple of malloc methods: odsbuf->windoweddata = (float*) fftwf_malloc(framesizebytes); odsbuf->fftbuf = (float*) fftwf_malloc(framesizebytes); a method instantiate fftplan odsbuf->fftplan = fftwf_plan_r2r_1d(ods->fftsize, odsbuf->windoweddata, odsbuf->fftbuf, fftw_r2hc, fftw_estimate); methods releasing memory: void onsetsds_destroy_audiodata(onsetsdsaudiobuf *odsbuf){ // take down fftw stuff fftwf_destroy_plan(odsbuf->fftplan); // free mem free(odsbuf->data); free(odsbuf->window); fftwf_free(odsbuf->windoweddata); fftwf_free(odsbuf->fftbuf); } and method execute fft: fftwf_execute(odsbuf->fftplan); my knowledge of c , ffts pretty limited. pointers m...

java - How to quiet org.w3c.dom.Document? -

i have following java method: private static document documentfromfile(final file xmlfile) { document document = null; try { documentbuilderfactory docbuilderfactory = documentbuilderfactory .newinstance(); documentbuilder docbuilder = docbuilderfactory .newdocumentbuilder(); document = docbuilder.parse(xmlfile); document.getdocumentelement().normalize(); } catch(exception exc) { // handle exception... } return document; } in test methods, if pass method malformed xml file sorts of error output on console: [fatal error] :1:1: content not allowed in prolog. [fatal error] :1:1: premature end of file. i assume culprit docbuilder.parse(xmlfile) . i'd able disable default output , "silence" document builder, , don't see setter methods on object allow me that. have remedies here or stuck this? use documentbuilder.seterrorhandler set implementation...

type conversion - XE2 XML Attribute can't convert to double -

i have xml node attributes this: <pad name="e" x="2.5" y="7" drill="1.3"/> when assign attributes["x"] double result 25, not 2.5 without complaints or errors. to correct conversion first have assign attribute string, replace decimal '.' decimal ',' , convert string double. attribute["x"] can't convert doesn't anything! (bug?!?) here code faulty conversion: double x = xmlnode->attributes["x"]; this gives faulty x of 25 instead of 2.5 , here work around: string sd = xmlnode->attributes["x"]; if (sd.pos(".")) sd[sd.pos(".")] = ','; double x = sd.todouble(); this gives correct value in x (2.5) there must more simple way this! // thanks xml attributes arbitrary string values if not using xsd coherce data, such ide's xml data binding wizard. attributes[] property returns olevariant , in case going contain syst...

Apply a specific class/id to current page on menu (PHP) -

i have menu this: <div id="blahblah" style="blahblah"> <a href="http://domain.com/folder/biography"><img style="blahblah" src="blahblahblahblah"></a> <a href="http://domain.com/folder/contacts"><img style="blahblah" src="blahblahblahblah"></a> <a href="http://domain.com/folder/gallery"><img style="blahblah" src="blahblahblahblah"></a> <a href="http://domain.com/folder/dontknow"><img style="blahblah" src="blahblahblahblah"></a> </div> i'd have automatically adds class="current" page i'm in. links (as can see in code above) domain.com/folder/biography or domain.com/folder/contacts, without .php/.html, etc. i tried with: <div id="blahblah" style="blahblah"> <a <?php if (strpos($_server['php_self'], ...

javascript - Something with callback -

already 15 minutes can not understand if(send == true){ $.getscript('index.php?get_names_from_ajax=true', function(data){ $('#firstnames').remove(); $('#lastnames').remove(); $('#content').prepand('<div class="block" id="firstnames">'+firstnames+'</div>'); $('#firstnames').after('<div class="block" id="lastnames">'+lastnames+'</div>'); send = false; }); alert(send); } getscript works fine, callback gives no results. edit as said, callback off, nothing removes or adds, no moving, there no callback. i think firstnames , lastnames should data.firstnames , data.lastnames , if not defined in script before. $.getscript('index.php?get_names_from_ajax=true', function(data){ $('#firstnames, #lastnames').remove(); $('#content').prepand('<div class="block" id="firstnames">'+da...

c# - How can I run an application and do not show the console? -

i've got console application , want run application. when invoke code--to call program use activexobject--it shows console. how not show console? mean, program works console shown. if make application windows application instead of console application not show or open (or use) console. code can stay same - , application still function (without ever creating form or window ). that being said, if control "other" application, may want consider making class library instead of separate application. allow include , run code within library without starting separate process.

android - Understanding fragment stack -

i have action bar (actionbarsherlock) tab navigation , have couple of action items well. 1 of action items displays listfragment , here how call it: case r.id.menuitem_info: // create new fragment , transaction sherlocklistfragment aboutlistfragment = new aboutlistfragment(); fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); // replace whatever in fragment_container view fragment, // , add transaction stack ft.replace(r.id.root, aboutlistfragment); ft.addtobackstack(null); actionbar actionbar = getsupportactionbar(); actionbar.setdisplayhomeasupenabled(true); // commit transaction ft.commit(); return true; my problem when hit button, illegalargumentexception. i'm not sure how remove fragment view , display previous view? here home button code: case android.r.id.home: fragmentmanager fm = getsupportfragmentmanager(); if (fm.get...

opengl - PyOpenGL Cube Mapping Textures -

i've tried texture_2d push textures on cube. thats no problem. but when use texture_cube_map textures aren't visible. black cube. can me? #### init function textureids = glgentextures(1) glbindtexture(gl_texture_cube_map, textureids) gltexparameteri(gl_texture_cube_map, gl_texture_wrap_s, gl_clamp_to_edge) gltexparameteri(gl_texture_cube_map, gl_texture_wrap_t, gl_clamp_to_edge) ...

java - how to get the storage engine using jdbc -

is there way storage engine of mysql table using jdbc. use metadata other table information columns names, types, primary key , indexes ... didn't find how o engine you can use information_schema engine type, e.g.: select engine information_schema.tables table_schema=database() , table_name='foobar';

asp.net - .NET ASP webpage inheritance -

i new .net , ideally want make several layers of abstraction making complex website. being first layer handling login, authentication, etc, layer handling built in apps (how look, predefined functions, database connections), , lower level specific app implementation details. this favors uniformity apps inherit 1 place allowing easier maintenance , rapid development of smaller apps once overhead abstraction layers handle responsibilities. the problem not 100% sure start .net asp webpage inheritance. tried google , searching may not looking right thing. hoping experience on matter may direct me towards resources make kind of webpage inheritance/abstraction easier! i using visual studio 2010. edit: want add purpose question: individual creating base of website handle authentication, portal, ui look, etc i want make app base uses website framework , adds onto standards every app must meet, function library, addition ui overrides not applicable portal, etc. from there third ...

android - Street view on Google Maps? -

i try offer 3 display modes users of app: traffic view (the standard view on every printed map) satellite view (aerial) , streetview (3d, done infamous google car) i can set 'standard' traffic view with mapview.setsatellite(false); mapview.settraffic(true); satellite view mapview.setsatellite(true); but mapview.setstreetview(true); doesn't anything, if can streetview @ location checking maps.google.com , followup check mapview.isstreetview() returns true. can me out? setstreetview(true) should load tile set showing streets streetview data available. not, however, display streetview -- separate application. can launch streetview, devices have it, given location by using specific intent structure . however, cannot embed streetview in own app @ time.

ios - Cropping an AVCaptureSession preview -

i'm displaying video preview of 320x320 capture window, , using videogravity have fill square: capturevideopreviewlayer.videogravity = avlayervideogravityresizeaspectfill; i'm grabbing photo quality image session , cropping it, starting @ 0, 0. problem have saved image shows more top (but not left) of frame preview. i'd see top of frame, seems i'm seeing middle section, hope i'm explaining myself properly. here code snippet if helps: avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; capturevideopreviewlayer.frame = _cameraview.bounds; [_cameraview.layer addsublayer:capturevideopreviewlayer]; capturevideopreviewlayer.videogravity = avlayervideogravityresizeaspectfill; avcapturedevice *device = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; thanks in advance help. cheers. i couldn't figure out how this, decided fix changing cropping region instead of prev...

android - BroadCast Receiver not launching on BOOT_COMPLETET event -

i trying launch broadcastreceiver-class "simchangereceiver" after system boot-up. therefore, class listening intent.action.boot_completed event. public class simchangereceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if("android.intent.action.boot_completed".equals(intent.getaction())){ ... ... after bootup, logcat comes entry: 06-04 20:09:08.070: v/otastartupreceiver(399): onreceive: intent action=android.intent.action.boot_completed motaspmode=-1 however, "simchangereceiver" class never entered. an extract of manifest file: <uses-permission android:name="android.permission.read_phone_state" /> <receiver android:name=".simchange.simchangereceiver" > <intent-filter android:priority="999" > <action android:name="android.intent.action.boot_completed" /> </...

Android application - develop for iPhone how? -

we're students sweden, , we've developed android application in school project. application has been noticed number of significant (to us) people who're interested in our idea, think it's necessary develop iphone application give small chance of succeeding. problem we've studied java, little less year. had learn android 'on-the-go'. don't know how take advanced android application , turn iphone application. we've explored possibilities of using kind of framework, , 1 has caught our eyes "phonegap". don't know if it's advanced enough our purposes. in android version have client (the phone), in turn contacts tcp-server in turn contacts mysql server information needed. information sent application , handled. data gets put in kind of list fills our view. can phonegap handle objects this? can calculate data , dynamically add client? phonegap "secure"? or recommend going in different direction - learning program iphone ...

c - Pointer to function vs global variable -

new ee little software experience here. have read many questions on site on last couple years, first question/post. haven't quite found answer one. i know difference/motivation between having function modify global variable within body (not passing parameter), , between passing address of variable. here example of each make more clear. let's i'm declaring functions "peripheral.c" (with proper prototypes in "peripheral.h", , using them in "implementation.c" method 1: //peripheral.c //macros, includes, etc void function(*x){ //modify x } . //implementation.c #include "peripheral.h" static uint8 var; function(&var); //this end modifying var method 2: //peripheral.c //macros, includes, etc void function(void){ //modify x } . //implementation.c #include "peripheral.h" static uint8 x; function(); //this modify x is motivation avoid using "global" variable? (also, global i...

javascript - JS Global Variable to Local Variable -

this simple question. i know global variables created when declared outside function (says w3schools.com). my question is, if create global variable , edit in function, become local? new value given function become global value? in general, no, editing global not make local: var myglob = 5; function incglob() { myglob = myglob + 1; } incglob(); console.log(myglob); // 6 however, if pass global variable argument, argument local copy: var myglob = 5; function incarg(myloc) { myloc = myloc + 1; } incarg(myglob); console.log(myglob); // still 5 note objects passed reference, editing member variables of argument variable changes member variables of original object passed in: var myglob = { foo:5 }; function editloc(myloc) { myloc.foo = 6; } editloc(myglob); console.log(myglob.foo); // foo 6 finally, note local variable in editloc , above, reference. if try overwrite entire object (instead of member variable), function loses reference original obj...

rails render missing variables -

for rails app, error messages not displaying correctly. think reason because on failed validation, controller did redirect opposed render. however, im having trouble rendering. variables seem missing. example in pub_messages#create have... def create @pub_message = current_user.pub_messages.build @pub_message.to_id = params[:pub_message][:to_id] @pub_message.user_id = current_user.id @pub_message.content = params[:pub_message][:content] if @pub_message.save flash[:success ] = "your post has been sent" redirect_to user_path(params[:pub_message][:to_id]) else render 'users/show' end end ^(on side note, im maually saving each of attributes because of security issue didn't make :to_id attr_accessible) but on point, when render 'users/show', seems can't find of variables. goes users show view, complains about... undefined method `name' nil:nilclass 1: <% provide(:title, @user.name) %>...

dynamic - Binding ExpandoObject in Silverlight -

in wpf, can bind against expandoobject , other dynamic types: dynamic o = new expandoobject(); o.foo = "hello"; datacontext = o; <textblock text="{binding foo}"/> this doesn't work in silverlight 5. there way make work or have links issue? in silverlight 5 didn't add default mechanism binding dynamic objects , instead added new interface icustomtypeprovider . , interface wasn't added expandoobject either, expando should able use indexer binding since idictionary<string, object> implements inotifypropertychanged . <textblock text="{binding [foo]}"/>

php - Magento Programming: Getting list of all Manufacturers and corresponding Manufacturer ID -

i need coding. need list of manufacturers corresponding magento id. possible? please help. thanks. tried mods 1 or other. if possible, pls w/ 1 last thing. thank in advance $attribute = mage::getmodel('eav/config')->getattribute('catalog_product', 'manufacturer'); foreach ( $attribute->getsource()->getalloptions(true, true) $option){ $attributearray[$option['value']] = $option['label']; } foreach($attributearray $key=>$val){ echo $val; } not sure format require in following example should illustrate how values need: $attribute = mage::getmodel('eav/entity_attribute') ->loadbycode('catalog_product', 'manufacturer'); $valuescollection = mage::getresourcemodel('eav/entity_attribute_option_collection') ->setattributefilter($attribute->getdata('attribute_id')) ->setstorefilter(0, false); $preparedmanufacturer...

pyqt4 - simple IPython example raises exception on sys.exit() -

i'm doing simple pyside (and pyqt) tutorials in ipython. 1 tutorial creates window sliders demonstrate slots , signals. when close window of running demo application, see error: an exception has occurred, use %tb see full traceback. systemexit: 0 exit: use 'exit', 'quit', or ctrl-d. so run %tb , this: systemexit traceback (most recent call last) /workspaces/scratch/<ipython-input-1-88966dcfb499> in <module>() 33 34 if __name__ == "__main__": ---> 35 main() /workspaces/scratch/<ipython-input-1-88966dcfb499> in main() 29 w.show() 30 app.exec_() ---> 31 sys.exit(0) 32 33 systemexit: 0 if try execute code again, this: runtimeerror: qapplication instance exists. in case helps, here code: from pyside.qtcore import * pyside.qtgui import * import sys class mywindow(qwidget): def __init__(self): qwidget.__init__(self...

Limited number of results in Google Search using Python -

i trying custom google search python. found relevant code @ developer.google.com . my code: url = ('https://ajax.googleapis.com/ajax/services/search/web' '?v=1.0&q=teen%20wolf%20s02e01%20divxstage.eu&userip=users-ip-address') request = urllib2.request(url, none, {'referer': "http://www.my-ajax-site.com"}) response = urllib2.urlopen(request) results = simplejson.load(response) print results as can see querying teen wolf s02e01 divxstage.eu . above script returned json response . now, when search teen wolf s02e01 divxstage.eu browser first link google gives me link of site divxstage.eu required link. now, if closely @ json response doesn't contain divxstage.eu link , results limited. so, question why there difference in output of above 2 approaches , how customize query required divxstage.eu link www.divxstage.eu/video/6qihgxf1ejzx1 .

java - stringbuffer and "0&" causes truncation or escaping -

sorry unclear title don't know call it, i'll go ahead , explain what's happening. i'm using stringbuffer build url. looks this: http://maps.googleapis.com/maps/api/geocode/json?latlng=49.0516736,8.38891840&sensor=false i encountered behavious when comparing string in unit-test actual result of method. and assertion-error i'm getting: latlng=49.0516736[,8.38891840]&sensor=false> was:<...on?latlng=49.0516736[,8.3889184]&sensor=false the emphasis on character sequence 0]& , 4]& right before sensor=false if remove 0 before & test goes green. then created string looks this: latlng=49.0516736,8.3889184&sensor=false so ... expected. it's not problem, 0 gets truncated , test fail - i've proved code doing it's supposed (when remove zero), want know happening here. 0& must kind of indication array-access or kind of escaping. don't know. idea what's causing behaviour? edit: here's ...

php - I don't want $_SESSION to stop after a long period of time -

possible duplicate: extending session timeout in php i have php sessions problem have if long time not use application, if refresh web browser, notices on $_session's. want know if possible if have not used web page long time, if refresh page, $_sessions remain intact? i know @ symbol can used not show error message? don't want ever stop session. thanks the notices getting describe wrong code. consider correcting code don't notices, instead of avoiding case errors manifest.

c# - Label.property reference -

i inserted label (called label1) in "table cell" in turn inserted datalist. why in situation, can't use, example, label1.text inside page_load method, however when insert label outside datalist, reference label1 works perfectly? is there workaround this, need label in table cell described , able modify caption (.text property) code-behind file, plan assign value of stored procedure. hello , thank in advance. if control inside datalist, repeated each item in list. consequently, doesn't make sense refer control outside of datalist, asp.net not know instance refer - , if there no data, there won't instances! you can access label given item in datalist, however: datalistitem item = datalist.items[0]; // or whichever item want label label1 = (label)item.findcontrol("label1");

javascript - underscore.js templating, iterating over "this" -

how iterate on "this" (or data object passed template) using underscore.js templating? example, if pass data object template: obj = {name: "ben", description: "funny looking"} var template = _.template("<ul> <% _.each(this, function(x, y){ print('<li>'+x+'<li>')}) %> </ul>"); var compiled = template(obj); i expect "this" in iterator loop on data object (like in handlebars), it's not working. ordinarily i'd directly enter <%= name %> template, in case, object keys being determined dynamically. any ideas on how this? thanks! here's easy solution: var compiled = template({data:obj}); and iterate on "data"

Spring Hibernate JSP Insert Error -

i'm trying insert database table, set hibernate/spring, , i'm getting following error the class 'layouts' not have property 'subjectname' the error coming line input type="text" name="subjectname" size="50" value="${fn:escapexml(layout.subjectname)}" but have subjectname defined in 'layouts' model file string, , in hbm.xml file as property name="subjectname" type="string" column="subject"/ i can't select form database, although it's not giving error. feel coming same root problem since hibernate relies on convention, i'd check make sure property name "subjectname", not "subjectname". java's coding conventions , java bean standards member names should start lower case character , provide getter/setter access. private data member "foo" have "getfoo" , "setfoo" methods. are using hibernate fiel...

Can the Vim tabularize plugin match multiple expressions per column? -

i'd use vim tabularize plugin align following type of code: buy <- blabla buy[,cash := blablabla] pr.tmp <- matrix(blaaaaaaaaa) to read follows: buy <- blabla buy[,cash := blablabla] pr.tmp <- matrix(blaaaaaaaaa) my question if tabularize can match "<-" , ":=" in same column? use branches: :tabularize /<-\|:=/ see :help \|

ruby on rails - pg_search using one text field and one category select-type field -

ruby on rails newbie. i'm trying use pg_search gem running difficulties (yes, looking @ documentation). want search form has both text field , select field (category). here code have far: contact_info.rb class contactinfo < activerecord::base ... include pgsearch pg_search_scope :search_by_category, (lambda |category, query| raise argumenterror unless [:prev, :cat].include?(category) { :against => category, :query => query } end end home_controller.rb class homecontroller < applicationcontroller def index @contact_infos = contactinfo.search_by_category(params[:query]) respond_to |format| format.html # index.html.erb format.json { render json: @contact_infos } end end home\index.html.erb <%= form_for :search_by_category, :url => {:controller => 'home', :action => 'index'}, :html => {:method => 'get'} |f| %> <%= text_field_tag :query %> <%= f.la...

c# - dealing with DocPanel on Canvas and XAML -

Image
i need create 3 columns (dock-able) on left side of window using xaml. window used grid base should canvas no more following code work: <stackpanel grid.column="0" margin="1,1,7,0"> </stackpanel> <expander header="one" isexpanded="true"/> <expander header="two" isexpanded="true"/> <expander header="three" isexpanded="true"/> </stackpanel> so i'm using container instead. however, one , two , three displayed on line line however, need have them vertically. <dockpanel horizontalalignment="stretch" margin="0,0,0,0" width="auto"> <expander header="one" isexpanded="true"/> <expander header="two" isexpanded="true"/> <expander header="three" isenabled="true"/> my goal create toolbar on left sid...

Internet Explorer blocked this website from displaying content with security certificate errors -

i have security certificate hosted cdn provider. website https:www.connect4fitness.com navigating site in ie gives following error: "internet explorer blocked website displaying content security certificate errors." when pull site in firefox or chrome, works fine. see warning "mixed content" , "partially encrypted content" when probe certificate details. all outbound links on site https. it's content injected cdn triggering message. how pinpoint exact part of webpage not being encrypted? need information work tech support of cdn company claiming fine. are there tools or techniques can use find out part of rendered page received browser not encrypted? additional information: purging cdn cache resolved error messages firefox , chrome. ie still complains mixed content though not see "http" requests going out on network tab. ideas? the actual issue triggering mixed content error on ie broken link included hosted ...

Cocos2d 2.0 - 3 numbers on the bottom left -

i have 3 numbers on bottom left part of screen on cocos2d 2.0 project: 82 0.016 60.0 60 fps , other two? remember, previous versions of cocos had fps number. any clues? thanks 82 <-- number of draw calls 0.016 <-- time took render frame, here: 1.0/60.0 = 60 fps 60.0 <-- frames per second the first number (82) number of draw calls (which high). typically each node renders on screen (sprites, labels, particle fx, etc) increases number one. draw calls expensive, important keep number down. 1 way batching draw calls - cocos2d v3 automatically. the time took render frame, in seconds. since need draw new frame every 0.016666666 seconds in order achieve 60 frames per second ( 1/60 = 0,0166… ) it's inverse of framerate. the last number number of frames per second aka framerate aka fps. value, previous one, averaged on several frames doesn't fluctuate much. note ios devices have vsynch (vertical synchronization) on. game can render frame every 0.0...

java - Generate XML Output from Jasper Reports -

our team has integrated jasper reports spring mvc project generate pdf/csv/html reports. have requirement generate xml output our database feeding other systems. wondering if possible use jasper reporting engine purpose (i.e. generate xml output file though report format - tags etc. customised our target schema), , if possible, sensible way use jasper reporting engine. thanks replies

map - Images' size in Leaflet (Cloudmade) popups don't seem to count to determine popup's size -

i'm having hard time getting around problem came across while using leaflet's library on mapbox map. specifically, i've written code popup bind each icon/marker on map. inside each popup there's image links different website. unfortunately seems image's size doesn't count towards calculation of size of actual popup, having following consecuences: the image bigger popup ( http://postimage.org/image/c7u0n5sx3/ ) the autopan option does't work my code following: <?php // retrieves info correct rows in database further input in javascript while ($row = mysql_fetch_assoc($get_info)){ $name = $row ['nombre']; $lat = $row ['lat']; $long = $row ['long']; echo "<script type=\"text/javascript\"> var latlng = new l.latlng(".$row ['lat'].", ".$row ['long']."); var flyer = \"<a href='boliches/pdnws/".$...

java - Forcing other phones to recognize update in bluetooth device name for android -

i creating android app requires using android phone's name store information phone. name of phone changing. however, when other phones perform multiple bluetooth scans, seem use first name recognized phone, after phone name has changed. there way force android app see new name or flush kind of cache bluetooth scan has finished? as noted in howell's answer can use setname change name, , can use fetchuuuidswithsdp() force update of name of phone, believe there no way force device update service information , name has you. i guess best can create new connection , hope that triggers update info has on you, if worked implementation dependent (i.e. not reliable), because has no need to.

xslt - Modify element based on subelement's partial value via xsl -

i have follow xml 1.0 code <oldele userlabel="label1"> <ele1>%02d.jpeg</ele1> </oldele> <oldele userlabel="label2"> <ele1>%02d.tiff</ele1> </oldele> i want change oldele jpeg , tiff each oldele using xsl v1.0. want xsl this: <jpeg userlabel="label1"> <ele1>%02d.jpeg</ele1> </jpeg> <tiff userlabel="label2"> <ele1>%02d.tiff</ele1> </tiff> i have tried following not working: <xsl:template match="/oldele"> <xsl:for-each select="/oldele"> <xsl:if test="contains(/oldele/ele1,'jpeg')"> <jpeg> <xsl:apply-templates select="@*|node()"/> </jpeg> </xsl:if> </xsl:for-each> </xsl:template> thanks! if can guarentee ele1 element ever contain 1 full-stop, extract file exte...

how can i recover windows chk-files extensions in linux bash -

after scan disk have lot of chk-files in folders "found.000", ... i can find out extensions file command: for in /media/daten/found.*/*.chk ; file $i; done how can use reconstruct file extensions these files? this technique not work files. used use data recovery. for in /media/daten/found.*/*.chk; mv "$i" "$i".$(grep $(file -bi $i | awk '{print $1}' | sed 's/;//') /etc/mime.types | head -1 | awk '{print $2}'); done the way works uses mime type functionality in file command greps /etc/mime.types it, picks first extension in list , renames file that. this command mass renames, move first , ask questions later, 100% sure you're running on correct directory. next time, not use chkdsk recover files. can damage them beyond repair. chkdsk om nom nom data , burp afterwards. use recovery software files need before chkdsk. generally, files named .chk though, not .chk (just fyi.)

MySQL 5.5. installation on Windows doesn't show up in the registry properly -

i trying django mysql working on windows 7 machine. need mysqldb interface this. when try install "mysqldb interface", looks mysql installation in hkey_local_machine . in registry shows in hkey_current_user/software/mysql ab/mysql server 5.5 . my sql instance seems work fine. mysqldb installer somehow needs in hkey_local_machine (i think) doesn't let me finish install. throws me error. traceback (most recent call last): file "setup.py", line 15, in <module> metadata, options = get_config() file "c:\blah\software\mysql-python-1.2.3\setup_windows. py", line 8, in get_config mysql_root, dummy = _winreg.queryvalueex(serverkey,'location') windowserror: [error 2] system cannot find file specified thanks lot time. you can fix registry key in site.cfg . or can download windows msi package sourceforge. (no, did not exist when question posted.)

android - Can't figure out correct argument form - calling a method from within a static nested class in Java -

i'm testing code copied java android examples site. i'm trying modify start new activity when user clicks row of current activity. i'm using intent method i'm not able figure out how reference current view instance argument intent method. i've tried dozens of combinations, , spent 2 days researching. must seem basic many of know, apologies, week #2 me learning java, eclipse , android sdk (target= api 8) public class customlistviewdemo extends listactivity { private efficientadapter adap; private static string[] data = new string[] { "0", "1" }; private static string[] titlestring = new string[] { "title1", "title2" }; private static string[] detailstring = new string[] { "detail1", "detail2" }; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main); adap = new ef...