Posts

Showing posts from May, 2014

c - Interrupt a accept() that is waiting, just changing a global variable value -

i'm doing project university, chat system server , multiple clients. in specification document there written: the main thread controlled loop on global var go, , @ each cycle waits connection request user and also: server stops sigterm or sigint. when signal received, global var go set zero, , threads exit loop cycle so, thread main create socket, bind port , @ every new connection accept() , create thread worker takes care of communication client. my problem exiting thread main changing global var. in thread main if do while (go && accept(params)) {} it doesn't enter in while loop. so @ moment code while (go) { accept(params); // stuff } and, well, when set go 0 waits on accept , have create new connection, accepts connection , exit thread 'cause go becomes zero. same problem thread worker while (go && read(socket_id, buffer, sizeof(char)) > 0) {} it waits char socket exit loop. i don't see way...

regex - RewriteRule to convert /a/b into ?x=a&y=b? -

this current rewrite rule, lets me pass url domain.com/pagename , evaluate domain.com/index.php?page=pagename : <ifmodule mod_rewrite.c> rewriteengine on #create friendly url rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]+)/?$ /index.php?page=$1 [l,qsa] </ifmodule> what need do/add in there allow take url this: domain.com/pagename/type/value and evaluate this: domain.com/index.php?page=pagename&t=type&v=value (where both /type , /value optional) ?? thanks! you can do: <ifmodule mod_rewrite.c> rewriteengine on #create friendly url rewriterule ^index\.php$ - [l] # if request valid file - or rewritecond %{request_filename} -f [or] # if request valid directory rewritecond %{request_filename} -d # nothing ignore rules below rule rewriterule ^ - [l] # 1 parameter rule numbers rewriterule ^(\d+)/?$ index.php?page=$1 [l,qsa] # 1 parameter rule rewriterule ^(...

c - fsync on newly created folder? -

can explain why fsync can return einval when pass folder descriptor in it? there code, pretty simple: #include <dirent.h> /* defines dt_* constants */ #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <errno.h> #define handle_error(msg) \ { trace(msg); exit(0); } while (0) #define trace printf int createdir(const char* name) { int r = ::mkdir( name, 0777 ); if (r != 0) { trace("error r!=0 %d\n",errno); } r = open(name, o_rdonly | o_directory); if (r < 0) { trace("error create dir r <0\n"); } return r; } int main(int argc, const char * argv[]) { int r; int dir = createdir("test"); r = fsync(dir); trace("r = %d %d\n",r,errno); close(dir); return 0; } it gives me output: r = -1 22 i using linu...

c# - server and client side validation differences adding extra span -

i have validation both on server side , client side when validation added on server side different structure when on client side client <span data-valmsg-replace="true" data-valmsg-for="location" class="text-danger field-validation-error"><span for="location" class="">the location field required.</span></span> server side <span data-valmsg-replace="true" data-valmsg-for="location" class="field-validation-error text-danger">broken</span> the problem <span for="location" class=""> is way make server side validation add span? or way make client side validation remove span? any appreciated :) model public class locationmodel { [required] public int id { get; set; } [required] public string location { get; set; } } controller [httppost] public actionresult locationview(locationmodel lm) { modelstat...

Query mysql from json came from angularjs - Python -

hi guys json data , json data angularjs, can me on this?. i'm stuck on it. thank you. {u'ischecked': {u'49871': false, u'49870': true, u'113634': false}} then in python want update mysql when id found in json data right here code updating , want connect json data updatetable = """update table_x set value = '1' """ db.session.execute(updatetable) db.session.commit() here solution #!/usr/bin/env python import platform import sys import urllib2 import simplejson json def update_table(id): sqlupdatestr = "update table_x set value = '1' id="+id print "executing update: " + sqlupdatestr def test_parse_json(): print "loading json ..." req = urllib2.request("http://localhost/example.json") opener = urllib2.build_opener() f = opener.open(req) ...

c# - Accessing a variable in an object contained within another object when the child object is null -

i have following 2 classes. addresses contains list of address. method getmailingaddress scan through addresslist looking particular type of address. class addresses { public list<address> addresslist {get; set;} public address mailingaddress {get { return getmailingaddress();} } class address { public int? id {get; set;} } to access id of mailingaddress type following: addresses obj = new addresses(); int? = obj.mailingaddress.id the problem mailingaddress can return null. if happens call fails references id through null object. in instance return null. to work around use code: if(obj.mailingaddress == null) { i? = null; } else { i? = obj.mailingaddress.id; } is there way call obj.mailingaddress.id , return null if mailingaddress null without having above if statement. i create additional method/property within class addresses again see work around, not clean solution: public int? mailingaddressid { if(getmailingaddress == null) {...

android - Andorid Google map show custom marker and clustering issue -

Image
i show custom marker google map , cluster them. marker contains imageview shows avatar downloaded network. here target: everythings ok, however, when implemented google maps android marker clustering utility , imageview shows same avatar (sometime 2 wrong avatars). here custom markerrender: public class markerrender extends defaultclusterrenderer<image> { private static final string tag = markerrender.class.getsimplename(); private icongenerator clustergenerator; private icongenerator markergenerator; private imageview mimgmarkerthumbnail; private imageview mimgmarkerclusterthumbnail; private textview txtsizecluster; private activity activity; private bitmap mask, background; private atomicinteger imagedownloadcounter; private int totalitem; private imagesize imagesize; public markerrender(fragmentactivity activity, googlemap mmap, clustermanager<image> mclustermanager) { super(activity, mmap, mclustermanag...

asp.net - MVC - Kendo Grid and DropDownList -

in editortemplates have defined dropdownlist as @model int? @(html.kendo().dropdownlistfor(m => m) .name("id_sifra") .datavaluefield("id_sifra") .datatextfield("naziv") .datasource(datasource => datasource.read("read_sifredl","documents").serverfiltering(true) ) .htmlattributes(new { style = "width:400px" }) .optionlabel("---select---") ) in grid have columns.bound(c => c.id_sifra).editortemplatename("_sifreeditor").title("id_sifra"); the read_sifredl in documentscontrollers is public jsonresult read_sifredl() { var sifre = db.sifre.select(c => new { id_sifra = c.id, naziv = c.naziv }).tolist(); return json(sifre, jsonrequestbehavior.allowget); } the problem when selection in dropdownlist (in case naziv ), , dropdownlist has closed valuefield shown (in case id_sifra ). want naziv shown. wrong ...

XSLT Transforming XML into a cross referenced, nested HTML lists when source nodes are siblings and nesting is based on attribute values -

problem: need create nested html unordered list xml not nested. additionally need cross reference xml 'allowed nodes' section contained in document. example xml: <content> <data> <navigation> <link name="about us" url="#"/> <link name="staff" url="staff.asp" parent="about us"/> <link name="contact" url="contact.asp" parent="about us"/> <link name="facebook" url="facebook.asp"/> </navigation> </data> <allowedlinks> <link name="about us"/> <link name="facebook"/> </allowedlinks> </content> example result html (note have left out boiler plate code): <ul> <li> <ul> <li>staff</li> <li>contact</li> </ul> </li> <li...

c# - Casting Range.Value2 of Excel interop to string -

i import values excel sheets in c# application. 1 column text can contain values. used following: range range = ... // getting excel, works fine string mystring = (string)range.value2; when cell contains text, working. when contains, example, 123, debugger shows 123.0 range.value2 , conversion string fails exception. i wonder, how write general conversion kinds of cells. @ least string , integer, may float content. i found solution may not nice works: mystring = range.value2 == null ? "" : range.value2.tostring(); may better exists.

Android Material Design Button Styles -

Image
i'm confused on button styles material design. i'd colorful raised buttons in attached link., "force stop" , "uninstall" buttons seen under usage section. there available styles or need define them? http://www.google.com/design/spec/components/buttons.html#buttons-usage i couldn't find default button styles. example: <button style="@style/primarybutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="calculate" android:id="@+id/button3" android:layout_below="@+id/edittext5" android:layout_alignend="@+id/edittext5" android:enabled="true" /> if try change background color of button adding android:background="@color/primary" all of styles go away, such touch animation, shadow, rounded corner, etc. i add answer since don't use of other answers provided. with su...

android - When I switch one activity to another activity then inApp purchase dosen't work -

////// in first activity @override public void onclick(view v) { if(v==btn){ intent i= new intent(chatactivity.this ,mainactivity.class); i.putextra("name",0); startactivity(i); } } //////////// in second activity oncreate method intent i=getintent(); int name=i.getintextra("name",10); demo(name); ////// in demo method private void demo(int name) { if(name==0){ purchase(); } } ////// in purchase method public void purchase(){ bp.purchase(mainactivity.this,product_id); showtoast("in purchase method !!!"); } inapp purchase classes include in application first statement not working , second working.if separate run second class without switch work properly.plz help. change onclick() method shown below: @override public void onclick(view v) { if(v.getid()== btn){// can used v.getid() == r.id.btn intent i= new intent(chatactivity.this ,mainactivity.class); i.pute...

php - sql query don't pick the value -

i have simple sql insert query: insert db_name (col1, col2, col3, ...) values ('value1', (select name another_table id = :php_value), value3 .....) but col2 value null because select don't pick nothing (name exist) possible protect empty records? or need change script , keep select before insert (outside insert)? that's happen not regularly ~1/3000 records i think problem condition id = :php_value query doesn't return data. can avoid insert row table empty name way: insert db_name (col1, col2, col3, ...) select 'value1', name, 'value3',... another_table id = :php_value

Formatting phone number to E164 format in Android -

i want convert every phone number conatct in device e164 format. so, used opensource below. libphonenumber so used here. phonenumber.phonenumber formattednumber = null; string formatted = null; try { formattednumber = phoneutil.parse(phonenumber, "kr"); formatted = phoneutil.format(formattednumber,phonenumberutil.phonenumberformat.e164); if (stringutils.isempty(formatted) == false && formatted.length() > 0 && stringutils.isempty(name) == false && name.length() > 0) { listname.add(name); listphonenumber.add(formatted); } } catch (numberparseexception e) { continue; } and read library used android framework since 4.0. the java version optimized running on smartphones, , used android framework since 4.0 (ice cream sandwich). i want use android sdk. found this. android sdk provides phonenumberutils . and there function formatnumbertoe164(string phonenumber, string defaultcountryiso) ...

c# - Cannot convert method group to non delegate type System.Data.Datatable -

cannot convert method group non delegate type system.data.datatable. did intend invoke method? i'm using design pattern mvp (model view presenter) so have datatable in model datatable _getpendingtestorders24hours() { var connsettings = configurationmanager.connectionstrings["mydb"]; { string cn = connsettings.connectionstring; mysqlconnection conn = new mysqlconnection(cn); mysqlcommand cmd = new mysqlcommand("", conn); mysqldataadapter data = new mysqldataadapter(cmd); conn.open(); data.fill(_dt); return _dt; } } and , setter pass parameters controller public datatable getpendingtestorders24hours { { return _getpendingtestorders24hours; } set { _getpendingtestorders24hours = value; } } but i'm getting error above you're attempting return method group, _getpendin...

objective c - TransloadIt image upload issue when image is too small in size in ios -

while uploading image of small size e.g when crop image transloadit server reply response. {"error":"file_filter_declined_file","message":"one of files declined","reason":"file_0"} i tried testing response adding step in assembly force_accept parameter considering(hoping) accept file size. still getting same response. here code snippet : transloadit *transloadit = [[transloadit alloc]init:transloadit_api_key]; assemblybuilder *assembly = [[assemblybuilder alloc]init]; [assembly settemplateid:transloadit_template_id]; nsdata *imgdata = uiimagejpegrepresentation(imagetoupload, 1.0f); nserror* error; //add file uploaded autogenerated key [assembly addfile:imgdata witherror:error]; if(error!=nil) transloadit_log_error(self.class,error); nsobject<istep>* step=[[step alloc] init]; [step setoptionkey:@"robot" object:@"/image/resize"]; [step setoptionkey:@"width" object:@(75)]; [...

jquery - Check if variable have already been appended -

got problem. in following fiddle have tried exemplify how wish check if variable "htmlstring" has been appended, , if so, not append another. on other hand if haven't been appended, ofcourse append it. http://jsfiddle.net/lc5gdvge/6/ how make work? in all, need if-else code, check previous appended variable. if none has been appended append, if container contains appended variable "htmlstring" ofcourse shouldn't append new one. $(document).ready(function () { $('.outerdiv').click(function () { var htmlstring = $(this).contents().filter(function(){return this.nodetype == 3;}).text() if ($('.innerdiv').innerhtml( jquery.inarray(htmlstring, arr))){ /*this line problem*/ } else { $(this).find('div.innerdiv').append(htmlstring);} }) }); you can use jquery's length find if content present like var checkcontent = $(this).find('div.innerdiv').html().length; if(checkcontent> 0){...

metadata - java.lang.ClassNotFoundException : com.adobe.xmp.XMPException -

i using metadata extractor extract metadata image file , working flawlessly until today morning today encountered exception java.lang.classnotfoundexception : com.adobe.xmp.xmpexception and control of web application redirected error.jsp expected also found article resolve exception but code extract wrapped in try-catch block why exception didn't catched in catch block entire stack trace : caused by: java.lang.noclassdeffounderror: com/adobe/xmp/xmpexception @ com.drew.imaging.jpeg.jpegmetadatareader.extractmetadatafromjpegsegmentreader(jpegmetadatareader.java:112) @ com.drew.imaging.jpeg.jpegmetadatareader.readmetadata(jpegmetadatareader.java:71) @ com.drew.imaging.imagemetadatareader.readmetadata(imagemetadatareader.java:108) @ com.drew.imaging.imagemetadatareader.readmetadata(imagemetadatareader.java:95) @ mypackagename.myclassname.readlocationexifdata(myclassname.java:274) relevant code : try{ metadata metad...

vba - Remove extra spaces from cells in column -

Image
i wrote following code inventory scanning bar-codes reason when scan bar-code adding spaces in cells , result not showing expected. how remove spaces cells in column? option explicit private sub workbook_sheetchange(byval sh object, byval target range) if target.cells.count > 1 or isempty(target) or target.column <> 1 exit sub if not sheetexists("warehouseinventory") exit sub dim result variant set result = sheets("warehouseinventory").cells.range("e:e").find(target) if result nothing target.worksheet.cells(target.row, 2) = "data maybe bin #?" else target.worksheet.cells(target.row, 2) = result.worksheet.cells(result.row, 4) target.worksheet.cells(target.row, 3) = result.worksheet.cells(result.row, 5) target.worksheet.cells(target.row, 4) = result.worksheet.cells(result.row, 6) target.worksheet.cells(target.row, 5) = result.worksheet.cells(result.row, 7) end...

ios - how can I do manifest request with WKWebView -

i trying use new webview in app, seems wkwebview can't work nsurlcache , , manifest request didn't work, no request loaded , nothing stored. everything seems work better using wkwebview instead of uiwebview except using nsurlcache , manifest , wonder if there ways solve matter. p.s. i've tried private api _setofflineapplicationcacheisenabled: , work, app using non-public api rejected apple... i'm out of ideas. right now, wkwebview instances ignore of default networking storages (nsurlcache, nshttpcookiestorage, nscredentialstorage) , standard networking classes can use customize network requests (nsurlprotocol, etc.). so cookies of wkwebview instance not stored in standard cookie storage of app, , nsurlsession/nsurlconnection uses standard cookie storage has no access cookies of wkwebview (and problem have: „login status“ stored in cookie, nsurlsession/nsurlconnection won’t see cookie). the same case cache, credentials etc. wkwebview has own ...

objective c - iOS - Tap specific area in UIImageView and perform the action -

Image
i have uiimageview of floor plan , client wants when click specific area in floor plan, display interior image of area... don't have problem displaying area when clicked. problem area clicked itself. @ initial implementation: (i don't know if it's proper way) master bath area has excess place put button in it, when user tap area, i'll perform action display interior image... same in "walk-in closet" area, have 2 buttons. so, there way optimize implementation? one option use uitapgesturerecognizer imageview,then when gesture fired - (ibaction)tap:(uitapgesturerecognizer*)sender { cgpoint touchpoint = [sender locationinview:yourimageview]; //then decide point in area different action }

javascript - Translate ajax call to CORS -

i trying access api via localhost using following code: $.ajax({ url: "http://domain.xxx.net/api/tokens.json?email=xxx@xxx.net&password=xxx", //method: "get", headers: { "accept": "application/xml", "content-type": "application/xml", "access-control-allow-origin": "*"}, datatype: "json", success:function(data){ alert(data);}, success:function(e){ alert(e.message);} }); i have read on internet not possible due error below. no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:3000 ' therefore not allowed access. after research said can use jsonp or cors. able use jsonp however, getting js error because api supports both json & xml , not jsonp. trying convert ajax call cors can't understand syntax. same e...

ruby on rails - Syntax error with hash and square brackets -

i using rails 4.1.6 , ruby 2.1.5. i have following code, getting error: params = { input: @model.video.url, test: true, notifications: [zencoder_url], pass_through: @model.id outputs: [ { public: true, base_url: base_url, filename: "mp4_" + filename_without_ext + '.mp4', label: 'webmp4', format: 'mp4', audio_codec: 'aac', video_codec: 'h264' }, { public: true, base_url: base_url, filename: "web_" + filename_without_ext + '.webm', label: 'webwebm', format: 'webm', audio_codec: 'vorbis', video_codec: 'vp8' }, { public: true, base_url: base_url, filename: "ogv_" + filename_without_ext + '.ogv', label: 'webogv', format: ...

ios - Parsing twitter api JSON in Swift -

i using twitter-kit/fabric response twitter api. returns json of following format - https://dev.twitter.com/rest/reference/get/search/tweets my query - https://api.twitter.com/1.1/search/tweets.json?q=""&geocode=lat,long,radius&count=15 i need extract text , coordinates json plot tweets on map. what doing wrong following code - ? twitter.sharedinstance().apiclient.sendtwitterrequest(request) { (response, data, connectionerror) -> void in if (connectionerror == nil) { var jsonerror : nserror? let parsedresult = nsjsonserialization.jsonobjectwithdata(data, options: nil, error: &jsonerror) nsdictionary println(parsedresult) if let tweets = parsedresult["statuses"] as? nsdictionary { tweetsdict in tweets { let title = tweetsdict["text"] nsstring ...

python - Print value from a DataFrame (wrong output, need only 1 item from a DataFrame) -

i have for loop going find matching values 2 dataframes. list read: index, row in output_merged_po.iterrows(): stock = output_merged_stock[output_merged_stock['pn_stripped'] == row['pn_stripped']][['whs']] print stock in results when pn matches: whs 111 vko 1111 vko 1112 zzz so if put if stock.iloc[0:3]['whs'].values[0] == '_': print stock or if any(stock['whs'] == 'vno'): print stock i result above: whs 111 vko 1111 vko 1112 zzz where need see 111 , 1111 lines whs vko. however, if write second whs name (zzz): if stock.iloc[0:3]['whs'].values[0] == 'zzz': print stock i empty line, no info printed, while want see whs 1112 zzz to printed. how possible solve problem , see line/lines needed see?

coldfusion - Adding art to cfmail causing javascript warning and no art display in client email -

i sending out receipt clients on purchase using cf script. <cfmail to="#gtord.contact_email#" from="no-reply@mycompany.net" subject="mtcompany order #gtord.order_lead#-#gtord.order_number#" type="html"> <cfset order_id = #order_id#> <cfset mgd = #mgd#> <cfinclude template="order_receipt.cfm"> <cfmailparam file="#expandpath('/art/mycompany.jpg')#" contentid="shownets" disposition="inline" /> </cfmail> the email recipient gets warning: "potentially dangerous scripts removed message. allow scripts" the artwork not show in email body. if "allow scripts" the artwork included attachment.

Scraping the second page of a website in Python does not work -

let's want scrape data here . i can nicely using urlopen , beautifulsoup in python 2.7. now if want scrape data second page this address . what data first page! looked @ page source of second page using "view page source" of chrome , content belongs first page! how can scrape data second page? the page of quite asynchronous nature, there xhr requests forming search results, simulate them in code using requests . sample code starting point you: from bs4 import beautifulsoup import requests url = 'http://www.amazon.com/best-sellers-books-architecture/zgbs/books/173508/#2' ajax_url = "http://www.amazon.com/best-sellers-books-architecture/zgbs/books/173508/ref=zg_bs_173508_pg_2" def get_books(data): soup = beautifulsoup(data) title in soup.select("div.zg_itemimmersion div.zg_title a"): print title.get_text(strip=true) requests.session() session: session.get(url) session.headers = { ...

php - xampp showing folder empty in htdocs -

i have folder called myfiles in htdocs , folder contains file name home.php. when open http://localhost:8080/myfiles/ showing no files in it. after trying few things, somehow thought of changing file name home1.php , file being displayed. not able figure out this, why so. can put light on this. home.php 1 of default index page show in apache settings. if check xampp/apache/httpd.conf file find following code <ifmodule dir_module> directoryindex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \ default.php default.pl default.cgi default.asp default.shtml default.html default.htm \ home.php home.pl home.cgi home.asp home.shtml home.html home.htm </ifmodule> if want remove home.php index need delete above code , need restart apache.

php - Number of days between two time stamps -

how can calculate number of days between 2 times, have 1 time field in table name active_time , following code have tried gives me number value around thousands whereas have queried number of days: $now =strtotime("now"); // current time $your_date = $data[$i]['active_time']; $datediff = $now - $your_date; $value= floor($datediff/(60*60*24)); result:16569 try: $value= ceil(abs($now - $your_date) / 86400);

objective c - search NSArray with regex -

i have array of names. if of name there on inserting new name want append counter eg john (02) if john present in array john (03) if third entry of name john. is there way filter array regex can filter records pattern "john (xx)"? yup. have loop through array , check regex. have this, since if check if array contains string, won't return true if search "john" , 1 in array "john1" nsmutablearray *testarray = [[nsmutablearray alloc] initwithobjects:@"john", @"steve", @"alan", @"brad", nil]; nsstring *nametoadd = @"john"; nsstring *regex = [nsstring stringwithformat:@"%@[,]*[0-9]*", nametoadd]; nspredicate *mytest = [nspredicate predicatewithformat:@"self matches %@", regex]; (int = 0; < [testarray count]; i++) { nsstring *string = [testarray objectatindex:i]; if ([mytest evaluatewithobject:string]) { // matches nslog(@" match !...

sql - Informix grouping based on static values returned in query -

i have query works , returns me bunch of product numbers, want group these product numbers down product group level. these groups not exist in database. i have list this: 'metro 60' '63782-1-4000','63782-1-5000','63778-1-4000','63778-1-5000','63780-1-5000','63776-1-4000','63776-1-5000','63772-1-4000','63772-1-5000','63774-1-4000','63774-1-5000','63784-1-5000','63786-1-5000' 'elements wa' '63782-1-4000','63782-1-5000','63778-1-4000','63778-1-5000','63780-1-5000','63776-1-4000','63776-1-5000','63772-1-4000','63772-1-5000','63774-1-4000','63774-1-5000','63784-1-5000','63786-1-5000','63774-2-1000','63782-2-1000','63778-2-0200','63772-2-1000','63776-2-1000','67744-1-5000','63770-2-1000','63768-2-0200...

I'm trying to install PostgreSQL onto Ubuntu 14.04, but I am having difficulties after following a guide -

i followed guide @ http://www.postgresql.org/docs/9.3/static/runtime.html . instructed me install postgres-xc, meant making clusters of databases. on other sites, instructed use postgres-9.3 package (or 9.x) instead of postgres-xc package. 1 inconsistency noticed arguments such --nodename were missing original guide , led me believe there issue original guide i have uninstalled postgres-xc using both apt-get remove --purge postgres-xc , dpkg remove --purge postgres-xc , advised others, following this solution , involves changing postgres-xc.prerm exits on. additionally, have uninstalled , reinstalled postgresql-package many times , run sudo apt-get install postgresql postgresql-contrib , sudo apt-get install postgresql-9.3 postgresql-contrib-9.3 . have done after uninstalling other version. when try running postgres command in bash, following error: the program 'postgres' not installed. can install typing: sudo apt-get install postgres-xc i've b...

vb.net return only selected columns/fields from linq.IQueryable(of out t) -

sorry english. i have been searching web "dynamic linq queries" , found 1 works on me. guide creating dynamic linq queries . converted vb on online converter. , result public shared function getfiltereddatawithpage(customer string, itemdesc string, jonumber string) dim db new jodataclassesdatacontext dim dataquery iqueryable(of jomaintbl) = db.jomaintbls if customer.trim().length > 0 dataquery = dataquery.where(function(a) a.customer.startswith(customer)) end if if itemdesc.trim().length > 0 dataquery = dataquery.where(function(a) a.itemdescription.startswith(itemdesc)) end if if jobnumber.trim().length > 0 dataquery = dataquery.where(function(a) a.jonumber = jonumber) end if return dataquery end function i have table 5 fields "jonumber, sample, datecreated, customer, itemdesc" and display it datagridview.datasource = getfiltereddata(txtcustomer.text, txtitemdesk.text, txtjobnu...

java - Session Timeout does not work on Google App Engine -

i have simple jsp servlet web app deployed on google app engine. have sessionlistener implementing httpsessionlistener monitor creation , destroying of sessions. public class sessionlistener implements httpsessionlistener { private int sessioncount = 0; @override public void sessioncreated(httpsessionevent event) { // todo auto-generated method stub synchronized (this) { sessioncount++; } system.out.println("session created: " + event.getsession().getid()); system.out.println("total sessions: " + sessioncount); } @override public void sessiondestroyed(httpsessionevent event) { // todo auto-generated method stub synchronized (this) { sessioncount--; } system.out.println("session destroyed: " + event.getsession().getid() + ", " + event.getsession().getattribute("loginname")); system.out.println("total sessions: " + sessioncount); } } in web.xml fi...

visual studio 2010 - VS2010 Professional SP1 reports correct _MSC_FULL_VER for 32-bit compiler but non-SP1 _MSC_FULL_VER for 64-bit compiler -

when building 32-bit application, _msc_full_ver correctly equals 160040219, when building x64, _msc_full_ver set 160030319. order had installed stuff, due needs on years, is: installed vs2010 without 64-bit compiler/tools installed sp1 also installed various hotfixes/etc. (some years later) installed 64-bit compiler/tools saw 64-bit compilation of application reporting incorrect (i.e. non-sp1) _msc_full_ver re-ran sp1 install re-apply sp1 sp1 re-apply completes despite that, _msc_full_ver still incorrect 64-bit compilation if sp1 wasn't applied @ all i going remove sp1 re-install, remove warns post-remove state such it's not possible re-install sp1. what need fix problem 64-bit building in proper sp1 state (and _msc_full_ver reporting correct value)?

rest - Setting SSLContext for AsyncHttpClient - Can not read keystore file -

i need use asynchttpclient in play application make post() call on https protocol. using play 2.2.x version. tried @esfand's code mentioned in below question's first answer failing java.io.filenotfoundexception. how use play ws ssl? here did : 1) used keytool command generate keystore on c drive .. this keytool -import -trustcacerts -alias mypublickey -file "" -keystore "c:\mypublicstore.jks” it stores file on c drive name mypublicstore.jks" (note double quotes @ end) 2) using following code read that keymanagerfactory keymanagerfactory = keymanagerfactory.getinstance(keymanagerfactory.getdefaultalgorithm()); keystore keystore = keystore.getinstance("jks"); inputstream inputstream = new fileinputstream("c:\\mypublicstore.jks\""); string certpass = play.application().configuration().getstring("certificate.password"); keystore.load(inputstream, certpass.tochararray()); keymanagerfact...

ios - Understanding how to use methods found in Apple Developer Reference documentation -

i've asked number of questions lately newbish. often, community answers questions leaving foot-note, "it's in apple documentation". truth is, don't understand how translate read in documentation real-world code. rely entirely on examples. i'd change this. how invoke method found in apple developer reference documentation? please explain steps in perspective of how go finding method want - implementing in project. the first step read documentation very carefully . programming documentation terse , dense. every word significant. if there's piece of explanation of method don't understand, find meaning looking in related documents, on web (google has many programming mail lists indexed), or on stack overflow relevant question or code. in case of example ( now removed , realize), seem have missed @ least 1 important bit: returns whether resource pointed file url (emphasis mine), reinforced note: this method applicable urls f...

json - How I can read parameter PHP -

how can read return of parameter? i have try use $_get, it's working parameter $_get['name'], parameters city, doesn't working... how's best way this? object { name: "test", city: object } city: object city: object city: "bulls gap" state_code: "tn" org_name: "test" thanks ideal! suppose json variable $json, need this:- $obj = json_decode($json); echo $obj->access_token(like name, city);// means $obj->name note:- city std class object try convert normal array , values.

How can I use a thread pool to off-load a processing from a Netty handler -

i have server proxy implemented netty 4.0.27 support set of custom protocols. 1 of these protocols processes results server simple two-handler pipeline before returning messages client: custom lengthfieldbasedframedecoder followed handler non-trivial processing of each message/frame. proxy stress tested on high cpu/core server , i’d take advantage of these cores passing messages handler thread pool processing, retrieving processed message, , sending them client (in right order). not see how within netty handler due being callback in nature. any thoughts? you can pass eventexecutorgroup while adding handler pipeline: pipeline.addlast(group, "handler", new mybusinesslogichandler()); see building pipeline section @ http://netty.io/4.0/api/io/netty/channel/channelpipeline.html

javascript - Why is this div completely invisible to jQuery? -

i have div (the topmost 1 in markup below) in html code i'm trying find via jquery .children() . reason jquery can't find it. this can tested running this: $($('<p class="info-item"><span class="info-item-key">gender:</span><span class="info-item-value">male</span><span class="info-item-edit-button">&nbsp;<a class="black-link" href="#"><i class="fa fa-pencil-square"></i></a></span><div class="form-inline info-item-edit-input"><div class="form-group"><div class="input-group"><input type="text" class="form-control" value="" /><div class="input-group-addon"><a class="black-link info-item-edit-save-link"><i class="fa fa-check"></i></a></div></div></div></div></p...

c# - Dictionary in Settings throws an exception? -

i want save dictionary in default usersettings class of project. i've tried following in code of settings file fails: <setting name="mediakeys" type="system.collections.objectmodel.dictionary&lt;system.input.key, system.io.fileinfo&gt;" scope="user"> <value profile="(default)" /> </setting> i error message when @ ui settings: could not load file or assembly 'system.io.fileinfo>' or 1 of dependencies. parameter incorrect. (exception hresult: 0x80070057 (e_invalidarg)) bearing in mind, please, deal whole serializable dictionary @ point in time, why getting exception? non-serializable objects (such fileinfo, have tested) not throw exception. .net settings not handle generics well. do: [xmlroot("dictionary")] public class mydictionary : serializabledictionary<int, string> { }

javascript - Gulp webpack-dev-server: callback before bundle is finished -

i'm trying add callback webpack-dev-server module in gulp. callback has goal notify users url dev server started. issue callback invoked before bundling process finishes. if add fixed timeout works, undesired. question: doing wrong callback structure? why being called before bundle finished? my code in gulp: var server = new webpackdevserver(webpack(devwebpackconfig), devserverconfig); server.listen(options.devserverport || 8080, 'localhost', function(err) { if(err) { console.error('[webpack-dev-server] failed start:', err); } else { console.log('[webpack-dev-server] started:', 'browse http://localhost:'+ options.devserverport +'/webpack-dev-server/'); } }); current output: [14:43:43] finished 'dev' after 66 ms [webpack-dev-server] started: browse http://localhost:8002/webpack-dev-server/ hash: 638bdaa3201a4220c58e version: webpack 1.9.5 time: 7315ms asset size chunk...

java - What's the benefit of having two ReentrantLock in a class? -

if have code: public class prlock { private lock lock1= new reentrantlock(); private lock lock2= new reentrantlock(); private int num=0; public void addlock1(){ lock1.lock(); try { num++; system.out.println(thread.currentthread().getname()+" num "+num); } finally{ lock1.unlock(); } } public void addlock2() { lock2.lock(); try { num++; system.out.println(thread.currentthread().getname()+" num "+num); } finally{ lock2.unlock(); } } } what difference between lock1 , lock2 , simple alias or there different logic? if use 1 lock 2 methods won't able execute them concurrently. so having 2 locks means, while executing addlock1() thread-a can execute addlock2() thread-b. thread-b blocked, if had 1 lock.

c# - DotNetRDF & AllegroGraph -

i'm working on application bulk parsing , uploading allegrograph triplestore, have run snag. able open , read graph in question using below code: allegrographconnector conn = new allegrographconnector(myhost, mygraph, myusername, mypassword); graph g = new graph(); conn.loadgraph(g, ""); g.baseuri = new uri(mog); foreach (rtsnode r in _nodes) { iurinode sbj = g.createurinode(new uri(rtsuri + r.myname)); iurinode pred = g.createurinode(new uri(mog)); iliteralnode obj = g.createliteralnode(r.myname, "en"); g.assert(new triple(sbj, pred, obj)); } conn.savegraph(g); as mentioned graph loads fine , triples being added local version. when attempt save it, 400- bad request error. turning on full debugging shows error due to: unsupported file format: 'application/n-triples' not supported content-type is there option changing default...