Posts

Showing posts from January, 2010

Sub-grouping in a plot in R -

Image
i want represent data different individual cells in xyplot , give them color in base of different category. however, when have been able represent dots: xyplot( signal ~ time | as.factor(treatment), data=data,groups=cell, fill.color = as.character(data$color), panel = function(x, y,fill.color,...,subscripts){ fill = fill.color [subscripts] panel.xyplot(x, y,pch=19, col=fill, type ="p")} ) but in way imposible visually track cells. therefore, want same lines , polygons error area happens each time try, lattice override second group should assign color (or not able tell lattice. here way that: cell<-rep(x = c("a","b","c","d"),50) signal<-rep(sample(seq(from = 0, = 50, = 1), size = 50, replace = true),4) time<-sort(rep(seq(1,50),4),decreasing = f) treatment<-rep(c("hard","soft"),50*2) color<-rep(c("red","orange"),50*2) data<-data.frame(c

osx - Submitting several commands to sqlite3 in a single command at cli -

on mac os yosemite use following version of sqlite: # sqlite3 --version 3.8.5 2014-08-15 22:37:57 c8ade949d4a2eb3bba4702a4a0e17b405e9b6ace and have 2 commands run fine @ sqlite3 prompt: .read android.sql .import words.txt dict the first command above creates 3 tables need in android app (i use sqliteassethelper copy my.db apk-file). the second command above fills dict table text file. how can run both commands in single command @ cli? i have tried following separators: semicolon, slash , \\n not work: echo ".read android.sql / .import words.txt dict" | sqlite3 my.db usage: .read file update: this work in mac os terminal (thanks, mark) - # echo -e "command1\ncommand2" command1 command2 # echo -e ".read android.sql\n.import words.txt dict" | sqlite3 my.db usage: .read file try this: echo -e "command1\ncommand2" | sqlite3 my.db for example: echo -e ".print hello\n.print goodbye" | sqlite3

Any progress with programming Java for iOS? -

after seeing this question realized it's around 5 years later, , kept hearing translators getting better , better. is there professional way of developing in java ios mobile systems? thanks using robovm , libgdx best way i've found compile ios. robovm: robovm.com libgdx: https://libgdx.badlogicgames.com robovm uses aot (ahead-of-time) compiler convert java code before it's packaged ios libgdx provides library compatible android, desktop, ios, , html

python - how to check for a presence of a character in a byte array -

this sounds basic me ask here goes. have bytearray. want check presence of let's 'a' or 'a' in array , print count of them. following don't see though know there 'a' in there - a_bytes = bytearray.fromhex(hex_string) count = 0 x in a_bytes: if ( (x=='a') or (x == 'a') ): count = count+1 return count why doesn't above code work? printed out byte values integers , see 65 repeating multiple times. again try convert constant 'a' integer using int('a') error -- valueerror: invalid literal int() base 10: 'a' the values in bytearray stored integers, not hex representations. need search 65 or 97 , not "a" or "a" . if want use strings, use list. if you're not interested in integer values of bytes, bytearray not right choice. also, if use list, can use .count method of lists directly count occurrences of particular value.

css - Marker on top of the menu list items -

how can create marker appears on top of menu list items when hover on them ?like 1 have here . it's possible create css ? edit:i don't want code , want tips because don't know start. here minimal example of want achieve. important parts :before pseudo element , position: relative of <a> . please notice width of "markers" width property of pseudo element. (in case it's 2px). here css-part of marker pseudo element. a:hover:before { content:""; width: 2px; height: 20px; background: #000; position: absolute; /* works when parent 'position:relative' */ left: 50%; top: -10px; } minimal example snippet html * { box-sizing: border-box; } ul { list-style: none; } ul > li { display: inline-block; } li > { padding: 5px 10px; position: relative; } a:hover:before { content: ""; width: 2px; height: 20px; background: #000; position: absolute

can't set attribute in class instance in Python -

i'm trying create instance of class test module created working properly. here module (filewriter.py), error appears in init method: class file(object): '''process data file''' #fields #filename = name of file #textdata = data read from/written file #constructor def __init__(self, filename = 'saved_data.txt', textdata = ''): #attributes self.filename = filename self.textdata = textdata #properties @property #getter def filename(self): return self.__filename @filename.setter #setter def filename(self, value): self.__filename = value @property #getter def textdata(self, value): self.__textdata = value #methods def savedata(self): '''appends data file''' try: fileobj = open(self.filename, 'a') fileobj.write(self.textdata) fileobj.close() except exception e: print('you have following error: ' + str(e)) return('data sa

filter - r error: Complex matrix? -

i'm trying smooth data using savitzky-golay filter, keep getting error in r-studio: error in la.svd(x, nu, nv) : 'a' must complex matrix even when running example code: library(pracma) ts <- sin(2*pi*(1:1000)/200) t1 <- ts + rnorm(1000)/10 t2 <- savgol(t1, 51) or: library(signal) bf <- butter(5,1/3) x <- c(rep(0,15), rep(10, 10), rep(0, 15)) sg <- sgolayfilt(x) the error doesn't appear when run same thing in r. might problem? i encountered same error , upgraded r-studio 0.98 0.99 , fixed "error in la.svd(x, nu, nv) : 'a' must complex matrix" problem.

oracle11g - Oracle Incremental Percent -

i trying make query return this: <pre> codigo_vendedor anio monto %inc 100 2014 23 100 2015 26.50 15.22% 200 2014 20 200 2015 575 2775.00% <pre> this incremental percentaje, problem having calculate %inc column, current query: with ventas_anuales ( select c.codigo_vendedor, sum(d.precio*d.cantidad) monto, extract( year f.fecha) anio detalle d inner join factura f on f.serie = d.serie , f.numero = d.numero inner join clientes2 c on c.codigo_cliente = f.codigo_cliente group c.codigo_vendedor, extract( year f.fecha) order c.codigo_vendedor, extract( year f.fecha) ) select va.codigo_vendedor, va.anio, to_char(va.monto,'9999.99') monto, concat(to_char((va.monto*100/va.monto)-100,'9999.99'),'%') "%inc" ventas_anuales va; and obviosly can columns, except incremental percentaje year: but not know how calculate last column. thank in advance. regards

ios - NSDateFormatter isn't getting correctly formatted -

i have nsdateformatter created. want print out seconds , milliseconds. here's code: dateformatter.dateformat = "ss\(separator)sss" let string = self.dateformatter.datefromstring(self.timelabel.text!) // timelabel.text = 3:29 println(string!) the println() prints out following: 2001-01-01 08:00:03 +000 all want print out, 3:29. seconds, , milliseconds. prints out different things. how can print out seconds , milliseconds? with datefromstring converting string date. so, "string" date, not string. , when print "string" printing value of string's description, standard formatter, not using formatter. if want format string date, use stringfromdate:

php - Laravel 5: Database Migrations (Help!) -

some useful information: im running on os x (el capitan beta) im using xampp i've installed laravel 5 , can confirm works. here migration file: <?php use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; class createuserstable extends migration { /** * run migrations. * * @return void */ public function up() { schema::create('users', function(blueprint $table) { $table->increments('id'); $table->string('email'); $table->string('username'); $table->string('password'); $table->string('first_name')->nullable(); $table->string('last_name')->nullable(); $table->string('remember_token')->nullable(); $table->timestamps(); }); } /** * reverse migrations. * * @return void */ public function do

ios - Parse Crash Analytics Unsymbolicated After Uploading DSYM File -

i have app in app store , got crash report unsymbolicated. tried upload .dsym file using following procedure, parse still showing me unsymbolicated crash report. wondering if doing wrong. let's app named myapp in xcode, open organizer using window > organizer i locate latest myapp archive, , right click on show in finder i right click on myapp.xcarchive file , choose show package contents i navigate dsyms folder , directory (i see here myapp.app.dsym file) in terminal, upload dsym file using this: i cd parse cloud folder in project folder then type following: parse symbols myapp --path="/users/emadtoukan/library/developer/xcode/archives/2015-08-15/myapp 2015-08-15, 7.28 pm.xcarchive/dsyms/myapp.app.dsym" when hit enter, following: uploading ios symbol files... uploaded symbol files. when refresh parse analytics page, still says crash report unsymbolicated. ideas why happening? i submitted comment because didn't think seeing corr

Function php argument -

something wrong in 1 of functions. others work fine. application has mvc structure. beginning objects , mvc, must ay. basically, have page (services.php) linking to: echo"<a href=\"index.php?page=detailservices&id=".$data['id']." \">plus d'informations...</a>"; function in model page (model.php): function get_nextserv($id) { global $bdd; $id = (int)$id; $req = $bdd->query('select * entreprises id= ?'); $req->execute(array($id)); return $req; } and detailservices.php page: try { if (isset($_get['id'])) { $id = intval($_get['id']); $billet = get_nextserv($id); if (get_nextserv($id) < 1) { echo "no......"; } else { foreach ($billet $data) { echo "<h2>" . $data['entreprise'] . "</h2>"; } ..... i have following errors: warning: missing argument 1 get_nex

telerik - KendoUI grid create : how to deal when server response only the id of the new created item -

i want use kendoui grid widget rest api (manage dreamfactory); when create new item grid server response contains new id , not new item (aka fields) read in forum http://www.telerik.com/forums/request-for-support-on-editable-grid#2098471 . "when add new item in grid id should generated on server , newly inserted item (as array) client. way datasource can update internal data , grid widget update column field. in case server not return result, inserted item treated new 1 every time sync datasource. same applies destroy , update functionality." my question how deal if cannot modify contains of server response. here response server : {"record":[{"id":26}]} any idea? according the dreamfactory documentation , id of created record returned default. the docs mention may select returned fields . using fields=* return created fields. should sure use the record wrapper force return of array rather single, unwrapped id field.

html - Vertically centering with flexbox -

i'm trying center div on webpage using flexbox. i'm setting following css properties. see it's being centered horizontally, not vertically. .flex-container { display: flex; align-items: center; justify-content: center; } here's fiddle: jsfiddle can explain i'm doing wrong? a <div> element without explicit height defaults height of it's contents, block elements do. you'd want set 100% of it's parent, <body> , that's not enough, since block element. again, need set 100% height, match it's parent, <html> . , yet again, 100% still required. but once done, annoying vertical scroll bar. that's result of default margin body has, , way box model defined. have several ways can combat that, easiest set margins 0. see corrected fiddle . html, body { height: 100%; margin: 0px; } .flex-container { display: flex; align-items: center; justify-content: center; height: 100%;

ios - How to initialize a Realm DB -

i want app ship out pre-initialized db. in sql, create db, necessary inserts, pg_dump file, , load file. i'm sure realm has equivalent method, i'm not sure , couldn't find in documentation. (disclaimer: work realm) there's no pg_dump-like functionality in realm, can distribute pre-built realm file along app , that'll work fine. :) at moment, best way create pre-made realm file make small sample app generate , populate file, we're working on adding functionality realm browser well.

relationship - OrientDB: using Lucene to query related document fields -

say have movie vertices connected person vertices directedby , starring edges. consider orientdb query works expected: select *, out("directedby").name, out("starring").name movie out("directedby") contains (name = 'john ford') that correctly returns movies directed persons name "john ford". however, want perform query using lucene full text search give little more flexibility. i think have indexes set correctly, query directly on persons table succeeds produces results: select * person name lucene 'john ford' however trying use lucene operator in query of movie vertices produces no results: select *, out("directedby").name, out("starring").name movie out("directedby") contains (name lucene 'john ford') am doing wrong? or trying not possible? in order use lucene, should execute select it, not inside contains. try should super fast: select *, out(&quo

scala - Why method persist of PersistentActor doesn't return a Future? -

i have theoretical question. wrote code: class account extends persistentactor { def receivecommand = { case block(id, amount) => persist(block(id, amount)){ case block(id, amount) => persist(revertblock(id, s"id ${id} in processing", balance + amount))(_.revert()) } } ... } it looks bad. why method persist takes callback 2nd argument instead return future? deal in context. sender() inside callback valid, not true futures.

css - Hide All Page + Project titles in Virb.com -

Image
i'm having trouble finding best way hide project titles on virb website. main gallery view here: http://katekoeppel.com shows project title below each image. there way remove of these titles completely? thanks in advance! you need hide <h2> . so, give css: #main-content .index .normal li .titles h2, #main-content .index .large li .titles h2 {display: none;} let know in comments, if face difficulty in adding css. also, please refrain posting link questions. need add css in base.css . preview:

javascript - jQuery .bind('show') not working appropriately when element is shown via jQuery -

i have snippet in project similar 1 seen below: $('#field').change(function() { var thiscondition = $(this).val(); if(thiscondition) { $('#this_container').fadein(); } }); the above snippet working. when thiscondition evaluates true , container fade in. however, have snippet below not functioning expected. binds show when container fades in event triggered: $('#this_container').bind('show', function() { $.ajax({ ... }); }); shouldn't snippet above react line 5 in change event handler? why bind method not triggering? confirmed show not valid nor jquery-triggered event. but can trigger yourself! try : $('#this_container').fadein("slow", function() { $(this).trigger("show"); });

java - HQL to accept wildcard characters and display the matching records -

my requirement accept wild card in textbox , show matching records. i'm working on maintenance project , not sure how modify existing code written in hibernate(hql) accept wildcard characters in query , display matching records. below wildcard characters condition: % = 0 many characters _ = 1 character in normal sql query know use accept wild card chacters. please see sample below. select * emp empname '%_%'; please suggest how when used hibernate(hql). below sample code: public actionforward performsearch(actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse response) throws exception { mysearchform searchform = (mysearchform) form; actionmessages messages = new actionmessages(); searchform.getsearchcriteria().setdosearch(messages.isempty()); if (!messages.isempty()) { adderrors(request, messages); } loadformdata(searchform, request);

function - Python [Tkinter] Application not displaying all information -

Image
i working on python tkinter application allows user send email user using gui window. running on python 3.4.2, , have created [log in] window , [compose message] window. within program have created many entries user enters data, 1 email, password, message, subject, to, , etc. have function print() out data user has entered. problem 3/6 entry results showing in console. can please @ code , tell me wrong. friends please not flag question, i'm trying learn why isn't working can work on , publish online, if want can credit in work if that's want ;) below have provided screen shot of output in console, , 2 different windows i've created. the code: #-->project name : email buddy #-->project start date : monday, august 24th, 2015. #-->project written : pamal mangat. #-->project end date : #imports pil import image, imagetk import webbrowser import email import sys import smtplib import tkinter def sendmail(recipient, sender, subject, message, password):

node.js - Chef nodejs depend on ark and windows -

i trying use nodejs cookbook , finding has ark dependency. ark has windows , 7-zip dependency. setting ubuntu box having install windows/zip package seems unnecessary. is there way of not needing ark dependency? correct way use nodejs cookbook?

osx - Prevent NSMenu from creating multiple instances of same NSWindow when clicked -

Image
i have simple cocoa application launches nswindow when nsmenu item clicked. initiating window via segue. problem when click menu item multiple times keeps creating new windows instead of bringing existing window foreground. how can prevent behavior? in advance. select destination window controller click attribute inspector , select under presentation "single" instead of "multiple"

json - swift play list play selected song -

i can't find way online explains how play song when select item in tableview. have external urls loaded in array called track_url. i know need in tableview function didselectrowatindexpath. can't figure out how set url avplayer when click on cell. can 1 share code me can url load in avplayer. can find stuff rhat pars , uses pfobect. have appended var. came json done swiftyjason. i hope 1 can give me suction/example can understand this. new swift. thanks according apple's qa , cannot stream audio avaudioplayer : the avaudioplayer class not provide support streaming audio based on http url's. url used initwithcontentsofurl: must file url (file://). is, local path. fortunately, same qa says can stream avplayer : import avfoundation var player: avplayer? func playsong(url: nsurl) { let asset = avurlasset(url: url) let playeritem = avplayeritem(asset: asset) player = avplayer(playeritem: playeritem) player?.play() } to tr

image - YPDrawSignatureView, Capturing/Saving a Signature in an iOS App -

i'm using ypdrawsignatureview custom class on github ( https://github.com/yuppielabel/ypdrawsignatureview ), , set application present modally new view ability sign name , save/cancel image. i'm using default save function in class, have absolutely no idea how works or saves to. here's code function: // mark: save signature uiimage func getsignature() ->uiimage { uigraphicsbeginimagecontext(cgsizemake(self.bounds.size.width, self.bounds.size.height)) self.layer.renderincontext(uigraphicsgetcurrentcontext()) var signature: uiimage = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() return signature } this how i'm calling it: @ibaction func savebutton(sender: uibutton) { signatureimage = signaturecapturefield!.getsignature() dismissviewcontrolleranimated(true, completion: nil) } i wish save signature image, , make appear on main view of application (as signature form). saved , , how able a

optimization - Can variance be replaced by absolute value in this objective function? -

initially modeled objective function follows: argmin var(f(x),g(x))+var(c(x),d(x)) where f,g,c,d linear functions in order able use linear solvers modeled problem follows argmin abs(f(x),g(x))+abs(c(x),d(x)) is correct change variance absolute value in context, i'm pretty sure imply same meaning having least difference between 2 functions you haven't given enough context answer question. though question doesn't seem regression, in many ways similar question of choosing between least squares , least absolute deviations approaches regression. if term in objective function in sense error term appropriate way model error depends on nature of error distribution. least squares better if there distributed noise. least absolute deviations better in nonparametric setting , less sensitive outliers. if problem has nothing probability @ other criteria need brought in decide between 2 options. having said this, 2 ways of measuring distance broadly similar. 1 s

javascript - Unexpected token < destroys other site functions -

i'm getting error line of code jquery("body").html(jquery("body").html().replace(/some text/gi, "<strong>some text</strong>")); i trying attach strong tag every instance of words "some text" across site pages. but error destroys other site functionalities, ajax stuff. error: uncaught syntaxerror: unexpected token < further info on error: (anonymous function) @ (index):227 this happens because function in body tag. when this... <body> $(function(){ jquery("body").html(jquery("body").html().replace(/some text/gi, "<strong>some text</strong>")); }); </body> you replacing instances of 'some text' in whole body including function itself you could, move function head tag... but @vohuman pointed out "you shouldn't replace whole contents of body element. that's madness. select target elements , replace contents of spec

bluetooth lowenergy - ios scanning different device by counting bits -

i working on ble scanning modules scanning devices if bit 0x00 shown 10 times or more. when more 1 identical device scanned, console shows alternate 0x00 , 0x01 in nslog . since use 1 integer counter count presence of 0x00 bits, override-ed . please tell me way implement key/value data structure save uuid , count storing scannedperipheral ? the below working for(nsuinteger = 0 ; < [ _ble.scannedperipheral count ] ; ++){ deviceperiperal *device; nsstring *uuid = [_ble.scannedperipheralkey objectatindex:i]; if (uuid) { device = [_ble.scannedperipheral objectforkey:uuid]; if([self isemptyarrayornil:[_dbman getdevicerecord:device.uuid ] ]){ nslog(@"pair bit %@ ," , device.pairbit ); const unsigned char ssss[1] = {0x00}; nsdata* pairbi = [nsdata datawithbytes:(const void *)ssss length:(sizeof(unsigned char) * 1)];

jquery - Assign each index argument different function -

i have code. $('#my-container-div').on('onalbumload', function(event, index) { ... }); i need assign different function each instance of index , @ loss. in non-coder terms, i'm looking for: if index equals 0 this, if index equals 1 this, if index equals 3 this, , on. i don't follow overall context of you're trying enough know if best option or not, can use code @ index , decide next. that can done if/else or switch statement or function table. // if/else $('#my-container-div').on('onalbumload', function(event, index) { if (index === 0) { func1(); } else if (index === 1) { func2(); } }); // switch $('#my-container-div').on('onalbumload', function(event, index) { switch(index) { case 0: func1(); break; case 1: func3(); break; } }); // function table var ftable = [func1, func2, func3, func4]; $('

c - Force calls to libgcc -

as far understand, libgcc implements libc functions called when program uses built-in , gcc decides not implement inline assembly. possible have gcc implement built-ins calls libgcc always? use: -fno-builtin , or: -fno-builtin-function , specific functions. e.g., -fno-builtin-memcpy

python - How to automate tasks in OSX/Windows and Android -

hey guys sorry noob here, have been trying more productive , have been trying search web ways automate tasks on mac, windows , android machines. far have been forced believe on : mac : applescript can used write scripts (shell scrpits?) on mac automate tasks in terminal setting , environment compile code. using automator launch shell scripts windows : writing scripts in python automate tasks. android : same windows. using "tasker" run code app. my main doubts : 1) shell script run on windows? 2) if not sort of scripts run on windows? 3) can python used write shell scripts? 4) can applscript used write shell scripts? 5) can javascripts used write shell scripts? 6) can shell scripts used perform intended tasks(lol noob strikes). 7) bash scripts , how different shell scripts? 8) can bash scripts used on osx , windows perform intended tasks? 9) learn create scripts? let's terms defined. unfortunately words "shell" , "script" vague, , of c

c++ - Window stops refreshing when key is pressed -

whenever press key move sprite, screen not update until release key. way i've been able fix clear, draw, , display window within each , every keypressed loop. it makes more sense each of these things 1 time, independent of key-presses. don't know why isn't working, or best way of fixing be. in program below, posted clear/draw/display code in multiple different places hoping putting in right place work. far hasn't. redundancy otherwise pointless. #include <sfml/window.hpp> #include <iostream> #include <sfml/graphics.hpp> #include <sfml/system.hpp> using namespace std; int main() { int windowx = 800; int windowy = 600; float playerx = 400.0; float playery = 300.0; sf::sprite playersprite; sf::sprite enemysprite; float playerspeedx = 0; float playerspeedy = 0; float playerspeedx2 = 0; float playerspeedy2 = 0; float accelerationx = 50.0; float accelerationy = 50.0; float deccelerationx = 50.0; float deccelerationy = 50.0; float frict

HTML capabilities on eclipse -

Image
this question has answer here: getting eclipse highlight , validate html files 4 answers i learning html on eclipse. works, posted on web service. cannot use html capabilities (see colors make life easier when programming), looks .txt file any ideas of how make .txt code html code? thank you use file's open with context menu open in html editor. eclipse reopen last editor used given file default.

javascript - jQuery limit div characters to 90 when a certain class is there -

i trying limit element's characters 90 words normally. when show more button clicked should remove limit. i tried using class , attaching limit class , removing class when show more button clicked. my attempt @ this: <header> <h1>heading goes here</h1> <p class="jumbo-p non-exp"> quick brown fox jumped on lazy dog. quick brown fox jumped on lazy dog. quick brown fox jumped on lazy dog. quick brown fox jumped on lazy dog. </p> <a href="#" class="more1">more</a> </header> the css: .jumbo-p{display: inline-block; height: 20px; overflow: hidden;} .more1 {position: relative; left: 2px; top: -21px;} .jumbo-p.expanded+.more1 {display: none} .jumbo-p.expanded {height: auto;} the jquery make work: $(".non-exp").text(function(index, currenttext) { return currenttext.substr(0

c# - Multiple Files from Google Client library - Drive API's Not Found -

Image
i've installed google.api.drives.v2 nuget without issue, when attempt create driveservice object, multiple file not found errors. used when ran windows 8.1, vs2013, different google drive objects, , never show stopping. since upgrading vs2015, unable work, i've removed references google api's , reinstalled packages , reset references. here's c# code i'm running: clientsecrets googlesecrets = new clientsecrets(); googlesecrets.clientid = clientid; googlesecrets.clientsecret = clientsecret; credential = googlewebauthorizationbroker.authorizeasync(googlesecrets, new[] { driveservice.scope.drive }, "user", cancellationtoken.none, new filedatastore("test")).result; and here's picture of when debug: if continue step through, error ton of other files. examples: googlewebauthorizationbroker.cs, googleauthorizationcodeflow.

mysql - How do I install PHP engine on Windows 8.1? -

it says above: "wait! of past questions have not been well-received, , you're in danger of being blocked asking more." here goes.... i run win8.1. i've been learning php , mysql , reason installed wamp server, zend server, zend studio , phpmyadmin. zend studio on 30 day trial , it's expired, right can't afford buy licence. i've been researching alternative zend studio , came across php engine via wikihow site ( http://www.wikihow.com/install-the-php-engine-on-your-windows-pc ), went php.net , downloaded php binaries. there's no installer can see , though downloaded binaries haven't been able install engine. so, questions are: am on right track able run php mysql, given have apache downloaded via wamp server? if not, else can do? thanks in advance. you can use xampp server easy install , configure, download: http://sourceforge.net/projects/xampp/ , here tutorial link: http://www.tutorialspoint.com/articles/run-a-php-pr

Reverse a int array in java -

this question has answer here: what's simplest way print java array? 24 answers i've written following code reverse int array, however, not see result right. hint on this? thanks! the result [i@15db9742[i@15db9742[i@15db9742[i@15db9742[i@15db9742[i@15db9742[i@15db9742[i@ which seems weird. public class reversearray { public static void main(string[] args) { int[] array = {2, 4, 5, 7, 8, 9, 12, 14, 17, 19, 22, 25, 27, 28, 33, 37}; reverse(array, 0, array.length - 1); } public static void reverse(int[] data, int low, int high) { if (low < high) { int temp = data[low]; data[low] = data[high]; data[high] = temp; reverse(data, low + 1, high - 1); } system.out.print(data); } } you system.out.print printing array object , not array index value. use below:- system.out.print(data[low]);

html - Cursor to remain pointer in area -

i'm building little hidden object game. can't seem stop cursor turning hand (on chrome anyway) pretty defeats purpose of objects being hidden. i've read lot of stackexchange posts on none work me. below 1 of maps , few things have tried, inline, css. i have issue blue outline when click 1 of polygons, should make separate question. please assist. this actual game page- game page <map name="m__r3_c7" id="m__r3_c7"> <area shape="poly" coords="28,91,52,93,70,89,71,74,82,67,80,52,70,40,55,28,47,30,29,31,20,21,5,9,-6,0,-27,10,-10,19,-18,20,-9,44,2,61,3,68,20,73,29,76" style="cursor:default" href="javascript:;" alt="" onclick="mm_nbgroup('down','navbar10','n_r3_c6','images/_r3_c6_s4.jpg','n_r3_c7','images/_r3_c7_s4.jpg',1);" /> </map> i've tried area { cursor: default; display:block; } javascript:void(0); java

ios - Page View Controller showing previous view controller after adding subviews -

i have 1 view controller collection view in page view controller , having search button on navigation bar when click on search bar , did search result shown means child view controller updating when slide on left showing me original content of collection view also. how can remove previous view controller , show result child view controller. then dont want page view controller, pageview controller reuse single child view controller each time swipe detected. in page view controller delegate methods check values being loaded array being reduced permanently or u using mutable copy of array each time reload page view controller contents.

javascript - Avoid jquery function for all the content -

i have table 20 rows. in each row there element <p class="exp-date">'.$cust->expiration_date.'</p> this element going repeated , return different values in lot of rows return 0001-01-01. want hide content wrote in javascript var exp = $(".exp-date").val(); var exphide = '0001-01-01'; if(exp = exphide) { $(".exp-date").html(''); } and have tried this $('.exp-date').each(function() { if(exp = exphide) { $(".exp-date").html(''); } }); but in both cases apply jquery on first row , modify not statement declared. someone idea? thanks in advance use == , "this", else point classes. code shown below var exphide = '0001-01-01'; $('.exp-date').each(function() { if(this.innerhtml == exphide) { //this.innerhtml $(this).html(''); //this.html..else point classes

php - Need assistance making .htaccess more strict -

i looking assistance in making .htaccess file point requests index.php file, regardless of if file exists or not. currently, requests sent index.php unless file exists in directory, not want, nor secure. here current .htaccess: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^?]*)$ /index.php?path=$1 [nc,l,qsa] let me know if have pointers or resources. thank you you can use: rewriteengine on rewritecond $1 !^(index\.php|robots\.txt) rewriterule ^(.+)$ index.php?path=$1 [l,qsa] if need real path in path parameter

appium - Unable to execute the android project in MAC with real device (5s) -

i working mobile automation tester web applications in android , ios device. have started mobile automation using selenium webdriver , appium our web applications. have created automation project android device. want use same project ios device , using iphone 5s that. i have configure eclipse, appium , imported our project in mac. able launcher safari browser in 5s unable execute project. can 1 please me how execute existing project in mac. is approach on executing existing android project on mac using real device correct or not? i had setup appium successfully. able launch safari browser through xcode on real device. while executing project through eclipse showing below error. org.openqa.selenium.unsupportedcommandexception: requested resource not found, or request received using http method not supported mapped resource. (original error: invalid timeout 'page load') (warning: server did not provide stacktrace information) @suresh @helping hands me

wpf - Insert a Control in UserControl -

i have usercontrol load swf, works fine. when add button control in it, doesn't show swf. here code use usercontrol ( flashplayer usercontrol ) : <window x:class="flashtest.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:flashplayerlibrary;assembly=flashplayerlibrary" title="mainwindow" height="768" width="1024"> <grid> <controls:flashplayer source="e:\\lesson1.swf" width="1024" height="768"> <button width="20" height="20" ></button></controls:flashplayer> </grid> is there anyway insert control in usercontrol . you can try put button on , not in it. using grid can try this: <grid> <controls:flashplayer source="e:\\lesson1.swf" width=&

javascript - What's the difference between `[undefined, undefined]` and `new Array(2)`? -

this question has answer here: foreach on array of undefined created array constructor 2 answers what [undefined × 2] mean , why different [undefined,undefined]? 1 answer why this: [undefined, undefined].map(function(i) { console.log(i); }) produces expected output (2 times undefined ), this: (new array(2)).map(function(i) { console.log(i); }) doesn't?

elixir - Trying to install using mix, (Mix) Could not access url error -

i trying install elixir packages , whenever use mix command, kind of message, mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.0/phoenix_new-1.0.0.ez sure want install archive https://github.com/phoenixframework/phoenix/releases/download/v1.0.0/phoenix_new-1.0.0.ez? [yn] y ** (mix) not access url https://github.com/phoenixframework/phoenix/releases/download/v1.0.0/phoenix_new-1.0.0.ez, error: {:failed_connect, [{:to_address, {'github.com', 443}}, {:inet, [:inet], :nxdomain}]} how avoid this? i needed ensure ~/.mix/archives directory has write permission. sudo chmod a+rw ~/.mix/archives/ solved problem.

python - Reserializing row index after row selection in pandas data frame -

i have following data frame: import pandas pd df = pd.dataframe({ 'gene':["foo","bar","qux","woz"], 'cell1':[5,0,1,0], 'cell2':[12,90,13,0]}) df = df[["gene","cell1","cell2"]] that looks this: gene cell1 cell2 0 foo 5 12 1 bar 0 90 2 qux 1 13 3 woz 0 0 after performing row selection this: in [168]: ndf = df[(df[['cell1','cell2']] == 0 ).any(axis=1)] in [169]: ndf out[169]: gene cell1 cell2 1 bar 0 90 3 woz 0 0 note ndf has row index 1 , 3 how can re index 0 , 1 . the expcted output is: gene cell1 cell2 0 bar 0 90 1 woz 0 0 i tried failed: ndf.reset_index what's right way it? try 1 ndf.reset_index(drop = true)

jquery - calling controller from view using ajax -

trying call controller , pass data variable mat holding. not calling controller function.please me, how proceed? $('#buttonadd').click(function () { var mat = $('#material_name').val(); $.ajax({ type: "post", url: $("#baseurl").text()+"gc_purchase/add_material_info"+mat, success: function (data) { $('#demo').html(data).show(); }, error: function (xhr, ajaxoptions, thrownerror) { $('#material_name').text("error encountered while saving comments."); } }); }); try this: $.ajax({ url: '/home/addbooking', type: 'post', datatype: 'json', data: { starttime: starttime, endtime: endtime, productid: productid }, success: function (data) { location.reload(); }, error: function (jqxhr, textstatus, errorthrown) { alert(e

angularjs - ionicModal Cannot call method 'fromTemplateUrl' of undefined -

i using ionic display modal, here example code: angular.module('starter', ['ionic']) .controller('mycontroller', ['$scope', function($scope,$ionicmodal){ $ionicmodal.fromtemplateurl('my-modal.html', { scope: $scope }).then(function(modal) { $scope.modal = modal; }); $scope.openmodal = function() { $scope.modal.show(); }; when run code, got error message saying typeerror: cannot call method 'fromtemplateurl' of undefined . how can fix it? you missed $ionicmodal after $scope .controller('mycontroller', ['$scope','$ionicmodal', function($scope,$ionicmodal){

python - Calling template_filter function in flask only once? -

i have simple filter should print out value passed it. created simple template use it. first time page viewed, value printed in terminal, after template rendered not printed again. why filter being called once? @app.route('/') def hello_world(): return render_template('test.html') @app.template_filter() def allow_menu(menu): print('allow_menu : {}'.format(menu)) return menu == 'test' {% if 'test' | allow_menu %}ok{% endif %} $ python main.py * running on http://0.0.0.0:9876/ (press ctrl+c quit) allow_menu : test 10.10.2.62 - - [31/aug/2015 15:50:46] "get / http/1.1" 200 - 10.10.2.62 - - [31/aug/2015 15:50:47] "get / http/1.1" 200 - the first time template file loaded, jinja compiles , caches result internally. since passing constant 'test' filter, jinja optimizes evaluating during compilation, rather during each render. the first time template used, filter called. subsequent ren

javascript - Uncaught TypeError: Cannot read property 'enter' of undefined , while using transitionToRoute -

i getting "uncaught typeerror: cannot read property 'enter' of undefined". when using transitiontoroute in controller. transitiontoroute function in controller, transitiontoroute: function() { // target may either controller or router var target = get(this, 'target'); var method = target.transitiontoroute || target.transitionto; return method.apply(target, arguments); }, here target variable being assigned view instead of controller or router. don't know if issue or using transitiontoroute in wrong way. need here. edit: above function can found here, https://github.com/emberjs/ember.js/tree/v2.0.1/packages/ember-routing/lib/ext/controller.js#l41 edit: in above function, calls function controller object "this", looking "target" key in it. when log "this.target" in transitiontoroute prints route class, if log same variable in function view class. i have no clue how hap

ios - SpriteKit Generate Random Curl Line -

Image
i working on project , need accomplish generate random curl line. @ point have have line randomly generated not curl. spawning points @ different x positions on every 0.5 seconds , connect points bezier. works except not curl. on picture below shown on 1) how have , on 2) how suppose make it. ideas how can ? using spritekit - objective c basically need make , randomize a bézier (parametric) curve control points . after read great answer , familiar terms, can try example (i assume scene , view size set correctly): gamescene.m #import "gamescene.h" @implementation gamescene -(void)didmovetoview:(skview *)view { } -(nsinteger)randomnumberbetween:(nsinteger)from to:(nsinteger)to { return (int)from + arc4random() % (to-from+1); } - (cgmutablepathref)generatepath { cgmutablepathref path = cgpathcreatemutable(); cgpoint p0 = cgpointmake(cgrectgetmidx(self.frame),self.scene.size.height-20.0f); //starting point little below upper edge of screen

Bash - Copy files from directory -

i have folder contains folders: main \_ dir 1 \_ dir 2 \_ ... \_ dir 40 i need open each sub-folder, copy files , paste them in folder, same folder sub-folder. how can in smart way? the thing comes mind create list name of folders , use simple script open, copy , paste i'm sure there faster way write names. try: cp main/*/* /path/to/otherfolder/ if want warned before overwriting file, use -i option: cp -i main/*/* /path/to/otherfolder/

return infinite loop python success -

i learning python online not understand last step should take. here question write function execute(prog) following. assume prog list of strings containing basic program, before. then, function should return either "success" or "infinite loop" depending on whether program terminates, or loops forever. important: should assume procedure findline(prog, target) defined in sub-task 2 defined, not need re-write it. hint input example: (['5 goto 30', '10 goto 20', '20 goto 10', '30 goto 40', '40 end']) my code still returns "infinite loop" when should return success cannot find last required step. ( include debugging checks here also) def execute(prog): location = 0 #print('prog = ', prog) visited = [false] * len(prog) while true: in range (0,len(prog)): visited[i] = true #print('prog type=',type(prog)) # print(type(location)) #print('len o

android - YouTube player API integration Error NullPointerException -

i getting error while integrating youtube player in android app. error in on line - youtubeview.initialize(config.developer_key, this); caused by: java.lang.nullpointerexception: attempt invoke virtual method 'void com.google.android.youtube.player.youtubeplayerview.initialize(java.lang.string, com.google.android.youtube.player.youtubeplayer$oninitializedlistener)' on null object reference my code: private static final int recovery_dialog_request = 1; private youtubeplayerview youtubeview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_you_tube_test); //requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_main); youtubeview = findviewbyid(r.id.youtube_view); // i

Prestashop:update ps_orders.valid MYSQL -

i'm trying update valid value inside ps_orders table 0 1 inside cycle, doesen't change @ all, here code: //this first query: $query = "select ps_orders.reference,ps_orders.id_order,ps_orders.valid,ps_order_detail.product_name,ps_orders.id_order,ps_orders.date_add,ps_orders.payment,ps_order_detail.unit_price_tax_incl,ps_order_detail.id_order_detail,ps_order_detail.product_quantity,ps_order_detail.product_reference,ps_order_detail.product_weight,ps_order_detail.unit_price_tax_incl,ps_address.id_customer,ps_address.firstname,ps_address.lastname,ps_address.address1,ps_address.address2,ps_address.postcode,ps_address.city ps_orders join ps_order_detail on ps_orders.id_order = ps_order_detail.id_order join ps_address on ps_orders.id_customer = ps_address.id_customer ps_orders.id_order=$i , ps_orders.valid=1"; //and how wanna change value $uporder = mysql_query("update ps_orders set valid=0 id=".$row[id_order]); there's no c

ios - Unwind segue not working from UITableViewController having UINavigationController as -

i've navigation controller having uiviewcontroller rootviewcontroller (say firstviewcontroller ). i've presented uitableviewcontroller (say secondviewcontroller having uinavigationcontroller parent). i'm not able unwind firstviewcontroller although i've method written in firstviewcontroller . thanks