Search Results

Search found 11238 results on 450 pages for 'miserable variable'.

Page 55/450 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Use of unassigned local variable 'dictionary'

    - by codemonkie
    I got the error Use of unassigned local variable 'dictionary' despite I assigned the value in the following code: private static void UpdateJadProperties(Uri jadUri, Uri jarUri, Uri notifierUri) { Dictionary<String, String> dictionary; try { String[] jadFileContent; // Create an instance of StreamReader to read from a file. // The using statement also closes the StreamReader. using (StreamReader sr = new StreamReader(jadUri.AbsolutePath.ToString())) { Char[] delimiters = { '\r', '\n' }; jadFileContent = sr.ReadToEnd().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries); } // @@NOTE: Keys contain ": " suffix, values don't! dictionary = jadFileContent.ToDictionary(x => x.Substring(0, x.IndexOf(':') + 2), x => x.Substring(x.IndexOf(':') + 2)); } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } try { if (dictionary.ContainsKey("MIDlet-Jar-URL: ")) { // Change the value by Remove follow by Add } } catch (ArgumentNullException ane) { throw; } } The error is from the line: if (dictionary.ContainsKey("MIDlet-Jar-URL: ")) Can any one help me out here, pls? TIA

    Read the article

  • Passing an instance variable through RJS?

    - by Elliot
    Hey guys here is my code (roughly): books.html.erb <% @books.each do |book| %> <% @bookid = book.id %> <div id="enter_stuff"> <%= render "input", :bookid => @bookid %> </div> <%end%> _input.html.erb <% @book = Book.find_by_id(@bookid) %> <strong>your book is: <%=h @book.name %></strong> create.rjs page.replace_html :enter_stuff, :partial => 'input', :object => @bookid The problem here is that only create.js doesn't seem to work (though, if instead of passing the partial I passed "..." it does work, so I know its that there are instance variables in the partial that aren't being reset. Any ideas?) So the final question, is how do I pass an instance variable to a partial through the create.rjs file? p.s. I know I will have duplicate div IDs, I'm not worrying about that for now though. Best, Elliot

    Read the article

  • javascript variable evaluation in function

    - by lamerzpua
    I trying to use simile widget for own need but I'm stuck on such problem. I have loop for (i=0;i<15;i++){ Timeline.loadXML(function_that_return_url(), function(xml, url) { eventSource[i].loadXML(xml, url); }); } This code is for Timeline.loadXML: Timeline.loadXML = function(url, f) { var fError = function(statusText, status, xmlhttp) { alert("Failed to load data xml from " + url + "\n" + statusText); }; var fDone = function(xmlhttp) { var xml = xmlhttp.responseXML; if (!xml.documentElement && xmlhttp.responseStream) { xml.load(xmlhttp.responseStream); } f(xml, url); }; SimileAjax.XmlHttp.get(url, fError, fDone);}; When I open the page - my function function(xml, url) { eventSource[i].loadXML(xml, url); }); is passed to loadXML method which use it inside as f(xml, url); Problem is that i variable is not parsed as number and I receive message that eventSource[...] is not declared. How I can evaluate i values before it will be posted as argument for the method LoadXML ?

    Read the article

  • Value is not changing in the javascript variable on the onClick event

    - by Chetan sharma
    I am trying to implement a dynamic search jquery and php, but I am not able to change the value of a javascript variable on my onclick event. <script type="text/javascript"> var main_category = '<?php echo $main_category?>'; var main_url = '<?php echo $url?>get/' + encodeURIComponent(main_category) + '/'; var container_id = '<?php echo $unique_id?>content_area'; //name $('#<?php echo $unique_id?>search_by_name').autocomplete('<?php echo $url?>get_autocomplete_data/' + encodeURIComponent(main_category) + '/names/', { matchContains: "word", autoFill: true, width: 310 });$('#<?php echo $unique_id?>search_by_name').result(function (event, data){ var url = main_url + 'search/title/' + encodeURIComponent(data); load_div(container_id, url); }); //on click of displayed categories $('[rel="<?php echo $unique_id?>sub_category"]').click(function (){ window['main_category'] = this.title; $('#<?php echo $unique_id?>category').html('' +main_category+ ''); return false; }); }); </script> It changes the value when on click is fired //on click of displayed categories $('[rel="<?php echo $unique_id?>sub_category"]').click(function (){ window['main_category'] = this.title; $('#<?php echo $unique_id?>category').html('' +main_category+ ''); return false; }); but when after that i add data for the search it still searches for the old category $('#<?php echo $unique_id?>search_by_name').result(function (event, data){ var url = main_url + 'search/title/' + encodeURIComponent(data); load_div(container_id, url); }); "main_category" value is not changing in the "main_url"

    Read the article

  • Passing Variable Length Arrays to a function

    - by David Bella
    I have a variable length array that I am trying to pass into a function. The function will shift the first value off and return it, and move the remaining values over to fill in the missing spot, putting, let's say, a -1 in the newly opened spot. I have no problem passing an array declared like so: int framelist[128]; shift(framelist); However, I would like to be able to use a VLA declared in this manner: int *framelist; framelist = malloc(size * sizeof(int)); shift(framelist); I can populate the arrays the same way outside the function call without issue, but as soon as I pass them into the shift function, the one declared in the first case works fine, but the one in the second case immediately gives a segmentation fault. Here is the code for the queue function, which doesn't do anything except try to grab the value from the first part of the array... int shift(int array[]) { int value = array[0]; return value; } Any ideas why it won't accept the VLA? I'm still new to C, so if I am doing something fundamentally wrong, let me know.

    Read the article

  • GET variable after doing a Join Query

    - by John
    Hello, For the code below, on the second link (http://www...com/sandbox/comments/index.php?submission='.$row["title"].'), I would like to pass $row["submissionid"], on as a GET variable. I tried this and it caused all of the code below to produce a blank result. Is there a way that I can do I want? Thanks in advance, John $sqlStr = "SELECT s.loginid ,s.title ,s.url ,s.displayurl ,l.username ,COUNT(c.commentid) countComments FROM submission s INNER JOIN login l ON s.loginid = l.loginid LEFT OUTER JOIN comment c ON s.submissionid = c.submissionid GROUP BY s.submissionid ORDER BY s.datesubmitted DESC LIMIT 10"; $result = mysql_query($sqlStr); $arr = array(); echo "<table class=\"samplesrec\">"; while ($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td class="sitename1"><a href="http://www.'.$row["url"].'">'.$row["title"].'</a></td>'; echo '</tr>'; echo '<tr>'; echo '<td class="sitename2"><a href="http://www...com/sandbox/members/index.php?profile='.$row["username"].'">'.$row["username"].'</a><a href="http://www...com/sandbox/comments/index.php?submission='.$row["title"].'">'.$row["countComments"].'</a></td>'; echo '</tr>'; } echo "</table>";

    Read the article

  • Scope of This JavaScript Variable

    - by dkris
    I have a question and an issue wrt the code below: My question is what is the scope of the variable loaded here. The reason why i ask this is the onload="if(loaded==1)inittextarea() code is working fine on Firefox and not IE8. Why is this happening? Is there something specific i need to do here? Or is it not a valid practice? <html> <head> <title>Some Page</title> <link rel="stylesheet" href="../css/default.css" type="text/css"> <script type="text/javascript"> var loaded = 0; /*Point of interest*/ function jsLoaded() { loaded =1; } </script> <script type="text/javascript"> function inittextarea() { alert("test") tinyMCE.init({ elements : "content", theme : "advanced", readonly : true, mode : "exact", theme : "advanced", readonly : true, setup : function(ed) { ed.onInit.add(function() { tinyMCE.activeEditor.execCommand("mceToggleVisualAid"); }); } }); } </script> <script src="../js/tiny_mce/tiny_mce.js" onload="jsLoaded()" type="text/javascript"></script> </head> <body onload="if(loaded==1)inittextarea()"><!--Works on Firefox only--> *Usual stuff* </body></html> Any pointers please?

    Read the article

  • Is there any other efficient way to use table variable instead of using temporary table

    - by varta shrimali
    we are writing script to display banners on a web page where we are using temporary table in mysql procedure. Is there any other efficient way to use table variable instead of using temporary table we are using following code: -- banner location CURSOR -- DECLARE banner_location_cursor CURSOR FOR select bm.id as masterId, bm.section as masterName, bs.id as locationId, bs.sectionName as locationName from banner_master as bm inner join banner_section as bs on bm.id=bs.masterId where bm.section=sCode ; -- DECLARE banner CURSORS DECLARE banner_cursor CURSOR FOR SELECT bd.id as bannerId, bd.sectionId, bd.bannerName, bd.websiteURL, bd.paymentType, bd.status, bd.startDate, bd.endDate, bd.bannerDisplayed, bs.id, bs.sectionName from banner_detail as bd inner join banner_section as bs on bs.id=bd.sectionId where bs.id= location_id and bd.status='A' and (dates between cast(bd.startDate as DATE) and cast(bd.endDate as DATE)) order by rand(), bd.bannerDisplayed asc limit 1 ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = 1; SET dates = (select curdate()); -- RESULTS TABLE WHICH WILL BE RETURNED -- CREATE temporary TABLE test ( b_id INT, s_id INT, b_name varchar(128), w_url varchar(128), p_type varchar(128), st char(1), s_date datetime, e_date datetime, b_display int, sec_id int, s_name varchar(128) ); -- OPEN banner location CURSOR OPEN banner_location_cursor; the_loop: LOOP FETCH banner_location_cursor INTO master_id, master_name, location_id, location_name; IF no_more_rows THEN CLOSE banner_location_cursor; leave the_loop; END IF; OPEN banner_cursor; -- select FOUND_ROWS(); the_loop2: LOOP FETCH banner_cursor INTO banner_id, section_id, banner_name, website_url, payment, status, start_date, end_date, banner_displayed, sec_id, section_name; IF no_more_rows THEN set no_more_rows = 0; CLOSE banner_cursor; leave the_loop2; END IF; INSERT INTO test ( b_id, s_id, b_name , w_url, p_type, st, s_date, e_date, b_display, sec_id, s_name ) VALUES ( banner_id, section_id, banner_name, website_url, payment, status, start_date, end_date, banner_displayed, sec_id, section_name ); UPDATE banner_detail set bannerDisplayed = (banner_displayed+1) where id = banner_id; END LOOP the_loop2; END LOOP the_loop; -- RETURN result SELECT * FROM test; -- DROP RESULTS TABLE DROP TABLE test; END

    Read the article

  • PHP Treat String as Variable

    - by Ygam
    Hi guys. I have a piece of code here that does not work despite me using a $$ on it to treat the string as a variable: <? foreach (KOHANA::config('list.amenities_forms') as $k => $v) : ?> <div class="form"> <fieldset> <legend><?php echo $v ?></legend> <input type="checkbox" name="<?=$k?>flag" id="<?=$k?>flag"/> <label class="inline"><?=$v?></label> <label>Description</label> <textarea cols="50" rows="5" name="<?=$k?>[]"><?= empty($$k[0]) ? '' : $$k[0]?></textarea> <label>Size</label> <input type="text" name="<?=$k?>[]" value="<?= empty($$k[1]) ? '' : $$k[1]?>"/> <label>Capacity</label> <input type="text" name="<?=$k?>[]" value="<?= empty($$k[2]) ? '' : $$k[2]?>"/> </fieldset> </div> <? endforeach?> the function Kohana::config returns this array: 'amenities_forms' => array( 'meeting_space' => 'Meeting Space', 'breakfast_room' => 'Breakfast Room', 'living_quarters' => 'Living Quarters', 'restaurant' => 'Restaurant', 'bar' => 'Bar' ) what could I be doing wrong?

    Read the article

  • Access reading error when using class member variable

    - by bsg
    Hi, I have a class with private member variables declared in a header file. In my constructor, I pass in some filenames and create other objects using those names. This works fine. When I try to add another member variable, however, and initialize it in the constructor, I get an access reading violation. I sent the code to someone else and it works fine on his computer. Any idea what could be wrong? Here is the offending code: The .h file: class QUERYMANAGER { INDEXCACHE *cache; URLTABLE *table; SNIPPET *snip; int* iquery[MAX_QUERY_LENGTH]; int* metapointers[MAX_QUERY_LENGTH]; int blockpointers[MAX_QUERY_LENGTH]; int docpositions[MAX_QUERY_LENGTH]; int numberdocs[MAX_QUERY_LENGTH]; int frequencies[MAX_QUERY_LENGTH]; int docarrays[MAX_QUERY_LENGTH][256]; int qsize; public: QUERYMANAGER(); QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname); ~QUERYMANAGER(); This is the .cpp file: #include "querymanagernew.h" #include "snippet.h" using namespace std; QUERYMANAGER::QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname){ cache = new INDEXCACHE(indexfname, btfname); table = new URLTABLE(urltablefname); snip = new SNIPPET(snippetfname, snippetbtfname); //this is where the error occurs qsize = 0; } I am totally at a loss as to what is causing this - any ideas? Thanks, bsg

    Read the article

  • Unwanted Shell expansion when assigning the output of a shell command to a variable

    - by Rob Goodwin
    I am exporting a portion of a local prototypte svn repository to import into a different repo. We have a number of svn properties set throughout the repo so I figured I would write a script to list the file elements and their corresponding properties. How hard can that be right. So I write started writing a bash script that would assign the output of the svn proplist -v to a variable so I could check if the specified file had any properties. #!/bin/bash svn proplist -v $1 o=$(svn proplist -v "$1") echo $o now this works fine and echos the output of the svn proplist command. But if the proplist command returns something like svn:ignore : * build it performs a shell expansion on the * and inserts the entire directory listing prior to the build property value. So if the directory had a.txt, b.txt and build files/dirs in it, the output would look like. svn:ignore a.txt b.txt build I figure I need to somehow escape the output or something to keep the expansion from happening, but have yet to find something that works. There are other ways to do this, but I hate when I cannot figure something out. and I have to admin, I think this one beat me ( well given the time I can spend on it )

    Read the article

  • Using a function with variable argument strings

    - by wrongusername
    I was playing around a bit with functions with variable arguments, and decided to make a function to create vectors with the arguments. My function for creating an int vector worked... vector<int> makeIntVector(int numArgs, ...) { va_list listPointer; va_start(listPointer, numArgs); vector<int> made; for(int a = 0; a < numArgs; a++) made.push_back(va_arg(listPointer, int)); va_end(listPointer); return made; } but not my function for creating a string vector: vector<string> makeStringVector(int numArgs, string something, ...) { va_list listPointer; va_start(listPointer, something); vector<string> made; for(int a = 0; a < numArgs; a++) made.push_back(va_arg(listPointer, string)); va_end(listPointer); return made; } which crashes the program. What am I doing wrong?

    Read the article

  • Session Variable Not Being Updated? ASP.NET

    - by davemackey
    I have a three step wizard. On the first step I use a repeater to create a series of buttons that an individual can select from. When the user selects one of the buttons the value of the button is saved to session state. They are taken to the next step and shown a similar list of buttons that are based on what they previously selected. Thus, if you choose "Hamburger" you might receive the options of "onion", "lettuce", "tomato" while if you choose "Hot Dog" you might receive "sauerkraut" and "ketchup". Lets say an individual chooses Hamburger. This is saved into session state like so: Public Sub Button_ItemCommand(ByVal Sender As Object, ByVal e As RepeaterCommandEventArgs) ' ******** Lets pass on the results of our query in LinqDataSource1_Selecting. Session("food_select") = RTrim(e.CommandName) Wizard1.ActiveStepIndex = 1 End Sub Now, this works fine and dandy. But lets say I select hamburger and then realize I'm really hankering for a hot dog. I go back to the first wizard step and click on the hot dog button - but when the wizard progresses to the next step I still see the options for hamburgers! The session variable has not been updated. Why? Thanks!

    Read the article

  • background-color hex to js variable (jquery)

    - by Ezdaroth
    I'm kinda new to javascript and jquery and now I'm facing a problem: I need to post some data to php and one bit of the data needs to be the background color hex of div X. Jquery has css("background-color") function and with it I can get rgb value of the background into a javascript variable. The css function seems to return a string like this rgb(0, 70, 255). I couldn't find any way to get hex of the background-color (even tho it's set as hex in css). So it seems like I need to convert it. I found a function for converting rgb to hex, but it needs to be called with three different variables, r, g and b. So I would need to parse the string rgb(x,xx,xxx) into var r=x; var g=xx; var b=xxx; somehow. I tried to google parsing strings with javascript, but didn't really understand the regular expressions thing. Could someone tell me if there's a way to get background-color of div as hex, or explain how to convert the string into 3 different variables.

    Read the article

  • Problem accessing variable in a nested form partial

    - by brad
    I have a nested form in a rails view that is called like this <% f.fields_for :invoice_item_numbers do |item_no_form| %> <%= render 'invoice_item_number', :f => item_no_form %> <% end %> and the partial (_invoice_item_number.html.erb) looks like this <div class='invoice_item_numbers'> <% if f.object.new_record? %> <li><%= f.label :item_number %><%= f.text_field :item_number %> <%= link_to_function "remove", "$(this).parent().remove()", :class => 'remove_link' %></li> <% else %> <li class="inline"><%= f.label :item_number %><%= f.text_field :item_number %> </li><li class="inline"><%= f.label :description %><%= invoice_item_number.description %></li><li><%= f.label :amount %><%= f.text_field :amount %> <%= f.check_box '_destroy', :class => 'remove_checkbox' %> <%= f.label '_destroy', 'remove', :class => 'remove_label' %></li> <% end %> </div> This fails with the error message undefined method `description' for nil:NilClass Why does invoice_item_number return a nil object in this partial? It is obviously being defined somehow because if I change it to something else (e.g. item_number.description then the error message becomes undefined local variable or methoditem_number' for #instead. The invoice_item_number object that is being displayed by this partial is being used perfectly well by the form helpers as<%= f.text_field :item_number %and<% f.text_field :amount %both work perfectly well. I have tried a number of solutions such as using@invoice_item_number` and explicitly defining an object in the render method but these have not worked. Presumably there is a very simple answer to this.

    Read the article

  • Newbie question: undefined local variable or method , why??

    - by Mellon
    I am new in Rails (I am using Rails 3.0.3), currently I am following the book "Agile Web Development with Rails" to develop a simple rails application. I followed the book to: --create a model 'Cart' class; --implement 'add_to_cart' method in my 'store_controller', I have a line of code <%=button_to "Add to Cart", :action => add_to_cart, :id => product %> in my /store/index.html.erb As you see, there is :action => add_to_cart in my index.html.erb, which will invoke the add_to_cart method in my *Controllers/store_controller.rb* But after I refresh the browser, I got the error "undefined local variable or method 'add_to_cart'", apparently I do have the method add_to_cart in my 'store_controller.rb', why I got this error??? What is the possible cause??? Here are my codes: store_controller.rb class StoreController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart @cart.add_product(product) end private def find_cart session[:cart] ||= Cart.new end end /store/index.html.erb <h1>Your Pragmatic Catalog</h1> <% @products.each do |product| -%> <div class="entry"> <%= image_tag(product.image_url) %> <h3><%=h product.title %></h3> <%= product.description %> <div class="price-line"> <span class="price"><%= number_to_currency(product.price) %></span> <!-- START_HIGHLIGHT --> <!-- START:add_to_cart --> **<%= button_to 'Add to Cart', :action => 'add_to_cart', :id => product %>** <!-- END:add_to_cart --> <!-- END_HIGHLIGHT --> </div> </div> <% end %> Model/cart.rb class Cart attr_reader :items def initialize @items = [] end def add_product(product) @items << product end end

    Read the article

  • Problems initializing a final variable in Java

    - by froadie
    I keep running into slight variations of a problem in Java and it's starting to get to me, and I can't really think of a proper way to get around it. I have an object property that is final, but dynamic. That is, I want the value to be constant once assigned, but the value can be different each runtime. So I declare the class level variable at the beginning of the class - say private final FILE_NAME;. Then, in the constructor, I assign it a value - say FILE_NAME = buildFileName(); The problem begins when I have code in the buildFileName() method that throws an exception. So I try something like this in the constructor: try{ FILE_NAME = buildFileName(); } catch(Exception e){ ... System.exit(1); } Now I have an error - "The blank final field FILE_NAME may not have been initialized." This is where I start to get slightly annoyed at Java's strict compiler. I know that this won't be a problem because if it gets to the catch the program will exit... But the compiler doesn't know that and so doesn't allow this code. If I try to add a dummy assignment to the catch, I get - "The final field FILE_NAME may already have been assigned." I clearly can't assign a default value before the try-catch because I can only assign to it once. Any ideas...?

    Read the article

  • Setting Class-Level Variable to Use Between Event Handlers

    - by lush
    I'm having a hard time understanding why the following code doesn't work. I'm sure it's something remedial that I'm missing or not understanding. I currently have a page that asks for user input. If, based on the input and logged in user, I find data from this page already in the database, I need to update the existing records rather than creating new ones, so I set a class-level bool to true. The problem is, when MyNextButton is clicked, PreviouslySubmitted is still false. So, I'm not sure how to make the value of this variable persist. Any advice is appreciated, thanks. public partial class MyForm : System.Web.UI.Page { private bool previouslySubmitted; protected void Page_Load(object sender, EventArgs e) { MyButton.Click += (o, i) => { q = from a in db.TableA where (a.SomeField == SomeValue) select a; if(q.Any()) { PreviouslySubmitted = true; //populate the form's fields with values from database for user to revise } } MyNextButton.Click += (o, i) => { if(PreviouslySubmitted) { //update database } else { //insert into database } }

    Read the article

  • Add less than integer variable to string search

    - by user1691832
    I'm scanning a text document for certain installed programs on a computer and looking for an easy way to include a greater or less than variable in the string I'm scanning for. Here is a very ugly and cumbersome example of what I'm using currently and while it works as a temporary fix, isn't practical or sustainable. If CheckBox2.Checked Then sReader.Close() If text.Contains("Adobe Flash Player 11 Plugin") And text.Contains("Adobe Flash Player 11 ActiveX") Then Else If text.Contains("Adobe Flash Player 12 Plugin") And text.Contains("Adobe Flash Player 12 ActiveX") Then Else If text.Contains("Adobe Flash Player 13 Plugin") And text.Contains("Adobe Flash Player 13 ActiveX") Then Else '(Goes ahead and does a silent install of the missing or outdated program) So far I've run into this problem with both Adobe Flash and Java RTE and am certain to run into it with future programs. Essentially I need to scan for "Adobe Flash Player (Any number less than 11) Plugin" , "Adobe Flash Player (Any number less than 11) ActiveX" , "Java (number less than 9) Update (any number)". I'm sure whatever solution is offered can likely be adapted to similar programs I'm likely to encounter later. Thanks ----- Edit ----- I've since tried the following code but it always returns the "Found" messagebox, even when no version of adobe flash is present in the file it is scanning. If CheckBox2.Checked Then sReader.Close() Dim options As RegexOptions = RegexOptions.None Dim regex As Regex = New Regex("Adobe Flash Player (?<version>\d+) (Plugin|ActiveX)", options) Dim input As String = "Adobe Flash Player 11 Plugin" ' Get match Dim match As Match = regex.Match(input) Dim version As String = match.Groups("version").Value If (match.Success) Then MessageBox.Show("Version 11 or higher found, skipping install") Else MessageBox.Show("Version 11 or higher not found, installing Version 11")

    Read the article

  • C89, Mixing Variable Declarations and Code

    - by rutski
    I'm very curious to know why exactly C89 compilers will dump on you when you try to mix variable declarations and code, like this for example: rutski@imac:~$ cat test.c #include <stdio.h> int main(void) { printf("Hello World!\n"); int x = 7; printf("%d!\n", x); return 0; } rutski@imac:~$ gcc -std=c89 -pedantic test.c test.c: In function ‘main’: test.c:7: warning: ISO C90 forbids mixed declarations and code rutski@imac:~$ Yes, you can avoid this sort of thing by staying away from -pedantic. But then your code is no longer standards compliant. And as anybody capable of answering this post probably already knows, this is not just a theoretical concern. Platforms like Microsoft's C compiler enforce this quick in the standard under any and all circumstances. Given how ancient C is, I would imagine that this feature is due to some historical issue dating back to the extraordinary hardware limitations of the 70's, but I don't know the details. Or am I totally wrong there?

    Read the article

  • using jquery selector to change attribute in variable returned from ajax request

    - by Blake
    I'm trying to pull in a filename.txt (contains html) using ajax and change the src path in the data variable before I load it into the target div. If I first load it into the div the browser first requests the broken image and I don't want this so I would like to do my processing before I load anything onto the page. I can pull the src values fine but I can't change them. In this example the src values aren't changed. Is there a way to do this with selectors or can they only modify DOM elements? Otherwise I may have to do some regex replace but using a selector will be more convenient if possible. $.ajax( { url: getDate+'/'+name+'.txt', success: function(data) { $('img', data).attr('src', 'new_test_src'); $('#'+target).fadeOut('slow', function(){ $('#'+target).html(data); $('#'+target).fadeIn('slow'); }); } }); My reason is I'm building a fully standalone javascript template system for a newsletter and since images and other things are upload via a drupal web file manager I want the content creators to keep their paths very short and simple and I can then modify them before I load in the content. This will also be distributed on a CD so I can need to change the paths for that so they still work.

    Read the article

  • python global variable not working in apache

    - by Suhail
    I am facing issue with the global variable, when i run in the django development server it works fine, but in apache it doesn't work here is the code below: red= "/foodfolio3/test/" def showAddRecipe(request): #global objc if "userid" in request.session: objc["ErrorMsgURL"]= "" try: urlList= request.POST URL= str(urlList['url']) URL= URL.strip('http://') URL= "http://" + URL recipe= __addRecipeUrl__(URL) if (recipe == 'FailToOpenURL') or (recipe == 'Invalid-website-URL'): #request.session["ErrorMsgURL"]= "Kindly check URL, Please enter a valid URL" objc["ErrorMsgURL"]= "Kindly check URL, Please enter a valid URL" print "here global_context =", objc arurl= HttpResponseRedirect("/foodfolio3/add/import/") arurl['ErrorMsgURL']= objc["ErrorMsgURL"] #return HttpResponseRedirect("/foodfolio3/add/import/") #return render_to_response('addRecipeUrl.html', objc, context_instance = RequestContext(request)) return (arurl) else: objc["recipe"] = recipe return render_to_response('addRecipe.html', objc, context_instance = RequestContext(request)) except: objc["recipe"] = "" return render_to_response('addRecipe.html', objc, context_instance = RequestContext(request)) else: global red red= "/foodfolio3/add/" return HttpResponseRedirect("/foodfolio3/login") def showAddRecipeUrl(request): if "userid" in request.session: return render_to_response('addRecipeUrl.html', objc, context_instance = RequestContext(request)) else: global red red= "/foodfolio3/add/import/" return HttpResponseRedirect("/foodfolio3/login") def showLogin(request): obj = {} obj["error_message"] = "" obj["registered"] = "" if request.method == "POST": if (red == "/foodfolio3/test"): next= '/foodfolio3/recipes' else: next= red try: username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) except: user = authenticate(request=request) if user is not None: if user.is_active: login(request, user) request.session["userid"] = user.id # Redirect to a success page. return HttpResponseRedirect(next) this code works fine in django development server, but in apache, the url is getting redirected to '/foodfolio3/recipes'

    Read the article

  • how to use shared variable using stored procedure in crystal reports

    - by sonia
    i have a parent report and it contains a two sub report. * subreport: item which get all fields from store procedure named spGetReportItem. like ItemName ItemQuantity TotalItemCost ab 4 45 dd 6 98 *subreport: Labour which get all fields from store procedure named spGetReportLabour. like labourName labourQuantity TotalLabourCost ab 44 455 dd 63 986 i want to find the total of totalitemcost and total of totallabourcost and then want grandtotal of totalitemcost and totallabourcost. i have seen many examples on internet in which shared variable is used in the formula bt the problem is that they have used the table but i m fetching data from stored procedure. so how can i access the stored procedure fields for calculation. like i have seen that many have used: shared numbervar total:=sum({tablename.ColumnName}); but i have used stored procedure instead of table so how could i find total of field that resultset returns from stored procedure.. plz give me answer as soon as possible.. i need it urgently. thanks..

    Read the article

  • How to Return Variable for all tests to use Unittest

    - by chrissygormley
    Hello, I have a Python script and I am trying to set a variable so that if the first test fail's the rest of then will be set to fail. The script I have so far is: class Tests(): def function: result function.......... def errorHandle(self): return self.error def sudsPass(self): try: result = self.client.service.GetStreamUri(self.stream, self.token) except suds.WebFault, e: assert False except Exception, e: pass finally: if 'result' in locals(): self.error = True self.errorHandle() assert True else: self.error = False self.errorHandle() assert False def sudsFail(self): try: result = self.client.service.GetStreamUri(self.stream, self.token) except suds.WebFault, e: assert False except Exception, e: pass finally: if 'result' in locals() or self.error == False: assert False else: assert True class GetStreamUri(TestGetStreamUri): def runTest(self): self.sudsPass() class GetStreamUriProtocolFail(TestGetStreamUri): def runTest(self): self.stream.Transport.Protocol = "NoValue" self.errorHandle() self.sudsFail() if __name__ == '__main__': unittest.main() I am trying to get self.error to be set to False if the first test fail. I understand that it is being set in another test but I was hoping someone could help me find a solution to this problem using some other means. Thanks PS. Please ignore the strange tests. There is a problem with the error handling at the moment.

    Read the article

  • Send html array as post variable using Request.JSON

    - by ian
    I have an html: First name: <input type='text' name='first_name' value='' /><br/> Last name: <input type='text' name='last_name' value='' /><br/> <input type='checkbox' name='category[]' value='Math' /> Math<br/> <input type='checkbox' name='category[]' value='Science' /> Science<br/> <input type='checkbox' name='category[]' value='History' /> History<br/> etc..... I want to send(using post method) the selected categories(category[]) via mootools ajax so that if I dump the $_POST variable in the server I will get something like: array(1) { [category]=> array(2) { [0]=> string(4) "Math" [1]=> string(7) "History" } } What should be the javascript(mootools) code for it? Below is my partial code. new Request.JSON({url: '/ajax_url', onSuccess: function(){ alert('success'); } }).post(???); Note that I don't want to send first_name and last_name fields. I only want to send the category field which is an html array.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >