Posts

Showing posts from August, 2013

python - Backtracking to generate all numbers within constraint -

i trying create function generates numbers can formed through combination of primes satisfy constraint of being within 99% of number , less or equal number. primes [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] , exponents [39, 19, 9 , 6, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1] the code have uses 1 of each prime , stops, 2^1*3^1*5^1*...*17^1 or something, doesn't increment exponents. not sure wrong here, don't know problem is. here code def rec(start): global freqa global global exp if start >=length:return true print a," ",freqa if a>= int(0.99*curt): in xrange(length): exp[i]=exponents[i]-freqa[i] rec1(0) in xrange(exponents[start]): freqa[start]+=1 a*=primes[start] if a<=curt , rec(start+1): return true freqa[start]-=1 a/=primes[start] return false line exp[i]=exponents[i]-freqa[i] not in loop just in case: 17! = 355 687 428 096 000

android - Exiting asynctask midway through doinBackground on conditional -

i'm loading data async task. in doinbackground() , want check if json string returned contains error, if want stop asynctask , display textview, if there's no error, want continue executing asynctask. code. protected string doinbackground(string... args) { // building parameters httpclient client = new defaulthttpclient(); httppost post = new httppost(url_all_open_bets); list<namevaluepair> params = new arraylist<namevaluepair>(); post.setheader("user-agent","mozilla/5.0 (macintosh; intel mac os x 10_9_5) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.81 safari/537.36"); params.add(new basicnamevaluepair("email", name)); params.add(new basicnamevaluepair("user-agent","mozilla/5.0 (macintosh; intel mac os x 10_9_5) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.81 safari/537.36")); try { post.s

ruby on rails - Can I send delayed_job an in-memory only ActiveRecord object? -

so had emails didn't go out due mailing service api key not being instantiated. however, detail model objects preserved in database. don't want re-create these in database. i wrote rake task send out emails , easier try , create temporary in-memory objects rather try find correct activerecord objects based on in detail_params. send out emails using detailmailerjob , pass in instantiated detail object. temp_obj = detail.new(detail_params) detailmailerjob.new.delay.notify_job(temp_obj) but i'm noticing following error in delayed::job.all queue after running rake task: last_error: "activerecord::recordnotfound does mean way me pass in detail object detailmailerjob first find instantiated record in database? (i.e., no in-memory objects) edit: here detailmailer & detailmailerjob class. class detailmailerjob def notify_job(detail) detailmailer.notify_job(detail).deliver end end class detailmailer < actio

reactjs - missing ) after argument list when using react-router -

i'm using react-router v0.13.3 , react 0.13.3 build simple web app. big issue happened when tried integrate react-router. so, here's error message: uncaught syntaxerror: missing ) after argument list app.jsx var router = window.reactrouter; var route = router.route; app.view_search = 'search_view'; app.view_favorite = 'favorite_view'; app.view_result = 'result_view'; var routehandler = router.routehandler; var app = react.createclass({ render () { return ( <div> <h1>app</h1> <routehandler/> </div> ) } }); // declare our routes , hierarchy var routes = ( <route handler={app} path="/"> <route path="search" handler={app.searchview}/> <route path="about" handler={app.aboutview}/> <router.defaultroute handler={app.searchview}/> </route> ); router.run(ro

spring websocket - Can I add request parameter to SockJs constructor so that it can be send to server -

i initialize sockjs url as var protocols = ['xhr-polling', 'xdr-polling', 'xdr-streaming', 'xhr-streaming']; var options = {protocols_whitelist: protocols, debug: true,server:tets}; _ws = new sockjs(url, null, options); i want send out request parameter , example somesite/sockjs/info?someparam=tets" is possible? documentation of sockjs refers options map can have key value not sure key use here. i verified url @ server sockjs sends on , http://http_backend/cecobrowsega-3.0.0.0.31/sockjs/testapp/620/4ydem52f/xhr?null so in absence of request param appending null, seems there way send on request param! it's available in latest sock js client. discussion here https://github.com/sockjs/sockjs-client/issues/72 we can pass query string along connection url, same syntax http call

c - read() not working properly -

i trying read txt file using read() , print out output. the text file has these numbers: 123 456 227 and code shown below #include<stdio.h> #include<stdlib.h> #include <fcntl.h> #include<io.h> int main(int argc, char*argv[]){ char* input; char* output; int fd; int temp = 0; if(argc != 3){ printf("too many or few arguments\n"); exit(-1); } input = argv[1]; output = argv[2]; fd = open(input,o_rdonly,0); if(fd == -1){ printf("read failed"); exit(-1); } while(read(fd, &temp ,sizeof(int)) != 0){ printf("%d\n", temp); } close(fd); } i tried running , output 221458993 909456394 842150410 842150455 what doing wrong? you need perform formatted i/o int value representation. fscanf() or better, fgets() friend.

Magento Translate is not defined -

i'm getting error in site , messing css , of js files. uncaught referenceerror: translate not defined any ideas? in page.xml file in layout directory missing translate.js file <action method="addjs"><script>mage/translate.js</script></action>

ios - AlertView delegate method alertViewShouldEnableFirstOtherButton not called Swift -

i'm creating alert view , trying use delegate method alertviewshouldenablefirstotherbutton isn't being called. documentation says going deprecated in ios9 i'm using ios8 var alert = uialertview(title: "edit collection name", message: "", delegate: self, cancelbuttontitle: "cancel", otherbuttontitles: "ok") alert.alertviewstyle = uialertviewstyle.plaintextinput alert.show() *update duncan pointed out uialertview deprecated in ios8. uialertview deprecated in ios8. credit @duncan c

c# - Using RowFilter on datagridview and trying to filter multiple string names -

i trying filter multiple string names on 1 datagridview. appending filter string so filter = " (datetime >= #" + startdatetime.tostring("mm/dd/yyyy hh:mm:ss") + "# , datetime <= #" + enddatetime.tostring("mm/dd/yyyy hh:mm:ss") + "#"; (int = 0; < productnumber.count; i++) { filter += " , tagindex ='" + productnumber[i] + "'"; } filter += " )"; where productnumber list id tags in in string format. output this: (datetime >= #11/02/2014 01:00:58# , datetime <= #12/01/2014 00:00:00# , tagindex ='0' , tagindex ='1' , tagindex ='2' ) i'm getting syntax error when try pass filter datagridview. maybe problem filter not returning anything. try changing last ands ors filter (datetime >= #11/02/2014 01:00:58# , datetime <

python - django, how to Use Count in Q -

i have following models: class group(models.model): group_name = models.charfield(max_length=16) class member(models.model): group = models.foreignkey('group') member_name = models.charfield(max_length=16) gender = models.booleanfield() #false "female", true "male" how can find group has no member , or number of male member s zero? i tried following, didn't work: group.objects.filter( q(member__isnull=true) | q(member__isnull=false) & q( count(member__gender=true)=0 ) ) solution, group.objects.filter(q(member__isnull=true) | ~q(member__gender=true)) when you're trying fetch might return multiple results, should use filter , not get if want count query set, can use, group.objects.filter(q(member__gender=false )).count()

Random number between 0.3 and 1 using jquery -

how tocreate random number between 0.3 , 1. i know math.random() creates number between 0 , 1. however im using css scale , below 0.3 small. if want equal chance of number on range 0.3 1, then math.random() * 0.7 + 0.3 multiplying number 0 1 0.7 give number 0 0.7, , + 0.3 range 0.3 1.0.

Android set wallpaper of home screen with centering the image -

Image
i wrote simple application sets wallpaper on device. can't achieve 1 effect. wish picture automatically centrated horizontally. means center of image on central desktop of luncher app. picture @ bottom shows how looks now: effect want achieve: and image itself: i tried use code this question , however, did not achieve desired effect. my code: public class systemwallpaperhelper { private context context; private imageloader imageloader; private displayimageoptions imageloaderoptions; public systemwallpaperhelper(context context){ this.context = context; setimageloaderoptions(); } private void setimageloaderoptions() { final int width = sharedhelper.getdevicewidth(context) << 1 ; // best wallpaper width twice screen width imageloaderoptions = new displayimageoptions.builder() .imagescaletype(imagescaletype.none) .cacheinmemory(false) .cacheondisk(false) .postprocessor(new bitmapprocessor() {

javascript - Protractor - Get text from table -

i have list of "cases" in table, need find specific 1 name , click on it. my html looks like: <tr ng-repeat-start="case in cases | orderby:order:order_reverse" class="middle ng-scope odd readonly" ng-class-odd="'odd'" ng-class-even="'even'" ng-class="{readonly: !casemanager.iswritable(case)}"> <td> <span ax-sharing-circle="shared_with_partner" class="ng-isolate-scope"><span class="icon sharing-circle sharing-circle-left" title="sdílený"></span></span> </td> <td class="case-table-claim-number fix-v-align"> <a ui-sref="case.general({caseid: case.caseid})" class="ng-binding" href="#/case/0a0b1c2a-94b4-444c-a2b8-c62cbd3532ae/general">20150629-165000-65</a>

Does the XMPP protocol guarantee delivery in a consistent order ("in-order delivery")? -

according this discussion xmpp in-order delivery , xmpp spec guarantees messages processed in order received not delivered in order received. even though not delivered in order received, xmpp (either normal chats or via pub-sub extension) guarantee connected clients receive messages in consistent order? e.g. if 3 messages sent a, b, c , , client c1 receives <message> stanzas in order a, c, b , client c2 receive stanzas in order a, c, b ? i can't see in standards guarantees this. it's not there, implementations (like ejabberd) provide side effect of architecture? the linked post pretty old. xmpp guarantee in-order processing , delivery, of stanzas. see rfc 6120 10.1 . note it's different matter if xmpp implementation obeys , implements requirement. the stanzas in example must received in order sent, i.e. a b c .

linux - Run two shell script in parallel and capture their output -

i want have shell script, configure several things , call 2 other shell scripts. want these 2 scripts run in parallel , want able , print live output. here first script calls other two #!/bin/bash #configure stuff $path/instance2_commands.sh $path/instance1_commands.sh these 2 process trying deploy 2 different application , each of them took around 5 minute want run them in parallel , see live output know deploying tasks. possible? running both scripts in parallel can this: #!/bin/bash #configure stuff $path/instance2_commands.sh >instance2.out 2>&1 & $path/instance1_commands.sh >instance1.out 2>&1 & wait notes: wait pauses until children, instance1 , instance2 , finish 2>&1 on each line redirects error messages relevant output file & @ end of line causes main script continue running after forking, thereby producing child executing line of script concurrently rest of main script each script should send output separa

c++ - C++11 does not deduce type when std::function or lambda functions are involved -

when define function, template<class a> set<a> test(const set<a>& input) { return input; } i can call using test(myset) elsewhere in code without having explicitly define template type. however, when use following function: template<class a> set<a> filter(const set<a>& input,function<bool(a)> compare) { set<a> ret; for(auto = input.begin(); != input.end(); it++) { if(compare(*it)) { ret.insert(*it); } } return ret; } when call function using filter(myset,[](int i) { return i%2==0; }); following error: error: no matching function call ‘filter(std::set<int>&, main()::<lambda(int)>)’ however, of these versions do work: std::function<bool(int)> func = [](int i) { return i%2 ==0; }; set<int> mynewset = filter(myset,func); set<int> mynewset = filter<int>(myset,[](int i) { return i%2==0; }); set<int> mynewset = filter(myse

prestashop - Very basic "creating your first module" tutorial fail. How? -

so i'm following prestashop's published hand-holding guide (which references helper classes ), isn't working. since other "how make module" questions point there, i'm getting fast. at bottom of question code i'm @ far , don't particular error, i'm not seeing * promised beside required field. when add 'desc' => $this->l('description displayed under field.'), it goes left, not under, , if add 'lang' => true, i lose input entirely. that's copy pasted out of guides, missing? unfortunately isn't complete document. should have complete working example. now, there reference vaguely template file (tpl) far point isn't explicitly mentioned. @ point have single php file indicated point in tutorial. <?php if (!defined('_ps_version_')) exit; class spfishbox extends module { public function __construct() { $this->name = 'spfishbox'; $this->tab = '

asp.net mvc - How do I have a client template that changes between edit and read mode in a Telerik MVC grid? -

i creating telerik mvc ui grid , 1 of properties in record view model numeric company id. what want grid display display name company in column when reading grid, when creating new record (or editing existing record) show drop down possible values user can select. i've done first part c.bound(x => x.companyid).clienttemplate('#= getcompanyname(companyid)#'); , works fine, don't see in examples or api reference on how have editing template different display template. i'm sure missing something, since 1 example on telerik's own website shows ( http://demos.telerik.com/aspnet-mvc/grid/editing-custom ) source code show missing definition drop down box (easily seen in example passes categories viewdata element none of provided source code uses that. any hints on i"m missing accomplish this? edit: ok, after bashing head against wall think want create shared editor template, column.bound(x => x.companyid).editortemplatename("idnamepa

web scraping - how to login into a website programatically using asp.net -

i have performed below process in vb.net login website project ! here have taken webbrowser control , named webbrowser1 private void button1_click(object sender, eventargs e) { navigate("http://www.websitename.com"); webbrowser1.document.getelementbyid("webpagetextboxnameforusername") .innertext = "myusername"; webbrowser1.document.getelementbyid("webpagetextboxnameforpassword") .innertext = "mypassword"; webbrowser1.document.getelementbyid("webpagebuttonnametologin") .invokemember("click"); } public void navigate(string url) { webbrowser1.navigate(url); while(webbrowser1.readystate != webbrowserreadystate.complete) { application.doevents(); } } now want follow same procedure in asp.net can people please me out here ? thanks here working example: this class extends default .net webclient ability store cookies: public class cookieawarewebcli

unity3d - Initialize array of AudioSource c# unity -

how can initialize array of audiosource script , how can add value array of audiosource? i'm using unity3d , c# lang please help... you can try resources.loadall function believe. function loads resources directory if remember correctly. more information here doc page function http://docs.unity3d.com/scriptreference/resources.loadall.html

How to set the anchoredPosition of a RectTransform via script in Unity3D -

i trying set anchoredposition of ui image instance programmatically. have tried these ways: getcomponent<recttransform>().anchoredposition=new vector2(0,0); and getcomponent<recttransform>().anchoredposition.set(0,0); but none of above seem work. infact when run program, in inspector says anchoredposition (0.5,0.5). , puts image likes. that?

Factory function unable to return the local iterator to for loop in lua? -

why can't factory function fromto return local function iter iterator loop? function fromto(from,to) return iter,to,from-1 end local function iter(to,from)--parameter:invariant state, control variable = + 1 if <= return else return nil end end in fromto(1,10) print(i) end as @yuhao says, scheme can work. there few ways rearrange code. here's one: local function fromto(from,to) --parameter:invariant state, control variable local function iter(to,from) = + 1 if <= return else return nil end end return iter,to,from-1 end in fromto(1,10) print(i) end two things understand: variable scope , functions values. variables either global or local. local variables lexically scoped. in scope statement following declaration end of block. if name not name of local variable becomes global variable reference. on line 2, iter global variable. fu

javascript - Element not detecting click event -

this question has answer here: event binding on dynamically created elements? 19 answers i generating html dynamically through javascript , have 2 glyphs enclosed within table cell. pencil glyph responds correctly code delete not , not sure why. this rendered html <span id="edit-dp" class="glyphicon glyphicon-pencil" data-action-url="/settings/getdatapoint" data-id="3"></span> <span id="delete-dp" class="glyphicon glyphicon-trash" data-id="3"></span> and here javascript code tie event element. $(document).ready(function(){ $('#delete-dp').click(function (event) { alert('pressed'); //add datapoint id array serialised json , stored in html hidden field deleteddatapoints.push($(this).data('id')); }); }) use .on() .

javascript - Create Html Elements With Angular? -

so, have seemingly simple problem - have list of locations, have sublocations, have sublocations, , on. first location (level 1) picked drop down. the goal have drop down appear under first drop down (if) selected location has sublocations. there can infinite number of dropdowns. what's best way handle creating these new dropdowns angular? the kicker? if possible, able bind these dropdowns ng-model. don't know start on one. tempted try ng-repeat or something.

c# - Calling generic extension method with constraints -

i have model class 2 properties of different types - sourcedata , destinationdata . these properties holds instances of similar classes (in different namespaces) need compare manually , display differences. i create generic extension method issame problem, write simply: // sourcedata: x => ..., destinatindata: y => ... var nameissame = model.issame(x => x.name, y => y.name); var ageissame = model.issame(x => x.age, y => y.age); ... i prepared sample scenario can't write method issame called above. have specify type generic method call. public interface isource { } public interface idestination { } public class sourceperson : isource { public string name { get; set; } public int age { get; set; } } public class destinationperson : idestination { public string name { get; set; } public int age { get; set; } } public abstract class detailviewmodel<tsource, tdestination> tsource : isource tdestination : idestination

broadcastreceiver - App doesn't auto-start an app when booting the device in Android -

Image
i have managed implement following method coding allows app perform auto-launch when device booted/started-up. however, when tested out implementation code, failed work, app has failed perform auto-launch when device booted. can please or advice me possibilities? thank you. manifest.xml <uses-permission android:name="android.permission.receive_boot_completed"> </uses-permission> <receiver android:enabled="true" android:exported="true" android:name="com.dapoaugury.apps.robotapp.autostartup" android:permission="android.permission.receive_boot_completed" android:installlocation="internalonly"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> <action android:name="android.intent.action.quickboot_poweron" /> <category android:name="android.intent.category.default"

fstream - C++ getline adding space at beginning of string -

this bit of code keeps throwing space in front of strings i'm attempting retrieve. void texture_manager::loadsheet(std::string filename, std::string textfile) { std::ifstream infofile(textfile); if (infofile.is_open()) { std::string line; while(std::getline(infofile, line )) { std::string texturename; sf::intrect texture; texture.height = 32; //these dynamic based on text file defines pixel sizes texture.width = 32; if(line.find("<name>") != std::string::npos) { std::size_t pos1 = line.find("<name>") + 6; //search name of texture std::size_t pos2 = line.find(";", pos1); std::size_t namesize = pos1 - pos2; texturename = line.substr(pos1, namesize); std::cout << texturename << std::endl; } } } here's file i'm reading from. i'm trying name , keeps putting space in front of deser

uistoryboard - Xcode Storyboard preview size classes blank -

i have problem storyboard preview. when select old viewcontroller created previous version of xcode (6.0), preview show me navigation bar. but, if create new viewcontroller , put inside elements, preview works. current version of xcode 6.3.2. thanks the interface elements put inside "old viewcontroller" added under particular size class. not in size class preview, interface elements not present.

css - Yet another background image with gradient transparency -

i checked many sites regarding topic , found random stuff nothing solid. have checked question been answered in stackoverflow not thing looking for. have altered code of jsfilled mentioned , tried adding background color image suppose transparent http://jsfiddle.net/fvny7/518/ sadly, wasn't thing want seek <div class="content"></div> <div class="fadeaway"></div> .content{ position:absolute; top:0px; left:0px; width:100%; height:100%; background:url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/goldengatebridge-001.jpg/400px-goldengatebridge-001.jpg') no-repeat; background-color:red;} .fadeaway{ position: absolute; top:0px; left:0px; width:100%; height:100%; background:transparent; background: linear-gradient(top, rgba( 255, 255, 255, 255 ) 0%, rgba( 255, 255, 255, 1 ) 100% ); background: -ms-linear-gradient(top, rgba( 255, 255, 255, 0 ) 0%, rgba( 255, 255, 255, 1 ) 100%

c# - PHP Prepared Statments - Can't Select Varchar Rows, No Problems Selecting Numeric Rows -

alright, i'm having oddball problem here. i'm trying select row via php, reason won't grab row data! it's not having problems fetching numeric rows or anything. note: sending arguments via c# winform, cause of problem (collation or something)? $stmt_getsalt = $con->prepare("select salt,status accounts email=?"); $stmt_getsalt->bind_param("s", $email); $stmt_getsalt->execute(); $stmt_getsalt->bind_result($salt, $status); $stmt_getsalt->fetch(); $stmt_getsalt->close(); status int , has no problem returning value. salt varchar no data being returned. what's going on here? edit: xml representation of data in table. <table name="accounts"> <column name="email">test@testmail.test3</column> <column name="password">65t6anolesrba</column> <column name="salt">65fe93d93e283f002beaca712fd178c6</column>

Oracle Web service Date Returnes Null in Java Code but Not in SOAP UI -

i trying call web service far know implemented oracle. need date web service. here part of code generated web service client in netbeans: @webmethod(operationname = "lastenabled", action = "lastenabled") @webresult(name = "lastenabledoutput", targetnamespace = "something",partname = "parameters") public lastenabledoutput lastenabled( @webparam(name = "sdate-lastenabledinput", targetnamespace = "something", partname = "parameters") sdatelastenabledinput parameters); and code lastenabledoutput: @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "_return" }) @xmlrootelement(name = "lastenabledoutput") public class lastenabledoutput { @xmlelement(name = "return", required = true) @xmlschematype(name = "date") protected xmlgregoriancalendar _return; public xmlgregoriancalendar getreturn() { return _return; } public vo

c - Finding next smallest palindrome, infinite loop -

i writing code find next smallest palindrome(integer) . (must) using array deal large numbers below: #include<stdio.h> #include<malloc.h> #include<string.h> void check_pal(int a[],int max) { int i,j,ctr,k; while(1) { for(i=0;i<max;i++) printf("%d",a[i]); ctr=0; k=max-1; while(a[k]==9) { a[k--]=0;//add corner case when k==0 } a[k]++; for(i=0,j=max;i<max/2;i++,j--) { printf("%d",i); if(a[i]!=a[j]) { ctr=1; break; } } if(ctr==0) for(i=0;i<max;i++) { printf("%d",a[i]); if(i==max-1) return; } } } void int_convert(char * m,int a[] ) { int i,max; for(i=0;i<strlen(m);i++) { // printf("%c",m[i]); a[i]=m[i]-'0'; } max=strlen( m); printf("%d\n",max); check_

javascript - value is not selected in dropdown and please convert Inline js code to external j query -

hello can convert inline js code external js code how possible tried not possible.and value not selected in dropdownlist how possible ? code hear <select class="form-control" id="ncats" name="ncats" onchange="this.options[this.selectedindex].value && (window.location = this.options[this.selectedindex].value);"> <option value="/pr192/index.php?id=10">all</option> <option value="/pr192/index.php?id=25">electric</option> <option value="/pr192/index.php?id=15">solar</option> <option value="/pr192/index.php?id=19">real estate</option></select> convert inline function <script> function fred(sel) { sel.options[sel.selectedindex].value && (window.location = sel.options[sel.selectedindex].value); } </script> then call function, passing this argument <select class="f

javascript - ES2015 equivalent of $.Deferred() -

i'm using babel project , i'm stuck basic problem. i'm used jquery's deferred objects , i'm struggling find es2015 equivalent, here want: // file1.js let dfd = new promise() function functioncalledatsomepoint(thing) { dfd.resolve(thing) } export default { dfd } // file2.js import { dfd } './file1' dfd.then((thing) => { console.log('yay thing:', thing) }) what should correct way right simple deferred? edit royhowie's answer: // file1.js let thing function getthing(_thing) { return new promise((resolve) => { if (el) { thing = new thing(el) } resolve(thing) }) } function functioncalledatsomepoint(el) { getthing(el) } export default { getthing } // file2.js import { getthing } './file1' getthing.then((thing) => { console.log('yay thing:', thing) }) you can export promise directly (instead of function)—like have—but you'll able use (

How to share Image + Text + URL via WhatsApp in Android? -

i share text,image , url via whatsapp. i have looked few links, has share text feature. intent whatsappintent = new intent(intent.action_send); whatsappintent.settype("text/plain"); whatsappintent.setpackage("com.whatsapp"); whatsappintent.putextra(intent.extra_text, "text here"); try { activity.startactivity(whatsappintent); } catch (android.content.activitynotfoundexception ex) { toasthelper.makeshorttext("whatsapp have not been installed."); } uri imageuri = uri.parse(picturefile.getabsolutepath()); intent intent = new intent(); intent.setaction(intent.action_send); intent.setpackage("com.whatsapp"); intent.putextra(intent.extra_text, picture_text); intent.putextra(intent.extra_stream, imageuri); intent.settype("image/jpeg"); intent.addflags(intent.flag_grant_read_uri_permission); try { startactivity(intent); } catch (android.content.activitynotfoundexcepti

c++ - Error while setting cross compiler in QT5.2.1 -

Image
i working on cross compiling qt apps beaglebone black. have installed qt5.2.1 on ubuntu 14.04 , working ubuntu. have installed compiler gcc-linaro-arm-linux-gnueabihf 4.8-2013.04-20130417_linux cross compilation. but when setting cross compiler getting red mark on kit option , error below : the compiler 'xxxxxxxxx'(arm-linux-generic-elf-32bit) cannot produce code qt version qt 5.2.1 in path qt5 (x86-linux-generic-elf-32bit) screen shot below: i have tried other tool chain no success. unable understand getting wrong , how resolve it.

java - Find Merge Point of Two Lists by reversing the Lists -

problem statement: you’re given pointer head nodes of 2 linked lists merge @ node. find node @ merger happens. 2 head nodes different , neither null. input format have complete int findmergenode(node* heada, node* headb) method takes 2 arguments - heads of linked lists. should not read input stdin/console. output format find node @ both lists merge , return data of node. not print stdout/console. i trying reverse 2 lists , walk through each of them seperately until reach last common node. when tested, it's not giving correct ouput. thinking wrong or code wrong? approach or bad one? my code: int findmergenode(node heada, node headb) { //reverse lista node currenta = heada; node preva = null; node nexta; while(currenta!=null){ nexta = currenta.next; currenta.next = preva; preva = currenta; currenta = nexta; } heada = preva; //reverse listb node currentb = headb; node prevb = null; node nextb; while(currentb!=null){ nextb = currentb.next; currentb.

xcode - Image Uploading in iOS -

currently working on image uploading in ios application , here code afhttprequestoperationmanager *man = [[afhttprequestoperationmanager alloc]init]; man.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"text/html"]; nsdata *imagedata = uiimagepngrepresentation(self.imageview.image); afhttprequestoperation *op = [man post:addgroup parameters:@{ @"userid":@"6", @"name":self.txtgroupname.text @"description":self.textviewgroupdescription.text, @"image":imagedata } constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfiledata:imagedata name:@"image" filename:filename mimetype:@"image/png"]; } success:^(afht

mysql - How to close an ssh tunnel in python -

i writing python application accesses remote mysql database using ssh tunneling. setup tunnel os.system("ssh -fng -l 3306:127.0.0.1:3306 username@host") and works perfectly. problem is: what python code close ssh tunnel? thanks os.system('exit') doesn't work the process creates tunnel still runs in background >>> command = 'ssh -fng vagrant@localhost -p2222 -l 8000:localhost:8000' >>> os.system(command) >>> os.system('exit') ps -a | grep ssh 7144 ?? 0:00.04 ssh -fng vagrant@localhost -p2222 -l 8000:localhost:8000 this shows process still running , tunnel still working, , os.system doesn't return process id can use terminate process (it returns exit code) use subprocess return handle process import subprocess proc = subprocess.popen(command, shell=true) proc.terminate() # terminates process

sockets - Ip Struct C parameters -

i have started 1 adventure in raw sockets , found 1 ip header don't understand, doubt is hdrlen:4 this 2 points 4 used what? attribute (( packed )); what attribute? struct iphdr { uint8_t hdrlen:4; uint8_t version:4; uint8_t ecn:2; // explicit congestion notification - rfc 3168 uint8_t dscp:6; // diffserv code point uint16_t length; uint16_t ident; uint16_t fragoff:13; uint16_t flags:3; uint8_t ttl; uint8_t protocol; uint16_t checksum; uint32_t srcip; uint32_t dstip; uint32_t options[ ]; // present if hdrlen > 5 } __attribute__((__packed__)); this struct represents data packet going sent on network, don't want waste single bit of space (since every bit needs sent on "wire"). the field_name:field_width syntax declares bit field , uint8_t hdrlen:4; means want 4 bits store "header length" value (but compiler make sure value copied

opencart2.x - Vendor systems returned INVALID or ERROR in response to notification POST - Sagepay Server -

ive built 2 websites using opencart 2 (many more on opencart 1) , both setup take sagepay server payments, come light both sites sagepay payments failing when sagepay tries talk opencart give green light. means no failure email notification sent store owner, , sale cancelled @ sagepay? can imagine both store owners not happy. contacted sagepay see happening , told me payments failing below error, far sagepay concerned payments had passed tests, because calling website not send correct response sagepay, had cancel transactions! looking @ how sagepay works, seams sagepay returns autorisation opencart , opencart has whether going accept payment based upon being sent, , seams opencart 2 failing respond correctly? is yet oc2 bug? has come across , how put right one site on oc 2.0.2.0 , other 1 2.0.3.1 setup correctly in payment module , ip address logged sagepay etc.., problem after payment authorisation. transaction completed vendor systems returned invalid or error in r

How to mix class="form-horizontal" with ordinary form elements in a bootstrap form? -

how can mix class="form-horizontal" in single form form elements don't displayed horizontal? tag intended reside in <form> -tag according documentation . conflicting part (form-horizontal-tag conflicts rest of form: <form class="form-horizontal" role="form" action="/registrieren" method="post"> <div class="row"> <div class="col-md-2"> <label for="usr">surname:</label> <input type="text" class="form-control" id="vorname" name="vorname"> </div> <div class="col-md-2"> <label for="usr">name:</label> <input type="text" class="form-control" id="name" name="name"> </div> </div&