Search Results

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

Page 20/450 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • JQuery\Javascript - Passing a function as a variable.

    - by Josh
    I was just curious if I could pass a function as a variable. For example: I have a function $('#validate').makeFloat({x:671,y:70,limitY:700}); I would like to do something like this: $('#validate').makeFloat({x:function(){ return $("#tabs").offset().left+$("#tabs").width();},y:70,limitY:700}); This does not work, but ideally every time the variable was accessed it would compute the new value. So if the window was resized it would automatically adjust as opposed to a variable passed in being static. I realize I can implement this directly inside the function\widget, but I was wondering if there was some way to do something like the above.

    Read the article

  • help me understand a variable setting

    - by meo
    var fmt = document.documentElement.clientWidth; var cls = (fmt<=240)?'pda_ver':(fmt>240&&fmt<=320)?'pda_hor':(fmt>320&&fmt<=640)?'screen_ultralow':(fmt>640&&fmt<=800)?'screen_low':(fmt>800&&fmt<=1024)?'screen_med':(fmt>1024&&fmt<=1280)?'screen_high':'screen_wide'; can someone tell me what this does (just the part where the variable is set with a value i do not understand... what are th ?, : have for a role here)? i have never seen a variable declared like that. Is this a conditional variable setting? if yes how does it work ? working example

    Read the article

  • Set the output of a function equal to a variable

    - by ryno
    How would i set the output of a custom php function to a variable? The function is: function getRandomColor1() { global $cols; $num_cols = count($cols); $rand = array_rand($cols); $rand_col = $cols[$rand]; echo $rand_col; unset($cols[$rand]); } How would i set getRandomColor1 equal to $RandomColor1? I need it to be a variable so I can use it in css like: #boxone1 { height: 150px; width: 150px; background: <?=$RandomColor1?>; float: left; } If its not possible to set it as a variable, how else could i put the output of the function into css?

    Read the article

  • Returning the address of local or temporary variable

    - by Dave18
    #include <iostream> int& foo() { int i = 6; std::cout << &i << std::endl; return i; } int main() { int i = foo(); std::cout << &i << std::endl; } I know it doesn't return the address of local variable so that is why the warning but why does it still works and assign the variable i in main() to '6'? How does it only return the value if the variable the was removed from stack memory?

    Read the article

  • PHP Variable from extended class

    - by Ste
    I cant retrieve var from parent class: class core { var $variable; var $test; function __construct() {} public function setVar($var) $this->variable = $var; } } class test extends core { public function getVar() { return $this->variable; //also if i echo here i can't see !!!! } } $core = new core(); $core->test = new test(); print $core->test->getVar(); Any help??

    Read the article

  • python and overflowing byte?

    - by Meloun
    Hi all, I need to make a variable with similar behaviour like in C lanquage. I need byte or unsigned char with range 0-255. This variable should overflow, that means... myVar = 255 myVar += 1 print myVar #!!myVar = 0!!

    Read the article

  • Send a variable to a variable of a function?

    - by J. M
    Let's say I have a function and one of the parameters is for the name of the target variable.. Would it be possible for me to send a variable to the function like this: function otherfunction(input){ ... } function test {target) { var x = 1; target(x); } test(otherfunction); The problem I have is that I'm making a greasemonkey script and one of the variable I need can't be returned from the function due to a limitation.. So this would be the alternative. I just don't know how to get it to work.. Any help would be much appreciated!!

    Read the article

  • Looping in filemaker using a local variable

    - by Mike Davis
    Been programming in C# for a little bit - trying to use file maker and I cant believe it but I cant even get a simple for loop to work. What I want to do is simple: loop through for the amount of entries in my "amountOfRooms" field and create an entry in a table for each room. Sounds so simple, but I cant get it to work. Right now I have this: Set Variable[$cnt[Customers::AmountOfRooms]; value:1] Go to Layout["rooms"(Rooms)] Loop Exit Loop If[$cnt = Customers::AmountOfRooms] New Record / Request Set Variable[$cnt; Value: $cnt + 1] End Loop Exit Script No new records are created. I know the script is running because it does go to my layout, but doesnt create any new records. There is a "Repetition" field for my local variable - not sure how to use that or what it means? Any thoughts on how to do this simple loop? Thanks.

    Read the article

  • Preserving NULL values in a Double Variable

    - by Sam
    Hi, I'm working on a vb.net application which imports from an Excel spreadsheet. If rdr.HasRows Then Do While rdr.Read() If rdr.GetValue(0).Equals(System.DBNull.Value) Then Return Nothing Else Return rdr.GetValue(0) End If Loop Else I was using string value to store the double values and when preparing the database statement I'd use this code: If (LastDayAverage = Nothing) Then command.Parameters.AddWithValue("@WF_LAST_DAY_TAG", System.DBNull.Value) Else command.Parameters.AddWithValue("@WF_LAST_DAY_TAG", Convert.ToDecimal(LastDayAverage)) End If I now have some data with quite a few decimal places and the data was put into the string variable in scientific notation, so this seems to be the wrong approach. It didn't seem right using the string variable to begin with. If I use a double or decimal type variable, the blank excel values come across as 0.0. How can I preserve the blank values? Thanks

    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

  • bash—Better way to store variable between runs?

    - by shardbearer
    I've made a bash script which I run every hour with crontab, and I need to store one variable so that I can access it the next time I run it. The script changes the variable every time it runs, so I can't hardcode it in. Right now I am writing it to a txt file and then reading it back. Is there a better way to do it than this? And the way I am reading the txt file is something I found on here, I don't understand it, and it's kinda clunky. Is there not a built in command for this? Anyway, here's the applicable code, with some of the variables changed to make it easier to read. while read x; do var=$x done < var.txt # Do some stuff, change var to a new value echo $var > var.txt The variable is only a single integer, so the text file feels overkill.

    Read the article

  • jQuery variable iteration with .each()

    - by user1143357
    My code needs to capture the 'src' of an image in a variable. It then needs to insert this variable into a 'href' tag on a link which surrounds the image. My code is as follows: $('.fancybox-image-li img').each(function(test) { var test = $(this).attr("src"); $('.fancybox-image-link').attr('href', ''+test+''); }); Unfortunately what seems to be happening is the 'test' var is only getting the attribute of the last img and then inserting this into all the 'href' attributes. Any ideas how I can get the variable to change per image. Cheers!

    Read the article

  • how to declare object variable name in loop

    - by user3717895
    public class Node{ Node p,l,r; int height; String s; { /** class body**/ } } String[] S=new String[5000]; int i=0; while (i<5000){ Node x=new Node(); x=S[i]; } I want to make 5000 Node object. above code assign same variable name x every time but i want different variable name . then how to declare 5000 class variable name without declaring it manually. is there something by which i can create 5000 Node class object with ease.

    Read the article

  • Delphi - Why is my global variable "inacessible" when i debug

    - by Antoine Lpy
    I'm building an application that contains around 30 Forms. I need to manage sessions, so I would like to have a global LoggedInUser variable accessible from all forms. I read "David Heffernan"'s post about global variables, and how to avoid them but I thought it would be easier to have a global User variable rather than 30 forms having their own User variable. So i have a unit : GlobalVars unit GlobalVars; interface uses User; // I defined my TUser class in a unit called User var LoggedInUser: TUser; implementation initialization LoggedInUser:= TUser.Create; finalization LoggedInUser.Free; end. Then in my LoginForm's LoginBtnClick procedure I do : unit FormLogin; interface uses [...],User; type TForm1 = class(TForm) [...] procedure LoginBtnClick(Sender: TObject); private { Déclarations privées } public end; var Form1: TForm1; AureliusConnection : IDBConnection; implementation {$R *.fmx} uses [...]GlobalVars; procedure TForm1.LoginBtnClick(Sender: TObject); var Manager : TObjectManager; MyCriteria: TCriteria<TUser>; u : TUser; begin Manager := TObjectManageR.Create(AureliusConnection); MyCriteria :=Manager.Find<TUtilisateur> .Add(TExpression.Eq('login',LoginEdit.Text)) .Add(TExpression.Eq('password',PasswordEdit.Text)); u := MyCriteria.UniqueResult; if u = nil then MessageDlg('Login ou mot de passe incorrect',TMsgDlgType.mtError,[TMsgDlgBtn.mbOK],0) else begin LoggedInUser:=u; //Here I assign my local User data to my global User variable Form1.Destroy; A00Form.visible:=true; end; Manager.Free; end; Then in another form I would like to access this LoggedInUser object in the Menu1BtnClick procedure : Unit C01_Deviations; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.ListView.Types, FMX.ListView, FMX.Objects, FMX.Layouts, FMX.Edit, FMX.Ani; type TC01Form = class(TForm) [...] Menu1Btn: TButton; [...] procedure Menu1BtnClick(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var C01Form: TC01Form; implementation uses [...]User,GlobalVars; {$R *.fmx} procedure TC01Form.Menu1BtnClick(Sender: TObject); var Assoc : TUtilisateur_FonctionManagement; ValidationOK : Boolean; util : TUser; begin ValidationOK := False; util := GlobalVars.LoggedInUser; // Here i created a local user variable for debug purposes as I thought it would permit me to see the user data. But i get "Inaccessible Value" as its value util.Nom:='test'; for Assoc in util.FonctionManagement do // Here is were my initial " access violation" error occurs begin if Assoc.FonctionManagement.Libelle = 'Reponsable équipe HACCP' then begin ValidationOK := True; break; end; end; [...] end; When I debug I see "Inaccessible Value" in the value column of my user. Do you have any idea why ? I tried to put an integer in this GlobalVar unit, and i was able to set its value from my login form and read it from my other form.. I guess I could store the user's id, which is an integer, and then retrieve the user from the database using its id. But it seems really unefficient.

    Read the article

  • Python Django Global Variables

    - by Joe J
    Hi all, I'm looking for simple but recommended way in Django to store a variable in memory only. When Apache restarts or the Django development server restarts, the variable is reset back to 0. More specifically, I want to count how many times a particular action takes place on each model instance (database record), but for performance reasons, I don't want to store these counts in the database. I don't care if the counts disappear after a server restart. But as long as the server is up, I want these counts to be consistent between the Django shell and the web interface, and I want to be able to return how many times the action has taken place on each model instance. I don't want the variables to be associated with a user or session because I might want to return these counts without being logged in (and I want the counts to be consistent no matter what user is logged in). Am I describing a global variable? If so, how do I use one in Django? I've noticed the files like the urls.py, settings.py and models.py seems to be parsed only once per server startup (by contrast to the views.py which seems to be parsed eache time a request is made). Does this mean I should declare my variables in one of those files? Or should I store it in a model attribute somehow (as long as it sticks around for as long as the server is running)? This is probably an easy question, but I'm just not sure how it's done in Django. Any comments or advice is much appreciated. Thanks, Joe

    Read the article

  • powershell: use variable with wildcard with get-aduser

    - by user179037
    powershell newbie here. I am building a simple bit of code to help me find user's by entering letters of user names. How do I get a wildcard to work w/ a variable? this works: $name=read-host -prompt "enter user's first or last initial" $userInput=get-aduser -f {givenname -like 'A*' } cmd /c echo "output: $userInput" this does not: $name=read-host -prompt "enter user's first or last initial" $userInput=get-aduser -f {givenname -like '$name*' } cmd /c echo "output: $userInput" The first bit of code delivers a list of users with "A" in their name. Any suggestions woudl be appreciated. thanks

    Read the article

  • Creating packages in code - Package Configurations

    Continuing my theme of building various types of packages in code, this example shows how to building a package with package configurations. Incidentally it shows you how to add a variable, and a connection too. It covers the five most common configurations: Configuration File Indirect Configuration File SQL Server Indirect SQL Server Environment Variable  For a general overview try the SQL Server Books Online Package Configurations topic. The sample uses a a simple helper function ApplyConfig to create or update a configuration, although in the example we will only ever create. The most useful knowledge is the configuration string (Configuration.ConfigurationString) that you need to set. Configuration Type Configuration String Description Configuration File The full path and file name of an XML configuration file. The file can contain one or more configuration and includes the target path and new value to set. Indirect Configuration File An environment variable the value of which contains full path and file name of an XML configuration file as per the Configuration File type described above. SQL Server A three part configuration string, with each part being quote delimited and separated by a semi-colon. -- The first part is the connection manager name. The connection tells you which server and database to look for the configuration table. -- The second part is the name of the configuration table. The table is of a standard format, use the Package Configuration Wizard to help create an example, or see the sample script files below. The table contains one or more rows or configuration items each with a target path and new value. -- The third and final part is the optional filter name. A configuration table can contain multiple configurations, and the filter is  literal value that can be used to group items together and act as a filter clause when configurations are being read. If you do not need a filter, just leave the value empty. Indirect SQL Server An environment variable the value of which is the three part configuration string as per the SQL Server type described above. Environment Variable An environment variable the value of which is the value to set in the package. This is slightly different to the other examples as the configuration definition in the package also includes the target information. In our ApplyConfig function this is the only example that actually supplies a target value for the Configuration.PackagePath property. The path is an XPath style path for the target property, \Package.Variables[User::Variable].Properties[Value], the equivalent of which can be seen in the screenshot below, with the object being our variable called Variable, and the property to set is the Value property of that variable object. The configurations as seen when opening the generated package in BIDS: The sample code creates the package, adds a variable and connection manager, enables configurations, and then adds our example configurations. The package is then saved to disk, useful for checking the package and testing, before finally executing, just to prove it is valid. There are some external resources used here, namely some environment variables and a table, see below for more details. namespace Konesans.Dts.Samples { using System; using Microsoft.SqlServer.Dts.Runtime; public class PackageConfigurations { public void CreatePackage() { // Create a new package Package package = new Package(); package.Name = "ConfigurationSample"; // Add a variable, the target for our configurations package.Variables.Add("Variable", false, "User", 0); // Add a connection, for SQL configurations // Add the SQL OLE-DB connection ConnectionManager connectionManagerOleDb = package.Connections.Add("OLEDB"); connectionManagerOleDb.Name = "SQLConnection"; connectionManagerOleDb.ConnectionString = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=master;Integrated Security=SSPI;"; // Add our example configurations, first must enable package setting package.EnableConfigurations = true; // Direct configuration file, see sample file this.ApplyConfig(package, "Configuration File", DTSConfigurationType.ConfigFile, "C:\\Temp\\XmlConfig.dtsConfig", string.Empty); // Indirect configuration file, the emvironment variable XmlConfigFileEnvironmentVariable // contains the path to the configuration file, e.g. C:\Temp\XmlConfig.dtsConfig this.ApplyConfig(package, "Indirect Configuration File", DTSConfigurationType.IConfigFile, "XmlConfigFileEnvironmentVariable", string.Empty); // Direct SQL Server configuration, uses the SQLConnection package connection to read // configurations from the [dbo].[SSIS Configurations] table, with a filter of "SampleFilter" this.ApplyConfig(package, "SQL Server", DTSConfigurationType.SqlServer, "\"SQLConnection\";\"[dbo].[SSIS Configurations]\";\"SampleFilter\";", string.Empty); // Indirect SQL Server configuration, the environment variable "SQLServerEnvironmentVariable" // contains the configuration string e.g. "SQLConnection";"[dbo].[SSIS Configurations]";"SampleFilter"; this.ApplyConfig(package, "Indirect SQL Server", DTSConfigurationType.ISqlServer, "SQLServerEnvironmentVariable", string.Empty); // Direct environment variable, the value of the EnvironmentVariable environment variable is // applied to the target property, the value of the "User::Variable" package variable this.ApplyConfig(package, "EnvironmentVariable", DTSConfigurationType.EnvVariable, "EnvironmentVariable", "\\Package.Variables[User::Variable].Properties[Value]"); #if DEBUG // Save package to disk, DEBUG only new Application().SaveToXml(String.Format(@"C:\Temp\{0}.dtsx", package.Name), package, null); Console.WriteLine(@"C:\Temp\{0}.dtsx", package.Name); #endif // Execute package package.Execute(); // Basic check for warnings foreach (DtsWarning warning in package.Warnings) { Console.WriteLine("WarningCode : {0}", warning.WarningCode); Console.WriteLine(" SubComponent : {0}", warning.SubComponent); Console.WriteLine(" Description : {0}", warning.Description); Console.WriteLine(); } // Basic check for errors foreach (DtsError error in package.Errors) { Console.WriteLine("ErrorCode : {0}", error.ErrorCode); Console.WriteLine(" SubComponent : {0}", error.SubComponent); Console.WriteLine(" Description : {0}", error.Description); Console.WriteLine(); } package.Dispose(); } /// <summary> /// Add or update an package configuration. /// </summary> /// <param name="package">The package.</param> /// <param name="name">The configuration name.</param> /// <param name="type">The type of configuration</param> /// <param name="setting">The configuration setting.</param> /// <param name="target">The target of the configuration, leave blank if not required.</param> internal void ApplyConfig(Package package, string name, DTSConfigurationType type, string setting, string target) { Configurations configurations = package.Configurations; Configuration configuration; if (configurations.Contains(name)) { configuration = configurations[name]; } else { configuration = configurations.Add(); } configuration.Name = name; configuration.ConfigurationType = type; configuration.ConfigurationString = setting; configuration.PackagePath = target; } } } The following table lists the environment variables required for the full example to work along with some sample values. Variable Sample value EnvironmentVariable 1 SQLServerEnvironmentVariable "SQLConnection";"[dbo].[SSIS Configurations]";"SampleFilter"; XmlConfigFileEnvironmentVariable C:\Temp\XmlConfig.dtsConfig Sample code, package and configuration file. ConfigurationApplication.cs ConfigurationSample.dtsx XmlConfig.dtsConfig

    Read the article

  • WPF Binding to local variable

    - by PrimeTSS
    Can you bind to a local variable like this? SystemDataBase.cs namespace WebWalker { public partial class SystemDataBase : Window { private string text = "testing"; ... SystemDataBase.xaml ... <TextBox Name="stbSQLConnectionString" Text="{SystemDataBase.text}"> </TextBox> ?? Text is set to the local variable "text"

    Read the article

  • Variable parsing with Bash and wget

    - by Bill Westrup
    I'm attempting to use wget in a simple bash script to grab a jpeg image from an Axis camera. This script outputs a file named JPEGOUT, instead of the desired output, which should be a timestamp jpeg (ex: 201209292040.jpg) . Changing the variable in the wget statement from JPEGOUT to $JPEGOUT makes wget fail with "wget: missing URL" error. The weird thing is wget parses the $IP vairable correctly. No luck on the output file name. I've tried single quotes, double quotes, parenthesis: all to no luck. Here's the script !/bin/bash IP=$1 JPEGOUT= date +%Y%m%d%H%M.jpg wget -O JPEGOUT http://$IP/axis-cgi/jpg/image.cgi?resolution=640x480&compression=25 Any ideas on how to get the output file name to parse correctly?

    Read the article

  • JSON - safely add a variable

    - by HeavyWave
    How do I safely add a variable to JSON data with C#? For instance I might have [{"data": "data"}, {"data": "data"}] or I might have {"data": "data"}. How do I add a new variable "newdata": "newdata" to the structure?

    Read the article

  • Make PATH variable changes permanent on openSuse

    - by Marlon
    Okay, so I'm trying to do something that should be rather simple but for some reason I can't quite seem to make it work. All I simply want to do is add a path to the PATH environment variable in openSuse. So far, I've edited the following line in /etc/default/su : PATH=/usr/local/bin:/bin:/usr/bin with this line : PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/php/bin:/usr/local/mysql/bin Basically, all I want to do is have access to php and mysqld regardless of how I log in directly from the command prompt without having to type trailing /usr/local/php/bin/ every time. Am I even editing the right file? I'm a bit of a Linux newbie and to achieve something as trivial as this is eluding me. Server gods out there, drop be a crumb, please? :-)

    Read the article

  • Change programfiles variable on windows

    - by Fire-Dragon-DoL
    I have built a computer for a user that asked me for "speed": an SSD was the obvious solution because what he means by speed is "fast boot time". This solved the problem, however the user is not smart enough to remember that he must install programs on D rather than C (c is the ssd, D is an raid 1 hdd). The only solution that comes in my mind is changing programfiles variable such that will point to D rather than C by default. Otherwise, other solutions are ok but I really can't find anything else at the moment. Does anyone have recommendations for how to accomplish changing the default installation directory in Windows?

    Read the article

  • Windows XP environment variable editor replacement that handles lines

    - by Codism
    I'm looking for an environment variable editor that handles linebreaks well. I have a monster %PATH% to edit (edited to save side-scrolling): C:\Program Files\Windows Resource Kits\Tools\;C:\Program Files\PC Connectivity Solution\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\cygwin\bin;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;C:\WINDOWS \system32\WindowsPowerShell\v1.0\;C:\Utils;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\; C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\; C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\; C:\Program Files\MKVtoolnix;C:\Program Files\Common Files\Roxio Shared\ DLLShared;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE I want the editor to put each path in a line and when I click save & close, for the editor put the lines back in the right format. Is there an editor that can do that?

    Read the article

  • NRPE and the $USER1$ variable

    - by timbrigham
    I have NRPE daemons running on all of my remote Linux boxes. I have a couple configurations in place and I'm trying to standardize the paths in my nrpe.cfg. The changes are deployed via Puppet. I would like to use the following syntax: command[mycommand]=$USER1$/check_tcp .. etc. The $USER1$ variable is not available in my NRPE setup. I could write Puppet templates for all the variants but I would much prefer to manage this through a native method. Is there anything available to do so? If not does anyone have a sample Puppet config that will address this?

    Read the article

  • Mysql locale session variable ?

    - by Maxim Veksler
    Hunting internationalization bugs here. Does mysql has a variable which can be set per session, meaning the each connection will know the timezone of it's client and will act upon that. If such variable does exists I would expect sql statements such as the following will return diffect values, based on connection session locale. select date('2010-04-14') + 0; Thank you, Maxim.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >