Search Results

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

Page 49/450 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • Batch number variable setter.

    - by eyefinity
    I need help with this batch file I'm working on, Basically everytime it does a task it should plus the variable %number% by one which works fine and all and then repeat over again doing a different task until its completed. This is the code which it uses to repeat I need a way of settings basically: set svn=%svn%%number% set svnlink=%svnlink%%number% set svnfolder=%svnfolder%%number% Instead I am using: if %number%==1 ( set svn=%svn1% set svnlink=%svnlink1% set svnfolder=%svnfolder1%) if %number%==2 ( set svn=%svn2% set svnlink=%svnlink2% set svnfolder=%svnfolder2%) if %number%==3 ( set svn=%svn3% set svnlink=%svnlink3% set svnfolder=%svnfolder3%) Which i really need to shorten as this goes up to number 20+ Is this possible? If you could help me, Thanks!

    Read the article

  • In Django, why is user.is_authenticated a method and not a member variable like is_staff

    - by luc
    Hello all, I've lost some time with a bug in my app due to user authentication. I think that it's a bit confusing but maybe someone can explain the reason and it will appear to me very logical. The user.is_staff is a member variable while user.is_authenticated is a method. However is_authenticated only returns True or False depending if the class is User or AnonymousUser (see http://docs.djangoproject.com/en/dev/topics/auth/) Is there a reason for that? Why user.is_authenticated is a method? Thanks in advance

    Read the article

  • How to pass a variable as an argument to a command with quotes in powershell

    - by da_ponc
    Hi there, My powershell script takes the following parameter: Param($BackedUpFilePath) The value that is getting passed into my script is: "\123.123.123.123\Backups\Website.7z" I have another variable which is the location I want to extract the file: $WebsiteDeploymentFolder = "C:\example" I am trying to extract the archive with the following command: `7z x $BackedUpFilePath -o$WebsiteDeploymentFolder -aoa I keep getting the following error: Error: cannot find archive The following works but I need $BackedUpFilePath to be dynamic: `7z x '\123.123.123.123\Backups\Website.7z' -o$WebsiteDeploymentFolder -aoa I think I need to pass $BackedUpFilePath to 7z with quotes but they seem to get stripped out no matter what I try. I am in quote hell. Thanks.

    Read the article

  • undefined local variable or method 'acts_as_gmappable'

    - by MRJ
    I attempted to install the gmaps4rails gem. I added gem 'gmaps4rails' to my Gemfile, and ran 'bundle install. It said that my bundle installed successfully. I can find "Using gmaps4rails (0.8.8)" with 'gem list'. I added the specified columns to my users table with rake db:migrate and added acts_as_gmappable and the gmaps4rails_address method to my User model. Visiting pages that involve the user model gives me "undefined local variable or method 'acts_as_gmappable'"error. Is there something that I am missing? For greater context, the code I am using is from the Rails 3 Tutorial. OS X 10.6.6 ruby 1.8.7 rails 3.0.7 passenger 3.0.7

    Read the article

  • How to use a variable to specify filegroup in MSSQL

    - by gt
    I want to alter a table to add a constraint during upgrade on a MSSQL database. This table is normally indexed on a filegroup called 'MY_INDEX' - but may also be on a database without this filegroup. In this case I want the indexing to be done on the 'PRIMARY' filegroup. I tried the following code to achieve this: DECLARE @fgName AS VARCHAR(10) SET @fgName = CASE WHEN EXISTS(SELECT groupname FROM sysfilegroups WHERE groupname = 'MY_INDEX') THEN QUOTENAME('MY_INDEX') ELSE QUOTENAME('PRIMARY') END ALTER TABLE [dbo].[mytable] ADD CONSTRAINT [PK_mytable] PRIMARY KEY ( [myGuid] ASC ) ON @fgName -- fails: 'incorrect syntax' However, the last line fails as it appears a filegroup cannot be specified by variable. Is this possible?

    Read the article

  • Distinguish UI change to variable from code-behind change

    - by Jay
    Like the title says I am trying to architecture into my application a way to distinguish the source of a variable change, either from UI or code-behind. My problem is that I need to trigger some action after a property changed its value, but I only need to do this when the change comes from the UI because otherwise I don-t want to perform that action. I am having some trouble because, for example when a checkbox(two way binding), changes state, my binded property gets updated and then I use the checked and uncheked events to trigger that action.The problem is that when I change the property in codebehind it also triggers those events and I do not want that. Right now, i am using a flag that enables, or not, the actions at the event handlers but I do not feel that this is a good idea. Any sugestions or ideas? I am considering using only one-way binding and control everything my self, using commands.

    Read the article

  • Getting a variable out of a Public Void (Android)

    - by James Rattray
    I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { final MediaPlayer mp2 = MediaPlayer.create(Textbox.this, R.raw.hero); mp2.start(); } public void onNothingSelected(AdapterView<?> parentView) { } }); (The code basically runs when a new item is selected of a spinner and then plays a song, -which later will be a variable based on what was picked, but i'm fine as it is for now) Problem: And I want to be able to use 'mp2' out of this public void, (I want a button which pauses it) How can I do this? Please explain/show... Thanks alot James

    Read the article

  • Jquery ID Attribute Contains With Selector and Variable

    - by User970008
    I would like to search for an image ID that contains a value AND a variable. I need the below script to be something like $("[id*='MYVALUE'+x]") but that does not work. for (x=0; x< imageList.length; x++) { var imageSRC = imageList[x]; //need this to be MYVALUE + the X val //search for IDs that contain MYVALUE + X $("[id*='MYVALUE']").attr('src', 'images/'+imageSRC); }; <!-- These images are replaced with images from the array imageList--> <img id="dkj958-MYVALUE0" src="images/imageplaceholder" /> <img id="mypage-MYVALUE1" src="images/imageplaceholder" /> <img id="onanotherpage-MYVALUE2-suffix" src="images/imageplaceholder" />

    Read the article

  • Passing a variable to jsp when reloading an iframe using javascript

    - by Vee
    In my javascript code I load a jsp page in an iframe and pass some variables like this: htmlData[i++]="<iframe id=\"mapframe\" frameborder=\"0\" style=\"width:330px;height:300px\" src=\"" + "mapURL.jsp" +"&lat=" + AjxStringUtil.urlComponentEncode("33.65") +"&lng=" + AjxStringUtil.urlComponentEncode("-84.42") +"&accord=" + AjxStringUtil.urlComponentEncode(accord) +"\"></iframe>"; Then I have to reload that jsp page after an action, and I do this: accord = ui.newHeader.text(); document.getElementById('mapframe').contentWindow.location.reload(); The reload works except that the "accord" variable is not getting updated. When I call it from the jsp, it still has its original value. How do I pass the new value when reloading the iframe/jsp? It shouldn't make any difference, but I am working with jquery and this is for a Yahoo zimlet. Thanks.

    Read the article

  • How to read a file with variable multi-row data in Python

    - by dr.bunsen
    I have a file that is about 100Mb that looks like this: #meta data 1 skadjflaskdjfasljdfalskdjfl sdkfjhasdlkgjhsdlkjghlaskdj asdhfk #meta data 2 jflaksdjflaksjdflkjasdlfjas ldaksjflkdsajlkdfj #meta data 3 alsdkjflasdjkfglalaskdjf This file contains one row of meta data that corresponds to several, variable length data containing only alpha-numeric characters. What is the best way to read this data into a simple list like this: data = [[#meta data 1, skadjflaskdjfasljdfalskdjflsdkfjhasdlkgjhsdlkjghlaskdjasdhfk], [#meta data 2, jflaksdjflaksjdflkjasdlfjasldaksjflkdsajlkdfj], [#meta data 3, alsdkjflasdjkfglalaskdjf]] My initial idea was to use the read() method to read the whole file into memory and then use regular expressions to parse the data into the desired format. Is there a better more pythonic way? All metadata lines start with an octothorpe and all data lines are all alpha-numeric. Thanks!

    Read the article

  • How to use a variable to specify filegroup in SQL Server

    - by gt
    I want to alter a table to add a constraint during upgrade on a SQL Server database. This table is normally indexed on a filegroup called 'MY_INDEX' - but may also be on a database without this filegroup. In this case I want the indexing to be done on the 'PRIMARY' filegroup. I tried the following code to achieve this: DECLARE @fgName AS VARCHAR(10) SET @fgName = CASE WHEN EXISTS(SELECT groupname FROM sysfilegroups WHERE groupname = 'MY_INDEX') THEN QUOTENAME('MY_INDEX') ELSE QUOTENAME('PRIMARY') END ALTER TABLE [dbo].[mytable] ADD CONSTRAINT [PK_mytable] PRIMARY KEY ( [myGuid] ASC ) ON @fgName -- fails: 'incorrect syntax' However, the last line fails as it appears a filegroup cannot be specified by variable. Is this possible?

    Read the article

  • Evaluation of jQuery function variable value during definition of that function

    - by thesnail
    I have a large number of rows in a table within which I wish to attach a unique colorpicker (jQuery plugin) to each cell in a particular column identified by unique ids. Given this, I want to automate the generation of instances of the colorpicker as follows: var myrows={"a","b","c",.....} var mycolours={"ffffff","fcdfcd","123123"...} for (var i=0;i<myrows.length;i++) { $("#"+myrows[i]+"colour").ColorPicker({flat: false, color: mycolours[i], onChange: function (hsb, hex, rgb) { $("#"+myrows[i]+"currentcolour").css('backgroundColor', '#' + hex); } }); Now this doesn't work because the evaluation of the $("#"+myrows[i]+"currentcolour") component occurs at the time the function is called, not when it is defined (which is want I need). Given that this plugin javascript appends its code to the level and not to the underlying DOM component that I am accessing above so can't derive what id this pertains to, how can I evaluate the variable during function declaration/definition? Thanks for any help/insight anyone can give. Brian.

    Read the article

  • .NET generic class instance - passing a variable data type

    - by FerretallicA
    As the title suggests, I'm tyring to pass a variable data type to a template class. Something like this: frmExample = New LookupForm(Of Models.MyClass) 'Works fine Dim SelectedType As Type = InstanceOfMyClass.GetType() 'Works fine frmExample = New LookupForm(Of SelectedType) 'Ba-bow! frmExample = New LookupForm(Of InstanceOfMyClass.GetType()) 'Ba-bow! LookupForm<Models.MyClass> frmExample; Type SelectedType = InstanceOfMyClass.GetType(); frmExample = new LookupForm<SelectedType.GetType()>(); //Ba-bow frmExample = new LookupForm<(Type)SelectedType>(); //Ba-bow I'm assuming it's something to do with the template being processed at compile time but even if I'm off the mark there, it wouldn't solve my problem anyway. I can't find any relevant information on using Reflection to instance template classes either. (How) can I create an instance of a dynamically typed repository at runtime?

    Read the article

  • Debugging stack data not assigned to a named variable

    - by gibbss
    Is there a way to view stack elements like un-assigned return values or exceptions that not assigned to a local variable? (e.g. throw new ...) For example, suppose I have code along the lines of: public String foo(InputStream in) throws IOException { NastyObj obj = null; try { obj = new NastyObj(in); return (obj.read()); } finally { if (obj != null) obj.close(); } } Is there any way to view the return or exception value without stepping to a higher level frame where it is assigned? This is particularly relevant with exceptions because you often have to step back up through a number of frames to find an actual handler. I usually use the Eclipse debugging environment, but any answer is appreciated. Also, if this cannot be done, can you explain why? (JVM, JPDA limitation?)

    Read the article

  • MATLAB submatrix over variable dimensions

    - by rlbond
    I have a variable dimension matrix, X. I want a function that will get the first half of X in one dimension. I.E., I want something like this: function x = variableSubmatrix(x, d) if d == 1 switch ndims(x) case 1 x = x(1:end/2); case 2 x = x(1:end/2, :); case 3 x = x(1:end/2, :, :); (...) end elseif d == 2 switch ndims(x) case 2 x = x(:, 1:end/2); case 3 x = x(:, 1:end/2, :); (...) end elseif (...) end end I'm not quite sure how to do this. I need it to be fast, as this will be used many times in computation.

    Read the article

  • Avoiding "variable might not have been initialized"

    - by Mason Wheeler
    I recently ran across a routine that looks something like this: procedure TMyForm.DoSomething(list: TList<TMyObject>; const flag: boolean); var local: integer; begin if flag then //do something else local := ExpensiveFunctionCallThatCalculatesSomething; //do something else for i := 0 to list.Count do if flag then //do something else if list[i].IntValue > local then //WARNING HERE //do something else end; This gives Variable 'local' might not have been initialized even though you can tell by reading the code that you won't hit that line unless the code branch that initializes it has run. Now, I could get rid of this warning by adding a useless local := 0; at the top of the procedure, but I wonder if there might not be a better way to structure this to avoid the issue. Anyone have any ideas?

    Read the article

  • Posting Static & Variable length data to the Server with JQUERY & Coldfusion

    - by nobosh
    I'm looking to post the following type of data to a server using JQUERY & Coldfusion: foodID - int foodDESC - text html text from a WYSIWYG (CKEDITOR) --there will always be just 1 foodID and foodDESC per POST to the server but there can be a variable number of: locationID - int LocationDesc - text --There can be 0-8+ of these. Should I send this in one post or multiple posts? If one post, what's the smartest way to do this? I'm never had to deal with this much data before. Thank you

    Read the article

  • Active Record like functionality on array instance variable

    - by rube_noob
    I would like to write a module that provides active record like functionality on an array instance variable. Examples of its use would be x = Container.new x.include(ContainerModule) x.elements << Element.new x.elements.find id module ContainerModule def initialize(*args) @elements = [] class << @elements def <<(element) #do something with the Container... super(element) end def find(id) #find an element using the Container's id self #=> #<Array..> but I need #<Container..> end end super(*args) end end The problem is that I need the Container object within these methods. Any reference to self will return the Array, not the Container object. Is there any way to do this? Thanks!

    Read the article

  • Korn Shell - Test with variable that may be not set

    - by C. Ross
    I have the following code in KornShell FAILURE=1 SUCCESS=0 isNumeric(){ if [ -n "$1" ]; then case $1 in *[!0-9]* | "") return $FAILURE; * ) return $SUCCESS; esac; else return $FAILURE; fi; } #... FILE_EXT=${FILE#*.} if [ isNumeric ${FILE_EXT} ]; then echo "Numbered file." fi #... In some cases the file name not have an extension, and this causes the FILE_EXT variable to be empty, which causes the following error: ./script[37]: test: 0403-004 Specify a parameter with this command. How should I be calling this function so that I do not get this error?

    Read the article

  • How to use a dynamic smarty variable in foreach loop

    - by P Kumar
    Hi, Can anyone tell me how to use dynamic variables in smarty foreach loop. I am trying to create a module in prestashop and m very close to get it done. here's my code: //file name index.php foreach($subCategories as $s) { $foo = intval($s['id_category']); $k = new Category($foo); $var1 = "subSubCategories.$foo"; $var1 = $k-getSubCategories(1); $smarty-assign(array('foo'.$foo = $var1)); } //file name:index.tpl {assign var=foo value=$foo$cat} //where $cat is a variable that counts the number of categories {if isset($foo) AND $foo} {foreach from=$foo item=subCategories name=homesubCategories} <p>{$subCategories.name}</p> {/foreach} {else} <p>{l s='test failed'}</p> {/if} I've exhausted all of my resources and knowledge and feeling quite helpless at this moment. so plz help me out.

    Read the article

  • Environment variable (NLS_LANG) value altered in Java process?

    - by Ralkie
    This was noticed in some legacy Java application (jre1.4 on HP-UX). Parent process (shell script S1) is starting Java process, which on its own is starting child process (shell script S2). Schematically it's: S1 Java S2. NB! Java application connects to Oracle DB using OCI driver. What is strange here is that process running S1 has environment variable NLS_LANG set to american_america.BLT8MSWIN1257, Java spawns S2 using: Runtime.getRuntime().exec(cmd); and S2 shows that NLS_LANG is set to american_america.UTF8 (!) This happens on some limited-access environment (production), I was not able to reproduce same problem on linux with jre 1.5. AFAIK, Java process should inherit environment from its parrent (S1) and should pass all environment variables to its child S2 (since single argument exec call was used). However, it does not seem to be the case. Any ideas why NLS_LANG appears to be altered?

    Read the article

  • Set a js variable in a html include

    - by user102533
    I have a ASP.NET page that uses the include method for header. I am adding a JS variable that I access from JS functions In head.htm <script language="javascript" type="text/javascript"> var render=<%= RenderProperty %>; </script> The RenderProperty is a method in the base page class (a .cs file that inherits from System.Web.UI.Page) It looks something like this: private bool _renderProp = false; public bool RenderProperty { get { return _renderProp; } set { _renderProp = value; } } On a page by page basis, I set the RenderProperty in the Page_Load of a aspx page protected void Page_Load(object sender, EventArgs e) { RenderProperty = true; } I get a compile time error that says: The name 'RenderProperty' does not exist in the current context C:\...\head.htm

    Read the article

  • Pointer to local variable

    - by Radek Šimko
    May I have any acces to local variable in different function? If may, how? void replaceNumberAndPrint(int array[3]) { printf("%i\n", array[1]); printf("%i\n", array[1]); } int * getArray() { int myArray[3] = {4, 65, 23}; return myArray; } int main() { replaceNumberAndPrint(getArray()); } The output of the piece of code above: 65 4202656 What am i doing wrong? What the "4202656" means?? Do I have to copy the whole array in the replaceNumberAndPrint() function to be able to access to it more than first times?

    Read the article

  • modx revo snippet variable in query

    - by Meddie
    I noticed something weird when using a query in a snippet. When I have a query like this: $sql = 'SELECT * FROM table WHERE colomn = ' . $variable; And I echo $sql, the query reads: SELECT * FROM table WHERE colomn = <code class="php plain">2</code> .. wich will result in an error because the sql is no longer valid. So for now I use strip_tags to remove the code tag, but I find it not a very clean method. I couldnt find anything about this, so maybe someone can shed some light on this for me?

    Read the article

  • ASP Classic Named Parameter in Paramaterized Query: Must declare the scalar variable

    - by My Alter Ego
    I'm trying to write a parameterized query in ASP Classic, and it's starting to feel like i'm beating my head against a wall. I'm getting the following error: Must declare the scalar variable "@something". I would swear that is what the hello line does, but maybe i'm missing something... <% OPTION EXPLICIT %> <!-- #include file="../common/adovbs.inc" --> <% Response.Buffer=false dim conn,connectionString,cmd,sql,rs,parm connectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=.\sqlexpress;Initial Catalog=stuff" set conn = server.CreateObject("adodb.connection") conn.Open(connectionString) set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.CommandText = "select @something" cmd.NamedParameters = true cmd.Prepared = true set parm = cmd.CreateParameter("@something",advarchar,adParamInput,255,"Hello") call cmd.Parameters.append(parm) set rs = cmd.Execute if not rs.eof then Response.Write rs(0) end if %>

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >