Search Results

Search found 186 results on 8 pages for 'jerry'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Jquery Bugs?? Long decimal number after two numbers multiply...

    - by Jerry
    Hi all I am working on a shopping site and I am trying to calculate the subtotal of products. I got my price from a array and quantity from getJSON response array. Two of them multiply comes to my subtotal. I can change the quantity and it will comes out different subtotal. However,when I change the quantity to certain number, the final subtotal is like 259.99999999994 or some long decimal number. I use console.log to check the $price and $qty. Both of them are in the correct format ex..299.99 and 6 quantity.I have no idea what happen. I would appreciate it if someone can help me about it. Here is my Jquery code. $(".price").each(function(index, price){ $price=$(this); //get the product id and the price shown on the page var id=$price.closest('tr').attr('id'); var indiPrice=$($price).html(); //take off $ indiPrice=indiPrice.substring(1) //make sure it is number format var aindiPrice=Number(indiPrice); //push into the array productIdPrice[id]=(aindiPrice); var url=update.php $.getJSON( url, {productId:tableId, //tableId is from the other jquery code which refers to qty:qty}, productId function(responseProduct){ $.each(responseProduct, function(productIndex, Qty){ //loop the return data if(productIdPrice[productIndex]){ //get the price from the previous array we create X Qty newSub=productIdPrice[productIndex]*Number(Qty); //productIdPrice[productIndex] are the price like 199.99 or 99.99 // Qty are Quantity like 9 or 10 or 3 sum+=newSub; newSub.toFixed(2); //try to solve the problem with toFixed but didn't work console.log("id: "+productIdPrice[productIndex]) console.log("Qty: "+Qty); console.log(newSub); **//newSub sometime become XXXX.96999999994** }; Thanks again!

    Read the article

  • C# two classes with static members referring to each other

    - by Jerry
    Hi, I wonder why this code doesn't end up in endless recursion. I guess it's connected to the automatic initialization of static members to default values, but can someone tell me "step by step" how does 'a' get the value of 2 and 'b' of 1? public class A { public static int a = B.b + 1; } public class B { public static int b = A.a + 1; } static void Main(string[] args) { Console.WriteLine("A.a={0}, B.b={1}", A.a, B.b); //A.a=2, B.b=1 Console.Read(); }

    Read the article

  • Get drop down menu value on Jqery

    - by Jerry
    Hi all Got a simple question. I would like to get a drop down menu value when a use clicks it. I tried to write the code on my own, but couldn't do it. Any helps would be appreciated. My Jquery $("#week").change(function(){ var input=$("week: select").val(); alert(input); //display undefiend My Html <form id="week"> <select> <option>Week 1</option> <option>Week 2</option> <option>Week 3</option> <option>Week 4</option> <option>Week 5</option> </select> </form>

    Read the article

  • How to detect how many time the users have click the button...

    - by Jerry
    Hello guys. Just want to know if there is a way to detect how many times a user has clicked a button by using Jquery. My main application has a button that can add input fields depend on the users. He/She can adds as many input fields as they need. When they submit the form, The add page will add the data to my database. My current idea is to create a hidden input field and set the value to zero. Every time a user clicks the button, jquery would update the attribute of the hidden input field value. Then the "add page" can detect the loop time. See the example below. I just want to know if there are better practices to do this. Thanks for the helps. main page <form method='post' action='add.php'> //omit <input type="hidden" id="add" name="add" value="0"/> <input type="button" id="addMatch" value="Add a match"/> //omit </form> jquery $(document).ready(function(){ var a =0; $("#addMatch").live('click', function(){ $('#table').append("<input name='match"+a+"Name' />") //the input field will append //as many as the user wants. a++; $('#add').attr('name', 'a'); //pass the a value to hidden input field return false; }); Add Page $a=$_POST['a']; // for($k=0;$k<$a;$k++){ //get all matchName input field $matchName=$_POST['match'.$k.'Name']; //insert the match $updateQuery=mysql_query("INSERT INTO game (team) values('$matchName')",$connection); if(!$updateQuery){ DIE('mysql Error:'+mysql_error()); }

    Read the article

  • Flex noob questions

    - by Jerry
    Hi all I was wondering how to copy files (like my images files) into my flex 4 src folder from windows explorer. There is no such folder called src when I look at my project folder. Thanks.

    Read the article

  • PHP Class Question

    - by Jerry
    Hi all I am trying to build a PHP class to check the username and password in MySql. I am getting "mysql_query(): supplied argument is not a valid MySQL-Link resource in D:\2010Portfolio\football\main.php on line 38" database has errors:" message. When I move my userQuery code out of my Class, it works fine. Only if it is inside my Class. I am not sure if the problem is that I don't build the connection to mysql inside my Class or not. Thanks for any helps!! Here is my code <?php $userName=$_POST['userName']; $userPw=$_POST['password']; class checkUsers { public $userName; public $userPw; function checkUsers($userName='', $userPw=''){ $this->userName=$userName; $this->userPw=$userPw; } function check1(){ if (empty($this->userName) || empty($this->userPw)){ $message="<strong>Please Enter Username and Password</strong>"; }else{ //line 38 is next line $userQuery=mysql_query("SELECT userName, userPw FROM user WHERE userName='$this->userName' and userPw='$this->userPw'", $connection); if (!$userQuery){ die("database has errors: ". mysql_error()); } if(mysql_num_rows($userQuery)==0){ $message="Please enter valid username and password"; } }//end empty check return $message; }//end check1 method }//end Class $checkUser=new checkUsers($userName, $userPw); echo $checkUser->check1(); ?> I appreciate any helps!!!!

    Read the article

  • Perl ftp question, like the previous ones ...

    - by Jerry Scott
    I need to move or copy a simple text file from one web site to another web site. I have administrator rights to both web sites. The first web site has a large data file (again, just a text file), certain records are selected and written to a team file (for entry into a tournament). Next I go through paypal and pay for the entries. The second site is for the the club running the tournament and I use IPN to return to a script on their site and if it verified, I add the team memebers into the master file for the tournament. I am limited to the ONE IPN script on the tournament site because I have a ton of other entries that come in from all over. The first site has the rosters for the state and no need to type all that data from each club, use the rosters like I use for all the non-paypal tounamenmts. I can ftp the team file to the second server and place it in the folder just like it was created from scratch from that server originally and everything should go fine but I took the examples and tried them and nothing. Here's the code section: my $custom = $in->param('custom'); my $filename = "$ENV{DOCUMENT_ROOT}/database/$custom"; my $usjochost = '208.109.14.105'; my $okserieshost = '208.109.181.196'; my $usjocuser = 'teamentry'; my $okseriesuser = 'okwaentry'; my $usjocpw = 'Password1'; my $okseriespw = 'Password1'; my $file = $custom; my $usjocpath ='/home/content/u/s/j/usjoc/html/database/'; my $okseriespath ='/home/content/o/k/s/okseries/html/database/'; $ftp = Net::FTP->new($okserieshost, Debug => 0) or die "Could not connect to '$okserieshost': $@"; $ftp->login($okseriesuser, $okseriespw) or die sprintf "Could not login: %s", $ftp->message; #$ftp->cwd(/database) or die sprintf "Could not login: %s", $ftp->message; $ftp->get($filename); #$ftp = Net::FTP->new($usjochost, Debug => 0) or die "Could not connect to '$usjochost': $@"; $ftp->quit; I NEED to READ the file on the first web site (okseries.com) and write the file on the second web site (usjoc.com). I have no problem reading and writing the file on the server, is sending the file to the second server. HELP! I'm not a genius at PERL.

    Read the article

  • PHP echo query result in Class??

    - by Jerry
    Hi all I have a question about PHP Class. I am trying to get the result from Mysql via PHP. I would like to know if the best practice is to display the result inside the Class or store the result and handle it in html. For example, display result inside the Class class Schedule { public $currentWeek; function teamQuery($currentWeek){ $this->currentWeek=$currentWeek; } function getSchedule(){ $connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS); if (!$connection) { die("Database connection failed: " . mysql_error()); } $db_select = mysql_select_db(DB_NAME,$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } $scheduleQuery=mysql_query("SELECT guest, home, time, winner, pickEnable FROM $this->currentWeek ORDER BY time", $connection); if (!$scheduleQuery){ die("database has errors: ".mysql_error()); } while($row=mysql_fetch_array($scheduleQuery, MYSQL_NUMS)){ //display the result..ex: echo $row['winner']; } mysql_close($scheduleQuery); //no returns } } Or return the query result as a variable and handle in php class Schedule { public $currentWeek; function teamQuery($currentWeek){ $this->currentWeek=$currentWeek; } function getSchedule(){ $connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS); if (!$connection) { die("Database connection failed: " . mysql_error()); } $db_select = mysql_select_db(DB_NAME,$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } $scheduleQuery=mysql_query("SELECT guest, home, time, winner, pickEnable FROM $this->currentWeek ORDER BY time", $connection); if (!$scheduleQuery){ die("database has errors: ".mysql_error()); // create an array } $ret = array(); while($row=mysql_fetch_array($scheduleQuery, MYSQL_NUMS)){ $ret[]=$row; } mysql_close($scheduleQuery); return $ret; // and handle the return value in php } } Two things here: I found that returned variable in php is a little bit complex to play with since it is two dimension array. I am not sure what the best practice is and would like to ask you experts opinions. Every time I create a new method, I have to recreate the $connection variable: see below $connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS); if (!$connection) { die("Database connection failed: " . mysql_error()); } $db_select = mysql_select_db(DB_NAME,$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } It seems like redundant to me. Can I only do it once instead of calling it anytime I need a query? I am new to php class. hope you guys can help me. thanks.

    Read the article

  • Add jquery link to returned text...

    - by Jerry
    Hi all I am trying to add two jquery plugins files to my application. When a user triggers my ajax event, the server will return text with a form button. The plugins (a jquery calendar) will work when the user clicks the form button inside the returned text . I believe I have to add the link inside the return text instead of the main page to let the code work, but not sure how to do this. I am giving out my code and need you experts opinions. Thanks. My main page html //required jquery plugins ...didn't work if I add them in the main application. <script type="text/javascript" src="JS/date.js"></script> <script type="text/javascript" src="JS/datePicker.js"></script> <script type="text/javascript" src="JS/selectWeek.js"></script> <div id="gameInfo"> //return text will be displayed here. </div> My returned text ...part of it.... <form> <div id=returnDiv> // the form input will be added here when a user clicks #addMatch button... </div> <tr> <td><input type="button" id="addMatch" name="addMatch" value="Add Match"/> </td> </tr> </form> My jquery $("#addMatch").live('click', function(){ //the code below will create a calender when a user click the link...I am not sure //where I should add my two jquery plugins link... $("#returnDiv").html("<td><input type='text' size='6' class='date-pick dp-applied'"+ "name='date'><a style='color:white;' class='dp-choose-date' title='Choose Date'"+ "href='#'>Date</a></td>"; return false; }); I hope I explain my question well. +1 to any reply...:D

    Read the article

  • How to save svg canvas to local filesystem

    - by dr jerry
    Is there a way to allow a user, after he has created a vector graph on a javascript svg canvas using a browser, to download this file to their local filesystem? SVG is a total new field for me so please be patient if my wording is not accurate. kind regards, Jeroen.

    Read the article

  • Center label instance inside VGroup in Flex

    - by Jerry
    Hi all I am trying to center my labels below my image inside my VGroup. The labels are align to left now and it seems like HorizontalAlign is not working on spark component. Anyone knows how to fix it? Thanks a lot. <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:VGroup width="800"> <mx:Image source="images/big/city1.jpg"/> <s:Label text="test1" horizontalCenter="0" /> //doesn't work....:( <s:Label text="test2" /> </s:VGroup> </s:Application>

    Read the article

  • How can I prevent application domain stealing?

    - by dr jerry
    I'm in the process of making a javascript application and I want to bring that online, lets call it mydesign. I'm living in the Netherlands so mydesign.nl can be mine. Now is mydesign.com available for sale by some domain broker sales bastards. And those bastards don't accept a first bid lower than 1000$ which is a about ten times of the budget I'm willing to pay. So far so good, it's a sick business model but it's there. Now lets imagine that mydesign.nl is a huge success in the Netherlands and I'm makin tons of profits out of advertisements and other things I'm not yet aware of (I know entering the lotery gives a better chance of earning money, but lets just imagine). Is there a way (licence, legal or otherwise) to prevent the sick owners of mydesign.com to download and steal my javascript app and deploy it on their own site and take the profits of my app?

    Read the article

  • Flex Panel Content Background Color

    - by Jerry
    Hello guys. I am trying to set the gradient background color for my panel via skins. I try to change my code but nothing seems to change. Not sure what to do. Thanks for any reply. My skin file /<!-- layer 2: background fill --/> <!--- Defines the appearance of the PanelSkin class's background. --> <s:Rect id="background" left="1" top="1" right="1" bottom="1"> <s:fill> <!--- @private Defines the PanelSkin class's background fill. The default color is 0xFFFFFF. --> <s:SolidColor id="backgroundFill" color="red"/> //Change to red but //nothing happen.... </s:fill> </s:Rect>

    Read the article

  • why does $.ajax(..) not work for me?

    - by dr jerry
    I'm running jquery from a file. And I'm trying to load a svg file from my localhost to populate a svg canvas. However that does not work as expected. What I do from filesystem: $.ajax({ url: url , timeout: 1000, complete: function(xml) { alert('complete'); }, success: function(xml, status, xreq) { alert('success'); }, error: function() { alert('error'); } }); the url reads: http://localhost/image.svg, when I read this url directly from an addressbar from the browser, the pages remains white but the pagesource displays the source of image.svg. Debugging the $.ajax code above, reveals that the success: method is hit, but xml response remains empty. Any help is greatly appreciated. regards, jeroen.

    Read the article

  • comments in svg path

    - by dr jerry
    I'm experimenting with jquery and svg, I make up my path but now I want to change that (based on some user input) I do something like var dpath = $('path').attr("d"); $('path').attr("d",dpath.replace("150 150", "450 450")); which works fine, but this not useful when my path grows, so I wonder is there a possibility to put a label or a comment in the path to serve as a replace hook? searching for svg path comments gives me all. I'm close to write my own "replaceble" pseudo svg path code, but is there an alternative possible in svg? regards, Jeroen.

    Read the article

  • Jquery-Different between event.target and this keyword?

    - by Jerry
    Hi all Got a quick and might be an newbie question. What is the different between event.target and this? let's say I have $("test").click(function(e){ $thisEventOb=e.target; $this=this; alert($thisEventObj); alert($this); }); I know the alert will pop different value. Anyone could explain the difference? Thanks a million.

    Read the article

  • Problem when reading backslash in Prolog

    - by Jerry
    I'm writing a lexer in Prolog which will be used as a part of functional language interpreter. Language spec allows expressions like for example let \x = x + 2; to occur. What I want lexer to do for such input is to "return": [tokLet, tokLambda, tokVar(x), tokEq, tokVar(x), tokPlus, tokNumber(2), tokSColon] and the problem is, that Prolog seems to ignore the \ character and "returns" the line written above except for tokLambda. One approach to solve this would be to somehow add second backslash before/after every occurrence of one in the program code (because everything works fine if I change the original input to let \\x = x + 2;) but I don't really like it. Any ideas?

    Read the article

  • Dynamically add tab sheets to page control and embed a form?

    - by Jerry Dodge
    I'm working on a module which consists of a page control. By default, this page control (TPageControl) shouldn't have any tab sheets (TTabSheet), but upon initialization, it should dynamically insert these pages and embed a form inside of it. The issue comes with knowing how to insert a tab sheet into the page control. How do I create this? And once it's created, along with the forms inside each one, how do I iterate through them to destroy the forms?

    Read the article

  • MySQL select two tables at the same time...

    - by Jerry
    Hi all I have two tables and want to make a query. I tried to get team AA and team BB's image base on table A. I used: SELECT tableA.team1, tableA.team2, tableB.team, tableB.image, FROM tableA LEFT JOIN tableB ON tableA.team1=tableB.team The result only display imageA on the column. Are there any ways to select imageA and image B without using the second query? I appreciate any helps! Thanks a lot! My table structure are: table A team1 team2 ------------ AA BB table B team image ------------- AA imagaA BB imageB

    Read the article

  • How to pass around event as parameter in c#

    - by Jerry Liu
    Am writing unit test for a multi-threading application, where I need to wait until a specific event triggered so that I know the asyn operation is done. E.g. When I call repository.add(something), I wait for event AfterChange before doing any assertion. So I write a util function to do that. public static void SyncAction(EventHandler event_, Action action_) { var signal = new object(); EventHandler callback = null; callback = new EventHandler((s, e) => { lock (signal) { Monitor.Pulse(signal); } event_ -= callback; }); event_ += callback; lock (signal) { action_(); Assert.IsTrue(Monitor.Wait(signal, 10000)); } } However, the compiler prevents from passing event out of the class. Is there a way to achieve that?

    Read the article

  • Please suggest ASP.Net source editor

    - by Jerry
    Can someone suggest ASP.Net source editor which I can integrate into my web site expected features: Highlight ASP.Net source code, including server code / javascript code / html / css Intelligent suggesting when typing the code. (this is optional) "Design View" is not required. I just need the code view, please suggest, thank you

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >