Posts

Showing posts from July, 2014

python - Django - mysql IntegrityError 1062 -

i have cron job downloads data mysql every night @ 3. can test connection , download , works. download partially fails. (partial download) if try , re-run py script, barks. duplicate entry error key 2. i want able run script , erase entries previous night can rerun script populates db. there 3 other tables tied one. django going if create sql script deletes yesterdays records? automatically delete necessary additions other tables, or should in script also? traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/usr/local/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() file "/usr/local/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "/usr/local/lib/python2.6/site-packages/django/core/manag

postgresql - Rows sorting changes after updating a column not related to sorting at all -

have orm generated sql this: select * "games" "competition_id" in (select "id" "competitions" "id" in (1,2,3)) order "date" limit 10 it displaying rows 1 10. however after: update "games" set "season_id"=2 same select returns rows 1,2,3 ... 11, 12 instead of 1,2,3 ... 9, 10 yes, returned rows still 10, last ones replaced ones after 10... limit doesn't guarantee rows returned if multiple matching results exist within order by scope. if have more 10 rows same date , or if have different dates happens 9th, 10th, 11th , 12th rows have same date , aren't guaranteed consistent results returned 9th , 10th slots. postgresql choose these @ own discretion - change when records updated. try adding id order list fix this.

scala - Get command line arguments when running an Akka Microkernel? -

i have akka microkernel below: class servicekernel extends bootable { val system = actorsystem("service-kernel") def startup = { system.actorof(props(new boot(false))) ! start } def shutdown = { system.shutdown() } } because kernel extends bootable , not app , how access command line arguments used when starting kernel? instance if run kernel using start namespace.servicekernel -d rundevmode or similar. thanks! additional info i thought worth adding information start script in microkernel. in /bin/start notice following: #!/bin/sh akka_home="$(cd "$(cd "$(dirname "$0")"; pwd -p)"/..; pwd)" akka_classpath="$akka_home/config:$akka_home/lib/*" java_opts="-xms256m -xmx512m -xx:+useconcmarksweepgc -xx:+cmsclassunloadingenabled -xx:parallelgcthreads=2" java $java_opts -cp "$akka_classpath" -dakka.home="$akka_home" akka.kernel.main "$@" although om-nom

dependency injection - WELD-001408 Unsatisfied dependencies for type [EmbeddedCacheManager] with qualifiers [@Default] -

i getting exception: weld-001408 unsatisfied dependencies type [embeddedcachemanager] qualifiers [@default] @ injection point [[parameter 1] of [constructor] @inject public org.jboss.jdf.example.ticketmonster.service.seatallocationservice(embeddedcachemanager)]. does have tip? have confirmed beans.xml in src\main\webapp\web-inf , not publishing more 1 jar. it's 1 project. @inject public seatallocationservice(embeddedcachemanager manager) { configuration allocation = new configurationbuilder() .transaction() .transactionmode(transactionmode.transactional) .transactionmanagerlookup(new jbosstransactionmanagerlookup()) .lockingmode(lockingmode.pessimistic) .loaders() .addfilecachestore() .purgeonstartup(true) .build(); manager.defineconfiguration(allocations, allocation); this.cache = manager.getcache(allocations); } pom snippet: <dependencymanagement> ... <artifactid>

c# - Store user input when updating repeater inside updatepanel -

i have repeater inside updatepanel. inside repeater item have several text boxes. have "add new" button dynamically add new items repeater. problem every time press "add new" user input erased. how update repeater preserving user input? whenever postback occurs, repeater control loses state. might want perform following quick steps on postback. convert repeater data form of data array (da) in code-behind. add empty element da. bind da repeater control.

asp.net web api - delegatingHandler (webapi) equivalent in servicestack -

i trying migrate servicestack framework asp.net mvc4 webapi framework. have delegatinghandler in webapi equivalent in servicestack? this validate request , return custom response without going further. my delegatinghandler public class xyzdh : delegatinghandler { protected override task<httpresponsemessage> sendasync(httprequestmessage request, cancellationtoken cancellationtoken) { int maxlengthallowed = 200; long? contentlen = request.content.headers.contentlength; if (contentlen > maxlengthallowed) { var defaultresponse = responsehelper.getbaseresponse("content lenght issue", true, uploadlogsizeissue); return task<httpresponsemessage>.factory.startnew(() => { var response = new httpresponsemessage(httpstatuscode.ok) { content = new stringcontent(defaultresponse.tostring(), encoding.utf8, "message/http"

jquery - Convert string "04/09/2013" MM/DD/YYY to Date Format in JavaScript -

this question has answer here: parse datetime string in javascript 8 answers i want convert "04/09/2013" date can compare start date , end date like, if (stardate < enddate) { //do } else {}. want convert mm/dd/yyyy format. it's difficult work dates in javascript. highly recommend use moment.js library http://momentjs.com/

ImageView in javaFx is not shown when i run it as webstart or in browser -

i've been trying load image imageview , , works fine when run standalone app, when try run in browser or webstart doesn't shown. i've tried: ivfoto = new imageview(new image("file:/c:/users/carlos/desktop/4fbzw.jpg")); or ivfoto = new imageview(new image("file:\\c:\\users\\carlos\\desktop\\4fbzw.jpg")); or ivfoto = new imageview("file:///c:/users/carlos/desktop/4fbzw.jpg"); if has idea of i'm doing wrong here, appreciate help! package image ( 4fbzw.jpg ) in application jar file (in same location class loading image) , reference resource: ivfoto = new imageview( new image( this.getclass().getresource("4fbzw.jpg").toexternalform() ) ); there couple of things wrong image references in question: hardcoding file: protocol. a javafx application packaged jar file, resources application should accessed using jar protocol. using getresource method, resource fetched same protocol used load cl

java - Jersey post consume always calls objects default constructor -

the non default constructor never called in person class when attempt consume rest service takes person parameter. here person class: @xmlrootelement(name = "person") public class person { protected string name; public person(string name) { this.name=name; } // default constructor public person(){this.name="";} @xmlelement(required=true, name="name") public string getname() { return name; } public void setname(string name) { this.name = name; }; } here web method: @path("person/") public class postresource { @path("create") @post @produces("text/plain") @consumes("application/json") public string createperson(person person) { return person.getname(); } } here body of rest call: { "person": { "name":"some name"} } the name of person object passed createperson blank (or whatever specify in default constructor) any clue why??? method return respo

class has no attribute, even with self given as a parameter - Python -

i have following python class: import sys import re class parser: def __init__(self, filename=""): self.filename = filename def parse(self): try: table = {} fp = open(self.filename, 'r') records = fp.readlines() record in records: (index, column, value) = record.strip().split() value = value[:3] table[column] = value return table except ioerror: print "could not open file ", self.filename sys.exit(1) def organize_map(self, table={}): new_table = { 'profile_1': [], 'profile_2': [], 'profile_3': [], 'profile_4': [] } k, v in table.iteritems(): if re.match("profile1", k): new_table['profile_1'].append(int(v)) elif re.ma

rdf - How can I use OWL Import with relative paths? -

in owl file, import many other files like: <owl:imports rdf:resource="file:/home/noor/downloads/bbc/anatidae.rdf"/> <owl:imports rdf:resource="file:/home/noor/downloads/bbc/animal.rdf"/> <owl:imports rdf:resource="file:/home/noor/downloads/bbc/bird.rdf"/> <owl:imports rdf:resource="file:/home/noor/downloads/bbc/chordate.rdf"/> <owl:imports rdf:resource="file:/home/noor/downloads/bbc/kingdom.rdf"/> <owl:imports rdf:resource="file:/home/noor/downloads/bbc/mammal.rdf"/> but i'm not able manage relative paths; these failing: <owl:imports rdf:resource="file:anatidae.rdf"/> <owl:imports rdf:resource="file:./anatidae.rdf"/> how can relative paths? imports supposed point uris rather local files, therefore tools not support yet import local assets. in order handle local files, have following solutions: a quick fix expose rdf via local web se

python - How do I add a menu to a toolbar? gtk3 -

ok figured out way. if have way can still give answer. may have easier way. i'll trying format reply answer in meantime. method discovered little messy have take time. leave answer unaccepted see if else has better way. i'm using python gtk3. for gtk3 there menutoolbutton, description of it's usage in documentation not clear enough me. besides plain button without drop arrow toolbutton used this. if there way gtk uimanager prefer that. here's answer. it's kinda taking long way around works. one of main problems thought use recent button in grid, gtk seems have recent action toolbars , menus. complicated if want toolbar button popup because toolbar buttons not customizable not have drop arrow. long story short. took long way around regular popup button , made grid contain , toolbar. #the popup see here used menu button toolbar_ui = """ <ui> <toolbar name="toolbar"> <toolitem action="

java - Why isn't this work? String value won't change. Recursion -

public class ggg { static int y=0; static int x; static string h; public static void main(string [] args) { string s = "hadoyef"; x = s.length(); system.out.println(s); reverse(s); system.out.println(s); } public static string reverse(string s){ if (s.length() == 1){ //system.out.print(s); h = h + s.substring(0,1); s=h; system.out.println(s); return s; } else{ h = h + s.substring(s.length()-1,s.length()); return reverse (s.substring(0, s.length()-1)); //system.out.print(s.substring(0,1)); } } } please me dont understand why s=h; part isn't working. ignore here making me post more detail , idk im going ramble until works whoever helps. when call reverse(s); in main , you're not assigning result anything.

Running a shell command from a variable in a shell script -

i programming game using linux. i have shell script: //run.sh a="string1" b="string2" c="string3" command_line="python ../file.py \"$a\" \"$b\" --flag1 ../file.txt --flag2 $c" echo "$command_line" $command_line //note ' \" ' intentionally i want shell run command in command_line. reason command not work, if take string created , stored in command_line(the string echoed) , run through shell, program works fine. any suggestions? thank you the embedded quotes in command_line treated literal characters; not quote value of $a when $command_line expanded. there isn't good, safe way execute value of variable command in posix shell. if using bash or shell supports arrays, can try options=( ../file.py "$a" "$b" --flag1 ../file.txt --flag2 $c ) echo "python ${options[@]}" python "${options[@]}"

amazon s3 - Outlook does not recognize Mime type- application/json in Html Email campaign -

windows has following information mime type. page find software needed open file. mime type: application/json description: unknown windows not recognize mime type this message of emails show when opened on outlook. have images in email being store in amazon s3 bucket? if so, should possibly pull images in email . please note images being dynamically pulled via ruby code. it sure looks storing actual json file instead of image attachment. what see in outlookspy if select message in outlook, click imessage button on outlookspy toolbar go getattachmenttable tab?

windows - Adding multiple lines in registry -

i have application use on multiple machines. export registry settings have configure on each machine can script them imported @ startup. application allows me put multiple lines of text text box, overlay text on printouts. saves text in string in registry. when export registry, string looks this: "sendorsement"="line 1 of text line 2 of text" this doesn't import because of break in string. ideas how make import nicely? don't have option use 1 line of text in settings. instead of using standard .reg file got exporting settings, you'll have via vbscript, using vbcrlf introduce newlines in string. set shellobj = createobject("wscript.shell") shellobj.regwrite "hkcu\software\key\sendorsement", "line1" & vbcrlf & "line2", "reg_sz"

How to run an exported selenium test case using TestNG in Eclipse -

i recorded test case using selenium ide 1.10.0. exported case java/testng/remote control. my eclipse version 4.2.0 , installed testng plug-in version 6.8 i wondering how can create project within eclipse run exported test case? please give me instructions or share me online tutorial / documentations. thanks! below java code generated eclipse: package com.example.tests; import com.thoughtworks.selenium.*; import org.testng.annotations.*; import static org.testng.assert.*; import java.util.regex.pattern; public class searchdonor extends selenesetestnghelper { @test public void testsearchdonor() throws exception { // set overall speed of test case selenium.setspeed("4000"); selenium.open("/?html=openid"); selenium.click("css=input[type=\"submit\"]"); selenium.waitforpagetoload("30000"); thread.sleep(4000); selenium.click("id=cmp_admin"); selenium.

How to do rank-1 factorization in MATLAB? -

i have matrix m of dimensions 6x6 , has rank 1. how can factorize 2 matrices of dimensions 6x1 (say a) , 1x6 (say b) m=a*b. take largest eigen vector , multiply largest eigenvalue : a=[1 2 3 4]'*[1 2 3 4] = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 [v,e] = eigs(a,1); sqrt(e)*v ans = -1.0000 -2.0000 -3.0000 -4.0000 of course, result sign change. edit : if assume 2 vectors can different: a=[1 2 3 4]'*[5 6 7 8] [uu,ss,vv]=svd(a); u=uu(:,1)*ss(1,1) v=vv(:,1) assert(norm(u*v'-a)<1e-10) now solution less unique. determining 2*n values based on n. 1 solution among many. for example, @ other simpler solution (which assume matrix rank 1) : aa=a(:,:)./repmat(a(1,:),[size(a,1),1]); bb=a(:,:)./repmat(a(:,1),[1,size(a,2)]); u=aa(:,1); v=bb(1,:)'*a(1); assert(norm(u*v'-a)<1e-10) it produces totally different result, still factorizes matrix. if want non-negative factori

Cleaning Project not fixing R.java errors (Android) -

my android project started saying r.blah.blah references errors. cleaning/re-generating r.java file has not fixed it. nor has closing/reopening project/eclipse. undid changes xml files have caused it. occurring in 1 of activities, other activities not have errors related r.blah. note: r.java have correct references in file. check if import android.r; is in classes , remove try

sql - How to optimize the count query for each categories for the search results? -

i have 9 categories classfieds website. when user search keyword, want show search results , number of search results in each of categories. how optimize sql query? what have tried? run loop each category: select * ads title '%keyword%'; select count(*) ads title '%keyword%' , category_id = 1; select count(*) ads title '%keyword%' , category_id = 2; select count(*) ads title '%keyword%' , category_id = 3; select count(*) ads title '%keyword%' , category_id = 4; ..... any better suggetions make sql queries faster? use group clause select count(*) ,category_id ads title '%keyword%' group category_id

php - Generating arrays inside for loop -

i have 2 following variables: $contact_number=array('0123456','65321'); $msg="my text" ; i trying create array following using above variables $myarray =array( array("0" => "0123456", "1" => "my text"), array("0" => "65321", "1" => "my text") ); i have tried following code not creating exact array live above: for($i=0; $i < count($contact_number); $i++ ) { $myarray[] =array(array("0" =>$contact_number[$i], "1" =>$msg),); } var_dump($myarray); could please tell me how solve problem you can loop through every contact number, , append message this: $contact = array('0123456','65321'); $message = "my text" ; $array = array(); foreach($contact $value) { $array[] = array($value, $message); } var_export($array); produces this: array ( 0 => array (

visual studio 2010 - How to get absolute paths in cmake generated project files -

i using cmake generate project files c++ project needs compiled under visual studio 6 , 2010. files generated ok both projects , can build projects without problems. however, 2010 vxproj files contain relative paths cpp files , when use jenkins build files log contains relative paths jenkins can not use find source files. i see this: ..\..\source\modulea\file1.cpp(74): warning c4800: 'bool' : forcing value bool 'true' or 'false' (performance warning) while should have been either source/modulea/file.cpp or d:\jenkins\jobs\workspace\source\modulea\file.cpp jenkins able find file. of course, can make parser parse log file , remove ..\...\ hoping find more elegant solution. in end found compiler option can fix this. can add /fc flag visual studio 2010. not sure if works vc6. add use this: set(cmake_cxx_flags "${cmake_cxx_flags} /fc")

Every alternate Paypal IPN transaction is failing (HTTP code 400) -

i have weird issue paypal ipn. every alternate transaction failing. let's if first transactions goes second 1 fails. if 3rd 1 goes 4th 1 fails. http status code getting failed transactions in ipn history 400. have implemented new paypal host header changes newly introduced them. any idea why happening? ipn history http://i.imgur.com/nfqrsgi.png ipn detail http://i.imgur.com/hckdasw.png edit using php curl ipn work (using same sample code available on paypal website) another edit ok found code sample php 5.2 paypal site. 1 different 1 using. tested on paypal sandbox twice , worked. later on test on live see if working fine or not. error 400 = bad request, means requests being made on application layer (by browser) may contain errors or transport layer (syn, syn, ack, syn) 3 way hand shack being interrupted. check pc mallware on safe side. netstat -b in dos , see what's trying connections external network. also scan malware bytes , virus scanner eset

Python Dictionaries & CSV Values | Check CSV -

the csv file works fine. dictionary can't seem check values in csv file make sure i'm not adding duplicate entries. how can check this? code tried below: def write_csv(): csvfile = csv.writer(open("address.csv", "a")) check = csv.reader(open("address.csv")) item in address2: csvfile.writerow([address2[items]['address']['value'],address2[items]['address']['count'],items, datetime.datetime.now()]) def check_csv(): check = csv.reader(open("address.csv")) csvfile = csv.writer(open("address.csv", "a")) stuff in address2: address = address2[str(stuff)]['address']['value'] sub in check: if sub[0] == address: print "equals" try: address2[stuff]['delete'] = true e

Jquery .animate only from index page -

i designing small site in header have different height/position other pages (pages x & y). use .animate animate style change when user goes index pages x or y, not when user goes between pages x & y. how can use jquery determine page user on, , initiate animation if user going index x or y? css, header: header { width: 100%; padding: 4% 0 10px; } index header: .index header { position: absolute; top: 130px; } x & y header: .work header, .bio header { padding-top: 2%; } determine page coming using referrer , if coming index followed checking presence of elements on x or y $(document).ready(function() { var referrer = document.referrer; if(/*do custom check on referrer see if coming index */) { // check if on x or y if($(".work").length || $(".work").length){ // trigger animation } } });

multithreading - Maximum number of threads for a CUDA kernel on Tesla M2050 -

i testing maximum number of threads simple kernel. find total number of threads cannot exceed 4096. code follow: #include <stdio.h> #define n 100 __global__ void test(){ printf("%d %d\n", blockidx.x, threadidx.x); } int main(void){ double *p; size_t size=n*sizeof(double); cudamalloc(&p, size); test<<<64,128>>>(); //test<<<64,128>>>(); cudafree(p); return 0; } my test environment: cuda 4.2.9 on tesla m2050. code compiled nvcc -arch=sm_20 test.cu while checking what's output, found combinations missing. run command ./a.out|wc -l i got 4096. when check cc2.0, can find maximum numberof blocks x,y,z dimensions (1024,1024,512) , maximum number of threads per block 1024. , calls kernel (either <<<64,128>>> or <<<128,64>>>) in limits. idea? nb: cuda memory operations there block code output kernel shown. you abusing kernel printf , , using

PHP dynamically creating associative array from XML -

so have xml i'm strolling through , i'm able move through fine. want dynamically create associative array in way: $keyname => $valname here's how xml looks like: <dict> <key>major version</key><integer>1</integer> <key>minor version</key><integer>1</integer> <key>application version</key><string>7.6.1</string> <key>tracks</key> <dict> <key>0</key> <dict> <key>track id</key><integer>0</integer> <key>name</key><string>american idol 2013</string> <key>artist</key><string>amber holcomb</string> <key>album artist</key><string>amber holcomb</string> <key>album</key><string>unknown album</string> <key>kind</key><string>mpeg audio file</str

jsf - How to specify name attribute in h:inputText? -

i need render h:inputtext following html output : <input id="yourname" type="text" name="name" /> <input id="email" type="text" name="email" /> but h:inputtext renders name attribute same client id of component. want specify name attribute myself, instead of putting client id in that, input field can show meaningful autocomplete suggestions submitted values same field type on other sites. e.g. when use name="email" input field email, user shown suggestions of emails ids submitted on other websites. you can't achieve using <h:inputtext> . name autogenerated jsf based on client id (which in turn based on component id , of naming container parents). you've 2 options achieve concrete functional requirement anyway: if there no other naming container parents, instruct parent form not prepend id: <h:form prependid="false"> this cause <f:ajax>

pointers - C++ interview about operator -

here code implementing = assignment class named cmystring , , code right. cmystring& cmystring::operator =(const cmystring &str) { if(this == &str) return *this; delete []m_pdata; m_pdata = null; m_pdata = new char[strlen(str.m_pdata) + 1]; strcpy(m_pdata, str.m_pdata); return *this; } the instance passed reference, , first 'if' checking whether instance passed in or not. question is: why use &str compare, doesn't str contain address of instance? 1 explain how line works? also, want make sure this contains address of object: correct? address-of operator , reference operator different. the & used in c++ reference declarator in addition being address-of operator. meanings not identical. int target; int &rtarg = target; // rtarg reference integer. // reference initialized refer target. void f(int*& p); // p reference pointer if take address of reference, returns address of tar

Testing the database connection in Yii framework -

the following commands produce errors. , have been working yii 4 days now.. please solve this. c:\wamp\www\yii\trackstar\protected\tests\unit>phpunit dbtest.php 'phpunit' not recognized internal or external command, operable program or batch file. the above error states phpunit not installed in wamp stack. the easiest method install using pear. try following method install phpunit pear : go directory php located. typically, \bin\php\php5.3.8 we’ll call path “php’s location” download “go-pear.phar” location: pear.php.net/go-pear.phar create folder “pear” in php’s location put downloaded “go-pear.phar” file in location. open command prompt administrative privilege. this, click on start menu, type “cmd” – can see cmd.exe icon. right-click on icon , click “run administrator” cmd.exe open. go direcotry of php’s location, typing “cd” command. example, wamp located in “d:\wamp”, write following command: d: cd wamp\bin\php\php5.3.8 now run download

perl - how to compare two cursors in mysql -

in db , have compare data between 2 cursors. steps: in cursor 1, write select query (a huge select query) compares many tables , creates file , stores resultant data in table . on other date, if run same cursor1 , there more rows added , there differenece in number of rows. lets assume cursor 2 row table written cursor1 . now want compare difference every day , comparing cursor1 cursor2.obviously , there difference , has written in file. hope iam clear in explaining stuff. iam unable paste cursor it's above 300 lines , has 3 different queries in it.and compare first query data ex : cursor 1 = ( 'query1' = qq{} 'query2' = qq {} 'query3' = qq{} ); and compare first query new cursor 2 , want directly done in perl script have , not pl-sql or stored procedures. thank you

javascript - MAC address Iphone and Desktop -

this question has answer here: mac addresses in javascript 6 answers i using jquery mobile. want mac address of device, iphone app used on.. used on computer too. want script cross browser , should support multiple devices too.. tried searching on internet couldn't find solution. can tell possible? if yes, example code highly appreciated. no, impossible, javascript not provide access mac adress , on server side can not except if client on same ethernet segment server.

mysql - how to display the result after the submit php form -

how display result after submit form i want display result after submit form print example 1st im filling form submit result after submit want screen display same result http://www.tizag.com/phpt/examples/formexample.php how can please me fix issue. php form code <?php function renderform($grn, $name, $rollno, $class, $fees, $date, $reference, $error) { ?> <?php if ($error != '') { echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>'; } ?> <form action="" method="post"> <div> <p><span class="style9"><strong>g.r.n no:</strong></span><strong> *</strong> <input name="grn" type="text" id="grn" value="<?php echo $grn; ?>" size="50" /> </p> <p><s

Java Generic Type Inference Strange Behavior? -

can explain behaviour me: note: t never used in somethinggeneric public static class somethinggeneric<t> { public list<string> getsomelist() { return null; } } final somethinggeneric<object> somethinggenericobject = new somethinggeneric<object>(); final somethinggeneric<?> somethinggenericwildcard = new somethinggeneric<object>(); final somethinggeneric somethinggenericraw = new somethinggeneric<object>(); (final string s : somethinggenericobject.getsomelist()) { } // 1 - compiles (final string s : somethinggenericwildcard.getsomelist()) { } // 2 - compiles (final string s : somethinggenericraw.getsomelist()) { } // 3 - not compile! (1) , (2) compiles (3) fails following message: incompatible types found : java.lang.object required: java.lang.string if wants full code, here is . have verified in both java 5 , 6. well, interesting question despite downvotes. belie

javascript - How do I avoid the error event in fine uploader when there is no response content on a successful upload? -

i've configured fineuploader use cors , work amazon web services s3 bucket. the problem face, successful upload not return response content (status code 204 though, response content empty). though upload happens (i've verified file uploaded), error event triggered. presumably, because there no response. how handle case? there way me manually trigger 'success' catching error in 'onerror' callback? edit: i've made progress digging here. error seems stem handler.xhr.js . in particular, inside parseresponse(xhr) function. try{ response = qq.parsejson(xhr.responsetext); } catch(error) { log('error when attempting parse xhr response text (' + error + ')', 'error'); response = {}; } this seems throw error since response empty. does know proper response should be? i'm thinking of adding line here checking empty response , manually plugging in correct response should be. the issue parseresponse() fun

doctrine - Temporary users in Zend framework 2 -

i'm struggling temporary users in zend framework 2. want cms temporary users. give them startdate , enddate, want check if they're active , current date between start , enddate. the "out of date" no value in database, can't check on database. possible check in login zfcuser if user active , not out of date? my overview users working check, other pictogram when user out of date. example: public function customstate() { $state = $this->getstate(); $curdate = new \datetime('midnight'); //if (state = 1 , current date after startdate) , (current date before enddate or enddate empty) if (($state == '1' && $this->startdate <= $curdate) && ($curdate <= $this->enddate || !isset($this->enddate))) { $this->setstate('1'); } //if state = 1 , currentdate not between start- , enddate, set state on 2 elseif ($state == '1' && ($this->startdate > $cu

c++ - /bin/sh: 1: gdk-pixbuf-config: not found -

i trying compile c/c++ program based on gdk-pixbuf, during compilation error "/bin/sh: 1: gdk-pixbuf-config: not found" i got below packages currently, kindly guide, missing? using ubuntu 12.04, 32 bit dpkg -l | grep libgdk ii libgdk-pixbuf2-ruby 1.0.3-1build1 transitional package ruby-gdk-pixbuf2 ii libgdk-pixbuf2-ruby1.8 1.0.3-1build1 transitional package ruby-gdk-pixbuf2 ii libgdk-pixbuf2-ruby1.8-dbg 1.0.3-1build1 transitional package ruby-gdk-pixbuf2-dbg ii libgdk-pixbuf2.0-0 2.26.1-1 gdk pixbuf library ii libgdk-pixbuf2.0-common 2.26.1-1 gdk pixbuf library - data files ii libgdk-pixbuf2.0-dev 2.26.1-1 gdk pixbuf library

sqlite - Android: ListView Load gives Null Pointer Exception -

i'm trying data sqlite listview followed example in answer in url make listview sqlite database the customcursoradapter going public class customcursoradapter extends simplecursoradapter { private int layout; private layoutinflater inflater; private context context; public customcursoradapter (context context, int layout, cursor c, string[] from, int[] to) { super(context, layout, c, from, to); this.layout = layout; this.context = context; inflater = layoutinflater.from(context); } @override public view newview(context context, cursor cursor, viewgroup parent) { view v = inflater.inflate(r.layout.topics, parent, false); return v; } @override public void bindview(view v, context context, cursor c) { //1 column you're getting data string name = c.getstring(1); /** * next set name of entry. */ textview name_text = (

rubygems - How to fill a online form automatically using ruby? -

i wondering how can fill online form automatically . new ruby development , done python . more want enter 10 digit pnr no " http://irctc-pnr-status.com/ " , click enter. take @ mechanize gem . allows perform web requests programatically, including filling in forms , submitting.

jdbc - jConnect4 pooled connection does not work as documented -

official sybase jconnect programmers reference suggests following way use pooled connections: sybconnectionpooldatasource connectionpooldatasource = new sybconnectionpooldatasource(); ... connection ds = connectionpooldatasource.getconnection(); ... ds.close(); however getdatasource causes exception. decompiled sybconnectionpooldatasource , found method call explicitly generates error: public connection getconnection() throws sqlexception { errormessage.raiseerror("jz0s3", "getconnection()"); return null; } does have idea why documentation contradicts implementation? i can't comment sybase because 1) don't use , 2) link doesn't work, can try give theory based on own experience maintaining jdbc driver (jaybird/firebird jdbc) , looking @ of other implementations do. the connectionpooldatasource least understood part of jdbc api. contrary naming suggests , how has been implemented in jdbc implementations interface should not

html - True mobile screen emulator ? -

Image
i have page : http://people.opera.com/andreasb/viewport/ex01.html which uses viewport different mobile screen sizes. when run @ iphone see font changes : but when use ripple or other chrome extensions (which found) , doesnt show me increased font size. screen size changing. ( doesnt affect font size ) how can emulate ( chrome extension) screen size show me if i'm on real mobile ? you don't need chrome extension that, developer tools have such built-in feature. open developer tools ( f12 , ctrl shift i , ...). click on gear in bottom-right corner. click on "overrides". enable "device metrics", , adjust "screen resolution" / "font scale factor" desired values. examples (360x200 , 200x360, didn't zoom or resize screenshots): some preset values can used switching user agent (above "device metrics"). if want multiple custom values, create chrome extension using chrome.debugger api.

css3 - How to stretch an input button to available width and center it's text using CSS padding and text-indent? -

i have input button fixed width @ 20px using box-sizing: content-box . <input data-role="none" type="button" class="icon_text" value="click me" /> the width of button set using padding only. example: .icon_text { border: 1px solid #aaa; border-radius: .7em; -moz-border-radius: .7em; -webkit-border-radius: .7em; color: white !important; font-size: 16px; font-weight: 800; cursor: pointer; background-color: #7eb238; background-image: url("p.png"); background-image: url("p.png"), -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(rgba(52,109,28,1)), color-stop(rgba(52,109,28,0) )), -webkit-gradient(linear, left top, left bottom, from( #9ad945 ), to( #7eb238 )); background-image: url("p.png"), -webkit-radial-gradient(center, ellipse cover, rgba(52,109,28,1), rgba(52,109,28,0) ), -webkit-linear-gradient( #9ad945, #7eb238 ); b

caching - What is the recommended way to save chat history in Android? -

i programming chat application using asmack. i looking best way save chat history. although server side later on, still want history (mostly recent) saved on phone. i read http://developer.android.com/guide/topics/data/data-storage.html and implemented internal data storage save history. recommended way save chat history/contacts? edit: in reply comments; follows, i've done? (but adding encryption) string filename = "contactname.history"; string string = "encrypted message history"; fileoutputstream fos = openfileoutput(filename, context.mode_private); fos.write(string.getbytes()); fos.close(); will have encrypt string manually, or android on own? best way use sqlite data base because easy process , can sort objects based on timestamp.

jquery - colspane all columns of clone row -

i want merge columns (colspan) in new row created using clone() method of jquery . 1 more thing want new row have 1 column after colspan should have values of original row separated space . i have tried clone , working me far consider cloning $(document).ready(function(){ console.log($('table tbody tr').eq(0).html()); var newtr=$('table tbody tr').eq(0).clone(); console.log(newtr.html()); }); but no idea how colspan columns value of original row comma separated. js fiddle link edited current html <table> <thead> <tr> <th>name</th> <th>order</th> <th>month</th> </tr> </thead> <tbody> <tr> <td>rahul</td> <td>#1</td> <td>january</td> </tr> <tr> <td>yunus</td> <

c# - What's the best practice in organizing test methods that cover steps of a behavior? -

i have fileextractor class start method steps. i've created test class called "whenextractinginvalidfile.cs" within folder called "fileextractortests" , added test methods inside below should verified steps of start() method: [testmethod] public void should_remove_original_file() { } [testmethod] public void should_add_original_file_to_errorstorage() { } [testmethod] public void should_log_error_locally() { } this way, it'd nicely organize behaviors , expectations should met. the problem of logic of these test methods same should creating 1 test method verifies steps or separately above? [testmethod] public void should_remove_original_file_then_add_original_file_to_errorstorage_then_log_error_locally() { } what's best practice? while it's commonly accepted act section of tests should contain 1 call, there's still lot of debate on "one assert per test" practice. i tend adhere because : when tes

c - Query the IP of the interface that will be used for a connection to a certain target -

i have linux server multiple interfaces. each interface has ip , network. there default route , other routes in routing table connections networks go on 1 or other interface. of course, connections initiated programm going ip in same network 1 of intefaces of server go on interface. given target ip programm on server going connect to: there api retrieve ip address of local interface used? or alternatively: once connection has been initiated ip, how can local ip address of server appropriate? available? i don't want write routing logic again. example: eth0: 192.168.1.10/24 eth1: 10.1.1.20/24 default gw: 192.168.1.1 additional static route: 10.2.0.0/16 via 10.1.1.1 now if programm initiates udp connection 1.2.3.4, use eth0 , appropritate ip want query 192.168.10. if programm initiates udp connection 10.2.55.66, use eth1 , appropritate ip want query 10.1.1.20. if programm initiates udp connection 10.1.1.9, use eth1 , appropritate ip want query 10.1.1.20. the reason que

php - Working with checkbox which is creating by Ajax -

i working ajax project. have form of user in name, address , postcode . on entering name, address or postcode matching rows shown ajax file in . so on select checkbox want further activity. my html code address : <input type="text" name="user_name" id="from_location" value="" class="in_form" /> <div id="user"></div> and jquery code is $.ajax({ url: "ajax_user.php", data: { address: address, }, datatype: "html", type: "post", success: function(result){ $("#user").append(result); } }) } and ajax user php $sql= "select * instructor_mst sex='$sex' , car_type='$car_type' , address '%$address%' "; if (!$sqli=mysql_query($sql)){

robotframework - How do I tell robot-server to reset the test fixture when I use ride with Plone? -

i'm trying write first robot test; i'd use ride advertized in http://developer.plone.org/reference_manuals/external/plone.app.robotframework/happy.html#install-robot-tools i added initialization = import os os.environ['path'] = os.environ['path'] + os.pathsep + '${buildout:directory}/bin' to [robot] section make possible run tests clicking "start" in ride. it works, second time run tests still see content created first test run. how tell robot-server go just-initialized state? easily (and should throw me pool not documenting yet in plone.app.robotframework 's documentation – i thought ride difficult running until works on wxpython 2.9). in ride select run -tab change execution profile custom script click browse select bin/robot buildout script run tests click start . technically bin/robot shortcut bin/pybot --listener plone.app.robotframework.robotlistener (i keep repeating bin/ , because it&