Posts

Showing posts from April, 2013

extjs - Adding rows to grid -

i trying add rows grid. i saw example in docs: onaddrouteclick: function(){ // create model instance var rec = new kitchensink.model.grid.plant({ buying_vendor_id: 12, country_code: '1', route: 0 }); this.getstore().insert(0, rec); this.cellediting.starteditbyposition({ row: 0, column: 0 }); } but cant seem make work in code. this grid: onbtnroutessearchclick: function(button, e, options){ var me = this; var v_url = 'getroutes.jsp?' + ext.urlencode({'route_id': routeid, 'route_country_code' : routecountrycode , 'route_vendor_id' : routevendorid}); var newtab = ext.create('ext.panel.panel', { id: 'routes_pannel', title: 'routes', autoscroll: true, layout: { type: 'fit' }, closable: true, dockeditems: [ { xtype: 'toolbar',

javascript - Issue with jQuery and auto-resizing textarea -

i have textareaexpander jquery function working, i'm having 1 little issue it. when textarea large, removing text bottom of backspace or delete buttons causes focus move top of textarea, , cursor gets moved off screen. makes jarring edit large sections of text. how function auto-resize textarea, without jumping around , hiding cursor in situation? (function($) { // jquery plugin definition $.fn.textareaexpander = function(minheight, maxheight) { var hcheck = !($.browser.msie || $.browser.opera); // resize textarea function resizetextarea(e) { // event or initialize element? e = e.target || e; // find content length , box width var vlen = e.value.length, ewidth = e.offsetwidth; if (vlen != e.vallength || ewidth != e.boxwidth) { if (hcheck && (vlen < e.vallength || ewidth != e.boxwidth)) e.style.height = '0px'; var h = math.max(e.ex

php - Route fail to work after migrate and upgrade for ZF2 -

there 3 modules in app/modules/, named application, album, shop. want access each of these modules using hostanme/application, hostname/album, , hostname/shop. application modules, configuration is: 'router' => array( 'routes' => array( 'application' => array( 'type' => 'literal', 'options' => array( 'route' => '/application', 'defaults' => array( '__namespace__' => 'appliwcation\controller', 'controller' => 'index', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'segment',

javascript - Smooth scrolling page jump -

i need help. i tried make simple project on jsfiddle, can't work. http://jsfiddle.net/reuyp/2/ here's code html: <div id="img0"> <b class="i01">one</b> <b class="i02">two</b> <b class="i03">three</b> </div> <div style="width:200px; height:500px; background-color:red;" id="i01"></div> <br> <div style="width:200px; height:500px; background-color:blue;" id="i02"></div> <br> <div style="width:200px; height:500px; background-color:green;" id="i03"></div> <br> javascript: $(function(){ $('#img0 b').click(function(){ cl=$(this).attr('class') st=$('#'+cl+'').offset().top; $('body,html').animate({scrolltop: st}, 500); return false; }); }); what want when click on 1 of words, pag

mouseevent - VB.NET event listener for click outside a form -

in vb.net can add event listener clicking inside form, want program pick clicks outside form, when clicking elsewhere. possible? you talking global mouse hook, codeplex project globalmousekeyboardhook 1 of easier ways accomplish it.

Stop Ruby from Automatically Escaping Strings -

if have string "this \#test" , drop python shell, 'this \\#test' , behavior looking for. if drop ruby shell, "this #test" no indication backslash had been present. how make ruby string behave python, is, without automatically escaping # sign? using single quotes when dont want escape sequences interpreted. [1] pry(main)> 'this \#test' => "this \\#test" single quotes not string interpolation, if need both , can escape slash manually: [1] pry(main)> t = "test" ; "this \\##{t}" => "this \\#test"

Unable to click on button of a search result with Selenium / Python -

i'm using selenium , coding in python. i'm having trouble getting script click on first button ( id=ita_form_button_linkbutton_0 ), first available option , cheapest option. error message instead: attributeerror: 'webelement' object has no attribute 'send_click' this code have: element_result = ui.webdriverwait(driver, 60).until( lambda driver : driver.find_elements_by_css_selector("[id*=ita_form_button_linkbutton") ) element_result[0].send_click() the idea click on first available option (button) cheapest option, weirdly wouldn't click. guys know why? there send_keys , click in webelement , no send_click . replace following line: element_result[0].send_click() with: element_result[0].click()

node.js - AngularJS: Best way to handle data from socket with ng-repeat -

i quite new real-time data socket.io. trying figure out best way handle data coming in socket.io in angularjs ng-repeat? right have backend sending entire data structure every time there update it. but causing ng-repeat refresh in order display new data (if make modifications data on client side only, removed next time data sent backend). there better way this? should filter out data requires updating on backend , send front end instead of delivering entire data structure again? (but how apply in ng-repeat update data...) i tried using underscorejs extend method in frontend seems cause issues sorting of data in ng-repeat (orderby , filter both break). my specific use case dealing sports scores (several games (objects) in array), getting updates on data whether time changing in game, or scoring play. updates happening pretty every second. tapping specific api , grabbing data on specific refresh variable, sending front-end via socket. not ideal case use sockets really,

jquery - Highchart yAxis Values -

i have highchart bar chart mentioned below , displaying number values in yaxis according height of chart. how can add following values [0, 40, 80, 120, 160, 200] , replace auto populated values. $('#barchart').highcharts({ chart: { type: 'column', backgroundcolor:'rgba(255, 255, 255, 0.1)', height: 250 }, title: { text: '' }, subtitle: { text: '' }, xaxis: { categories: [ 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' ],

ipad - Can I build an app that runs on iOS 5.1 and iOS 7 in the respective native look & feel? -

Image
i have app targeted ipads, , want users able still use original ipads (ios 5.1). on other hand app should “native” ios 7 app when run on ios 7-device. when select sdkroot (base sdk) ios 7 , deployment target 6.0, app runs fine on both systems, showing respective & feel. since want app run on 5.1 also, set deployment target 5.1 (i copied iphoneos5.1.sdk xcode 5 according answers of this question ). app runs on 5.1, 6.0 , 7.0, (almost) looks ios 6 app on ios 7. this found when dealing compiler settings (depending on settings, app runs on ios version): so, possible: 1 app, native & feel on ios 5.1, ios 6 , ios 7? thanks help. it turned out ran installation/configuration problem adding iphoneos5.1.sdk xcode 5. when upgraded xcode 5.0.2, did not add sdk again , got requested: can set base sdk 7.0 , deployment target 5.1, native l&f on ios versions. i have make sure don’t use features introduced later 5.1 without checking os version (look here how che

android - Sliding the top layer of an activity when clicking a button -

please, suggest solution following scenario: when user clicks button, screen must slid right left , next screen must shown. background both screens same (it's image), , not slid, stays @ place. what can suggest? can use activities here, or there must fragments, or else? i found solution. created activity , in setcontentview() function set layout custom viewpager . in custom viewpager ontouchevent() , onintercepttouchevent() functions overriden , return false . screens implemented fragment s. when button clicked, viewpager's setcurrentitem() function called , corresponding screen shown (the viewpager object declared static , can called fragment). here example of using viewpager : http://www.javacodegeeks.com/2013/04/android-tutorial-using-the-viewpager.html , example of custom view pager, sliding disabled: https://stackoverflow.com/a/13437997/2346046

java - JPanel and JButton, cannot figure how to layout 2 simple buttons -

Image
i starting jpanel , trying put 2 simple buttons on frame, able put buttons not position them, here code: jframe frame = new jframe(); frame.setsize(500,500); frame.setdefaultcloseoperation(jframe.exit_on_close); jbutton = new jbutton("text"); jbutton but2 = new jbutton("list"); jpanel panel= new jpanel(new gridlayout(1, 2)); panel.setsize(100, 100); panel.add(but); panel.add(but2); frame.add(panel); frame.setvisible(true); and here sketch of want: look layout padding , borders solve this. import java.awt.*; import javax.swing.*; import javax.swing.border.emptyborder; class twobuttonlayout { public static void main(string[] args) { runnable r = new runnable() { @override public void run() { // adjust numbers need.. jpanel panel = new jpanel(new gridlayout(1, 2, 40, 40)); // adjust numbers need.. panel.setborder(new emptyborder(20

javascript - Jquery slider previous and next weird on double click -

i creating simple accordion using jquery, far looks acts weird on double click or if clicked more twice. instead of closing starts opening , closing depending how many times been clicked. thought implementing variable, if(!hasbeenclicked) not sure if work. wonder how prevent double clicks if clicked again on same option, close itself.`sliderclass : "scrollable", prevbutton : 'previous', nextbutton : 'next', duration : 5000, slidecount : 3, prevtext : 'previous', nexttext : 'next', clicktiming : 5000, initslider : function(sliderobject, direction, eventtype) { slidecount = this.slidecount; slidewidth = sliderobject.find('li:first-child').outerwidth(true); var lefval = slidewidth * slidecount; if (direction == 'moveleft') lefval = -lefval; if (sliderobject.attr("class").indexof("autoscroll") >= 0) { var all_classes = sliderobj

new to android - supporting Supporting Multiple Screens -

i have galaxy note 2, think considered large screen. when run app, want use activity_main.xml file in layout-large folder. not. used activity_main.xml in layout folder. here have tried: i create folder called layout-large under res directory. tree looks this: res layout--> activity_main.xml layout-large--> activity_main.xml i tried go through documentation, didn't find anything. placed code in manefest: <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" android:xlargescreens="true" /> the problem solved using new qualifiers defined in android docs here .

regex - PHP string how to extract part after pattem to a separate variable -

i have string collects 2 pieces of information. before slash search variable, , after page number. assume following: $search = "classic rock/8" should $searchvalue[0]='classic $searchvalue[1]='rock' $searchvalue[x]= etc... , $page=8 i tried few approaches, last 1 3 passes first removing after slash. $search=substr($search, 0, strpos($search, '/')); and separate $search values array. , go (a 3rd time!) , page variable deleting before slash. i know highly inefficient. there way these actions in 1 pass? thanks in advance! you can explode string twice , same results! $res = explode("/", $search); $page = $res[1]; //this page $searchvalues = explode(" ", $res[0]); //these results

html - Vertical Nav Menu Won't Hover -

i'm having trouble trying figure out why via mobile (iphone, ipad, etc.), sub-cateogories on nav menu won't open. have installed here: http://thebrlab.com/ugo-mozie/index.html here original example demo of nav menu http://thebrlab.com/ugo-mozie/menu.html (which works when tap headers on mobile) the reason won't work because device can't sense whether hovering on it. senses when touch , non-clickable seeing link goes remove href off tag , if want have pointing cursor (clickable content) add css rule: cursor: pointer; this way work on mobile , page won't keep refreshing when accidentally click it

php - Correct way to log from Entities and Repositories in Symfony2 -

what way log messages or errors entity or repository class in symfony2 architecture? in symfony1 use singleton kill puppies doing logger anywhere: sfcontext::getinstance()->getlogger() symfony2's container model stricter, great, how should 1 go logging non-container-aware classes? repos, guess can define them (all) services, dependency on logger, , go there. when have instance of entity class? historically i'd want put log message inside class methods, now? should pass logger (as parameter) every class method wants write log message? seems bit of overkill perhaps it's best practice? or looking @ wrong , entities or repos shouldn't writing log messages passing them controller handle? you should avoid putting business logic (even logging) inside entity model. as repositories, way described right one.

recursion - Counting Change in Scheme using a list of denominations -

i writing function count number of ways make change in scheme given list of denominations , amount. code follows, not work intended. should using cons instead of + operator? should third line down's base case empty list? (define (change k l) (cond ((= k 0) 1) ((or (< k 0) (null? l)) 0) (else (+ (change k (cdr l)) (change (- k (car l)) (cdr l)))))) test: (change 11 (list 1 5 10 25)) if returned value number forget cons , '() building output , , use car , cdr , null? processing input . other that, aware there's small mistake in last line of code, here's fixed version: (define (change k l) (cond ((= k 0) 1) ((or (< k 0) (null? l)) 0) (else (+ (change k (cdr l)) (change (- k (car l)) l))))) ; don't (cdr l) here now works expected: (change 11 (list 1 5 10 25)) => 4

c# - Casting to different types with the conditional operator -

i trying check whether object info either word.selection or word.document , use later in program. here getting trouble. object info; var doc = info word.document ? info word.document : info word.selection; //do doc.words; it returns error: type of conditional expression cannot determined because there no implicit conversion between 'microsoft.office.interop.word.document' , 'microsoft.office.interop.word.selection' i can't seem around error when use ?: operator 2 results must of same type. use standard if case: if(info word.document) { //your code } else { }

delphi - How to redirect large amount of output from command executed by CreateProcess? -

i need run sqlite backup command command line. don't want use "cmd /c". command is: sqlite3.exe mydb.db .dump > mydb.bak i not find example on shows how this. code have far, collected various posts this, incomplete: function startprocess(const acommandline: string; ashowwindow: boolean = true; awaitforfinish: boolean = false): integer; var commandline: string; startupinfo: tstartupinfo; processinformation: tprocessinformation; stdoutpiperead, stdoutpipewrite: thandle; handle: boolean; begin result := 0; fillchar(startupinfo, sizeof(tstartupinfo), 0); fillchar(processinformation, sizeof(tprocessinformation), 0); startupinfo.cb := sizeof(tstartupinfo); startupinfo.hstdinput := getstdhandle(std_input_handle); startupinfo.hstdoutput := stdoutpipewrite; startupinfo.hstderror := stdoutpipewrite; if not(ashowwindow) begin startupinfo.dwflags := startf_useshowwindow; startupinfo.wshowwindow := sw_shownormal; end

web services - Having Separate Certificates Running Under GlassFish 2 -

can please explain how can have more 1 x.509 certificates in glassfish application server? main challenge me glassfish uses 1 alias 's1as'. you can pull additional certificates external key files create sslcontext , sslsocketfactory , can feed external https calls. e.g.: keystore ckeystore = keystore.getinstance("pkcs12"); try (inputstream clientcertkeyinput = new fileinputstream("my.pfx")) { ckeystore.load(clientcertkeyinput, "password".tochararray()); } keymanagerfactory keymanagerfactory = keymanagerfactory.getinstance(keymanagerfactory.getdefaultalgorithm()); keymanagerfactory.init(ckeystore, "password".tochararray()); sslcontext sslctx = sslcontext.getinstance("tls"); sslctx.init(keymanagerfactory.getkeymanagers(), null, // default javax.net.ssl.truststore new securerandom()); sslsocketfactory sslsocketfactory = sslctx.getsocketfactory(); you may configure httpsurlconnect

javascript - Jquery: if link is clicked open pop up and close all current pop up which are open -

Image
i managed create jquery command opens pop ( .more-news ). in page there several links open different pop up's. pop has closing button, if user clicks on link opens pop overlay each other shown on image. avoid want jquery command if click link open pop first closes other open pop avoid overlay. any suggestions? post link open pop up: <article class="news-thumb"> <time>08/07/2013</time> <div class="news-info"> <img src="images/news/post-2.jpg" alt="#"> <h1>main title</h1> <p>lorem ipsum su madre. lorem ipsum su madre. lorem ipsum... </p> <a href="#" class="more-btn-2">read more <i class="sprites-more-news"></i></a> </div>

how to concatenate the numbers returned from python permutations()? -

i have following code generates 2-digit permutations in range 0-9: p = permutations(range(10), 2) which produces result this: (0, 1); (0, 2); (0, 3); (0, 4); (0, 5); (0, 6); (0, 7); (0, 8); (0, 9); (1, 0); (1, 2); (1, 3); (1, 4); (1, 5); (1, 6); (1, 7); (1, 8); (1, 9); (2, 0); (2, 1); (2, 3); (2, 4); (2, 5); (2, 6); (2, 7); (2, 8); (2, 9); (3, 0); (3, 1); (3, 2); (3, 4); (3, 5); (3, 6); (3, 7); (3, 8); (3, 9); (4, 0); (4, 1); (4, 2); (4, 3); (4, 5); (4, 6); (4, 7); (4, 8); (4, 9); (5, 0); (5, 1); (5, 2); (5, 3); (5, 4); (5, 6); (5, 7); (5, 8); (5, 9); (6, 0); (6, 1); (6, 2); (6, 3); (6, 4); (6, 5); (6, 7); (6, 8); (6, 9); (7, 0); (7, 1); (7, 2); (7, 3); (7, 4); (7, 5); (7, 6); (7, 8); (7, 9); (8, 0); (8, 1); (8, 2); (8, 3); (8, 4); (8, 5); (8, 6); (8, 7); (8, 9); (9, 0); (9, 1); (9, 2); (9, 3); (9, 4); (9, 5); (9, 6); (9, 7); (9, 8) what should output [01,02,03....98] , can element calling p[0]? just aggregate each result: p = permutations(range(10), 2) resu

c# - Oracle CLOB storing Arabic Numbers in form of '?' -

i working on desktop c# application. 1 of field of type clob . data enter assign in c# based variable upon storing value in oracle store number '?'. instance if string hiÛ±Û²Û³ , upon storing becomes hi??? it happening number, rest of text in arabic text saves fine. upon running query: select dump(content) mytable gives error: [err] ora-00932: inconsistent datatypes: expected - got clob below code insert clob public void insertclob(string sqlstatement, string str) { system.data.oracleclient.oracledatareader rstoracle = null; system.data.oracleclient.oraclecommand sqlcommandoracle = null; system.data.oracleclient.oracletransaction txn = null; system.data.oracleclient.oraclelob clob = null; try { if (sqlstatement.length > 0) { if (myconnection.state.tostring().equals("open")) {

compiler construction - Why does Xcode not find the headers in a folder reference? -

for example drag in folder " sharedclasses " shared source code files folder reference xcode. folder reference appears in project navigator , lists .h , .m files correctly. but xcode refuses import them. tried kinds of import: #import "utility.h" #import "sharedclasses/utility.h" #import <sharedclasses/utility.h> none of them work. folder reference exists , contains " utilities.h " xcode knows folder comes must looks inside it? because files in different folder project xcode not include in header search path. fix add entry user header search paths (select project, select build settings, filter "user header search paths", add value) in project points original folder reference. example in project i'm working on have code shared between several projects in workspace stored @ same folder level projects in folder named shared. user header search paths has following: $(project_dir)/../shared/mysharedcode/

MySQL error #1054 - Unknown column in 'Field List' -

whenever try input data tblorder error message #1054 - unknown column 'fk_customer_id' in 'field list'. have tried breaking code down , in doing found error repeated fk_customer_id , orderquantity whereas fk_dvd_id take single data entries. have tried dropping table , recreating it, have dropped database , recreated nothing works. far can tell code correct along spelling i'm stuck. my tblorder is- create table tblorder ( order_id int auto_increment not null, fk_customer_id int not null, fk_dvd_id int not null, orderdate datetime not null default now(), orderqantity int not null, primary key (order_id), foreign key (fk_customer_id) references tblcustomer (customer_id), foreign key (fk_dvd_id) references tbldvd (pk_id) ); the data trying put in is- insert tblorder (fk_customer_id, fk_dvd_id, orderquantity) values (1, 3, 2), (1, 5, 1), (1, 10, 4), (1, 15, 3), (2, 5, 4), (2, 17, 3), (3, 15, 1), (3, 16, 1), (3, 17, 1);

html - position: fixed (but when scrolled down to the fixed content) -

i have div has own module position. want make position fixed when scrolled content, means when see fixed content , scroll on full screen content automaticly fixes on side. when scroll again top fixed content gone. how should make css? thank you. you might want try jquery waypoints ( http://imakewebthings.com/jquery-waypoints/ ). don't think can achieve css alone because changing behavior based upon user interaction. you'll need javascript.

java - I cannot figure out why my collection is null at some points -

i adding dvds collection. , trying sort every time dvd added. keep getting error message: exception in thread "main" java.lang.nullpointerexception @ dvdcollection.adddvd(dvdcollection.java:44) could guys show me how fix it? public void adddvd (string title, string director, int year, double cost, boolean bluray) { if (count == collection.length) increasesize(); collection[count] = new dvd (title, director, year, cost, bluray); totalcost += cost; count++; if (count > 0) { int min; (int = 0; < collection.length - 1; i++) { min = i; (int j = + 1; j < collection.length; j ++) { if(collection[j].getdirector().compareto(collection[i].getdirector()) < 0) min = j; temp[min] = collection[min]; collection[min] = collection[j]; collection[j] = temp[min]; } } } }

Set Bing Maps Center in Windows 8 Store App using XAML C# -

i trying set center location on bing maps control in windows 8 store app using xaml/c#. came across articles explaining cannot use binding center property in xaml trying set in c#. using default windows 8 store app grid template in studio. <flipview x:name="flipview" automationproperties.automationid="itemsflipview" automationproperties.name="item details" tabindex="1" grid.rowspan="2" itemssource="{binding source={staticresource itemsviewsource}}"> <flipview.itemcontainerstyle> <style targettype="flipviewitem"> <setter property="margin" value="0,137,0,0"/> </style> </flipview.itemcontainerstyle> <flipview.itemtemplate> <datatemplate> <!-- usercontrol chosen templated item becau

multithreading - Python separate threads are killing the whole program -

so wrote script: def schedule_setup(): # kill old threads should exist global active active = false time.sleep(3) active = true global threadlist threadlist = [] try: sql = "select time_to_run time_table" cursor.execute(sql) results = cursor.fetchall() row in results: #row[0].strftime('%h:%m') t = threading.thread(target=th,args=(row[0].strftime('%h:%m'),)) t.start() threadlist.append(t) # join threads main memory #for count in threadlist: #count.join() sql = "update motor set update_schedule = 0" try: cursor.execute(sql) # commit changes in database db.commit() except: # rollback in case there error print "no worky" db.rollback() except: print "error: unable table data" it takes times setup on sql , creates scheduled event action. put in beginning thread "killer" active threads if ever

android - How to overwrite beta APK with a new version -

my app not yet published. have beta apk uploaded september 28. today want upload new one, upload goes fine, never shows current apk updated. no matter do, never see new uploaded version. what can't upload new apk , overwrite old one? i contacted support , said bug working fix.

c - Creating a Custom Array Size with Random Numbers -

i trying write function returns array of custom size , populated random numbers. whole code such: #include <stdio.h> #include <stdlib.h> #include <time.h> int check_error(int a); void initialize_array(int array[],int a); void print_array(int array[],int a); int replace(int array[],int i, int b, int c); int main(void) { int asize, array; printf("hello!\nplease enter size of array:\n"); scanf("%d", &asize); check_error(asize); while (check_error(asize)==0) { printf("invalid input! enter size of imput size again:\n"); scanf("%d", &asize); } if (check_error(asize)==1) { initialize_array(array, asize); } } int check_error(int a) { if (a> 0 && <= 100) return 1; else return 0; } void initialize_array(int array[], int a) { int i; srand(time(null)); for(i=0; < a; i++) {

c - Assembly operator AND -

in order continue this: debugging c program (int declaration) decided test more code , see how compiler reacts it. decided try 1 test local variables: #include <stdio.h> main() { int a,b,c,d,e,f,g; a=0xbeef; b=0xdead; c=0x12; d=0x65; e=0xfed; f=0xaa; g=0xfaceb00c; a=a+b; printf("%d",a); } ok did int a,b,c... test main's frame size , see sub $0x10,%esp growing up, (i'm under linux why maybe sub), sub $0x30,%esp here the gdb output "disas main" command: 0x0804841c <+0>: push %ebp 0x0804841d <+1>: mov %esp,%ebp 0x0804841f <+3>: , $0xfffffff0,%esp 0x08048422 <+6>: sub $0x30,%esp ;7 int vars 4-byte 7*4=28. 30 enough 0x08048425 <+9>: movl $0xbeef,0x14(%esp) 0x0804842d <+17>: movl $0xdead,0x18(%esp) 0x08048435 <+25>: movl $0x12,0x1c(%esp) 0x0804843d <+33>: movl $0x65,0x20(%esp) 0x08048445 <+41>: movl $0xfed,0x24(%esp) 0x

arm - How to load register with predefined bytes in Assembly -

using arm assembly, want load r0 predefined bytes a, b, c, d. in .data section have them defined as: a: .byte 0xff b: .byte 0xaa c: .byte 0x88 d: .byte 0x77 i want r0 ffaa8877 when said , done. not sure should using .byte or .word or else a, b, c, d. edit: here i'm trying r0: @on entry: r0 holds word swapped @on exit: r0 holds swapped word, r1 destroyed @r0 = a, b, c, d byteswap: eor r1, r0, r0, ror #16 bic r1, r1, #0xff0000 mov r0, r0, ror #8 eor r0, r0, r1, lsr #8 here shortcut. ldr r0,=0xffaa8877 or can same thing manually... ldr r0,my_number ... my_number: .word 0xffaa8877

linked list - unable to modify global variable in c -

i'm learning c, , in program i'm trying implement simple linked list. each node of list contains integer, , pointer next node. pointer head points first node in list, list empty, initialized head = null . i want 2 operations on list - populate it, , print it. to populate list, i'm calling function insert_node 2 arguments: head , , integer want insert. the problem need function insert_node change value of head (so points updated list, instead of null). i'm not sure how that, made head global variable, , i'm trying change value. reason, though value of head changed inside function insert_node , when call function again, head still has value of null. questions: why global variable value not changed globally? i'm aware using global variables not practice, how can update pointer list? thinking having insert_node function return pointer list, way? #include<stdio.h> #include<stdlib.h> struct node { int data; struct node *

c++ - SFML 2.1 program runs fine in debug mode, but crashes in release mode -

i using qt creator sfml project. problem experiencing application crash on line of code only if running in release mode. i've stripped down application find exact line of code causing problem. here entire program looks like: works in debug mode; crashes in release mode #include <sfml/graphics.hpp> int main() { sf::renderwindow window(sf::videomode(800, 600), "sfml worked!"); window.setverticalsyncenabled(true); sf::shader shader; shader.loadfromfile("data\\shaders\\horizontalblur.frag", sf::shader::fragment); return 0; } if remove loadfromfile code, run fine in both debug , release modes. works in debug mode; works in release mode #include <sfml/graphics.hpp> int main() { sf::renderwindow window(sf::videomode(800, 600), "sfml worked!"); window.setverticalsyncenabled(true); sf::shader shader; //shader.loadfromfile("data\\shaders\\horizontalblur.frag", sf::shader::fragment

javascript - Rich text editor replacement for html textarea -

are there rich text editors out there can form simple html textarea? ex. <textarea></textarea> nicedit , jhtmlarea choices if users going paste rich text box supports microsoft word pasting well. prefer nicedit. ckeditor , tinymce full alternatives html editing, , prefer ckeditor. update: guardian made nice 1 called scribe . and of them, can choose buttons appear.

Python Cmd/Powershell error "Traceback (Most recent call last)" -

i giving @ " learn python hard way " tutorial , when told me try out typing python in powershell after installed kept giving me this: ps c:\users\zach> python traceback (most recent call last): file "c:\python27\lib\site.py", line 548, in <module> main() file "c:\python27\lib\site.py", line 530, in main known_paths = addusersitepackages(known_paths) file "c:\python27\lib\site.py", line 266, in addusersitepackages user_site = getusersitepackages() file "c:\python27\lib\site.py", line 241, in getusersitepackages user_base = getuserbase() # set user_base file "c:\python27\lib\site.py", line 231, in getuserbase user_base = get_config_var('userbase') file "c:\python27\lib\sysconfig.py", line 516, in get_config_var return get_config_vars().get(name) file "c:\python27\lib\sysconfig.py", line 449, in get_config_vars import re file "c:\python27\lib\re.py", line 105, in <module>

regex - Find the regular expression for the language on E={a,b} -

l = w : (na(w) - nb(w)) mod 3 /= 0 how can go finding regular expression language? i understand means number of minus number of bs cannot multiple of 3. - b cannot 3,6,9,12, etc. but still having trouble putting regular expression. tried first making dfa or nfa couldn't either. any appreciated! i go dividing list of words on {a,b} 3 cases: l1 = w : (na(w) - nb(w)) mod 3 = 1 l2 = w : (na(w) - nb(w)) mod 3 = 2 l3 = w : (na(w) - nb(w)) mod 3 = 3 l l1 u l2 , , should able create expressions relating l1, l2, , l3. should able eliminate things , end regular expression on {a,b}.

python - BeautifulSoup4 - All links within 1 div on multiple pages -

for schoolproject need scrape 'job-finding' website , store in db, , later match these profiles companies searching people. on particular site, url's pages need scrape in 1 div (with 10 links per page) div called 'primaryresults' has 10 in it. with beautifulsoup wish first scrape links in array looping through page number in url until 404 or similar pops up. then go through each of these pages, , store information need each page array , lastly send db. now i'm getting stuck @ part collect 10 links id = 'primaryresults' div. how go , put python make store 10 url's array? far have tried this: import urllib2 beautifulsoup import beautifulsoup opener = urllib2.build_opener() opener.addheaders = [("user-agent", "mozilla/5.0")] url = ("http://jobsearch.monsterboard.nl/browse/") content = opener.open(url).read() soup = beautifulsoup(content) soup.find(id="primaryresults") print soup.find_all('

javascript - How can I efficiently move from a Pandas dataframe to JSON -

i've started using pandas aggregation date. goal count of instances of measurement occur on particular day, , represent in d3 . illustrate workflow, have queryset (from django ) looks this: queryset = [{'created':"05-16-13", 'counter':1, 'id':13}, {'created':"05-16-13", 'counter':1, 'id':34}, {'created':"05-17-13", 'counter':1, 'id':12}, {'created':"05-16-13", 'counter':1, 'id':7}, {'created':"05-18-13", 'counter':1, 'id':6}] i make dataframe in pandas , aggregate measure 'counter' day created: import pandas pd queryset_df = pd.dataframe.from_records(queryset).set_index('id') aggregated_df = queryset_df.groupby('created').sum() this gives me dataframe this: counter created 05-16-13 3 05-17-13 1 05-18-13 1 as i'm using d3 thought

javascript - Meteor Reference Error -

i'm new programming , hoping if me figure out problem app. here link repo in github . the error: w202306-18:14:53.145(-4)? (stderr) /users/ed/apptest/.meteor/local/build/programs/server/boot.js:184 w202306-18:14:53.146(-4)? (stderr) }).run(); w202306-18:14:53.146(-4)? (stderr) ^ w202306-18:14:53.147(-4)? (stderr) referenceerror: require not defined w202306-18:14:53.148(-4)? (stderr) @ app/node_modules/stripe/test/charges.js:1:47 w202306-18:14:53.148(-4)? (stderr) @ app/node_modules/stripe/test/charges.js:65:3 w202306-18:14:53.149(-4)? (stderr) @ mains (/users/ed/apptest/.meteor/local/build/programs/server/boot.js:153:10) w202306-18:14:53.149(-4)? (stderr) @ array.foreach (native) w202306-18:14:53.149(-4)? (stderr) @ function._.each._.foreach (/users/ed/.meteor/tools/3cba50c44a/lib/node_modules/underscore/underscore.js:79:11) w202306-18:14:53.150(-4)? (stderr) @ /users/ed/apptest/.meteor/local/build/programs/server/boot.js:80:5 => exited code: 1

sql - Why does SELECT 'a'='b'='c' return 1 in MYSQL? -

i doing homework security class involving sql injections. found shorter sql injection typical ' or '1'=1 example. instead '=' . typing in password field of typical login boxes gives sql query this: select * users username='user' , password=''=''; it turns out password=''='' evaluates 1 , allowing sql injection work. after doing more testing, saw if test if string equal 0, returns 1: select 0='a'; so in example, password='' evaluate 0 , 0='' end evaluating 1. my testing showed me how happening, want know why happens (i.e why 0='a' true?. as documented under type conversion in expression evaluation , comparisons between string , integer performed numerically: in other cases, arguments compared floating-point (real) numbers. therefore, operands converted floating-point numbers , compared. conversion of string float consider every numeric character (an

ruby - using a string (from gets) directly as a variable name -

starting out towers of hanoi assignment, have a = [6,5,4,3,2,1] b = [] c = [] puts "type a, b, or c" = gets.chomp # user types lower-case popped = from.pop now fails because pop not string method. so other than if == popped = a.pop elsif == b popped = b.pop , there nice ruby shortcut pop intend? you can use eval : a = [6,5,4,3,2,1] b = [] c = [] puts "type a, b, or c" = gets.chomp popped = eval(from).pop but eval typically seen bad idea security, performance, , debugging reasons.

php - How to get the tags associated to an article in Joomla -

i need tags associated article in joomla 3.1.5 i have tried following not return string: echo $article->item->tags->itemtags; and $tags = $article->get("tags"); and record loading article info such (getting article title works perfectly) $article = jtable::getinstance("content"); $article->load(jrequest::getint("id")); $pagetitle = $article->get("title"); $user =& jfactory::getuser(); if in components/com_content/views/article/tmpl/default.php , tags being displayed so: if ($this->params->get('show_tags', 1) && !empty($this->item->tags->itemtags)) { $this->item->taglayout = new jlayoutfile('joomla.content.tags'); echo $this->item->taglayout->render($this->item->tags->itemtags); } so can base on this: hope helps

sql - Transaction Isolation and many statement request -

if use serializable transaction isolation level , run sql query like: create database new_db; use new_db; create table persons ( personid int, lastname varchar(255), firstname varchar(255), address varchar(255), city varchar(255) ); will use new_db fail create database new_db statement still not commited database? create database not allowed in transaction. see here . if script wrapped in explicit transaction, throw error on create database new_db

android - Stop apps to get my SharedPreferences -

i'm using sharedpreferences save login info used httppost requests. the problem use directly data authenticate users php, if create app steal app users sharedpreferences(username, password), how can stop him? your shared preferences placed on internal storage default. private app. other apps cannot access preferences file. exception if user has rooted device , runs other app superuser privileges.

expire session when there is no activity in PHP -

i found many tutorials on internet when expire session after limit, after 30 minutes or so, want expire session when there no activity, quoting famous question the solution straight forward: if (isset($_session['last_activity']) && (time() - $_session['last_activity'] > 1800)) { // last request more 30 minutes ago session_unset(); // unset $_session variable run-time session_destroy(); // destroy session data in storage } $_session['last_activity'] = time(); // update last activity time stamp but have update $_session['last_activity'] on each request? the pre-assumed answer yes, have big site containing 200+ php pages , it's hectic update $_session['last_activity'] on each request. is there other way of doing this? common thing among files 1 config file db connection. you update $_session['last_activity'] (eg) once per minute session not destroyed after 30 min