Posts

Showing posts from March, 2015

C - Adding the numbers in 2 strings together if a different length -

if had 2 strings: a = "1234" b = "4321" i add 2 numbers this: for(i=0; i<width-1; i++){ sum = (a[width-2-i]-48) + (b[width-2-i]-48) + carry; carry = 0; if(sum > 9){ carry = 1; sum-=10; } answer[i] = sum+48; } if(carry) answer[i++] = carry+48; answer[i]= 0; and reverse (width equal strlen(a)). how same thing if following? a = "12345" b = "4321" would need reallocate memory? or what? (btw - the problem i'm trying solve using many numbers 50 digits, strtoul or strtoull out of question understand. here's code far .) int getcharval(const char *s, int idx) { if (idx < strlen(s)) return s[strlen(s) - idx - 1] - 48; return 0; } void add() { const char *a = "1234"; const char *b = "13210"; char answer[256]; int i, wa=strlen(a), wb=strlen(b), width, sum, carry; width = wa > wb ? wa : wb; for(i=0; i<width; ...

PHP an array of arrays to one string or one BIG ARRAY -

this code opens excel files in folder gets emails in file opened , puts them in array. in end need 1 big array content array of arrays. need 1 big array of emails files. the code below not working. sure simple one. thanks <? $folder = "sjc/"; $files = scandir($folder); function cleanfolder($file) { $string = file_get_contents("sjc/$file"); $pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,3})(?:\.[a-z]{2})?/i'; preg_match_all($pattern, $string, $matches); $emails[] = $matches[0]; return $emails; } function beginclean($files) { for($i=0; count($files)>$i;$i++) { $emails = cleanfolder("$files[$i]"); $theemails .= explode(",",$emails); } /// supposed big string of emails separated comma echo $theemails; // echos .... arrayarrayarrayarrayarray etc... // want is.. 1 array holding emails, not array of arrays. } beginclean($files); ?> update: got tot work.. having memory issue ...

grand central dispatch - iOS SetNeedsLayout on thread -

good day, i have complex calendar control needs redrawn using setneedslayout everytime select date item etc. tried run in gcd block, never ran. however, when run on main thread setneedslayout runs , works. however, causes annoying stutter/lag in program destroys user experience. can know can done? can executed on thread? can use nstimer or perform selector on thread? dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); dispatch_async(queue, ^{ dispatch_async(dispatch_get_main_queue(), ^{ //[[uiapplication sharedapplication] setnetworkactivityindicatorvisible:yes]; }); @try { nslog(@"new thread"); if (self.selecteddate) { [datestoreload addobject:self.selecteddate]; } if (date) { [datestoreload addobject:date]; } self.selecteddate = date; [self reloaddates:datestoreload]; [self performselectoronmainthread:@selector(reloa...

Twitter Integration for IOS 4.3 -

it's integrate twitter in ios 5 (twitter.framework) , ios 6 (social.framework). what ios 4.3? what have tried: 1) tried sharekit , it's not working properly, it's hard install, , lot of xcode errors , files not found error after installation. 2) tried detweetcomposeviewcontroller + unoffcial-twitter-sdk , many errors, 1 of them oauth+userdefaults.h not found. what's best way ios 4.3 ? thanks hi can use "mgtwitter engine" ios 4.3 you form following link https://github.com/mattgemmell/mgtwitterengine i hope may you.

html - _GET method php -

i making texteditor website fun me , got of going down. now, wondering having issue transfer of data _get method in php , won't write files if &lt; (<). has < odd reason. there easy method override when transfer it? find way, wanted know if there simple way. editor file: <html> <head> <title>web editor</title> <link href="controller.css" rel="stylesheet"/> <script type="text/javascript" src="script/editor.js"></script> </head> <body> <div class="platform"> <div class="head"><div class="file"><p>file: <div id="file">hello.html</div></p></div></div> <div class="hotbar"><img src="images/save.png" class="hotbarimage" onclick="save()" /> </div> <div class="editor"><div contenteditable="true"...

java - Error when running applet with Slick2D -

i have been trying slick application work on website awhile now, , have html code correct, know sure, getting error applet saying this: initializing real applet mon may 20 17:07:24 edt 2013 error:game.gameboard java.lang.classnotfoundexception: game.gameboard @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.class.forname0(native method) @ java.lang.class.forname(unknown source) @ org.newdawn.slick.appletgamecontainer.init(appletgamecontainer.java:123) @ org.lwjgl.util.applet.appletloader.switchapplet(appletloader.java:1330) @ org.lwjgl.util.applet.appletloader$2.run(appletloader.java:909) @ java.awt.event.invocationevent.dispatch(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.e...

c# - LEFT JOIN or RIGHT JOIN using LINQ Entity-Framework -

trying joining using linq. should use ? left join or right join? applicant table profile table applicant_id|profile_id|applicant_name| |profile_id|applicant_name 1 | null | ray heavens | | 1 | mark lapid 2 | null | ben tulfo | | 2 | super man 3 | 1 | null | | 3 | brandon knight 4 | 2 | null | | 5 | 3 | null | | desired output: applicant_id | applicant_name 1 | ray heavens 2 | ben tulfo 3 | mark lapid 4 | superman 5 | brandon knight this code in controller: var applicantlist = (from in context.profiles join app in context.applicants on a.profile_id equals app.profile_id output j in output.defaultifempty(new applicant()) select j ).take(1000).asenumerable(); ...

html - How to clip one word at the line-end, and the next word to the next line with CSS? -

what want: _________ fo|r answ|er! not: _________ | | answer! | and not: _________ fo|r answer! use width @ want break words element in question, clip narrower width using css clip . see http://jsfiddle.net/aeg3t/ . however, not see way ensure clipping not cut letter in half.

css - How to assign the content of a jquery variable to another variable -

i attempting assign content of variable variable. how do this? far have tried this: var classname = $($(this).attr("class");); $('.content').html(classname) edit: please assume end value "var classname = $($(this).attr("class"););" point1 point 1 contains: edit 2: (contains full code) <div class="content"><h1>testing hello world</h1><div class="position"> <div class="point1"> test<br> awewa<br> test <h1> test </h1> </div></div></div> <script type="text/javascript"> var point1 = '<div class="content"><h1>testing hello world</h1><div class="position"> <div class="point1"> test<br> awewa<br> test <h1> test </h1> </div></div></div>'; var classname = "broken"; $('.content [class...

multithreading - How to determine when threads are in a deadlock from Main C# -

i have read other posts tools deadlock detection , avoiding deadlock; question how find when threads in deadlock main can make main thread sleep until threads deadlocked , proceed further. i tried use threadstate.waitsleepjoin detect whether threads deadlocked longer period of time in main, doesn't seem working; there utility methods available determine when threads deadlocked? i trying implement deadlock scenario in dining philosophers when threads take either right or left chopstick first, wait other chopstick forever , hence deadlock occurs; issue not able find when these threads enter waiting state ever main. this run method: public virtual void run() { while (!stop) { random random = new random(); try { outputlist.add("thinking", identity); thread.sleep(random.next(1, 100000000)); outputlist.add("hungry", identity); right.get(...

xml - How to send SOAP via HttpRequest in VB6 -

now i'm working soap in vb6 , have trouble. need send soap web server , save result xml file. here httprequest sample scraped site. for more detailed information, please see url. https://www.ftq360.net/collect/exportsvc_jrjc.asmx?op=exportjrjc i installed soap toolkit3.0 , added microsoft soap3.0 library in vb reference dialog. after googling, wrote code below , there no error. my trouble have after that! i'm @ vb don't know web service. hope quick help. everybody. as long client can use msxml-api handling http communication soap-server. here example class http-handling: option explicit private httphandler msxml2.serverxmlhttp public event onreadystatechange() public sub sendsoaprequest() dim soapdocument msxml2.domdocument 'set document 'eigther string soapdocument.loadxml "<xml......" 'or file soapdocument.load "c:\foo\soapdoc.xml" 'or assembling in code (see msxml-documentation) ...

android - Saving the checked list item continuously when after coming back to the activity and select -

hi new android & doing simple examples. exactly, i'm using 2 activities & contains list view on both. in first list view (activity1) empty, second list view(activity2) has list item checkbox. getting selected item 2nd activity & listed in first activity. it's fine want again click 'add' button 1st activity launches second activity select item & save. newly selected item not adding existing list value used in 1st activity. can me out. secondactivity.java add.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { checkedcontactlist = adapter.getselecteditemarraylist(); } intent returnintent = new intent(v.getcontext(),mainactivity.class); returnintent.putparcelablearraylistextra("result", checkedcontactlist); startactivity(returnintent); } }); in mainactivity.java private arraylist<selectedlistmodel> selectedarraylist = new arra...

php - Submit Only One of Two toggling forms -

i have 2 different forms being included in php file. visibility based on onclick js toggle function. toggle works great. if fill 1 of forms out , click respective submit button, sent same page rather action.php file have specifed in broswer: http://localhost/?user_temp=f&pass_temp1=f&pass_temp2=ff&email_temp=f&answer1=3&submitbtn=signup+now and javascript error: "typeerror undefined document.hform.ssecureuser both forms have own javascripts md5 data , ssecureuser comes signup form. interestingly, if remove 1 of inlcude forms leaving submit form lets say, work. seems these forms' javascript clashing 1 :/ ... i tried this didnt work me since each 1 of forms using java script. please , in advance!!!... let me know if see of forms, javascript, or php files... toggle code: <div> <a href="/forms/login-form.php" onclick="toggle_visibility('login-div'); return false;">login</a> <div id="lo...

php - Nginx Running Wordpress Redirecting www to non-www by mistake -

i have nginx server (1.4.1) running website in wordpress. automatically redirecting www.mysite.com mysite.com without specific rules doing so. i'd stop , keep www if entered. can please examine configuration , let me know might cause? if test on image files, redirect not occur, on php files does... server { listen 80; server_name www.mysite.com mysite.com; access_log /logs/mysite.com/access.log; error_log /logs/mysite.com/error.log crit; root /home/sites/mysite.com/; location / { index index.php; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_intercept_errors off; } } fastcgi_params: fastcgi_param query_string $query_string; fastcgi_param request_method $request_method; fastcgi_param content_type ...

How to zip and unzip png images in android -

hi in app when click zip button need zip image file , and when click unzip button need unzip file,i tried using below code zip image problem when click zip button zip file creating,but after in system using winzip software try open file not opening showing "it not appear valid archive valid file" did mistake can u let me how zip , unzip images public class mainactivity extends activity { /** called when activity first created. */ button zip,unzip; string []s=new string[2]; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); zip=(button)findviewbyid(r.id.button1); zip.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { // todo auto-generated method stub s[0]="/sdcard/saved_images/main.png"; //s[1]="/sdcard/physics_lab/stefans_law/stefan_law.txt"; // path of second file ...

bigcommerce api returning blank results -

i have downloaded bigcommerce api , created test script using time sample. blank response & no error: my test code just: <?php require 'bigcommerce.php'; use bigcommerce\api\client bigcommerce; bigcommerce::configure(array( 'store_url' => 'https://storeurl.mybigcommerce.com', 'username' => 'apiusername', 'api_key' => 'token' )); bigcommerce::setcipher(); bigcommerce::verifypeer(false); $ping = bigcommerce::gettime(); if ($ping) echo $ping->format('h:i:s'); ?> can assist why result blank ? i think cipher incorrect. please @ docs http://developer.bigcommerce.com/quickstarts/php bigcommerce::setcipher('rc4-sha')

In Java, should I escape a single quotation mark (') in String (double quoted)? -

in java, \' denotes single quotation mark (single quote) character, , \" denotes double quotation mark (double quote) character. so, string s = "i\'m human."; works well. however, string s = "i'm human." not make compile errors, either. likewise, char c = '\"'; works, char c = '"'; works. in java, better use? in html or css, things style="font-family:'arial unicode ms';" more (and such tags, think it's way use quotation marks), in java, saw people use escape characters "i\'m human." you don't need escape ' character in string (wrapped in " ), , don't have escape " character in char (wrapped in ' ).

php - Impersonate a user when I'm already impersonating another user? -

i want able impersonate user in app, followed tutorial website if try change user user "a" user "b", works, if try change user "c" while i'm impersonating user "b", attemptswitchuser method throws excepcion: you switched "b" user. 500 internal server error - logicexception this because method checks wether current user name (b) equals user name want impersonate (c) $token = $this->securitycontext->gettoken(); $originaltoken = $this->getoriginaltoken($token); if (false !== $originaltoken) { if ($token->getusername() === $request->get($this->usernameparameter)) { return $token; } else { throw new \logicexception(sprintf('you switched "%s" user.', $token->getusername())); } } but can't never case, don't know if bug in symfony's code or if there's else i'm missing. is bug? can achieve functionality without commenting out block of cod...

How to code a given jquery into a javascript? -

i new phonegap.so,using javascript first time .i working in javascript. comfortable working java script. implementing plugin sms in phone gap. in tutorial have asked use following code. window.plugins.sms.send($('#phone').val(), $('#message').val(), function () { alert('message sent successfully'); }, function (e) { alert('message failed:' + e); } ); could 1 me out in de-coding jquery code? please me out. you can use document.getelementbyid('phone').value instead of $('#phone').val() element's value without jquery.

Django raw Query aggreation function -

i need write django raw query function sum value , write csn file. write query for time in tracking_details.objects.raw('select *,sum=sum(work_time) structure_tracking_details employee_id='+ employee_id + ' group project_structure ') : writer.writerow([ time.project_structure,time.sum ]) it tells no such column: sum how write query correctly? replace sum=sum(work_time) sum(work_time) sum . btw, employee_id='+ employee_id + ' poor way of building queries. , should not it. makes query prone sql injection django doesn't check whatever query pass in raw() function. can pass parameters raw query - tracking_details.objects.raw('select *, sum(work_time) sum structure_tracking_details employee_id = %s group project_structure', [employee_id]) more details .

asp.net - The page must inherit from DelvingWare.AsyncControls.AsyncPage -

using delvingware.asynccontrols; public partial class buildcheck : system.web.ui.page { } presently ,the above code , need inherit "delvingware.asynccontrols.asyncpage" class "buildcheck" , 1.here directly writing "system.web.ui.page,delvingware.asynccontrols.asyncpage " 2. got error ,and using " delvingware.asynccontrols.asyncpage" class got other error ,i want both class inherit "buildcheck" page ...can 1 me. the error pretty clear. controls using expect base class delvingware.asynccontrols.asyncpage you cannot have 2 base classes in c#.

Error CDialog "not a class or struct" in MFC/VS2010 -

i'm new person in mfc. i have question follow: i have project, when build application, successful , application run ok however, when open file adjusthorparameterdlg (this file in project), vs2010 notice error cdialog "not class or struct" : class cadjusthorparameterdlg : public cdialog { public: cstring m_unitname; //cstring getunitname(); //void setunitname( cstring unitname ); int m_requestedcenterpoint_time; int m_seledhmagni; cadjusthorparameterdlg(cwnd* pparent = null); // 標準のコンストラクタ cadjusthorparameterdlg( cgraphsbase* pgraphs, cuintarray* magselector, cstring unitofxaxle, int initialhmagni, int initialdisppoint, cwnd* pparent = null ); ~cadjusthorparameterdlg(); //{{afx_data(cadjusthorparameterdlg) enum { idd = idd_adjhorizontalpara }; cedit m_requestedcenterpointedit; clistbox m_hmagnilistbox; int m_hmagnilistboxindex; ..... anyone tell me why? assuming code compiles su...

Map list to list of lists by index (Python) -

i'm looking efficient way map list of values, x = [1,2,3,4,5,6,7,8,9] to list, containing lists of values of same total range, example z = [[1,2,3], [4,5,6], [7,8,9]]. what need know index value x corresponds in z. x[0]=1 correspond z[0] , because falls in first bin of z, x[7]=8 correspond z[2] , because falls in third bin. how identify index of sublists of z each x value? in case, x has 50,000 values, z has 5,000 sublists, , have lots of lists, i'm looking way fast possible. you can use dict here: >>> x = [1,2,3,4,5,6,7,8,9] >>> z = [[1,2,3], [4,5,6], [7,8,9]] >>> dic = {y :i i,a in enumerate(z) y in a} >>> dic[7] 2 >>> dic[8] 2 >>> dic[1] 0

actionscript 3 - I can't play a valid RTMP stream in OSMF -

i'm building application strobe media playback in , can't play rtmp stream. the weird thing here can play stream on jwplayer , in simple flash video player classic netstream , netconnection code. http://www.longtailvideo.com/jw-player/wizard/ this stream: rtmp://fl.world-television.com/streamstudio/vod/flv:endesa/20130422/video_full_es_v2.flv i don't know if need set special configuration through osmf params. this how have been played video in simple flash cs application. package { import flash.display.sprite; import flash.events.netstatusevent; import flash.events.securityerrorevent; import flash.media.video; import flash.net.netconnection; import flash.net.netstream; import flash.events.event; public class videotest extends sprite { private var videourl:string = "rtmp://fl.world-television.com/streamstudio/vod/flv:endesa/20130422/video_full_es_v2.flv"; private var connection:netconnection; ...

c++ - Exception safety of std::function -

i tried without success find if code throw exception : std::function<void(void)>f=[]{}; according standard, copy or move constructor of std::function not noexcept. guess lack of noexcept keyword due fact std::function wrap user defined functor object copy or move constructors throw. in case exception seems unlikely possible @ ? in case exception seems unlikely possible @ ? in principle, yes. std::function have allocate memory store callable object it's initialised with, , if memory allocated dynamically there's possibility of failure. in practice, in case, no. in words of note in specification, "implementations encouraged avoid use of dynamically allocated memory small callable objects". lambda no captures convertible function pointer, small callable object gets; implementation should store without dynamic allocation. , of course, copying pointer can't throw either. larger objects (including lambdas many captures) need dynamic a...

dicom - Plotting the Graph against ECG Modality -

ecg i have no previous experience in plotting graph. want plot ecg graph w.r.to waveform sequence how can achieve , below points need ask.... 1)i want draw ecg ecg modality. 2)for how draw graph , type of co-ordinate need consider. 3)which dicom tags helpful draw graph w.r.to point draw (5400, 0100) waveform sequence 1) "5.6.3-9-1", // "i" 2) "5.6.3-9-2", // "ii", 3) "5.6.3-9-61", // "iii", 4) "5.6.3-9-62", // "avr", 5) "5.6.3-9-63", // "avl", 6) "5.6.3-9-64", // "avf", 7) "5.6.3-9-3", // "v1", 8) "5.6.3-9-4", // "v2", 9) "5.6.3-9-5", // "v3", 10) "5.6.3-9-6", // "v4", 11) "5.6.3-9-7", // ...

regex - Is there any efficient Java solution/Algorithm to find values in a text field based on key string with delimiter? -

is there efficient java solution/algorithm find values in text field based on key string delimiter? example: rules: i. key: username start-delimiter: ; end-delimiter: ; need find value if followed key( in case username ) , value between start , end delimiters(in case ;). ii. key: on start-delimiter: ; end-delimiter: ; sample input: a user username ;suren; logged system on ;thu may 2, 2013 2:30pm; results: i. username - suren ii. on - thu may 2, 2013 2:30pm here example of have tried far: string key = "username "; string startdelimiter = ";"; string enddelimiter = ";"; string computedpattern = "(\\w+)" + key + startdelimiter + "(\\w+)" + enddelimiter; pattern p = pattern.compile(computedpattern); matcher m = p.matcher( "a user username ;suren; logged system on ;thu may 2, 2013 2:30pm;"); while( m.find() ) { system.out.println( "key:" + m.group(1) + "value:" + m.group(2) ); } ...

oracle - Execute Immediate : Encountered the symbol -

i getting error ora-06550 pls-00103 encountered symbol "version"... can 1 me rectify problem? appreciated! declare sql_stmnt varchar(200); lsparameter varchar(50); lsparameterdata varchar(20); begin sql_stmnt := 'select parameter, parameter_data lsparameter, lsparameterdata mytable parameter = 'version''; execute immediate sql_stmnt; end; i know setting parameter "version" in clause. want retrieve parameter , parameter_data mytable check version , continue rest of function. thanks in advance. you need escape character ' sql_stmnt := 'select parameter, parameter_data lsparameter, lsparameterdata mytable parameter = ''version'''; and missing after execute immediate.

mysql - sqlyog export query result as csv -

Image
i'm using sqlyog , wonder if possible export query result csv? mean let's have query select * wp_comments comment_post_id = 902 , rows export csv. found it! right click on result table , use export! in order make clear can see screenshot.

WordPress - add Database driven tables -

i'm trying move 1 of old php sites wordpress. part of site have 'top tables' e.g. top 10 cars, listing features etc. @ moment comes database , html generated data. if car gets hybrid engine check in database , web site table updates reflect that. this works fine. don't know start when trying implement in wordpress. want keep wp header, footer, nav... , put table in content area. someone recommended copying current generated html in new post , editing html when changes, sounds quick solution there must better way of doing this. ideally want keep current data input pages (and separate database) of 'table data' , present out put post. if can point me in right direction (key words should search for, guide) great. depending on usecase, you'll want use static page template: http://codex.wordpress.org/page_templates or shortcodes: http://codex.wordpress.org/shortcode_api

android - Postgresql Connection with Database in Java fail -

i try connect android app postgresql server running on windows 7. both running on computer special ip. try string url = "jdbc:postgresql://xx.xx.xx.xx:5432/postgis20"; connect = drivermanager.getconnection(url,"postgres","xxxx"); the app running in simulator on pc. connect contains after procedure null , exceiption the connection attempt failed. wrong connection? if try connect via sql shell working fine , use same parameter. ssl set no. i tried use instead of ip localhost or 127.0.0.1 has same result. i changed permission settings allow access internet. following error: org.postgresql.util.psqlexception: unusual has occured cause driver fail. please report exception. to use jdbc on android necessary use strictmode. can done using following code lines: strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy);

merge - Merging more than 2 dataframes in R by rownames -

i gather data 4 df's , merge them rownames. looking efficient way this. simplified version of data have. df1 <- data.frame(n= sample(seq(9, 27, 0.5), 40, replace= t), p= sample(seq(0.3, 4, 0.1), 40, replace= t), c= sample(seq(400, 500, 1), 40, replace= t)) df2 <- data.frame(origin= sample(c("a", "b", "c", "d", "e"), 40, replace= t), foo1= sample(c(t, f), 40, replace= t), x= sample(seq(145600, 148300, 100), 40, replace= t), y= sample(seq(349800, 398600, 100), 40, replace= t)) df3 <- matrix(sample(seq(0, 1, 0.01), 40), 40, 100) df4 <- matrix(sample(seq(0, 1, 0.01), 40), 40, 100) rownames(df1) <- paste("p", sprintf("%02d", c(1:40)), sep= "") rownames(df2) <- rowna...

symfony - Error when calling Rabbitmq consumer from command line -

i trying setup simple amqp publisher/consumer using symfony2.2 rabbitmq bundle , following documentation on bundle page the publisher works fine, can see messages on web manager of rabbitmq. when try run consumer using command php app/console rabbitmq:consumer my.api i following error: call undefined method my\apibundle\service\consumerservice::setroutingkey() in /***/vendor/oldsound/rabbitmq-bundle/oldsound/rabbitmqbundle/command/baseconsumercommand.php on line 91 my setup: confi.yml old_sound_rabbit_mq: connections: my.api: host: %amqp_host% port: %amqp_port% user: %amqp_user% password: %amqp_password% vhost: %amqp_vhost% producers: my.api: connection: my.api exchange_options: {name: 'my.api', type: fanout} consumers: my.api: connection: my.api exchange_options: {name: 'my.api', type: fanout} queu...

netbeans 6.9 - generate pdf in ruby on rails using wicked_pdf -

i have installed wicked_pdf gem , wkhtmltopdf when try generate pdf gettin error failed execute: "e:/nupur/wkhtmltopdf/wkhtmltopdf.exe" -q "file:///c:/users/wish7/appdata/local/temp/wicked_pdf.608.3884.html" "c:/users/wish7/appdata/local/temp/wicked_pdf_generated_file.608.3885.pdf" error: #<java::javalang::illegalargumentexception:0x1e48d50> e:/nupur/netbeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/wicked_pdf-0.9.6/lib/wicked_pdf.rb:68:in `pdf_from_string' e:/nupur/netbeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/wicked_pdf-0.9.6/lib/pdf_helper.rb:63:in `make_pdf' e:/nupur/netbeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/wicked_pdf-0.9.6/lib/pdf_helper.rb:76:in `make_and_send_pdf' e:/nupur/netbeans/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/wicked_pdf-0.9.6/lib/pdf_helper.rb:21:in `render_with_wicked_pdf' c:/users/wish7/documents/netbeansprojects/healthrecord/app/controllers/appointments_controller.rb:58:in `show' ...

php - How to remove "Warning: Unresponsive Script" -

this question has answer here: asynchronous , synchronous 2 answers i using jquery ajax code this: $.each(url_id, function(index, value) { $.ajax({ async: false, type: "post", url: "webservices/insert-manual.php", data: { url_id: value}, datatype: "json" }).done(function(response){ if(response.code == "200"){ $("#results").append('<div class="results-list"><strong>well done!</strong></div>'); }else{ $("#results").append('<div class="results-list-error"><strong>oh snap!</strong> there no records update in database.</div>'); } }); }); when run script got error message i...

android - Why my application from store not visible for tablet samsung tab p3100? -

my application store visible acer tablet android 3.2.1 not visible samsung tab p3100 4.1. can do? <uses-sdk android:minsdkversion="7" android:targetsdkversion="11" /> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.internet" /> <!-- permission allow request connection changes. --> <uses-permission android:name="android.permission.access_network_state" /> <!-- required start our service bootcompletedintentreceiver. --> <uses-permission android:name="android.permission.re...

asp.net - What is limit of data that can be passed with jQuery ajax GET request -

this cross-domain request rest service: $.ajax({ type: "get", datatype: "jsonp", contenttype: "application/javascript", data: d, //crossdomain: true, async: false, url:"http://xx.xx.xx.xx/myservice/myservice.svc/getdata", success: function (jsondata) { console.log(jsondata); alert('hello'); }, complete: function (request, textstatus) { console.log(request.responsetext); console.log(textstatus); }, error: function (request, textstatus, errorthrown) { console.log(request.responsetext); console.log(textstatus); console.log(errorthrown); } }); here, data: d how data can send? there limit? ...

view - Detect if a video is playing on Android -

can app detect if video playing via 3rd party player? i want hide floating view (think chatheads) when video starts playing or becomes full screen. chatheads when video playing how detect playing video? thanks you can't monitor other apps behavior, more specifically, can't capture or take snapshot of other apps can watch special strings in logcat here's logcat of defaul movies app of android: 05-21 12:30:03.709: error/mediaplayerservice(803): error: -2147483648 05-21 12:30:03.709: error/mediaplayer(1778): unable to create media player 05-21 12:31:19.160: debug/mediaplayer(1852): getmetadata 05-21 12:31:19.370: warn/mediaplayer(1852): info/warning (3, 0) 05-21 12:31:19.400: info/mediaplayer(1852): info (3,0) you should take care of player apps, too.

php - Zend Framwork crashed when newrelic was enabled -

i created new zf1 application (1.12.0) zf tool this: zf create project test i enabled layout follow: zf enable layout and when enabled newrelic got error: php error: uncaught exception 'zend_layout_exception' message 'invalid method 'getmodulename' called on layout action helper' /usr/local/zend/share/zendframework/library/zend/layout/controller/action/helper/layout.php : 184 the way in new relic names zend transactions hook zend_controller_plugin_broker::routeshutdown() , @ various methods in single argument that function receives, request. parameter supposed class has several methods: getmodulename() , getcontrollername() , , getactionname() . php agent expects able call of functions on request. if have highly customized zend framework installation, may need resort naming transaction manually. in case, in php ini file set newrelic.framework = "none" , @ appropriate place in router, call newrelic_name_transaction() . may abl...

File Manager access in iphone for custom application -

this question exact duplicate of: how use nsdocuments directory downloads in iphone 3 answers how can file manager access in iphone application have downloads option thank you. you can downloads directory passing argument nsdownloadsdirectory method nssearchpathfordirectoriesindomains. this nsarray *directoryarray = nssearchpathfordirectoriesindomains(nsdownloadsdirectory , nsuserdomainmask, yes); nsstring *downloadsdir = [directoryarray objectatindex:0];

mysql - PHP Drop Down Selected -

i've got 3 drop down boxes populate each drop down 1 above on 3rd drop down want bring value selected. code below <tr> <td width="119">category</td> <td width="371"> <select name="cat_id" id="cat_id" onchange="showcompany(this.value);"> <option value="">--select--</option> <?php $sql="select * category"; $sql_row=mysql_query($sql); while($sql_res=mysql_fetch_assoc($sql_row)) { ?> <option value="<?php echo $sql_res["id"]; ?>" <?php if($sql_res["id"] ==$_request ["cat_id"]) { echo "selected"; } ?>><?php echo $sql_res["category_name"]; ? ></option> <?php } ?> </select> </td> </tr> <tr> <td>company</td> <td id="td_company"> <select name="company_id...

sql - mysql - Get two greatest values from multiple columns -

we can use greatest greatest value multiple columns below select greatest(mark1,mark2,mark3,mark4,mark5) best_mark marks but want 2 best marks all(5) marks. can on mysql query? table structure (i know wrong - created someone): student_id | name | mark1 | mark2 | mark3 | mark4 | mark5 this not elegant solution if cannot alter table structure can unpivot data , apply user defined variable row number each student_id. code similar following: select student_id, name, col, data ( select student_id, name, col, data, @rn:=case when student_id = @prev @rn else 0 end +1 rn, @prev:=student_id ( select student_id, name, col, @rn, @prev, case s.col when 'mark1' mark1 when 'mark2' mark2 when 'mark3' mark3 when 'mark4' mark4 when 'mark5' mark5 end data marks cross join ( select 'mark1' col union select 'mark2...

javascript - Onclick on bootstrap button -

this question has answer here: bootstrap onclick button event 1 answer ok i'm new bootstrap themes , all, trying fire javascript onclick method on below bootstrap button couldn't figure out how so.. <a class="btn btn-large btn-success" href="http://twitter.github.io/bootstrap/examples/marketing-narrow.html#">send email</a> any appreciated.. just other click event, can use jquery register element, set id element , listen events so: $('#mybutton').on('click', function(event) { event.preventdefault(); // prevent following link (optional) ... }); you can use inline javascript in onclick attribute: <a ... onclick="myfunc();">..</a>

c# - How do I use the hyperlink field in gridview, a new pop-up, to link back to my main page -

Image
i have created page button opens new page, pop-up if will. btntoolbarsearch.attributes.add("onclick", "window.open('dagboksearch.aspx','','height=600,width=600');return false"); on new page opens have gridview below info. (you search on "from date" "to date" , records in between.) the first column says "gå till" link <asp:hyperlinkfield datanavigateurlfields="foretag" datanavigateurlformatstring="userprofile.aspx?id={0}" text="gå till" /> i link me previous page , open object corresponding id, i'm not sure how accomplish this. maybe there better way 1 i'm using i'm still learning. you should able use window.opener property reference parent window. can set it's url selected link, , close popup window. something should trick: // place near closing </body> tag // nb uses jquery , event de...

assembly - Call 5 interface on MS-DOS -

i have hello, world program ms-dos uses int 21h make system calls. mov dx,hello mov ah,9 int 0x21 mov ah,0 int 0x21 "hello" address of string 'hello, world',13,10,'$'. the program works. however, when replace (the first) "int 0x21" "call 5", program crashes computer (i.e. virtualbox virtual machine running pts-dos). on dosbox terminates , returns command prompt. i tried using different registers address , call number got same result. now wondering... do later versions of dos not support cp/m compatibility call 5 interface more? do pts-dos , dos in dosbox not support call 5? am using interface wrong? do have configure segment registers first? (i tried setting segment registers zero.) any ideas? update: accepted answer because correct per documentation. still doesn't work might due version of dos or other problem. is there version of dos you've seen cp/m "call 5" work? started dos 2.1, di...

java - Eclipse as an applet? -

is possible run eclipse without downloading, installing, unpacking or having file on computer, use applet in browser? seeing how eclipse contains native code (the swt), i'm gonna say: no. maybe using remote desktop (but doesn't count, it).

openstreetmap - Offline-Open street maps on windows phone -

i'm planning implement offline map solution windows phone using open street maps. achieve this, need download complete osm database first , use it? or possible fetch on-demand , store locally? if osm not best solution else used have offline maps application? offline data required 3-5 cities, not more that.

gmail - How do I get storage size and used storage in google apps API -

i trying retrieve size of users email boxes google apps domain having hard time finding in apis google. know is? see can in gapps console can not find is. i using gapps .net client if in there awesome. you can gmail quota , usage numbers user using new admin sdk reports api calls.

How can I explain Cloud Computing without technical jargon? -

i need explain cloud computing without technical training or experience. can suggest way have worked well? also, internet services not strict cloud computing, says serviecs cloud (online) drive , cloud (online) music , or cloud (internet) smart tv , how can explain that? cloud computing in nutshell leasing hardware or software through internet on demand.

javascript - How can I catch JS exceptions from async functions I don't control? -

i know using try..catch async functions doesn't work, , advice i've read suggests using inside passed callback. however, without control on async function throws exception, can 1 catch it? in example it's chrome.bookmarks.create , fails on edge cases. in chrome extensions, there 3 possible ways of catching asynchronous errors: listen global error events using window.onerror . in callback of asynchronous functions, check value of chrome.runtime.lasterror .

asp.net mvc - logoff only works on layout after 1 refresh/request -

im working on log module application, need close session if same user login on different pc (close old session). part works when redirect filter logout view, logout view uses layout, , layout has menu inside if: @if (context.user.identity.isauthenticated) { <nav> <div> @html.action("_menu", "menu") </div> </nav> } so expect logout view loaded without menu, when run application menu there, until refresh page happens, menu gone. my logoff method: public actionresult logoff() { formsauthentication.signout(); httpcookie cookie = new httpcookie("sid") { expires = datetime.now.adddays(-10) // eliminar la cookie }; httpcontext.response.cookies.set(cookie); if (httpcontext.session["errormsg"] == null)//salida normal? ...

html - how to detect distro / os to apply css -

i using <!--[if statement detect type of browser user has realized same browser (version , build) can produce different result on different operating systems. safari shows ok on windows distorted on ubuntu. best way detect specific browser specific os, ubuntu or debian? ppk has great method that: var browserdetect = { init: function () { this.browser = this.searchstring(this.databrowser) || "an unknown browser"; this.version = this.searchversion(navigator.useragent) || this.searchversion(navigator.appversion) || "an unknown version"; this.os = this.searchstring(this.dataos) || "an unknown os"; }, searchstring: function (data) { (var i=0;i<data.length;i++) { var datastring = data[i].string; var dataprop = data[i].prop; this.versionsearchstring = data[i].versionsearch || data[i].identity; if (datastring) { ...

php - Marking few items from a list based on a database -

i have list of n items(in multiple categories) like category 1 2 3 category b 1 2 .... stored in mysql database. corresponding particular user, know m (m <=n) of them should marked user (stored in database userid|itemid table.) while displaying them html list. what efficient way this? i'm using php we can in o(mn) checking each list item against user history there better way? , can algorithm change if know m << n . step 1: name variables populating checkboxes intelligently can reference them id of item. step 2: pull (m) items out of database. step 3: loop through (m), , each item in (m), mark checkbox 'checked'. o(m) result.

c++ - How to get QGridLayout item by clicked QPoint? -

i have grid of qframes in qgridlayout , popup menu actions, targeted on cell mouse right click happens. on implementation of contextmenuevent clicked qpoint using common event->pos() how access correct cell object point? or there better alternative solution path purpose? void x::contextmenuevent(qcontextmenuevent* event) { // qpoint target = event->pos(); // todo: m_gridlayout-> ... // myderivedcell->setsomething(); } there bunch of solutions here. simplest go through widgets, calling bool qwidget::undermouse () const . favorite this: frame_i->setcontextmenupolicy(qt::customcontextmenu); connect(frame_i, signal(customcontextmenurequested(qpoint)) , slot(oncontextmenu(qpoint))); ... void x::oncontextmenu(const qpoint &pos) { qframe *w = qobject_cast < qframe * >(sender()); ... }

console - Java runtine.exec: doesn't change path -

java : public static void startcmd(string path) { runtime rt = runtime.getruntime(); process pr = rt.exec(path); bufferedreader input = new bufferedreader(new inputstreamreader(pr.getinputstream(), "cp852")); string line = null; // redirection output console while((line = input.readline()) != null) { system.out.println(line); } system.out.println("error code: " + pr.waitfor()); } public static void main(string[] args) { startcmd("c:\\run.bat"); } run.bat : cd c:\cmd\ application.exe output in console : d:\workspace\test>cd c:\cmd\ d:\workspace\test>application.exe // path should changed d:\workspace\test> c:\cmd> error code: 0 why cd c:\cmd\ command isn't passed java console application??? under dos , when changing path drive necessary use drive letter before directory can set. due fact each drive has own working directory. need add c: batch file: c: cd c:\cmd\ application.exe

c# - Cannot load web api method using Backbone.js -

i have blank asp.net solution 5 different projects. 1 of them asp.net web api , other 1 blank web site bunch of html pages. using backbone.js/jquery make calls web api within solution. blank web site running on different port , web api running on different port. //collection var auditscollection = backbone.collection.extend({ url: 'http://localhost:56501/api/searchaudits', sync: function (method, model, options) { if (!options.crossdomain) { options.crossdomain = true; } options.timeout = 1000; alert(method + ": " + json.stringify(model)); return backbone.sync(method, model, options); }, }); var audits = new auditscollection(); // model var audit = backbone.model.extend({ }); var audit = new audit({ auditnumber: "a12" }); audits.add(audit); // post call - sending model , expecting json object in response. audit.save({}, { ...

jquery - Starting client-side validation when using BeginForm helper -

i working on asp.net mvc 3 application , have problem getting unobtrusive js validation work. i've asked similar question since don't answers think managed define problem better write question now. searching answer how client-side validation working saw there must code attached click event of submit button start validation process. i'm not 100% sure so, , in fact problem, if i'm correct me js need add validation process can triggered. this form : @using (html.beginform("recievedatafromdocument", "forms", formmethod.post)) { @html.validationsummary(true) <table border="1"> <colgroup> <col span="1" style="width: 10%;" /> <col span="1" style="width: 40%;" /> <col span="1" style="width: 25%;" /> <col span="1" style="width: 25%;" /> </colgroup> ...