Posts

Showing posts from January, 2014

python - PyQt on Android -

i'm working on pyqt now, , have create application on android, i've seen kivy library, it's crude. is there way run application on android made on pyqt? android not support pyqt4. pyqt5 supported(read this: https://groups.google.com/forum/#!topic/android-scripting/hubyuynm3z8 ). however, port application use pyside( https://pypi.python.org/pypi/pyside ). provides bindings qt4 platform. can use pyside-android( http://thp.io/2011/pyside-android/ ).

javascript - Animating different markers API V3 Google Maps -

i have got markers in map , wanted animate 1 or marker depending in 1 made "click". animation work last marker create , not others ones. tried make marker array same problem. here code: <script type="text/javascript"> var marker = null; var address = null; var altura = null; function codeaddress() { altura = document.getelementbyid('altura').value; address = document.getelementbyid('address').value + ' ' + altura ; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { map.setcenter(results[0].geometry.location); // marker marker = new google.maps.marker({ map: map, icon: document.getelementbyid('icono').value, position: results[0].geometry.location, animation: google.maps.animation.drop }); // animating listener google.maps.event.addlistener(marker, 'clic...

javascript - How do I integrate jasmine into mocha? -

i have large set of unit test written in jasmine-node node project. want use mocha expanded feature set i'm pretty in bed jasmine both style , extensive use of spies. have several helpers , custom code jasmine dependent. how can use jasmine-node or jasmine library framework while mocha testing engine? can 2 play nicely or have rewrite testing environment mocha, chai, , sinon? how can use jasmine-node or jasmine library framework while mocha testing engine? what? mean want code tests against jasmine , somehow run them in mocha? while i'm sure it's possible, sounds bizarre. for given suite of tests, it's 1 or other. have similar different apis have choose one. choosing both in single project poor judgement imho. other mocha's vastly superior async support, can't see how justify using both when closely related. it's going create confusing annoyance maintenance. suggestion: split project apart smaller, separate modules. can port each of...

ios - CAGradientLayer with Angle -

Image
i drawing cgpath not rectangle or square,and adding cgpath cashapelayer . cashapelayer 's frame getting cgpath using cgpathgetboundingbox(path) . rectangle or square. want set gradient color layer path not rectangle or square not spreading gradient color equally in whole cgpath . there way set gradient color cgpath or how can set gradient color angle? please refer screen shot understand situation. here white color indicates frame of cgpath , green colour, our drawn cgpath . @ bottom of cgpath can see white gradient colour not distributed equally in cgpath . the start , end points of linear gradient specified in points relative whole size of layer, (0,0) @ top left , (1,1) @ bottom right. therefore, make linear gradient @ angle, need set start , end points appropriately. example, if used (0,0) , (1,1) start , end points, gradient run top left bottom right, @ 45 degree angle. working out specific start , end points needs therefore matter of trigonometry. ...

multithreading - Are C++11 compilers allowed to introduce additional loads of atomic variables? -

in this answer , bdonlan states code similar following: int t; volatile int a, b; t = x; = t; b = t; may transformed compiler into: a = x; b = x; my question is, still allowed if x atomic variable relaxed loads, in following? atomic<int> x; int t; volatile int a, b; t = x.load(std::memory_order_relaxed); = t; b = t; assert(a == b); // hold? as title says, c++11 compilers allowed introduce additional loads of atomic variables? additional stores? the compiler allowed under as-if rule, load same memory location twice, compiler have show no other thread accessing same variable. either way, guaranteed a==b in example.

What is correct way to declare varbinary in SQL Server 2008? -

what correct way declare varbinary in sql server 2008? declaring this declare @binaryvalue varbinary(max) the correct way this: declare @binaryvalue varbinary(max) consider specifying length instead of max , if can.

php - Reorder the sequence of records in mysql -

how rearrange multiple records after deleting multiple records.my code deletes 1 record , rearrange records when delete multiple records,it cant reshuffle. this codes works great when delete 1 record not work multiple records, $sql="delete $user id='$id'"; $result=mysql_query($sql,$connection) or die(mysql_error()); $reorder = "update $user set id=id-1 id > $id"; $catch = mysql_query($reorder,$connection); you may need query for rows require reorder, re-order them calling update statement 1 @ time, careful set id='xx-1' id='xx'

plugins - Java semi-colon issue -

i getting annoying error when type line eclipse .java document on semi-colon: @override public void onenable() { plugindescriptionfile pdffile = this.getdescription(); this.logger.info(pdffile.getname() + " version " + pdffile.getversion() + (" has been enabled!"); } at end of (" has been enabled!") put necessary semi-colon, gets red line under issue: syntax error, insert ")" complete expression. however, a) cause troubles , b) when says, says it's still wrong , must finish semi-colon. try this this.logger.info(pdffile.getname() + " version " + pdffile.getversion() + " has been enabled!");

android - Posted tweet doesn't show on Twitter timeline -

i using edit text box , post button post tweets on twitter's timeline using app. but after processing "status updated successfully" toast appears, tweet not showing on timeline... gives error 400 in logcat , shows message bad authentication data!! new oauth . how can fix problem? here code: public class postcommentactivity extends activity { private static final string consumer_key = "*****"; private static final string consumer_secret = "*******"; static string preference_name = "twitter_oauth"; static final string pref_key_oauth_token = "oauth_token"; static final string pref_key_oauth_secret = "oauth_token_secret"; static final string pref_key_twitter_login = "istwitterlogedin"; sharedpreferences msharedpreferences; progressdialog pdialog; edittext et; button postbtn; twitter twitter; @override ...

javascript - JQuery smooth animation -

i have animation makes buttons on screen 'beat'. works fine exept 1 thing, animation 'sharp' , not smooth, how can smooth it? function myfunction() { setinterval(function () { tstfnc(); }, 1000); } var flag = true; function tstfnc() { var numm = math.floor((math.random() * 10) + 1); var stringm = '#mgf_main' + numm + ' img'; $(stringm).animate({ width: '80px', height: '80px' }, 150, function () { $(stringm).animate({ width: '68px', height: '68px' }, 150, function () { // nothing }); }); }; you can set easing property on animate options. http://api.jquery.com/animate/ http://easings.net/

performance - Benefits and trade offs for improving text search on small data in PostgreSQL -

i have 4 text columns of interest. each column 100 characters. the text in 3 of columns latin words. (the data biological catalog, , these names of things.) the data 500 rows. don't expect grow beyond 1000. a small number of users (under 10) have editing privileges add, update, , delete data. not expect these users put heavy load on database. so suggests pretty small data set consider. i need perform search on 4 columns rows @ least 1 column contains search text (case insensitive). query issued (and results served) via web application. i'm bit lost how approach it. postgresql offers few options improving text searching speed. possible options built postgresql i've been considering are don't try index @ all. use ilike , like on lower , or similar. (without index?) index pg_trgm improve search speed. assume need index concatenation somehow. full text searching. assume involve concatenating index also. unfortunately, i'm not familiar expected p...

c++ - Make HTTP POST request with a list of named parameters in Qt -

i need make http post request server qt application. the post request contain list of named values, i.e. key/value pairs. alphanumeric strings, can contain special characters such quotes, spaces, etc. what canonical way of doing type of post request in qt? qurl params; params.addqueryitem("key1", "value1"); params.addqueryitem("key2", "value2"); qurl resource("http://server.com/form.php"); qnetworkaccessmanager* manager = new qnetworkaccessmanager(this); connect(manager, signal(finished(qnetworkreply*)), this, slot(handleendofrequest(qnetworkreply*))); qnetworkrequest request(resource); //force content-type header request.setheader(qnetworkrequest::contenttypeheader, "application/x-www-form-urlencoded"); manager->post(request, params.encodedquery()); this code assumes current object qobject (passed parent qneworkaccessmanager , slots declaration)

java - Array is not displaying correct values -

i new java,i have created array accepts 8 values. it's working fine,also accepting values it's not displaying correct output on console,please me problem can ?? here's code, import java.util.*; public class array2 { public static void main(string []args) { scanner scan=new scanner(system.in); int[] nums=new int[8]; for(int count=0;count<8;count++) { nums[count]=scan.nextint(); } system.out.println(nums); } } use system.out.println(arrays.tostring(nums)); ( import java.util.arrays this) if system.out.println(nums); , print object reference array , not actual array elements. because array objects not override tostring() method, printed using default tostring() method object class , prints [class name]@[hashcode] of object instance.

html - jQuery SVG removeClass() -

ok after hours , hours trying figure out way this, have come nothing. knew need svg jquery plugin have , have gotten toggleclass() function work, i'm trying remove classes of group elements , add class group elements well: $('g').removeclass().addclass('slice'); i came upon line of code removeclass documentation on jquery site. ultimately desire have pie chart of skills when slice clicked, removed pie until slice clicked. once slice clicked previous slice returned pie , newly clicked slice pulled out. can see i'm getting @ checking out jsfiddle. i've managed slices pull out, i'm struggling getting them slide in when slice clicked. jsfiddle example: http://jsfiddle.net/jrjacobs24/bhwch/30/ i've been trying go throuh documentation keith wood's plugin here: http://keith-wood.name/svg.html#dom but haven't had luck. appreciated. let me know if vague or needs clarity. thank in advance! you should better consider .clicked...

sql - Webform : how to count and live display results -

update (that 1 works) <?php if (arg(0) == 'node' && is_numeric(arg(1))) { $nid = arg(1); $node = node_load($nid); if ($node->type == 'webform') { $count = db_result(db_query('select count(*) {webform_submissions} nid = %d', $nid)); $atelier_1 = "sources" ; $sql = "select count(*) {webform_submitted_data} data \"".$atelier_1."\" ;"; $count_atel_1 = db_result(db_query($sql)); } } echo $sql; echo $count_atel_1; ?> webform has been submitted <?php print $count ?> times. we'd use webform our students should register on workshops. the webform works great. we'd display live number of students register in on of workshops other should know if there remains possibilities of registration (each workshop can accept 20 students @ same time) i'm trying that doesn't work ($atelier_1 = "sources" ;) name of 1 workshop : <?php if (arg(0) == 'node...

c# - The wpf controls dose't displaying on the canvas -

i inheritance canvas control , create custom canvas class this: public class mycanvas:canvas { //this list contains shape visualcollection graphicslist; list<graphicsbase> clonegraphicslist; int c = 0; double deltax = 0; double deltay = 0; public mycanvas() :base() { graphicslist = new visualcollection(this); clonegraphicslist = new list<graphicsbase>(); } public visualcollection graphicslist { { return graphicslist; } set { graphicslist = value; } } protected override int visualchildrencount { { return graphicslist.count; } } protected override visual getvisualchild(int index) { if (index < 0 || index >= graphicslist.count) { throw new argumentoutofrangeexception("index"); } return graphicslist[index]; } ...

visual studio 2010 - How to implement a WM_LBUTTONCLICK event handler -

suppose have the copenglcontrol class derived cwnd , i'm customizing own purposes. want this: 1- add zoom tool toolbar button @ top of dialog. 2- after pressing toolbar button mentioned feature explained below gets enabled. 3- if user clicks left mouse button zoomed in factor of 2 , gltranslate position of user's click. 4-if user clicks right mouse button zoomed out factor of 0.5 , gltranslate position of user's click. 5-if user clicks toolbar button feature explained in 2 above steps gets disabled. you know want implement zoom tool in global mapper . i don't have problems implementing glscale or gltranslate . have problems mfc part. searching default message handlers, found have wm_lbuttondblclk , wm_lbuttondown , wm_lbuttonup , wm_rbuttondblclk , wm_rbuttondown , wm_rbuttonup not wm_lbuttonclk or wm_rbuttonclk ? even if had wm_lbuttonclk or wm_rbuttonclk , these event handlers enabled , active since creation of window until closing want the...

node.js - How to use node v0.10.5 runtime for Cloud9 IDE? -

i have installed cloud9 ide node v0.6.19. default node installed v0.11.5. when start simple script cloud9 (with node v0.6.19) uses version of node started cloud9 ide (v0.6.19). console.log('version: ' + process.version); logs v0.6.19 is there way can use different version of node? want use v0.11.5 application , v0.6.19 cloud9 ide. i'm using cloud9 ide on https://c9.io/ . wanted change version of node , found page, none of instructions helped. i'm posting solution future googler's. cloud9 has nvm node version manager pre-installed. these steps used change version of node runs when click "run" file. $ mkdir /home/ubuntu/.nvm/versions $ nvm install 0.12.0 $ nvm alias default 0.12.0 why mkdir? because nvm support "rudimentary" . anyway, that's worked me. you can confirm adding server.js file: console.log("node version: " + process.version) hope helps somebody.

javascript - JQX Grid Not working in chrome -

i used jqx grid widget.and through javascript i'm populating cell values.this works firefox.but not working in chrome.here code have used. var objcredit = jquery.parsejson(returntext); document.getelementbyid('txtcustnumber').value = objcredit.customerid; $('[id$=txtcustnumber]').text(objcredit.customerid); getcustomerdetails(); document.getelementbyid('cmbdoctype').value = '3'; ***documentgridcontainer.jqxgrid('setcellvalue', 0, 'amount', objcredit.amount);*** here grid definition. var source1 = { totalrecords: 5, unboundmode: true, datatype: "json", datafields: [ { name: 'lineid' }, { name: 'distcode' }, { name: 'distfinder' }, { name: 'distcodedesc' }, { name: 'revaccount' }, { name: 'revaccountfinder' }, ...

Why I get Null Pointer Exception in Android -

i facing issue of nullpointerexception . in app have 2 classes mainactivity , test . creating object main of mainactivity inside test class. when call display method of mainactivity inside test class main.display(); nullpointerexception . please check sample code below , recommend me changes doing wrong. public class mainactivity extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setrequestedorientation(activityinfo.screen_orientation_portrait); // fixed getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); // orientation setcontentview(r.layout.training_ten_position); test test = new test(10); } public mainactivity() { super(); } public void display() { } } public class test { . . . mainactivity main; public test(int ...

html - Submit form field values to a Javascript function -

i using buddy.com's api build mobile app web interface administrators , user creation. still in initial stages of project. the first page trying build user registration page website. page have form asking users username, password, email , other fields. i using javascript form page http://buddy.com/developers/#useraccount_profile_create the function is: function createuserwithname(); , has inputs. function looks this: function fixedencodeuricomponent (str) { return encodeuricomponent(str).replace(/[!'()*]/g, escape); } function createuserwithname(aname, anemail) { var finalurlstr = "https://webservice.buddyplatform.com/service/v1/buddyservice.ashx"; finalurlstr += "?useraccount_profile_create"; // api call finalurlstr += "&buddyapplicationname=" + fixedencodeuricomponent("<#buddy app name#>"); finalurlstr += "&buddyapplicationpassword=" + fixedencodeuricomponent("<#bu...

opengl - Generating a sphere manually -

in opengl (lwjgl java), using glu.sphere.sphere() can make easy generate sphere after tens of spheres 32x32 resolution, becomes slow. im thinking of using buffers send vertices+colors+normals+indices once , change them using opencl. question: if take origin (0,0,0) center of sphere, can choose normal equal vertex? example: north pole of sphere vertex=(0,1,0) can surface-normal (0,1,0) again? can same thing vertices? element array order if can make optimized? guessing triangle vertex can used many neighbour triangles. im begineer need pointer useage of efficient drawelementarray function , index array generation. note: im keeping cpu @ 1400mhz cant handle computing on host side , opengl not accept multi-threaded drawing of spheres. following valentin's suggestion, opened inside of glu , found drawing element element. use buffer generation. if (this.drawstyle == 100010) { gl11.glbegin(0); if (normals) gl11.glnormal3f(0.0f, 0.0f,...

jquery - masked input not working in android mobiles? -

i using digitalbush masked input jquery plugin . working fine in web browsers , iphone browser perfectly, not working android mobile devices. my issue : mask in input field _ - _ - ___. when type numbers 12345685555___- - example: http://rossbender.com/temp/mask.html any suggestions? how can solve this? thanks prasad. i resolved issue 3 actions, have fixed android 4.0+ phones: update masked-input @ least version 1.4 add type="tel" input, trigger phone keypad remove input's maxlength attribute or set value not interfere caret action, 20 .

shell - Escape UNIX character -

this should easy can't out of it: i need replace piece of text in .php file using unix command-line. using: sudo sed -i '' 's/string/replacement/g' /file.php (the quotes after -i needed because runs on mac os x) the string: ['password'] = ""; needs replaced by: ['password'] = "$pass"; $pass variable, gets filled in. i got like: sudo sed -i '' 's/[\'password\'] = ""\;/[\'password\'] = "$pass"\;/g' /file.php but i'm new unix don't know escape... what should changed? thanks! if want expand variable in sed, have use double quote, sed -i... "s/.../.../g" file that is, don't have escape single quotes, use group reference save typing. try: sudo sed -i '' "s/\(\['password'\] = \"\)\(\";\)/\1$pass\2/g" /file.php

android - ActivityInstrumentationTestCase2 - sendkeys -

i'm trying test application through activityinstrumentationtestcase2 . have few clickables in ui. use sendkeys(keyevent.keycode_dpad_down); sendkeys(keyevent.keycode_dpad_center); etc simulate keyevents on ui. the problem is app kinda slow whereas test case relatively fast. what's happening keyevents click/navigate wrong ui element , messes test case. is there other way of simulating keyevents tiny bit of delay ? i'm using thread.sleep(500) introduce minor delay. is there more elegant way of doing other using thread.sleep() ? note: aware of robotium , i'd appreciate if answers related android test framework. thanks. there sleep method in robotium, can replace thread.sleep with: solo.sleep(long ms); there way, uiautomator uses, i'm not sure, if it's safe , not cause freezing of ui: systemclock.sleep(long ms); you can use wait methods, if sure view going appear. take on robotium api , see else can useful you.

resourcemanager - Slurm: create a directory on all nodes -

i'm launching job parallel execution slurm. job needs directory structure exist in each node, if use mkdir in job script, directories created in first node. how can make sure directories created in nodes used job? i guess have answer myself. not perfect solution, worked in case enough. in job script used before real job starts: for node in $(scontrol show hostnames $slurm_nodelist) ; srun -n 1-1 -n 1 -w $node mkdir -p /directory/to/be/created done sleep 60 the node list in $slurm_nodelist abbreviated, scontrol statement full names. without sleep command had problems directory not existing, added safe. the problem need know directories need created in advance, possible in case, might more difficult in other circumstances.

visual c++ - How to change the size of activex control automatically? -

i wrote activex control showing images in richedit.what want control's size changes image in changes, control's size seems fixed, i've no idea how it.is there way reach that? change size of activex control's window setwindowpos call ioleinplacesite::onposrectchange on site object. [edited] apparently, perform above upon en_requestresize notification richedit. en_objectpositions looks relevant. try both , share result us.

How to connect to the Internet through a proxy? -

i have written below code access web page , run in ubuntu. how fix this? have tried suggested fixes on internet, still can't figure out solution. a 407 response means "proxy authentication required", described here . now appear setting proxy user , password in system properties, apparently not working. can think of couple of explanations: you setting properties late. properties read default proxyselector , authenticator initializing. if set them late, won't respected. try setting properties using -d... options. you using wrong proxy username , password. the proxy expecting proxy authentication details in different form being supplied. take @ headers in response failed request. there should "proxy-authenticate" header includes "challenge". if approach doesn't work, alternative implement proxy selection , authentication programatically implementing , registering own proxyselector , authenticator classes. ...

jquery - Can't make Bootstrap tooltip work when creating elements with javascript -

i'm pretty new jquery in particular , js in general, hope didn't make silly mistake. have following js code: var speechtext = "purpose of use:<br/>"; speechtext += "<script>$(function(){$(\".simple\").tooltip();});</script>"; speechtext += "<a href=\"#\" class=\"simple\" title=\"day day use\" data-placement=\"top\" data-toggle=\"tooltip\">simple use</a>"; speechelement.innerhtml = speechtext; this function changes content of element on html page. when calling function works, including displaying link "simple use", tooltip doesn't appear. tried writing exact thing on html document itself, , worked. missing? first, script tags inserted dom using innerhtml text, not execute. see can scripts inserted innerhtml . background on script tags, they're parsed on pageload default in synchronous manner meaning beginning earlier script t...

c++ - What is changelog.Debian.gz file during debian packaging? -

while packaging encountered following error dh_builddeb dpkg-deb: building package `remotedevicecontroller' in `../remotedevicecontroller_1.0-1_i386.deb'. dpkg-source -b remotedevicecontroller-1.0 dpkg-source: info: using source format `3.0 (quilt)' dpkg-source: error: unwanted binary file: debian/remotedevicecontroller/usr/share/doc/remotedevicecontroller/changelog.debian.gz dpkg-source: error: detected 1 unwanted binary file (add in debian/source/include-binaries allow inclusion). dpkg-buildpackage: error: dpkg-source -b remotedevicecontroller-1.0 gave error exit status 29 why file being created debian-helper , why again asking include in other directory? when packing in debian, inside project directory there's directory named debian , keep files regarding instructions of how pack software, relations other packages, etc. can call package control files . among them, there's 1 called changelog , looks this: mypackage (version-revision) unstable; ...

java - Advantages of Constructor Overloading -

i new java , trying learn subject, having previous programming exposure in html/css. have started herbert schildt , progressed through few pages. i unable understand exact advantages of constructor overloading. isn't easier overload methods using single constructor flexibility? if trying use constructor overloading use 1 object initialize another, there simpler ways it! benefits , in situation should use constructor overloading. constructor overloading useful simulate default values, or construct object existing instance (copy) here example: public class color { public int r, g, b, a; // base ctr public color(int r, int g, int b, int a) { this.r = r; this.g = g; this.b = b; this.a = a; } // base, default alpha=255 (opaque) public color(int r, int g, int b) { this(r, g, b, 255); } // ctr double values public color(double r, double g, double b, double a) { this((int) (r * 255)...

java - Reformatting source code with Text I/O -

i teaching myself programming java through textbook. exercise asks write program reformats entire source code file (using command line): from format (next-line brace style): public class test { public static void main(string[] args) { // statements } } to format (end-of-line brace style): public class test { public static void main(string[] args) { // statements } } here's code have far: import java.io.*; import java.util.*; public class fourteenpoint12 { public static void main(string[] args) throws ioexception { if (args.length != 2) { system.out.println ("usage: java fourteenpoint12 sourcefile targetfile"); system.exit(1); } file sourcefile = new file(args[0]); file targetfile = new file(args[1]); if (!sourcefile.exists()) { system.out.println("file not exist"); system.exit(2); } scanner input = new scanner(sourcefile); printw...

android - how to change image background via any file explorer -

i trying understand how change background image of application (not via eclipse) using file explorer in android(phone) , picking file.png saved background image in app following comments above: well, thing can think of (if understand correctly, want change background of application, via application - right?) set background theme.wallpaper. in other application, can set background differently , in base application, bg changed accordingly. asuming - pick file explorer, navigate .jpg, .png etc. file , set device's background. if application uses theme.wallpaper default application theme, changed, according background image you've set device. in simpler terms: 1. problem - want change background of application (yapp short), want achieve choosing picture application (let's gallery). 2. solution - thing can think of set desired image background device itself. in yapp you'll have theme.wallpaper set, use device's background to put code, here's sa...

Lithium PHP framework - How to run db transaction on mysql? -

i have been working on e-commerce website in php lithium framework, 1 upgraded cakephp, have use transaction operation on db in mysql. don't know how db transaction in php lithium framework. since lithium uses pdo, can pdo object , call begintransaction() method. $foo = app\models\foo::create(); $pdo = connections::get('default')->connection; $pdo->begintransaction(); $foo->bar = 'hello'; $foo->save(); $pdo->commit(); https://github.com/unionofrad/lithium/issues/1004#issuecomment-23690165 http://www.php.net/manual/en/pdo.begintransaction.php

editor - Android Studio Collapse definitions and methods -

how can collapse definitions , methods within android studio editor? visual studio has option on edit-->outlining , cannot find similar feature in android studio. sure feature exists. how can access android studio's outlining feature? it called folding in android studio. first make sure enabled in config (it should default). go file -> settings , under ide settings area find editor -> code folding , check show code folding outline . to collapse/expand items use code -> folding menu. edit: customize keyboard shortcuts these open settings ( file -> settings ) select keymap under ide settings . type folding search box (top right). setup keyboard shortcut various folding actions :)

android - Best solution to draw responsive areas on image -

Image
i'm wondering best solution result shown below. here i've found far: an imageview forest , transparent surfaceview (to handle touch) on draw rectangles? or... 1 surfaceview image set background , rectangles directly drawn on...? for 2 i've chosen relativelayout. which of 2 efficient , easiest do? or maybe there way haven't think about. in case advice, here tend to... i've implemented placing image in relativelayout (framelayout work too), , adding each outlined view programatically. if know x , y origin (perhaps ratio image) , size each area, can inflate each view/area (with black border, transparent center), make clickable , set listener, , set it's origin adjusting it's margins. may want perform of after image has finished laying out: i put in onactivitycreated of fragment , other lifecycle methods work too... viewtreeobserver vto = image.getviewtreeobserver(); vto.addongloballayoutlistener(new ongloballayoutlistener() { ...

javascript - jaydata not working in related data storage -

i new jaydata , learned through many tutorials , examples how define model , store data using jaydata. have written code store data on local storage , has 2 entities 1 many relation each other. have checked code many times , compared available example codes , right code not working. problem when push single entity array defined in other entity model, not save changes , if comment push line, works fine. have created jsfiddle , have commented line in js code. the code this: var task_entity = new tsk({task_work:tsk }); mydb.tasks.add(task_entity); var category_entity=new categry({name:ctgry}); category_entity.taskk=new array(); //category_entity.taskk.push(task_entity); // line not working mydb.categorys.add(category_entity); i have commented line creating problem here jsfiddle http://jsfiddle.net/zgqyz/1/ please let me know wrong code or may jaydata model, can't find main problem. only websql/sqlite supports navigation @ moment, change soon

sql - Take substring out of string -

this question has answer here: how substring of string in sql 2 answers i have key string like empl:9998 earn code:7704 seq:1 i need take employee number 9998 out of string. employee number start @ position 6 , end before second e . have been played around string function no success. use ms sql. the following statement this: select substring(empno, 6, charindex('e', empno, 6) - 6) (select 'empl:9998 earn code:7704 seq:1' empno) t; you might want -7 if don't want space in "number".

method resolution order - Python's document about MRO is wrong? -

i read doc today. there confused me. http://www.python.org/download/releases/2.3/mro/ in example prove mro of python 2.2 breaks monotonicity, >>> class a(object): pass >>> class b(object): pass >>> class c(object): pass >>> class d(object): pass >>> class e(object): pass >>> class k1(a,b,c): pass >>> class k2(d,b,e): pass >>> class k3(d,a): pass >>> class z(k1,k2,k3): pass i think result python 2.2 give linearizations z is: ['z', 'k1', 'c', 'k2', 'b', 'e', 'k3', 'd', 'a', 'object'] , however, doc gives l[z,p22] = z k1 k3 k2 d b c e o and doc said, example provided samuele pedroni in here , , samuele pedroni's answer same mine. is there missed? i think result python 2.2 give linearizations z is:['z', 'k1', 'c', 'k2', 'b', 'e', 'k3', 'd...

javascript - how can i disable closing of jquery mobile popup -

i use jquery mobile build web application. when use 'jquery mobile signin popup' in here: http://jquerymobile.com/demos/1.3.0-rc.1/docs/demos/widgets/popup/ and customize signin popup preloaded , user can unable close it. static form in html. because without popup or disappered popup, user's cant signin , cant use services. how can that?? thank time here signup popup's source. <a href="#popuplogin" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-icon="check" data-theme="a" data-transition="pop">sign in</a> <div data-role="popup" id="popuplogin" data-theme="a" class="ui-corner-all"> <form> <div style="padding:10px 20px;"> <h3>please sign in</h3> <label for="un" class="ui-hidden-accessible">user...

Showing different value in image with different color in Matlab -

Image
i working in matlab 2009. have array (say test) like: 0 0 0 0 1.2 1.2 1.4 1.6 1.2 1.3 1.3 1.7 this array represents image after performing few operations. i want same values represented in 1 color. pixels corresponding value 1.2 should represented in red color (while using imshow function). how can done? please help the function imagesc assign 1 color per value. the code a=[ 0 0 0 0 1.2 1.2 1.4 1.6 1.2 1.3 1.3 1.7]; imagesc(a); will produce

python - Disable user registration with django-social-auth -

i know if knows if there way make django-social-auth throw error if social account not associated site account , not register new user? you can make possible overriding pipeline setting 1 drops create_user entry (there's example in pipeline docs @ http://django-social-auth.readthedocs.org/en/latest/pipeline.html ). define setting: social_auth_pipeline = ( 'social_auth.backends.pipeline.social.social_auth_user', 'social_auth.backends.pipeline.social.associate_user', 'social_auth.backends.pipeline.social.load_extra_data', 'social_auth.backends.pipeline.user.update_user_details' ) also add own entry check you, this: def user_must_exists(user=none, *args, **kwargs): if user none: raise yourexceptionhere()

php - Big Data with cURL -

i own vps server, want server have big data 15k usernames. what need, send usernames curl request with: website.com/getaccount.php?username= every minute. so solution case .. don't want make cron because take 15k jobs , bad. in language optimize 15k users ? bash ? perl ? php ? , if can make separate files , each file content 5k users. please give me solution, alot .. if understand question correctly, want distribute big job using job server such gearman gearman extremely flexible, , can use batch process large number of jobs in parallel quickly. when comes language should use...i use whatever you're comfortable in. have processed large jobs ( much larger 1 described ) using bash + php in past. php has wrapper libraries can use things started pretty quickly. hope helps go in correct direction. suggested links: gearman php extension - quick start php daemon managing gearman workers basic gearman client , worker, submitting tasks

c# - Multiple Parameters in GridView with multiple DataKeyNames passing same value for all parameters -

i have gridview1 want populate gridview2 gridview1 declared so: <asp:gridview runat="server" id="gwdup" allowpaging="true" allowsorting="true" pagesize="15" datakeynames="caseid, column2, adate, adddate" autogeneratecolumns="false" datasourceid="sqldatasource1"` > <asp:commandfield showselectbutton="true" /> <asp:boundfield datafield="column1" headertext="possible duplicates" readonly="true" sortexpression="column1" /> <asp:boundfield datafield="caseid" headertext="caseid" sortexpression="caseid" /> <asp:boundfield datafield="column2" headertext="column2" sortexpression="column2" /> <asp:boundfield datafield="adate" headertext="adate" sortexpression="adate" /> <asp:boun...

Zend Framework 2 route overlap -

let's want user able access profile typing www.test.com/hisname i've added following route routes array in modules config file 'profile' => array( 'type' => 'segment', 'options' => array( 'route' => '/:user[/]', 'defaults' => array( 'controller' => 'user\controller\user', 'action' => 'profile' ) ) ), and works fine until want access page, example www.test.com/about has following, easy figure out, route 'about' => array( 'type' => 'segment', 'options' => array( 'route' => '/about[/]', 'defaults' => array( 'controller' => 'application\controller\i...

Rotate a control in android -

i create control signature of user , returns me bitmap signature , print receipt. so have activity supports portrait orientation , need when show signature control, in landscape mode. can´t use other activity because app ask login if user lost focus of first activity , need signature part of transaction. i don't know if can rotate controls simulate landscape orientation , didn't find information this. *i have show control in landscape , control use screen. hi may help... if want screen in portrait.. in manifest android:screenorientation="portrait" or in coding setrequestedorientation(activityinfo.screen_orientation_portrait); if want screen in landscape.. in manifest android:screenorientation="landscape" or in coding setrequestedorientation(activityinfo.screen_orientation_landscape); if activity don't want restart every time while changing orientation of mobile try below line in manifest.. <activity android:name=...

sql server - T-Sql condition check -

i have table there column called allocated_to . if there value in column, means status of row assigned otherwise unassigned . from search box sending 1 assigned , 0 unassigned. have 2 more similar checks pending , closed on column named signoff (type: int) . now have total of 9 search criteria 1. pending 2.closed 3. unassigned 4. assigned 5. pending + unassigned 6. pending + assigned 7. closed + unassigned 8. closed + assigned 9. records irrespective of statuses. so how add condition query. change in sp , sp , running. cant make huge change in query, making dynamic or whatsoever. i can give sample here , how query looks like: if some_condition begin select x,y,zfrom t1 join t2 on t1.a=t2.b isnull(signoff,0)=@paramforpendingandclosed end now add above 9 check in where, help?? please note: i can't take heavy alterations, need make in each , every if-else condition. query has 4-5 if else depending upon header condition, please not suggest me go dyn...

sql server - SQL-statement for two group-columns -

i have problem creating sql-statement sqlserver2008. have following data: city person priority ----------------------------------- linz mike 1 wien mike 1 linz tom 1 wien tom 1 linz john 1 linz sarah 2 this means persons mike , tom choose cities linz , wien priority 1. john chooses linz priority 1. sarah chooses linz priority 2. now want following output: cities persons priority ----------------------------------- linz, wien mike, tom 1 linz john 1 linz sarah 2 i have following sql-statement not expected result query john has entry wien priority 1. select (select stuff((select ', ' + d.city (select distinct d2.city dbo.dummytable d2 d2.priority = d1.priority) d xml path('')), 1, 2, '') ) cities, (select stuff((select ', ' + d.person (select distinct d2.person d...

apache - Reference: mod_rewrite, URL rewriting and "pretty links" explained -

"pretty links" requested topic, explained. mod_rewrite 1 way make "pretty links", it's complex , syntax terse, hard grok , documentation assumes level of proficiency in http. can explain in simple terms how "pretty links" work , how mod_rewrite can used create them? other common names, aliases, terms clean urls: restful urls, user-friendly urls, seo-friendly urls, slugging, mvc urls (probably misnomer) to understand mod_rewrite first need understand how web server works. web server responds http requests . http request @ basic level looks this: get /foo/bar.html http/1.1 this simple request of browser web server requesting url /foo/bar.html it. important stress not request file , requests arbitrary url. request may this: get /foo/bar?baz=42 http/1.1 this valid request url, , has more nothing files. the web server application listening on port, accepting http requests coming in on port , returning response. web server entirely...