Search Results

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

Page 116/632 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • Table Variables in SSIS

    - by aceinthehole
    In one SQL Task can I create a table variable DELCARE @TableVar TABLE (...) Then in another SQL Task or DataSource destination and select or insert into the table variable? The other option I have considered is using a Temp Table. CREATE TABLE #TempTable (...) I would prefer to use Table Variable so that it remains in memory. But can use temp table if it is not possible to use table variable. Also I cannot use the record set destination as I need to preform straight SQL tasks on it later on.

    Read the article

  • replacing variables in output in php

    - by Thorpe Obazee
    Right now I have this code. <?php error_reporting(E_ALL); require_once('content_config.php'); function callback($buffer) { // replace all the apples with oranges foreach ($config as $key => $value) { $buffer = str_replace($key, $value, $buffer); } return $buffer; } ob_start("callback"); ?> some content <?php ob_end_flush(); ?> in the content_config.php file: $config['SiteName'] = 'MySiteName'; $config['SiteAuthor'] = 'thatGuy'; What I want to do is that I want to replace the placeholders that with the key of the config array with its value. Right now, it doesn't work :(

    Read the article

  • Defined variables and arrays vs functions in php

    - by Frank Presencia Fandos
    Introduction I have some sort of values that I might want to access several times each page is loaded. I can take two different approaches for accessing them but I'm not sure which one is 'better'. Three already implemented examples are several options for the Language, URI and displaying text that I describe here: Language Right now it is configured in this way: lang() is a function that returns different values depending on the argument. Example: lang("full") returns the current language, "English", while lang() returns the abbreviation of the current language, "en". There are many more options, like lang("select"), lang("selectact"), etc that return different things. The code is too long and irrelevant for the case so if anyone wants it just ask for it. Url The $Url array also returns different values depending on the request. The whole array is fully defined in the beginning of the page and used to get shorter but accurate links of the current page. Example: $Url['full'] would return "http://mypage.org/path/to/file.php?page=1" and $Url['file'] would return "file.php". It's useful for action="" within the forms and many other things. There are more values for $Url['folder'], $Url['file'], etc. Same thing about the code, if wanted, just request it. Text [You can skip this section] There's another array called $Text that is defined in the same way than $Url. The whole array is defined at the beginning, making a mysql call and defining all $Text[$i] for current page with a while loop. I'm not sure if this is more efficient than multiple calls for a single mysql cell. Example: $Text['54'] returns "This is just a test array!" which this could perfectly be implemented with a function like text(54). Question With the 3 examples you can see that I use different methods to do almost the same function (no pun intended), but I'm not sure which one should become the standard one for my code. I could create a function called url() and other called text() to output what I want. I think that working with functions in those cases is better, but I'm not sure why. So I'd really appreciate your opinions and advice. Should I mix arrays and functions in the way I described or should I just use funcions? Please, base your answer in this: The source needs to be readable and reusable by other developers Resource consumption (processing, time and memory). The shorter the code the better. The more you explain the reasons the better. Thank you PS, now I know the differences between $Url and $Uri.

    Read the article

  • PHP Changing Class Variables Outside of Class

    - by Jamie Bicknell
    Apologies for the wording on this question, I'm having difficulties explaining what I'm after, but hopefully it makes sense. Let's say I have a class, and I wish to pass a variable through one of it's methods, then I have another method which outputs this variable. That's all fine, but what I'm after is that if I update the variable which was originally passed, and do this outside the class methods, it should be reflected in the class. I've created a very basic example: class Test { private $var = ''; function setVar($input) { $this->var = $input; } function getVar() { echo 'Var = ' . $this->var . '<br />'; } } If I run $test = new Test(); $string = 'Howdy'; $test->setVar($string); $test->getVar(); I get Var = Howdy However, this is the flow I would like: $test = new Test(); $test->setVar($string); $string = 'Hello'; $test->getVar(); $string = 'Goodbye'; $test->getVar(); Expected output to be Var = Hello Var = Goodbye I don't know what the correct naming of this would be, and I've tried using references to the original variable but no luck. I've come across this in the past, with the PDO prepared statements, see Example #2 $stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)"); $stmt->bindParam(1, $name); $stmt->bindParam(2, $value); // insert one row $name = 'one'; $value = 1; $stmt->execute(); // insert another row with different values $name = 'two'; $value = 2; $stmt->execute(); I know I can change the variable to public and do the following, but it isn't quite the same as how the PDO class handles it, and I'm really looking to mimic that behaviour. $test = new Test(); $test->setVar($string); $test->var = 'Hello'; $test->getVar(); $test->var = 'Goodbye'; $test->getVar(); Any help, ideas, pointers, or advice would be greatly appreciated, thanks.

    Read the article

  • Global variables in hadoop.

    - by Deepak Konidena
    Hi, My program follows a iterative map/reduce approach. And it needs to stop if certain conditions are met. Is there anyway i can set a global variable that can be distributed across all map/reduce tasks and check if the global variable reaches the condition for completion. Something like this. While(Condition != true){ Configuration conf = getConf(); Job job = new Job(conf, "Dijkstra Graph Search"); job.setJarByClass(GraphSearch.class); job.setMapperClass(DijkstraMap.class); job.setReducerClass(DijkstraReduce.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(Text.class); } Where condition is a global variable that is modified during/after each map/reduce execution.

    Read the article

  • C++ offset of member variables?

    - by anon
    I have: class Foo { int a; int b; std::string s; char d; }; Now, I want to know the offset of a, b, s, d given a Foo* I.e. suppose I have: Foo *foo = new Foo(); (char*) foo->b == (char*) foo + ?? ; // what expression should I put in ?

    Read the article

  • C#: How to constuct a variable from another variables

    - by ozzwanted
    How to construct new variable in C#. I mean, to have sth like this public void updateXXX(string endingOfVariable, int newValue) { this.textBox_{endingOfVariable} = newValue; } This is implemented in Php: $a = 'var'; $b = 'iable'; $variable = 'var'; echo ${$a.$b}; But maybe it is possible in C#. The problem is that - I created ~500 textBoxes in C# Windows Form, and if I want to set a value, I need to build a switch() {case:; } statment with 500's cases.

    Read the article

  • Problem accessing private variables in jQuery like chainable design pattern

    - by novogeek
    Hi folks, I'm trying to create my custom toolbox which imitates jQuery's design pattern. Basically, the idea is somewhat derived from this post: http://stackoverflow.com/questions/2061501/jquery-plugin-design-pattern-common-practice-for-dealing-with-private-function (Check the answer given by "David"). So here is my toolbox function: (function(window){ var mySpace=function(){ return new PrivateSpace(); } var PrivateSpace=function(){ var testCache={}; }; PrivateSpace.prototype={ init:function(){ console.log('init this:', this); return this; }, ajax:function(){ console.log('make ajax calls here'); return this; }, cache:function(key,selector){ console.log('cache selectors here'); testCache[key]=selector; console.log('cached selector: ',testCache); return this; } } window.hmis=window.m$=mySpace(); })(window) Now, if I execute this function like: console.log(m$.cache('firstname','#FirstNameTextbox')); I get an error 'testCache' is not defined. I'm not able to access the variable "testCache" inside my cache function of the prototype. How should I access it? Basically, what I want to do is, I want to cache all my jQuery selectors into an object and use this object in the future.

    Read the article

  • Updating variables in XSL

    - by Stroboskop
    Is there any way in XSL to update a global variable? I want to check what elements i already transformed and act accordingly. That would require me to somehow add the names of the elements to some sort of list and update it each time a new element is transformed. But since xsl:variable isn't "variable" in the sense one would expect, i have no way of adding anything to it once it has been defined. I have multiple included data files, so using xsl functions that only know the current set of nodes will not help.

    Read the article

  • Delete cache when web browser is close.

    - by Edy Cu
    Hi all. I have issue about multiple login in asp.net. Case this happen: User X login as "user1" in web browser. Then user Y also login as "user1" also in another web browser. User Y got error message "Another user log in some account". That is work as expected. If X, close their web browser. Then try again to login in as "user1". X get also get "Another user log in some account". So i trying debug then i found session is remove when web browser is close, but cache still remaining in web browser. Anyone have idea about this how to clear cache when user close their browser, (not tab). Regard.

    Read the article

  • Variables in properties.

    - by Woland
    <Me:FunctionalParFractal runat="server" ID="stockNextDayProg" MinZ=" I LIKE TO BUT it dynamicly" /> I know that i should do it from controller side but i ask, is this possible somehow? Tnxs

    Read the article

  • How to call a set of variables functions based on class on a group of elements

    - by user1547007
    I have the following html code: <i class="small ele class1"></i> <i class="medium ele class1"></i> <i class="large ele class1"></i> <div class="clear"></div> <i class="small ele class2"></i> <i class="medium ele class2"></i> <i class="large ele class2"></i> <div class="clear"></div> <i class="small ele class3"></i> <i class="medium ele class3"></i> <i class="large ele class3"></i> <div class="clear"></div> <i class="small ele class4"></i> <i class="medium ele class4"></i> <i class="large ele class4"></i>? And my javascript looks like so: var resize = function(face, s) { var bb = face.getBBox(); console.log(bb); var w = bb.width; var h = bb.height; var max = w; if (h > max) { max = h; } var scale = s / max; var ox = -bb.x+((max-w)/2); var oy = -bb.y+((max-h)/2); console.log(s+' '+h+' '+bb.y); face.attr({ "transform": "s" + scale + "," + scale + ",0,0" + "t" + ox + "," + oy }); } $('.ele').each(function() { var s = $(this).innerWidth(); var paper = Raphael($(this)[0], s, s); var face = $(this).hasClass("class1") ? class1Generator(paper) : class4Generator(paper); /*switch (true) { case $(this).hasClass('class1'): class1Generator(paper); break; case $(this).hasClass('class2'): class2Generator(paper) break; case $(this).hasClass('class3'): class3Generator(paper) break; case $(this).hasClass('class4'): class4Generator(paper) break; }*/ resize(face, s); }); my question is, how could I make this line of code more scalable? I tried using a switch but The script below is calling two functions if one of the elements has a class, but what If i have 10 classes? I don't think is the best solution I created a jsFiddle http://jsfiddle.net/7uUgz/6/ //var face = $(this).hasClass("awesome") ? awesomeGenerator(paper) : awfulGenerator(paper);

    Read the article

  • Accessing variables with different scope in C++

    - by Portablejim
    With #include <iostream> using namespace std; int a = 1; int main() { int a = 2; if(true) { int a = 3; cout << a << " " << ::a // Can I access a = 2 here? << " " << ::a << endl; } cout << a << " " << ::a << endl; } having the output 3 1 1 2 1 Is there a way to access the 'a' equal to 2 inside the if statement where there is the 'a' equal to 3, with the output 3 2 1 2 1 Note: I know this should not be done (and the code should not get to the point where I need to ask). This question is more "can it be done".

    Read the article

  • PHP - not sure how to ask - regarding variables and $_POST

    - by Phil
    I have a PHP form. The form works but I'm trying to test to see if a value other than the first item has been selected. I can't figure out how to write the If statement. $products = array( '' => 1, 'Item 2' => 2, 'Item 3' => 3, 'Item 4' => 4, 'Item 5' => 5, 'Item 6' => 6 ); $html = generateSelect('products', $products); function generateSelect($name = '', $options = array()) { $html = '<select name="'.$name.'">'; foreach ($options as $option => $value) { $html .= '<option value='.$value.'>'.$option.'</option>'; } $html .= '</select>'; return $html; } In my table, the drop down box is displayed: <tr> <td style="width:{$left_col_width}; text-align:left; vertical-align:center; padding:{$cell_padding}; font-weight:bold; {$product[3]}">{$product[0]}</td> <td style="text-align:left; vertical-align:top; padding:{$cell_padding};"><select name="{$product[1]}"> <option value="1"></option> <option value="2">Item 2</option> <option value="3">Item 3</option> <option value="4">Item 4</option> <option value="5">Item 5</option> <option value="6">Item 6</option> </select></td> </tr> I use the following if statement to check to see if someone has entered a phone number. if they have not entered a phone number, then the "Phone:" text turns red. How do I do an if statement similar to this to verify that someone has selected a product option from the drop down box? if(!empty($_POST['phone'])) { $phone[2] = clean_var($_POST['phone']); if (function_exists('htmlspecialchars')) $phone[2] = htmlspecialchars($phone[2], ENT_QUOTES); } else { $error = 1; $phone[3] = 'color:#d20128;'; } it seems simple but I can't figure it out.

    Read the article

  • Local Variables take 7x longer to access than global variables?

    - by ItzWarty
    I was trying to benchmark the gain/loss of "caching" math.floor, in hopes that I could make calls faster. Here was the test: <html> <head> <script> window.onload = function() { var startTime = new Date().getTime(); var k = 0; for(var i = 0; i < 1000000; i++) k += Math.floor(9.99); var mathFloorTime = new Date().getTime() - startTime; startTime = new Date().getTime(); window.mfloor = Math.floor; k = 0; for(var i = 0; i < 1000000; i++) k += window.mfloor(9.99); var globalFloorTime = new Date().getTime() - startTime; startTime = new Date().getTime(); var mfloor = Math.floor; k = 0; for(var i = 0; i < 1000000; i++) k += mfloor(9.99); var localFloorTime = new Date().getTime() - startTime; document.getElementById("MathResult").innerHTML = mathFloorTime; document.getElementById("globalResult").innerHTML = globalFloorTime; document.getElementById("localResult").innerHTML = localFloorTime; }; </script> </head> <body> Math.floor: <span id="MathResult"></span>ms <br /> var mathfloor: <span id="globalResult"></span>ms <br /> window.mathfloor: <span id="localResult"></span>ms <br /> </body> </html> My results from the test: [Chromium 5.0.308.0]: Math.floor: 49ms var mathfloor: 271ms window.mathfloor: 40ms [IE 8.0.6001.18702] Math.floor: 703ms var mathfloor: 9890ms [LOL!] window.mathfloor: 375ms [Firefox [Minefield] 3.7a4pre] Math.floor: 42ms var mathfloor: 2257ms window.mathfloor: 60ms [Safari 4.0.4[531.21.10] ] Math.floor: 92ms var mathfloor: 289ms window.mathfloor: 90ms [Opera 10.10 build 1893] Math.floor: 500ms var mathfloor: 843ms window.mathfloor: 360ms [Konqueror 4.3.90 [KDE 4.3.90 [KDE 4.4 RC1]]] Math.floor: 453ms var mathfloor: 563ms window.mathfloor: 312ms The variance is random, of course, but for the most part In all cases [this shows time taken]: [takes longer] mathfloor Math.floor window.mathfloor [is faster] Why is this? In my projects i've been using var mfloor = Math.floor, and according to my not-so-amazing benchmarks, my efforts to "optimize" actually slowed down the script by ALOT... Is there any other way to make my code more "efficient"...? I'm at the stage where i basically need to optimize, so no, this isn't "premature optimization"...

    Read the article

  • Double use of variables?

    - by Vaccano
    I have read that a variable should never do more than one thing. Overloading a variable to do more than one thing is bad. Because of that I end up writing code like this: (With the customerFound variable) bool customerFound = false; Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; customerFound = true; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; customerFound = true; } } } if (customerFound) { // Do something } But deep down inside, I sometimes want to write my code like this: (Without the foundCustomer variable) Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; } } } if (foundCustomer != null) { // Do something } Does this secret desires make me an evil programmer? (i.e. is the second case really bad coding practice?)

    Read the article

  • How to sub with matched groups and variables in Python

    - by Syed
    Hi, new to python. This is probably simple but I haven't found an answer. rndStr = "20101215" rndStr2 = "20101216" str = "Looking at dates between 20110316 and 20110317" outstr = re.sub("(.+)([0-9]{8})(.+)([0-9]{8})",r'\1'+rndStr+r'\2'+rndStr2,str) The output I'm looking for is: Looking at dates between 20101215 and 20101216 But instead I get: P101215101216 The values of the two rndStr's doesn't really matter. Assume its random or taken from user input (I put static vals here to keep it simple). Thanks for any help.

    Read the article

  • Sharepoint Document Upload Page - Passing URL Variables?

    - by Corey O.
    Throughout my SharePoint site, I have several document repositories that are tied to primary keys from an external database. I have added custom columns in the document library metadata fields so that we will know which SharePoint documents correspond with which table entries. As a requirement, we need to have document uploads that have these fields automatically populated. For instance, I'd like to have the following url: ./Upload.aspx?ClassID=2&SystemID=63 So that when you upload any documents to this library, it automatically adds the ClassID and SystemID values to the corresponding ClassID and SystemID columns outlined in the SharePoint document library fields. Is there any quick or easy way to do this, or will I have to completely rewrite the Upload.aspx script from scratch?

    Read the article

  • CodeIgniter URI segments captured as variables?

    - by Zen Savona
    well, i have a function within a controller called test, and i can access it by going to http://localhost/nwk/control/test this is my function. I want to use the data given in the next segment from the "test" as a php variable. so if i put function test() { $var $this->uri->segment(3); echo $var; } according to the user guide if I enter control/test/data, my variable should be equal to 'data'? doesn't seem to be working. Am I missing something here?

    Read the article

  • jQuery .ready() automatically assigning variables for each element with ID in DOM

    - by Greg
    I have noticed some unexpected behaviour when using the jQuery .ready() function, whereby afterwards you can reference an element in the DOM simply by using its ID without prior declaration or assignment: <html> <script src="jquery.js"></script> <script> $(document).ready(function() { myowndiv.innerHTML = 'wow!' }); </script> <body> <div id="myowndiv"></div> </body> </html> I would have expected to have to declare and assign myowndiv with document.getElementById("myowndiv"); or $("#myowndiv"); before I could call innerHTML or anything else on it? Is this behaviour by design? Can anyone explain why? My fear is that if I refactor and end up not using .ready() or even using jQuery at all then my code will fail to execute. Cheers!

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >