Posts

Showing posts from January, 2011

keystore - Genarate ECPublicKey in java -

hi new java ecc encryption.so got ecc public key data array java card.the size 49 byte length.so need genarate eccpublic key.so have created public key.but gives java.security.spec.invalidkeyspecexception: encoded key spec not recognised error.this code can me how generate eccpublickey using data array.thanks byte[] pub = new byte[] { /*(public data) 49 length byte array */ }; system.out.println("length :" + pub.length); x509encodedkeyspec ks = new x509encodedkeyspec(pub); keyfactory kf; try { kf = keyfactory.getinstance("ecdh"); } catch (nosuchalgorithmexception e) { e.printstacktrace(); return; } ecpublickey remotepublickey; try { remotepublickey = (ecpublickey) kf.generatepublic(ks); } catch (invalidkeyspecexception e) { e.print...

wso2 - Is it possible for a message producer to get acknowledgement of message receipt from activemq? -

in situation, remote client sending messages wso2esb acting proxy forward messages activemq. once remote client receives acknowledgement of message receipt wso2esb, deletes message local storage. important me send acknowledgement remote client after activemq has received message wso2esb , has stored in persistent storage. ( store , forward consumers pattern ). all find read on activemq acknowledgement activemq getting acknowledgement once consumer collects message activemq , sends acknowledgement activemq including transactions etc. not find on producer getting acknowledgement activemq once activemq has received message producer. how configure activemq send acknowledgement wso2esb acting proxy producer? hope resolve concern http://wso2.com/library/articles/2013/01/jms-message-delivery-reliability-acknowledgement-patterns/

c - Can EPOLLHUP trigger an event for a descriptor, disabled by EPOLLONESHOT? -

i have few threads, waiting on same epoll_fd epoll_wait() . descriptors within epoll set setup in way: struct epoll_event event; event.events = epollin | epolloneshot; event.data.fd = fd; the purpose of epolloneshot guarantee, each descriptor handled in 1 thread @ same time. if 1 thread has received epollin event specific fd , can epollhup or epollerr trigger event in thread same fd ? i suggest can't - since descriptor disabled due epolloneshot . if can - can use epollrdhup instead? triggered at least once when descriptor becomes invalid/closed/disconnected means? seems disabled descriptors don't receive epollhup .

linux - how to combine two variable column-by-column in bash -

i have 2 variables, multi-line. var1="1 2 3 4" var2="ao ad af ae" i want var3="1ao 2ad 3af 4ae" i know can by: echo "$var1" > /tmp/order echo "$var2" | paste /tmp/order - but there way without temp file? paste <(echo "$var1") <(echo "$var2") --delimiters ''

java - Copy Paste from Central Repository is Weird -

Image
this question bit odd -- bear me. if wrong site ask question, please kindly advise correct stack site. i use website http://search.maven.org find java dependencies maven-based projects. take artefact example . in dependency information box (for apache maven), double click highlight text, copy-paste favourite text editor. @ raw bytes. weird. if paste directly pom.xml file, maven cries foul during validate stage badly formatted xml. example raw text octal literals: <dependency> \302\240\302\240\302\240\302\240<groupid>cglib</groupid> \302\240\302\240\302\240\302\240<artifactid>cglib-nodep</artifactid> \302\240\302\240\302\240\302\240<version>2.1_3</version> </dependency> am crazy or else have issue? problem web browser (chrome), text editor (notepad++), operating system (windows 7) or central repo website? update i tried copying google chrome , pasting various places. have same issue. tried pasting cygwin se...

c++ - determinisitic random number generator giving different random number for same seed -

i want use deterministic random bit generator application. i' m using openssl random number generator apis. i'm using rand_pseuso_bytes() api generating pseudo random numbers. , i'm giving seed through rand_add(). if called random generator function 2 times, i'm getting 2 different random values @ these 2 calls. if seed same, should give me same values, have gone wrong ? the code have written is int nsize = 8; /* 64 bit random number required */ int nentropy = 5; /* 40 bit entropy required */ /* generate random nonce making seed */ rand_bytes(cseed_64, nsize); rand_add(cseed_64, nsize, nentropy); /* random nonce cseed_64, seedin 64 bit * 40 bit entropy */ /* calling random byte function generate random number function 10 times same seed*/ int j = 10; while( j--) { rand_pseudo_bytes(crandbytes_64, 8); printf("generated 64 bit random number \n"); for(i = 0 ; < nsize; i++) printf("%x ...

java - Stored procedure use Sqlite : Android -

my query can write stored procedure in sqlite can accessed android java class? i have refered creating stored procedure , sqlite? and if no there other way perform kind of activity in android?? no cant have stored procedure on sqlite. not multi user database server mysql or sql-server. create normal query , execute it. see link more information how run query in sqlite database in android? . remember speed benefit of stored procedure not have recompile , query plan can generated before execution. great in multi user environment not in single user environment sqlite.

business logic - jQuery end(), where exactly it is useful -

i have looked in jquery documentation of function end(), definition : end recent filtering operation in current chain , return set of matched elements previous state. i have understood functionality, not able make out, more helpful. ex: <p>text</p> <p class="middle">middle <span>text</span></p> <p>text</p> <script type="text/javascript"> alert(jquery('p').filter('.middle').length); //alerts 1 alert(jquery('p').filter('.middle').end().length); //alerts 3 alert(jquery('p').filter('.middle').find('span') </script> i have understood second line displaying //alerts 3 , can written as alert(jquery('p').length); //alerts 3 then why 2 methods .filter , .end() , please give me example, .end() useful. html <p>text</p> <p class="middle">middle <span>text</span></p> <p>...

strophe - XMPP: retrieving BOSH Session ID and RID -

please tell me how retrieve sid , jid. using strophe js. <body rid='489923353' xmlns='http://jabber.org/protocol/httpbind' sid='ab7f5957' to='127.0.0.1' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/> var conn = new strophe.connection(bosh_service); however, conn.sid or conn.rid not returning same numbers. after , that, think found answer! else if(status === strophe.status.connected){ //get roster var iq = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:roster'}); chat.connection.sendiq(iq, chat.on_roster); //on chat chat.connection.addhandler(chat.on_message,null, "message", "chat"); $("#presence").html("connection sid" + chat.connection.sid + "connection rid" + chat.connection.rid); }

ruby on rails - Sending custom headers through RSpec -

given api consumers required send customer http header this: # curl -h 'x-someheader: 123' http://127.0.0.1:3000/api/api_call.json then can read header in before_filter method this: # app/controllers/api_controller.rb class apicontroller < applicationcontroller before_filter :log_request private def log_request logger.debug "header: #{request.env['http_x_someheader']}" ... end end so far great. test using rspec there change in behavior: # spec/controllers/api_controller_spec.rb describe apicontroller "should process header" @request.env['http_x_someheader'] = '123' :api_call ... end end however, request received in apicontroller not able find header variable. when trying same code http_accept_language header, work. custom headers filtered somewhere? ps: examples around web use request instead of @request . while i'm not 1 correct of current rail...

sql - ORA-00905: Trouble converting Mysql syntax to oracle syntax -

i have mysql code , need convert oracle syntax , faced error. me? select sum(t.send_unread_draft) send_unread_draft, sum(t.send_read_draft) send_read_draft, sum(t.send_approved) send_approved, sum(t.send_completed) send_completed, sum(t.send_failed)send_failed,sum(t.received_draft)received_draft,sum(t.received_approved)received_approved, sum(t.received_accepted_send)received_accepted_send,sum(t.received_rejected_send)received_rejected_send, sum(t.send_canceled)send_canceled (select (case when type = 'out' (case when status = 'draft' (case when read_flag = 'n' 1 else 0 end) else 0 end) else 0 end) send_unread_draft, (case when type = 'out' (case when status = 'draft' (case when read_flag = 'y' 1 else 0 end) else 0 end) else 0 end) send_read_draft, (case when type = 'out' (case when status = 'approved' 1 else 0 end) else 0 end) send_...

c++ - getchar_unlocked() slowing down execution time -

i attempting problem on codechef input array of size n, , have output number repeats in array along count. problem link :: http://www.codechef.com/problems/maxcount/ i first wrote code using scanf input, , got ac execution time(0.94s) pretty near allowed time(1s). had read getchar_unlocked() decreases input time, , hence tried implement using getchar_unlocked. instead got me time limit exceeded error. the code using getchar_unlocked :: #include <iostream> #include <cstdio> using namespace std; void fastread(int* a) { char c=0; while (c<33) c=getchar_unlocked(); *a=0; while (c>33) { *a=*a*10+c-'0'; c-getchar_unlocked(); } } int main() { int cases; int size,in; fastread(&cases); while(cases--) { int arr[100001]={0}; int max=0; int index=0; fastread(&size); for(int i=0; i<size; i++) { fastread(&in); arr[in]++; if(arr[in]==max) { if(in<index) ...

php - how to solve this internal server error -

i getting internal server error while running query mysql_query("select * table_name party '%nixon%' group 1_from_2_to,instr_,party limit 1770"); but result when change limit 1765 mysql_query("select * table_name party '%nixon%' group 1_from_2_to,instr_,party limit 1765"); what problem here? in advance. see error log . may mysql problem. check version of mysql.

ssl - java SunPKCS11 multiple etokens(smartcards) same time , provider not found error -

i using ssl connection x509 certificates provided smartcards. have 2 identical tokens athena . initialise keystores after reading certificates, when trying to actual connection second token getting no provider found private key.connecting using first token it's not affected, works. tried adding different sunpcks11 provider specifing slotindexlist 1 , number second token given "slots = p11.c_getslotlist(true)", still same error. when listing providers: see second provider, java doesn't use (i don't know why). provider _etpkcs11; slots = p11.c_getslotlist(true); if(slot ==0) { string pkcs11config = "name=athena\nlibrary=c:\windows\system32\asepkcs.dll"; byte[] pkcs11configbytes =pkcs11config.getbytes(); bytearrayinputstream configstream = new bytearrayinputstream(pkcs11configbytes); etpkcs11 = new sunpkcs11(configstream); security.addprovider(etpkcs11); } the above works following doesn't work if(slot ==1) { string pkcs11config1 = "...

mysql - Join other table to get count -

i have table contains items: items : id, body, user_id and second table constains votes: items_votes : id, item_id, type i getting items simple query: select * items how can votes count every item in query? try out this... select item.id, item.type, item.user_id, count(*) items item inner join items_votes iv on item.id = iv.item_id group item.id sql fiddle

android - Creating textview using arraylist -

Image
i have requirement show results. want know best possible way achieve it.(requirement shown in jpeg file can textview inside list adapter or textview. box decided dynamically based on condition. can 0 many(mostly 2). let me know thoughts.

Download large file on Android device -

i'm writing android-app, map application. use app, user should download offline map file. size of file 3gb... possible/good idea download such big file in app or have ask user download file on his/her pc , manualy copy file android device? if want use android download file itself, shall use download manager perform task you: public void startdownload(string url, string filename) { uri resource = uri.parse(url); downloadmanager.request request = new downloadmanager.request(resource); request.setallowednetworktypes(request.network_wifi); request.setallowedoverroaming(false); //set file type mimetypemap mimetypemap = mimetypemap.getsingleton(); string mimestring = mimetypemap.getmimetypefromextension(mimetypemap.getfileextensionfromurl(url)); request.setmimetype(mimestring); //show notification request.setshowrunningnotification(true); request.setvisibleindownloadsui(true); //set target directory ...

java - apache poi language version causes date format misinterpretation -

edit: avoid confusions, here's (again) improved version of original question: question how can read out string representation of cell way microsoft excel display it, without knowing respective hard-coding formatting-settings (but example using cell's own formatting settings format output). answer far no problem if using us-version of excel, other versions apache poi return strings equivalent how us-version of excel display , there no built-in way in apache poi change this. way can confirm "working" - gagravarr suggested - switch language on mac us/en. apache poi , excel deliver same result. kind of inverse solution. the problem is: cell displayed 01.12.13 in german version of excel, since it's formatted date hssfcell cell = (hssfcell) celliter.next(); hssfdataformatter formatter=new hssfdataformatter(); string val=formatter.formatcellvalue(cell) gives me val of 21/01/13 . the original question was: i having xlsx file containing date fields d...

android - Draw auto adjustable text infront of bitmap -

Image
i want draw text in front of marker image.but text going out of boundary of image.can auto adjust text? if yes please give me example pragmatically. using following code draw text. paint.settextsize((int) (11 * scale)); // text shadow paint.setshadowlayer(1f, 0f, 1f, color.white); // draw text canvas center rect bounds = new rect(); paint.settextalign(align.center); paint.gettextbounds(gtext, 0, gtext.length(), bounds); int x=20; int y=15; canvas.drawtext(gtext, x * scale, y * scale, paint); it show following output how can adjust text? private textpaint mtp; private string mtext; private final static float text_size = 30; private void drawingsettings() { mtp = new textpaint(paint.anti_alias_flag); mtp.setstyle(paint.style.fill); mtp.setcolor(0xffcccccc); mtp.settextsize(text_height); mtext = "some text" } @override public void ondraw(canvas canvas) { int bmpwidth = mbitmap.getwidth(); int textwidth =...

android - Fast tap on TextView clearing random portion of my Custom View -

i using 1 40 miliseconds timer , plotting graph speed. (in each 40 milisecsnds of ondraw() call , plotting 5 points). on layout same time when taping on 1 textview, clearing random portion of custom view. so question is related cache drawing. ? i tried setdrawingcacheenabled(true); not working. any idea ? this ondraw() @override public void ondraw(canvas canvas) { super.ondraw(canvas); //setdrawingcacheenabled(true); //canvas.drawbitmap(bbitmap,0,0,null); drawstuff(canvas); } my cache memory size 256k , screen resulotion 800x480

unit testing - mocking creation of an array with powermock java -

i write test following function in java.i want mocking creation of array. public file[] myfunc() { file[] array = new file[2]; return array; } i have wrote following test using powermock java: @test public void test1() { file f1 = createmock(file.class); file[] files = new file[]{f1}; expectnew(file[].class).andreturn(farray); replayall(); file[] res = myclass.myfunc(); verifyall(); assertequals(f1, res[0]); } it throws exception following message: org.powermock.reflect.exceptions.constructornotfoundexception: no constructor found in class java.io.file parameter types:<none> the exception says it: attempt create file instance without specifying constructor arguments there no constructor without parameters class java.io.file. stack trace of exception tell code location of attempt. guess, file f1 = createmock(file.class); . check powermock documentation alternatives.

how can i change dynamically with php the width of a html div? -

in website have faq page users can add questions , images <div class="faq container"> <div class="content">text text text</div> <div class="pic"><img></div> </div> if user adds text question div .class should 100% width if user adds text , img 2 divs should 50% each, next each other, how can it? i'm going assume using database mysql. i'm going assume your database query returns following fields question , answer , _image_path_. php $faq_html = '<div class="faq %s"><div class="content">q: %s<br>a: %s</div>%s</div>'; while ( $row = $result->fetch_object() ) : $container_class = 'no-image'; $faq_img_html = ''; if ( ! empty( $row->image_path ) ) : $container_class = 'has-image'; $faq_img_html = sprintf( '<div class="pic"><img src="...

fonts - Croatian letters in Java Program -

i need on croatian letters in program. on website (play framework) can put in names. name saved , pdf file created (with itext) string user typed in shown. want use font lucida bright. problem there non-german letters in names not shown. tried convert unicode (/u----) doesn't work. tried use utf-8 in itext doc: string name = new string(e.getname().getbytes("utf-8")); // e object name , other infos saved and in html user can type in name <meta name="language" content="cr"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> but doesn't work completely. in lucida bright (font) Š , š correctly shown , in times new roman Š, Ž, š , ž. how can solve problem? if want use font in itext's pdf generation have add it as in font font = fontfactory.getfont("times-roman"); document.add(new paragraph("times-roman", font)); for more information see itext

mesh - Fast volume representation, modification and polygonisation -

i looking ideas algorithms , data structures representing volumetric objects. working on sculpting system, sculptrix or mudbox, , want find implementation strategy. i have nice dynamic halfedge mesh system collapse/subdivide faces. works , incredibly fast, since surface algorithm, not easy robustly change topology. so want go drawingboard , implement proper volumetric system. first idea kind of octtree representation volume , marching cubes polygonise it. however, have few problems this. first, marching cubes produces small or thin triangles, highly undesirable (reason why later). second, want polygonise volume in area of editing, , @ different levels of detail. example, may want low res sphere, few tiny high res bumps. can kind of subdivision behaviour current surface based sustem, can't envision how robustly marching cubes. another problem actual trianglular mesh further subdivided on gpu smooth surfaces, need neighbourhood information too. again, have current half-ed...

Invalid syntax on ".perform()" with Python -

i trying download zip file ubuntu 10.04 workstation , limit transmit limit 100 kb/s. when running script following: file "./iso.py", line 7 iso.perform() ^ syntaxerror: invalid syntax here code using. not sure actual syntax error is. have searched google while before asking here. appreciated. #!/usr/bin/env python import pycurl iso = pycurl.curl() iso.setopt(iso.url, "http://downloads.sourceforge.net/sevenzip/7za920.zip") iso.setopt(iso.max_recv_speed_large, 100000) iso.setopt(iso.writedata, file("7za920.zip") iso.perform() fyi running python version 2.6.5 you forgot parenthesis after previous line. change: iso.setopt(iso.writedata, file("7za920.zip") to: iso.setopt(iso.writedata, file("7za920.zip")) python interpretting if continuing add function (eg, add more parameters). there's syntaxerror because there's no comma.

How to convert DriveInfo[] to List<string> C# -

hi want convert driveinfo type list string type list using loop.in code trying use tolist() it's not exist. want paths of logical drives in string list without using loop. know manually it's possible use loop want direct function. thank. here's code driveinfo[] drive_info = driveinfo.getdrives(); list<string> list = drive_info.tolist<string>(); try code: driveinfo[] drive_info = driveinfo.getdrives(); list<string> list = drive_info.select(x => x.rootdirectory.fullname).tolist(); if i'm not wrong takes path drives. using select can make new ienumerable property choose. using tolist() convert list.

AngularJS model bound with two fields -

i have object following: myobj{ groups:[{name:"test1": xdata:"[1,2,3]" }, {name:"test2": xdata:"[5,6,7]" }] } i have represent these values in 2 different views on same page. first view renders xdata , ydata in textareas, uses splitarray directive display values 1,2,3 1 value @ each line in text area. <textarea split-array="" ng-model="group.xdata" > </textarea> second view shows these values in textboxes. xdata split 3 textboxes following <input type="text" ng-model="group.xdata[0]" > <input type="text" ng-model="group.xdata[1]" > following splitarray directive mymodule.directive('splitarray', function() { return { restrict: 'a', require: 'ngmodel', link: function(scope, element, attr, ngmodel) { function fromuser(text) { return text.split("\n...

Create a Horizontal dotted line in android layout -

in layout trying draw dotted line.for drawing horizontal line defining view in layout file. <view android:layout_width="fill_parent" android:layout_height="1dip" android:background="@drawable/customdots" /> and customdots.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:left="10dp" android:right="10dp" android:width="4dp" android:drawable="@drawable/dotted" /> </layer-list> dotted.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <size android:height="4dp" android:width="1024dp"/> <stroke android:width="4dp" android:dashwid...

jquery - IE 10 wont reload my directory proper after uploading file with PHP -

i having headaching trouble ie 10. (who doesn't) i have upload function, user can upload files (pdf's) admin part of website. after upload completed use jquery show contents of dir through jquery.post action, in effect reloading dir contents , printing them screen. i other browsers (tested opera, chrome, firefox) works out fine. in ie10 contents of directory printed screen seems cached version. using ftp program can verify file uploaded ie10, won't read updated contents. have restart ie10 browser in order reload proper. any ideas on how force ie10 read contents scratch or maybe solution? code reload <table> <?php $dir_handle = opendir("../../images/certificates"); while (($entry = readdir($dir_handle)) !== false){ // show pdf's $filetest = preg_match('/(.pdf|.pdf)$/',$entry); if ($filetest){ echo "<tr>"; echo "<td rel='{$entry}'><img class='pdfdownloadicon imageicon' s...

Hot Deployment with WSO2 ESB -

can hot deployment in wso2 esb. example want add new service / new route without restarting esb minimize service interruption. if possible can give example. if not possible can know if in future releases. hot deployment/hot update may take system inconsistent states if updates not coordinated. therefore recommended turn hot deployment , hot update off production deployments. more details here

php - Countdown timer changed with local time -

i have game site, in need display timer until match time. once timer reaches limit, need load games. for this, have used jquery countdown . working fine in general. my problem is, while timer running if user changes system time(local time), remaining time limit changed , game started. how prevent countdown timer local time? please me fix problem. my code, $('#gamewindow').countdown({ until : 100, layout:'{mn} : {s<}{snn} {s>}', onexpiry: function () { $('#gamewindow').load('game.php'); }, }); }); <div id="gamewindow"></div> instead of initializing timer via plain javascript (which return client-time , i.e., time on client's computer), should instead rely on server-time , i.e., time on server. standardize timing players. so, upon visiting countdown page, javascript counter initialized server's time. use ajax or hack-y php this...

json - Ignore Null Value Fields From Rest API Response Java -

in project when send rest response advance rest client shows fields have values , ignores(does not show) fields have null values or empty values. part of code: gson gson=new gson(); // firstresponse object contains values string jsonstring = gson.tojson(firstresponse); test.savejson(jsonstring); //or system.out.println(jsonstring); return response.ok(firstresponse).build(); // response rest client response sample return response.ok(firstresponse).build(); advance rest client web project : { "name": "smith", "properties": { "propertylist": [ { "id": "072", "number": "415151", "address": "somewhere" }, { "id": "151", "number": "a800cc79-99d1-42f1-aeb4-808087b12c9b", "address": "ninink" }, { "id": ...

java - Hi.while developing OCR application in Android i'm getting Error as "Unfortunately OCR test has stopped" in Android emulator -

i've been developing ocr application in android.while running app in emulator i'm getting error "unfortunately ocr test has stopped".so can 1 plz me resolve error...thanks in advance.... the logcat: 08-26 14:24:45.128: d/dalvikvm(548): not late-enabling checkjni (already on) 08-26 14:24:47.988: d/languagecodehelper(548): getocrlanguagename: eng->english 08-26 14:24:48.008: d/languagecodehelper(548): gettranslationlanguagename: es->spanish 08-26 14:24:48.219: d/dalvikvm(548): gc_concurrent freed 261k, 6% free 6680k/7047k, paused 8ms+7ms 08-26 14:24:48.319: w/dalvikvm(548): exception ljava/lang/unsatisfiedlinkerror; thrown while initializing lcom/googlecode/tesseract/android/tessbaseapi; 08-26 14:24:48.319: d/androidruntime(548): shutting down vm 08-26 14:24:48.319: w/dalvikvm(548): threadid=1: thread exiting uncaught exception (group=0x409c01f8) 08-26 14:24:48.369: e/androidruntime(548): fatal exception: main 08-26 14:24:48.369: e/androidruntime(548): ja...

php - MySql PDO access denied when passing pdo object to another class -

i have 2 linux vms below configuration: vm 1: os: redhat enterprise linux 5.4 apache: 2.2.23 php: 5.5.3 mysql: 5.5.28 php config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/apache2/php' '--with-config-file-path=/usr/local/apache2/php' '--disable-cgi' '--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3' '--enable-sqlite-utf8' '--with-mysql=/usr/local/mysql/' '--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--enable-calendar' '--with-curl=/usr/lib' '--with-gd' '--with-jpeg-dir=/usr/lib/libjpeg.so' '--with-png-dir=/usr/lib/libpng.so' '--enable-soap' '--enable-bcmath' vm 2: os: redhat enterprise linux 6.4 apache: 2.4.6 php: 5.3.27 mysql: 5.6.13 php config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/apache2/php' ...

Read XML file using JavaScript in Chrome -

i need load , read xml file using javascript. the following code works fine in firefox, ie , opera: function loadxmldoc(dname) { var xmldoc // internet explorer try { xmldoc = new activexobject('microsoft.xmldom') } catch (e) { // firefox, opera, etc. try { xmldoc = document.implementation.createdocument('', '', null) } catch (e) { alert(e.message) } } try { xmldoc.async = false xmldoc.load(dname) return xmldoc } catch (e) { alert(e.message) } return null } but executing code in chrome gives me error: object# has no method "load" legacy code document.implementation.createdocument not work on chrome , safari. use xmlhttprequest instead when possible: function loadxmlsync(url) { try { // prefer xmlhttprequest when available var xhr = new xmlhttprequest() xhr.open('get', url, false) xhr.setrequestheader('content-type...

ios - implement Iad tutorial -

i include in app iad, not know how do, simple thing http://eureka.ykyuen.info/2010/07/22/iphone-create-an-iad-application/ or http://denmsg.altervista.org/foto.png can me? please have @ tutorial ray wenderlich. should give enough information build iphone and/or ipad applications. ray wenderlich tutorial

ruby - Rails Non tabular settings -

what best practice storing non-tabular settings (configured end-user) application? i know possible creating model , using it, creating one-row-table in database seems little wasteful me. convert data yaml, , write configuration file. require "yaml" file.write(path_to_configuration_file, yaml.dump(obj)) # write obj = yaml.load_file(path_to_configuration_file) # read

ssl - Node.js throws an error when connecting to a server (WSS) -

i use ssl error: unable_to_verify_leaf_signature nodejs version: 0.10.2 ws module: websocket-node (last ver) on version 0.8.22 works well. update: events.js:72 throw er; // unhandled 'error' event ^ error: unable_to_verify_leaf_signature @ securepair. (tls.js:1283:32) @ securepair.eventemitter.emit (events.js:92:17) @ securepair.maybeinitfinished (tls.js:896:10) @ cleartextstream.read [as _read] (tls.js:430:15) @ cleartextstream.readable.read (_stream_readable.js:294:10) @ encryptedstream.write [as _write] (tls.js:344:25) @ dowrite (_stream_writable.js:211:10) @ writeorbuffer (_stream_writable.js:201:5) @ encryptedstream.writable.write (_stream_writable.js:172:11) @ write (_stream_readable.js:547:24)

java - wrong arguments are passed to .ksh -

the arguments not being passed expected when try execute following .ksh file. processlauncher.ksh: /usr/java/jdk1.7.0_25/bin/java -xmx256m $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 this code execute invoke above .ksh file: callingclass: public static void main(string[] args) { string[] cmdline = {}; cmdline = new string[]{"ksh", "../scripts/processlauncher.ksh", com.mypackage.calledclass.class.getname(), "simpledf", "1099"}; } and code executed after calling .ksh file: calledclass: public static void main(string[] args) { system.out.println("arguments passed: " + arrays.tostring(args)); if (args.length != 2) { system.out.println("invalid arguments"); system.exit(0); } } expected result after executing callingclass#main() method: arguments passed: simpledf 1099 actual result after executing callingclass#main() method: arguments passed: simpledf 1099 com...

ios - In UITextView, how to get the point that next input will begin another line -

i'm using uitextview in ios, , moment/point next input text begin new line. how can this? -----editted------- ----after long time research, found below ok, seems little complicated. //limit text within text box nsstring *originalstr = textview.text; textview.text = [textview.text stringbyappendingstring:text]; cgfloat lineheight = textview.font.lineheight; int currentlines = textview.contentsize.height / lineheight; int maxlines = textview.frame.size.height/lineheight; if (currentlines > maxlines) { nsstring * firsthalfstring = [originalstr substringtoindex:range.location]; nsstring * secondhalfstring = [originalstr substringfromindex: range.location]; textview.text = [nsstring stringwithformat: @"%@%@%@", firsthalfstring, text, secondhalfstring]; int timeout = 0; while (true) { timeout =50; textview.text = [textview.text substringtoindex:(textview.text.length...

zk - Why bindings do not work? -

<textbox id="nexttitletextbox" readonly="true" value="@bind(ivm.inventory.successortitlename)" /> <button id="nexttitlebutton" label="..." mold="trendy" onclick="@command('chooseformerorsuccessor', isformer = false)"/> <a id="nexttitlehrefview" href="/inventory_new.do?method=edit&amp;docuid=${ivm.inventory.successortitlename}">view</a> <a id="nexttitlehrefhistory" href="javascript:showrenaminghistory(${ivm.inventory.successortitlename},${ivm.inventory.successortitlename})">history</a> the problem in 'a' tags. textbox , buttons works fine, links in 'a' tags not catch information binding, link there looks /inventory_new.do?method=edit&amp;docuid= . don't understand what's wrong here, because tried lot of combination , similar working on other pages. mistake in binding? i tried put...

Cannot edit the data in a cell of a datagridview in c# -

i have problems datagridview in c#. editmode property of editonkeystrokeorf2 , readonly property false. , datasourse of binded list. double clicked on 1 cell(for example, data 40), edit it(change 60). if press enter, data of cell not updated, still 40. i'm wondering reason. tried cellendedit event, , added breakpoint here. private void datagridview_cellendedit(object sender, datagridviewcelleventargs e) { datagridview.refreshedit(); if (e.columnindex==0) { double key = convert.todouble(datagridview.rows[e.rowindex].cells[0].value); } } then run program, double click on cell in first column, changed it, pressed enter. , came breakpoint, , data got still old one. knows reason? how can edit clicking on it? lot help!

java - Java3D, How to alter the View Platform clip distance? -

i'm working using java3d, , i've been manipulating viewplatform can 'zoom' in , out of model fine. however, @ point when close (or far away) model clipped question how return (get) values these alter (set) them suit needs? javax.media.j3d.view.setbackclipdistance(double distance) javax.media.j3d.view.setfrontclipdistance(double distance)

asp.net - Multiple Application Pools running as Network Service -

i have 4 different application pools, each 1 different web site, running network service . is normal configuration have? can cause problems between different applications? if you've configured each site's anonymous authentication use "application pool identity" requests run network service account. if isn't shared server, i.e. you're not allowing customers or users upload content or deploy asp.net applications, , , team sole deployers/mamagers isn't terrible thing do. that said, if 1 site becomes compromised possible attackers compromise other sites. if network service account has read access attack limited data theft, otherwise they'll able more damage. unless have reason to, idea configure application pools run application pool identity . iis synthesise account when application pool running. should configure public facing www folders give appropriate permissions account known iis apppool\[pool_name] [pool_name] name of ap...

java - Unindent or linearize XML -

i'm looking fast way linearize xml in java i'm using ~2gb file dom excluded. java targhet 1.5.0.22 have generate xml file composed of 80bytes + newline read file byte byte(i must) can use internal temp bufferization store sequence ignore example 5 bytes af ascii file <a><b><c>psofpisogiosigpsfiogpo</c></b></a> <a><b ><c>p sofpi sogio sigps fiogp o</c> </b>< /a> problem file <a> <b> <c>psofpisogiosigpsfiogpo</c> </b> </a> <a> <b > <c>ps ofpis ogios igpsf iogpo </c> < /b> </ a> if can linearize file same output if file indented or not any idea? private static final string xml_linarization_regex = "(>|&gt;){1,1}(\\t)*(\\n|\\r)+(\\s)*(<|&lt;){1,1}"; private static final string xml_linarization_replacement = "$1$5"; public static string linar...

html - How to align text input with sorting button inside <td>? -

i'm having bad time trying align clickable element on right of text <input> element. wouldn't problem if have fixed dimensions, <input> inside of container variable size. resizing made js function. need place clickable element on far right, inside <td> and, remaining space filled 100% <input> . @ moment i'm totally confused , cannot come clean solution doesn't involve nested tables inside table cell. at moment, clickable <a> tag, i'm not sure if that's best approach. need clear advice right now. here basic code: <html> <head> <style type="text/css"> table{border-collapse:collapse;} td{ border: 1px solid black; padding: 2px; } .container{ width: 100px;/*this dinamically resized js*/ } input[type="text"]{ width: 100%; } ...

ios - Cocos2D - Make sprite smoothly follow & rotate to touch -

i'm trying make sprite smoothly follow & rotate according touch on screen. player not forced touch on sprite make move, can control 1 sprite @ time. wherever touch on screen, player must follow movement. here's have far : in gamescene.m : - (bool) cctouchbegan:(uitouch *)touch withevent:(uievent *)event { cgpoint location = [touch locationinview:[touch view]]; location = [[ccdirector shareddirector] converttogl:location]; lasttouchlocation = location; return yes; } - (void) cctouchmoved:(uitouch *)touch withevent:(uievent *)event { cgpoint location = [touch locationinview:[touch view]]; location = [[ccdirector shareddirector] converttogl:location]; //moveby determine translate vector cgpoint moveby = ccpsub(lasttouchlocation, location); [player moveby:moveby]; lasttouchlocation = location; } and here's player.m : - (float) calculateanglefornextpoint:(cgpoint) point { cgpoint nextpoint = point; cgpoint po...

html5 - iOS 7 mobile Safari no longer supports <input type="datetime"/> -

i have rather large ipad application built using phonegap , doing testing make sure going work appropriately in ios 7. significant issue have found <input type="datetime"/> no longer supported. i have seen several posted suggesting need have 2 separate fields date , time. huge change because using on application. hoping broken in beta release of ios 7 since html 5 standard input type can't seem find information. any or thoughts appreciated. support datetime has been removed, can use datetime-local instead. hear (can't whom) it's here stay.

css - Make display: table-cell elements stack on top of each other? -

i'm building tumblr template. in tumblr, there variable called {content} , may contain 1 or more <p> -tags <p>foo</p> <p>bar</p> i'm trying center content vertically inside div, regardless of size of text or number of paragraphs. i used display: table-cell techinque described here: http://css-tricks.com/vertically-center-multi-lined-text/ in short, add display: table; to containing object and display: table-cell; vertical-align: middle; to object want vertically center. this works great when have 1 p-tag. multiple don't flow vertically, rather horizontally. there can this? sample: http://jsfiddle.net/dbpf2/1/ i think need containing object around <p> tags set display:table-cell, rather setting display:table-cell <p> tags themselves. <div class="content"> <div class="inner"> <p>foo</p> <p>bar</p> </div> </div...

sql server - SQL between clause returns rows for values outside bounds -

as title says when use sql between clause running against address range low high , putting in number outside of 2 , getting rows returned me. , know why. http://www.sqlfiddle.com/#!6/49467/2 quick hit on query, using address number of 4929 , getting rows returned me address range low , high numbers 400 , 498 respectively. here query: select zipcodelow , zipcodehigh , zipextensionlow , endingeffectivedate , beginningeffectivedate , addressrangelow , addressrangehigh , streetname , city , zipcode , zip4, zip4high boundtable ('68503' between zipcodelow , zipcodehigh) , ('4929' between [addressrangelow] , [addressrangehigh]) , ([streetname] = '32nd') , (getdate() between [beginningeffectivedate] , [endingeffectivedate]) convert 4929 numeric first , run query: select zipcodelow , zipcodehigh , zipextensionlow , endingeffectivedate , beginningeffectivedate , addressrangelow , addressrangehigh , streetname , city , ...

c++ - 12 Days Of Christmas C Program -

so tried coding 12 days of christmas myself. i'm not yet done though lyrics, i'm still trying figure out. don't understand why "1st day" of christmas gets doubled , partnered different gift , on 12th day, no gift showing up. checked on switch case , seem right guess. , possible lessen code print out complete lyrics? #include <stdio.h> #include <conio.h> int main() // main function { int days, counter, num; //int counter = 1; printf("\t\t***twelve days of christmas***\n"); printf("\t\t______________________________\n\n\n"); (counter=0; counter<=12; counter++) { // counter++; switch(counter) { case 1: printf("\t\ta partridge in pear tree\n");break; // day 12 case 2: printf("\t\ttwo turtle doves\n"); break; case 3: printf("\t\tthree french hens\n"); break; case 4: printf("\t\tfour calling b...

javascript - AngularJS does not send hidden field value -

for specific use case have submit single form "old way". means, use form action="". response streamed, not reloading page. aware typical angularjs app not submit form way, far have no other choice. that said, tried populate hidden fields angular: <input type="hidden" name="somedata" ng-model="data" /> {{data}} please note, correct value in data shown. the form looks standard form: <form id="aaa" name="aaa" action="/reports/aaa.html" method="post"> ... <input type="submit" value="export" /> </form> if hit submit, no value sent server. if change input field type "text" works expected. assumption hidden field not populated, while text field shown due two-way-binding. any ideas how can submit hidden field populated angularjs? you cannot use double binding hidden field. solution use brackets : <input type="hidden...

html - Float replacement for email in outlook -

Image
this follow question this question . i writing two-column email , have been advised use float:left on td's widths appropriate email. however, don't think float supported in outlook , right column being pushed outside bounds of entire table. here screenshot of how email renders in outlook: code can found here . floating td strange thing do. haven't tried, guess versions of ie won't (therefore, concern, versions of outlook might show same behaviour, or not, depending on version , order of installation of ms office , ie). floating elements email clients bad idea well, since hotmail/outlook.com, , versions of outlook desktop not support float property. see: http://www.campaignmonitor.com/css/ edit: has nothing floating or aligning. have 6 rows in table, , second one, has 2 columns, rest have 1 column. have have same amount of columns per table, can use colspan attribute on 5 of other tr in order table account tr has 2 td , <tr colspan=...

android - Change color font only in part of textview -

i want change part of textview color.. i've tried in way nothing change textview textview = (textview)findviewbyid(r.id.temperature); textview.settext("temperature: "+ "<small> <font color='#59c3fa'>" + temperature + "°c</font></small>"); so first part "temperature: " has have textview color (black in case), , rest of part #59c3fa . how wrong? please use html class this. textview.settext(html.fromhtml("temperature: "+ "<small> <font color='#59c3fa'>" + temperature + "°c</font></small>"));

sql server - SQLite INSTEAD OF TRIGGER -

i want convert microsoft sql server trigger alter trigger [dbo].[trg_eliminoitems] on [dbo].[pedidosencabezado] instead of delete begin set nocount on; insert histpedidosencabezado select * pedidosencabezado pedidosid in ( select pedidosid deleted ) insert histpedidositems select * pedidositems pedidosid in ( select pedidosid deleted ) delete pedidositems pedidosid in ( select pedidosid deleted ) delete pedidosencabezado pedidosid in ( select pedidosid deleted ) end into sqlite. sqlite not allow instead of triggers on tables, going delete records anyway: create trigger trg_eliminoitems before delete on pedidosencabezado each row begin insert histpedidosencabezado select * pedidosencabezado pedidosid = old.pedidosid; insert histpedidositems select * pedidositems pedidosid = old.pedidosid; delete pedidositems pedidosid = old.pedidosid; end;

.net - How do I identify my own parts in an MEF catalogue? -

following article create composite modular ui application in wpf using mef , prism, have wpf application instructed, , view injected region on main window works fine. however, module project exports mef parts, have set output directory parts repository directory somewhere. when build solution, modulea.dll gets placed in directory, it's dependencies. i use directorycatalog on parts repo directory, , contains 26 parts, 1 of mine. extract list of parts mine directory, not using raw reflection myself, e.g. not examining assemblies , building assemblycatalog . there way can call parts on directory, , examine exports see mine? if browse catalogue, can see part, can't see properties can examine grammatically. if want load things single specific assembly, kinda goes against whole point of mef... if that's want, reference assembly directly. if want things mef way, app shouldn't concerned what's in catalog - should "import" interface needs , let f...

java - Questions about casting -

i trying make game auth system in java. when trying run it, can see exception thrown in console log there no error in project. know runtime error the console log displays following information: exception in thread "main" java.lang.classcastexception: com.google.gson.internal.linkedtreemap cannot cast auth$profile @ auth.<init>(auth.java:30) here code: public auth(file profilesfile) { try { profilesjson e = (profilesjson)this.gson.fromjson(new filereader(profilesfile), profilesjson.class); map ps = e.authenticationdatabase; iterator var5 = ps.keyset().iterator(); while(var5.hasnext()) { string name = (string)var5.next(); profile p = (profile)ps.get(name); if(p != null) { if(p.displayname == null || p.displayname.length() == 0) { p.displayname = p.username; ...

Rails display two modals from same view -

i have rails view 2 icons. each icon should open different modal (using partial). the issue both icons opening same modal (the first one). here code display modals: <a data-toggle="modal" href="#workorder-<%= workorder.id %>"> <i class="icon-list"></i><%= workorder.wologs.count %> <%= render :partial => "wologs/history", locals: {workorder: workorder} %> </a> <a data-toggle="modal" href="#workorder-<%= workorder.id %>"> <i class="icon-ok-sign"></i><%= workorder.tasks.count %></a> <%= render :partial => "tasks/taskslist", locals: {workorder: workorder} %> </a> thanks help! as mryoshiji mentioned reason 2 links point same id, same modal launched. i add it's incorrect put modal body inside link, if partial modal body. according bootstrap example: <a href="#mymodal...