Search Results

Search found 15797 results on 632 pages for 'session variables'.

Page 138/632 | < Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >

  • [Bash] Save part of matching pattern to variable

    - by Ben
    I want to extract a substring matching a pattern and save it to a file. An example string: Apr 12 19:24:17 PC_NMG kernel: sd 11:0:0:0: [sdf] Attached SCSI removable disk I want to extract the part between the brackets, in this case []. I tried to do something like grep -e '[$subtext]' to save the text in the brackets to a variable. Of course it doesn't work, but I am looking for a way similar to this. It would be very elegant to include a variable in a regex like this. What can I do best? Thanks!

    Read the article

  • PHP and Javascript: Getting file contents with Javascript variable

    - by celliott1997
    Could someone help me to understand why this isn't working? var uname = "<?php echo strtolower($_GET['un']) ?>"; var source = "<?php echo file_get_contents('accounts/"+uname+"') ?>"; console.log(source); I've been trying for a while to get this working and it just doesn't seem to. Before I added in the source variable, it was working fine and displayed the un variable on the page. Thanks.

    Read the article

  • Optimal (Time paradigm) solution to check variable within boundary

    - by kumar_m_kiran
    Hi All, Sorry if the question is very naive. I will have to check the below condition in my code 0 < x < y i.e code similar to if(x > 0 && x < y) The basic problem at system level is - currently, for every call (Telecom domain terminology), my existing code is hit (many times). So performance is very very critical, Now, I need to add a check for boundary checking (at many location - but different boundary comparison at each location). At very normal level of coding, the above comparison would look very naive without any issue. However, when added over my statistics module (which is dipped many times), performance will go down. So I would like to know the best possible way to handle the above scenario (kind of optimal way for limits checking technique). Like for example, if bit comparison works better than normal comparison or can both the comparison be evaluation in shorter time span? Other Info x is unsigned integer (which must be checked to be greater than 0 and less than y). y is unsigned integer. y is a non-const and varies for every comparison. Here time is the constraint compared to space. Language - C++. Now, later if I need to change the attribute of y to a float/double, would there be another way to optimize the check (i.e will the suggested optimal technique for integer become non-optimal solution when y is changed to float/double). Thanks in advance for any input. PS : OS used is SUSE 10 64 bit x64_64, AIX 5.3 64 bit, HP UX 11.1 A 64.

    Read the article

  • Cookie in Tomcat

    - by Richard
    Sorry... can anybody help me out? I'm a complete neewbiee to tomcat, but I have to set a cookie with the name 'lastlogin' with the actual timestamp as a value. How am I supposed to do it? Thanks a lot.

    Read the article

  • How to add up amount of data from an external file in C# (Stream Reader)

    - by user2985995
    I'm new to this site, and pretty new to programming, at the moment I'm trying to display a count amount for the users names on my donation list, and then I also want to have a sum to work out the total amount of money the donation list contains, If someone could help me with creating a way to add up amount of donors on the donations.txt file that would be great help, I have no idea where to start, but so far this is my coding: string sName; double dAmount; string sTotalNames; double dAmountTotal; double dAmountAverage; using (StreamReader sr = new StreamReader("Donations.txt")) { while (sr.Peek() != -1) { sName = sr.ReadLine(); Console.WriteLine(sName); dAmount = Convert.ToDouble(sr.ReadLine()); Console.WriteLine(dAmount); } Console.WriteLine("Press any key to close"); Console.ReadKey(); }

    Read the article

  • Assigning jQuery ajax response text to variable constanty returns null

    - by Dan Twining
    Hi all, hopefully one of you on this great site can help. I'm having issues with assigning a variable to a jQuery ajax call response text. I have a form which when submited runs my "checkemail" function to varify the email address can be found in a database. If it's found, the responseText == "true", else "false". This works fine, and can be seen ok using Firebug....but the actual variable the response text should be assigned to is constantly showing "", and therefore causing the function to return false all the time. function checkemail(){ var EmailFromForm = $("#lostemail").val(); var EmailCheckRes = $.ajax({ type : "POST", cache : false, url : "./scripts/passreset/emailcheck.php", data : "Email="+EmailFromForm, dataType : "text", }).responseText; if (EmailCheckRes == "true") { alert("Should say true: " + EmailCheckRes); return true; } else { $("#ErrorMsg").html("Your email address is either invalid or not found."); alert("Should say false: " + EmailCheckRes); return false; } } If anyone has any pointers as to what i'm doing wrong it'd be greatly appreciated.

    Read the article

  • How to store double using SharedPrefrences?

    - by user3924167
    I am having trouble storing a double in the phone's memory. What are my other options if this isnt possible. Basically what the code is aiming to do using sharedprefrences is take the stored value of "Alcohol" spending and then add whatever the input is in the editText to it and then store that new value for the next time. Running total of spending on alcohol **Can someone please help with this issue and be detailed where x y & z should go in the project. The user selects from a spinner, which works. public void addInput(){ double dblCostInput = Double.valueOf(inputBox.getText().toString()); String strCategories= spinnerCategories.getSelectedItem().toString(); if(strCategories.equals("Alcohol")) { alcoholSpend = alcoholSpend + dblCostInput; inputBox.setText(""); nextInput(); inputBox.setText("Your Spending on"+strCategories+" is: " +d.format(alcoholSpend)); }

    Read the article

  • How can I close the currently running server app when I launch new debug session?

    - by Eonil
    Google App Engine (GAE) Java SDK uses eclipse as main IDE. IDE runs a server app when I launch debugging session. And it runs another server app when I launch debugging session again. It closes the server app when I stop the debugging session, but it doesn't when I re-launch debugging session. Re-launching means stop and launch again. Why does it stop existing app? So I have to close the server app manually at each time. Is there a way to close existing running app when re-launching debugging session?

    Read the article

  • PHP, better to set the variable before if or use if/else?

    - by DssTrainer
    So a simple one that I just never could find a straight answer on. What is better (performance or otherwise): $var = false; If ($a == $b) { $var = true; } or If ($a == $b) { $var = true; } else { $var = false; } I've heard arguments for both ways. I find the first cleaner to ensure I have it set, and a little less code too. The pro being that you may only need to set it once without conditional. But the con being that if the argument is true, it gets set twice. I am assuming the second way is probably best practice

    Read the article

  • asp.net C# variable as Image1.ImageUrl property

    - by ModS
    I would like to Click "buttonImage1" and have that store "photos/Image1.jpg" into a var called Photo. then have ButtonImage2.ImageUrl = (Photo). I am using an UpdatePanel to refresh the area with the images so the only problem is actually setting the variable correctly and then using it correctly. Reworded: how can I store a path to an image in a variable then set it correctly as a image's URL path? protected void Button2_Click(object sender, ImageClickEventArgs e) { Evt = ("~/events/ev2.jpg"); } protected void Image2_Click(object sender, ImageClickEventArgs e) { Image1.ImageUrl = (Evt); }

    Read the article

  • How do I update mysql database when posting form without using hidden inputs?

    - by user1322707
    I have a "members" table in mysql which has approximately 200 field names. Each user is given up to 7 website templates with 26 different values they can insert unique data into for each template. Each time they create a template, they post the form with the 26 associated values. These 26 field names are the same for each template, but are differentiated by an integer at the end, ie _1, _2, ... _7. In the form submitting the template, I have a variable called $pid_sum which is inserted at the end of each field name to identify which template they are creating. For instance: <form method='post' action='create.template.php'> <input type='hidden' name='address_1' value='address_1'> <input type='hidden' name='city_1' value='city_1'> <input type='hidden' name='state_1' value='state_1'> etc... <input type='hidden' name='address_1' value='address_2'> <input type='hidden' name='city_1' value='city_2'> <input type='hidden' name='state_1' value='state_2'> etc... <input type='hidden' name='address_2' value='address_3'> <input type='hidden' name='city_2' value='city_3'> <input type='hidden' name='state_2' value='state_3'> etc... <input type='hidden' name='address_2' value='address_4'> <input type='hidden' name='city_2' value='city_4'> <input type='hidden' name='state_2' value='state_4'> etc... <input type='hidden' name='address_2' value='address_5'> <input type='hidden' name='city_2' value='city_5'> <input type='hidden' name='state_2' value='state_5'> etc... <input type='hidden' name='address_2' value='address_6'> <input type='hidden' name='city_2' value='city_6'> <input type='hidden' name='state_2' value='state_6'> etc... <input type='hidden' name='address_2' value='address_7'> <input type='hidden' name='city_2' value='city_7'> <input type='hidden' name='state_2' value='state_7'> etc... // Visible form user fills out in creating their template ($pid_sum converts // into an integer 1-7, depending on what template they are filling out) <input type='' name='address_$pid_sum'> <input type='' name='city_$pid_sum'> <input type='' name='state_$pid_sum'> etc... <input type='submit' name='save_button' id='save_button' value='Save Settings'> <form> Each of these need updated in a hidden input tag with each form post, or the values in the database table (which aren't submitted with the form) get deleted. So I am forced to insert approximately 175 hidden input tags with every creation of 26 new values for one of the 7 templates. Is there a PHP function or command that would enable me to update all these values without inserting 175 hidden input tags within each form post? Here is the create.template.php file which the form action calls: <?php $q=new Cdb; $t->set_file("content", "create_template.html"); $q2=new CDB; $query="SELECT menu_category FROM menus WHERE link='create.template.ag.php'"; $q2->query($query); $toall=0; if ($q2->nf()<1) { $toall=1; } while ($q2->next_record()) { if ($q2->f('menu_category')=="main") { $toall=1; } } if ($toall==0) { get_logged_info(); $q2=new CDB; $query="SELECT id FROM menus WHERE link='create_template.php'"; $q2->query($query); $q2->next_record(); $query="SELECT membership_id FROM menu_permissions WHERE menu_item='".$q2->f("id")."'"; $q2->query($query); while ($q2->next_record()) { $permissions[]=$q2->f("membership_id"); } if (count($permissions)>0) { $error='<center><font color="red"><b>You do not have access to this area!<br><br>Upgrade your membership level!</b></font></center>'; foreach ($permissions as $value) { if ($value==$q->f("membership_id")) { $error=''; break; } } if ($error!="") { die("$error"); } } } $member_id=$q->f("id"); $pid=$q->f("pid"); $pid_sum = $pid +1; $first_name=$q->f("first_name"); $last_name=$q->f("last_name"); $email=$q->f("email"); echo " // THIS IS WHERE THE HTML FORM GOES "; replace_tags_t($q->f("id"), $t); ?>

    Read the article

  • I call session_start() the script hangs and nothing happens

    - by shovon
    I am running php5, however as soon as I call session_start() the script hangs and nothing happens. Is anyone else experiencing this problem, or am I doing something incorrectly? I am using session_start() on index.php and for some reason sometimes it'll fail. No warnings, no errors, no notices, not even after prepending error_reporting(E_ALL) and ini_set('display_errors', TRUE) before session_start() do I see anything, it just plain dies.

    Read the article

  • How do I compute a variable in Javascript if and only if it is used?

    - by LLer
    This is what I'm doing right now. var foo = function() { var x = someComplicatedComputationThatMayTakeMoreTime(); this.foo = function() { return x; }; return x; } It works but only if foo is called as a function like so foo(); But what if I want to call it as a normal variable with a value? I could modify the code to be var foo = function() { var x = someComplicatedComputationThatMayTakeMoreTime(); this.foo = x; return x; } That would allow me to only call it once as a function and after that as a regular variable. But it's still not what I want. Plus it gets complicated if it accidentally gets called as a function again, returning an error. Is this even possible in Javascript?

    Read the article

  • Accessing initialized variable on different class C++

    - by d0pe
    I'm having some difficulties with this problem. The main idea is, I initialized a variable of class type B in class A, class A.h has the variable Z declared as public, like B *Z; In class A.cpp, I initialized it as Z = new B(); Now, I want to access that variable from class C and I'm unable to do so. C.h includes A.h and B.h

    Read the article

  • Why do I get Bind Variable "DeliveryDate_Variable" is NOT DECLARED(Completely New TO Oracle)

    - by GigaPr
    Hi, I have the following script in Oacle I do not understand why i get Bind Variable "DeliveryDate_Variable" is NOT DECLARED Everything looks ok to me VARIABLE RollingStockTypeId_Variable NUMBER := 1; VARIABLE DeliveryDate_Variable DATE := (to_date('2010/8/25:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam')); SELECT DISTINCT rs.Id, rs.SerialNumber, rsc.Name AS Category, (SELECT COUNT(Id) from ROLLINGSTOCKS WHERE ROLLINGSTOCKCATEGORYID = rsc.id) as "Number Owened", (SELECT COUNT(rs.Id) FROM ROLLINGSTOCKS rs WHERE rs.ID NOT IN( select RollingStockId from ROLLINGSTOCK_ORDER WHERE :DeliveryDate_Variable BETWEEN DEPARTUREDATE AND DELIVERYDATE) AND rs.RollingStockCategoryId IN (Select Id from RollingStockCategories Where RollingStockTypeId = :RollingStockTypeId_Variable) AND rs.RollingStockCategoryId = rsc.Id) AS "Number Available" FROM ROLLINGSTOCKS rs JOIN RollingStockCategories rsc ON rsc.Id = rs.RollingStockCategoryId WHERE rs.ID NOT IN( select RollingStockId from ROLLINGSTOCK_ORDER WHERE :DeliveryDate_Variable BETWEEN DEPARTUREDATE AND DELIVERYDATE ) AND rs.RollingStockCategoryId IN ( Select Id from RollingStockCategories Where RollingStockTypeId = :RollingStockTypeId_Variable ) ORDER BY rsc.Name

    Read the article

  • Use of unassigned local variable

    - by Bob
    ... ... ... try { string Tags_collect; SqlDataReader Data1 = cmd.ExecuteReader(); Data1.Read(); lbl_q_title.Text = Data1["subject"].ToString(); Data1.NextResult(); while (Data1.Read()) { Tags_collect = Data1.GetString(0); Tags_collect= Tags_collect+ Tags_collect; } lbl_tags.Text = Tags_collect; ..... .... .... not sure why i get this error what do i miss?

    Read the article

  • Variable text in links with knockout

    - by Gepser
    I'm generating a list of links and they have not the same text but I don't know how to put a text with knockout. This is what I have: <a data-bind="attr: { href: 'Controller/Method/' + Id, 'Title': CurrentTask }"> <!-- I need the name of the CurrentTask here--> CurrentTask </a> So, the text I want to show appears only in the "alt" property but not in the text of the link. It works but I need that the name of the CurrentTask be the link and now it's just showing me everything like this: <a href...>CurrentTask</a> <a href...>CurrentTask</a> <a href...>CurrentTask</a> <a href...>CurrentTask</a> and I need this <a href...>I get this data from de controller</a> <a href...>Sometext</a> <a href...>OtherText</a> <a href...>Anything</a>

    Read the article

  • How do I create if statements in php to perform a specific action depending on what form has string in it

    - by user1637284
    Im trying to create a grid on my page in each cell there will be a simple one line form. If a person enters data into lets say FieldA I would like the php to perform actionA but if the data was entered in FieldF I would like actionF performed. Is this possible without having to create a php for each cell and upload all those php files? Or is there a way to perform the GET method in each form to append the data to the end of the action url without the field name showing (ie sample.com/somestuff/fieldA instead of sample.com/somestuff/fieldname=fieldA) thus not needing php at all?

    Read the article

  • Where is the best place to store globals in Rails app?

    - by Nick Gorbikoff
    Hello. I was wondering if there is the best practice on where to store global settings in a rails app. What I mean by that is i.e: I have a few globals defined that may change, but not likely and it seems inappropriate to store them in DB since they are used so much. For instance I have SYSTEM_EMAIL & SYSTEM_EMAIL_SIGNATURE & SYSTEM_STORAGE_ROOT. Right now I keep them in environment.rb, but I'm not sure if this is the right palce to store them. Thank you

    Read the article

< Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >