Search Results

Search found 20065 results on 803 pages for 'practice problems'.

Page 89/803 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • Problems re-populating select options in Rails when form returned with errors

    - by Rick
    I have a form with 2 select options in it -- frequency and duration. When there are errors with the form, and it is returned to the browser, the select options are not re-populated with the selections the user made even though the returned values for those fields match the values of options in the selects. Also, when the form is returned, these fields are not marked as having errors even though their values are blank. Here's the frequency and duration fields in Rails <%= frequency_select c, :frequency %> <%= duration_select c, :duration %> The method for frequency_select is def frequency_select(f, method) options = [["day", 1.day], ["other day", 2.days], ["week", 1.week]] f.select method, options, :include_blank => true end And the method for duration_select is def duration_select(f, method, unit="day" ) values, units = *case unit when "day" : [[[5, 5], [15, 15], [30, 29]], "days"] when "other day" : [[[15, 15], [30, 29], [45,45]], "days"] when "week" : [[[4, 29], [6, 43], [8, 57]], "weeks"] end f.select method, values.map {|(label, i)| ["#{label} #{units}", i.days]}, :include_blank => true end If you enter a value into one or both of these fields and submit the form without completing part of it (any part of it), the form is returned to the user (as would be expected), but the duration and frequency fields are not re-populated with the user's selection. If I add this bit of code to the form <p><%= @challenge.attributes.inspect %></p> I see that this for duration and frequency when the form is returned to the browser: "duration"=>3888000, "frequency"=>172800 These values match values on the options in the select fields. Is there anything special in Rails that needs to be done so that the select fields are re-populated with the user's selections? Any thoughts on what the problem could be or what I should try next? Help is greatly appreciated! -Rick PS If you look at some of the other questions, you'll notice I've asked about this in the past. At one point, I thought the form was returning values for frequency and duration in days rather than seconds, but that's not the case. PPS Here's one other bit of information that might matter, but my tests indicate that it probably does not. (Though, I'm a bit of a newbie to this, so don't take my word for it.) These two fields are chained together using the cascade jquery plugin. The javascript is included on the page (not in a separate file) and some of the js is being created by Rails. First, here are the scripts as they appear in the browser. The first is the script to generate the options for the duration select and the second is the script required by the Cascade plugin to trigger the field chaining. <script type="text/javascript"> var list1 = [ {'When':'86400','Value':' ','Text':' '}, {'When':'172800','Value':' ','Text':' '}, {'When':'604800','Value':' ','Text':' '}, {'When':'86400','Value':'432000','Text':'5 days'}, {'When':'86400','Value':'1296000','Text':'15 days'}, {'When':'86400','Value':'2505600','Text':'30 days'}, {'When':'172800','Value':'1296000','Text':'15 days'}, {'When':'172800','Value':'2505600','Text':'30 days'}, {'When':'172800','Value':'3888000','Text':'45 days'}, {'When':'604800','Value':'2505600','Text':'4 weeks'}, {'When':'604800','Value':'3715200','Text':'6 weeks'}, {'When':'604800','Value':'4924800','Text':'8 weeks'} ]; function commonTemplate(item) { return "<option value='" + item.Value + "'>" + item.Text + "</option>"; }; function commonMatch(selectedValue) { return this.When == selectedValue; }; </script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#challenge_duration, #user_challenge_duration").cascade("#challenge_frequency, #user_challenge_frequency",{ list: list1, template: commonTemplate, match: commonMatch }) }); </script> And here's a bit of the the first script as it is in the erb file -- you see that some of the script is being generated by Rails <%= [ [1.day, [[5, 5], [15,15], [30, 29]], "days"], [2.days, [[15, 15], [30, 29], [45, 45]], "days"], [1.week, [[4, 29], [6, 43], [8, 57]], "weeks"]].map do |(frequency, durations, unit)| durations.map do |(label, value)| "{'When':'#{frequency}','Value':'#{value.days}','Text':'#{label} #{unit}'}" end end.join(",\n") -%> Now, the reason I don't think that it matters whether the duration is being generated with JS is the problem still exists if I remove all the JS the problem also affects the frequency field, whose options are not being generated by the JS

    Read the article

  • Android: Problems downloading images and converting to bitmaps

    - by Mike
    Hi all, I am working on an application that downloads images from a url. The problem is that only some images are being correctly downloaded and others are not. First off, here is the problem code: public Bitmap downloadImage(String url) { HttpClient client = new DefaultHttpClient(); HttpResponse response = null; try { response = client.execute(new HttpGet(url)); } catch (ClientProtocolException cpe) { Log.i(LOG_FILE, "client protocol exception"); return null; } catch (IOException ioe) { Log.i(LOG_FILE, "IOE downloading image"); return null; } catch (Exception e) { Log.i(LOG_FILE, "Other exception downloading image"); return null; } // Convert images from stream to bitmap object try { Bitmap image = BitmapFactory.decodeStream(response.getEntity().getContent()); if(image==null) Log.i(LOG_FILE, "image conversion failed"); return image; } catch (Exception e) { Log.i(LOG_FILE, "Other exception while converting image"); return null; } } So what I have is a method that takes the url as a string argument and then downloads the image, converts the HttpResponse stream to a bitmap by means of the BitmapFactory.decodeStream method, and returns it. The problem is that when I am on a slow network connection (almost always 3G rather than Wi-Fi) some images are converted to null--not all of them, only some of them. Using a Wi-Fi connection works perfectly; all the images are downloaded and converted properly. Does anyone know why this is happening? Or better, how can I fix this? How would I even go about testing to determine the problem? Any help is awesome; thank you!

    Read the article

  • Problems with real-valued deep belief networks (of RBMs)

    - by Junier
    I am trying to recreate the results reported in Reducing the dimensionality of data with neural networks of autoencoding the olivetti face dataset with an adapted version of the MNIST digits matlab code, but am having some difficulty. It seems that no matter how much tweaking I do on the number of epochs, rates, or momentum the stacked RBMs are entering the fine-tuning stage with a large amount of error and consequently fail to improve much at the fine-tuning stage. I am also experiencing a similar problem on another real-valued dataset. For the first layer I am using a RBM with a smaller learning rate (as described in the paper) and with negdata = poshidstates*vishid' + repmat(visbiases,numcases,1); I'm fairly confident I am following the instructions found in the supporting material but I cannot achieve the correct errors. Is there something I am missing? See the code I'm using for real-valued visible unit RBMs below, and for the whole deep training. The rest of the code can be found here. rbmvislinear.m: epsilonw = 0.001; % Learning rate for weights epsilonvb = 0.001; % Learning rate for biases of visible units epsilonhb = 0.001; % Learning rate for biases of hidden units weightcost = 0.0002; initialmomentum = 0.5; finalmomentum = 0.9; [numcases numdims numbatches]=size(batchdata); if restart ==1, restart=0; epoch=1; % Initializing symmetric weights and biases. vishid = 0.1*randn(numdims, numhid); hidbiases = zeros(1,numhid); visbiases = zeros(1,numdims); poshidprobs = zeros(numcases,numhid); neghidprobs = zeros(numcases,numhid); posprods = zeros(numdims,numhid); negprods = zeros(numdims,numhid); vishidinc = zeros(numdims,numhid); hidbiasinc = zeros(1,numhid); visbiasinc = zeros(1,numdims); sigmainc = zeros(1,numhid); batchposhidprobs=zeros(numcases,numhid,numbatches); end for epoch = epoch:maxepoch, fprintf(1,'epoch %d\r',epoch); errsum=0; for batch = 1:numbatches, if (mod(batch,100)==0) fprintf(1,' %d ',batch); end %%%%%%%%% START POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% data = batchdata(:,:,batch); poshidprobs = 1./(1 + exp(-data*vishid - repmat(hidbiases,numcases,1))); batchposhidprobs(:,:,batch)=poshidprobs; posprods = data' * poshidprobs; poshidact = sum(poshidprobs); posvisact = sum(data); %%%%%%%%% END OF POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% poshidstates = poshidprobs > rand(numcases,numhid); %%%%%%%%% START NEGATIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% negdata = poshidstates*vishid' + repmat(visbiases,numcases,1);% + randn(numcases,numdims) if not using mean neghidprobs = 1./(1 + exp(-negdata*vishid - repmat(hidbiases,numcases,1))); negprods = negdata'*neghidprobs; neghidact = sum(neghidprobs); negvisact = sum(negdata); %%%%%%%%% END OF NEGATIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% err= sum(sum( (data-negdata).^2 )); errsum = err + errsum; if epoch>5, momentum=finalmomentum; else momentum=initialmomentum; end; %%%%%%%%% UPDATE WEIGHTS AND BIASES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% vishidinc = momentum*vishidinc + ... epsilonw*( (posprods-negprods)/numcases - weightcost*vishid); visbiasinc = momentum*visbiasinc + (epsilonvb/numcases)*(posvisact-negvisact); hidbiasinc = momentum*hidbiasinc + (epsilonhb/numcases)*(poshidact-neghidact); vishid = vishid + vishidinc; visbiases = visbiases + visbiasinc; hidbiases = hidbiases + hidbiasinc; %%%%%%%%%%%%%%%% END OF UPDATES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end fprintf(1, '\nepoch %4i error %f \n', epoch, errsum); end dofacedeepauto.m: clear all close all maxepoch=200; %In the Science paper we use maxepoch=50, but it works just fine. numhid=2000; numpen=1000; numpen2=500; numopen=30; fprintf(1,'Pretraining a deep autoencoder. \n'); fprintf(1,'The Science paper used 50 epochs. This uses %3i \n', maxepoch); load fdata %makeFaceData; [numcases numdims numbatches]=size(batchdata); fprintf(1,'Pretraining Layer 1 with RBM: %d-%d \n',numdims,numhid); restart=1; rbmvislinear; hidrecbiases=hidbiases; save mnistvh vishid hidrecbiases visbiases; maxepoch=50; fprintf(1,'\nPretraining Layer 2 with RBM: %d-%d \n',numhid,numpen); batchdata=batchposhidprobs; numhid=numpen; restart=1; rbm; hidpen=vishid; penrecbiases=hidbiases; hidgenbiases=visbiases; save mnisthp hidpen penrecbiases hidgenbiases; fprintf(1,'\nPretraining Layer 3 with RBM: %d-%d \n',numpen,numpen2); batchdata=batchposhidprobs; numhid=numpen2; restart=1; rbm; hidpen2=vishid; penrecbiases2=hidbiases; hidgenbiases2=visbiases; save mnisthp2 hidpen2 penrecbiases2 hidgenbiases2; fprintf(1,'\nPretraining Layer 4 with RBM: %d-%d \n',numpen2,numopen); batchdata=batchposhidprobs; numhid=numopen; restart=1; rbmhidlinear; hidtop=vishid; toprecbiases=hidbiases; topgenbiases=visbiases; save mnistpo hidtop toprecbiases topgenbiases; backpropface; Thanks for your time

    Read the article

  • Problems with createImage(int width, int height)

    - by Jonathan
    I have the following code, which is run every 10ms as part of a game: private void gameRender() { if(dbImage == null) { //createImage() returns null if GraphicsEnvironment.isHeadless() //returns true. (java.awt.GraphicsEnvironment) dbImage = createImage(PWIDTH, PHEIGHT); if(dbImage == null) { System.out.println("dbImage is null"); //Error recieved return; } else dbg = dbImage.getGraphics(); } //clear the background dbg.setColor(Color.white); dbg.fillRect(0, 0, PWIDTH, PHEIGHT); //draw game elements... if(gameOver) { gameOverMessage(dbg); } } The problem is that it enters the if statement which checks for the Image being null, even after I attempt to define the image. I looked around, and it seems that createImage() will return null if GraphicsEnvironment.isHeadless() returns true. I don't understand exactly what the isHeadless() method's purpose is, but I thought it might have something to do with the compiler or IDE, so I tried on two, both of which get the same error (Eclipse, and BlueJ). Anyone have any idea what the source of the error is, and how I might fix it? Thanks in advance Jonathan ................................................................... EDIT: I am using java.awt.Component.createImage(int width, int height). The purpose of this method is to ensure the creation of, and edit an Image that will contain the view of the player of the game, that will later be drawn to the screen by means of a JPanel. Here is some more code if this helps at all: public class Sim2D extends JPanel implements Runnable { private static final int PWIDTH = 500; private static final int PHEIGHT = 400; private volatile boolean running = true; private volatile boolean gameOver = false; private Thread animator; //gameRender() private Graphics dbg; private Image dbImage = null; public Sim2D() { setBackground(Color.white); setPreferredSize(new Dimension(PWIDTH, PHEIGHT)); setFocusable(true); requestFocus(); //Sim2D now recieves key events readyForTermination(); addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { testPress(e.getX(), e.getY()); } }); } //end of constructor private void testPress(int x, int y) { if(!gameOver) { gameOver = true; //end game at mousepress } } //end of testPress() private void readyForTermination() { addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if((keyCode == KeyEvent.VK_ESCAPE) || (keyCode == KeyEvent.VK_Q) || (keyCode == KeyEvent.VK_END) || ((keyCode == KeyEvent.VK_C) && e.isControlDown()) ) { running = false; //end process on above list of keypresses } } }); } //end of readyForTermination() public void addNotify() { super.addNotify(); //creates the peer startGame(); //start the thread } //end of addNotify() public void startGame() { if(animator == null || !running) { animator = new Thread(this); animator.start(); } } //end of startGame() //run method for world public void run() { while(running) { long beforeTime, timeDiff, sleepTime; beforeTime = System.nanoTime(); gameUpdate(); //updates objects in game (step event in game) gameRender(); //renders image paintScreen(); //paints rendered image to screen timeDiff = (System.nanoTime() - beforeTime) / 1000000; sleepTime = 10 - timeDiff; if(sleepTime <= 0) //if took longer than 10ms { sleepTime = 5; //sleep a bit anyways } try{ Thread.sleep(sleepTime); //sleep by allotted time (attempts to keep this loop to about 10ms) } catch(InterruptedException ex){} beforeTime = System.nanoTime(); } System.exit(0); } //end of run() private void gameRender() { if(dbImage == null) { dbImage = createImage(PWIDTH, PHEIGHT); if(dbImage == null) { System.out.println("dbImage is null"); return; } else dbg = dbImage.getGraphics(); } //clear the background dbg.setColor(Color.white); dbg.fillRect(0, 0, PWIDTH, PHEIGHT); //draw game elements... if(gameOver) { gameOverMessage(dbg); } } //end of gameRender() } //end of class Sim2D Hope this helps clear things up a bit, Jonathan

    Read the article

  • IPhone - Memory Management problems.

    - by user321721
    i am going over my code and trying to get a handle on proper memory management. This code: imageView = [[[UIImageView alloc] initWithImage:myImage] autorelease]; causes my application to crash. I am using multiple view controllers within a nav bar controller. The app works fine, i cant select a person from the first view controller (tableview) and it puts me to a list of that persons photos, i can then select a photo from that view controller (tableview) and move to a final view with a scrollview for viewing the photo. Once i hit back on the navbar the previous view loads (list of photos in a tableview) however the app crashes right before the row is deselected using this code: (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if(RowSelected != nil) { [MainTableView deselectRowAtIndexPath:RowSelected animated:YES]; } } Row selected is stored when a the user clicks a row. If i leave the code as : imageView = [[UIImageView alloc] initWithImage:myImage]; The app runs fine. Am i doing something wrong? do i not need to autorelease this? Thanks!

    Read the article

  • Problems using jQuery $.ajax to pass data

    - by iboeno
    I'm using ASP.NET and attempting to call a method with a signature of [WebMethod] public static string GetInfo(string id){...} using the following javascript: var elementValue = $("#element").attr('id'); var d = "{id : " + elementValue + "}"; $.ajax({ type: "POST", url: "../WebPage.aspx/GetInfo", data: d, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { //do this } }); And this is not working. If instead I set elementValue = 2; it works fine. If I try to hardcode in a string value for testing purposes e.g. elementValue = "nameToLookUp"; It fails. Why is this happening, and how do I resolve it? On a side not, why is type: required to be POST instead of a GET? In the end I just want to pass a string value I want to look up in a DB and retrieving some json data.

    Read the article

  • .NET connecting to oracle problems with the connectionstring

    - by Oxymoron
    At the moment I'm trying to make a connection to a local server. Connecting via, say, TOAD works fine. When I try to connect using .NET I get ora-12154. Which puzzles me, since I'm using the connectionstring from my TNSNAMES.ora file: XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myPC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) As follows: private string connectionString = "Data Source=(DESCRIPTION =" +" (ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = myPC)(PORT = 1521)))" +" (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = XE));" +"User Id=sys;Password=zsxyzabc;"; Any ideas?

    Read the article

  • Paging in SQL Server problems

    - by Manh Trinh
    I have searched for paging in SQL Server. I found most of the solution look like that What is the best way to paginate results in SQL Server But it don't meet my expectation. Here is my situation: I work on JasperReport, for that: to export the report I just need pass the any Select query into the template, it will auto generated out the report EX : I have a select query like this: Select * from table A I don't know any column names in table A. So I can't use Select ROW_NUMBER() Over (Order By columsName) And I also don't want it order by any columns. Anyone can help me do it? PS: In Oracle , it have rownum very helpful in this case. Select * from tableA where rownum > 100 and rownum <200 Paging with Oracle

    Read the article

  • more radio problems * sighs * been at this for one week now

    - by jeansymolanza
    hi guys really i don't know what im doing wrong... i am trying to process multiple radios with mysql. the first step has involved me echoing the results on the process page. each time i select any radio option it simply displays the first row result. this is that i see after trying to submit the form: Notifications Thank you. The notifications have been updated successfully. statusid: 14 notc2: 1 Return this is the code for the form: <div style="padding: 15px;"> <span class="loginfail" style="font-size:24px; font-weight: bold">Notifications</span><p> <?php include("progress_insertcomment.php"); ?> <?php // Make a MySQL Connection mysql_select_db("speedycm_data") or die(mysql_error()); $query_comment = "select * from tbl_alert order by id desc limit 1"; $comment = mysql_query($query_comment, $speedycms) or die(mysql_error()); $row_comment = mysql_fetch_assoc($comment); $totalRows_comment = mysql_num_rows($comment); ?> <!--- add notification ---> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <span id="sprytextarea1"> <textarea id='comment' name="comment" style="height: 75px; width:330px;"><?php echo $row_comment['comment']; ?></textarea> </span> <p> <button type="submit">Add</button> <input type="hidden" name="notc" value="1"/> </form> <!--- notification history ---> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table border="0" cellspacing="2" cellpadding="2"> <?php if ( $row_comment == 0 ) { echo "<span style='font-size: 11px;'>No current alerts.</span>"; } else { // Get all the data from the "example" table $result = mysql_query("SELECT * FROM tbl_alert ORDER BY id DESC") or die(mysql_error()); while($rows=mysql_fetch_array($result)){ ?> <tr> <td> <?php echo "<div class='bubble'><div class='pimped'> <blockquote>" . $rows['comment'] . " </blockquote></div> <cite><strong>" . $rows['user'] . "</strong> @ " . $rows['date'] . "</cite> <span style='font-size: 10px;'> <p> <a href='editalert.php?id=". $rows['id'] ."' class='form' >Edit</a>&nbsp;&#8226;&nbsp;<a href='deletealert.php?id=". $rows['id'] ."' class='form'>Delete</a> </span> </div> "; ?> </td> <td valign="top" align="center"><div style="padding-left: 30px;"><span style="font-size: 10px;">Completed?</span> <p class="field switch"> <!--- determine status of notification ---> <?php $status = $rows['status']; $id = $rows['id']; ?> <input type="radio" name="selstatus[<?php echo $id; ?>]" value="no" <?php if($status == 'yes') {echo 'checked';} else {echo '';} ?>/> <input type="radio" name="selstatus[<?php echo $id; ?>]" value="yes" <?php if($status == 'yes') {echo 'checked';} else {echo '';} ?>/> <input type="hidden" name="statusid" value="<?php echo $id; ?>"/> <label for="radio1" class="cb-enable <?php if($status == 'yes') {echo 'selected';} else {echo '';} ?>"><span>Yes</span></label> <label for="radio2" class="cb-disable <?php if($status == 'no') {echo 'selected';} else {echo '';} ?>"><span>No</span></label> </p> </div></td> </tr> <tr> <td></td> <?php } } ?> <td align="center"><div style="padding-left: 30px;"> <button type="submit">Update</button> <input type="hidden" name="notc2" value="1"/> </div></td> </tr> </table> </form> </div> this is the code for the processing page: <?php // 6) update notifications if (array_key_exists('notc2',$_POST)) { $update = $_POST['selstatus']; echo "<p style='font-size: 12px;'>Thank you. The notifications have been updated successfully.<p>"; foreach($_POST as $key => $value){ echo $key . ': ' . $value . '<br>'; } echo "<p><span style='font-size: 12px;'> <a onClick=\"history.go(-1)\" class='form'>Return</a></p> <p></span> "; exit; }; ?> how do i resolve this problem? please any help would be appreciated. i would like to display the id and value of the selected checkbox on the processing page before inserting it into the table. thanking you in advance. GOD BLESS

    Read the article

  • problems with matlab wavrecord and wavread

    - by user504363
    Hi all I have a problem in matlab I want to record a speech for 2 seconds then read the recorded sound and plot it I use the code FS = 8000; new_wav = wavrecord(2*FS,FS,'int16'); x = wavread(new_wav); plot(x); but the error appears ??? Error using ==> fileparts at 20 Input must be a row vector of characters. Error in ==> wavread>open_wav at 193 [pat,nam,ext] = fileparts(file); Error in ==> wavread at 65 [fid,msg] = open_wav(file); Error in ==> test at 2 x = wavread(new_wav); I plotted correctly recorded sound files, but when I want to record new one through matlab I get this errors. I tried many ways by changing FS and 'int16' but nothing happens. thanks

    Read the article

  • Problems with Twitter on Android App

    - by Dayner Alvarez Rodriguez
    I'm trying to show one public twitter profile in one WebView of my app, is not necessary to login twitter, in the MotoDev Simulator this works fine, but in the physical device don't work, this: "403 fobiden limite exceed rate" error appears, this is the simple code line that I'm using: webView.loadUrl("https://mobile.twitter.com/#!/asambleaecuador"); and works fine into de MotoDev simulator AVD ....can somebody helpme please!!! Thanks

    Read the article

  • Z-Index problems with IE6 and html <select> element

    - by rsturim
    I have a <div> that opens up on a jquery hover event (display goes from hidden to block). Sometime it's opens up over some form elements. And of course it works fine in all browsers except IE6. <select> boxes bleed through as if there z-index is higher than the <div> tag. I've tried setting the <div> tag with a higher z-index, but it still gets ignored by IE6. I'm hoping to implement any fix -- jquery or css, I really don't care at this point. Any ideas?

    Read the article

  • JQuery: using .LIVE problems

    - by TeddTedd
    I have the following JQuery code: $("#myDIV li:eq(0)").live('click',function(){ funcA(); }); $("#myDIV li:eq(1)").live('click',function(){ funcB(); }); $("#myDIV li:eq(2)").live('click',function(){ funcC(); }); $("#myDIV li:eq(3)").live('click',function(){ funcD(); }); And realized it's really inefficient. So I tried the following, which I believe is much more effect; however, the code does not work: var tab_node = $("#myDIV li"); tab_node.eq(0).live('click',function(){ funcA(); }); tab_node.eq(1).live('click',function(){ funcB(); }); tab_node.eq(2).live('click',function(){ funcC(); }); tab_node.eq(3).live('click',function(){ funcD(); }); Any idea how I can make my code more efficient while also work? UPDATE: From the answers below, it sounds like these two statements are not equalavent. New Question: Is there any way to run my original code more efficient?

    Read the article

  • Apache mod_rewrite rules problems

    - by ni
    domain.com/index/ to domain.com/index.php domain.com/index/hello to domain.com/index.php/hello The site is use path_info,and the default rule not works: RewriteRule ^([^/]+)/(.*)$ $1.php/$2 [L] I change to: RewriteRule ^([^/.]+)((/[^/]+)*)/?$ $1.php$2 [L] That was strange domain.com/index/ to domain.com/index.php works fine domain.com/index/hello to domain.com/index.php/hello not work and it says No input file specified. Php is run in fast cgi mode in apache

    Read the article

  • Problems with Database Search Code (asp.net vb)

    - by Phil
    Here is a sample of my database search code: Dim sql As String = "Select * From Table Where " Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim andor As Boolean = AndOr1.SelectedValue 'selection can be AND or OR (0 / 1) 'Code for when the user selects AND If NameSearch.Text.ToString IsNot String.Empty And andor = 0 Then sql += "Surname LIKE '%" & name & "%' AND " End If If EmailSearch.Text.ToString IsNot String.Empty And andor = 0 Then sql += "Email LIKE '%" & email & "%' AND " End If If CitySearchBox.Text.ToString IsNot String.Empty And andor = 0 Then sql += "City LIKE '%" & city & "%' AND " End If 'Code for when the user selects OR If NameSearch.Text.ToString IsNot String.Empty And andor = 1 Then sql += "(Surname LIKE '%" & name & "%' OR " End If If EmailSearch.Text.ToString IsNot String.Empty And andor = 1 Then sql += "Email LIKE '%" & email & "%') OR " End If If CitySearchBox.Text.ToString IsNot String.Empty And andor = 1 Then sql += "(City LIKE '%" & city & "%' OR " End If sql = CleanString(sql) End Sub When the user selects AND (as andor.selectedvalue(0)) then the sql is produced fine like this; Select * From Table Where Surname LIKE '%test%' AND Email LIKE '%test%' AND City LIKE '%test%' But if the user selects OR (as andor.selectedvalue(1)), nothing is outputted except; Select * From Table Where Im sure the controls have values so are not string.empty and when the user selects OR the correct value 1 is being assigned to andor.

    Read the article

  • config.cache_classes = true in production mode has problems in IE

    - by techno_log
    Hi Dears, In my rails app. I am using link_to_function to bring an ajax tabs in one page.Everything works fine in Moazilla and other browsers. But in IE the tabs are not loading only when the server is started in production mode(doesn't matter whether its webrick or mongrel). In development mode everything is fine. So I figured out that the issue was with one line config.cache_classes = true in app/config/environments/production.rb when i changed the above code to config.cache_classes = false everything works fine. So I assume caching causes problem in rails. When I Googled about this I found many have the issues with caching. So my question is 1) is there any other fix for this? 2) Does this fix (config.cache_classes = false) causes any performance issues. If then how to overcome that? Any comments and suggestions are welcome. Techno_log

    Read the article

  • IE8 problems with .animate() of opacity property - descendant remains opaque throughout

    - by Fabian
    Basically I have something like this: <ul> <li> <a> <div class="trigger-layer"></div> <div class="title-layer">Text here</div> <div class="hover-layer"></div> </a> </li> </ul> I use jQuery to animate the <ul> as follow: $ul = xxx (where I assign the selector to var $ul) $ul.animate({opacity: 0}, 1000, function() {$ul.css("display", "none")}); However in IE8, as the <ul> fades off, the <div class="title-layer">Text here</div> remains clear and opaque. Finally the animation ends, the display: none; property is applied onto the <ul> and the text disappears aburptly.

    Read the article

  • Problems encountered in changing a CRichEditCtrl selection color.

    - by dev ray
    I have written the following code after creating the CRichEditCtrl // 06112010 : The following code was added to highlight the textselection in black color instead of the default blue color of CRichEditCtrl. - 1311 { m_EditControl.SetSel(0,100); CHARFORMAT2 cf1; cf1.cbSize = sizeof(CHARFORMAT2); m_EditControl.GetSelectionCharFormat(cf1); cf1.dwMask = CFM_BACKCOLOR ; cf1.dwEffects &= ~CFE_AUTOBACKCOLOR; cf1.crBackColor = RGB(0,0,0); m_EditControl.SetSelectionCharFormat(cf1); m_EditControl.Invalidate(); } After this I am adding text, but the selection still comes in blue color instead of Black. Could someone please tell me what I am doing wrong?? Thanks, DeV

    Read the article

  • Problems Installing Eclipse and Ruby Plugin

    - by Jesse J
    I installed Eclipse on my Ubuntu machine and then the Ruby Development Tools (RDT), but it would crash when I try to alter certain features, like having line numbers, how far back to have history, and the code coloring scheme didn't work fully. I decided to try to uninstall Eclipse by doing sudo aptitude remove Eclipse and then sudo aptitude install eclipse but instead it installed it back with the broken Ruby plugin. I also tried aptitude purge but that didn't help either. How can I freshly reinstall Eclipse and get a properly working Ruby plugin?

    Read the article

  • Problems with i18n using django translation on App-Engine with Korean and Hindi

    - by Greg
    I've got a setup based on the post here, and it works perfectly. Adding more languages to the mix, it recognises them fine, except for Korean (ko) and Hindi (hi). Chinese/Japanese/Hebrew are all fine, so nothing to do with encodings/charsets I don't think. Taking a look into the django code inside the app-engine SDK, I notice that all the languages that I'm using except for ko and hi are ones that ship with django - in the default settings.py and inside the locale folder they are missing. If I copy one of the locale folders inside the /usr/local/google_appengine/lib/django[...]/conf/locale and rename it to be 'ko', then it starts working in my app, but I won't be able to replicate this modification when I deploy to app-engine, so need a bit of help understanding what I might be doing wrong. my settings.py is definitely being taken into account, as if I remove languages from there then they stop working (as they should). If I copied the django modules into my app, under 'lib' there say, could I use those instead of the ones app-engine tries to use, maybe? I'm brand new to python/django/app-engine, and developing on a Mac with Leopard, if that makes any difference. I have the latest app-engine SDK as of tuesday.

    Read the article

  • PHP Array problems....if anyone can assist!

    - by Homer_J
    First off, the code which brings back my data into an array: function fetch_questions($page) { global $link; $proc = mysqli_prepare($link, "SELECT * FROM tques WHERE page = $page"); mysqli_stmt_bind_param($proc, "i", $page); mysqli_stmt_execute($proc); $rowq = array(); stmt_bind_assoc($proc, $rowq); // loop through all result rows while ($proc->fetch()) { // print_r($rowq); } mysqli_stmt_close($proc); mysqli_clean_connection($link); return($rowq); } Now, when I `print_r($rowq);' I get the following, which is all good: Array ( [questions] => q1 [qnum] => 1 [qtext] => I find my job meaningful [page] => 1 ) Array ( [questions] => q2 [qnum] => 2 [qtext] => I find my job interesting [page] => 1 ) Array ( [questions] => q3 [qnum] => 3 [qtext] => My work supports ABC's objective [page] => 1 ) Array ( [questions] => q4 [qnum] => 4 [qtext] => I am able to balance my work and home life [page] => 1 ) Array ( [questions] => q5 [qnum] => 5 [qtext] => I am clear about what is expected of me in my job [page] => 1 ) Array ( [questions] => q6 [qnum] => 6 [qtext] => My induction helped me to settle into my job [page] => 1 ) Array ( [questions] => q7 [qnum] => 7 [qtext] => I understand the ABC vision [page] => 1 ) Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 ) Now, in my php page I have the following piece of script: $questions = fetch_questions($page); And when I print_r $questions, as below: print_r($questions); I only get the following back from the array, 1 row: Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 ) Any ideas why that might be? Thanks in advance, Homer.

    Read the article

  • MySQL Problems......

    - by Kovu
    With the tool "mysql administrator" i get a complete connection to my database, I can change userthings and so on. But not PHPMyAdmin nor Joomly Installation will get a connection, they timed out. Any Ideas?

    Read the article

  • Javascript 'class' and singleton problems

    - by Kucebe
    I have a singleton object that use another object (not singleton), to require some info to server: var singleton = (function(){ /*_private properties*/ var myRequestManager = new RequestManager(params, //callbacks function(){ previewRender(response); }, function(){ previewError(); } ); /*_public methods*/ return{ /*make a request*/ previewRequest: function(request){ myRequestManager.require(request); //err:myRequestManager.require is not a func }, previewRender: function(response){ //do something }, previewError: function(){ //manage error } }; }()); This is the 'class' that make the request to the server function RequestManager(params, success, error){ //create an ajax manager this.param = params; this._success = success; //callbacks this._error = error; } RequestManager.prototype = { require: function(text){ //make an ajax request }, otherFunc: function(){ //do other things } } The problem is that i can't call myRequestManager.require from inside singleton object. Firebug consolle says: "myRequestManager.require is not a function", but i don't understand where the problem is. Is there a better solution for implement this situation?

    Read the article

  • Using the framework of the problems encountered SharpArch

    - by livebean
    I try to test SharpArch frame, directly in the provided example code to write some code to add test data, but unsuccessful, do not have any information to me! ICustomerRepository customerRepository = new CustomerRepository(); Customer customer = new Customer("Jack Chen"); customer.SetAssignedIdTo("JACKK"); customerRepository.Save(customer); I just had an instance of CustomerRepository operation, do not understand why there is no new data on the data table

    Read the article

  • Problems inserting file data into sqlite database using python

    - by tylerc230
    I'm trying to open an image file in python and add that data to an sqlite table. I created the table using: "CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "description" VARCHAR, "image" BLOB );" I am trying to add the image to the db using: imageFile = open(imageName, 'rb') b = sqlite3.Binary(imageFile.read()) targetCursor.execute("INSERT INTO images (image) values(?)", (b,)) targetCursor.execute("SELECT id from images") for id in targetCursor: imageid= id[0] targetCursor.execute("INSERT INTO %s (questionID,imageID) values(?,?)" % table, (questionId, imageid)) When I print the value of 'b' it looks like binary data but when I call: 'select image from images where id = 1' I get '????' printed to the console. Anyone know what I'm doing wrong?

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >