Posts

Showing posts from April, 2015

javascript - CSS3 keyframes - changing animation duration causes "jumps" -

you can see what's happening here http://goo.gl/bbmx6x (it's fiddle, wouldn't allow me post without having c&p code) click on start, wait couple of seconds , press stop.. jumps to(i think) position have been if had lower duration beginning. what i'm trying have spinning , on stop "finish" spin little faster.. that not posible way trying. (and reason guess) you have calculate in javascript way second animation has begin. webkit demo the script is $(document).ready(function() { $(".start").click(function(e) { e.preventdefault(); var elem = document.getelementbyid('idtest'); elem.style["-webkit-animation"] = ""; elem.style["-webkit-animation-delay"] = ""; $("#idtest").removeclass("spin2").addclass("spin"); }); $(".stop").click(function(e) { e.preventdefault(); stopping

How can I get erlang crash dump file? -

my program crashes during execution , writes segmentation fault (core dumped) on console. there no generated files in current working directory. question can find generated crash dump file? i'm using ubuntu 13.04 / erlang r15b01 a linux core dump , erlang crash dump not same thing. if you're getting segmentation fault , can't locate core dump, need check os configuration. "cat /proc/sys/kernel/core_pattern" see linux wants write core file, check that directory exists , writable you, , of course check ulimit set produce dump.

system verilog - Copy a packed array to unpacked array -

i wrote code copying packed array unpacked array below: module m1; bit [2:0] temp; bit temp1[2:0]; initial begin temp=3'b011; temp1='{temp}; end endmodule but showing error: "too few assignment pattern items given assignment" solution please. packed array , unpacked array different data structure, cannot directly assigned type. using assignment pattern array must either positional based or index based. example, temp1 = '{temp[2], temp[1], temp[0]}; the solution using streaming operator @ lhs of assignment. {>>{temp1}} = temp;

Heroku PHP mcrypt not found -

yesterday, able push without problems, today, framework ( laravel 4 ) detects there not anymore mcrypt on heroku cedar app. do have information me ? i tryed add php.ini @ root of project with extension_dir = "/app/www/ext/" extension=mcrypt.so and download archive https://s3.amazonaws.com/heroku-buildpack-php-tyler/libmcrypt-2.5.8.tar.gz , took libmcrypt.so.4.4.8 file, renammed mcrypt.so , put in ext folder @ root of application. thanks in advance. here's quick fix: fork official default heroku php build pack (github.com/heroku/heroku-buildpack-php), , revert couple commits (i did here.. https://github.com/jdomonell/heroku-buildpack-php.git ). then set buildpack app (i used own downgraded repo, feel free use too): $ heroku config:add buildpack_url= https://github.com/jdomonell/heroku-buildpack-php.git the issue caused recent update uses php_version="5.3.27" (instead of php_version="5.3.10") ... doesn't seem includ

bitmap - How to create resizable ImageView in Android -

Image
i want user of app able modify image @ run time. user should able modify image height , width tapping on corner of image-view , dragging illustrated in following diagram: i have spent lot of time researching , found making sense of multitouch , resize large bitmap file scaled output file pinch zoom none of these quite match requirements. currently resizing bitmap using below finction , changing width in onprogress change method of seekbar instead of frame. using function changing image size not working smooth. public static bitmap decodefile(file f,int width,int hight){ try { //decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodestream(new fileinputstream(f),null,o); //the new size want scale final int required_width=width; final int required_hight=hight; //find correct scale value. should power of 2. int scale=1; w

linux - Check if a function exists before executing it in shell -

i want check if function exist or not before executing in shell script. does script shell support that? , how it? as read in this comment , should make it: type -t function_name this returns function if function. test $ type -t f_test $ $ f_test () { echo "hello"; } $ type -t f_test function note type provides informations: $ type -t ls alias $ type -t echo builtin

Getting "OperationalError: 1366" from python script - MySQL 5.6 . MySQLdb 1.2.3 -

environment: mysql-python-1.2.3.win-amd64-py2.7 python-2.7.amd64 mysql-installer-community-5.6.12.2 windows server 2008 r2 datacenter i getting operational error 1366 when inserting data python script. need run epfimporter 2010 i think problem mysqldb can handle uft8 not utf8mb4_unicode_ci . data need import contains utf8mb4 charackters , may not remove them. running script cmd comand line gives me following error message after succesfully inserted ~70.000 rows: 2013-07-31 15:14:53,460 [error]: fatal error encountered while ingesting 'c:\webserver\www\site1\assets\scripts traceback (most recent call last): file "c:\webserver\www\site1\assets\scripts\epfimporter\epfingester.py", line 129, in ingestfull self._populatetable(self.tmptablename, skipkeyviolators=skipkeyviolators) file "c:\webserver\www\site1\assets\scripts\epfimporter\epfingester.py", line 379, in _populatetable cur.execute(exstr) file "c:\windows\python\lib\sit

javascript - Is there any CallBack function which is called before/after data is loaded in Angular Js ng-Grid? -

Image
presently have angular js grid pagination enabled 5 records per page example , total number of records 2000, there going 400 pages in all. when pagination in ng-grid handled gridoption data specified per page means 1st page gridoption 1-5 rows 2nd 6-10 rows , on........ here have implemented selection functionality through checkboxes whenever row selected[checkbox becomes selected] , it's stored in selecteditems array , show selected items in grid this..... now when move on second page[pagination] , select further rows ... the real trouble lies here when again go previous page i.e page 1 checkboxes not checked because in pagination load data runtime pages shows following result... hope must have understood problem.... what need here callback before/after data loaded can select checkboxes have number of selection preserved or other workaround problem helpful too. thanks!. can store checked value on data model storing row values? come , checked angu

c++ - How to use Boost headers with Jetbrains Appcode -

Image
i have boost libraries installed on macbook via macports , wondering how configure appcode recognize headers. tried right clicking on project -> add frameworks , libraries -> other... -> browse /opt/local/include -> choose doesn't seem add boost list. has gotten boost work appcode? in case else stumbles upon via google: there 3 steps involved: right click on project , choose add frameworks , libraries , followed other , , browse of dylibs. since installed boost via brew, dylibs located under /usr/local/cellar/boost/1.53.0/lib/ . make sure select of them, under new frameworks folder in navigation window, list of of boost libraries appear. right click on project , choose project settings . scroll search paths , add path boost include directory under header search paths . me located under /usr/local/cellar/boost/1.53.0/include . make sure recursive unchecked, or compile errors if using std!!! proceed add boost lib dir (that browsed in step 1) und

post - null in FormParam with "charset=UTF-8" in Jersey 2.0 -

i'm working on angularjs project , i'm calling rest services using content-type "application/x-www-form-urlencoded;". on server side use jersey in version 2.0. maven dependency. <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet-core</artifactid> <version>2.0</version> </dependency> everthing work fine on chrome , ie7. problem firefox add mystically "charset=utf-8" in content type. i made test , if use postman , set "application/x-www-form-urlencoded; charset=utf-8" in content type, jersey has null in formparam parameters this header of method in java @post @produces(mediatype.application_json) @path("movements/") public response movements( @formparam("compte_no") string compte_no, @formparam("compte_bidule") string compte_bidule, @formparam("comp

java - How to use selenium webdriver on local (on my pc) webpage instead of locate somwhere on www? -

i have use selenium webdriver on webpage have on hard disc. i've tried like: selenium = new webdriverbackedselenium(driver, "c:\\...dispatcher.html"); instead of normal: selenium = new webdriverbackedselenium(driver, "http://www.dunnowhattodo.org"); but don't work (i error "unknown protocol: c") is possible? im kinda new user of selenium webdriver can silly question, still appriciate every get:) try using method: webdriver.get("file:///d:/folder/abcd.html"); (or) selenium = new webdriverbackedselenium(driver, "file:///d:/folder/abcd.html");

java - What significance does `...` serve following a parameter type? -

this question has answer here: java, 3 dots in parameters 8 answers i trying asynctasks working in android, , have found have never seen before on , on again in many different tutorials. certain methods in tutorials passed parameters string... arg0 , integer... values . here tutorial code shown similar describing. what mean? why ... there? it called varargs. works type long it's last argument in signature. basically, number of parameters put array. not mean equivalent array. a method looks like: void foo(int bar, socket baz...) will have array of socket (in example) called baz. so, if call foo(32, ssock.accept(), new socket()) we'll find array 2 socket objects. calling foo(32, mysocketarray) not work. however, if signature varargs of arrays can pass 1 or more arrays , two-dimensional array. example, void bar(int bar, printstr

java - Double-Checked Locking without creating objects -

i'm using double-checked locking (dcl) avoid need of synchronization on object if not needed so. in case need synchronize when buffer empty, have "processing thread" wait "delivery thread" notify again - otherwise, "processing thread" run in loops without doing useful. both threads share these objects: object bufferlock = new object(); queue<command> commands = new concurrentlinkedqueue<>(); // thread safe! thread 1 ("delivery thread" - fills buffer): while (true) command command = readcommand(); commands.add(command); synchronize (bufferlock){ bufferlock.notify(); // wake thread 2 (if waiting) } } thread 2 ("processing thread" - empties buffer): while (true){ if (commands.peek() == null){ // not creating here synchronized (bufferlock){ if (commands.peek() == null){ // not creating bufferlock.wait(); } } } command

android - Implementing Runnable in MainActivity -

i have activity prints custom date time string textview. implemented runnable interface in mainactivity self , created thread @ end of oncreate method. thread thread = new thread(this); thread.run(); this run method public void run() { while (true) { try { thread.sleep(1000); localtime.settext(localtime.gettime().format2445()); system.out.println(localtime.gettime().format2445()); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } } when run on emulator can see system out in logcat. emulator shows anr after 5 seconds. doing wrong. method not suitable? async task way go here? need update clock every second having asynctask run forever acceptable pattern? you need start thread.start() http://developer.android.com/reference/java/lang/thread.html quoting docs there 2 ways execute

ruby - Can't figure out why match result is nil -

>> "<img src=\"https://filin.mail.ru/pic?width=90&amp;height=90&amp;email=multicc%40multicc.mail.ru&amp;version=4&amp;build=7\" style="">".match(regexp.new("<a href=\"http(s?):\/\/(?:\w+\.)+\w{1,5}.+?\">|<img src=\"http(s?):\/\/(?:\w+\.)+\w{1,5}.+?\"(?: style=\".+\")?>")) => nil but testing in rubular says should catched link i can't understand why testing rubular says string should catched, , not. regex wrong tool handling html (or xml) 99.9% of time. instead, use parser, nokogiri : require 'nokogiri' html = '<img src="https://filin.mail.ru/pic?width=90&amp;height=90&amp;email=multicc%40multicc.mail.ru&amp;version=4&amp;build=7" style="">' doc = nokogiri::html(html) url = doc.at('img')['src'] # => "https://filin.mail.ru/pic?width=90&height=90&email=multicc%40

vim - What does @ and ~ mean at the bottom? -

when i'm editing plain text files (not code files), sometime see signs @ , ~ @ bottom in different colors scroll, , disappear. mean in vim? the @ sign appears @ bottom when have long line of code (or text) continues (wraps) next line. the ~ sign place holder says nothing on line (not spaces or tabs or returns)

c++ - how can i get the number of bytes available to read on async socket on linux? -

i have simple tcp/ip server written in c++ on linux. i'm using asynchronous sockets , epoll. possible find out how many bytes available reading, when epollin event? from man 7 tcp : int value; error = ioctl(sock, fionread, &value); or alternatively siocinq , synonym of fionread . anyway, i'd recommend use recv in non-blocking mode in loop until returns ewouldblock . update: from comments below think not appropriate solution problem. imagine header 8 bytes , receive 4; poll/select return epollin , check fionread , see header not yet complete , wayt more bytes. these bytes never arrive, keep on getting epollin on every call poll/select , have no-op busy-loop. is, poll/select level-triggered . not edge triggered function solves problem either. at end far better doing bit of work, adding buffer per connection, , queuing bytes until have enough. not difficult seems , works far better. example, that: struct connectiondata { int sck; std::

state pattern: does it make sense to use it if each state is only allowed to perform just 1 or 2 actions? -

1) extreme case: have 10 states , 10 possible actions perform (that result in state transitions). each of these actions allowed in particular state. state 1 can perform action 1, state 2 action 2, , on (a simple graph goes forward) 2) opposite case: have 10 states , 10 possible actions perform, each of them allowed in every state. of them behave in same way among couple of states, behave same in every state , others work differently in each (like strategy) i have presented 2 extreme scenarios. i'd have opinions on do. combining patterns too. think of states phases in simple game. have title state, menu state (plus sub-menus inherit main menu state), actual game state, , maybe credits state. each of these individual states has own functionality , purpose, , not shared, else why need own state? if have functionality shared between states, should sort of inheritance. in example, involve making base menu state, individual menu state each menu (main menu, options menu

c - Does ctype.h still require unsigned char? -

traditionally, - strictly speaking - error pass signed char ctype.h predicates because defined -1 255, -128 -2 end in reading outside array bounds. was ever fixed, or still strictly speaking have use unsigned char avoid undefined behaviour in modern versions of c? do still strictly speaking have use unsigned char avoid undefined behavior in modern versions of c? yes, c11 draft standard section 7.4 character handling <ctype.h> paragraph 1 says ( emphasis mine ): the header declares several functions useful classifying , mapping characters. 198) in cases argument int, value of shall representable unsigned char or shall equal value of macro eof . if argument has any other value, behavior undefined . this holds draft c99 standard well, can find in same section.

python - Using data from CSV to make directories -

i have .csv file such following: name1,name2,name3 , on using python script trying have read .csv , make directories each value eg: name1,name2,name3 create these directories : name1 , name2 , name3 this code far: import os import fileinput textfile = 'e:/videos/movies/subtest/dirlist.csv' path = "e:/videos/movies/subtest/" #generate txt file current names of directories def makefile(): # open file dirs = os.listdir( path ) # print files , directories file in dirs: #open file tfo = open(textfile, "ab+") #write file, seprating each item "||" tfo.write( file + ',' ) #print output print ( file ) #prints confirmation print 'file printed!' #close file tfo.close() mainmenu() def makedirs(): #open textfile read , set varible mylistread mylistread = open(textfile, 'rb+') #reads x amount of lines , stores st

Mediawiki: how do I create a list of wanted articles in the Main namespace? -

mediawiki provides special page view "wanted pages" (pages linked don't have existing articles yet) visiting /special:wantedpages on wiki. check out wikipedia's wanted pages see i'm talking about. my issue wanted pages list fill pages special namespaces. @ moment wiki chock full of wanted pages in template, talk, , category namespaces, name few. with many links special namespace pages, articles in main namespace (the ones users care about) getting lost. there way (through extension or have you) create list of wanted pages in main namespace? see wantedpagesfromns extension. however, have make minor edit extension source files work latest versions of mediawiki (1.20+). rename downloaded .zip file .7z can expand it. copy wantedpagesfromns folder extensions folder of mediawiki installation. open wantedpagesfromns.php file , comment out line reads wfloadextensionmessages( 'wantedpagesfromns' ); . (that function deprecated in mediawiki

node.js - UTC DATE in Sequelize.js -

i'm using sequelize in node.js save open , close times. i'm using moment.js format. alter findorcreate i'm doing this: result.open = moment(hours.open, "hh:mma").format("yyyy-mm-dd hh:mm:ss"); result.save() ... this works fine , time gets formatted mysql's datetime format. problem when retrieve time seqquelize thinks it's utc time , converts est (my server timezone). i prefer go database utc , come out same way. there i'm doing wrong? why sequelize not convert utc on insert assumes it's utc coming out? also, there way not have try convert server timezone? i know pretty late here struggling postgres (maybe can point in right direction other engines) as know postgres stores datetimes in utc. the issue, me, turned out not in sequelize rather in pg package. in order fix it, place before sequelize = new sequelize() line var types = require('pg').types; var timestampoid = 1114; types.settypeparser(1114, fun

mongo java - Mongodb Logs shows too many connections open -

why mongodb logs show many opened connections? it's showing me more maximum connection limit , number of current operations in db. also primary refused create more connections after reaching 819 limit. time, number of current operations in db less 819. raising ulimit has solved problem temporarily, why idle connections not utilized serve requests? i having exact same problem. connection number kept growing , growing until hit 819 , no more connections allowed. i'm using mongo-java-driver version 2.11.3. has seemed fix problem explicitly setting connectionsperhost , threadsallowedtoblockforconnectionmultiplier properties of mongoclient. before not setting these values myself , accepting defaults. mongoclientoptions mco = new mongoclientoptions.builder() .connectionsperhost(100) .threadsallowedtoblockforconnectionmultiplier(10) .build(); mongoclient client = new mongoclient(addresses, mco); //addresses pre-populated list of serveraddress objects i

drop down menu - Javascript Go button -

i create go button current code, don't know how. jquery(function($) { var data = [ // data ['select province', [ 'select city' ]], ['alberta', [ 'select city', 'airdrie', 'calgary', 'cold lake', 'edmonton', 'fort saskatchewan', 'grande prairie', 'leduc', 'lethbridge', 'medicine hat', 'red deer' ]], ['british columbia', [ 'select city', 'abbotsford', 'burnaby', 'chilliwack', 'coquitlam', 'kamloops', 'langley', 'nanaimo', 'new westminister', 'north vancouver', 'port coquitlam', 'port moody', 'prince george', 'richmond', 'surrey', 'vancouver', 'vernon', 'victoria' ]], ['manitoba', [ 'select city', 'brandon', 'dauphin', '

Drawing a line ActionScript 3 not working -

hello have piece of code drawing simple line doesn`t if possible tell me mistake thankful!!! here code: function click2(e:mouseevent):void{ e.currenttarget.removeeventlistener(mouseevent.click, click2); fx=mousex; fy=mousey; var i:int; i=2; trace(i); trace(sx,sy); trace(fx,fy); var line:shape = new shape(); line.graphics.beginfill(0x0066ff); line.graphics.moveto(400, 300); line.graphics.lineto(400, 400); this.addchild(line); } thank , appreciate community of website, , guys me see mistakes, i m beginner i m doing becouse of people heart!!! you drawing line have set linestyle : function click2(e:mouseevent):void { e.currenttarget.removeeventlistener(mouseevent.click, click2); fx=mousex; fy=mousey; var i:int; i=2; trace(i); trace(sx,sy); trace(fx,fy); var line:shape = new shape(); line.graphics.linestyle(1, 0x0066ff, 1); line.graphics.moveto(400, 300); line.graphics.lin

html - Accessing JSON through Jquery returns "undefined" -

i'm writing small script take schedules json document , present them in list view. i'm having hard time getting right values return when access json document, in continues "undefined" here's json doc. { "ferries": { "horseshoebay": {/*bunch of schedules here*/}, "departurebay": {/*bunch of schedules here*/}, "dukepoint": {/*bunch of schedules here*/}, } } and here's js $.getjson("includes/json/ferries.json", function(e){ var depart = e; $("#content").append("<ul id='depart-list'>"); $.each(depart.ferries, function(i, item) { console.log(item.result); }); $("#content").append("</ul>"); }); as can see i'm trying log results, come number of values attached key "ferries" undefined , i'm not sure why. any appreciated. edit hey, tried using "item" supplied commenters my each

javascript - Regular expression to search for at least 2 letters per line -

please tell me regular expression search @ least 2 letters in string. letters can anywhere , in case. minimum of 2 letters in string. example (javascript): /someregex/i.test(' w89u7'); /*should return true*/ /someregex/i.test(';te1 53#-00'); /*should return true*/ /someregex/i.test('232 3!4-22-1r*7'); /*should return false*/ ps: , sorry english. try using this: /[a-z].*?[a-z]/i

d3.js - Create a Graduated Symbol Map using D3 -

i'm trying create graduated symbol map , struggling find way make happen. can create pie charts , can create symbol map, how place pie charts @ specific coordinates on map? i've placed proportional symbols @ proper coordinates, can't figure out how replace symbols pie charts. every attempt leaves me empty map. i've tried merge mike bostock's pie multiples example symbol map example have instead managed expose lack of understanding of d3's data , event functions. index.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <title>graduated symbol map</title> <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> <script type="text/javascript" src="http://d3js.org/topojson.v1.min.js"></script> <script type="text/javascript" src=&qu

json - Adding StateCode dash StateName to the autocomplete using MVC4.5 and a JsonResult -

i trying state code followed dash , state name using ajax autocomplete syntax. i'm using jquery , jqueryui , jqueryui autocomplete function attempt this. i using json result: [{"code":"ak","name":"alaska"},{"code":"al","name":"alabama"}, {"code":"ar","name":"arkansas"},{"code":"az","name":"arizona"}, {"code":"ca","name":"california"}, ... ] and i'm using jquery ajax call embedded $.ajax({ url: '/cats/state/list', type: 'post', datatype: 'json', success: function (data) { $('#cat_statecode').autocomplete( { source: data.code + '-' + data.name, minlength: 2 }); } }); the mvc controller json result looks this: p

html - Opacity in nested div tag -

this question has answer here: opacity of background-color, not text [duplicate] 5 answers i looking css solution can set lower value of opacity background color, , text on b opaque. i tried this: <div style="opacity: 0.4; background:none repeat scroll 0% 0% rgb(242, 242, 242); "> <div style="opacity: 1;"> complete opaque text on background color </div> </div> but didn't work. here opacity both both background color , text getting changed per outer div opacity value. can please suggest solution? you can use rgba set semi-transparent colors: <div style="background:rgba(242, 242, 242, 0.4);"> <div> complete opaque text on background color </div> </div> the opacity of child element never higher parent's opacity, if parent's op

Getting error while reading local file in node.js -

i trying read local file using node.js. npm module trying execute child process , inturn opens file read. while reading throws error { [error: enoent, open 'e:\project\secintegrator\attack\manifest.json'] errno: 34, code: 'enoent', path: 'e:\\project\\secintegrator\\attack\\manifest.json' } actual path read file e:\project\secintegrator\node_modules\restscannerdriver\garudrudra\attack\manifest.json i have used var configpath = path.join(path.dirname(fs.realpathsync(__filename)), '/'); calculate absolute path still not working. inside npm module path changes. try use __dirname in npm , create realpath that: var filepath = fs.realpathsync(__dirname+'/'+relative path here file); after what's result of filepath

cakephp does not save cookie -

i have simple code in appcontroller beforefilter function, set cookie $this->cookie->name = 'mycookie'; $this->cookie->time = '1 hour'; $this->cookie->domain = 'example.com'; $mycookie = $this->cookie->read('my_cookie'); if ( empty($mycookie) ) { $this->cookie->write('my_cookie', 'cookievalue', true); } else { echo $mycookie;die; } so, refresh page second time should echo cookie's value. not. output nothing. ideas can problem ? i use cake 2.3.1. cookie component included. debug level 3 , there no errors. have checked cake logs file - nothing there. thanks

Android: how to override ContentProvider's ParcelFileDescriptor openFile method to send file from url as attachment via email? -

i've searched lot did not stumble upon have do. when click send email file shown attached never receive attached file there special way send attachments receive url? here activity code: http://pastebin.com/uzdjyxab[2] , here project https://docs.google.com/file/d/0b-91m-6zevwcrtytyxrgb3l6uve/edit?usp=sharing code "send email" button: sendemail_button.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub intent intent = new intent(intent.action_send_multiple); intent.settype("*/*"); intent.putextra(intent.extra_subject, "attachment app"); intent.putextra(intent.extra_text, "sending mp3 file " + title); intent.putextra(intent.extra_email, new string[] {"some_emai

Using Devise in a Mountable Engine Rails from outside of the engine -

i have engine called hq_core, , have rails app called hq. hq_core has devise user installed within , works hq. did using this how-to i want create devise admin_user in hq, not hq_core. ran typical 'rails g devise admin_user' installed find in hq. but when hit localhost:3000/admin_users/sign_in, says actionview::template::error (undefined method `admin_user_session_path' #<actiondispatch::routing::routesproxy:0x007fb454403818>): this rails 4 application devise 3.0.0rc i had same problem solved adding devise.setup |config| config.router_name = :<your engine name here> end to config/initializers/devise.rb stated in how to.

Json operations in PHP -

i have mysql database reading php: $con = mysqli_connect($host, $user, $pwd, $db); if(mysqli_connect_errno($con)) { die("failed connect mysql: " . mysqli_connect_error()); } $sql = "select grad lista"; $result = mysqli_query($con, $sql); $rows = array(); while($row = mysqli_fetch_array($result, mysqli_assoc)) { $rows[] = $row; } mysqli_close($con); $arr = array_flip(array_map('serialize', $rows)); $lista = array_map('unserialize', array_flip($arr)); echo json_encode((object) array('lista' => array_values($lista))); and localhost getting this: {"lista":[{"grad":"beograd"},{"grad":"novi_sad"},{"grad":"kragujevac"}]} is there way this: {"lista":[{"grad":"odaberite grad"},{"grad":"beograd"},{"grad":"novi_sad"},{"grad":"kragujevac"}]} i add {"grad&q

android intent - How to back stack activities without recreating them -

i new android. want understand activity stack. i have 3 activities in app a(main)->b->c . want navigate a->b->c , c->b->a without restarting them, or changing states (as button in emulator does). also, when press home button, want app go thebackground , when again launch app clicking icon, last activity should resumed in same state without restarting. mean this: a->b->c->(home button pressed, app went background)->launch app again clicking icon in emulator->c . plzz me codes coz can't catch theory without demo :) what describing default behavior in android. to handle home button don't have code anything. if in activity c , press home button , later come back, still have activity c on top of stack. if want navigate a->b->c start app activity a, later call startactivity() activity b, , later startactivity() activity c. if in activity c , want go b, call finish() on activity c.

xsp - mono MVC3/MVC4 - libraries still required -

ubuntu 13.04. using mono experimental branch (3.0.6 (debian 3.0.6+dfsg-1~exp1~pre1);). i'm still being required upload these 5 dlls bin folder mvc applications: system.web.mvc.dll system.web.razor.dll system.web.webpages.dll system.web.webpages.deployment.dll system.web.webpages.razor.dll i'm running mono-fastcgi-server4/xsp v3.0.11 compiled source on nginx. i've read multiple places of mono 2.12 copying these no longer required have on application (the razoronmono test solution). checked /usr/lib/mono/4.5 directory , dlls exist. in case it's web.config razoronmono solution, here file: <?xml version="1.0"?> <!-- more information on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=152368 --> <configuration> <appsettings> <add key="clientvalidationenabled" value="true"/> <add key="unobtrusivejavascriptenabled" value="tr

jquery - Unable to toggle button click event on AJAX request -

<div class=" pull-right"> <?php if ($placement['placementstatus'] == campaign::status_in_progress): ?> <a class="pausebtn btn btn-small" onclick="pauseplacement($(this), '<?=$placement['placementtag']?>');" href="#"><i class="elusive-pause"></i></a> <?php else: ?> <a class="startbtn btn btn-small" onclick="startplacement($(this), '<?=$placement['placementtag']?>');" href="#" ><i class="elusive-play"></i></a> <?php endif; ?> <a class="trashbtn btn btn-small" onclick="deleteplacement($(this), '<?=$placement['adid']?>');" href="#"><i class="elusive-trash"></i></a> </div> function pauseplacement(el, placementtag) { $.ajax({ url: '/campaign/pause

java - Adding Activity to Android in Adobe Air Extension -

i'm receiving following error when try start activity within native code of android application adobe air: android.content.activitynotfoundexception: unable find explicit activity class {air.inapppurchases/com.industrycorp.androidinapppurchaselib.asyncactivity}; have declared activity in androidmanifest.xml? i've been looking @ many tutorials , guides , unable solve problem. my native androidmanifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.industrycorp.androidinapppurchaselib" android:versioncode="1" android:versionname="1.0"> <uses-permission android:name="com.android.vending.billing" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="activity_ent

php - Decreasing a column value using SET -

i'm trying use codeigniter's database classes decrease value of column. @ moment i'm doing this: public function deduct_limit($bytes, $ip_address) { $this->db->where('ip_address', $ip_address); $this->db->set('limit', 'limit - ' . $bytes, false); $this->db->update('limits'); } however, codeigniter throws error message: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'limit - 418266480 ip_address = '127.0.0.1'' @ line 1 update `limits` set `limit` = limit - 418266480 `ip_address` = '127.0.0.1' as far know sql correct, i've google'd , looked on , follow syntax. can not use other +1 or -1 ? you need escape reserved words in mysql limit backticks update limits set `limit` = `limit` - 418266480 ip_address = '127.0.0.1'

multithreading - Android Game Thread Crashing on Draw() -

i have implemented basic game loop in android "conway's game of life" implementation. works pretty occasionally, crashes. me looks draw() called when view no longer valid (sometimes when home pressed or when options pressed). so did research , discovered not implementing onpause()/onresume() correctly. have tried correct still crashing intermittently. not time, enough. i have been working on longer care admit @ point , hoping knows more i, @ , tell me if i'm doing wrong, maybe life-cycle problem or something. here code (note have removed non-related methods brevity): // here main android activity public class mainactivity extends activity implements onsharedpreferencechangelistener { game gameview; string mspeed, malivecolor, mdeadcolor, mboardsize; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string deviceid = secure.getstring(getcontentresolver(), secure.androi