Posts

Socket.connect doesn't throw exception in Android -

if put nonsense url no exception thrown , none of rest of code executed not rest of asynctask called method connects. try { socketcliente.connect(new inetsocketaddress("f", port), 2000); } catch (unknownhostexception e) { geterror("host doesn't exist"); return -1; } catch (ioexception e) { geterror("could not connect: host down"); return -1; } add catch statement. catch ( exception e ) { log.d(tag, e.getmessage(),e); toast.maketext(getapplicationcontext(), "unexpected error:" + e.getmessage(), toast.length_long).show(); } this write log , pop toast tell what's going on.

Ruby can not find the module (LoadError) under Windows -

i tried connect database using ruby (under windows). that: install ruby in c:\ruby193 install devkit (c:\ruby193\devkit). run "ruby dk.rb init", "ruby dk.rb install" downloaded rubygems (1.8.25). executed ruby setup.rb and: gem install rubyfb (adapter ruby firebird) after wrote short rb-script: require 'rubygems' require 'rubyfb' include rubyfb db = database.new('test.gdb') and got error: c:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 126: can't find module - c:/ruby193/lib/ruby/gems/1.9.1/gems/rubyfb-0.6.7/lib/rubyfb_lib.so (loaderror) this file exists, ruby can not find it. attempts rectify situation failed. i installed adapter, situation repeated - ruby can not find file. please advise. i having same problem. had copying c:\program files\firebird\firebird_2_5\bin\fbclient.dll c:\ruby\bin .

android - Cant execute delete query properly using rawQuery -

i want deleting rows of table info comparing table type , code goes below. not getting error or exception still unable delete data. please suggest me string query = "delete info _id in " + "( select a._id " + " info a, type b," + " a.t_id = b._id , b.type_name = 'petrol' )"; try{ database.rawquery(query,null); }catch (exception e){ e.printstacktrace(); } the method sqlitedatabase.rawquery() meant querying --> select statement. to modify data raw sql, need use sqlitedatabase.execsql() .

mysql - How to join multiple occurrences of record against master record with filter -

i have table shows big library of products. i have several filters can applied table via kendo grid, problem having concerns mysql. i have date range filter, needs filter list of products when sold. the issue having because product have sold more once, causes product lines duplicate, because example 4 "datesold" rows 1 product. know why is, can't figure out how syntax filter: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id when applying date filter this: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id psd.datesold >= ? another issue doing: select ... parts_library left join parts_sale_dates psd on psd.partlibid = parts_library.id makes query take donkeys because there 500,000 products. i think looking "between": select ... parts_library pl left join parts_sale_dates psd on psd.partlibid = pl.id psd.datesold between <date1> ,...

reporting services - Compare SSRS report values with C# variables -

i have compare data contained in rendered ssrs report (chart , tablix values example) variables stored in c# application. how can done? so far know generating report in xml , parsing xml desired data. there easier way achieve without user interaction? alternatively, there way drop report chart/tablix data array or list in c#? you have 1 special requirement there... might if tell why want this, because there may other solutions actual problem . having said that, if want "compare data contained in rendered ssrs reports" "variables stored in c#", have best approach already. given approach, seem suppose there's user interaction needed generate xml, it's not: there's the ssrs web service can run reports without users intervening. the render method allows specify format: format type: system.string format in render report. argument maps rendering extension. supported extensions include xml, null, csv, image, pdf, html4.0, html3.2,...

Azure storage emulator cannot connect to LocalDB -

i have problem azure storage emulator, refuses connect localdb. used work fine before created odbc connection using named pipe. happened: i needed access data in database mathematica, generated odbc connection. odbc not connect (localdb)\v11.0, used named pipe instead. since then, azure has stopped work. upgraded sdk2.0, did not help. tried run dsinit.exe, get: found sql instance (localdb)\v11.0. creating database developmentstoragedb20 on sql instance '(localdb)\v11.0'. cannot create database 'developmentstoragedb20' : network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified). 1 or more initialization actions have failed. resolve these errors before attempting run storage emulator again. please refer http://go.microsoft...

jquery - How to manipulate DOM after new elements have been inserted? -

i working on woocommerce/wordpress site @ moment , on checkout page, when submit form, submits through ajax , if there errors (required fields not filled in etc), page inserts html , lists fields need filled in. i have jquery places newly inserted html in page new place on page doesn't work. woocommerce code inserted on submit (if errors): <ul class="woocommerce-error"> <li><strong>first name</strong> required field.</li> </ul> my code: var wc_errors = jquery('ul.woocommerce-error'); jquery('.errors_placeholder').append(wc_errors); it might useful note javascrript file loaded before woocommerce javascript file. thanks guys try following: $(document).ready(function() { var wc_errors = $('ul.woocommerce-error'); $('.errors_placeholder').appendto(wc_errors); }); you need in $(document).ready function tell jquery dom ready. check out example

How To: Convert from OpenGL to GLES -

i have following code... void draw_polygon(struct vector2d* center, int num_points, struct vector2d* points, int mode) { int i; if(mode == gl_triangle_fan) glvertex2f(center->x, center->y); for(i = 0; < num_points; i++) glvertex2f(points[i].x, points[i].y); glvertex2f(points[0].x, points[0].y); } and trying convert opengles 1.1 compat. other posts thought looked need similar this... void draw_polygon(struct vector2d* center, int num_points, struct vector2d* points, int mode) { int i; int offset=0; gl_float *arr; if(mode == gl_triangle_fan)i{ *arr = (gl_float *)malloc(sizeof(gl_float) * ((num_points+1)*2)); arr[0]=center->x; arr[1]=center->y; offset = 2; } else{ *arr = (int *)malloc(sizeof(gl_float) * (num_points*2)) ; } for(i = 0; < num_points; i++){ int g = i+offset; arr[g]=points[i].x; arr[g+1]=points[i].y; i++; } } but of course doesn't ...

jsp - (Spring controller) The requirement sent by the client was syntactically incorrect -

i have following jsp: <form:form method="post" commandname="fare"> <div><fmt:message key="createfares.name" /></div> <div><form:input path="name" type="text"></form:input> </div> <div><fmt:message key="createfares.amount" /></div> <div><form:input path="amount" type="number" min="0" step="0.01"></form:input></div> <div><fmt:message key="createfares.startdate" /></div> <div><input name="startdate" type="date"/> </div> <div><fmt:message key="createfares.enddate" /></div> <div><input name="enddate" type="date"/> </div> <div><fmt:message key="createfares.description" /></div> <form:textarea path=...

styles - what is the difference between the following to coding in VHDL to update registers? -

could ask difference between following 2 coding styles? first 1 read xilinx sample code. second, read book teaching vhdl. 1. signal: register std_logic; signal: output std_logic; process (clk) begin if rising_edge(clk) register <= outside_signal ; end if; end process; output <= register; 2. signal: register_reg std_logic; signal: register_next std_logic; signal: output std_logic; process (clk) begin if rising_edge(clk) register_reg <= register_next; end if; end process; register_next<=outside_signal; output <= register_reg; thank much. the obvious difference intermediate signal register_next declared , driven outside_signal signal, instead of using outside_signal directly in process. the simple answer there no functional difference. (complex answer register_next<=outside_signal delays signal delta delay (not actual time delay), delta delay typically not visible don't worr...

php - Symfony2 Doctrine get random product from a category -

i have following database scheme: table 'products' id category_id and of course category table, id. the data that: products -------------------- | id | category_id | -------------------- | 0 | 1 | | 1 | 1 | | 2 | 1 | | 3 | 2 | | 4 | 2 | | 5 | 1 | -------------------- i select category(for example category 1), select rows category in product-repository class: return $this ->createquerybuilder('u') ->andwhere('u.category = :category') ->setmaxresults(1) ->setparameter('category', $category->getid()) ->getquery() ->getsingleresult() ; how can select random product? also: possible solve via relationships? i have onetomany relationship between entities "category" , "product", products via category->getproducts()... any useful, thanks you first have count total number of products, generate random o...

livecode - How do I create a substack with code? -

how create named substack background livecode? the livecode dictionary has entry create stack with examples create stack "test" or create stack field 3 background "standard navigation" there no single command create substack. instead need create mainstack, , change it's mainstack property other stack make substack of one. example: create stack "my new stack" set mainstack of "my new stack" "some existing stack" see mainstack property, mainstacks function , mainstackchanged message in dictionary. there way achieve goal, setting mainstack of templatestack (see templatestack object in dictionary): set mainstack of templatestack "some existing stack" create stack "my new stack"

c# - How do you find at what line a word is located in a textbox? -

i'm working on notepad has find option. when type in word it'll find , highlight it. got working i've reached wall can't seem pass method i'm using it. i'm splitting words in textbox ' ' , adding length of words untill find inputted search term can see found word was, can highlight it. the problem have though, since i'm using split(' ') each word in textbox, whenever user adds new line split's return array "wordonfirstline\r\nwordonsecondline". counted 1 word. what's way can find word in textbox , see it's located can highlight it? try splitting string as string splitstring = stringtosplit.split(new char[] { ' ', '\n', '\r' }); it'll give empty string in between '\n' , '\r' characters, fix may closest you're doing.

javascript - JQuery Autocomplete drop down layout issue -

Image
i implementing jquery autocomplete on html page. unfortunately, drop down layout not clean box entries (see http://jqueryui.com/autocomplete/ ), rather ul-like list of links: i using: <script src='http://code.jquery.com/jquery-2.0.0.min.js' type="text/javascript"></script> <script src='http://code.jquery.com/ui/1.10.0/jquery-ui.min.js' type="text/javascript"></script> what doing wrong? you missing jquery ui css file gives style page. add following line html page tag: <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">

ASP.NET MVC Web Api 4.5 Session state -

i found solutions add session state web api 4.0. have not found 1 4.5. 1 point how accomplish this? use solutions : but instead of following code in de webapiconfig var route = config.routes.maphttproute(... use routtable class var route = routetable.routes.maphttproute(...

Display jQuery dialog onSubmit while HTML form is processing -

Image
i have html form allows user add attachment x mb. because connection speeds users vary, show dialog says along lines of "your request processing. not navigate away page. dialog close when form submitted successfully". not verbatim similar. form posts , processed php. not looking progress bar or anything. friendly alert. have been looking @ jquery ui documentation examples show confirmation requires user intervention continue. want placeholder while processing happening. or links appreciated. thanks in advance so after tinkering , hours of searching able piece working solution doesn't require ajax. here is: the head section <script type="text/javascript"> $(document).ready(function (){ $("#loading-div-background").css({ opacity: 1.0 }); }); function showprogressanimation(){ $("#loading-div-background").show(); } </script> the css #loading-div-background{ display: none; ...

Objective C can not process 2d array .count? -

i've got latest xcode xcode 4.6, , have problem: nsarray *array = @[@[@"a",@"b"]]; nslog(@"%d", array[0].count); before run it, xcode told me "property 'count' not found on object of type 'id'". but if change to nslog(@"%d", [array[0] count]); then, fine. so question is, why can't obj-c process two_d_array[index].count ? looks @ docs nsarray . there no count property. in fact, there no properties @ nsarray . when use property syntax non-property method, compiler deal ok if have object of specific type , there method of same name. in case have id . compiler can't safely work out attempt access count property should converted call count method.

Highlighting objects on a web page via Python? -

i'm not sure if possible python packages, here go: i making tool allows developers label different input fields on web pages automated testing framework. have html source of input, , display full web page in browser , highlight input on page user knows at. my thought far grab source of page, open in webbrowser, , replace html same html + "color = green" or whatever, hoping there more elegant / more visually appealing approach.

github - Does it matter what I name my open source license file? -

i have been starting try upload of stuff github , , have read few articles lately hard data showing most of repositories on github aren't licensed properly . not case. decided start including mit license of projects on , got wondering whether should name license.txt , or perhaps license.md (i one) better? began wonder more general question: matter name file holds open source license at all ? example project licensed if have valid license inside file named voidlicense.md ? know bit contrived, demonstrates trying ask. there limits on name file place license in, or matter file placed? if buried deep down in directory structure somewhere still count? if there else in file still count? imagine if license changed template @ not considered valid mit license, if else in file void it? it doesn't matter much, long choose sensible. since you're using open source license, want make easy fellow developer discover may in fact use code under mit license. done making licen...

android - How to return an object to the fragment from a nested static asynctask? -

i have fragment contains static asynctask class json data retrieving , parsing - after add data object workerobj nested parcelable class in fragment. object created inside fragment , want update data after asynctask finishes error arrises when try assign new value workerobj inside protected void onpostexecute(jsonobject jsonobject) method - how circumvent - while keeping asynctask static (it must): cannot make static reference non-static field workerobj when try in onpostexecute() workerobj = workerobject; summarized code: public class workerfragment extends sherlockfragment implements onclicklistener{ databasehandler db; workerparcel workerobj; ...... ..... static class workerparcel implements parcelable { ..... } private static class updateworkerasynctask extends customasynctask<workerparcel, integer, jsonobject> { private static final string tag = "dobackgroundtask"; private progressdialog mprogress; private int mcurrprogress; pri...