Posts

Showing posts from July, 2011

php - MysQL Get Time via Query -

the time in row 'signup' stored this: "1427538785" not able use method: where date(signup) = date(now()) but need query time of signup today.. any idea how solve this? you need from_unixtime mysql> select from_unixtime('1427538785','%y-%m-%d'); +----------------------------------------+ | from_unixtime('1427538785','%y-%m-%d') | +----------------------------------------+ | 2015-03-28 | +----------------------------------------+ 1 row in set (0.00 sec) so query where from_unixtime(signup,'%y-%m-%d') = curdate();

c# - Calculate 1 + 1!/X + 2!/X^2 + … + N!/X^N -

hi guys tried make program in c# calculates 1 + 1!/x + 2!/x^2 + … + n!/x^n giving wrong results tried debugging cant find mistake can me that? console.writeline("calculate 1 + 1!/x + 2!/x^2 + … + n!/x^n"); console.write("n:"); double n = double.parse(console.readline()); console.write("x:"); double x = double.parse(console.readline()); double result = 1; int ifac = 1; (int = 1; <= n; i++) { (int j = i; j >= 1; j--) { ifac *= j; } result += ifac / math.pow(x, i); } console.writeline(result); you need add ifac = 1; in each loop. console.writeline("calculate 1 + 1!/x + 2!/x^2 + … + n!/x^n"); console.write("n:"); double n = double.parse(console.readline()); console.write("x:"); double x = double.parse(console.readline()); double result = 1; int ifac = 1; (int = 1; <= n; i++) { ifac = 1; //this line important (int

I am trying to implement QuickSort in java but Could not get output? -

i trying implement quicksort taking last element pivot. unable produce valid output. also change needs done in order make randomized? coding in java. public class quicksortdemo { public static void quicksort(int a[], int temp[], int left, int right) { int q, i; //why u need check base case if (left < right) { q = partition(a, temp, left, right); quicksort(a, temp, left, q - 1); quicksort(a, temp, q + 1, right); (i = 0; < a.length; i++) { system.out.println(a[i]); } } } public static int partition(int a[], int temp[], int left, int right) { int x, i, j; x = a[right]; = left - 1; (j = left; j <= right - 1; j++) { if (a[j] <= x) { = + 1; a[i] = a[j]; } } a[i + 1] = a[right]; return + 1; } public static void main(string s[]) {

android - uiautomatorviewer giving java main class error -

hi trying open uiautomatorviewer after installing androidsdk-uiautomatorviewer in ubuntu 14.04 everytime trying open uiautomator viewer getting following error. root@xxxxxxx-hp-z400-workstation:/home/xxxxx# uiautomatorviewer exception in thread "main" java.lang.noclassdeffounderror: org/eclipse/jface/window/applicationwindow @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclasscond(classloader.java:631) @ java.lang.classloader.defineclass(classloader.java:615) @ java.security.secureclassloader.defineclass(secureclassloader.java:141) @ java.net.urlclassloader.defineclass(urlclassloader.java:283) @ java.net.urlclassloader.access$000(urlclassloader.java:58) @ java.net.urlclassloader$1.run(urlclassloader.java:197) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ sun.misc.launcher$extclassloader.findclass(launcher.java:229)

c# - How can I connect on my own PC to a local FileZilla FTP server for testings? -

i downloaded filezilla server , installed it. then use in filezilla address: 127.0.0.1 port: 14147 , admin user name: admin and connected fine. want connect server upload download , delete files using c#. this code. code working fine when used online ftp server @ ipage.com but want use filezilla. string fff = ""; public string[] getfilelist() { string[] downloadfiles; stringbuilder result = new stringbuilder(); webresponse response = null; streamreader reader = null; try { ftpwebrequest reqftp; reqftp = (ftpwebrequest)ftpwebrequest.create(new uri("ftp://" + f.host + "/")); fff = "ftp://" + f.host + "/"; reqftp.usebinary = true; reqftp.credentials = new networkcredential(f.username, f.password); reqftp.method = webrequestmethods.ftp.listdirectory; reqftp.proxy = null; reqftp.keepalive = false; reqftp.usepassive = false;

javascript - Hide divs when another div is expanded? -

i have 8 divs on page. 4 @ top , 4 @ bottom. 4 divs @ top have piece of javascript code expands/unhides div below them (see jsfiddle). make when these divs expanded 4 divs @ bottom of page hide. then, when div unexpanded, 4 divs @ bottom of page show again. please see jsfiddle: https://jsfiddle.net/44478c41/ i don't have knowledge of javascript had fiddle around existing code try , work, managed hide div not content within div, nor able unhide again. here edited code to: $(document).ready(function() { var $cont; function tgl_conts(){ $('.static').stop().animate({height: 0},1200); $cont.stop().animate({height:210},1200); } $('.tab_collapsable').on('click',function(){ var tabclass=$(this).attr('class').split(' ')[1]; $cont = $('.'+tabclass+':not(.tab_collapsable)'); var h = ($cont.height() === 0) ? tgl_conts() : ( $cont.stop().animate({height: 0},1200) )

ember.js - How to change controller property from component? -

i have property in controller. want use component update controller property. usual component parameter passing works when i'm using text field guides say, in case, i'm changing value in code, not input fields. binding seems broken. what method similar propertydidchange() or notifypropertychange() should use accomplish this? can provide simple example know make method call? personalities controller `import ember 'ember'` personalitiescontroller = ember.arraycontroller.extend eivalue: -> if params.name params.name.charat(0) else 'e' nsvalue: -> if params.name params.name.charat(1) else 'n' tfvalue: -> if params.name params.name.charat(2) else 't' pjvalue: -> if params.name params.name.charat(3) else 'p' type: (-> this.get('eivalue') + this.get('nsvalue') + this.get('tfvalue') + this.get('

variables - No overload for method 'zwierze' takes 0 arguments c# -

i haven't errors, program generates 0 animalage. should generate numbers 1-20. simple game player should find age of animal. corrected, still 0. public class losowaniez { public int animalage; public static random animalage1 = new random(); public int age2 { { return animalage1.next(20); } } } public class animal { public void fish() { console.writeline("zwierze moze miec maksymalnie 10 lat, zgadnij ile ma lat"); int x = convert.toint32(console.readline()); } public int zwierze(losowaniez c) { int animalage = c.age2; console.writeline("zwierze moze miec maksymalnie 20 lat zgadnij ile ma lat"); int x = convert.toint32(console.readline()); if (x == animalage) { console.writeline("wygrales g

unity3d - Why Visual Studio 2012 Tools for unity do not work? -

Image
i use visual studio 2012 ultimate , unity 3.5.1f2.i use visual studio 2012 tools unity in game programing.when click on (visual studio tools\open in visual studio) ,show message : project incompatible current edition of visual studio visual studio 2012 tools unity installed in vs , imported in unity properly.what problem? please help you need install unity plugin vs per documentation on unity vs website. the extension need can found here ... https://visualstudiogallery.msdn.microsoft.com/7ab11d2a-f413-4ed6-b3de-ff1d05157714

javascript - parse cloud code push notifications not working -

Image
i'm working on project , decided use cloud code send these user user push notifications. here's want do: when new row created/saved take content 'touser' column pointer<_user> , once i've got content 'touser' column i'd send push notification username, , usernames available under 'username' string in '_user' class. this code i've tried use: parse.cloud.aftersave("custommessage", function(request, response) { var touser = request.object.get('touser'); var pushquery = new parse.query(parse.installation); pushquery.equalto('touser', touser); parse.push.send({ where: pushquery, // set our installation query data: { alert: "you've got new message " + touser } }, { success: function() { // push successful response.success(); }, error: function(error) { throw "

entity framework - EF one to many relation -

i use ef's code first approach. have following 3 classes: public class inquiry { public guid id { get; set; } public string title { get; set; } public string description { get; set; } public virtual applicationuser createdby { get; set; } public virtual contractor contractor { get; set; } public ilist<applicationuser> inquiryusers { get; set; } public ilist<inquirycomment> comments { get; set; } public ilist<hydrotechemail> emails { get; set; } public inquirystate state { get; set; } public list<string> attachments { get; set; } public datetime? timeofcreation { get; set; } public datetime? timeofmodification { get; set; } } public class hydrotechemail { public guid id { get; set; } public string subject { get; set; } public string content { get; set; } public string fromdisplayname { get; set; } public string fromaddress { get; set; } public list<string> todisplayname

oop - Why am I getting two different outputs in Java code -

class { int xyz = new b().show(); // prints c=0 , z=null int c = -319; b z = new b(); int lmn = z.show(); // prints c=-319 class b { int show() { system.out.println("c=" + c); system.out.println("z=" + z); return -555; } } } class c { public static void main(string args[]) { p = new a(); } } why getting c=0 , c=-319 later. similarly, why z null , after not null . happening in code? you need know new operator responsible creating empty instance of class (instance fields have default values: numeric: 0 ; boolean: false , char: '\0' , reference: null ). code of constructor invoked after new finish job, , responsible setting correct state such empty object. now initialization of fields happens in constructor, code class { int xyz = new b().show(); // prints c=0 , z=null int c = -319; b z = new b(); int lmn = z.show(); // prints c

android - What to put in the single tap confirmed method so that a specific view does a specific job on tap -

what put in single tap confirmed method specific view specific job on tap? have imageviews in layout , want on single tap each imageview specific job. can tell me amethod has it. ` public boolean onsingletapconfirmed(motionevent e){ toast.maketext(creaacount_5.this, "single tap", toast.length_short).show(); edittext b=(edittext)findviewbyid(r.id.edittext1); b.append("*"); switch(id){ case 0: id=r.id.imageview1; toast.maketext(creaacount_5.this, "play", toast.length_short).show(); sharedpreferences s1=getsharedpreferences(mypreferences,mode_private); sharedpreferences.editor editor1=s1.edit(); editor1.putint("play", r.drawable.playing); editor1.commit(); break; case 1:

Issue with installing Python in Linux / CentOS -

issue installing python in linux / centos? i downloaded , unzipped tar file: python-2.7.9.tgz https://www.python.org/downloads/ when run setup.py below error message. know how upgrade python 2.6 2.7 in centos? $python setup.py traceback (most recent call last): file "setup.py", line 9, in <module> import sysconfig importerror: no module named sysconfig best, you seem have downloaded source code of python have compile source code install. follow instructions here: http://bugs.python.org/issue11353

javascript - Read samples from wav-file -

i'm trying make webpage in html5 stores sample-data wav-file in array. there way sample-data javascript? i'm using file-input select wav-file. in javascript added: document.getelementbyid('fileinput').addeventlistener('change', readfile, false); but have no idea in readfile. edit: tried file in arraybuffer, pass decodeaudiodata method , typedarraybuffer out of it. code: var openfile = function(event) { var input = event.target; var audiocontext = new audiocontext(); var reader = new filereader(); reader.onload = function(){ var arraybuffer = reader.result; console.log("arraybuffer:"); console.log(arraybuffer); audiocontext.decodeaudiodata(arraybuffer, decodeddone); }; reader.readasarraybuffer(input.files[0]); }; function decodeddone(decoded) { var typedarray = new uint32array(decoded, 1, decoded.length); console.log("decoded"); console.log(decoded); console.log("typedarray"); console.log(typedarray); (

swift - Delete user row in Parse Data browser -

import uikit class listeutilisateurspfquerytableviewcontroller: pfquerytableviewcontroller, uisearchbardelegate { var images = [nsdata]() var userobjects: nsmutablearray = nsmutablearray() // table search bar @iboutlet weak var searchbar: uisearchbar! // initialise pfquerytable tableview override init!(style: uitableviewstyle, classname: string!) { super.init(style: style, classname: classname) } required init(coder adecoder: nscoder) { super.init(coder: adecoder) // configure pfquerytableview self.parseclassname = "_user" self.textkey = "username" self.pulltorefreshenabled = true self.paginationenabled = false } // define query provide data table view override func queryfortable() -> pfquery! { userobjects.removeallobjects() var query = pfuser.query() object in objects{ let user: pfobject = object pfobject

C# start.process powershell longer runtime than native ps1 -

i'm using following c# code run powershell script, script runs within second when run outside of c# within following c# code block runs in excess of 9 secs. c# code compiled , run windows service under same user account (tested outputting whoami in powershell script.) string csv = jobpath + requesttype[2] + ".csv"; string id = "123321"; var scriptfile = @"c:\jobrunner\jobrunner.ps1"; processstartinfo startinfo = new processstartinfo(); startinfo.filename = @"powershell.exe"; startinfo.arguments = @"" + scriptfile + " '" + csv + "' " + " '" + id + "'"; startinfo.redirectstandardoutput = false; startinfo.redirectstandarderror = false; startinfo.useshellexecute = false; startinfo.createnowindow = true; process process = new process(); process.startinfo = startinfo; process.start(); the powershell script loads functions folder such: $date = get-date "start $date

social networking - Removing site meta description from Joomla 3 protostar template -

i have integrated linkedin social share button joomla 3 site. when go share page share popup shows phrase 'my joomla cms' beside site title being shared. not want show. there kind of meta description somewhere in site files cannot figure out how remove it. i have tried following: gone global configuration , changed site meta description , keywords set 'show meta' , 'show version' no; added line: <?php $this->setgenerator(null); ?> to index.php file installed byebyegenerator plugin commented out generator code in head.php , document.php files after of this, linkedin share popup still shows 'my joomla cms' in site title description. how can remove site?

ios - how to make a slider appear when a button is pressed in Swift? -

i'm making draw application, , want slider appear when user taps on button, example set width of line . can add alert , put slider in ? welcome stack overflow. your question more of basic programming question swift question. i don't think can put slider in alert. apple introduced uialertcontroller class recently, , docs should rather uialertview new development. a uialertcontroller lets create alerts , action sheets, , add actions. actions shown buttons. there facility adding text fields. don't think there facility adding other view objects sliders however. the now-deprecated uialertview not set adding custom fields sliders. you put slider on view somewhere , set it's hidden property true, in buttons action method, set myslider.hidden = false. however sounds want slider appear on top of ui, go away when user done it. you create view slider , dismiss button on it, put on top of view controller's content view, , set it's hidden flag tru

php - Cannot INSERT INTO from my form -

i have form <form method="post" action="new_announcement.php"> <fieldset> <legend>create new announcement</legend> subject :<input type="text" style="float-offset: !important;" name="subject" required="required" /><br> content :<br /> <textarea rows="10" cols="60" name="content"></textarea> </br></br> <input type="submit" value="upload"/> </fieldset> </form> and want store data form table in database. my insert into code this... <?php include_once 'header.php'; $username = $_session["username"]; if(isset($_post['username'])) { $subject = $_post['subject']; $content = $_post['content']; $sqlinsert = "insert announcements (author,subject,content) values ('$username','$subject','$content')&

php - How to order the links of different pages in cakephp -

i trying figure out how links should composed in order useful. in cakephp make new pages , links each other . soemthing.com/places/catergory want appear places/category/{name of place}/{id of service type} so in controller in cake php wrote public function category($city){ $data = array('place' => $city); $this -> set('services',$this -> service -> find('all', array('conditions' => array('service.place' => $city)))); $this -> set($data); } but not working, has idea this, need , new cake php pretend answering beginner. something this public function category($city=null,$type=null){ $conditions = array('service.place' => $city,'service.type' => $type); $services = $this -> service -> find('all', array('conditions' => $conditions))); $this -> set(compact('services','city'); } routes.php router::con

Assignment Operator Overload in c++ -

i realize there examples after examples of overloading assignment operator on web, have spent last few hours trying implement them in program , figure out how work , can't seem , appreciated. i trying implement overloaded assignment operator function. i have 3 files working, complex.h header file, complex.cpp definition file, , .cpp file i'm using driver test complex class. in complex.h header file prototype assignment operator: complex &operator= (complex&); and far have definition of overloaded operator in .cpp file is: complex &complex::operator=(complex& first) { if (real == first.real && imaginary == first.imaginary) return complex(real, imaginary); return first; }; and way i'm calling assignment operator in functions is: x = y - z; so specifically, problem when call overloaded assignment operator x = y -z, doesn't assign passed in value x when return passed in value , i

assembly - GNU Assembler adds uncessary padding to the end of the section -

consider following assembler code snipper gnu assembler: .section .text .align 4 .string "text" without padding, result in section of 5 bytes alignment of 2^4 = 16. however, verified gnu assembler (arm target) adds padding end of section such section's length multiple of 16. seems unnecessary alignment guarantee beginning of section, not end. why assembler add padding @ end? can disabled? put above assembler snipper in file called test.s , run following: arm-none-eabi-gcc -c -o test.o test.s arm-none-eabi-objdump -x test.o observe alignment of text section 2^4=16 requested , size of .text section 0x10 instead of 5.

Can I get distance between 3 points using Google Directions API? -

i trying distance between more 2 points. code running fine , can between 2 points want more 2 points. like: point 1 -> point 2 -> point 3 -> point 4 if can me good, in advance. assuming know how find distance between 2 points... might want this : function distanceof(points){ if (points.length<2){ return 0; } if (points.length==2){ //calculate distance between point x point x+1 return math.sqrt(math.pow(points[0].x-points[1].x, 2)+math.pow(points[0].y-points[1].y, 2)) } total=0; (i=0; < points.length-1; i++){ total+=distanceof([points[i],points[i+1]]); } return total; }

Enums with attributes Java -

each color has own static attribute - number. want able change value method. can using enums somehow? or perhaps differently: public enum color { red, orange, yellow; } color.red.setvalue(x); color.red.getvalue(); or have color class? public red extends color { private static int x; public int getredvalue(){ return x; } public void setredvalue(int x){ this.x = x; } } yes, can following: enum colour{ red(1), blue(2); public int value; colour(int valuearg){ value = valuearg; } /*public setvalue(int a){ value = a; } public getvalue(){ return value; }*/ } public class test{ static colour colour = colour.blue; public static void main(string[] args){ colour.value = 3; //colour.setvalue(3); } } you can variable type you'd like. here, each instantiation of

c++ - QRegularExpression For Phone Number -

i trying use regular expressions validate phone numbers allowing numbers accepted not 10, regular expression ^[0-9]{10} should allow 10 numbers 0-9. test strings 1234567890 passed , 703482062323 passed. can fix issue? the code im using test regular expression qregularexpression phone_num("^[0-9]{10}"); // 10 numbers in phone number qregularexpressionmatch match = phone_num.match("12345612312312312121237890"); qdebug() << match.hasmatch(); assuming want exactly 10: ^[0-9]{10}$ match end-of-line doesn't match subset of line more 10. #include <qregularexpression> #include <qdebug> int main() { qregularexpression re("^[0-9]{10}$"); qdebug() << re.match("12345678901123").hasmatch(); qdebug() << re.match("1234567890").hasmatch(); qdebug() << re.match("12345678").hasmatch(); qdebug() << re.match("123123123a").hasmatch(); } output:

linux - how to check if a location is on NFS or RAM -

i know if put file on /dev/shm, put on ram of server. and if put in home directory, put on nfs. and know there command tell if given location on nfs or maybe ram, what's command? ex, how can sure home directory on nfs? remember using command, prints "nfs" can seen you can use df command show directory's mount point: [mrsam@octopus ~]$ df -h . filesystem size used avail use% mounted on /dev/md0 178g 32g 137g 19% /home so, current directory on filesystem that's mounted on /dev/md0. based on device filesystem mounted on, can figure out if it's local filesystem, nfs mount, or else.

asp.net - radio button check and uncheck other radio buttons the web form is connected with a database created using ms access -

i have 2 radio buttons in web application named male , female , used following code check button , uncheck other 1 isnt working when m ruunning both selected .what do? protected void radiobutton1_checkedchanged(object sender, eventargs e) { if (radiobutton1.checked == true) { radiobutton2.checked = false; } else { radiobutton2.checked = true; } } protected void radiobutton2_checkedchanged(object sender, eventargs e) { if (radiobutton2.checked == true) { radiobutton1.checked = false; } else { radiobutton2.checked = true; } you should using radiobuttonlist this. give radio buttons belong same group , automatically have behavior other buttons in group unchecked when different button in group checked.

php - Which technologies to use to start web development? -

right have basic grasp of c++ (and mean basic!). i want learn web development. where should start , used technologies today? welcome on so. in order web development, you'll need learn* (among other things): php (for dynamic webpages) mysql (to store data) html (to display data) css (to format data) javascript , most-used library jquery (to animate webpages) and you'd go. should have programming issue, feel free post question on (by showing have tried , what's causing issue - see this link more info). happy coding! *this list is, of course, non-exhaustive these most used technologies today per op's question.

ios - Swift Changing View with performSegueWithIdentifier / programmatically -

Image
so trying programmatically change views when condition triggered. i have created simplistic project, whereby want change view 2 view 1, once view 1 has loaded. in reality, there logical operation checks if variable true, invokes performseguewithidentifier function, keep simple possible have removed code. the steps have performed are, firstly create 2 views: i click view 1, , inspect properties , created manually triggered segue view 2 i selected 'show' option, views connected segue under attribute inspector, give storyboard segue , identifier of "gotoview2". there go viewcontroller.swift file, , in viewdidload function. insert performseguewithidentifier code: self.performseguewithidentifier("gotoview2", sender: self) however, when run code. view 2 not load, , view 1 appears in simulator. any , explanation appreciated. i have had same problem attempting perform segue inside viewdidload function, , error comes seems view attemp

string - Checking that input is an integer between 1 and 3 - Python -

this question has answer here: asking user input until give valid response 10 answers i want able check input integer between 1 , 3, far have following code: userchoice = 0 while userchoice < 1 or userchoice > 3: userchoice = int(input("please choose number between 1 , 3 > ")) this makes user re-enter number if not between 1 , 3, want add validation ensure user cannot enter string or unusual character may result in value error. catch valueerror : raised when built-in operation or function receives argument has right type inappropriate value example: while userchoice < 1 or userchoice > 3: try: userchoice = int(input("please choose number between 1 , 3 > ")) except valueerror: print('we expect enter valid integer') actually, since range of allowed numbers small, can o

angularjs - Run karma tests in linux terminal -

i'm building automation proccess angularjs project. part of flow have ran karma tests via grunt test on linux (centos) machine without gui interface. have no idea how karma works. can run way? the karma-runner grunt has example of how configure karma run phantom in ci mode(run tests once , exit). have use configuration in gruntfile: karma: { unit: { configfile: 'karma.conf.js', runnerport: 9999, singlerun: true, browsers: ['phantomjs'], loglevel: 'error' } } the browsers array tells karma want use phantomjs(no gui necessary).

android - Login button in PreferenceActivity -

is possible load facebook log in button onto preference activity? how can set preference layout? referring developers.facebook.com add button layout xml file full class name, com.facebook.widget.loginbutton: <com.facebook.login.widget.loginbutton android:id="@+id/login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_margintop="30dp" android:layout_marginbottom="30dp" />

java - "Exception in thread "Animation Thread" error when using Processing in Eclipse -

i have created simple processing sketch in eclipse classes.eclipse says code contains no errors, warnings, fails @ runtime , console displays following errors: exception in thread "animation thread" java.lang.nullpointerexception @ processing.core.papplet.ellipse(papplet.java:12174) @ assignment.tracking.display(tracking.java:15) @ assignment.assignment.draw(assignment.java:16) @ processing.core.papplet.handledraw(papplet.java:2386) @ processing.core.pgraphicsjava2d.requestdraw(pgraphicsjava2d.java:240) @ processing.core.papplet.run(papplet.java:2256) @ java.lang.thread.run(unknown source) the code following: package assignment; import processing.core.*; public class assignment extends papplet { tracking tracking; public void setup() { size(500, 500); tracking = new tracking(); } public void draw() { tracking.display(); } } and code tracking class is: package assignment; import processing

inheritance in java.how to change the variable value of sub class by super class methods -

class sup { private int i; //private one,not gonna inherited. void seti(int s) //this set i.but going set becz in child class? { i=s; system.out.println(i+"of sup class"); //to verify changed } } class cid extends sup //this child class { private int i; //this 2nd i. want change isnt changing on call seti method void changi(int h) //this 1 working in changing 2nd i. { i=h; } void showci() { system.out.println(i+"of cid class"); } } class test { public static void main(string[] args) { cid ob= new cid(); ob.seti(3); //to set of cid class sets sup class ob.showci(); //result shows nothing changed cid class ob.changi(6); // works wanted ob.showci(); // can changed of cid class } } please clarify me whenever use inheritance(or extends) fields(variables , methods except private ones) copy child(or sub)classes or fields can accessed child cl

ios - SKEmmitterNode not Running after First Time -

i have effect created code below. have wired button fire test. on first press effect works intended. however, on subsequent requests effect never displayed. have determined, via breakpoints, effect being called , on both first , subsequent runs making in completion handler. have checked "totaltime" variable part of runaction , have verified same (2 seconds) both first run , subsequent runs. interesting thing in first run observe several second delay between preceding if statement , break point @ completion handler. subsequent runs, however, there virtually no delay between preceding if , completion handler. again have verified duration 2 seconds on runs. lastly, if comment out [self.view setpaused:yes] in completion handler, effect run every time. again though, , code below, can see scene unpaused prior. pausing scenes way occasional effect , don't want use cpu , battery majority of time when these effects not being generated. - (void) smokeeffectatposit

python - Applying "%.1f" to multiple variables -

just started course , exercise learn how use round(x, n) truncate floats . only problem is, didn't. found out how use %.1f online, there way apply multiple variables instead having write on , over? i have set below: a = float(input("a:")) b = float(input("b:")) c = float(input("c:")) d = float(input("d:")) e = float(input("e:")) sum = + b + c + d + e average = sum/5 print ("the sum of ", "%.1f" % (a), ", ", "%.1f" % (b), ",", "%.1f" % (c), ", ", "%.1f" % (d), ", , ", "%.1f" % (e), "is ", "%.1f" % (sum), ". meanwhile, average ", "%.2f" % (average), ".") is there way apply %.1f without having write much? edit: helped out. found onur güngör's have worked best i'm looking for, learned lot more needed everyone's input. appreciate it. i guess want t

Python json parser allow duplicate keys -

i need parse json file unfortunately me, not follow prototype. have 2 issues data, i've found workaround i'll mention @ end, maybe can there well. so need parse entries this: "test":{ "entry":{ "type":"something" }, "entry":{ "type":"something_else" } }, ... the json default parser updates dictionary , therfore uses last entry. have somehow store other 1 well, , have no idea how this. have store keys in several dictionaries in same order appear in file, thats why using ordereddict so. works fine, if there way expand duplicate entries i'd grateful. my second issue same json file contains entries that: "test":{ { "type":"something" } } json.load() function raises exception when reaches line i

mysql - sql query for hierarchal search -

in below relational table, want search user id's whom are under particular sponsorid in hierarchical manner user id name sponsor id 10030080 tulsi ram 10029866 10030079 sarabjeet kaur 10026043 10030078 manjit kaur 100042580 10030077 gurdas singh 10029579 10030076 tarlochan singh 10030072 10030075 gamer singh 10029943 10030074 juginder singh 10030068 10030073 malkin singh 10029740 10030072 parmodkumar 10030018 10030071 samitra devi 10030070 10030070 lohan lal 10030016 10030069 kashmir singh 10030057 10030068 sukhpal singh 10029862 10030067 sandeepsingh 10030066 10030066 gurmelsingh 10030065 10030065 kuldeep kaur 10030064 10030064 harpreet kaur 10030063 10030063 kalwinder kaur 10030062 please suggest query

How to convert a xml file to sql query -

i need on converting xml file sql query file. possible convert it? <mob_proto isoldstructure="false"> <mob vnum="101" name="??" localizedname="cão selvagem" type="0" rank="0" battle_type="0" level="1" event_type="0" mob_color="0" /> </mob_proto> just give sense of how xslt might used this, consider following stylesheet: <?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0"> <xsl:output method="text" doctype-public="xslt-compat" omit-xml-declaration="yes" encoding="utf-8" indent="yes" /> <xsl:template match="//mob"> select * <xsl:value-of select="local-name()" /> vnum = <xsl:value-of select="@vnum" />

expression - SharePoint MOSS 2007 - Calculated field - IsBlank function -

i'm sure simple question using sharepoint 2007 , trying create calculated column check if weather or not field empty. trying accomplish formula check if column empty , if return "this empty" or else return "this not empty". so far got formula below dont understand how else statement in here. not having luck finding info on microsoft's site. =if(isblank([column1]),"this empty") any appreciated. see documentation if function if takes 2 parameters , using first, second parameter else... if( isblank([column1]) , "this empty" , "this not empty" ) in other words.. rtfm https://msdn.microsoft.com/en-us/library/office/bb862071%28v=office.14%29.aspx

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

setcookie - display Email of User on HomePage After login using Cookies PHP -

i trying use cookies display users email address on home page after log in. have used setcookie($email); in loginbase page , using following code wont work. not sure if on right track or not. appreciate advice it. thanks. <?php $email = $_cookie['email']; echo "welcome '" . $email . "; ?> loginbase.php <?php //start session require_once("functions.php"); sec_session_start(); //get informations $email = $_post['inputemail']; $password = $_post['inputpass']; $nextpage = "home.php"; if(isset($email) && isset($password)) { //database connection $connection = mysqli_connect("localhost", "root", ""); mysqli_select_db($connection, "dairy herd system"); //prepare statement query //$statement = mysqli_prepare($connection, "select hash_password, salt user e_mail = ? limit 1"); $statement = mysqli_prepare($connection, &q

android - Build bitmap from view for map marker returns only background of the root element -

i trying build custom bitmap inflating view, insert values , drawingcache. i managed inflate , picture of mainview's background, view on top not shown. missing? layoutinflater inflater = layoutinflater.from(ctx); view markerview = inflater.inflate(r.layout.marker_layout, null, false); markerview.setdrawingcacheenabled(true); imageview eventimage = (imageview) markerview.findviewbyid(r.id.eventimage); textview textattending = (textview) markerview.findviewbyid(r.id.textattending); textview textfriendsattending = (textview) markerview.findviewbyid(r.id.textfriendsattending); eventimage.setimagebitmap(noctisevent.getpicturesmall()); textattending.settext(noctisevent.getattending() + ""); textfriendsattending.settext("na"); markerview.layout(0, 0, 144, 144); markerview.invalidate(); markerview.requestlayout(); markerview.builddrawingcache(); markerbitmap = bitmap.createbitmap(markerview.getdrawingcache()); the xml: <?xml version="1.0"

android - --- SkImageDecoder::Factory returned null -

i trying insert , retrieve image data sqlite database. have following codes. image inserted correctly when try retrieve, logcat shows --- skimagedecoder::factory returned null error. please me this class used create , insert database imageview img; string picpath; bitmap bmp; canvas cnvs; random r; int x, y, height, width; bytearrayoutputstream blob; //sql sql; paint paint; string name, no; uri data; sqlitedatabase db; string[] filepath = {mediastore.images.media.data}; ; cursor cur; textview txt; int colindex; contentvalues ctv; byte[] imgdata; public static final string db_name = "new.db"; public static final string table_name = "sample"; public static final int db_version = 1; public static final string name = "name"; public static final string no = "no"; public static final string img = "img"; public static final strin