Posts

Showing posts from January, 2014

osx - How can I detect whether a Mac has a Retina display from Java? -

osx - How can I detect whether a Mac has a Retina display from Java? - i've found swing image rendering bug afflicts macs retina displays ( type_int_argb_pre bufferedimages fail draw). have effective workaround (use type_int_argb images instead), in order apply it, need able observe whether host machine mac retina display. detecting whether machine mac no problem, how can determine display type? toolkit.getdefaulttoolkit().getdesktopproperty("apple.awt.contentscalefactor") the above line should homecoming 2.0 on retina displays. on more recent non-retina macs returns 1.0 , on other platforms null . can't find official documentation, ran across in mailing list post while trying solve similar problem. java osx

How do you search amazon's api for EAN codes using the Zend Framework? -

How do you search amazon's api for EAN codes using the Zend Framework? - i've got this: $barcode = '5055060927427'; $amazon = new zend_service_amazon($this->amazon_api_key, 'uk', $this->amazon_api_secret); $amazon = null; $amazonres = $amazon->itemlookup($barcode, array( 'searchindex' => 'all', 'associatetag' => 'non associate', 'idtype' => 'ean', 'responsegroup' => 'large,itemattributes,images', ) ); but gives me error: fatal error: uncaught exception 'zend_service_exception' message '5055060927427 not valid value itemid. please alter value , retry request. (aws.invalidparametervalue)' in c:\wamp\www\easionline\src\zend\service\amazon.php on line 319 the game trying find is: http://www.amazon.com/asuras-wrath-playstation-3/dp/b003o6hlok/ref=sr_1_1?ie=utf8&qid=1360139714&sr=8-1&ke...

How to optimize this Python script? -

How to optimize this Python script? - there numerous solutions (a, b, c) integer right triangle perimeter p, , these solutions a+b+c == p , pythagorean theorem applies. writing python script calculate maximum number of solutions possible triangle perimeter <= 1000. my script correct, takes forever run. i'm sure take more 30 minutes i7 processor, need optimize it. can help me? (this problem on project euler, in case wondering) def solutions(p): result = [] in range(1, p + 1): b in range(1, p - + 1): c in range(1, p - - b + 1): if + b + c == p , < b , b < c: d = ** 2 e = b ** 2 f = c ** 2 if (d + e == f) or (e + f == d) or (f + d == e): result.append((a, b, c)) homecoming len(result) max_p = 0 max_solutions = 0 p in range(3, 1001): print("processing %d" % p) s = solutions(p) if s > ma...

asp.net mvc - Set 'editor-field' value in ASP MVC3 View -

asp.net mvc - Set 'editor-field' value in ASP MVC3 View - i give field in asp mvc view default value of current date, cannot figure out how in view code. need allow field update-able, however, since not current date. suggestions? <div class="m-editor-label"> effective date </div> <div class="m-editor-field"> @html.editorfor(model => model.effectivedate) @html.validationmessagefor(model => model.effectivedate) </div> edit i have tried give field default value in model private datetime? effectivedate = datetime.now; public nullable<system.datetime> effectivedate { { homecoming datetime.now; } set { effectivedate = value; } } however get property gives me next error message: monet.models.agenttransmission.effectivedate.get must declare body because not marked abstract extern or partial ^ (monet name of project, , ag...

jquery ui - copy data from one Html.listboxfor to other listbox in asp.net mvc -

jquery ui - copy data from one Html.listboxfor to other listbox in asp.net mvc - i have 2 html.listboxfor called a & b . 1) a has info populated db & b empty. 2) want functionality this items list a placed list b . $('.add').on('click', function() { var options = $('select.multiselect1 option:selected').sort().clone(); $('select.multiselect2').append(options); }); $('.addall').on('click', function() { var options = $('select.multiselect1 option').sort().clone(); $('select.multiselect2').append(options); }); $('.remove').on('click', function() { $('select.multiselect2 option:selected').remove(); }); $('.removeall').on('click', function() { $('select.multiselect2').empty(); }); 3) tried asp.net mvc, unable fetch selected items in model & controller. 4) want way can perform in asp.net mvc. if there can way in mvc able s...

mysql - Prepared Statement: How to join header -

mysql - Prepared Statement: How to join header - i've got 2 tables want bring together header , first column within prepared statement. i've got managed bring together column, how bring together header? table1 : id |name ---------- 1 | 2 | b 3 | c 4 | d 5 | e table2 : teama|teamb|won|lost -------------------- 1 | 2 | 5 | 3 1 | 3 | 2 | 4 1 | 4 | 9 | 1 2 | 5 | 5 | 5 3 | 1 | 2 | 4 result-matrix: | | b | c | d | e ---------------------------- | 0 | 2 | -2 | 8 | 0 b | 0 | 0 | 0 | 0 | 0 c | -2 | 0 | 0 | 0 | 0 sql fiddle in order team names ids, have bring together on table twice. if know values, static version of code is: select a.name teama, max(case when b.name = 'a' won - lost else 0 end) a, max(case when b.name = 'b' won - lost else 0 end) b, max(case when b.name = 'c' won - lost else 0 end) c, max(case when b.name = 'd' wo...

Check for dash before applying titleize in Rails -

Check for dash before applying titleize in Rails - i new ruby , rails , need know how check if string contains dash before applying titlelize. @city = city.first :conditions => { :title => params[:city].titleize } what need is: @city = city.first :conditions => { :title => params[:city] } and write apply titleize if @city variable doesn't contain dash. i solution added zachrose couple of weeks ago: https://gist.github.com/varyonic/ccda540c417a6bd49aec def nice_title(phrase) homecoming phrase if phrase =~ /^-+$/ phrase.split('-').map { |part| if part.chars.count == part.bytes.count part.titleize else part.split(' ').map { |word| word.mb_chars.titleize }.join(' ') end }.join('-') end ruby-on-rails-3

hadoop - Calling htable.get(rowID) in reduce task returns NULL for random rows -

hadoop - Calling htable.get(rowID) in reduce task returns NULL for random rows - in hadoop mapper task, create [key,value] = [sortkey,rowid] scanning hbase table in cut down task, when result=htable.get(rowid), returns null, randomly, diffrent rowids. on querying in hbase shell, able fetch same rowid. input hbase table row count of 1000 (mapper able fetch these records), around 100 records returns htable.get(rowid) null (in reducer), these 100 records available in table. any thought why 'get' on htable homecoming null randomly? caching or memory tweaking solve this? am using hadoop-1.0.3, hbase-0.92.1 i using hashmap store text rowids, , cos of that, referring same location within loop. since doing updates/deletes within loop, row ids not found. either changing hashmap string, or creating new text object , adding hashmap solved issue. hadoop mapreduce hbase

ruby - Rails 3 Mobiscroll Gem -

ruby - Rails 3 Mobiscroll Gem - i running rails application on heroku , tried import mobiscroll-rails gem. gem works fine on heroku, however, whenever seek run rails/rake command on local machine, next error: couldn't find file 'mobiscroll.list' (in c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/mobiscroll-rails-2.3.1/vendor/assets/javascripts/mobiscroll.js:11) i running windows 7, ruby 1.9.3, rails 3.2.9. anyone have hints on do? check out https://github.com/dinuz/mobiscroll-rails/commit/972c89db2dcfa85fef144ddb9bd0e036d0209414 looks you're using old version of gem. prepare this, follow commit - rename 'vendor/assets/javascripts/mobilscroll.list.js' 'vendor/assets/javascripts/mobiscroll.list.js' ruby-on-rails ruby mobiscroll

django - escape % character in Python -

django - escape % character in Python - i have next string in python, rendered in template django. link_string = '<a href="/search/?q=%23%s"> %s </a>' it link search url %23 '#', because i'm trying search objects #hashtag. i intend interpolate string 2 values, %s after %23 , one: link_href = link_string % ('hashtag_value', 'link name') what proper way obtain next final string: <a href="/search/?q=%23hashtag_value"> link name </a> thank much link_string = '<a href="/search/?q=%%23%s"> %s </a>' python django string escaping design-patterns

javascript custom dialog box with delay -

javascript custom dialog box with delay - i want popup dialog box , after 5 seconds, want page redirects google.com . therefore, need have delay function settimeout() doesnt work. here code. how can delay 5 seconds before redirect... way, using someone's javascript code display works perfectly. <a href="javascript:showdialog('error','you have encountered critical error.','error',10);settimeout(window.location.href ='http://google.com', 5000);">error</a> settimeout works, it's not used correctly. seek this: javascript function clickhandle() { showdialog('error','you have encountered critical error.','error',10); settimeout(function () { window.location.href ='http://google.com'; }, 5000); } html <a href="clickhandle()">error</a> the first argument of settimeout code executed (for illustration string evaluated) improve pract...

Python 2.7: strange constructor behavior: changing wrong field -

Python 2.7: strange constructor behavior: changing wrong field - in code: # coding=utf-8 def print_tree(node, tree=0): print(u"|---" * tree + u"-> %s" % node) kid in node.children: print_tree(kid, tree + 1) class person(object): parent = none first_name = none last_name = none children = [] def __str__(self): homecoming '%s %s' % (self.first_name, self.last_name) def __unicode__(self): homecoming u'%s %s' % (self.first_name, self.last_name) def __init__(self, first_name, last_name, parent=none): if parent not none: if not isinstance(parent, person): raise attributeerror('`parent` not `person` type!') self.parent = parent self.parent.children.append(self) self.first_name = first_name self.last_name = last_name #self.children = [] root = person('alan', 'smith') p1 =...

Breeze item's arent loaded right with virtual properties on the domain class -

Breeze item's arent loaded right with virtual properties on the domain class - i have on domain class virtual icollection property. if leave property, items generated breeze after query don't have entityaspect attribut. if delete virtual, works. example: this products poco : public class product : baseentity { [required] public string name { get; set; } public decimal cost { get; set; } public string description { get; set; } // if leave property this, works fine. public icollection<category> categories { get; set; } //if this, entities loaded breeze, got no entity aspect property public virtual icollection<category> categories { get; set; } } make sure disabled proxy creation , disabled lazy loading in dbcontext . can either this: this.configuration.lazyloadingenabled = false; this.configuration.proxycreationenabled = false; or can utilize efcontextprovider acc...

ios - Can I set up an OCMock object to expect a char * argument? -

ios - Can I set up an OCMock object to expect a char * argument? - i'm trying verify method called on mocked object particular pointer value 1 of method's arguments, maintain getting "argument type '*' not supported." exception when mocked method called. here's test code: uint8_t *buf = calloc(65, sizeof(uint8_t)); id stream = [ocmockobject nicemockforclass:[nsinputstream class]]; [[stream expect] read:buf maxlength:64]; id mystream = [[mystream alloc] initwithstream:stream]; // mystream should pass read:maxlength: phone call through stream [mystream read:buf maxlength:64]; stassertnothrow([stream verify], @"did not pass phone call through"); here's -[mystream read:maxlength:] : - (nsinteger)read:(uint8_t *)buffer maxlength:maxlength { // internalstream stream passed -initwithstream: homecoming [self.internalstream read:buffer maxlength:maxlength]; } when phone call -read:maxlength: on mocked stream, "argume...

Cannot connect to server - Error 26 -

Cannot connect to server - Error 26 - my local server name user-f7a3ee0ff2\sqlexpress in sql server 20008 r2, user id "sa" password correct. able access before few hours after restarting scheme not accessible. while connecting local server in sql server 2008 r2 error message coming like: but, remote server accessible. solution? sql-server-2008-r2

c# - Saving an image to media library in Windows phone 7 -

c# - Saving an image to media library in Windows phone 7 - i trying save image image command named image1 in app mainpage phone's media library here code, in writeablebitmap wr = image1; gives me error. public void saveimageto(string filename = "gage.jpg") { filename += ".jpg"; var mystore = isolatedstoragefile.getuserstoreforapplication(); if (mystore.fileexists(filename)) { mystore.deletefile(filename); } isolatedstoragefilestream myfilestream = mystore.createfile(filename); writeablebitmap wr = image1; // give image source wr.savejpeg(myfilestream, wr.pixelwidth, wr.pixelheight, 0, 85); myfilestream.close(); // create new stream isolated storage, , save jpeg file media library on windows phone. myfilestream = mystore.openfile(filename, filemode.open, fileaccess.read); medialibrary library = new medialibrary(); //byte[] buffer = tobytearray(qrimage); libra...

jquery - How do I configure library plugins with Require.js? -

jquery - How do I configure library plugins with Require.js? - i have jquery / require.js / backbone project loads jquery datatables library along several of plugins. configuration below works fine, seems kinda gross. is there more elegant way load datatables dependent plugins? it cool if there inverse of "deps" shim property load kid plugins 1 time given library loaded. also, in config below i'm loading external dependencies app scope because literally used every single backbone view in app , don't want have define/include them in every module. is stupid load external libraries in app scope rather including them in every view? i appreciate best practice kind of guidance here. i've read lot of related threads on site , haven't been able find much in way of examples people loading lot of dependencies this. require.config({ baseurl: 'js/com/mycompany/', paths: { jquery: '/js/lib/jquery', underscore...

view - Android getWidth, getHeight, getLeft, getRight not correct after setScaleX() , setScaleY() -

view - Android getWidth, getHeight, getLeft, getRight not correct after setScaleX() , setScaleY() - i seek implement zoom in/out spread/pinch gesture , drag , drop functions on relative layout. this code of onpinchlistener handle zoom effect. mainview relativelayout defined in layout xml file. i implement touch listener in fakeview should in front end of view. touch event alter mainview according code. i want inquire if possible actual left, top, width , height after scale? homecoming 0,0 left , top, , original width , height after zoom. thanks much! <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linear_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <relativelayout android:id="@+id/zoomable_relati...

file io - read()/write() calls on iOS seem to be limited by 2250 bytes -

file io - read()/write() calls on iOS seem to be limited by 2250 bytes - i having unusual problem trying read , write 9k bytes open(), read() , write(). when effort write 9k file , read back, info goes 2250 bytes. after zeros. here code (except filename isn't relevant, i'm putting nsdocumentdirectory): int fp = open([appfile cstringusingencoding:nsasciistringencoding], o_rdwr | o_creat, 0644); [_detailviewcontroller log:@"first open() returns %i (err: %i)", fp, errno]; int data2[10000]; int data3[10000]; (int i=0;i<10000;i++) data2[i] = 1; [_detailviewcontroller log:@"resetting seek 0"]; int seekpos = lseek(fp, 0, seek_set); result = write(fp, data2, 9000); [_detailviewcontroller log:@"wrote 9k, result %i", result]; [_detailviewcontroller log:@"resetting seek 0"]; seekpos = lseek(fp, 0, seek_set); result = read(fp, data3, 9000); [_detailviewcontroller log:@"read 9k, result %i", result]; [...

logging - JBoss 7: Equivalent to jboss-log4j.xml -

logging - JBoss 7: Equivalent to jboss-log4j.xml - i don't want configure logging using standalone.xml or cli, because requires additional steps colleagues working development environment. want have these configuration files checked in our source code , automatically applied @ deployment time. with jboss 5 there possibility declare logging in jboss-log4j.xml. there equivalent file in jboss 7, too? we want utilize slf4j , logback. you can add together logback configuration application. need include logback in application. might have utilize jboss-deployment-structure.xml, similar log4j exclusion one, exclude org.slf4j module. configure logging application though. if you're concern getting logging subsystem configured there couple other possibilities work depending on environment. the first , 1 work environment create cli script checked in , run. ${jboss_home}/bin/jboss-cli.sh --connect --file path/to/script.cli if you're using maven sec possibi...

WP8 App misbehaving due to StreamWrite in JavaScript -

WP8 App misbehaving due to StreamWrite in JavaScript - i save results calculated on html page in textfile using javascript. <script type="text/javascript"> window.onload = function () { var sw : streamwriter = new streamwriter("html_results.txt"); sr.write('xyz"); *** calculations ****** sr.write (result); } </script> by doing this, my wp8 app misbehaving , not displaying images usual. app image fader (calculates fps). also tried: streamwriter sr; seek { sr = new streamwriter("\html5\htmlresults.txt"); sr.write("xyz"); file.setattributes("html5\htmlresults.txt", fileattributes.hidden); } catch(ioexception ex) { console.write ("error writing"); //handling io } the aim to: extract calculated values of several html pages(after getting loaded 1 one) in single text file. a resultant html reads text file , displays results in tabular format. is the...

android - I can't dismiss ProgressDialog when webvView has completed loading the webpage -

android - I can't dismiss ProgressDialog when webvView has completed loading the webpage - i want dismiss progressdialog when webview completed loading webpage, isn't working me. here code : bundle com.mcc.ghurbo; import java.security.publickey; import android.app.activity; import android.app.progressdialog; import android.content.context; import android.content.intent; import android.os.bundle; import android.os.handler; import android.os.message; import android.view.window; import android.webkit.websettings; import android.webkit.webview; import android.webkit.webviewclient; public class ghurboactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main); final webview mywebview=(webview)findviewbyid(r.id.webview); mywe...

python - Is it possible to do automation testing for QML using squish? -

python - Is it possible to do automation testing for QML using squish? - i need know if squish built test qml standalone applications? know can test qt standalone applications.but unable same qml specifically. yes, squish can test qml standalone application. version of squish used? have tested squish qml application few months ago, , works well. please refer related news squish: http://www.prweb.com/releases/2013/9/prweb11160262.htm python testing automated-tests qml

c++ - Normalize values to a smaller range -

c++ - Normalize values to a smaller range - description i have rather big set of (string, string, string) unique tuples (around 40mln can bigger). tuple each compute single unsigned int value. store values somewhere after generating them reused (even after application goes downwards in memory storage out of question, databases unfortunately). at first stored them in file tuple (string, string, string, value) reading in 40mln records takes time (and need instantly). i decided first compute hash value of each (string, string, string) tuple normalize [0, n] (where n number of values) , store values in binary file in sorted order (sorted normalized hash value). after can mmap() file , values mmap[normalize(hash(string, string, string))]. my hash function pretty straightforward fast , works in case (didn't notice collisions): concatenatedstring = s1+"."+s2+"."+s3 unsigned int hash = 31; for(int = 0; < concatenatedstring.length(); i++) { hash = ...

unit testing - When do BDD scenarii become too much specific? -

unit testing - When do BDD scenarii become too much specific? - after inspiring training tdd , bdd, seek implement methodology, using mstest , specflow . have question i'm stuck to: i've written acceptance tests validate subsystem working on. our scheme little distributed: there 3rd party computer with own application running freely with 3rd party database accessing through tcp/ip however my specflow scenario seems much specialized own development set-up: contains inputs valid me. in illustration below, ip adress accessible me. , target directory namely directory on machine. the accredited tester/validator, or product owner not able launch same test scenario, since won't have access machine. developper colleages may not either. @lastone scenario: lattest 3rdparty ocr info specified directory given indicate 'database' databasename of 3rd party computer , indicate '12.126.42.21' ipaddress of 3rd party computer , indicate 'user...

python - How lxml with cssselect get text -

python - How lxml with cssselect get text - example: html='<div class="a"><input type="text" value="bla bla bla">some text</div>' import lxml.html doc = lxml.html.document_fromstring(html) a=doc.cssselect("div.a") print a[0].text this print empty string... how "some text"? python css-selectors lxml

javascript - Trouble with static properties being undefined in CoffeeScript -

javascript - Trouble with static properties being undefined in CoffeeScript - so i'm writing coffeescript project , i'm trying create static properties in class. i've been next file in codebase same thing successfully, mine isn't working. my code class messages @toggleunreadconversations:()-> # line in question, messages defined # functions property viewonlyunread undefined messages.viewonlyunread = !messages.viewonlyunread @init:-> @viewonlyunread = false other code in code base of operations uses static properties class map @cacherealtor: (realtor) -> realtor.realtor_id = parseint(realtor.realtor_id) # here static property idtorealtormap defined map.idtorealtormap[parseint(realtor.realtor_id)] = new realtor() @init: -> @idtolistingmap = [] @idtorealtormap = [] from can tell these init functions beingness called same way, when page loads init call...

cross platform - What are some problems with having $ in file names? -

cross platform - What are some problems with having $ in file names? - i'm trying convince fellow developers not include $ in file names couldn't come argument other perl scripts may need updated. suggestions? a quick glance @ wikipedia's filename page reveals zos , commodore dos disallow user of $ appearing in file names. can see why have problem coming reason not utilize them. cross-platform special-characters compatibility filenames

ExtJS4 Selector in a Region -

ExtJS4 Selector in a Region - i attempting ref grid in region: ... region: 'south', layout: 'fit', split: true, items:[{ xtype: 'grid', border: false ... }] ... in refs section of controller not know how reference actual grid within region: {ref: 'mygrid',selector:'????'} will please kick me in right direction, please. give thanks you. refs intended views, not components. reason 1 controller can ref specific view. utilize selector 1 of alias view. you'll have create view extends ext.panel.panel , contains ext.grid.panel or view extends ext.grid.panel. view must have alias on own , alias utilize selector. extjs4 css-selectors

ibatis - Nested ResultMaps with ambiguous database columns -

ibatis - Nested ResultMaps with ambiguous database columns - i have couple of nested resultmaps in ibatis have same database column names. causing ambiguity , resulting in wrong result beingness retrieved different database tables. for e.g., ` <sql namespace="shipment"> <resultmap id="consignment" class="com.model.consignment"> <result property="consignmentid" column="consignment_cd" /> <result property="shipmentcd" column="shipment_cd" /> <result property="shipmentunit" column="shipment_unit" /> <result property="location" resultmap="shipment.size" /> </resultmap> <resultmap id="size" class="com.model.size"> <result property="consignmentid" column="consignment_cd" /> ...

GAS gadget inserted to googleSite... for non-google accounts -

GAS gadget inserted to googleSite... for non-google accounts - i think same question: http://code.google.com/p/google-apps-script-issues/issues/detail?id=852 but clear: google apps scripts won't run on google site without google/gmail user beingness signed in? ...are there other google products gas can deployed non-google accounts? thanks, nathan false. can embed apps script in google site using insert > script gadget. sure publishing setting set "anyone, anonymous". google-apps-script

ACCESS 2003: Checking to see if record exists BEFORE UPDATE and then display message THEN OPEN existing record -

ACCESS 2003: Checking to see if record exists BEFORE UPDATE and then display message THEN OPEN existing record - working on awhile , i'm getting runtime error 2501 i'm trying pull record after message box appears stating duplicate has been found , upon clicking "ok" pulls record. i have been tinkering docmd.findrecord, docmd.gotorecord, , docmd.openform methods no avail. any help appreciated. thanks in advance. private sub mrn_beforeupdate(cancel integer) dim reply variant reply = dlookup("[mrn]", "requests processed", "[mrn] = '" & me.mrn & "'") if not isnull(answer) msgbox "existing mrn found" & ": " & mrn.text & vbcrlf & vbcrlf & "please search , edit on existing record.", vbcritical + vbokonly + vbdefaultbutton1, "existing mrn found" cancel = true me.mrn.undo else: end if docmd.openform "requests processed", , , reply end...

A complete list of all Android project.properties options -

A complete list of all Android project.properties options - i know next properties , have finish list. this specifies target api level (api level 17 in example): target=android-17 this specifies whether project library: android.library=true this specifies included libraries in android way (directories of library projects merged including project's corresponding directories): android.library.reference.1=../relative/path/to/library/one android.library.reference.2=../relative/path/to/library/two ... android.library.reference.n=../relative/path/to/library/n this specifies whether manifest file ( androidmanifest.xml ) of library projects merged including project's manifest file: manifestmerger.enabled=true i saw first 3 in projects (generated eclipse) , found lastly 1 sdk tools - revisions - sdk tools, revision 20 (june 2012), hard find. would there finish list in official site / documentations / android source? -- edited 2013/02/17 -- thank...

CodeIgniter, jQuery load and strange Google indexing of my content -

CodeIgniter, jQuery load and strange Google indexing of my content - i have unusual problem google indexing of website. problem search engines, utilize google example. (the website in bulgarian) the website cooking recipes. build using codeigniter , uses jquery load function load comments recipes. jquery load calls controller function not straight accessible via url request, if request ajax. if seek access comments function straight (not ajax) redirected recipe corresponding uri segments (or homepage if nil found). the problem is, google index ajax requests not actual page of recipe. below i'm placing code , links problems. the domain http://www.gotvachnicata.com/ , can grab instance next recipe: http://www.gotvachnicata.com/potrebiteli/gotvachnicata/recepta/domashna-pica-sas-salam-i-lyuti-chushki we have ajax request loads comment executed @ next way: $(document).ready(function(){ $('.recipe-comments').load('http://www.gotvachnicata.com/...

vb.net - Change textbox value dynamically? -

vb.net - Change textbox value dynamically? - i have 7 textboxes named lblsun, lblmon etc , 7 buttons named cmdsun, cmdmon etc. want alter text value of these text boxes , buttons within query. i've tried me.controls("cmd" & daysofweek(i)).text , not work. the error object reference not set instance of object. here code: public sub loadschedule() ' days of week dim daysofweek(0 6) string dim integer dim var string dim ctrl command ' set days of week daysofweek(0) = "sun" daysofweek(1) = "mon" daysofweek(2) = "tue" daysofweek(3) = "wed" daysofweek(4) = "thu" daysofweek(5) = "fri" daysofweek(6) = "sat" ' connect db dim con oledb.oledbconnection = new oledb.oledbconnection(form1.constring) con.open() ' query stuff dim query string dim cmd new oledb.oledbcommand dim rs oledb.oledbdatareader ...

java - Is there any way to find out an argument passed to a jar was quoted? -

java - Is there any way to find out an argument passed to a jar was quoted? - i'm trying pass number of arguments java application, parse them myself using intelligent parser doesn't rely on whitespace separate arguments. example: /update source=foo func=(bar, foo ,foo,bar) this works nicely converting tokens , parse those. however, problem occurs when add: path="./foo/bar/foo bar.txt" (note double space between foo , bar). when utilize double quotes, argument passed single string, preserving double space. quotation marks removed though this: path=./foo/bar/foo bar.txt which makes parser fail. when seek utilize other character utilize quotes, ', parser works fine shell passes string 2 separate strings, separated @ double space, hence lose info there 2 spaces there. what can pass argument using double quotes maintain literal string representation, maintain info string quoted, without user having type weird constructions "...

sql - How to Copy a table row details to visual studio form -

sql - How to Copy a table row details to visual studio form - i have table seek - "uid,pwd,mob , name." cl001 abc 9876589 admin cl002 def 8909898 admin2 i want phone call values in visual basic form table , display values in corresponding textbox .i know sql query --> select * seek uid="cl001" here function allow execute select statement on database. before phone call must declare new datatable like: dim dt new datatable dt = dosql("select * seek uid='cl001'") public function dosql(byval sqlcmd string) datatable dim cmd new sql.sqlcommand() dim cnn new sql.sqlconnection(my.settings.cnnstring) ' connection string here dim sqldt new datatable cmd .connection = cnn .commandtext = sqlcmd .commandtype = commandtype.text end dim da new sql.sqldataadapter() da.selectcommand = cmd da.fill(sqldt) homecoming sqldt end function the datatable have record...

mysql - how to use special character in prepared statement java -

mysql - how to use special character in prepared statement java - im not frequent user of clause, have requirement want fetch files based on name . tried with "select * files filename "+"%"+"?"+"%"; next tried escaping character "select * files filename "+"\\%"+"?"+"\\%"; both ways when create prepared statement , execute giving error , please help me how can utilize % ? thanks in advance i agree cowls answer, think want percent sign after search string, based on initial post. so, like: "%myfilename%" java mysql prepared-statement

jQuery Colorbox slideshow different content -

jQuery Colorbox slideshow different content - i'm using jquery colorbox [ http://www.jacklmoore.com/colorbox ] slideshow. can't seem figure out how create work different content ( images, videos, iframes, inline elements, etc. ) <p><a class="image" href="ohoopee1.jpg" rel="slideshow">an image</a></p> <p><a class="video" href=""http://www.youtube.com/embed/617ania5rqs?rel=0&amp;wmode=transparent" rel="slideshow">a youtube video - should iframed</a></p> <p><a class="page" href="http://stackoverflow.com" rel="slideshow">a page, should iframed.</a></p> <p><a class="image" href="ohoopee2.jpg" rel="slideshow">another image</a></p> in example, there images , iframes. if utilize <script> $("a[rel="slideshow"]").colorbox(...

Loadrunner - Select which action to execute next -

Loadrunner - Select which action to execute next - i'm scripting under vugen , know if there way take action perform next. for illustration have 3 action in script, in first action i'm testing value of variable , if value 0 want execute action 2 action 3 but if value 1 want execute action 3. is there way create possible ? unschedule actions in run time settings these standard c functions, so.... if ( myvariable == 0 ) { action2(); } if ( myvariable == 0 || myvariable == 1 ) { action3(); } you may want investigate 'c' language refresher course. loadrunner

c# - How to validate a field using javascript in itemadding eventhandler in sharepoint 2010? -

c# - How to validate a field using javascript in itemadding eventhandler in sharepoint 2010? - please help me on adding javascript function alert below. public override void itemadding(spitemeventproperties properties) { base.itemadding(properties); spsecurity.runwithelevatedprivileges(delegate { if (properties.afterproperties["col"] != null) { splist lstitem = properties.web.lists[list]; list<splistitem> items = (from splistitem item in lstitem .items.oftype<splistitem>() convert.toint32(item[constants.projectid].tostring().split(';')[0].tostring()) == convert.toint32(_httpcontext.request.querystring["id"]) select item).tolist<splistitem>(); if (items.count() > 0) { system.nullable<int> maxriskpriority = (from in items select c...

wpf - DatePicker SelectedDate string format -

wpf - DatePicker SelectedDate string format - i have derived datepicker class back upwards additional datemode property allow user utilize command per datemode (day, month, year). if datemode set year, command not able farther drill downwards see months of year , farther days of month. command working good, 1 problem. though have applied string formatting on 'part_textbox' command datepicker template, alter formatting based on datemode, datepicker command loses focus formatting lost. next derived datepicker command code: public class mydatepicker : datepicker { public string datemode { { homecoming (string)getvalue(datemodeproperty); } set { setvalue(datemodeproperty, value); } } // using dependencyproperty backing store datemode. enables animation, styling, binding, etc... public static readonly dependencyproperty datemodeproperty = dependencyproperty.register("datemode", typeof(string), typeof(myda...

Regex to match [integer][colon][alphanum][colon][integer] -

Regex to match [integer][colon][alphanum][colon][integer] - i attempting match string formatted [integer][colon][alphanum][colon][integer]. example, 42100:zba01:20. need split these colon... i'd larn regex, if could, tell me i'm doing wrong: i've been able come with... ^(\d):([a-za-z0-9_]):(\d)+$ ^(\d+)$ ^[a-za-z0-9_](:)+$ ^(:)(\d+)$ at first tried matching parts of string, these matching entire string. can tell, i'm not familiar regular expressions. edit: regex input desktop application. i'm not 'language' or 'type' of regex use, assumed .net . need able identify each of grouped characters, split colon. grouping #1 should first integer, grouping #2 should alphanumeric group, grouping #3 should integer (ranging 1-4). thank in advance, darius i assume semicolons ( ; ) meant colons ( : )? right, bit of basics. ^ matches origin of input. is, regular look match if finds match @ start of input. similarly, $ matches...

How to delete and keep some columns for a txt file in R? -

How to delete and keep some columns for a txt file in R? - i have file in txt format , delimited tabs, here extract: id 1 2 4 15 18 20 1_at 100 200 89 189 299 788 2_at 8 78 33 89 90 99 3_xt 300 45 53 234 89 34 4_dx 49 34 88 8 9 15 now have file, in txt format, , separated commas next data: 18,1,4,20 so based on file, read , extract columns first tabulated info can store in file this: (important: need maintain order of info stored according csv file) id 18 1 4 20 1_at 299 100 89 788 2_at 90 8 33 99 3_xt 89 300 53 34 4_dx 9 49 88 15 if info want extract rows easier because read row row , comparing txt file (i have done that), stuck column stuff. i wonder if there way extract straight columns using subindex function? any help appreciated. this 1 way ...

r - replace asterisks in dataframe with NA's -

r - replace asterisks in dataframe with NA's - here's dataframe df i'm trying: df=data.frame(rbind(c(1,"*","*"),c("*",3,"*")) df2=as.data.frame(sapply(df,sub,pattern="*",replacement="na")) it doesn't work because of asterisk i'm getting mad trying replace it. you should set total reproducible example, people more inclined help when create easy em. anywho... dat <- data.frame(a=c(1,2,'*',3,4), b=c('*',2,3,4,'*')) > dat b 1 1 * 2 2 2 3 * 3 4 3 4 5 4 * > as.data.frame(sapply(dat,sub,pattern='\\*',replacement=na)) b 1 1 <na> 2 2 2 3 <na> 3 4 3 4 5 4 <na> r

css - How to inject a into the head section of a page with a Chrome extension, using a content script -

css - How to inject a <style> into the head section of a page with a Chrome extension, using a content script - i'm trying create simple extension, inserts this; <style> span.watch-view-count:hover {opacity: 1;} span.watch-view-count {opacity: 0;} </style> right before body on youtube page visit. tried using content script inject code above, first tried putting code in css file called mycsscode.css , adding manifest.json file this: "js": ["script.js"] but i'm pretty sure nil happened, since viewed source , couldn't find code anywhere. then tried next first method in reply question changed script.js script.css hoping work, nope didn't i'm stuck. this codes have far; manifest.json file: { "name": "youtube views hider", "version": "1.0", "manifest_version": 2, "description": "a plain text description", "permiss...

javascript - Select all links and forms without jQuery -

javascript - Select all links and forms without jQuery - how can select a , form tags without needing include jquery? i trying following: $("a").click(function { window.onbeforeunload = null; }); $("form").submit(function { window.onbeforeunload = null; }); but rather not include jquery (or sizzle.js), if there's more compact way that. you can utilize document.queryselectorall() this: var els = document.queryselectorall( 'a' ); for( var i=els.length; i--; ) { els[i].addeventlistener( 'click', function(){ window.onbeforeunload = null; } ); } similar <form> tags. it available in modern browsers (caniuse.com). javascript jquery selector sizzle

python - how can i make u1-publish-folder (Ubuntu One) recursive into each folder -

python - how can i make u1-publish-folder (Ubuntu One) recursive into each folder - how extend each folder in target folder? know recursive every file in subfolders. http://bazaar.launchpad.net/~sil/+junk/utility-programs/view/head:/u1-publish-folder alternative if want modify script edit bottom part this: (and yes, sorry double posting keeps cleaner) if __name__ == '__main__': if len(sys.argv) > 1: folder = sys.argv[1] else: print "syntax: %s folder" % sys.argv[0] sys.exit(1) folder = os.path.realpath(folder) if not os.path.isdir(folder): print "%s not folder. terminating." % (folder,) sys.exit(1) # walk directories within `folder` (dirname, subdirs, files) in os.walk(folder): subdir = os.path.realpath(dirname) if not os.path.isdir(subdir): go on reactor.callwhenrunning(process_folder, subdir) reactor.run() this should same...

c# - High CPU usage when sending data using SOAP -

c# - High CPU usage when sending data using SOAP - we wrote in c# webservice sends , receives info remote clients. works fine. few days ago found when sending client array of bytes cpu usage increases 2% 30% on iis worker process. during debugging found cpu usage peak occurs after our webmethod ended, nil in our code. there don't know cause such cpu usage? when sends error code there no such peak... this cpu usage occurs when there 1 client connected. when had 4-5 clients connected cpu used in 100%! with little go on, i'm assuming (educated) guesses. here's mine: check if gc active (you can in perfmon). if was, allocating/deallocating lots of memory? have long running transactions? maybe of interest: optimizing wcf web service performance .net debugging demos lab 4: high cpu hang c# web-services soap gsoap svc

jsf 2 - getting null value in username and password from database -

jsf 2 - getting null value in username and password from database - database=db_jsf table=tbl_users fields=id,uname, pword when ever seek run doesn't values form database cannot match database name input text. public void dbdata(string uname){ try{ class.forname("com.mysql.jdbc.driver"); con = drivermanager.getconnection("jdbc:mysql://localhost:3306/db_jsf","root","root"); ps = con.createstatement(); sql_str="select * tbl_users uname ('" + uname + "')";// rs=ps.executequery(sql_str); rs.next(); dbusername=rs.getstring(2).tostring(); dbpassword=rs.getstring(3).tostring(); }catch(classnotfoundexception ex){ system.err.print("class not found in getconnection"+ex.getmessage()); }catch(exception e) { //e.printstacktrace(); system.out.println("excepti...

java - Can a non web application connect to a hessian server to retrive data? -

java - Can a non web application connect to a hessian server to retrive data? - i have made simple java application tries retrieve info through hessian web service. unfortunately getting response code of 301(access denied) using same keys worked before in web application connects same server/url. so question possible non web application connect hessian web server? do need alter encryption of keys? java hessian

Is there a way to determine if the neo4j database has been shutdown? -

Is there a way to determine if the neo4j database has been shutdown? - title says all. know can phone call graphdb.shutdown() on database, , says should remove references after that, there programmatic way determine state of graph database, see if shutdown? try graphdatabaseservice.isavailable(long timeout) "use method check if database in usable state. if database not in usable state, can provide timeout wait become so. if database has been shutdown returns false." i believe timeout in milliseconds. neo4j

Issues in Facebook Install ads for my android app -

Issues in Facebook Install ads for my android app - i trying have facebook install ads android app. following guidelines explained in https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/. have downloaded facebook-android-sdk https://github.com/facebook/facebook-android-sdk/archive/sdk-version-3.0.1.b.zip as provided in above guidelines, integration have write next code in onresume() of activities: com.facebook.settings.publishinstallasync(this, my_facebook_app_id); for above integration, need facebook sdk jar. have imported above project (facebook-android-sdk) eclipse ide , exported jar file. have added new jar libs directory included in java build path (libraries) of android app. once after above step, when seek debug or run application, receiving next error in console: [2013-02-21 18:35:09 - com.org.product.view.welcome.welcomeview] dx unexpected top-level exception: java.lang.illegalargumentexception: added: lcom/facebook/android...

asp.net mvc - Entity Model, grouping models in one model file -

asp.net mvc - Entity Model, grouping models in one model file - i have next code: using system; using system.collections.generic; using system.linq; using system.web; using system.data.entity; namespace mytestwebsite.models { public class page { public int id { get; set; } public int authoruserid { get; set; } public string title { get; set; } public string description { get; set; } public string content { get; set; } public bool hidden { get; set; } } public class pagestate { public int id { get; set; } public string type { get; set; } } public class mytestwebsitedbcontext : dbcontext { public dbset<page> pages { get; set; } public dbset<pagestate> pagestates { get; set; } } } i went create controller page , found model structure.. no problems. this is, need model called pagestate , model list not show sec model. is usual have heck load o...

c# - Communication between a Client -> WCF Service -> ASP.NET Webpage -

c# - Communication between a Client -> WCF Service -> ASP.NET Webpage - i seek build client sends info wcf service. there asp.net webpage should recieve info , set them in textfields etc. here method in client: outlookpluginservice.bookingrequest breq = new outlookclient.outlookpluginservice.bookingrequest(); breq.subject = "this subject"; breq.numparticipants = 6; client.getbookingurl("1234", breq); this method sends info wcf webservice , recieves asp.net url. this wcf method: public string getbookingurl(string guid, bookingrequest request,string token,string exiturl) { bookingrequest breq = new bookingrequest(); httpcontext current = httpcontext.current; string baseurl = current.request.url.scheme + "://" + current.request.url.authority + current.request.applicationpath.trimend('/') + '/' + "webpage/booking/bbooking.aspx"; ...