Posts

Showing posts from April, 2012

gtk - FileChooserButton behaviour -

i've been getting strange behaviour when connect selection_changed function in filechooserbutton. of so users understand selection_changed syntax. weird happening when use second time in same program. context my aim create window 2 filechooserbuttons , entry text @ end position of window. first filechooserbutton helps user pick directory , causes second filechooserbutton open @ directory user chose in first one. until point code working perfectly. entry drawn , says "here goes filename". intended behaviour change entry's text upon selection of filename in second filechooserbutton after checking whether file writable. the strategy used connect selection_changed function takes care of checking wether file writable , change of entry's text. the problem function never called. added debugging dumb code like: stdout.printf("checking whether function called") it never gets printed,thus suppose function never gets called. function in question fi

android - How can I call an URL when I use setContentView()? -

i developed simple game , want give external url web page. problem that, i'm using setcontentview in oncreate method of main activity. game content dynamic , cannot use intents instead of setcontentview. however, know, oncreate called once , way found on web call url "using intents". not working because setcontentview thing running. here codes: gameactivity.java private static gamecontent gamecontent; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); gamecontent = new gamecontent(this); setcontentview(gamecontent); } // on.c.ends my gamecontent class extends surfaceview , runnable. call draw(), pause() , resume() methods here. have class basicbutton , added gamecontent , draw it. works. here part want use: basicbutton.java @override public void update() { if (xx > (rate.getx()) && xx < (rate.getx() + rate.getplaybutton('x'))) if (yy > (rate.gety()) &&

linux - Getting number of pattern matches in VTE search -

i'm developing gtk+ 3.0 application uses vte widget, how can number of occurrences search regex or @ least current text in terminal , process that? i'm using vte 2.91 , vala. vte.terminal.get_text() visible text in terminal processing. i'm not sure that includes text that's scrolled off screen. you try vte.terminal.select_all() followed vte.terminal.copy_clipboard() , copied text off clipboard, i'm not sure work.

MySQL Order with decimals -

i've got problem mysql ordering. query: select * versions order version desc it lists of versions this: 25.0.1364.86 25.0.1364.124 23.0.1271.100 however .124 higher .86. how can fix it? a small improvement query posted @peterm (with thanks!) select * `versions` order 1*substring_index(version, '.', 1) asc, 1*substring_index(substring_index(version, '.', -3),'.', 1) asc, 1*substring_index(substring_index(version, '.', -2),'.', 1) asc, 1*substring_index(version, '.', -1) asc, version asc # sort non-numeric strings i tested more complicated values, letters, numbers, dashes , points, versions can written in format. | version | ----------- | a-b | | a-c | | ab | | b | | c | | c.a | | c.a.b | | c.b | | c.b.a | | c.b.b | | ca | | 1.2 | | 1.2.1 | | 2.1.1 | | 2.1.2 | | 3 | | 10 | | 123 |

html - CSS - Using Hover on elements inside a tag? -

i want use hover couple divs inside tag. for example here <a href="#"> <div class="nextmatch_wrap"> <div class="clan12w"> <div class="teamlogos"> <div class="team" id="teamcontainer"> <img src="#"> </div> </div> </div> <div class="clan12w"> <div class="teamlogos"> <div class="team" id="teamcontainer"> <img src="#"> </div> </div> </div> </div> if hover on tag want colored border appear on "teamcontainer" , "teamlogos" i'm not css have tried a nextmatch_wrap, :hover #teamcontainer, nextmatch_wrap, :hover .r-home-team{ border:solid 1px #25c2f5; } it works somehow hover on when mouse on anywhere in page when move mouse out of browser

vba - Two array element combination in vb -

Image
i want combine arrays in program. take example: a = {1,2,3,4,5} b = {6,7,8,9,10} this should produce array containing first element of first array elements of second array except first element, {1,7,8,9,10} . should continue possible combinations, producing these output arrays: {1,7,8,9,10} {6,2,8,9,10} {6,7,3,9,10} {6,7,8,4,10} {6,7,8,9,5}... for 2,3,4 elements of first array second array {1,2,8,9,10} {6,2,3,9,10} {6,7,3,4,10} {6,7,8,4,5} {1,7,8,9,5}... {1,7,3,9,10} {6,2,8,4,10} {6,7,3,9,5} {1,7,8,4,10}..... and vice versa second array. for first combination i've tried: for = 0 4 'first array loop j = 0 4 'second array loop if <> j arr(j) = arr2(j) else arr(j)=arr1(j) end if next next this give every combination possible: function fifth(paramarray arr() variant) variant() dim temp() variant dim long dim j long dim t long = lbound(arr) + 1 ubound(arr) if ubound

php - How to post data to my server after successfull twitter authentication -

i want implement twitter authentication on website same visitors comment on aljazeera.com . i'm using twitteraouth library in codeigniter framework , working fine can see twitter data after successfull authentication. what want add functionality users comment on post should stored on server twitter user_id.

qt - How to put files generated by CMAKE_AUTOMOC in specific folder -

i doing out of source build cmake. current folder structure: |_projectroot |_build |_src |_inc since using qt, cmakelists.txt file contains these line in order generate required ui_*.h , moc_*.h : set(cmake_automoc on) set(cmake_autorcc on) set(cmake_include_current_dir on) all ui_*.h , moc_*.h files put in projectroot\build default. is there chance can specify moc_*.h generated put under projectroot\moc , ui_*.h put under projectroot\ui . cmake has no option that.

syntax - What does the arrow ( -> ) between two types mean in Swift? -

while researching separate issue, came across question: how create generic closures in swift they have function definition this: func savewithcompletionobject(obj : anyobject, success : anyobject -> void, failure : void -> void) what -> in anyobject -> void mean? it’s function type . anyobject -> void type of function accepting anyobject , returning void .

reflection - Get function by name dynamically in Kotlin -

how can dynamically function name in kotlin ? i.e: fun myfunc11() { println("very useful function 11") } val funcname = "myfunc" + 11 val funcref = getfunction(funcname) funcref() edit: accepted answer appears correct, code hitting bug in kotlin. bug report submitted: https://youtrack.jetbrains.com/issue/kt-10690 the global functions such fun myfunc11() { ... } defined in file named i.e. global.kt compiled static methods on class named globalkt described in the documentation . to function reference name you'll need load class defines it. if know file name defines function reference you're trying find can do: fun getfunctionfromfile(filename: string, funcname: string): kfunction<*>? { val selfref = ::getfunctionfromfile val currentclass = selfref.javamethod!!.declaringclass val classdefiningfunctions = currentclass.classloader.loadclass("${filename}kt") val javamethod = classdefiningfunctions.me

list - Python in operator is not working -

when run code, nothing shows up. example call ind(1, [1, 2, 3]) , don't integer 13 . def ind(e, l): if (e in l == true): print('13') else: print('12') operator precedence. if put ( , ) around e in l work: def ind(e, l): if ((e in l) == true): print('13') else: print('12') ind(1, [1, 2, 3]) but testing true can done (and usual idiom) done without true def ind(e, l): if (e in l): print('13') else: print('12') ind(1, [1, 2, 3]) edit: bonus can use true , false keep/nullify things. example: def ind(e, l): print('13' * (e in l) or '12') ind(1, [1, 2, 3]) ind(4, [1, 2, 3]) and ouputs: 13 12 because e in l has first been evaluated true , 13 * true 13 . 2nd part of boolean expression not looked up. but when calling function 4 , following happens: `13` * (e in l) or '12` -> `13` * false or '12&

actionscript 3 - Detail lifespan of all ActionScript3 object -

i use actionscript3 develop web , mobile game. memory biggest enemy, don't know detail lifespan of objects. instance: bitmap know there "dispose" function of bitmapdata. always, dispose bitmap object using "bitmap.bitmapdata.dispose". however, wonder if reference of bitmap object becomes 0, gc free memory used object if don't call dispose function. i have many questions above (sound, texture, basetexture...). has ideas topic? the object's lifespan determined 1 single thing - if it's no longer referenced anywhere, it's considered dead (orphaned) , subject removed memory. yes, bitmapdata object removed memory without explicit dispose() call, if drop references it. about sound or texture objects - these best being reused, example, can call mysound.play() multiple times, generate separate soundchannel object lifetime duration of sound, if it's unreferenced. likewise can use same texture object have multiple instances of being

android - How 2 fragments communicate each other inside an activity -

this question has answer here: communicating between more 2 fragments 2 answers consider activity can call base activity. 2 fragments added base activity , call fragmentone , fragenttwo.how can fragmentone can communicate fragenttwo , vice versa . you can define interface communicate between fragments. go through link http://developer.android.com/training/basics/fragments/communicating.html hope helps.

android - AlertDialog not showing while cancelling AsyncTask -

i have got little problem while cancellling asynctask, in a fragment processes data. if internet session expired asynctask should cancelled , dialog shown inform user. however if cancel asynctask alertdialog not shown, noticed oncancelled() is not being called onpostexecute() is still executed. if pls assist? edit: if use while method, alertdialog shown how cancel asynctask code of try in doinbackground() still being executed? while (!iscancelled()) { // stuff } edit 2: solved! seemed asynctask call not correctly instinciated, below code works , oncancelled method called , onpostexecute declined should be. cudos anudeep bulla point me in right direction. public class tb3_abonnement extends fragment { private asynctask<void, void, void> task; ... @override // if fragment visible user, start asynctask public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (isvisibletouser) {

android - Animate marker movements along prepared coordinates. -

i need make animated movement if airplane marker along stored coordinates in arraylist collection. i've found solution, how move marker 1 coordinate another. here code of method, moves it: private void animatemarker(final marker plane, final latlng toposition, final boolean hidemarker, int currentindex) { final handler handler = new handler(); final long start = systemclock.uptimemillis(); projection proj = gmap.getprojection(); point startpoint = proj.toscreenlocation(plane.getposition()); final latlng startlatlng = proj.fromscreenlocation(startpoint); final long duration = 2500; final interpolator interpolator = new linearinterpolator(); handler.post(new runnable() { @override public void run() { long elapsed = systemclock.uptimemillis() - start; float t = interpolator.getinterpolation((float) elapsed / duration);

java mongodb 3.0: find value in internal array of documents -

i'm using java , mongodb v.3.0.7. have list of player internal array of games scores. test insert document: public void insertplayer(string id_device) throws parseexception{ dateformat format = new simpledateformat("yyyy-mm-dd't'hh:mm:ss'z'", locale.english); db.getcollection("player").insertone( new document() .append("nikname", "guest") .append("password", "guest") .append("my_id", "") .append("id_device", id_device) .append("language", "italian") .append("games", aslist( new document() .append("gamename", "ppa") .append("ban

android - Not able to add Intent to Google Maps inside ArrayAdapter -

i have code list items references , have address. need make such when item of list clicked, google maps navigation should launched corresponding address rowitem. btw address won't visible within row, address object row information taken. have tried code :- rowview.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { //intent intent = new intent(context,); //toast.maketext(context, "yeah boy", toast.length_short).show(); latlng tmp = objects.get(position).location; string uri = "http://maps.google.com/maps?saddr=" + location.getlatitude()+","+location.getlongitude()+"&daddr="+tmp.latitude+","+tmp.longitude; intent intent = new intent(android.content.intent.action_view, uri.parse(uri)); intent.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivity");

office365 - Integrate outlook 365 sign in in android application -

i working on android application sign in need sign in using outlook 365. have tried using google+ sign in , worked there no official documentation how integrate through outlook 365. can please ? you can refer following microsoft's official msdn documentation: understanding authentication office 365 apis in find sample project android @ github: office 365 connect sample android to learn more sample, visit our understanding code wiki page. if want use code sample in app, visit the using o365 android connect sample code in app . hope helps!

python - Running TensorFlow on a Slurm Cluster? -

i access computing cluster, 1 node 2 12-core cpus, running slurm workload manager . i run tensorflow on system unfortunately not able find information how or if possible. new far understand it, have run tensorflow creating slurm job , can not directly execute python/tensorflow via ssh. has idea, tutorial or kind of source on topic? it's relatively simple. under simplifying assumptions request 1 process per host, slurm provide information need in environment variables, slurm_procid, slurm_nprocs , slurm_nodelist. for example, can initialize task index, number of tasks , nodelist follows: from hostlist import expand_hostlist task_index = int( os.environ['slurm_procid'] ) n_tasks = int( os.environ['slurm_nprocs'] ) tf_hostlist = [ ("%s:22222" % host) host in expand_hostlist( os.environ['slurm_nodelist']) ] note slurm gives host list in compressed format (e.g., "myhost[11-99]"), need expand. mo

java - Custom collision shape for Buttons in JavaFX -

creating custom button shape done, how possible make sure new shape "collision box" of button itself? in case created 2 hexagnol shaped buttons , aligned them properly. problem collision box of buttons still rectangular , when move mouse upper button lower 1 notice collision box strictly rectangular , makes custom shapes kind of useless. any way create custom collision shapes or collision checks? full working example: import javafx.application.application; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.pane; import javafx.scene.shape.polygon; import javafx.stage.stage; public class test extends application { public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) throws exception { pane apane = new pane(); apane.setprefwidth(100); apane.setprefheight(100); apane.getchildren().add(createhexat(10, 10)); apane.

javascript - Sum Of count in D3 -

i have json data below. [ { "avg": 996.8, "sessions": [ { "mintime": 0, "maxtime": 599, "count": 10 }, { "mintime": 600, "maxtime": 1199, "count": 2 }, { "mintime": 1800, "maxtime": 2399, "count": 4 }, { "mintime": 2400, "maxtime": 2999, "count": 3 } ],"timestamp":1449360000}, { "avg": 986.4, "sessions": [ { "mintime": 0, "maxtime": 599, "count": 12 }, { "mintime": 600, "maxtime": 1199, "count": 1 }, { "mintime": 1200, "maxtime": 1799, "count": 2 },

java - How to get System Language? -

in application supporting multiple languages using locale.setdefault(newlocale); changing language there no way change language device default language. best way find device default language in settings programatically. check this: resources.getsystem().getconfiguration().locale.getlanguage();

iphone - MFMessageComposeViewController: How to restrict to send message as Cellular Message not as iMessage -

i use mfmesagecomposeviewcontroller send message creating problems me. when send message multiple recipients works fine whether imessages enable or disable settings. when send message single contact , and imessages enable settings gives me "delivery failed" in message app , show imessage . how can force mfmessagecomposeviewcontroller send cellular message. my code is: [[[mfmessagecomposeviewcontroller alloc] init] autorelease]; if ([mfmessagecomposeviewcontroller cansendtext]) { controller.body = @"sample text message"; controller.recipients = [nsarray arraywithobject:@"xxxxxxxxxxxx"]; controller.messagecomposedelegate = self; } in short - can't. if imessage enabled on device , recipient available imessage client, message sent imessage. behaviour defined ios itself, can't change it.

twitter bootstrap - A way to incorporate image responsive class in sphinx RST? -

so in using rst format sphinx , image can included webpage using: .. image:: images/pic.png :align: center but won't work responsive bootstrap class img-responsive required instead. there way work around this? @ moment solution writing html raw code: .. raw:: html <div class="container-fluid"> <div class="row"> <img src="images/pic.png" class="img-responsive"> </div> </div> but rather clumsy. there neater way handle this? i'm looking same thing , found question sadly no answers. after more searching, did come across sphinx extension: https://pypi.python.org/pypi/sphinxcontrib-css3image basically lets specify additional settings in new directive (based on image) use this: .. css3image:: /_images/foo.png :margin: 10px 10px 10px 10px :margin-left: 10px :margin-right: 10px :margin-top: 10px :border-radius: 10px :transform-origin: 10px 10px :transl

How do you select choices that is not inside a form using Python? -

i'd know how select option menu not inside form using mechanize? page i'm getting data, has selection option inside div , not on form <select name="name" onchange="somejavascript;"> <option value="-1">value -1</option> <option value="1">value 1</option> <option value="2">value 2</option> </select> # don't have page source. hope helps. html = """<select name="name" onchange="somejavascript;"> <option value="-1">value -1</option> <option value="1">value 1</option> <option value="2">value 2</option> </select>""" # work on string above forms = mechanize.parsestring(html, 'fake') # there 1 form here, form htmlform instance form = forms[0] control = form.controls[0] # select # values control 'name'

java - How to find if HL7 Segment has ended or not if Carriage return is not present -

i working on tool construct hl7 message in following way : message start : 0b segment end : od , message end : 1c0d so, here have reached far, able add ob , add 1c0d in end of hl7 message. able add od before @ end of segment. accomplishing of code check if character before segment name 0d or not. but issue if text in message ...pid| code add 0d before pid| not correct should check if start of segment or not. please if has worked on similar requirement. link code : arraylist sublist indexoutofbounds exception thanks in advance i had time @ problem. far understand, have piece of code generates hl7v2 segments , want create message following delimiters: segment delimiter: 0x0d (or 13 in ascii), carriage return. it's segment separator, per hl7v2 standard ; message start delimiter: 0x0b (ascii 11 - vertical tab); message finish delimiter: 0x1c0d. guess value supposed concatenation of 0x1c (ascii 28 - file separator) , 0x0d (ascii 13 - carriage return). wi

scala - Akka's actor based custom Event Bus implementation causes bottleneck -

i'm trying implement event bus (pub-sub) pattern on top of akka's actors model. "native" eventbus implementation doesn't meet of requirements (e.g. possibility of retaining last message in topic, it's specific mqtt protocol, i'm implementing message broker https://github.com/butaji/jetmq ). current interface of eventbus following: object bus { case class subscribe(topic: string, actor: actorref) case class unsubscribe(topic: string, actor: actorref) case class publish(topic: string, payload: any, retain: boolean = false) } and usage looks this: val system = actorsystem("system") val bus = system.actorof(props[mqtteventbus], name = "bus") val device1 = system.actorof(props(new deviceactor(bus))) val device2 = system.actorof(props(new deviceactor(bus))) all devices have reference single bus actor. bus actor responsible storing of state of subscriptions , topics (e.g. retain messages). device actors inside can de

subprocess - Python script, log to screen and to file -

i have script, , want put output on screen , log file. can me on how this? ps: don't mind debug lines plz thx #!/usr/bin/python import os import subprocess import sys import argparse subprocess import popen, pipe, call parser = argparse.argumentparser() parser.add_argument('-u', '--url', help=' add here url want use. example: www.google.com') parser.add_argument('-o', '--output', help=' add here output file logging') args = parser.parse_args() print args.url print args.output cmd1 = ("ping -c 4 "+args.url) cmd2 = cmd1, args.url print cmd2 print cmd1 p = subprocess.popen(cmd2, shell=true, stderr=subprocess.pipe) you can use logging module , communicate() method of subprocess process: import logging import argparse import subprocess def initlogging( args ): formatstring = '[%(levelname)s][%(asctime)s] : %(message)s' # specify format string loglevel = logging.info #

Unable to query d2rq ttl file from Jena -

i trying query d2rq-generated ttl file. following code snippet: modeld2rq m = new modeld2rq("file:c:\\users\\599782\\downloads\\d2rq-0.8.1\\northwind.ttl"); string sparql = "prefix vocab: <http://localhost:2020/resource/vocab/>" + "select ?firstname ?lastname where{"+ "?x vocab:employees_country 'usa'."+ "?x vocab:employees_firstname ?firstname."+ "?x vocab:employees_lastname ?lastname."+ "}"; query q = queryfactory.create(sparql); resultset rs = queryexecutionfactory.create(q, m).execselect(); resultsetformatter.out(system.out, rs, q); m.close(); and shows exception: exception in thread "main" java.lang.incompatibleclasschangeerror: class com.hp.hpl.jena.sparql.algebra.op.opproject not implement requested interface org.openjena.atlas.io.printable @ or

r - Record variable to a dummy variable using weekdays -

i have variable starting monday lists each date 1-7. want change weekday vs. weekend, 0-1 respectively create dummy variable. know how one, can't figure out how include 6 , 7 in iterations of code. for example, put following: flights$dayweek <-factor(ifelse(as.numeric(flights$dayweek)==6, 1,0)) my intent above code find anywhere says 6 & 7, replace 1 , else 0 variable dayweek in flights data set. problem above 6 , not 7. don't know how include 7 in data set. have tried: flights$dayweek <-factor(ifelse(as.numeric(flights$dayweek)==6:7, 1,0)) flights$dayweek <-factor(ifelse(as.numeric(flights$dayweek)==c(6,7), 1,0)) and have looked @ other common dummy variables topics, seem simple 1 0 male/female , know how that. greater 5 function? sample data below: schedtime carrier deptime dest distance date dayweek daymonth delay 1700 ru 1651 wer 213 1401 4 1 ontime 1800 ru 1402 ewr 199 1401 6 1 del

r - ggplot2: manually add a legend -

Image
how can map any (unrelated) legend existing ggplot? disclaimer: please don't hate me. know best way create legend 'ggplot2' map data right , 99% of time. here asking in general can give me legend want. as example have plot looks this: created code: set.seed(42) temp1 = cbind.data.frame(begin = rnorm(10, 0, 1), end = rnorm(10, 2, 1), y1 = 1:10, y2 = 1:10, id = as.character(1:10)) temp2 = cbind.data.frame(x = 0:2, y = 1:3*2) temp3 = cbind.data.frame(x = seq(0.5, 1.5, 0.33)) temp = c() plot1 = ggplot(data = temp, aes(x = x)) + geom_vline(data = temp3, aes(xintercept = x), color = "red", linetype = "longdash") + geom_segment(data = temp1, aes(y = y1, yend = y2, x = begin, xend = end, color = id)) + geom_point(data = temp2, aes(x = x, y = y), shape = 4, size = 4) + scale_color_discrete(guide = f) plot1 and want add legend contains: a red, longdashed vertical line called "l1" a black, solid horizontal line called "l

unix - imapsync - more messages on host 2 than shows in summary and host 1 -

i have used imapsync version 1.607. have 560 messages in inbox on host1 , empty (new) mailbox on host2. after synchronization summary 560 messages synchronized. when check on host2 see 600 messages, duplicates. there option awoid duplicated messages? imapsync can make duplicates several runs under circumstances, after second run @ least. see http://imapsync.lamiral.info/faq.d/faq.duplicates.txt but when imapsync makes duplicates duplicates messages, not few. wonder happen in case.

java - Change final value compiled by JIT -

i noticed strange thing after changing final field via reflection, method returning field time giving old value. suppose might because of jit compiler. here sample program: public class main { private static final main m = new main(); public static main getm() { return m; } public static void main(string args[]) throws exception { main m = getm(); int x = 0; for(int = 0;i<10000000;i++) { if(getm().equals(m)) x ++; } field f = main.class.getdeclaredfield("m"); f.setaccessible(true); removefinal(f); main main1 = new main(); f.set(null, main1); main main2 = (main) f.get(null); main main3 = getm(); system.out.println(main1.tostring()); system.out.println(main2.tostring()); system.out.println(main3.tostring()); } private static void removefinal(field field) throws nosuchfieldexception, illegalaccessexception { field modifiersfield = field.class.getdeclaredfield("modifiers"

Java Map Compute BiFunction Cannot Recognize Lambda Function -

Image
i learning map class in java , cannot manage compute method work. i found tutorial here demonstrate how can pass bifunction or lambda function compute, in way this: system.out.println(map.compute("a", (k, v) -> v == null ? 42 : v + 41)); the logic pretty straightforward, value key 'a', check if value null, set value 42, otherwise, existing value plus 41. however, when try run code in eclipse, complaining multiple markers @ line - v cannot resolved variable - syntax error, insert "assignmentoperator expression" complete assignment - v cannot resolved variable - syntax error on token ">", invalid ( - v cannot resolved variable - syntax error, insert ")" complete expression - k cannot resolved variable i pretty sure jre environment have been using java 8, , wondering if can here. did validation removing other java environments in eclipse , adding in system.out.println(system.getproperty("java.version"

nasm - Unable to do overlap block transfer in Assembly -

i have made program in assembly language(nasm) overlap block transfer i.e., if 1 of array contains '10, 20, 30, 40, 50'(without quotes) after overlapping of example 2 elements resulting array should contain '10, 20, 10, 20, 30, 40, 50'(without quotes). problem when display resultant array shows '10, 20, 10, 20, 30'(without quotes). unable figure out problem. below shown code. appreciated. %macro disp 2 ; display macro mov rax,1 mov rdi,1 mov rsi,%1 mov rdx,%2 syscall %endm %macro accept 2 ; accept data mov rax,0 mov rdi,0 mov rsi,%1 mov rdx,%2 syscall %endm global _start section .data ; data section arr db 10h,20h,30h,40h,50h msg1: db "",10,"input array is",10 len1: equ $-msg1 msg2: db "",10,"output array is",10 len2: equ $-msg2 msg3: db "enter number overlapped",10 len3: equ $-msg3 section .bss

knockout.js - knockout js ensuring one value is larger than another -

i have following business requirement: there 2 textboxes user needs input current age , retirement age. retirement age needs greater current age if user inputs retirement age that's less current age should update retirement age current age, , if user inputs current age greater retirement age retirement age must set current age. is there easy way using knockout js? i'm assuming i'll need computed observable both fields kind of backing store? heres starting point: http://jsfiddle.net/rvnhy/ js: var viewmodel = function() { this.currentage= ko.observable(32); this.retirementage = ko.observable(44); }; ko.applybindings(new viewmodel ()); html: <div class='liveexample'> <p>current age: <input data-bind='value: currentage' /></p> <p>retirement age: <input data-bind='value: retirementage' /></p> </div> yeah, want: function myviewmodel() { var self = thi

javascript - TinyMCE removes the ng-click event Angularjs -

editor.insertcontent("<a href=\"#\" ng-click=\"signup()\"> sign </a>"); this code line simple pluging tinymce editor. work problem. problem removes ng-click="signup()" like. in other words produce following content <a href="#"> sign </a> intead of <a href="#" ng-click="signup()"> sign </a> i full if me in case. want create small plugin tinymce insert above code line in correct way you need set ng-click valid tinymce attribute of a-tags. try setting: // valid_elements option defines elements remain in edited text when editor saves. valid_elements: "@[id|class|title|style]," + "a[name|href|target|title|alt|ng-click]," + "#p,blockquote,-ol,-ul,-li,br,img[src|height|width],-sub,-sup,-b,-i,-u," + "-span,hr",

objective c - What is causing this: Cannot jump from switch statement to this case label -

this question has answer here: defining block in switch statement results in compiler error 1 answer this switch statement getting errors on: switch (transaction.transactionstate) { case skpaymenttransactionstatepurchasing: // show wait view here statuslabel.text = @"processing..."; break; case skpaymenttransactionstatepurchased: [[skpaymentqueue defaultqueue] finishtransaction:transaction]; // remove wait view , unlock iclooud syncing statuslabel.text = @"done!"; nserror *error = nil; [sfhfkeychainutils storeusername:@"iapnoob01" andpassword:@"whatever" forservicename: kstoreddata updateexisting:yes error:&error]; // apply purchase action - hide lock overlay , [ostocklock

java - Would an assignment listed in the method cause a memory leak -

i know if possible resetting of amounts in populateresponse() can cause memory leak. class intent used process web service requests. understanding bigdecimal created @ (i) considered local object instance if call padamount() returns new bigdecimal , fall out of scope after method execution , marked gc. correct? public sampleresponse processrequest(samplerequest request){ bigdecimal amount = new bigdecimal("12.3000"); // pad //bigdecimal amount = new bigdecimal("12.35"); // not pad, return passed in amount return this.populateresponse(amount); } public sampleresponse populateresponse(bigdecimal amount){ bigdecimal finalamount = new bigdecimal(amount.tostring(), new mathcontext(21)); sampleresponse response = new sampleresponse(); response.setrespamount(finalamount.setscale(6, roundingmode.up).striptrailingzeros()); //(i) setting amount integer newscale = 2; bigdecimal paddedamount = t

c# - ListItem Background is not working on Chrome -

i want make image drop down in asp.net worked correctly in firefox , not working in ie , chrome . what's wrong code? searched in internet , tried many codes still it's not working. <body> <form id="form1" runat="server"> <div> <asp:dropdownlist id="drop" runat="server" width="100px"/> </div> </form> </body> and in .cs file protected void page_load(object sender, eventargs e) { loading(); } string imageurl; private void loading() { list<string> img = new list<string>() { "canada", "usa", "england", "spain", "india" }; drop.datasource = img; drop.databind(); (int = 0; < drop.items.count; i++) { switch (drop.items[i].text) { case "india": imageurl = "ima

iOS app written in swift is crashing when returning to a view -

i'm writing app loads options screen (scene 1) user fill in text fields segue new scene (scene 2). after user finished scene 2, user can click button segue them scene 1 fill out options again. on scene 1, i'm setting first text field become first responder keyboard automatically appears when view loads. override func viewdidload() { super.viewdidload() self.numeratorbegin.becomefirstresponder() // additional setup after loading view. } this works great when app loads. keyboard appears , cursor in numeratorbegin text field. however, when user finishes scene 2 , presses button go scene 1, app crashes. crash not occur when first responder not being set in viewdidload. debugger shows following line causing crash message thread 1: exc_bad_access(code=2, address=hexhere) class appdelegate: uiresponder, uiapplicationdelegate { the idea have numeratorbegin text field become first responder every time view loads. life of me can't discover why app crashing.

html - How to spread div verticaly to window size and center verticaly? -

so im trying center text div verticaly , spread window size responsive sizes. fiddle: https://jsfiddle.net/2b1wm0pv/ <div class="container"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="col-md-6 col-sm-6 col-xs-6"> <div class="error-number">404</div> </div> <div class="col-md-6 col-sm-6 col-xs-6"> <div class="error-small-title">error 404!</div> <div class="error-big-title">oooops, error has occured!</div> <div class="error-description">we sorry page looking not available anymore or have entered wrong address.</div> <div class="col-md-5 col-sm-5 col-xs-5"> <div class="row"> <div class="error-button"> <a href="#" class=&q

python - Reading a list from file, then writing in a loop to solve for math equation -

i have list in file made of numbers. i have command read number in list: but having error: typeerror: 'int' object not subscriptable which don't understand 'int' issue. with open('angles.txt', 'r') f: print('angle sine cosine tangent') number in f: degree= int(number) rad = math.radians(degree) sin = math.sin(rad) answer = degree[0] print(str(answer), end = '') print(format(math.sin(math.radians(rad)),'10.5f'),end='') print(format(math.cos(math.radians(rad)),'10.5f'),end='') print(format(math.tan(math.radians(rad)),'10.5f'),end='') i can answer specific question int type error. problem these 2 lines don't make sense python: degree = int(number) answer = degree[0] you're first defining degree integer, , trying access integer list! doesn't work.

mongodb - What does actually do static mapWith="mongo"? -

static mapwith = "mongo" i not clear means. according http://grails.github.io/grails-doc/3.0.x/ref/domain%20classes/mapwith.html mapwith purpose the mapwith static property adds ability control if domain class being persisted. examples class airport { static mapwith = "none" } i went through question remove simpledb mapwith meta programming in dev mode and got idea in grails application, static mapwith = "mongo" might using mongodb plugin. still not clear. went through these stackoverflow links : get mapwith static domain field value grailsdomainclass grails is possible in grails disable persistence of domain class dynamically inheritance migration mongodb postgresql groovy application in grails if want make fields non-persistent can use transient keyword this: class domainclass { static transients = ['field1', 'field2'] integer field1 integer field2 integer persistentfield1 i