Posts

Showing posts from June, 2014

android - how to hide virtual keyboard on edittext click -

i have activity in have edittext. on click on edittext want open timepicker dialog. had written code , working. problem when start activity , click on edittext first time-the virtual keyboard opens subsequent click on edittext timepickerdialog opens. not want virtual keyboard open first time.i want timepicker dialog open every time. please help here code timepickerdialog open on edittext click timetext=(edittext)findviewbyid(r.id.edittext2); timetext.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub calendar mcurrenttime = calendar.getinstance(); int hour = mcurrenttime.get(calendar.hour_of_day); int minute = mcurrenttime.get(calendar.minute); timepickerdialog mtimepicker; mtimepicker = new timepickerdialog(reminddetail.this, new timepickerdialog.ontimesetlistener() {

wpf - Filling a trapezoid with a bitmap brush -

Image
i looking fill trapezoid bitmap brush appears 3d-like. map each of vertices corners of bitmap , paint accordingly. i know there nothing readily available in wpf looking quick , dirty solution gives @ least simulation of effect. ideas welcome except i'd refrain using wpf-3d (unless proposed solution utterly simple). you're looking planerator . it control uses wpf's 3d capabilities create "plane projection" of it's contents: usage: <pl:planerator rotationy="35"> <stackpanel orientation="horizontal" ... > <stackpanel> <label fontsize="24" content=" " foreground="#ff000000"/> <border ... > <mediaelement x:name="mymediaelement" /> </border> </stackpanel> <listbox ... /> </stackpanel> </pl:planerator> full source code included in

mysql - SQL correct definition of floating points -

i measuring values on geo-location need create table consists of: date longitude latitude value the date column date of measure, value int value of measure, longitude , latitude coordinates - floating points columns 3 digits before point , 5 after (i.e. *. * ) i'm wondering how define table, try use: create table `obs` ( `id` int(11) not null auto_increment, `date` date default null, `lon` decimal(5,5) default null, `lat` decimal(5,5) default null, `val` int(11) not null, primary key (`id`) ) engine=innodb default charset=utf8; here link sqlfiddle but when i'm trying run insert `obs` values (null,'2014/06/07','34.000','31.342',1) i getting following error: out of range value column 'lon' @ row 1: can explain me what's wrong? decimal(5,5) means 5 decimal places in total 5 decimal places after point that make numbers invalid having decimal place before point. you want decimal(10,5)

java - Want to generate xy graph from 2 wave graph in J2EE (from MySQL DB) -

i have create 2 columns in mysql database , insert data in that, each column contain 8-9 k data. then need plot data in chosen gui in 3 separate plots on 1 screen shown in attached image. time interval x-axis plotting individual graph 0.001. then need plot these 2 waveform data against each other xy graph shown in graph. how achieve using j2ee because condition xy graph should appear within 2 or 3 second regards, prashant this answer pretty incomplete , pointer in general direction. solution consists of 3 steps: getting data database. there 2 options here: use simple sql using jdbc use jpa i assume have knowledge of that, if not there many tutorials on both topics. creating graph using java. suggest using http://www.jfree.org/jfreechart/index.html there alternatives. in scenario want render (temporary) image file. need play around find actual graph like. sending graph browser. sadly don't know how that.

c++ - Establishing a tcp connection from within a DLL -

i'm trying write piece of code allow me establish tcp connection within dll file. here's situation: have ruby application needs able send , receive data on socket, can not access native ruby socket methods because of environment in running. can access dll file , run functions within that, figured create wrapper winsock. unfortunately, attempting take piece of code should connect tcp socket in normal c++ application throws slew of lnk2019 errors can not life of me resolve. this method i'm using connect: //socket variable socket s; //establishes connection server int server_connect(char* addr, int port) { //start winsock wsadata wsadata; int error = wsastartup(0x0202, &wsadata); //check if happened if (error) return -1; //verify winock version if (wsadata.wversion != 0x0202) { //clean , close wsacleanup(); return -2; } //get information needed finalize socket sockaddr_in targe

c++11 - C style use of a modern C++ class -

i have class so: snippet 1: struct b { int member; // more complex members e.g. arrays of structs etc }; this class used in code assuming c style struct (e.g. used in memcpy , memset etc) as part of programming principles, contemplating modifying b so: snippet 2 struct b { b() {} int member; // more complex members e.g. arrays of structs etc }; here understanding. please correct if got wrong a. snippet 1 defines b pod whereas snippet 2 defines b not pod, , b. in snippet 2, b can still legitimately used c style uses such memset , memcpy std::is_pod : false std::is_trivial : false std::is_trivially_copyable : true std::is_trivial : false extending, follow rule of big 3 (or perhaps big 5), add copy assignment copy constructor. snippet 3: struct b { b() {} ~b(){} b& operator=(b &){ return *this; } b(b const &r){} int member; // more complex members e.g. arrays of structs etc }; here understanding. p

sbt - Why doesn't the Def.inputTask macro work in Scala 2.11.1? -

i'm using scala 2.11.1 , sbt 0.13.5. i have sbt plugin contains helper function create input tasks follows (the implementation stripped away it's irrelevant problem): def register(name: string, description: string): def.setting[inputtask[unit]] = { inputkey[unit](name, description) <<= def.inputtask { println("test") } } this function compiles , works fine in scala 2.10.4, once switch 2.11.1 fails following error: can't expand macros compiled previous versions of scala is def.inputtask macro broken in scala 2.11.1, or missing glaring detail? right above function residing in simplest sbt plugin imaginable. there no dependencies @ all, either. sbt 0.13.x series uses scala 2.10.x when loads up, sbt 0.13.x must compiled against scala 2.10, , sbt plugins 0.13.x. note : sbt 0.13 can define scala projects using 2.11.x.

email - PHP mail headers not working properly -

i trying create email in php, having problem constructing headers. i from admin@example.com, , other headers set show below. the problem when send email, "from" part in email client appears as: "admin@example.com rnreply-to: admin@example.com rnmime-version: 1.0 rncontent-type: text/html" this inadvertently breaks rest of email because doesn't recognise being html. // email headers $headers = 'from: admin@example.com \r\n'; $headers .= 'reply-to: admin@example.com \r\n'; $headers .= 'mime-version: 1.0 \r\n'; $headers .= 'content-type: text/html; charset=utf-8 \r\n'; any idea on how can fix these headers? thanks. change following: $headers = 'from: admin@example.com \r\n'; $headers .= 'reply-to: admin@example.com \r\n'; $headers .= 'mime-version: 1.0 \r\n'; $headers .= 'content-type: text/html; charset=utf-8 \r\n'; to this: $headers = "from: admin@example.com

c# - Windows phone picturebox -

i'm developing windows phone 8.1 application in c#. i'm using camera take picture. picture saved on device , i'm trying show in picturebox. have tested on htc phone , worked nice, when tried on nokia lumia picture never load. have idea how solve that? here code sing take picture: private void snap_task_click(object sender, eventargs e) { cameracapturetask = new cameracapturetask(); cameracapturetask.completed += cameracapturetask_completed; cameracapturetask.show(); } void cameracapturetask_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { navigationservice.navigate(new uri("/slika.xaml?fotka=" + e.originalfilename, urikind.relative)); } } and code try toload picture. public slika() { initializecomponent(); string slika = string.empty; string slika2 = string.empty; this.loaded += (s, e) =>

r - How can I find a maximum to this equation -

i have function find it's maximum deposit_likelood <- function(a1,a2) { (0.5672 - 0.092 * a1 + 0.0044 * a2^2 } how can maximize deposit_likelood while a1 should between -3 , +3 , a2 should between 0.5 , 0.9 ? i tried use optimize() function: optimize(deposit_likelood, interval=c(-3,3,0.5,0.9), maximum=true) but got error : error in a2^2 : 'a2' missing i hoping work out hints (because thats better way learn) here go. note i've had change function because question didn't have valid function in it, , unpack arguments: > deposit_likelood = function(a) {a1=a[1];a2=a[2];return (0.5672 - 0.092 * a1 + 0.0044 * a2^2) } we give optim start point (somewhere in box constraints), tell use method box constraints, , specify constraints: > optim(c(0,.7),deposit_likelood,method="l-bfgs-b",lower=c(-3,.5), upper=c(3,.9), control=list(fnscale=-1)) $par [1] -3.0 0.9 $value [1] 0.846764 $counts function gradient 7 7

localization - How to change our own application language from device languages list in android? -

Image
i want change application language dynamically not enter hard coded string language like"us""uk" etc want device languages list. important thing want open languages list on activity in dialog list not setting.e.g when user press text-view device language list opened , when user selected language language set on same text-view he/she pressed , @ same time whole app language change. default 1 language selected, e.g english. please me in form of code , information either work on "onactivityresult" or other process. google found every static code means hard code string. you can selected language of device with locale.getdefault().getdisplaylanguage(); and can set language (for english) locale.setdefault("en") edit: this source code of customlocale app android emulators package com.android.customlocale; import android.app.activitymanagernative; import android.app.iactivitymanager; import android.app.listactivity; import

greasemonkey - Execute javascript after page loaded and the page (intern) javascript finished -

i looking function/methode execute javascript (using greasemonkey) after page loaded , page javascript finished. already tried following ways running testscript after page loaded but before javascript finishs. window.onload = function () { testscript() } window.addeventlistener('load', function () { testscript()}) thanks.

java - ListView displays different items than what is in the holder -

i have custom adapter extends baseadapter. has variety of different layouts thumbnails without. when add new item same type 1 before row displays same values. when check set in holder tells me correct items set. public view getview(int position, view convertview, viewgroup parent) { int layouttype = getitemviewtype(position); listviewrow item = null; if(convertview == null) { item = atindex(position); holder = new viewholder(); convertview = getconvertview(layouttype, parent);//viewholder items declared here convertview.settag(-1, holder); } else if(!viewmatchestype(layouttype, convertview.getid())){ item = atindex(position); holder = new viewholder(); convertview = getconvertview(layouttype, parent);//viewholder items declared here convertview.settag(-1, holder); } else { holder = (viewholder) convertview.gettag(-1); item = atindex(position); } setdisplay(item, c

asp.net mvc - MVC 4 load partial view dynamically on single page -

Image
i have mvc 4 application has single home view. have 3 link buttons , want load 3 different forms dynamically based on button click. using mvc partial views. so, if click on button-1 should load partialview-1 , should send value-1 corresponding text box partialview-1. i looking mvc inbuilt approach rather doing heavy javascript work. you can this . a. have different methods inside controller returning partialviewresult [httpget] public partialviewresult getpartialview1(int value) { return partialview("_partialview1"); //this view should exist in appropriate views folder. } b. buttons on left handside should @ajax.actionlink @ajax.actionlink( "button1", "getpartialview1", new { value1 = 1}, new ajaxoptions { httpmethod = "get", insertionmode = insertionmode.replace, updatetargetid = "righthandsidebox" } ) c. updatetargetid =

Spring WS Security WSS4J with SAML from WSO2 -

earlier in assumption that, wss4j not compatible saml, see http://jaminhitchcock.blogspot.in/2014/05/creating-and-validating-saml-assertions.html , hope give try. want use identity provider(wso2) generate saml token. should able configure wss4j securitypolicy.xml file verifies token identity provider. please let me know can start looking it? thanks there 2 ways can generates saml tokens identity server. use identity server saml2 sso idp implements saml2 sso web browser based profile. use identity server sts (security token server) ws-trust specification. i think, more hoping use identity server sts. sts, identity serve provides web service retrieve saml tokens. sts web service can secured ws-security mechanism default. example, can secure sts service user name token. client needs send rst request user name token. once user authenticated, client received saml token. think, can find information sts service here

android - AngularJS, PhoneGap, ionic, grunt difference between web and mobile -

okay not sure what's going on... i build simple app using: "angularjs, phonegap, ionic, grunt"... after grunt:dist or grunt serve see nicely working in browser but when try run grunt ripple or grunt build + phonegap build android + phonegap run android able see ionic header , no content... idea possible wrong? because have no idea causing it. is there need take care when switching mobile? or ? the console clean well: → adb logcat | grep -i console i/web console(28936): falling on prompt mode since _cordovanative missing. expected android 3.2 , lower only.:966 ahhhhhhhhhhh found answer!!! as eduardo mentioned there problem slash @ beginning of template path. it should be: templateurl: "scripts/src/landingpage/views/home.html", maybe find useful. for more detailed explanation checkout eduardo's answer.

perl - Why does my output go to next line when there is no next line character in the script -

i learning & writing basic perl script follows:- print "please enter name dear: "; $name = <stdin>; print "${name} learning perl"; for reason, output displayed as:- please enter name dear: saas saas learning perl why text after input name go next line character when there isn't \n mentioned anywhere? print "please enter name dear: "; $name = <stdin>; chomp $name; print "${name} learning perl"; notice line 3. when send "saas" must press enter send it. newline appended name variable. chomp remove you

python - How to change the colour of menu in Tkinter under windows? -

i'm using windows xp . want change menubar , labels foreground , background in tkinter. but, i'm unable change. can change in windows xp or have upgrade windows 7. from tkinter import * root = tk() menubar = menu(root) menubar.add_command(label = 'label1', command = log, background = 'black', foreground = 'red') root.config(menu=menubar) root.mainloop() i'm able display want , code working in linux . but, it's not changing color in window. need use additional commands make work? there nothing can do. tkinter uses native menu object menus, means have same , feel of other windows menus.

objective c - iOS Cocoa NSArrayI length]: unrecognized selector sent to instance -

i trying determine causing error: 2014-06-08 20:40:44.076 database[8656:70b] -[__nsarrayi length]: unrecognized selector sent instance 0x8a44050 here code. nsdictionary* json = [nsjsonserialization jsonobjectwithdata:responsedata options:0 error:&error]; this breaking point error occurs: nslog([json allkeys]); sample of json being used input: {"1":{"key":"1","contentone":"aaa","contenttwo":"testing"},"2":{"key":"2","contentone":"bbb","contenttwo":null},"3":{"key":"3","contentone":"ccc","contenttwo":"testing"}} [json allkeys] returns nsarray , while nslog expects formatting string. try this: nslog(@"%@", [json allkeys]);

figures do not display in Eclipse GEF viewer -

i create scrollinggraphicalviewer show figures, no figure displays. debugged source , seems object (figures, editparts, models) created, no exceptions. why figures not display? since code larege , spread many java files, briefly depict did. creating model objects. in model, there 2 kinds of elements, directory , file. directory may contain other directories or files. figure objects. create 2 kinds of figures, 1 directory, other file. directory figure can have nested figures nested directories , files. editpart objects. each kind of model elements, i.e., directory , file, connect relation between model , figures. an editpart factory object, create each editpart object. create scrollinggraphicalviewer object (viewer). , invoke following methods on viewer: viewer.createcontrol(), viewer.setrooteditpart(), viewer.seteditpartfactory, , viewer.setcontents(). anything missing? clues , comments appriciated. thanks. overriding refreshvisuals() in editpart s trick. co

php - how to get data from post method -

my problem have 2 pages on first page giving mcq's name have given radio button same in mysql table index id how can recieve posted value on other page code folllows: $result = mysql_query("select * mcq order rand()",$connection); if(!$result) {die("could not query".mysql_error());} while($row = mysql_fetch_array($result)) { echo "<form action=\"grade.php\" method=\"post\">"; echo "question number : {$row['id']}<br>{$row['ques']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-a']}>{$row['op-a']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-b']}>{$row['op-b']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" valu

bash - Write to a file whose path does not exist yet -

i want write file file.txt using terminal in /dir1/dir2/dir3/dir4...dirn/file.txt the path /dir1/dir2/dir3/dir4...dirn/ not exist. how can write file path gets created on fly? just use mkdir -p ths: mkdir -p /dir1/dir2/dir3/dir4...dirn/ the -p creates whole directory structure if not exist. explained in mkdir man page: create intermediate directories required. if option not specified, full path prefix of each operand must exist. on other hand, option specified, no error reported if directory given operand exists. intermediate directories created permission bits of rwxrwxrwx (0777) modified current umask, plus write , search permission owner. and here used in 1 small shell script; going /dir1/dir2/dir3/dir4/ example: if [ ! -d /dir1/dir2/dir3/dir4/ ]; mkdir -p /dir1/dir2/dir3/dir4/; fi; echo "hello world" >> /dir1/dir2/dir3/dir4/file.txt or make bit more flexible, can add variables & use dirname file basepath:

java - error: cannot find symbol login.render(form(Login.class)) -

i trying tutorial here: http://www.playframework.com/documentation/2.1.0/javaguide4 but after adding method "application.java" class, have problem, variable "login" cannot found: public static result login() { return ok( login.render(form(login.class)) ); } afters searching internet, might doing wrong, found several suggestions, might have forgotten create login view , in case called: "login.scala.html". maybe have named wrong?! don't know, i tried "$ clean" command , "$ compile" command in play console, still while,trying compile project throws error message: error: cannot find symbol: method form(class(login.class)) symbol: method form(class<login>) location: class appplication any ideas might reason error? you might need add "views.html" before "login.render..." so right code should follows (if maintained proposed file structure play framework documentation): p

sorting - alphabet sort in mysql -

i using test data "bank" study mysql on mac. have question alphabet sort in mysql. i have example code select cust_id,cust_type_cd,city,state,fed_id customer order 2 asc; the return shows in column 2, "i" before "b". anyone knows reason? many thanks. i guess cust_type_cd enum column "i" ordered before "b" in enum definition. enums sort ordinal position of value in list defined enumeration, not alphabetical value. to sort alphabetically, either define enum entries in alphabetical order, or else force value converted string value: ... order concat(cust_type_cd) asc see http://dev.mysql.com/doc/refman/5.6/en/enum.html#enum-sorting note using function in order by clause spoils chance of using index sorting. forced use filesort.

html5 - No input validation message in Opera -

enter not valid email address or text, press ok - opera 22 not display validation error message , form isn't submitting... opera bug or i'm doing wrong? <form> <input type="email"/> <button type="submit">ok</button> </form> test here: http://jsfiddle.net/spueg define mean not valid e-mail, there pretty counter intuitive regex pattern e-mail validation, according rfc 5321 , rfc 5322. syntax the format of email addresses local-part@domain local-part may 64 characters long , domain name may have maximum of 253 characters – maximum of 256-character length of forward or reverse path restricts entire email address no more 254 characters long. the formal definitions in rfc 5322 (sections 3.2.3 , 3.4.1) , rfc 5321 – more readable form given in informational rfc 3696[3] , associated errata. local part the local-part of email address may use of these ascii characters. rfc 6531 permits unicode character

Java syntax array -

i can never find code perform: functionname(new float[]{factor}); is array declaration? mean: new float[]{factor} it equal to float[] arrayname = new float[factor]; ? new float[]{factor} is 1 type of array declarations in java . creates new float array factor value in it. another ways how can declare arrays: for primitive types: int[] myintarray = new int[3]; int[] myintarray = {1,2,3}; int[] myintarray = new int[]{1,2,3}; for classes , example string, it's same: string[] mystringarray = new string[3]; string[] mystringarray = {"a","b","c"}; string[] mystringarray = new string[]{"a","b","c"}; source how declare , initialize array in java?

PHPSTORM code style - Have different tab settings for view and save -

i current required have code meet psr1/psr2 coding standards in phpstorm. unfortunately means code has 4 space tabs, , prefer 2 space tabs. is there anyway in phpstorm view code having 2 space tabs save code 4 space tabs. due our procedure git wouldn't able physically convert files between 2 , 4 spaces. i hoping there nice easy hack allow this

HTML Form not submitting -

here simple code : <html> <head> <link href='http://fonts.googleapis.com/css?family=lato:400italic' rel='stylesheet' type='text/css'> <style> body { color:#f6f6f6; font-family: 'lato', sans-serif; } table,th,td { border:1px solid #e9e581; border-collapse:collapse; padding:6px; } td { text-align:center; } </style> </head> <body bgcolor="#2b2b2b"> <div align="center"> <br><br><br> <form action="dodajs.php" method="post"> ime: <br> <input type="text" name="ime"><br> prezime: <br> <input type="text" name="prezime"><br> adresa: <br> <input type="text" name="adresa"><br> broj tel: <br> <input type="text" name="brojtel"><br> broj indeksa: <br> <input type=&quo

XSLT:Break up tag structure at specic tag -

i have xml file processed using xslt 2.0 can contain tag adhering dtd fragment <!element p (#pcdata|foo|bar|table)* > that input file (just 1 of possible variants) <p>foobar <table attr1="a" attr2="b">...</table> <foo fooattr="foo">fdaghd</foo><bar>something</bar>sometext <table attr1="b">...</table> </p> i need convert (where namespace must preserved, no usage of copy or copy-of these creates xmlns="" attributes) <p>foobar</p> <table attr1="a" attr2="b">...</table> <p> <foo fooattr="foo">fdaghd</foo> <bar>something</bar> sometext </p> <table attr1="b">...</table> that "split" <p> -tag whenever <table> -tag found , continue <p> after (if there children left). please note valid input example <p

regex - Python - Seperate alphanumeric list into integer and string -

i trying manipulate csv file containing data this: ['193t','4234234234'],['30t','54353456346'],['203k','4234234234'],['19e','4234234234'] the alphanumeric string should separated number , single character , put array int() , string already. second step cluster of same characters , sort them integer. ending this: [19,'e',4234234234],[203,'k',4234234234],[30,'t',54353456346],[193,'t',4234234234] i hope can grasp idea behind it. thank in advance. l = [['193t','4234234234'], ['30t','54353456346'], ['203k','4234234234'], ['19e','4234234234']] # using list comprehension [[int(i[0][:-1]), i[0][-1], int(i[1])] in l] output [[193, 't', 4234234234], [30, 't', 54353456346], [203, 'k', 4234234234], [19, 'e', 4234234234]] then can sort using second element key

youtube api - Access Not Configured. Please use Google Developers Console to activate the API for your project -

Image
i getting same error thats solution suggested in below answer. not able find "referers" option under project. getting error 403: access not configured. please use google developers console activate api project thanks now called "any ip allowed"

logging - Git - List files created by author -

is there way list files created specific author using git ? need filter these results, either filename (regex/pattern) or folder created. so i'm looking list of created (not updated) files author without filename duplication , without commit messages. list commits adding files, showing commit author , added files; paste author front of each file listed: # add `--author=pattern` log arguments restrict author # add `--format=` template # add restrictions `/^a\t/` selector in awk, # ... /^a\t/ && /\.c$/ { etc. git log --name-status --diff-filter=a --format='> %an' \ | awk '/^>/ {tagline=$0} /^a\t/ {print tagline "\t" $0}'

java - Jetty http lookup when not connected to internet -

i have embedded jetty server, using jetty 9. trying run it's local instance host=localhost , port =8080, when machine connected internet works well. when not throws exception - idea how can fix this? java.net.unknownhostexception: java.sun.com @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:178) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) @ java.net.socket.connect(socket.java:579) @ java.net.socket.connect(socket.java:528) @ sun.net.networkclient.doconnect(networkclient.java:180) @ sun.net.www.http.httpclient.openserver(httpclient.java:432) @ sun.net.www.http.httpclient.openserver(httpclient.java:527) @ sun.net.www.http.httpclient.<init>(httpclient.java:211) @ sun.net.www.http.httpclient.new(httpclient.java:308) @ sun.net.www.http.httpclient.new(httpclient.java:326) @ sun.net.www.protocol.http.httpurlconnection.getnewhttpclient(httpurlconnection.java:996) @ sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnectio

navigation - Durandal local caching -

i building spa using durandal , asp.net web api. i retrieve dictionary table (lookup table) , cache on client side.. have viewmodel dictionary: ko.observablearray([]) and access in other module when needed. the goal avoid reading of list server during application's lifetime. any ideas (examples welcome) ladies , gentlemen, answer simple , staring me in face : arm modules singletons , live lifetime of application. http://durandaljs.com/documentation/creating-a-module.html

php - Returning Multiple Variables with isset() -

i have bit of code returns user agent, running through function parse it. code have used returns 1 variable parsing function (there three: 'platform' 'browser' 'version'): function my_get_user_agent($value) { $browser = parse_user_agent(); return isset($browser['platform']) ? $browser['platform'] : ''; } while code works return platform of user agent, need append return 3 variables in function. changed first half of code assume correct: return isset($browser['platform'], $browser['browser'], $browser['version'])? $browser['platform'] : ''; i unsure, however, need return 3 values. suggestions? you can return entire array: return $browser; then access values later: $browser['platform']; $browser['browser']; $browser['version']; reading question again, seem want ensure value set. can this: foreach($browser $value) { if(isset($value)) {

Using SceneKit in Swift Playground -

Image
i've looked everywhere i'm coming blank. how replicate chris lattner demonstrating playgrounds , scenekit @ wwdc? want have scenekit scene, animating, in playgrounds. i tried cutting , pasting setup code scenekit project template, thinking magically start rendering, not. i tried watching keynote , pausing , zooming on on lattner's screen looking hints @ source code, appeared importing code elsewhere in project, gave me no clues. there not seem in documentation, or i'm missing it. since swift doesn't have source compatibility between versions, code in answer might not work in either future or previous versions of swift. has been updated work in xcode 7.0 playgrounds swift 2.0. the xcplayground framework need, , it documented here . here simple scene started scene kit in swift: import cocoa // (or uikit ios) import scenekit import quartzcore // basic animation import xcplayground // live preview // create scene view empty scene var

python argparse, how to refer args by their name -

this question argparse in python, easy import argparse parser=argparse.argumentparser() parser.add_argument('--lib') args = parser.parse_known_args() if args.lib == 'lib': print 'aa' this work, instead of calling args.lib, want 'lib' (i dont want type more), there way export args variable out of module (ie changing scope). can directly check value of lib not specifying name of module @ front ps: have lot of variables, not want reassign every single one first, i'm going recommend using args specifier. makes clear lib coming from. said, if find you're referring argument lot, can assign shorter name: lib = args.lib there's way dump attributes global namespace @ once, won't work function's local namespace, , using globals without reason bad idea. wouldn't consider saving few instances of args. enough reason. said, here is: globals().update(args.__dict__)

ios - How to "dismiss" a UIViewController that was set as rootViewController at MyScene (SpriteKit)? -

i'm creating game using spritekit , make class pause settingsviewcontroller *pause = [[settingsviewcontroller alloc] init]; self.view.window.rootviewcontroller = set; now want set self.view.window.rootviewcontroller = nil; from pause , make game go left. obs: used self.scene.view.paused = yes; to stop skscene. just show custom view hide it, when comes remove it. allows show game's splash screen when in background public override void didenterbackground (uiapplication application) { addscreencover (); } public screencoverview addscreencover(float alpha = 1f) { screencoverview view = new screencoverview (window.bounds); view.alpha = alpha; window.addsubview (view); window.bringsubviewtofront (view); return view; } public void removescreencover() { foreach (var view in window.subviews) { if (view.gettype () == typeof(screencoverview)) { uiview.animat

php - Assign Session Values Via Object -

i have been trying assign/change/update session values within object. what trying create session , assign value in object format , update values object called/initiated. <?php class session { var $namespace; //null default var $session; //run session essantials public function __construct($sessionname=null, $assignedvalue=null, $booleneroftype=null){ $this->namespace = (!empty($sessionname))?$sessionname:null; if(!empty($_session[$sessionname])){ if(!empty($assignedvalue)){ //this overwrites existing value of session $_session[$sessionname] = $assignedvalue? $assignedvalue : new stdclass; }else{//end of if $_session[$sessionname] = (!empty($_session[$sessionname])==true)? $_session[$sessionname] : new stdclass; } }elseif(!isset($_session[$sessionname]) or empty($_session[$sessionname])){//end of i

regex - Find a line with leading and/or trailing space(s) -

create regular expression find line leading and/or trailing space(s). guys, have no idea how start. care lighten me up? to see if such lines exist, can use simple regex (see online demo ): ^ | $ to match lines, use (see online demo ): ^(?: .*$|.* $) to match spaces, use (see online demo ): ^ +| +$

jsf - How to set radio button as true bydefault -

i want make radio button bydefault true. sample code given below: <p:selectoneradio value="#{empcategorybean.dto.is_esi}" disabled="#{empcategorybean.sta}" > <f:selectitem itemlabel="yes" itemvalue="1"/> <f:selectitem itemlabel="no" itemvalue="0"/> </p:selectoneradio> go following link:- jsf set default value radio button h:selectoneradio set value in backing bean desired default value. example if want "1" default:

php - How to Change date-picker design in magento front-end? -

Image
how can change date-picker design in magento? by default magento gives date-picker you can style datepicker css. can find css files in directory skin/frontend/[package]/[theme]/css.

android - is multi-hovering touch technology possible? -

it bit interesting switch android days, interested in knowing if multi-hovering possible. base on search: from cypress technology in xperia sola's floating touch , multiple hover not possible using self-capacitance because of ghosting issue. currently samsung galaxy s4 has hovering capabilities using synaptics s5000b controller accepts 1 finger hover. according rumor multi-hovering touch feature on galaxy s5 using synaptics touch tech, possible. not included in release, wondering how works. i ask if can give me additional insight/details multiple hover, example 4 fingers hovering screen. multi-hover possible? useful in application in future though. i did research 2 years ago, , found few hardware companies made breakthrough in field, of them implemented technologies in current products (just mentioned) not enough... i'm curious kind of technology too, in fact ux specialist, can see endless possibilities useful applications delivering better user experi

c# - DataGrid copy to clipboard - losing data -

i wrote app generating report , after clicking right button exports data excel. when use don't want press button. want do: ctrl + a , ctrl + c , paste excel. the problem here after ctrl + v pastes 241 rows excel in report there 244 rows. cuts 3 rows. have no idea why, tought there limit when i'm generating report less rows cuts 2 rows. idea why happening ? btw: didn't write method copying couldn't screw anything. grateful if me. are using web app or windows app? you mimic button press using key combination (like ctrl+v) if it's web app look here more information: http://dmauro.github.io/keypress/

rewrite - Wordpress - changing a custom post type archive link -

i had create custom post type, let's call 'trucks'. link archive of posts looks that: http://example.com/wpdirectory/?post_type=trucks want that: http://example.com/wpdirectory/trucks without '?post_type=' query. how can affect it? try using add_rewrite_rule() function functions.php file. try this: add_action( 'init', 'rewriteposttype' ); function rewriteposttype(){ add_rewrite_rule('^wpdirectory/([^/]*)/?','index.php?post_type=$matches[1]','top'); add_rewrite_tag('%post_type%','([^&]+)'); } otherwise can overwrite permastructures in settings -> permalinks in wordpress , hard code in.

MVVM : Binding Commands with Collection to Listbox in WPF -

i have list box in there different controls button , text box etc in item template, have collection bind listbox, works fine , want move code mvvm , , write commands in view model clicks events of buttons , how can bind collection + commands list box ??? because commands not in collection, data template list box <datatemplate x:key="listitemtemplate"> <grid showgridlines="false"> <grid.rowdefinitions> <rowdefinition></rowdefinition> <rowdefinition></rowdefinition> <rowdefinition></rowdefinition> </grid.rowdefinitions> <dockpanel grid.row="0" name="commentspanel" lastchildfill="false" minwidth="350"> <textblock name="txtusername" isenabled="false" text="{binding username}" width="auto" dockpanel.dock="left"

load - jQuery fadein when loaded with timer -

i want build script loads external file div when page loaded, , fades content in content has been loaded completely. want display first div 60 seconds, , fadeout first div , fadein second div has loaded completely. now have different processes in script reloads content of div while it's visible... want reload div before fades in, , display 60 seconds, , same process next div. can me out? i|ve been trying lot of things here, can't work want to. this code have far; <html> <head> <title> title </title> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script> <script type='text/javascript'>//<![cdata[ $(window).load(function(){ var divs = $('.fade'); function fade() { var current = $('.current'); var currentindex = divs.index(current), nextindex = currentindex + 1; if (nextindex >= divs.length) {