Posts

Showing posts from January, 2010

java - IllegalStateException: null in HttpServlet.service -

i'm trying send error client when request fails. here's code looks like: response.senderror(httpservletresponse.sc_bad_request, "email , username required fields."); this code throws following error: java.lang.illegalstateexception: null @ org.apache.catalina.connector.responsefacade.senderror(responsefacade.java:407) ~[catalina-6.0.26.jar:6.0.26] @ com.****.****.****.*********servlet.service(********servlet.java:68) ~[********servlet.class:na] @ javax.servlet.http.httpservlet.service(httpservlet.java:717) ~[javaee-api-5.1.2.jar:5.1.2] @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) ~[catalina-6.0.26.jar:6.0.26] @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) ~[catalina-6.0.26.jar:6.0.26] @ org.red5.logging.loggercontextfilter.dofilter(loggercontextfilter.java:78) ~[red5.jar:na] @ org.apache.catalina.core.applicationfilterchain...

php - remove "resourse id #--" from image name -

when displaying(php echo) image name server,it's shows like, resource id #32global_2012062513406170744fe83172d6c99.jpg resource id #33330394727_2012062613406707734fe90335d0a5e.jpg how can remove "resource id #32" associated image name? can display image server? or there other way display images? code is 69 if(is_dir($dir)) 70 { 71 $dir = opendir($dir); 72 while (false !== ($file = readdir($dir))) 73 { 74 if ($file != "." && $file != "..") 75 { 76 $files[] = $file; 77 } 78 } 79 closedir($dir); 80 } 81 //srand ((double) microtime( )*1000000); 82 $randnum = mt_rand(0,(sizeof($files)-1)); 83 $img = $dir.$files[$randnum]; 84 echo $img; thanks! if(is_dir($dir)) { $opendir = opendir($dir); ...

Drawing fast in canvas Bitmap android ics -

i've been developing app draw in ics android tablets , i've encountered issue can't figure out how fix. the problem draw correctly , in real time drawing when go really fast (tested on real tablets) circles not circles, pilygons of 5 or 6 sides... here declare bitmap , assign canvas: display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); width = size.x; height = size.y; bm = bitmap.createbitmap(width, height-50,bitmap.config.argb_8888); c = new canvas(bm); here code use x, y: (the layp "painter" you'll se down here class saveontouchlistener implements ontouchlistener{ public boolean ontouch(view v, motionevent e) { final float x = e.getx(); final float y = e.gety(); if(e.getaction() == motionevent.action_down){ startx.add(x); starty.add(y); x1 = x; y1 = y; } else if(e.getaction...

c# - how to solve error "Exception has been thrown by the target of an invocation" -

when run below code, showing error "exception has been thrown target of invocation" what can solve issue? public linqtoxml() { xdocument document = xdocument.load(@"d:\\data.xml"); #region fetch books var books = r in document.descendants("book") select new { author = r.element("author").value, title = r.element("title").value, genere = r.element("genre").value, price = r.element("price").value, publishdate = r.element("publish_date").value, description = r.element("description").value, }; foreach (var r in books) { com_xdocuments.items.add(r.publishdate + r.title + r.author); } #endregion } shouldn't be xdocument document = xdocume...

awk split integer into several parts -

i have integer 20120305193821 , split several parts 2012-03-05-19:38:21 further usage in awk. can help? if using gawk, can use fieldwidths: echo 20120305193821 | gawk '{printf "%s-%s-%s-%s:%s:%s\n", $1, $2, $3, $4, $5, $6}' fieldwidths="4 2 2 2 2 2"

haskell - Monads with Join() instead of Bind() -

Image
monads explained in turns of return , bind . however, gather can implement bind in terms of join (and fmap ?) in programming languages lacking first-class functions, bind excruciatingly awkward use. join , on other hand, looks quite easy. i'm not sure understand how join works, however. obviously, has [haskell] type join :: monad m => m (m x) -> m x for list monad, trivially , concat . general monad, what, operationally, method do? see type signatures, i'm trying figure out how i'd write in, say, java or similar. (actually, that's easy: wouldn't. because generics broken. ;-) in principle question still stands...) oops. looks has been asked before: monad join function could sketch out implementations of common monads using return , fmap , join ? (i.e., not mentioning >>= @ all.) think perhaps might sink in dumb brain... without plumbing depths of metaphor, might suggest read typical monad m "strategy produce a...

powershell - Script create contacts in Active Directory does not work -

i running script in test environment, works run script in production environment, not work when starting on domain controller, under control of windows server 2008 r2 standard or enterprise. you must provide value expression on right-hand side of '-' operator. @ c:\scripts\galsync.ps1:89 char:14 + $targetcred - <<<< properties targetaddress + categoryinfo : parsererror: (:) [], parseexception + fullyqualifiederrorid : expectedvalueexpression 89 str $targetcred -properties targetaddress ### --- galsync.ps1 --- # # written carol wapshere # # manages contacts in 2 domains based on mail-enabled users in other domain. # - contacts created new users. # - contacts deleted if source user no longer meets filter requirements. # - contacts updated changed information. # # notes: # - requires rsat roles , features installed. ref http://blogs.technet.com/heyscriptingguy/archive/2010/01/25/hey-scripting- guy-january-25-2010.aspx # - attr...

mysql - best storage solution for data samples -

i'm developing system collect user activities samples (opened window, scrolls, enter page, leave page, etc.) , i'm looking best way store these samples , query it. i prefer smart can execute sql-like group queries (for example give me window open events grouped date , hour), , of course flexible enough in case i'll need add columns in future. i'm trying avoid thinking queries might need , save aggregated version of data time, since i'd drill-downs. (for example, count window open events date , time, , see event in each time-frame, or change unique userid). thanks. ps - use mysql task, data expected grow rapidly. i've experimented mongodb well. i believe mongodb can solution. first of it's designed hold big data , it's easy use , scale (replica set or sharding). expression language solid. mean it's not powerful sql, still enough. here link mapping sql command mongodb. there other alternatives, think or complex or expression lan...

jquery - Generate table row dynamically on AJAX success -

what i'd : when user clicks on send, want data displayed in <tr/> (with each field nested in own <td/> ). i wrote script this, system not dynamic yet. html : <form name="contact" method="post" action=""> <p> <label for="name">name</label> <input type="text" name="name" id="name" /> </p> <p> <label for="age">age</label> <input type="text" name="age" id="age" /> </p> <p> <label for="mail">mail</label> <input type="text" name="mail" id="mail" /> </p> <p> <input type="submit" name="submit" id="submit" value="send" /> </p> </form> <table id="results"></ta...

c# - DotNetZip Saving to Stream -

i using dotnetzip add file memorystream zip file , save zip memorystream can email attachment. code below not err memorystream must not done right because unreadable. when save zip hard drive works perfect, not when try save stream. using (zipfile zip = new zipfile()) { var memstream = new memorystream(); var streamwriter = new streamwriter(memstream); streamwriter.writeline(stringcontent); streamwriter.flush(); memstream.seek(0, seekorigin.begin); zipentry e = zip.addentry("test.txt", memstream); e.password = "123456!"; e.encryption = encryptionalgorithm.winzipaes256; var ms = new memorystream(); ms.seek(0, seekorigin.begin); zip.save(ms); //ms want use send attachment in email } i've copied code, , saved final memory steam disk data.txt . unreadable me, realized wasn't text file, zip file, saved data.zip , worked expected the method used save ms disk following(immediately after zip.save(...

linux - After kill(getpid(), sig), is the signal guaranteed to be delivered before the next statement? -

assuming you're in single-threaded process, , relevant signal not blocked or ignored, guaranteed that: kill(getpid(), sig); will result in signal being delivered before next line of code executed? in particular, if signal 1 there no handler , whole default action terminate process (e.g. sigterm, sigalrm), guaranteed next line of code won't executed? i had assumed (at least on linux) answer "yes", because thought before returning syscall kernel check see if there pending signals , deliver them if so. think have observed (when run on heavily-loaded, multi-core system) not case, though hard reproduce , i'd appreciate confirmation i'm not seeing things. [this question similar is signal sent kill parent thread guaranteed processed before next statement? except that question asking multi-threaded processes (for answer "no"), whereas question single-threaded processes.] yes. if you're in single threaded process, posix gives gua...

c++ - Can I do an assignment operation between two istream_iterators? -

can assignment operation between 2 istream_iterators? if behaviour, i.e. both iterators point same location in file, i.e. 2 pointers same line in file? if so, can increment 1 iterator, read lines, , assign other iterator , again start reading lines same location earlier? basically want write program simulates loop. should happen while parsing file. istream_iterators input iterators , not forward iterators . means single-pass iterators, opposed multi-pass iterators: there no way go in sequence, or iterate sequence more once.

javascript - Change image on click -

i have table , change image in <td> when click must url of image determine before. that url of image type link of page(for example click on img) index.html?type=dog then script read variables link. create variable script. type = httpgetvars["type"] now when click on img of cat, script should replace cat .png dog .png , tried in way. <img src="cat.png" onclick="document.write("<img src=\""+ type + ".png\">); <img id="foo" src="cat.png /> give <img> id - foo example than: document.getelementbyid('foo').src = type +".png"; you change existing <img> src new image.

root - Hide Android System Bar in tablets via Firmware -

i need know process or application shows system bar (home button, button, settings) in android tablets. need kill process or application avoid user access android settings. have possibility in custom android firmware. what need modify in android code hide bar? thanks look @ hidebar on github. process com.android.systemui , hidebar shows specific service class names. can use activitymanager or process kill since system process possible cause instability , possibly respawn itself.

apache2 - Setting the backend setting for Apache + Nginx -

backend default { .host = "localhost"; .port = "8080"; } at varnish config, port should assigning? i'm using apache on backend listening 1740 , nginx listening 80 proxy_pass upstream 127.0.0.1:1740 . why not nginx + varnish? nginx , apache both webserver, of course can use nginx proxy_pass... if same server ditch apache or nginx... choose one. in case "varnish web application accelerator. install in front of web application , speed significantly." (copy paste form home page @ site) so think first should decide if want nginx or apache has you're web server.

mysql - How does NOT IN subquery work with NULL values? -

i confused how following works in mysql. in queries below, first select returns rows table2 while second select returns none of rows. there explanation of how null works not in operator. there documentation explains this? create table table1 ( id int unsigned not null auto_increment, primary key (id) ); create table table2 ( id int unsigned not null auto_increment, table1_id int unsigned, primary key (id) ); insert table2 (id, table1_id) values (1, null); select count(*) table2 table1_id not in (select id table1); +----------+ | count(*) | +----------+ | 1 | +----------+ insert table1 (id) values (1); select count(*) table2 table1_id not in (select id table1); +----------+ | count(*) | +----------+ | 0 | +----------+ the reason according sql specification, foo in(a,b,c) translates ( foo = or foo = b or foo = c ) . thus, if have foo in(null, 1, 2) foo = null or foo = 1 or foo = 2 . since foo = null unknown , evaluated false purp...

javascript - Object.Prototype Methods and 'Use Strict' in an IIFE (Immediately-Invoked Function Expression) -

the original code: 'use strict'; function gitjs(config) { var defaults = { inheriting: false, clientid: undefined, accesstoken: undefined, baseurl: 'https://api.github.com', mode: 'read' }; this.config = $.extend(defaults, config); } /** * gets jquery method gitjs#generateapirequest going use send ajax request. * * @param {string} httpverb http verb request use, * @return string */ gitjs.prototype.getcommandmethod = function (httpverb) { var method = $.get; switch (httpverb) { case 'get': method = $.get; break; case 'post': method = $.post; break; } return method; }; ... the new code: (function() { 'use strict'; 'use strict'; function gitjs(config) { var defaults = { inheriting: false, clientid: undefined, accesstoken: undefined, baseurl: ...

css - Is there a way to load an alternate stylesheet using PHP? -

i'm building mobile version of site, , @ point, creating alternate stylesheet suffice make site adept mobile devices. want use user agent detection php script detect platform, , switch stylesheets accordingly. there way that? you might want try out librabry check if mobile device can try out library: http://code.google.com/p/php-mobile-detect/ (this supports detecting specific oses) and have code like if($detect->isios()){ echo <link rel="stylesheet" type="text/css" href="iosstyle.css" />; } else if ($detect->ismobile()) { echo <link rel="stylesheet" type="text/css" href="mobile.css" />; } else{ echo <link rel="stylesheet" type="text/css" href="normal.css" />; } fyi, these libraries dependent on user-agent value in header , other headers too.

Inserting a UTF-8 NSString in MySQL with PHP -

i have objective-c nsstring (say, 'gabriel garcía márquez') want pass php via post request, in turn call mysql insert add string utf8-bin column. trouble is, string shapeshifting along way, , i've read every stack overflow post on subject prevent it. the post request (with charset utf-8) contains 'gabriel garc\u00eda m\u00e1rquez'. if insert string utf8-bin column right away without encode or decode, result in mysql '4761627269656c2047617263c3ad614dc3a1727175657a'. if wrap string in utf8_decode(), result 'gabriel garc'. if wrap string in utf8_encode() (hey, why not?), result same first string. what missing prevent text devolving garbage? some notes make more frustrating: i call mysql_set_charset('utf8', $conn) before insert query. the table collated in utf8_bin, columns utf8_bin. oops...it's phpmyadmin bug. '4761627269656c2047617263c3ad614dc3a1727175657a' is, surprisingly, correct in different environment...

c# - issue in DataGrid when load the items -

i tried load top3 record of table datagrid shows error cannot implicitly convert type 'system.linq.iqueryable' 'string' .the code below wrote mydatatbasedatacontext mydb = new mydatatbasedatacontext(); var top3 = (from t in mydb.gettable<student>() select t).take(2); grd_8.itemstringformat = top3; change var top3 = (from t in mydb.gettable<student>() select t).take(2); to list<student> top3 = (from t in mydb.gettable<student>() select t).take(2).tolist(); and if grd_8.itemstringformat string have convert yr list string using stringbuilder but can assign list<student> top3 grid itemssource/datasource

xcode - Setting inital View on a View Based Aplication -

i no how go 1 window using ibaction , and button wandering if way "application didfinishlaunchingwithoptions" bool (unchanged since created) looks this - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. // set view controller window's root view controller , display. self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; } any on matter received. after searching internet 2 hours became apparent 1 have asked such question. after 1 , half hours of solid failure have made solution. there 3 things must first must go appdelegate.h , change following @class originalpageveiwcontroller; @interface snakeappdelegate : nsobject <uiapplicationdelegate> { uiwindow *window; originalpageveiwcontroller *viewcontroller; } @property (nonatomic, retain) iboutlet uiwindow *window; @property (...

java - Hibernate- cascading option for one to many using spring HibernateTemplate -

in application, i'm having one-to-many relationship in have following requirements. example, take car- owner relationship. owner can have multiple cars, while 1 car can have 1 owner only. when save parent entity (owner) car collection in it, want car inserted automatically. same update well. when remove car objects collection & save, want removed car objects deleted database. i tried following options in hibernate xml mapping: inverse="false" fetch="select" cascade="all-delete-orphan" and inserted using hibernatetemplate.persist() updated using hibernatetemplate.merge() the update works well, insert not working properly. can advice me exact cascade option & method use in saving & updating such scenario? see 21.3. cascading life cycle here: http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/example-parentchild.html

jquery - How to make autocomplete textbox that passes a value to another aspx page on submit? -

i have website has products list page , product detail page . in asp master page placed textbox search products in database . what need : when visitor begins writing in textbox ,the textbox auocompletes products names in database . when visitor press enter on result dropdownlist , site takes him product details page filled submitted product details id passed query string home page . please me searched lot , there similar questions didn't work case . any link tutorial or question mine here perfect . thank much you need automcompleteextender. read in codeproject tutorial here official documentation here msdn tutorial covering needs here

mysql - How to insert multiple records with some conditions -

i have 2 tables. 1 table contains words. other table contains points. table words: id word table points: id wordid x y word column unique. i want write stored procedure takes on input current x value , list of word|y values. for example: it's initial words table rows: id word 1 carrot 2 apple 3 potato we call procedure storedata(x = 5, words = { carrot:123, onion:321 }) . as result have: words table: id word 1 carrot 2 apple 3 potato 4 onion points table: id wordid x y 1 1 5 123 2 4 5 321 how it? you can't pass structured data parameter stored procedure: have first insert (temporary) table somewhere, read contents of table within procedure. such, may insert directly destination tables: insert ignore words (word) values ('carrot'), ('onion'); insert points (wordid, x, y) select words.id, 5, y words natural join ( select 'carrot' word, 123 y union sele...

.net - chaining array of tasks with continuation -

i have task structure little bit complex(for me @ least). structure is: (where t = task) t1, t2, t3... tn. there's array (a list of files), , t's represent tasks created each file. each t has 2 subtasks must complete or fail: tn.1, tn.2 - download , install. each download (tn.1) there 2 subtasks try, download 2 paths(tn.1.1, tn.1.2). execution be: first, download file: tn1.1. if tn.1.1 fails, tn.1.2 executes. if either download tasks returns ok - execute tn.2. if tn.2 executed or failed - go next tn. i figured first thing do, write structure jagged arrays: private void createtasks() { //main array task<int>[][][] maintask = new task<int>[_queuedapps.count][][]; (int = 0; < maintask.length; i++) { task<int>[][] arr = generateoperationtasks(); maintask[i] = arr; } } private task<int>[][] generateoperationtasks() { //two download tasks ...

html5 - How to use animationevent in css3 -

so trying learn new css3 features rid of javascript, have problems animationevent "function". on w3.org gives definition: interface animationevent : event { readonly attribute domstring animationname; readonly attribute float elapsedtime; void initanimationevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in domstring animationnamearg, in float elapsedtimearg); }; so how should use in firefox or chrome? if knows, please give basic example of should write animation name, after animationname:, or after typerarg: should put animationstart; have no idea. thanks! the interface w3 specification has implemented follows: e.addeventlistener("animationend", listener, false); // listener function receives obj...

jquery mobile - JQuerymobile redirect on pageshow with delay -

i working on jquerymobile site multiple pages. if 1 of pages shown (id="shown"), want redirect page (id=#redirected") after delay of 6 seconds. in code, commented line works this, problem redirects #redirected page if user changes sup page in meantime. need "if other page not shown" thing in here. i tried jquery "changepage" (which handle transitions etc.), don't know how implement delay here. please see code: $("#shown").bind("pageshow", function(e) { //window.settimeout('window.location="#redirected"; ',6000); $.mobile.changepage("#fertig", { reverse: "false"}); i made working jsfiddle you: http://jsfiddle.net/zuzmx/ using jquery mobile multi-page template 3 pages ids "one", "two", , "three". when navigating 2 initiates timeout of 6 seconds after checks if active page "two" and, if so, proceeds redirect user 3 usin...

Is there a way to add constructors using Groovy 2.0 Extensions -

in older (1.x.x) versions of groovy can add constructors using metaclass.constructor example.metaclass.constructor << { string arg0 -> new example(arg0, "") } is there way register constructors using new groovy 2.0 extension modules? this seems work: define extension class normal groovy 2 , add constructors in static initialiser public class examplehelper { static { example.metaclass.constructor << { string arg0 -> new example(arg0, "") } } } not know of... you add static factory method example class ie: class exampleextensionstatic { public static example newinstance( example type, string arg0 ) { new example( arg0, '' ) } } then (after adding link class in staticextensionclasses field of org.codehaus.groovy.runtime.extensionmodule file), do: example.newinstance( 'arg0' ) this worth asking on mailing list see if constructors worth adding module extension system.

sorting - insertion sort algorithm pseudocode -

insertion-sort(a) 1 j ← 2 length[a] 2 key ← a[j] 3 ▹ insert a[j] sorted sequence a[1 j - 1]. 4 ← j - 1 5 while > 0 , a[i] > key 6 a[i + 1] ← a[i] 7 ← - 1 8 a[i + 1] ← key hi! first question.could me understand code? why 'a[i+1]=a[i]'? shouldn't other way round going down list. a[i+1]=a[i] used shift each element greater key 1 place right, can put key before them. you can find more information on page .

ios - Objective-C calling instance method within Singleton -

i created singleton class named datamanager . i've set caching. however, when attempting call cache instance methods within instance method of datamanager , i'm getting exc_bad_access error on line: nsmutablearray *stops = [[datamanager sharedinstance] getcacheforkey:@"stops"]; datamanager.h @interface datamanager : nsobject { fmdatabase *db; nsmutabledictionary *cache; } + (datamanager *)sharedinstance; // ... more methods - (id)getcacheforkey:(nsstring *)key; - (void)setcacheforkey:(nsstring *)key withvalue:(id)value; - (void)clearcache; datamanager.m - (nsarray *)getstops:(nsinteger)archived { nsmutablearray *stops = [[datamanager sharedinstance] getcacheforkey:@"stops"]; if (stops != nil) { nslog(@"stops: %@", stops); return stops; } stops = [nsmutablearray array]; // set stops... [[datamanager sharedinstance] setcacheforkey:@"stops" withvalue:stops]; return stops;...

Python json get specific story and image -

i new python , have json news feed need selected 'title' , image 'src'. i have managed print 'title' , image 'src' says "1024 landscape". how can print, example, second title? how address particular one? feed : http://www.stuff.co.nz/_json/ipad-big-picture for story in data.get('stories', []): print 'title:', story['title'] img in story.get('images', []): var in img.get('variants', []): if var.get('layout') == "1024 landscape": print ' img:', (var.get('src')).split('/')[-1], ' layout:', var.get('layout') thanks first stories object (list of dicts): stories = data.get('stories', []) once have list can access index: if len(stories) >= 2: print stories[1]['title'] or try first , catch exception: i = 1 try: print stories[i]['title'] except ...

multithreading - What 4 threads are running under an empty new VCL forms application? -

Image
possible duplicate: what other threads in default vcl application, , can named purpose? when running new empty vcl forms application in delphi xe2 (32bit), see 4 threads running in task manager app. app requires @ least 1 thread, in case, other 3 threads? i'd have better understanding of threads vcl forms application runs default. thought possibly had fact running in debug mode rad studio, launched exe self, , had 4 threads running. tried compiling under "release" config (thus disabling compiling debug info) , there still 4 threads. to determine source of threads, can inspect start address of threads using tool process explorer or process hacker . in case example can see ntdll.dll!tpcallbackindependent+0x????? part of windows threadpool api. ntdll.dll!rtlmovememory+0x????? call rtlmovememory winapi function. project??.exe+0x????? main thread of app.

python - How to find an index at which a new item can be inserted into sorted list and keep it sorted? -

a = 132 b = [0, 10, 30, 60, 100, 150, 210, 280, 340, 480, 530] i want know a should in 6th position in ordered list b . what's pythonic way so? use bisect . it's not beautiful api, it's need. you'll want use bisect.bisect , returns want.

html5 - Camera object detection in JavaScript -

suppose user has modern browser chrome , enables necessary html5 camera settings (so getusermedia works), how 1 detect specific predefined objects shown in webcam sight, using javascript? for instance, there's html5/ js-based face detection works great, , saw hand detection demo (which didn't work here; might doing wrong). necessary steps train camera detect given other objects of (developer) choice? say, want cam recognize location of red pen; or perhaps darkest object in sight; or perhaps black iphone waved camera etc. thanks! object detection in tricky business. have know object is, whether smooth, flexible, has lot of color contrast, moves quickly, , lot of other questions before can determine best method. also, depends on whether want detect object , or if want track it during movement in front of camera. i'll naming few methods here, because don't have time elaborate lot. can find lot of documentation on google once know names, aware might...

java - IOException raise in parser -

i make application in call webservices , fill data. here due odd things occure.i got error arrayindexoutofbound ioexception... have use sax parser parseing simple webservices. error:: 07-02 16:50:52.992: e/nearbyscreen(31762): sax parser errorjava.lang.arrayindexoutofboundsexception: length=8192; regionstart=-2888; regionlength=11080 07-02 16:50:52.992: w/system.err(31762): java.lang.arrayindexoutofboundsexception: length=8192; regionstart=-2888; regionlength=11080 07-02 16:50:53.002: e/nearbyscreen(31762): sax parser errorjava.io.ioexception: attempted read on closed stream. 07-02 16:50:53.002: w/system.err(31762): @ java.util.arrays.checkoffsetandcount(arrays.java:1731) 07-02 16:50:53.012: w/system.err(31762): @ java.net.plainsocketimpl.read(plainsocketimpl.java:484) 07-02 16:50:53.012: w/system.err(31762): @ java.net.plainsocketimpl.access$000(plainsocketimpl.java:46) 07-02 16:50:53.012: w/system.err(31762): @ java.net.plainsocketimpl$plainsocketinputstream.read(...

How to tell credit card's country of origin by its number? -

i'm trying develop application, give access different services people different regions of world. let's say, enters card number 1111-1111-1111-1111 . how use tell country of origin? i know possible, because paypal , apple it. at first, questioned whether information gleened credit card number alone. then found here: http://en.wikipedia.org/wiki/list_of_bank_identification_numbers edit - don't forget pci compliance if taking credit card numbers payment. edit - apparently previous wikipedia page has been deleted. this appears have similar information.

How to get html source code of a page using C#? -

i'm building application in c# retrieve information bank account. far, i'm able connect bank account on https://accesd.desjardins.com . first enter card number , password on page. : private void newweb_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { switch (istages) { case 1: newweb.document.getelementbyid("card_num").setattribute("value", strcardnum); newweb.document.getelementbyid("ch_but_logon").invokemember("click"); istages = 2; break; case 2: newweb.document.getelementbyid("passwd").setattribute("value", psswd); newweb.document.getelementbyid("ch_but_logon").invokemember("click"); istages = 3; break; } } but once i'm on bank account page, can't no longer use newweb...

Android: Adding header to dynamic listView -

i'm still pretty new android coding, , trying figure things out. i'm creating listview dynamically shown below (and disabling items dynamically also) - you'll notice there's no xml file activity itself, listitem. what i'd add static header page. explain me how can modify code below either add programatically within java file, before listview, or edit code below targets listview within xml file! help appreciated!!! public class start extends listactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); databasehelper mydbhelper = new databasehelper(null); mydbhelper = new databasehelper(this); try { mydbhelper.opendatabase(); }catch(sqlexception sqle){ throw sqle; } arraylist<string> categorylist = new arraylist<string>(); cursor cur = mydbhelper.getallcategories(); cur.movetofirst(); while (cur.isafterlast() == false) ...

r - Using package ‘forecast’ version 3.22 auto.arima -

i used auto arima , have got result this: series: jmb arima(5,1,4)(2,0,2)[96] drift coefficients: ar1 ar2 ar3 ar4 ar5 ma1 ma2 ma3 ma4 1.3100 0.2710 -1.0215 0.5572 -0.1527 -0.8652 -0.6309 0.7686 -0.2520 s.e. 0.1384 0.1974 0.0752 0.1208 0.0334 0.1389 0.1371 0.0960 0.0797 sar1 sar2 sma1 sma2 drift 0.5959 0.4010 -0.4792 -0.4338 0.0005 s.e. 0.0382 0.0381 0.0388 0.0363 0.0183 sigma^2 estimated 0.01521: log likelihood=9835.91 aic=-19636.59 aicc=-19636.56 bic=-19522.77 > plot(forecast(fit,h=96), xlim=c(120,155) ) warning message: in sqrt(z[[2]] * object$sigma2) : nans produced , can not use plot (...) funktion. in addition warning, residual big. may auto arima create wrong model, , how can improve model? seasonal arima models not work when seasonal period large. have seasonal period of 96 way bigger use these types of models. see my blog post o...

memory - How are CLR GC heaps mapped to native heaps? -

for example, if see of heaps pretty big, next question (native or managed code) uses them. how can figure out native heaps (!heap -s) clr uses purpose? the clr uses virtualalloc allocate memory segments used managed heaps. can inspect segments using !sos.eeheap -gc. !sos.dumpheap -stat show how memory managed heaps using, , types of objects consuming memory.

ruby - Loaded async_sinatra gem, but my program is not finding a method in it -

the gem in question async_sinatra . have installed, , ran bundle install in gemfile, keep getting same error: nomethoderror: undefined method 'aget' main:object anyway fix this? notes: running latest sinatra, , using thin webserver, , running jruby 1.6.7. the example code using is: require 'sinatra/async' class asynctest < sinatra::base register sinatra::async aget '/' body "hello async" end end run asynctest.new rename file config.ru make sure require 'sinatra' @ top of file run rackup config.ru works me on osx 10.7 mri 1.9.3p125, thin 1.3.1, sinatra 1.3.2 , async_sinatra 1.0.0.

android - Should logs be disabled before releasing app? -

i release app. should remove log statements , e.printstacktrace() within catch statements ? logs essential troubleshooting resources, deployed software. i limit logging production releases (perhaps limit "only log in emergencies"). not categorically "no logging". here discussion (with guidelines): how enable/disable log levels in android? ps: having said that, hasten add: no, should not have "debug" or "informational" logging in production release. which android documentation, cited in above links, says.

iphone - Running the code when application is in the background or device is locked -

i have piece of code wherein make server call , based on response play sound. now, not work when application in background or devicei locked. is there way can execute piece of code (server call , response handling) if app in background or device locked? there no general solution, design. (apple not want have potentially cpu- , power-intensive process running in background , degrading user experience.) there few limited-case options available: you said want play sound. if mean "play music" or such streaming, there audio background task application can register perform. note must actually streaming audio; apple rightfully frowns upon apps try use approach circumvent general-case prohibition , reject app store submission accordingly. you can invert scenario , have server send push notification through apple push notification service . depending on user's settings, alert, badge, or sound can result. might best fit if aren't streaming audio. ...

bluetooth - How to use Broadcom BLE SDK (SMART 4.0) in Android 4.X -

i trying develop ble bluetooth (smart) application android. i managed download broadcom ble sdk , install through android sdk manager explained on web site , download projects examples . when tried push 1 of examples tests phones (htc 1 s, htc 1 x both bluetooth ble feature), facing following issue: install_failed_missing_shared_library is there possibility include broadcom library described in androidmanifest.xml file ? <uses-library android:name="com.broadcom.bt.le" android:required="true"/> is managed test broadcom projects examples? , on phone? according post , bug has been discovered on samsung galaxy s3, didn't find information htc products. update : great news!!! last android version 4.3 (jelly bean) support low-energy bluetooth smart accessories. http://www.android.com/about/jelly-bean/ https://developer.bluetooth.org/pages/bluetooth-android-developers.aspx not sure every phones have update (even last htc 1 m7 example) ...

jquery - jsf 2.0 working with javascript prevents ajax call -

i'm working on jsf 2 project. got javascript/jquery functions on client side, after calling these functions <a4j:commandbutton> not working. servlet.service() servlet faces servlet threw exception: java.lang.nullpointerexception @ com.sun.faces.context.partialviewcontextimpl.createpartialresponsewriter(partialviewcontextimpl.java:441) if change <a4j:commandbutton> <h:commandbutton> , works fine, need a4j because of oncomplete attribute. how can debug issue? looks problem javascript event, prevents ajax call. i have tracked down problem determine due <button> tag being in html. for example: <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j"> <h:head> </h:head> <h:body> <h:form id="example"> <a4j:commandbutton type="submit...

c# - NServiceBus issue, messages still in queue and handlers are not picking messages -

when hitting endpoint main method gets invoked subsequent handlers not pick messages queue. queue keeps building. has encountered issue before? thanks, so far not know neither architecture nor code, have guess here. please bear me if may not apply case. several things come mind: 1.) did see tread? nservicebus bus.send().register(callback) not working on iis/windows server 2008 2.) there unhandled exception or there 1 gets silently caught , causes handler method halt reason. 3.) using wcf nservicebus? last week colleague implemented wcf service hosted nservicebus , had problem sounds similar yours. hit message handler first message, never handled subsequent message. the reason handler never returned enum value return code (represented yourenum in code snippet), defined in service inheritance definition ( nservicebus documentation ): public class yourwcfservice : wcfservice<yourmessage, yourenum> { } the calling service did not need return values, c...

function - Passing type bound procedures as arguments -

i trying pass type bound procedure argument subroutine. want know if possible in fortran. here code snippet shows trying . module type_definitions type test_type integer :: i1, i2,i3 contains procedure :: add_integers_up end type test_type contains subroutine add_integers_up(this,i4,ans) class(test_type) :: integer :: i4,ans ans = this%i1+this%i2+this%i3+i4 end subroutine add_integers_up subroutine print_result_of_subroutine(i4,random_subroutine) integer :: i4,ans interface subroutine random_subroutine(i1,i2) integer:: i1,i2 end subroutine random_subroutine end interface call random_subroutine(i4,ans) write(*,*) ans end subroutine print_result_of_subroutine end module type_definitions program main use type_definitions implicit none integer :: i1,i2,i3,i4 integer :: ans type(test_type) :: test_obj i1 =1; i2=2; i3=3 test_obj%i1 = i1 test_obj%i2 = i2 test_obj%i3 = i...

private - Java method access -

i have question public , private classes in java. example, if have public method inside of private class, can public method accessed other public/private classes? in advance. in order able invoke method inside class, method invocation must have access class itself. therefore, methods of class inside of private class defined have access public method, , methods of other classes not have access. of course if private class inherits public class or implements public interface, methods of base class or interface visible everyone.

android - Asycntask multiple downloading fails in Listview -

i downloading mp3 files (using asynctask) , updating there progress in listview contains progress bar , textview (which shows how % downloaded). runs ok till 2% 3% crashes exception. this code: @override protected void onprogressupdate(integer... values) { super.onprogressupdate(values); log.v("progress ", integer.tostring(values[0])); pbar.setprogress(values[0]); tmin.settext(integer.tostring(values[0]) + "%"); } this error: 07-04 05:50:38.990: e/androidruntime(1587): fatal exception: main 07-04 05:50:38.990: e/androidruntime(1587): java.util.concurrent.rejectedexecutionexception: task android.os.asynctask$3@40928f80 rejected java.util.concurrent.threadpoolexecutor@40b93700[running, pool size = 128, active threads = 128, queued tasks = 10, completed tasks = 1] ...