Posts

Showing posts from August, 2011

How to construct a full-text search predicate for SQL Server 2008 -

i want search full-text column following 2 terms: 2011 j vineyards where construct predicate as "2011*" , "j vineyards*" no rows returned. a record should match is 2011 j vineyards viognier alexander valley united states after experimentation, seems related single "j" character. edit: here select statement full-text column beveragesearchdata. declare @test nvarchar(100); set @test='""2011*" , "j vineyards*"'; select * bv_beverage contains (beveragesearchdata,@test) there couple of possibilities going on here. full query , not predicate better answer. one thing going on sql full-text search eliminates single characters (as in j) when building index. if using contains , may need change noise file , restart sql server fulltext search service. if using like , may able try adding additional single character wildcard. play , see if works without 2011 , add in. where mycolumn 'j_vineyards%' mycolumn ...

sitemap - How to create left navigation using asp.net Menu control with label in between links? -

Image
i have left navigation menu have 3 asp.net menu controls 3 sitemaps below is possible achieve using 1 sitemap , 1 menu control ? sitemap - how create left navigation using asp.net menu control label in between links? - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads log in sign up learn, share, build each month, on 50 million developers come stack overflow learn, share knowledge, , build careers. join worldรข€™s largest developer community. s...

oauth - Having trouble with the oauth_verifier for offline use in simple linkedin php -

disclaimer, please pardon grammatical syntax. i'm using simple linkedin php library offered on linkedin's site. have followed instructions , have collected users oauth-token , oauth-secret. 2 pieces of information have been stored in database. know how make offline oauth call, im having trouble finding more information on oath-verifier. code have far. include('../../php/linkedin/linkedin_3.2.0.class.php'); include '../../php/global.settings.php'; $api_config = array( 'appkey' => linkedin_app_key, 'appsecret' => linkedin_app_secret, 'callbackurl' => null ); $linkedin = new linkedin($api_config); $linkedin->request_token = "4e1e5ede-1de4-4eba-ba33-d3d37cbe67ff -fake"; $linkedin->access_token = "82b2c333-1075-441b-a51f-657196bf507w -fake"; $search_response = $linkedin->search("?company-name=facebook&count=10"); var_dump($search_response); temporarily i'm inserting keys on own trying...

c# - How to check if string will fire รข€œA potentially dangerous Request.Form value was detectedรข€¦รข€ error -

similar this question don't care characters will/won't cause error fire. i'm more curious method can call, check myself, if current string fire above error message. to give bit of background, i'm creating random passwords when user forgets theirs , needs reset. unfortunately, random password generator "accidentally" created 1 &# in recently. caused page break when user tried login it. as mentioned in plenty of posts around topic, validaterequest=false (or <httpruntime requestvalidationmode="2.0" /> .net 4.0) can used turn off .net checking these exploits, don't see reason lose layer of security when i'm 1 creating string in first place. , telling random generator re-randomize on incomplete list ( < , &# , etc) doesn't seem cleanest solution i'd use same method of checking .net using. microsoft's explanation of exploits in question , being done guard against them here . this guy talks finding function cal...

linux - replay bash session with correct time delay -

edit ( seems important, goes on top, see below details) : need script execute commands, not display recorded ! script utility not far know. auto hotkey, bash , linux, timing information recorded. the question : i record , replay bash session, exact time delay between key presses , on. for instance, if run program called xxx , break ctrl+c after 11.4s , run program called yyy 3.4s after exited xxx , replay same (break xxx ctrl+c after 11.4s, wait 3.4s , run yyy ). i don't need record mouse movements, interested in recording happens in single bash session. i have looked utilities as script (it records bash session commands, no time delay info.) xmacro (it records key presses again no time info.) a person searching similar might want this (i including link because of possible value other users; don't find of solutions mentioned useful want achieve.) script -t standard answer. i rewrote script in python, can find here: http://stromberg.dnsalias.org/~strombrg/pyp...

dictionary - Comparing values of different python dictionaries with different keys & structures -

this more of theoretical question anything. have 3 dictionaries have different structure/keys values may same. e.g. dict1 = {u'd':{u'results':[{u'number':'1', u'dispurl':u'www.site.com'}, {u'number':u'2', u'dispurl':u'www.othersite.com'}] }} dict2 = {u'result_page':{u'url':u'www.greatsite.com', u'pos':u'1'}, {u'url':u'www.site.com', u'pos':u'2'}} dict3 = {u'hits':[{u'displayurl':u'www.othersite.com', u'index':u'1'}, {u'displayurl':u'www.site.com', u'index':u'2'}] } note how dict1 has {u'd': before {u'results': , dict1 , dict3 have different key/values enclosed in square parentheses. note how keys/values layout different in dict1 number key coming before url instead of after in dict2 , dict3 , key names being different in each dictionary. ...

javascript - What does the jQuery function $('#myelement').is('*') do? -

what following code do: $('#myelement').is('*') what asterisk signify? since there 1 element, #myelement , can't understand point of using is() , checks if element matches set of elements? this existential javascript. $('#myelement').is('*') it fail whenever #myelement doesn't exist, , return true otherwise.

c# - How to free connection after HttpWebRequest Async Abort() -

here's understand using httpwebrequest make request asyncronously: the essential structure making asynchronous web request call begingetresponse() , start timer @ same time. if response doesn't timeout, begingetresponse() call callback method call endgetresponse() , read response. if response timeout, different callback method timer gets called , webrequest.abort() invoked. this structure hinges on fact abort() , endgetresponse() exclusive. calling abort() after endgetresponse() has no effect , calling endgetresponse() after abort() causes endgetresponse() throw exception can caught , handled want handle timeouts. my problem when need make several hundred requests per second several services , 1 service starts becoming very, latent. timeout callback might called after 500ms , calls abort() , program continues happily. because service still hasn't returned 10 seconds later, first thread started begingetresponse() still waiting , network connection resource unavailable us...

java - Is it possible to store widgets in a list/array? -

all- have ton of spinners store in list/array don't have rewrite lots of code. have 30 spinners go through same exact code. trying figure out way put 30 spinners in array list , run array/list through code. example: spinner spinner1 = (spinner) findviewbyid(r.id.spinner); spinner spinner2 = (spinner) findviewbyid(r.id.spinner2); list<string> listofspinners= new arraylist(); // part not sure listofspinners.add(spinner1); listofspinners.add(spinner2); arrayadapter<string> adapterspinner = new arrayadapter<string>(this, r.layout.spinnerlayout, infoinspinner); adapterspinner.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); listofspinners.setadapter(adapterspinner); //i want use list here (listofspinners) i don't know if possible though ask otherwise going long night of writing repeating code:). time! store ids in array, int s. loop through them set adapter. arraylist<integer> listofspinners = new arraylist<integer>(); lis...

c# - GDI+ error when ASHX deployed to Azure -

i have following code composing ashx file hosted on azure: public void processrequest(httpcontext context) { int number; try { number = int.parse(context.request.querystring["number"]); } catch { number = -1; } var bitmap = new bitmap(173, 173); drawimage(bitmap, number); context.response.contenttype = "image/png"; bitmap.save(context.response.outputstream, imageformat.png); context.response.flush(); } private void drawimage(bitmap bitmap, int number) { using (var graphics = graphics.fromimage(bitmap)) { graphics.fillrectangle(getbrush(number), 0, 0, 173, 173); font font = new font("segoe ui", 40f, fontstyle.bold); stringformat textformat = new stringformat { alignment = stringalignment.far, linealignment = stringalignment.center }; rectangle rectangle = new rectangle(0, 0, 160, 173); graphics.drawstring("76", font, brushes.black, rectangle, textformat); font = new font("arial", 16, fontstyle.bold); textformat = new stringformat { ali...

rails link path and routing error when model singular and plural name are the same (e.g. equipment, species) -

<%= link_to t('.new', :default => t("helpers.links.new")), new_equipment_path, :class => 'btn btn-primary' %> i have above code in view, getting following error when clicking link: no route matches {:action=>"show", :controller=>"equipment"} my routes file contains: resources :equipment resources :workouts match ':controller(/:action(/:id))(.:format)' why trying access show action? here entries routes: equipment_index /equipment(.:format) equipment#index post /equipment(.:format) equipment#create new_equipment /equipment/new(.:format) equipment#new edit_equipment /equipment/:id/edit(.:format) equipment#edit equipment /equipment/:id(.:format) equipment#show put /equipment/:id(.:format) equipment#update delete /equipment/:id(.:format) equipment#destroy this issue has cropped before , related how rails scaffolding generates new.html.erb file models have names 'equipment' both singular , plural. ...

windows - VB.NET No Such host is known IP Grabber -

my program grabs ip of specific subdomains of host. if 1 of them don't exist gives error saying: no such host known. how can make replace text in lbldirect "not found" instead of give error. dim dhostname iphostentry = dns.gethostentry("direct." + textbox1.text) dim dip ipaddress() = dhostname.addresslist lbldirect.text = dip(0).tostring is code i'm using grabbing ip. use try...catch handle error , set label value in catch section.

assembly - What is the scope of lock prefix? -

it said assembly instruction prefixed "lock" atomic. want know if "lock" can affect 1 assembly instruction; assembly instruction not atomic? here example of atomic function in linux kernel: static __inline__ int atomic_sub_and_test(int i, atomic_t *v) { unsigned char c; __asm__ __volatile__( lock "subl %2,%0; sete %1" :"=m" (v->counter), "=qm" (c) :"ir" (i), "m" (v->counter) : "memory"); return c; } in example can subl , sete interrupted? the lock prefix affects single instruction. instructions stop being atomic when modify memory shared between several cpus. modifications involve reading memory operand, performing operation on (e.g. and, xor, inc, etc) , writing not seen atomic other cpus. lock prefix "locks" memory location, 3 steps (read, modify, write) one, i.e. other cpus can observe before , after locked instruction. see official cpu documentation intel or amd. edit : in new...