Search Results

Search found 16311 results on 653 pages for 'environment variables'.

Page 6/653 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • starting rails in test environment

    - by Brian D.
    I'm trying to load up rails in the test environment using a ruby script. I've tried googling a bit and found this recommendation: require "../../config/environment" ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'test' This seems to load up my environment alright, but my development database is still being used. Am I doing something wrong? Here is my database.yml file... however I don't think it is the issue development: adapter: mysql encoding: utf8 reconnect: false database: BrianSite_development pool: 5 username: root password: dev host: localhost # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql encoding: utf8 reconnect: false database: BrianSite_test pool: 5 username: root password: dev host: localhost production: adapter: mysql encoding: utf8 reconnect: false database: BrianSite_production pool: 5 username: root password: dev host: localhost I can't use ruby script/server -e test because I'm trying to run ruby code after I load rails. More specifically what I'm trying to do is: run a .sql database script, load up rails and then run automated tests. Everything seems to be working fine, but for whatever reason rails seems to be loading in the development environment instead of the test environment. Here is a shortened version of the code I am trying to run: system "execute mysql script here" require "../../config/environment" ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'test' describe Blog do it "should be initialized successfully" do blog = Blog.new end end I don't need to start a server, I just need to load my rails code base (models, controllers, etc..) so I can run tests against my code. Thanks for any help.

    Read the article

  • Local variables in java

    - by Mandar
    Hello , I went through local variables and class variables concept. But I had stuck at a doubt " Why is it so that we cannot declare local variables as static " ? For e.g Suppose we have a play( ) function : void play( ) { static int i=5; System.out.println(i); } It gives me error in eclipse : Illegal modifier for parameter i; I had this doubt because of the following concepts I have read : Variables inside method : scope is local i.e within that method. When variable is declared as static , it is present for the entire class i.e not to particular object. Please could anyone help me out to clarify the concept. Thanks.

    Read the article

  • Static variables in C and C++

    - by Naveen
    Is there any difference between a variable declared as static outside any function between C and C++. I read that static means file scope and the variables will not be accessible outside the file. I also read that in C, global variables are static . So does that mean that global variables in C can not be accessed in another file?

    Read the article

  • Passing variables, creating instances, self, The mechanics and usage of classes: need explenation

    - by Baf
    I've been sitting over this the whole day and Im a little tired already so please excuse me being brief. Im new to python. I just rewrrote a working program, into a bunch of functions in a class and everzthings messed up. I dont know if its me but Im very surprised i couldn t find a beginners tutorial on how to handle classes on the web so I have a few questions. First of all, in the init section of the class i have declared a bunch of variables with self.variable=something. Is it correct that i should be able to access/modify these variables in every function of the class by using self.variable in that function? In other words by declaring self.variable i have made these variables, global variables in the scope of the class right? If not how do i handle self. ? Secondly how do i correctly pass arguments to the class? some example code would be cool. thirdly how do i call a function of the class outside of the class scope? some example code would be cool. fouthly how do I create an Instance of the class INITIALCLASS in another class OTHERCLASS, passing variables from OTHERCLASS to INITIALCLASS? some example code would be cool. I Want to call a function from OTHERCLASS with arguments from INITIALCLASS. What Ive done so far is. class OTHERCLASS(): def __init__(self,variable1,variable2,variable3): self.variable1=variable1 self.variable2=variable2 self.variable3=variable3 def someotherfunction(self): something=somecode(using self.variable3) self.variable2.append(something) print self.variable2 def somemorefunctions(self): self.variable2.append(variable1) class INITIALCLASS(): def __init__(self): self.variable1=value1 self.variable2=[] self.variable3='' self.DoIt=OTHERCLASS(variable1,variable2,variable3) def somefunction(self): variable3=Somecode #tried this self.DoIt.someotherfunctions() #and this DoIt.someotherfunctions() I clearly havent understood how to pass variables to classes or how to handle self, when to use it and when not, I probably also havent understood how to properly create an isntance of a class. In general i havent udnerstood the mechanics of classes So please help me and explain it to me like i have no Idea( which i dont it seems). Or point me to a thorough video, or readable tutorial. All i find on the web is super simple examples, that didnt help me much. Or just very short definitions of classes and class methods instances etc. I can send you my original code if you guys want, but its quite long. Thanks for the Help Much appreciated!

    Read the article

  • Effective way of keeping past projects with their working development environment?

    - by Korey Hinton
    I find that whenever I want to go run a past project, it will take a long time before I can find it and before I have everything set-up again for it to be able to run. For example, I have python projects I created in Linux, and it depends on software packages that are easily installed in Linux, yet I no longer have the Linux VM I was using. And some of my other projects depend on other variables like web server configuration, PATH variables, sdk, IDE, OS version, device, etc. Does someone have an effective way of handling this issue? As of now I have only concerned myself with keeping the source code backed up yet it is difficult re-establish the working development environment and it is also difficult to keep the working development environment around as well.

    Read the article

  • Mac OS X keeps "old" environment variable around

    - by Xymak1y
    So far I had /Applications/play-1.2.5/ added to my $PATH variable. Now I'm working with 2.2.1, which I installed in /Applications/play-2.2.1 and changed in ~/.bash_profile (which is getting sourced at startup). However, when printing $PATH, 1.2.5 is somehow still around: mbp:~ user$ echo $PATH /usr/local/share/npm/bin:/Applications/play-2.2.1:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/play-1.2.5:/Applications/XAMPP/xamppfiles/bin/:/opt/X11/bin As far as I now, I only entered $PATH variables in .bash_profile, which looks like this: mbp:~ user$ cat .bash_profile source ~/.git-completion.bash ### Added by the Heroku Toolbelt export PATH="/usr/local/heroku/bin:$PATH" ### Play Framework export PATH="/Applications/play-2.2.1:$PATH" export PATH="/usr/local/share/npm/bin:$PATH" I'm also not sure where the XAMPP extension to the variable comes from. Can I see somewhere which other files are being sourced on startup?

    Read the article

  • Setting environment variables in OS X

    - by Percival Ulysses
    Despite the warning that questions that can be answered are preferred, this question is more a request for comments. I apologize for this, but I feel that it is valuable nonetheless. The problem to set up environment variables such that they are available for GUI applications has been around since the dawn of Mac OS X. The solution with ~/.MacOSX/environment.plist never satisfied me because it was not reliable, and bash style globbing wasn't available. Another solution is the use of Login Hooks with a suitable shell script, but these are deprecated. The Apple approved way for such functionality as provided by login hooks is the use of Launch Agents. I provided a launch agent that is located in /Library/LaunchAgents/: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>user.conf.launchd</string> <key>Program</key> <string>/Users/Shared/conflaunchd.sh</string> <key>ProgramArguments</key> <array> <string>~/.conf.launchd</string> </array> <key>EnableGlobbing</key> <true/> <key>RunAtLoad</key> <true/> <key>LimitLoadToSessionType</key> <array> <string>Aqua</string> <string>StandardIO</string> </array> </dict> </plist> The real work is done in the shell script /Users/Shared/conflaunchd.sh, which reads ~/.conf.launchd and feeds it to launchctl: #! /bin/bash #filename="$1" filename="$HOME/.conf.launchd" if [ ! -r "$filename" ]; then exit fi eval $(/usr/libexec/path_helper -s) while read line; do # skip lines that only contain whitespace or a comment if [ ! -n "$line" -o `expr "$line" : '#'` -gt 0 ]; then continue; fi eval launchctl $line done <"$filename" exit 0 Notice the call of path_helper to get PATH set up right. Finally, ~/.conf.launchd looks like that setenv PATH ~/Applications:"${PATH}" setenv TEXINPUTS .:~/Documents/texmf//: setenv BIBINPUTS .:~/Documents/texmf/bibtex//: setenv BSTINPUTS .:~/Documents/texmf/bibtex//: # Locale setenv LANG en_US.UTF-8 These are launchctl commands, see its manpage for further information. Works fine for me (I should mention that I'm still a Snow Leopard guy), GUI applications such as texstudio can see my local texmf tree. Things that can be improved: The shell script has a #filename="$1" in it. This is not accidental, as the file name should be feeded to the script by the launch agent as an argument, but that doesn't work. It is possible to put the script in the launch agent itsself. I am not sure how secure this solution is, as it uses eval with user provided strings. It should be mentioned that Apple intended a somewhat similar approach by putting stuff in ~/launchd.conf, but it is currently unsupported as to this date and OS (see the manpage of launchd.conf). I guess that things like globbing would not work as they do in this proposal. Finally, I would mention the sources I used as information on Launch Agents, but StackExchange doesn't let me [1], [2], [3]. Again, I am sorry that this is not a real question, I still hope it is useful.

    Read the article

  • best practices for setting development environment

    - by Sharique
    I use Linux as primary OS. I need some suggestions regarding how should I set up my desktop and development. I do work on mostly .Net and Drupal, but some time on other lamp products and C/C++, Qt. I'm also interested in mobile (android..) and embedded development. Currently I install everything on my main OS, even I use it a little. I use VMs a little. Should I use separate VM for each kind of development (like one for .Net/Mono, another C++, one for mobile and one for db only, one for xyz things etc) Keep primary development environment on main os and moveothers in VM. main os should be messed up keep things easy to organize (must) performance should be optimal

    Read the article

  • Development environment clean installation

    - by ruigoncalves
    Hi there! I'm about to install a new and clean development environment. To accomplish that, I would like a Windows operating system (possibly Windows 7) and a Ubuntu one (possibly the most recent, 10.04). To allow sharing data between the two operating systems, I'm thinking to create a partition (workspace, for example) with using NTFS to format it and that be automatically mounted by Ubuntu. In terms of the partitioning schema, how would be better to organize the previous mentioned partitions? Thanks in advance, Best regards!

    Read the article

  • /etc/environment and cron

    - by clorz
    Hi, I've got two machines: Fedora and CentOS. And a cronjob 0-59 * * * * env > /home/me/env.log On CentOS I can see that /etc/environment is affecting the output while on Fedora it does not. I want Fedora to be like CentOS. What do I need to make it happen? /etc/pam.d/crond on Fedora auth sufficient pam_rootok.so auth required pam_env.so auth include system-auth account required pam_access.so account include system-auth session required pam_loginuid.so session include system-auth /etc/pam.d/crond on CentOS auth sufficient pam_env.so auth required pam_rootok.so auth include system-auth account required pam_access.so account include system-auth session required pam_loginuid.so session include system-auth /etc/security/pam_env.conf is the same on both systems and consists of commented out lines. Even if I make /etc/pam.d/cron.d files the same, problem still persists.

    Read the article

  • /etc/environment and cron

    - by clorz
    I've got two machines: Fedora and CentOS. And a cronjob 0-59 * * * * env > /home/me/env.log On CentOS I can see that /etc/environment is affecting the output while on Fedora it does not. I want Fedora to be like CentOS. What do I need to make it happen? /etc/pam.d/crond on Fedora auth sufficient pam_rootok.so auth required pam_env.so auth include system-auth account required pam_access.so account include system-auth session required pam_loginuid.so session include system-auth /etc/pam.d/crond on CentOS auth sufficient pam_env.so auth required pam_rootok.so auth include system-auth account required pam_access.so account include system-auth session required pam_loginuid.so session include system-auth /etc/security/pam_env.conf is the same on both systems and consists of commented out lines. Even if I make /etc/pam.d/cron.d files the same, problem still persists.

    Read the article

  • Where to export a truly global environment variable?

    - by Socio
    I want to set an environment variable that will be visible to all processes launched by Upstart. This is on a CentOS system, but I presume the same applies to Ubuntu given that they both use Upstart. Somewhere in /etc/init/ perhaps? Note that adding it in /etc/profile.d only applies to login shells. I want all processes (e.g cron, rc.local, etc) to see it. Obviously I'd prefer not to edit existing sys config files if it can be avoided.

    Read the article

  • What's needed in a complete ASP.NET environment?

    - by Christian W
    We have a ASP3.0 application with a few ASP.NET (2.0) dittys mixed in. (Our longtime goal is to migrate everything to ASP.NET but that's not important for this issue) Our current test/deploy workflow is like this: 1 Use notepad++ or VS2008 to fix a bug/feature (depending on what I have open) 2 Open my virtual test-server 3 Copy the fixed file over, either with explorer, or if I can be bothered to open it, WinMerge 4 Test that the fix works 5 Close the virtual test-server 6 Connect to our host with VPN 7 Use WinMerge to update the files necessary 8 Pray to higher powers that the production environment is not so different that something bombs. To make things worse, only I have access to my "test-server". So I'm the only one testing it. I really want to make this a bit more robust, I even have a subversion setup running. But I always forget to commit changes... And I don't even work in my checked out folder, but a copy of what is currently in production... Can someone recommend some good reading on deploying, testing, staging and stuff like that. I currently use VS2008 and want to use subversion or GIT (or any other free VCS). Since I'm the only developer, teamsystem is not really an option (cost-related). I have found myself developing an "improved" feature, only to find a bug in the same feature in the production system. And since my "improved" feature incorporated deleting some old functionality, I have to fix bugs directly in production... That's not a fun feeling... (I have inherited this system recently... So it's not directly my fault that it is like this ;) )

    Read the article

  • Changing PATH Environment Variable for all Users. (Ubuntu)

    - by Wally Glutton
    I recently compiled Ruby Enterprise Edition (REE) on an Ubuntu 8.04 server. I would like to update my PATH to ensure this new version of Ruby (found in /opt/ruby_ee/bin) supersedes the older version in /usr/local/bin. (I still want the old version around, though.) I would like these PATH changes to affect all users and crontabs. Attempted Solution #1: The REE documentation recommends placing the REE bin folder at the beginning of the global PATH in /etc/environment. I altered the PATH in this file to read: PATH="/opt/ruby_ee/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" This did not affect my PATH at all. Attempted Solution #2: Next I followed these instructions and updated the PATH setting in /etc/login.defs and /etc/crontab. (I did not change /etc/sudoers.) This didn't affect my PATH either, even after logging out and rebooting the server. Other information: I seem to be having the same problem described here. I'm testing using the commands "echo $PATH" and "ruby -v". My shell is bash. My .bashrc doesn't override my PATH. Yes, I have heard of the Ruby Version Manager project. ;)

    Read the article

  • A deadlock was detected while trying to lock variables in SSIS

    Error: 0xC001405C at SQL Log Status: A deadlock was detected while trying to lock variables "User::RowCount" for read/write access. A lock cannot be acquired after 16 attempts. The locks timed out. Have you ever considered variable locking when building your SSIS packages? I expect many people haven’t just because most of the time you never see an error like the one above. I’ll try and explain a few key concepts about variable locking and hopefully you never will see that error. First of all, what is all this variable locking all about? Put simply SSIS variables have to be locked before they can be accessed, and then of course unlocked once you have finished with them. This is baked into SSIS, presumably to reduce the risk of race conditions, but with that comes some additional overhead in that you need to be careful to avoid lock conflicts in some scenarios. The most obvious place you will come across any hint of locking (no pun intended) is the Script Task or Script Component with their ReadOnlyVariables and ReadWriteVariables properties. These two properties allow you to enter lists of variables to be used within the task, or to put it another way, these lists of variables to be locked, so that they are available within the task. During the task pre-execute phase the variables and locked, you then use them during the execute phase when you code is run, and then unlocked for you during the post-execute phase. So by entering the variable names in one of the two list, the locking is taken care of for you, and you just read and write to the Dts.Variables collection that is exposed in the task for the purpose. As you can see in the image above, the variable PackageInt is specified, which means when I write the code inside that task I don’t have to worry about locking at all, as shown below. public void Main() { // Set the variable value to something new Dts.Variables["PackageInt"].Value = 199; // Raise an event so we can play in the event handler bool fireAgain = true; Dts.Events.FireInformation(0, "Script Task Code", "This is the script task raising an event.", null, 0, ref fireAgain); Dts.TaskResult = (int)ScriptResults.Success; } As you can see as well as accessing the variable, hassle free, I also raise an event. Now consider a scenario where I have an event hander as well as shown below. Now what if my event handler uses tries to use the same variable as well? Well obviously for the point of this post, it fails with the error quoted previously. The reason why is clearly illustrated if you consider the following sequence of events. Package execution starts Script Task in Control Flow starts Script Task in Control Flow locks the PackageInt variable as specified in the ReadWriteVariables property Script Task in Control Flow executes script, and the On Information event is raised The On Information event handler starts Script Task in On Information event handler starts Script Task in On Information event handler attempts to lock the PackageInt variable (for either read or write it doesn’t matter), but will fail because the variable is already locked. The problem is caused by the event handler task trying to use a variable that is already locked by the task in Control Flow. Events are always raised synchronously, therefore the task in Control Flow that is raising the event will not regain control until the event handler has completed, so we really do have un-resolvable locking conflict, better known as a deadlock. In this scenario we can easily resolve the problem by managing the variable locking explicitly in code, so no need to specify anything for the ReadOnlyVariables and ReadWriteVariables properties. public void Main() { // Set the variable value to something new, with explicit lock control Variables lockedVariables = null; Dts.VariableDispenser.LockOneForWrite("PackageInt", ref lockedVariables); lockedVariables["PackageInt"].Value = 199; lockedVariables.Unlock(); // Raise an event so we can play in the event handler bool fireAgain = true; Dts.Events.FireInformation(0, "Script Task Code", "This is the script task raising an event.", null, 0, ref fireAgain); Dts.TaskResult = (int)ScriptResults.Success; } Now the package will execute successfully because the variable lock has already been released by the time the event is raised, so no conflict occurs. For those of you with a SQL Engine background this should all sound strangely familiar, and boils down to getting in and out as fast as you can to reduce the risk of lock contention, be that SQL pages or SSIS variables. Unfortunately we cannot always manage the locking ourselves. The Execute SQL Task is very often used in conjunction with variables, either to pass in parameter values or get results out. Either way the task will manage the locking for you, and will fail when it cannot lock the variables it requires. The scenario outlined above is clear cut deadlock scenario, both parties are waiting on each other, so it is un-resolvable. The mechanism used within SSIS isn’t actually that clever, and whilst the message says it is a deadlock, it really just means it tried a few times, and then gave up. The last part of the error message is actually the most accurate in terms of the failure, A lock cannot be acquired after 16 attempts. The locks timed out.  Now this may come across as a recommendation to always manage locking manually in the Script Task or Script Component yourself, but I think that would be an overreaction. It is more of a reminder to be aware that in high concurrency scenarios, especially when sharing variables across multiple objects, locking is important design consideration. Update – Make sure you don’t try and use explicit locking as well as leaving the variable names in the ReadOnlyVariables and ReadWriteVariables lock lists otherwise you’ll get the deadlock error, you cannot lock a variable twice!

    Read the article

  • Can there be an Environment that Reacts to Weather changes in-game?

    - by The415
    Just to be straightforward, I am completely new to many aspects of coding and am searching for different specs and guidelines to aid me on my journey to crafting a wonderful game in Epic Games' Unreal Engine 4. I had some recent thoughts about the possibility of creating an environment in a game that interacts with weather (Rain, Snow, Storms) Is it possible to make an environment that can simulate weather changes in a game? I wrote notes on this for weeks now. I was thinking that an increase on environments occlusion maps was necessary for creating the effect of rain on windows, as well as making a flowing liquid surface on windows that is only visible in rain. I was also considering the idea of additive bump-maps on meshes for snow, to simulate accumulation. Are these elements dynamic in Unreal 4? Can I implement them?

    Read the article

  • Test to identify your development environment?

    - by lance
    The code has a runtime dependency which is not available in our development environment (and is available in test and prod). It's expensive to actually test for the dependency, and I want to test for the environment instead. if (isDevEnvironment) { // fake it } else { // actually do it } Without using appSettings, what code/technique/test would you use to set isDevEnvironment? Example answers: check machine name (partial or full) check for running instance of Visual Studio check for environment variable I'm hoping for a test I hadn't considered.

    Read the article

  • How should a QA Environment be setup?

    - by onesith
    I am currently at a loss. We are moving from Dev-owned testing environment to a QA-owned one. I have worked in a QA-owned testing environment before. But I have never set one up from scratch. I understand that it should mirror Production as much as possible. But how? How have you setup your QA Environment?

    Read the article

  • How do I change Windows Service environment path

    - by rs
    I need to change thw environment variable Environment.GetEnvironmentVariable("TMP") for a Windows service in .NET 2.0 that is running with its own user account. The server is a Windows Server 2003, SP2. Can anybody tell me how to change the Windows environment variable for that user?

    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

  • Is it OK to use dynamic typing to reduce the amount of variables in scope?

    - by missingno
    Often, when I am initializing something I have to use a temporary variable, for example: file_str = "path/to/file" file_file = open(file) or regexp_parts = ['foo', 'bar'] regexp = new RegExp( regexp_parts.join('|') ) However, I like to reduce the scope my variables to the smallest scope possible so there is less places where they can be (mis-)used. For example, I try to use for(var i ...) in C++ so the loop variable is confined to the loop body. In these initialization cases, if I am using a dynamic language, I am then often tempted to reuse the same variable in order to prevent the initial (and now useless) value from being used latter in the function. file = "path/to/file" file = open(file) regexp = ['...', '...'] regexp = new RegExp( regexp.join('|') ) The idea is that by reducing the number of variables in scope I reduce the chances to misuse them. However this sometimes makes the variable names look a little weird, as in the first example, where "file" refers to a "filename". I think perhaps this would be a non issue if I could use non-nested scopes begin scope1 filename = ... begin scope2 file = open(filename) end scope1 //use file here //can't use filename on accident end scope2 but I can't think of any programming language that supports this. What rules of thumb should I use in this situation? When is it best to reuse the variable? When is it best to create an extra variable? What other ways do we solve this scope problem?

    Read the article

  • What is a user-friendly solution to editing email templates with replacement variables?

    - by Daniel Magliola
    I'm working on a system where we rely a lot of "admins / managers" emailing users from the database. One of the key features is being able to email several people at the same time, with specific information relevant to each of them. Another key feature is to be able to hand-craft emails, because it tends to be be necessary to slightly modify them each time, but having a basic template saves a lot of time. For this, we have the typical "templates" solution, where we have a template that looks kind of like this: Hello {{recipient.full_name}}, Your application to {{activity.title}} has been accepted. You have requested to participate on dates {{application.dates}}, in role {{application.role}} Blah blah blah The problem we are having is obviously that (as we expected), managers don't get the whole "variables" idea, and they do things like overwriting them, which doesn't let them email more than one person at a time, assuming those are not going to get replaced and that the system is broken, or even inexplicable things like "Hello {{John}}". The big problem is that this isn't relegated, as usual, to an "admin" section where only a few power users have access to editing the templates that are automatically send out, and they're expected to know what they are doing. Every user of the system gets exposed to this problem. The obvious solution would be to replace the variables before showing this template for the user to edit, but that doesn't work when emailing several people. This seems like a reasonably common problem, and we are kind of hoping that someone has already solved it. Have you seen anywhere/created/can think of good solutions to this problem?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >