Search Results

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

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

  • Prepared statement help, Number of variables doesn't match number of parameters in prepared statement

    - by Sam Gabriel
    I'm getting this error : Number of variables doesn't match number of parameters in prepared statement every time I run this code: $dbh = new mysqli("localhost", "***", "***", "pics"); $stmt = $dbh->prepare("INSERT INTO comments (username, picture, comment) VALUES (?, ?, ?)"); $stmt->bind_Param('s', $username); $stmt->bind_Param('d', $picture); $stmt->bind_Param('s', $comment); $username=$_SESSION['username']; $picture=$_GET['id']; $comment=$_POST['comment']; $stmt->execute(); What's the problem?

    Read the article

  • classes and static variables in shared libraries

    - by abel
    I am trying to write something in c++ with an architecture like: App -- Core (.so) <-- Plugins (.so's) for linux, mac and windows. The Core is implicitly linked to App and Plugins are explicitly linked with dlopen/LoadLibrary to App. The problem I have: static variables in Core are duplicated at run-time -- Plugins and App have different copys of them. at least on mac, when a Plugin returns a pointer to App, dynamic casting that pointer in App always result in NULL. Can anyone give me some explanations and instructions for different platforms please? I know this may seem lazy to ask them all here but I really cannot find a systematic answer to this question.

    Read the article

  • Environment variables get lost between MSBuild projects

    - by DotNetter
    Hi, I have a .NET solution containing following projects: web application (WAP) web deployment (WDP, .wdproj) wix setup (WIX, .wixproj) In the WDP I've used a custom MSBuild task (SetEnvVar) to set some env. variables for further use in the build process. After setting them I can use them without prob. in the WDP but in the WIX they are empty/undefined. The strange thing is that when I reference those env. vars in the WIX files (by using properties in .wxs or preproc vars in .wxi) I get the values as expected. Do you have any idea why the env. vars get lost/are undefined in .wixproj? By the way the (solution) build process is triggered from inside VS 2010.

    Read the article

  • How to Split and strip into multiple variables?

    - by Khou
    How to Split and strip X string values into separate variables? X has string value of itemA=myvalue&itemB=anothervalue&itemC=andanother I have 3 strings (var1,var2,var3) to hold the values of the stripped values. Find in string X "itemA=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var1) Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var2) Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var3)

    Read the article

  • Allowing optional variables with Rewrite Cond

    - by James Doc
    I currently have the following code: RewriteCond %{REQUEST_URI} !assets/ RewriteCond %{REQUEST_URI} !uploads/ RewriteRule ^([a-z|0-9_&;=-]+)/([a-z|0-9_&;=-]+) index.php?method=$1&value=$2 [NC,L] This works perfectly to redirect 'page/home' to 'index.php?method=page&value=home. However at some points I need to add an extra variable or two to the query string such as 'admin/useraccounts/mod/2'. When I simply tack on bits to the end of the rewrite rule it works if all the variables are 'page/home/rand/rand' or 'admin/useraccounts/mod/2', but if anything is missing such as 'page/home' I get a 404. What am I doing wrong? Many thanks.

    Read the article

  • (iPhone SDK) How to link instance variables to a specific UILabel

    - by Timbo
    I'm using the iPhone SDK to build a simple application. I've created a brand new class which has a single variable. I need to make 5 instances of that class, which I have no trouble doing. I can create those instances and also set the variables without issue. What i do need to know is this: How do I link each of the 5 different instances of the variable to different and specific UILabels? Would I be better to create a method that dynamically creates and positions the labels? Thanks for your help in advance, I'm now to this iphone programming thing. I'm serious about learning fast though so I have posted a bounty on this question here : http://www.askearn.com/Responses.aspx?QuestionID=6542613f-7be8-4bb3-a950-aac218d47711

    Read the article

  • SELECT TOP N With Two Variables

    - by Ricardo Deano
    Hello all. It's Tuesday morning and I am being thick as (I'm blaming my daughter waking up early this morning!) I have the following example in a SQL table Cust Group Sales A 1 15 A 1 10 A 1 5 A 2 15 A 2 10 A 2 5 B 1 15 B 1 10 B 1 5 B 2 15 B 2 10 B 2 5 What I would like to show is the top 2 products per customer, per group sorted descending by Sales i.e. Cust Group Sales A 1 15 A 1 10 A 2 15 A 2 10 B 1 15 B 1 10 B 2 15 B 2 10 I'm assuming I need to declare two variables, Cust and Group, I'm just not sure how to complete this in one fell swoop. Apologies for the thick question...no excuse. Thanks for any help.

    Read the article

  • Why aren't unsigned OpenMP index variables allowed?

    - by Moe
    I have a loop in my C++/OpenMP code that looks like this: #pragma omp parallel for for(unsigned int i=0; i<count; i++) { // do stuff } When I compile it (with Visual Studio 2005) I get the following error: error C3016: 'i' : index variable in OpenMP 'for' statement must have signed integral type I understand that the error occurs because i is unsigned instead of signed, and changing i to be signed removed this error. What I want to know is why is this an error? Why aren't unsigned index variables allowed? Looking at the MSDN page for this error gives me no clues.

    Read the article

  • Why are $_POST variables getting escaped in PHP?

    - by George Edison
    When my PHP script receives data from an AJAX POST request, the $_POST variables are escaped. The really strange thing is that this only happens on my production server (running PHP 5.2.12 on Linux) and not on my local server (running PHP 5.3.1 on Windows). Here is the AJAX code: var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); pageRequest.onreadystatechange = function() { } var q_str = 'data=' + " ' "; pageRequest.open('POST','unnamed_page.php',true); pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); pageRequest.setRequestHeader("Content-length", q_str.length); pageRequest.setRequestHeader("Connection", "close"); pageRequest.send(q_str); Is there any reason this is happening? And how should I fix this so that it works on both servers?

    Read the article

  • Using PHP variables inside SQL statements?

    - by Homer
    For some reason I can't pass a var inside a mysql statement. I have a function that can be used for multiple tables. So instead of repeating the code I want to change the table that is selected from like so, function show_all_records($table_name) { mysql_query("SELECT * FROM $table_name"); etc, etc... } And to call the function I use show_all_records("some_table") or show_all_records("some_other_table") depending on which table I want to select from at the moment. But it's not working, is this because variables can't be passed through mysql statements?

    Read the article

  • Thread Local Storage and local method variables

    - by miguel
    In c#, each thread has its own stack space. If this is the case, why is the following code not thread-safe? (It is stated that this code is thread-safe on this post: Locking in C# class Foo { private int count = 0; public void TrySomething() { count++; } } As count is an int (stack variable), surely this value would be isolated to an individual thread, on its own stack, and therefore thread-safe? I am probably missing something here, but I dont understand what is actually in Thread Local Storage if not stack-based variables for the thread?

    Read the article

  • Identifying PHP unused variables (in Emacs)?

    - by Roberto Aloi
    Is it somehow possible to identify unused variables in a PHP file in Emacs? With other languages, this is possible by using tools such as flymake. I've already enabled Flymake to show syntax errors for my PHP files on the fly, but still it's frustrating that PHP logic errors are sometimes due to situations like: <?php $foo = whatever(); $bar = something($fo); ... Note the typo on $foo that will contribute to the developer's headache and to his exorbitant use of coffee.

    Read the article

  • importing CELERY* environment variables in django settings.py causes celeryd not to start

    - by Taras
    I just spent 2 hours trying to figure out why django celery stopped working. Celery would being to start, but would stop short of printing out the configuration items, implying that it wasn't starting correct. The log would only contain The celery.decorators module along with the magic keyword arguments, are deprecated, and will be removed in version 3.0. Please use the celery.task module instead of celery.decorators, and the task.request should be used instead of the magic keyword arguments: from celery.task import task See http://bit.ly/celery22major for more information. """)) It turns out that some celery env variables that I was importing to try and fix a different problem were causing celery not to start correctly: from celery.tests.config import CELERY_QUEUES, CELERY_DEFAULT_QUEUE, CELERY_DEFAULT_ROUTING_KEY Even though I wasn't using them anywhere. Does anyone know what was happening?

    Read the article

  • Python try/except: Showing the cause of the error after displaying my variables

    - by NealWalters
    I'm not even sure what the right words are to search for. I want to display parts of the error object in an except block (similar to the err object in VBScript, which has Err.Number and Err.Description). For example, I want to show the values of my variables, then show the exact error. Clearly, I am causing a divided-by-zero error below, but how can I print that fact? try: x = 0 y = 1 z = y / x z = z + 1 print "z=%d" % (z) except: print "Values at Exception: x=%d y=%d " % (x,y) print "The error was on line ..." print "The reason for the error was ..."

    Read the article

  • Loop colours from variables for graphics.py [Python 3.2]

    - by user1056548
    I am creating a graphics program that draws 100 x 100 squares next to each other depending on the user-specified grid size. The user also inputs 4 colours for the squares to be coloured (e.g. if they enter red,green,blue,yellow the squares will be coloured in that order, repeating the colours). Is it possible to loop the colours from the variables the user has given? Here is what I have so far: def main(): print ("Please enter four comma seperated colours e.g.: 'red,green,blue,yellow'\n\ Allowed colours are: red, green, blue, yellow and cyan") col1, col2, col3, col4 = input("Enter your four colours: ").split(',') win = GraphWin ("Squares", 500, 500) colours = [col1, col2, col3, col4] drawSquare (win, col1, col2, col3, col4, colours) win.getMouse() win.close() def drawSquare(win, col1, col2, col3, col4, colours): for i in range (4): for j in range (len(colours)): colour = colours[j] x = 50 + (i * 50) circle = Circle (Point (x,50), 20) circle.setFill(colour) circle.draw(win) I think I should be using a list in some way, but can't work out exactly how to do it. Can anybody help?

    Read the article

  • Creating Dynamic variables from json response

    - by c0mrade
    My JSON response looks like this : {"sample":[{"id":"2","name":"branch name"},{"id":"3","name":"branch name 2"}]} My function looks like this : function getJSONObjects(){ $.getJSON("http://localhost/api/branches", function(data){ $.each(data.sample, function(i,item){ var loc = "branch"; eval("var " + loc + item.id + "=123;"); alert(loc + item.id); }); }); } The idea is to create branch + id object so I can do something with it(create marker on a map), so I tried to assign it any value to see if this was working. I wanted both branch2 and branch3 to alert 123 so I have something to start with. But currently this alerts branch2 and branch3 instead of 123. I have little experience with creating dynamic variables/objects can someone tell me what I'm doing wrong or maybe another approach towards solving this?

    Read the article

  • Inverse relationship of two variables

    - by Jam
    this one is maybe pretty stupid.. Or I am just exhausted or something, but I just cant seem to solve it.. Problem : two variables X and Y, value of Y is dependent on value of X. X can have values ranging from some value to some value (lets say from 0 to 250) and y can have different values (lets say from 0.1 to 1.0 or something..) - but it is inverse relatonship (what I mean is: if value of X is e.g. 250, then value of Y would be 0.1 and when X decreases up to 0, value of Y raises up to 1.0.. So how should I do it? lets say I have function: -- double computeValue (double X) { /computation/ return Y; } Also, is there some easy way to somehow make the scaling of the function not so linear? - For example when X raises, Y decreases slower at first but then more rapidly in the end.. (rly dont know how to say it but I hope you guys got it) Thanks in advance for this stupid question :/

    Read the article

  • Declaring Variables on Informix

    - by santiagobasulto
    Hi everybody. I've a Store Procedure Routine. I want to get some variables from the execution of that proc. But i don't know how to create it. For example: CREATE PROCEDURE foo() ... RETURN somebar; END PROCEDURE; then, when i call it: -- DEFINE bar, this is what i want to know!!!! execute procedure foo() into bar; How can i initialize "bar"???? Thanks!

    Read the article

  • Using member variables inherited from a templated base class (C++)

    - by Aaron Becker
    I'm trying to use member variables of a templated base class in a derived class, as in this example: template <class dtype> struct A { int x; }; template <class dtype> struct B : public A<dtype> { void test() { int id1 = this->x; // always works int id2 = A<dtype>::x; // always works int id3 = B::x; // always works int id4 = x; // fails in gcc & clang, works in icc and xlc } }; gcc and clang are both very picky about using this variable, and require either an explicit scope or the explicit use of "this". With some other compilers (xlc and icc), things work as I would expect. Is this a case of xlc and icc allowing code that's not standard, or a bug in gcc and clang?

    Read the article

  • Passing variables to functions in Python

    - by brno792
    Im writing test scripts in python for selenium web testing. How do I pass parameters through a python function to call in a later function? I first have a login test function. Then I have a new user registration function. Im trying to pass the Username and Password I use in the registration function to the testLogin function that I call inside the testRegister function. This is my python code: userName = "admin" password = "admin" #pass username and password variables to this function def testLogin(userName,password): browser = webdriver.Firefox() browser.get("http://url/login") element = browser.find_element_by_name("userName") element.send_keys(userName) element = browser.find_element_by_name("userPassword") element.send_keys(password) element.send_keys(Keys.RETURN) browser.close() # test registration def testRegister(): browser = webdriver.Firefox() browser.get("http://url/register") #new username variable newUserName = "test" element = browser.find_element_by_name("regUser") element.send_keys(newUserName) #new password variable newUserPassword = "test" element = browser.find_element_by_name("regPassword") element.send_keys(newUserPassword) # #now test if user is registered, I want to call testLogin with the test user name and pw. testLogin(newUserName,newUserPassword) browser.close()

    Read the article

  • How can I create variable variables in ActionScript

    - by Daniel Angel
    I'm doing this mcomp7d101.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d102.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d103.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d150.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } you get the idea :) How can I use a for loop to do something like: for(ii = 101; ii < 150; ii++) { mcomp7d+ii.onRelease = function() { getURL("javascript:Compartir("+id7d+ii);"); } } I'm getting a syntax error. It seems that I can't create variable variables in compiled languages.

    Read the article

  • Setting package-wide variables during python setup.py install

    - by Morgoth
    Is there a way that when a user types python setup.py install to install a Python package, setup.py can be made to set specific variables at the base of the pacakge? A common example would be to basically set mypackage.__revision__ to be the svn revision of the checkout if one is working from svn. Another example case would be if the user can choose a global option, so that the option mypackage.__option__ be set according to a flag passed to setup.py, e.g. python setup.py install --set-flag=10 Then when using the package, mypackage.__option__ would equal 10.

    Read the article

  • How to use traceit to report function input variables in stack trace

    - by reckoner
    Hi, I've been using the following code to trace the execution of my programs: import sys import linecache import random def traceit(frame, event, arg): if event == "line": lineno = frame.f_lineno filename = frame.f_globals["__file__"] if filename == "<stdin>": filename = "traceit.py" if (filename.endswith(".pyc") or filename.endswith(".pyo")): filename = filename[:-1] name = frame.f_globals["__name__"] line = linecache.getline(filename, lineno) print "%s:%s:%s: %s" % (name, lineno,frame.f_code.co_name , line.rstrip()) return traceit def main(): print "In main" for i in range(5): print i, random.randrange(0, 10) print "Done." sys.settrace(traceit) main() Using this code, or something like it, is it possible to report the values of certain function arguments? In other words, the above code tells me "which" functions were called and I would like to know "what" the corresponding values of the input variables for those function calls. Thanks in advance.

    Read the article

  • Mod_rewrite with multiple variables

    - by Andrei
    Hello, I'm using a PHP script that dynamically generates transparent PNGs for use as CSS backgrounds from a query string that takes RGBa and HSLa values. The original script can be found here, I've only added HSLa support. Because background URLs with PHP query strings aren't very pretty, and because it seems to break the IE 6 transparent PNG hack, I thought of using mod_rewrite to allow the script to be called when a .png with this syntax is called : /assets/colors/h[0-360 value]_s[0-100 value]_l[0-100 value]_a[0-100 value].png which would be rewritten to : /assets/colors.php?h=[0-360 value]&s=[0-100 value]&l=[0-100 value]&a=[0-100 value] Here's the issues I'm encountering : passing multiple variables with mod_rewrite using an underscore as a delimiter I know this could be done by passing a single variable and then exploding it in the PHP script, however I would prefer it to be done by Apache. Thanks in advance and if anyone wants my HSLa enabled version of the script just ask. Anyway I recommend you check it out on it's author's website.

    Read the article

  • Help with variables and new lines, and quoting in a bash script

    - by Scott
    I would like to automate the following svn command. Note this command produces the desired results on my system - Ubuntu 10.04, svn 1.6.6, bash shell, when issued from the command line: svn ci -m $'Added new File: newFile.txt\nOrig loc: /etc/networking/newFile.txt' /home/user/svnDir/newFile.txt I would like to run that command in a bash script, assuming that the original full path to the file is contained in the variable $oFileFull, and the filename is in $oFileName. The script is executed from the svn directory. I need to allow for the possibility that the file name and or path contain spaces. so the line inside my shel script might look like: svn ci -m$'Added new file: ${oFileName}\nOrig loc: ${oFileFull}' ${oFileName} But I want the variables (which may contain spaces) expanded before the command is executed, and I cannot figure out how to do this while enclosing the svn comment in single quotes which is necessary in order to get the new line in the subversion comment log. I am pulling my hair out trying to figure out how to properly quote and assemble this command. Any help appreciated.

    Read the article

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