Search Results

Search found 6805 results on 273 pages for 'variables'.

Page 16/273 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Environment variable blank inside application

    - by Jake
    I have an environment variable that I've set in ~/.profile with the following line: export APPDIR=/path/to/dir When I log in and load up a terminal, I can verify that the variable is set: $ printenv APPDIR /path/to/dir I'm trying to access this variable from within a Qt application: QString appdir = getenv("APPDIR"); QTWARNING("dir: |" + appdir + "|"); The warning window that pops up shows me: dir: || What is going on here? Am I misunderstanding about how environment variables work in Ubuntu? This is with a C++/Qt App on Ubuntu 11.10 x86.

    Read the article

  • echo difference between ubuntu and RedHat

    - by arcomber
    I have mostly been experimenting with ubuntu but recently was using a Red Hat Enterprise system and was surprised at a difference I found setting and displaying env variables. In ubuntu I might have an interaction like this: acomber@mail:~$ export MY_VAR=i686-linux acomber@mail:~$ echo $MY_VAR i686-linux acomber@mail:~$ echo "$MY_VAR" i686-linux But on RHEL: acomber@mail:~$ export MY_VAR=i686-linux acomber@mail:~$ echo $MY_VAR acomber@mail:~$ echo "$MY_VAR" i686-linux I know this is a ubuntu forum but why the difference? Why do I need to enclose in quotes on RH? There are no spaces in the variable name?

    Read the article

  • Powershell Remoting Handover Variables

    - by icnivad
    I've opened a Remote Session s1, and like to run a function with Parameters i handover in my scriptblock: Simplified example with Write-Host: $a = "aaa" $b = "bbb" $c = "ccc" $d = "ddd" Write-Host "AAAAA: $a $b $c $d" #This works fine as it's locally Invoke-Command -Session $s1 -scriptblock {Write-Host "BBBBB: $a $b $c $d"} #These variables are empty What is the cleanest way to handover Variables (I normally receive from a local csv file) to the scriptblock?

    Read the article

  • Color variables in photoshop?

    - by Ezdaroth
    I'm doing a lot of website design and I'm looking for a feature that would allow me to set the main colors of website in variables and use the variables in color overlays and such. It would make changing the color scheme of site a lot easier and that would help previewing different possibilities. So, does such feature exists, or is there some kind of plugin for it? I'm using CS3 and I have CS4 available if it's required for this.

    Read the article

  • What's the best way to pass a PHP variable to Javascript?

    - by Gregory Bolkenstijn
    I currently echo certain variables in hidden input fields and read them out with Javascript whenever I need them. Me and a colleague are now thinking of generating an extra Javascript file with PHP which only contains all variables for Javascript. This way the variables already exist and there is no extra code in the HTML. What are good ways to pass variables from PHP to Javascript? And how does our solution sound?

    Read the article

  • Tracking pages with variables in GA

    - by Imran
    Recently I have updated my site, it now passes a variable on some links like so... www.mysite.com/1234/?play=true I've noticed in Google Analytics it records www.mysite.com/1234/ and www.mysite.com/1234/?play=true as two different URL's. Is there a way to merge them because they are after all just one page, It makes "Top Content" for example hard to read because of dupilicates. I've read about something called canonical link tag which may help this? My blog has this already inserted into the head but it doesnt make a difference. Any suggestions?

    Read the article

  • Setting effects variables in XNA

    - by Badescu Alexandru
    Hello ! I am currently reading a book named "3D Graphics with XNA Game Studio 4.0" by Sean James and have some questions to ask : If i create a effect parameter named lets say SpecularPower and have in my effect a variable named SpecularPower , if i do something like effect.Parameters["SpecularPower"].SetValue(3) That wil change the SpecularPower variable in my effect ? And a second question, not regarding the book : If i have a spaceship and i've created a "boost" functionality that speeds up my spaceship, what effects should i implement to create the impresion oh high speed ? I was thinking of making everything except my spaceship blurry but i think there would be something missing . Any ideas ? Regards, Alex Badescu

    Read the article

  • Powershell variables to string

    - by Mike Koerner
    I'm new to powershell. I'm trying to write an error handler to wrap around my script.  Part of the error handler is dumping out some variable settings.  I spent a while trying to do this and couldn't google a complete solution so I thought I'd post something. I want to display the $myinvocation variable. In powershell you can do this PS C:\> $myInvocation for my purpose I want to create a stringbuilder object and append the $myinvocation info.  I tried this $sbOut = new-object System.Text.Stringbuilder $sbOut.appendLine($myinvocation) $sbOut.ToString() This produces                                    Capacity                                MaxCapacity                                     Length                                    --------                                -----------                                     ------                                          86                                 2147483647                                         45 System.Management.Automation.InvocationInfo This is not what I wanted so I tried $sbOut.appendLine(($myinvocation|format-list *)) This produced                                    Capacity                                MaxCapacity                                     Length                                    --------                                -----------                                     ------                                         606                                 2147483647                                        305 Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Micros oft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.Powe rShell.Commands.Internal.Format.FormatEndData Finally I figured out how to produce what I wanted: $sbOut = new-object System.Text.Stringbuilder [void]$sbOut.appendLine(($myinvocation|out-string)) $sbOut.ToString() MyCommand        : $sbOut = new-object System.Text.Stringbuilder                                    [void]$sbOut.appendLine(($myinvocation|out-string))                                      $sbOut.ToString()                    BoundParameters  : {} UnboundArguments : {} ScriptLineNumber : 0 OffsetInLine     : 0 HistoryId        : 13 ScriptName       : Line             : PositionMessage  : InvocationName   : PipelineLength   : 2 PipelinePosition : 1 ExpectingInput   : False CommandOrigin    : Runspace Note the [void] in front of the stringbuilder variable doesn't show the Capacity,MaxCapacity of the stringbuilder object.  The pipe to out-string makes the output a string. It's not pretty but it works.

    Read the article

  • alternative to environment variables

    - by tonyl7126
    The amount of servers and the complexity of our application is growing and we now have servers in different regions (hosted on AWS). Certain database operations require low latency so we have stuck a database in each region (which is basically a user cache) to keep the network latency low. The way the application server currently knows which user cache/database to make its call to depends on an environemnt variable set in it. This has been working fine, but it seems hacky and not optimal. Is there any way for this to be done automatically? I was considering using a package like fping and pinging each database when the app server reloads (or caching it the first time) and using the corresponding latencies to decide which database has the lowest latency for each app server. Not sure if this is the best idea though.

    Read the article

  • Javascript Rookie Question: Define Variables Inline

    - by Dylan Kinnett
    I'm proficient with HTML and CSS but I'm still pretty shaky when it comes to Javascript. That said, I've been able to build a site using the Internet Archive Book Reader, which relies on reader.js Here's a copy of one of my versions of reader.js https://gist.github.com/dylan-k/ed4efed2384e221d46cc It's a good site, but I find I have to repeat things a lot. Basically, I have one copy of reader.js for every page/book featured on the site. It seems there must be a better way. I re-use the script, making copies, just so that I can change lines 28, 80, 83, 84. Is there a way I could include just one copy of reader.js and then use a <script> tag to define these 4 lines for the individual pages?

    Read the article

  • Using env variables with RewriteRule and ErrorDocument

    - by misterte
    Hi, I'm having problems with the following while config. my Apache server to Rewrite some urls. SetEnv PATH_TO_DIR /directory RewriteRule ^%{PATH_TO_DIR}/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-\.]+)/?$ /index.php?dir=$1&file=$2 ErrorDocument 404 %{PATH_TO_DIR}/index.php?dir=null&file=error This conf. used to work perfectly fine until I used SetEnv PATH... etc. I need to use this because there are lots of rules, not just those. Can anyone point out my mistake? Apache returns %{PATH_TO_DIR}/index.php?dir=null&file=error when I try anything (www.site.com/foo/bar for instance). Apache returns the ErrorDocument if i just try to fetch the index. I know it's not a problem with the rewrite rules because they work when I remove the PATH_TO_DIR variable and just hard code it. Thanks! A.

    Read the article

  • Scripting with variables from file

    - by Nooster
    I have several videos on my PC that I would like to shorten. For instance I have a 30 sec video where I want to have the section from sec 15 to 20 (a 5sec video). To cut this, I use avconv. avconv -i input.mp4 -ss 15 -acodec copy -vcodec copy -t 5 output.mp4 This command works pretty well. I have many videos I want to cut the same way. This is why I created a textfile containing the information: input-name, start of cut, length of cut, output-name. Those are written into in.txt that looks like this: input.mp4 15 5 output.mp4 input1.mp4 32 10 output1.mp4 input2.mp4 10 7 output2.mp4 ... My question is: How do I have to modify the avconv-command to cut my videos automatically? What I tried was this, but it didn't work at all: avconv -i $1 -ss $2 -acodec copy -vcodec copy -t $3 $4 < in.txt Any idea?

    Read the article

  • Are flag variables an absolute evil?

    - by dukeofgaming
    I remember doing a couple of projects where I totally neglected using flags and ended up with better architecture/code; however, it is a common practice in other projects I work at, and when code grows and flags are added, IMHO code-spaghetti also grows. Would you say there are any cases where using flags is a good practice or even necessary?, or would you agree that using flags in code are... red flags and should be avoided/refactored; me, I just get by with doing functions/methods that check for states in real time instead. Edit: Not talking about compiler flags

    Read the article

  • Passing variables from PHP to C++

    - by Alex
    I’m new to this so I’m sorry if my question is trivial. I have the following situation: I need to call a program from PHP and pass some vars and/or sets of key-value pairs to it. Now, my question is: how do I pass these vars, through arguments to the called function (e.g. exec("/path/to/program flag1 flag2 [key1=A,key2=B]");)? Or is there a better method to achieve this? Somebody suggested me to write them into a txt file and pass the path to it to as an argument instead (e.g. exec("/path/to/program path_to_txt_file);), but I’m not to excited about this method.

    Read the article

  • Name for this antipattern? Fields as local variables

    - by JSB????
    In some code I'm reviewing, I'm seeing stuff that's the moral equivalent of the following: public class Foo { private Bar bar; public MethodA() { bar = new Bar(); bar.A(); bar = null; } public MethodB() { bar = new Bar(); bar.B(); bar = null; } } The field bar here is logically a local variable, as its value is never intended to persist across method calls. However, since many of the methods in Foo need an object of type Bar, the original code author has just made a field of type Bar. This is obviously bad, right? Is there a name for this antipattern?

    Read the article

  • Error Setting Java Environment Variables

    - by Cherie Riesberg
    Problem:  Not exactly SharePoint, but the issue is when setting the %JAVA_HOME% environment variable, Java installs to the Program Files directory by default.  The space in the path seems to stop the variable from being read.  You get an error. Solution:  Change Program Files to Progra~1, so the path now looks like this: C:\Progra~1\Java\jdk1.6.0_23\bin\; You can type %JAVA_HOME%\bin\javac to test.  Output should look like this: Usage: javac <options> <source files> where possible options include: ...

    Read the article

  • Track user through Google Universal Analytics

    - by raygo
    I want to track a user from my site, give an id to Google Analytics and later be able to see which pages that id visited and for how long did that id view the pages. I've tried custom variables with the classic analytics. I tried enabling the User-ID feature in the Universal Analytics. Neither of these have given me what I want yet. Is there any way to accomplish this with Universal Analytics? UPDATE This is a sample code with a user whose id is 2. I try to set the userid in different ways to see if at least in one way it shows. <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXX-1', 'domain.com', { 'userId': '2' }); ga('set', '&uid', '2'); // Set the user ID using signed-in user_id. var dimensionValue = '2'; ga('set', 'dimension1', dimensionValue); ga('send', 'pageview'); </script>

    Read the article

  • Prefer class members or passing arguments between internal methods?

    - by geoffjentry
    Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as an argument to each of the methods - and why? On one hand I could see an argument to be made that reducing state (ie member variables) in a class is generally a good thing, although if the same value is being repeatedly used throughout a class' methods it seems like that would be an ideal candidate for representation as state for the class to make the code visibly cleaner if nothing else. Edit: To clarify some of the comments/questions that were raised, I'm not talking about constants and this isn't relating to any particular case rather just a hypothetical that I was talking to some other people about. Ignoring the OOP angle for a moment, the particular use case that I had in mind was the following (assume pass by reference just to make the pseudocode cleaner) int x doSomething(x) doAnotherThing(x) doYetAnotherThing(x) doSomethingElse(x) So what I mean is that there's some variable that is common between multiple functions - in the case I had in mind it was due to chaining of smaller functions. In an OOP system, if these were all methods of a class (say due to refactoring via extracting methods from a large method), that variable could be passed around them all or it could be a class member.

    Read the article

  • Do there exist programming languages where a variable can truly know its own name?

    - by Job
    In PHP and Python one can iterate over the local variables and, if there is only once choice where the value matches, you could say that you know what the variable's name is, but this does not always work. Machine code does not have variable names. C compiles to assembly and does not have any native reflection capabilities, so it would not know it's name. (Edit: per Anton's answer the pre-processor can know the variable's name). Do there exist programming languages where a variable would know it's name? It gets tricky if you do something like b = a and b does not become a copy of a but a reference to the same place. EDIT: Why in the world would you want this? I can think of one example: error checking that can survive automatic refactoring. Consider this C# snippet: private void CheckEnumStr(string paramName, string paramValue) { if (paramName != "pony" && paramName != "horse") { string exceptionMessage = String.Format( "Unexpected value '{0}' of the parameter named '{1}'.", paramValue, paramName); throw new ArgumentException(exceptionMessage); } } ... CheckEnumStr("a", a); // Var 'a' does not know its name - this will not survive naive auto-refactoring There are other libraries provided by Microsoft and others that allow to check for errors (sorry the names have escaped me). I have seen one library which with the help of closures/lambdas can accomplish error checking that can survive refactoring, but it does not feel idiomatic. This would be one reason why I might want a language where a variable knows its name.

    Read the article

  • MySQL Triggers - How to capture external web variables? (eg. web username, ip)

    - by Ken
    Hi, I'm looking to create an audit trail for my PHP web app's database (eg. capture inserts, updates, deletes). MySQL triggers seem to be just the thing -- but how do I capture the IP address and the web username (as opposed to the mysql username, localhost) of the user who invoked the trigger? Thanks so much. -Ken P.S. I'm working with this example code I found: DROP TRIGGER IF EXISTS history_trigger $$ CREATE TRIGGER history_trigger BEFORE UPDATE ON clients FOR EACH ROW BEGIN IF OLD.first_name != NEW.first_name THEN INSERT INTO history_clients ( client_id , col , value , user_id , edit_time ) VALUES ( NEW.client_id, 'first_name', NEW.first_name, NEW.editor_id, NEW.last_mod ); END IF; IF OLD.last_name != NEW.last_name THEN INSERT INTO history_clients ( client_id , col , value , user_id , edit_time ) VALUES ( NEW.client_id, 'last_name', NEW.last_name, NEW.editor_id, NEW.last_mod ); END IF; END; $$

    Read the article

  • PHPMailer safe practices - Send escaped / sanitized variables or not ?

    - by FreekOne
    I'm using the PHPMailer-Lite class to build an email sending script and I'm not sure if I should use addslashses() on the $name variable when adding it to the constructor. If somebody's last name would be O'Riley (or any other name that contains characters which should normally be sanitized before handling) and I would send it unescaped, wouldn't it mess with the script/email sending ? Is it safe to send it unescaped ? As a side note, I would also like to avoid having my message body say "Hello, O\'Riley". Looking at the source, I saw that it only trims the whitespace and line ending (\r\n) characters from the received $name variable, so any advice on this would be more than welcome. Thank you all in advance !

    Read the article

  • How to handle optional variables of an object in Java?

    - by Arvanem
    Hi folks, For my trading program, I have a Merchant class. A given Merchant object may or may not have a particular special quality or bundle of special qualities. For example, one Merchant object may have the Stockbroker quality, another Merchant may have the Financial Services and Stockbroker qualities, and another Merchant may have no special qualities at all. My initial thought was to create a HashMap and a Qualities class as follows: Map<Qualities, Boolean> merchantQualities = new HashMap<Qualities, Boolean>(); The only problem is, there are at least 50 possible special qualities for Merchants, such that it would be extremely tiresome to subclass all the qualities from the Quality class. Is there a better way of coding for these optional special qualities and representing them in the Merchants class than a HashMap and subclassing a Qualities class?

    Read the article

  • How to store local variables in jQuery click functions?

    - by Geuis
    I'm trying to figure out how to store external variable values in the functions created during jQuery's click() event. Here's a sample of the code I'm working with now. for(var i=0; i<3; i++){ $('#tmpid'+i).click(function(){ var gid = i; alert(gid); }); } <div id="tmpid0">1al</div> <div id="tmpid1">asd</div> <div id="tmpid2">qwe</div> So what's happening is that the events are attaching properly, but the value of 'gid' is always the last incremented value of 'i'. I'm not sure how to setup the private variable in this situation.

    Read the article

  • Can I view a list of public variables of some Adobe Air app or web flash file from another app?

    - by Parris
    I was thinking about creating making AIM pluggin that checks pandora one (desktop) or pandora website periodically to see what is currently playing and update a user's status. I suppose the main question is there a clever way to access a "public" variable from some open Adobe Air process? I KNOW this sounds like some crazy security flaw, but it may also be a feature. I am pretty sure javascript can potentially handle it. Thanks!

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >