Search Results

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

Page 94/632 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • Unable to set variables in bash script in Mac OSX

    - by cohortq
    Hello! I am attempting to automate moving files from a folder to a new folder automatically every night using a bash script run from applescript on a schedule. I am attempting to write a bash script on Mac OSX, and it keeps failing. In short this is what I have (all my ECHOs are for error checking): !/bin/bash folder = "ABC" useracct = 'test' day = date "+%d" month = date "+%B" year = date "+%Y" folderToBeMoved = "/users/$useracct/Documents/Archive/Primetime.eyetv" newfoldername = "/Volumes/Media/Network/$folder/$month$day$year" ECHO "Network is $network" $network ECHO "day is $day" ECHO "Month is $month" ECHO "YEAR is $year" ECHO "source is $folderToBeMoved" ECHO "dest is $newfoldername" mkdir $newfoldername cp -R $folderToBeMoved $newfoldername if [-f $newfoldername/Primetime.eyetv]; then rm $folderToBeMoved; fi Now my first problem is that I cannot set variables at all. Even literal ones where I just make it equal some literal. All my echos come out blank. I cannot grab the day, month, or year either,it comes out blank as well. I get an error saying that -f is not found. I get an error saying there is an unexpected end of file. I made the file and did a chmod u+x scriptname.sh I'm not sure why nothing is working at all. I am very new to this bash script on OSX, and only have experience with windows vbscript. Any help would be great, thanks!

    Read the article

  • Fork or copy a users browser session in IE

    - by jmoeller
    Is it possible to fork a users session (or do something similar) in a Internet Explorer plugin? I want to process the page the user is on when they click a button in the toolbar. To avoid interrupting the users browsing, I'd like to "copy" everything so I can parse and process the page in the background. The processing can involve things such as loading the content of the result links on a Google search, if that's where the button was clicked. So - what I basically want is to imitate "Ctrl+N" but hide the window from the user, so they won't be interrupted. As you can see, if you fill out and submit the form on http://www.snee.com/xml/crud/posttest.html and press "Ctrl+N", everything posted will still appear in the new window, but it won't post the data twice. I was thinking of somehow copying the IWebBrowser2, but: I'm not sure if that's possible (I haven't been able to find any information on MSDN) I don't know if it copies the sessions as well. Creating a new instance of the IWebBrowser2 and simply navigating to the current URL isn't a valid solution as POST-variables of course doesn't get carried over.

    Read the article

  • Using htaccess rewrite/redirect so single PHP file can display data according to GET/POST variables

    - by revive
    Hey gang, Bear with me as I try to learn more about .htaccess redirect rules - I'm a UI guy by profession and I'm doing my best to enhance my coding skills languages other than HTML/CSS/PHP, etc So, what I have is an index.php file that contains a menu - pretty simple. If Javascript is enabled on the users computer then forms are shown below the menu using simple jQuery goodies, with each link having a 'return false;' applied. What I am trying to do is make the page accessible with JS turned off, so instead of redirecting the user to a different page, I would like to use POST or GET variables from each link, to show the various forms.. within the same index.php file - but have the URL reflect the menu choice Here is an example using menu items named - Home, About, Form1 and Form2: With JS on, clicking on of the above example buttons simply slides the form or containing the data down onto the page. With JS off, if the user clicks the 'About' link, I would like to rewrite the URL to be http://domain.com/about - but keep the user on the index.php page (since it is the only page) and be able to use POST or GET variable to show the using PHP. So, accessing http://domain.com/index.php?page=about would show http://domain.com/about in the URL but pass the GET variable 'page' to the index.php file. Hope that makes sense.. and I'm sure there are many ways to accomplish this, so if you have ideas of how to improve on it, by all means, I'd love to hear it ! Thanks again Revive

    Read the article

  • Interpolating environment variables into a string in Ruby using String#scan

    - by robc
    I'm trying to interpolate environment variables into a string in Ruby and not having much luck. One of my requirements is to do something (log an error, prompt for input, whatever) if a placeholder is found in the initial string that has no matching environment variable. It looks like the block form of String#scan is what I need. Below is an irb session of my failed attempt. irb(main):014:0> raw_string = "need to replace %%FOO%% and %%BAR%% in here" => "need to replace %%FOO%% and %%BAR%% in here" irb(main):015:0> cooked_string << raw_string => "need to replace %%FOO%% and %%BAR%% in here" irb(main):016:0> raw_string.scan(/%%(.*?)%%/) do |var| irb(main):017:1* cooked_string.sub!("%%#{var}%%", ENV[var]) irb(main):018:1> done irb(main):019:1> end TypeError: cannot convert Array into String from (irb):17:in `[]' from (irb):17 from (irb):16:in `scan' from (irb):16 from :0 If I use ENV["FOO"] to manually interpolate one of those, it works fine. I'm banging my head against the desk. What am I doing wrong? Ruby is 1.8.1 on RHEL or 1.8.7 on Cygwin.

    Read the article

  • Static variables and long running thread on IIS 7.5

    - by Dmitry
    Hello people. Help me solve next problem. I have ASP .NET MVC2 application. I run it on IIS 7.5. In one page user clicks button and handler for this button sends request to server (jquery.ajax). At server action in controller starts new thread (it makes long time import): var thread = new Thread(RefreshCitiesInDatabase); thread.Start(); State of import is available in static variable. New thread changes value of variable in the begin of work. User can check state of import too with the help of this variable, which is used in view. And user sees import's state. When I start this function few minutes everything is okey. On page I see right state of import, quantity of imported records is changed, I see changes in logs. But after few minutes begin troubles. When I refresh page with import state sometimes I see that import is okey but sometimes I see page with default values about import (like application is just started), but after that again I can see page with normal import's state. I tried to attach Visual Studio to IIS process and debug application. But when request comes to controller sometimes static variables have right values and sometimes they have default values (static int has 0, static string has "" etc.). Tell me what I do wrong. May be I must start additional thread in other way? Thanks in advance, Dmitry

    Read the article

  • global variables in php not working as expected

    - by Josh Smeaton
    I'm having trouble with global variables in php. I have a $screen var set in one file, which requires another file that calls an initSession() defined in yet another file. The initSession() declares "global $screen" and then processes $screen further down using the value set in the very first script. How is this possible? To make things more confusing, if you try to set $screen again then call the initSession(), it uses the value first used once again. The following code will describe the process. Could someone have a go at explaining this? $screen = "list1.inc"; // From model.php require "controller.php"; // From model.php initSession(); // From controller.php global $screen; // From Include.Session.inc echo $screen; // prints "list1.inc" // From anywhere $screen = "delete1.inc"; // From model2.php require "controller2.php" initSession(); global $screen; echo $screen; // prints "list1.inc" Update: If I declare $screen global again just before requiring the second model, $screen is updated properly for the initSession() method. Strange.

    Read the article

  • 301 Redirecting URLs based on GET variables in .htaccess

    - by technicalbloke
    I have a few messy old URLs like... http://www.example.com/bunch.of/unneeded/crap?opendocument&part=1 http://www.example.com/bunch.of/unneeded/crap?opendocument&part=2 ...that I want to redirect to the newer, cleaner form... http://www.example.com/page.php/welcome http://www.example.com/page.php/prices I understand I can redirect one page to another with a simple redirect i.e. Redirect 301 /bunch.of/unneeded/crap http://www.example.com/page.php But the source page doesn't change, only it's GET vars. I can't figure out how to base the redirect on the value of these GET variables. Can anybody help pls!? I'm fairly handy with the old regexes so I can have a pop at using mod-rewrite if I have to but I'm not clear on the syntax for rewriting GET vars and I'd prefer to avoid the performance hit and use the cleaner Redirect directive. Is there a way? and if not can anyone clue me in as to the right mod-rewrite syntax pls? Cheers, Roger.

    Read the article

  • Merging datasets with 2 different time variables in SAS

    - by John
    Hye Guys, for those regularly browsing this site sorry for already another question (however I did solve my last question myself!) I have another problem with merging datasets, it seems that accounting for time in datasets is a real pain in the ass. I succesfully managed to merge on months in my previous datasets, however it seems I have a final dataset which only has quarter as a time count variable. So where all my normal databases have month 1- xxx as an indicator of time, this database had quarter as an indicator of time. I still want to add the variables of this last database, let's call it TVOL, into my WORK database. Quick summary QUARTER: Quarter 0 = JAN1996-MAR1996 Month: Month 0 = JAN1996 Example: TVOL TVOL _ Ticker ____ Quarter 1500 _ AA ________ -1 52546 _ BB ________ 15 Example: WORK BETA _ Ticker ____ Month 1.52 _ AA ________ 2 1.54__ BB _______ 3 Example: Merged: BETA ______ TVOL __ Ticker ____ Month 1.52 _______ 500 ___ AA _______ 2 I now want to merge this 2 tables using following relationship if the month is in quarter 1, the data of quarter 0 has to be used, so if i have an observation i nWORK with date 2FEB1996 the TVOL of quarter -1 has to be put behind this observation. Something like IF month = quarter i use data quarter i-1. Also, as TVOL is measured quarterly and I have to put in monthly I have to take the average, so (TVOL/3) should be added as a variable. Thanks!

    Read the article

  • Using variables inside macros in SQL

    - by Tim
    Hello I'm wanting to use variables inside my macro SQL on Teradata. I thought I could do something like the following: REPLACE MACRO DbName.MyMacro ( MacroNm VARCHAR(50) ) AS ( /* Variable to store last time the macro was run */ DECLARE V_LAST_RUN_DATE TIMESTAMP; /* Get last run date and store in V_LAST_RUN_DATE */ SELECT LastDate INTO V_LAST_RUN_DATE FROM DbName.RunLog WHERE MacroNm = :MacroNm; /* Update the last run date to now and save the old date in history */ EXECUTE MACRO DbName.RunLogUpdater( :MacroNm ,V_LAST_RUN_DATE ,CURRENT_TIMESTAMP ); ); However, that didn't work, so I thought of this instead: REPLACE MACRO DbName.MyMacro ( MacroNm VARCHAR(50) ) AS ( /* Variable to store last time the macro was run */ CREATE VOLATILE TABLE MacroVars AS ( SELECT LastDate AS V_LAST_RUN_DATE FROM DbName.RunLog WHERE MacroNm = :MacroNm; ) WITH DATA ON COMMIT PRESERVE ROWS; /* Update the last run date to now and save the old date in history */ EXECUTE MACRO DbName.RunLogUpdater( :MacroNm ,SELECT V_LAST_RUN_DATE FROM MacroVars ,CURRENT_TIMESTAMP ); ); I can do what I'm looking for with a Stored Procedure, however I want to avoid for performance. Do you have any ideas about this? Is there anything else I can try? Cheers Tim

    Read the article

  • How to bind "rest" variables to list of values in macro in Scheme

    - by Slartibartfast
    I want to make a helper macro for writing match-extensions. I have something like this: (define-match-expander my-expander (? (stx) (let* ([dat (cdr (syntax-e stx))] [var1 (car dat))] [var2 (cadr dat)]) ;transformer goes here ))) So I wanted a macro that will do this let binding. I've started with something like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (match-let ([(vars ...) (cdr (syntax-e stx))]) body)))) but match-let isn't defined in transformation time. First question would be is there any other way of doing this (making this expanders, I mean)? Maybe there is already something similar in plt-scheme that I'm not aware of, or I'm doing it wrong in some way. Regardless of answer on the first question, if I ever want to bound list of variables to list of values inside of a macro, how should I do it? EDIT: In combination with Eli's answer macro now looks like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (syntax-case stx () [(_ vars ...) body]))))

    Read the article

  • NSURLConnection and empty post variables

    - by SooDesuNe
    I'm at my wits end with this one, because I've used very similar code in the past, and it worked just fine. The following code results in empty $_POST variables on the server. I verified this with: file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); the only contents of log_file_name was "log: " I then verified the PHP with a simple HTML form. It performed as expected. The Objective-C: NSString *word = "this_word_gets_lost"; NSString *myRequestString = [NSString stringWithFormat:@"word=%@", word]; [self postAsynchronousPHPRequest:myRequestString toPage:@"http://www.mysite.com/mypage.php" delegate:nil]; } -(void) postAsynchronousPHPRequest:(NSString*)request toPage:(NSString*)URL delegate:(id)delegate{ NSData *requestData = [ NSData dataWithBytes: [ request UTF8String ] length: [ request length ] ]; NSMutableURLRequest *URLrequest = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ]; [ URLrequest setHTTPMethod: @"POST" ]; [ URLrequest setHTTPBody: requestData ]; [ NSURLConnection connectionWithRequest:URLrequest delegate:delegate]; [URLrequest release]; } The PHP: $word = $_POST['word']; file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); What am I doing wrong in the Objective-C that would cause the $_POST variable to be empty on the server?

    Read the article

  • Changing variables outside of Scope C#

    - by sam
    Hi, I'm a beginner C# programmer, and to improve my skills I decided to give Project Euler a try. The first problem on the site asks you to find the sum of all the multiples of 3 and 5 under 1000. Since I'm essentially doing the same thing twice, I made a method to multiply a base number incrementally, and add the sum of all the answers togethor. public static int SumOfMultiplication(int Base, int limit) { bool Escape = false; for (int mult = 1; Escape == true; mult++) { int Number = 0; int iSum = 0; Number = Base * mult; if (Number > limit) return iSum; else iSum = iSum + Number; } regardless of what I put in for both parameters, it ALWAYS returns zero. I'm 99% sure it has something to do with the scope of the variables, but I have no clue how to fix it. All help is appreciated. Thanks in advance, Sam

    Read the article

  • BackgroundWorker and instance variables

    - by Alastair Pitts
    One thing that's always confused me is how a BackgroundWorker seems to have thread-safe access to the instance variables of the surrounding class. Given a basic class: public class BackgroundProcessor { public List<int> Items { get; private set; } public BackgroundProcessor(IEnumerable<int> items) { Items = new List<int>(items); } public void DoWork() { BackgroundWorker worker = new BackgroundWorker(); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerAsync(); } void worker_DoWork(object sender, DoWorkEventArgs e) { var processor = new ProcessingClass(); processor.Process(this.Points); //Accessing the instance variable } void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //Stuff goes here } } Am I erroneous in my assumption the the call to processor.Process(this.Points); is a thread-safe call? How don't I get a cross-thread access violation? I'm sure it's obvious, but it always has confused me.

    Read the article

  • POST variables to web server?

    - by OverTheRainbow
    Hello I've been trying several things from Google to POST data to a web server, but none of them work: I'm still stuck at how to convert the variables into the request, considering that the second variable is an SQL query so it has spaces. Does someone know the correct way to use a WebClient to POST data? I'd rather use WebClient because it requires less code than HttpWebRequest/HttpWebResponse. Here's what I tried so far: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim wc = New WebClient() 'convert data wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim postData = String.Format("db={0}&query={1}", _ HttpUtility.UrlEncode("books.sqlite"), _ HttpUtility.UrlEncode("SELECT id,title FROM boooks")) 'Dim bytArguments As Byte() = Encoding.ASCII.GetBytes("db=books.sqlite|query=SELECT * FROM books") 'POST query Dim bytRetData As Byte() = wc.UploadData("http://localhost:9999/get", "POST", postData) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub Dim client = New WebClient() Dim nv As New Collection nv.Add("db", "books.sqlite") nv.Add("query", "SELECT id,title FROM books") Dim address As New Uri("http://localhost:9999/get") 'Dim bytRetData As Byte() = client.UploadValues(address, "POST", nv) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub 'Dim wc As New WebClient() 'convert data wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim bytArguments As Byte() = Encoding.ASCII.GetBytes("db=books.sqlite|query=SELECT * FROM books") 'POST query 'Dim bytRetData As Byte() = wc.UploadData("http://localhost:9999/get", "POST", bytArguments) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub End Sub Thank you.

    Read the article

  • Using unset member variables within a class or struct

    - by Doug Kavendek
    It's pretty nice to catch some really obvious errors when using unset local variables or when accessing a class or struct's members directly prior to initializing them. In visual studio 2008 you get an "uninitialized local variable used" warning at compile-time and get a run-time check failure at the point of access when debugging. However, if you access an uninitialized struct's member variable through one of its functions, you don't get any warnings or assertions. Obviously the easiest solution is don't do that, but nobody's perfect. For example: struct Test { float GetMember() const { return member; } float member; }; Test test; float f1 = test.member; // Raises warning, asserts in VS debugger at runtime float f2 = test.GetMember(); // No problem, just keeps on going This surprised me, but it makes some sense -- the compiler can't assume calling a function on an unused struct is an error, or how else would you initialize or construct it? And anything fancier just quickly brings up so many other complications that it makes sense that it wouldn't bother classifying which functions are ok to call and when, especially just as a debugging help. I know I can set up my own assertions or error checking within the class itself, but that can complicate some simpler structs. Still, it would seem like within the context of the function call, wouldn't it know insides GetMember() that member wasn't initialized yet? I'm assuming it's not only relying on static compile-time deduction, given the Run-Time Check Failure #3 it raises during execution, so based on my current understanding of it it would seem reasonable for the same checks to apply. Is this just a limitation of this specific compiler/debugger (Visual Studio 2008), or more tied to how C++ works?

    Read the article

  • Ruby on rails form variables as array items

    - by Francois
    I have a simple form with text input and text area, but when I submit it the variables seems to be array items instead of just string values? the form <%= form_tag(home_kontak_path, :remote => true) do %> <label>Jou epos adres</label> <%= text_field(:epos, "", :placeholder => "Jou epos adres", :id => "epos", :class => "input-block-level") %> <label>Boodskap hier</label> <%= text_area(:boodskap, "", :rows => "5", :placeholder => "Boodskap hier...", :id => "boodskap", :class => "input-block-level") %> <%= submit_tag "submit" %> <% end %> console output Started POST "/home/kontak" for 127.0.0.1 at 2012-11-23 11:53:03 +0200 Processing by HomeController#kontak as JS Parameters: {"utf8"=>"?", "authenticity_token"=>"i+5UWaQeBu7LYGPFBNAbum+67VzyyC82JN2wMlLc/UU=", "epos"=>["text box value"], "boodskap"=>["text area value"], "commit"=>""} what i would like it to be instead of "epos"=["text box value"] i want it to return "epos"="text box value"

    Read the article

  • How to prevent PHP variables from being arrays?

    - by MJB
    I think that (the title) is the problem I am having. I set up a MySQL connection, I read an XML file, and then I insert those values into a table by looping through the elements. The problem is, instead of inserting only 1 record, sometimes I insert 2 or 3 or 4. It seems to depend on the previous values I have read. I think I am reinitializing the variables, but I guess I am missing something -- hopefully something simple. Here is my code. I originally had about 20 columns, but I shortened the included version to make it easier to read. $ctr = 0; $sql = "insert into csd (id,type,nickname,hostname,username,password) ". "values (?,?,?,?,?,?)"; $cur = $db->prepare($sql); for ($ctr = 0; $ctr < $expected_count; $ctr++) { list ( $lbl, $type, $nickname, $hostname, $username, $password) = ""; $bind_vars = array(); $lbl = "csd_{$ctr}"; $type = $ref->itm->csds->$lbl->type; $nickname = $ref->itm->csds->$lbl->nickname; $hostname = $ref->itm->csds->$lbl->hostname; $username = $ref->itm->csds->$lbl->username; $password = $ref->itm->csds->$lbl->password; $bind_vars = array($id,$type,$nickname,$hostname,$username,$password); $res = $db->execute($cur, $bind_vars); # this is a separate function which works, but which only # does SELECTS and cannot be the problem. I include it because I # want to count the total rows. printf ("%d CSDs on that ITEM now.\n", CountCSDs($id_to_sync)); } P.S. I also tagged this SimpleXML because that is how I am reading the file, though that code is not included above. It looks like this: $Ref = simplexml_load_file($file);

    Read the article

  • P0ST variables to web server?

    - by OverTheRainbow
    Hello I've been trying several things from Google to POST data to a web server, but none of them work: I'm still stuck at how to convert the variables into the request, considering that the second variable is an SQL query so it has spaces. Does someone know the correct way to use a WebClient to POST data? I'd rather use WebClient because it requires less code than HttpWebRequest/HttpWebResponse. Here's what I tried so far: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim wc = New WebClient() 'convert data wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim postData = String.Format("db={0}&query={1}", _ HttpUtility.UrlEncode("books.sqlite"), _ HttpUtility.UrlEncode("SELECT id,title FROM boooks")) 'Dim bytArguments As Byte() = Encoding.ASCII.GetBytes("db=books.sqlite|query=SELECT * FROM books") 'POST query Dim bytRetData As Byte() = wc.UploadData("http://localhost:9999/get", "POST", postData) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub Dim client = New WebClient() Dim nv As New Collection nv.Add("db", "books.sqlite") nv.Add("query", "SELECT id,title FROM books") Dim address As New Uri("http://localhost:9999/get") 'Dim bytRetData As Byte() = client.UploadValues(address, "POST", nv) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub 'Dim wc As New WebClient() 'convert data wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim bytArguments As Byte() = Encoding.ASCII.GetBytes("db=books.sqlite|query=SELECT * FROM books") 'POST query 'Dim bytRetData As Byte() = wc.UploadData("http://localhost:9999/get", "POST", bytArguments) RichTextBox1.Text = Encoding.ASCII.GetString(bytRetData) Exit Sub End Sub Thank you.

    Read the article

  • Rename files and directories using substitution and variables

    - by rednectar
    I have found several similar questions that have solutions, except they don't involve variables. I have a particular pattern in a tree of files and directories - the pattern is the word TEMPLATE. I want a script file to rename all of the files and directories by replacing the word TEMPLATE with some other name that is contained in the variable ${newName} If I knew that the value of ${newName} was say "Fred lives here", then the command find . -name '*TEMPLATE*' -exec bash -c 'mv "$0" "${0/TEMPLATE/Fred lives here}"' {} \; will do the job However, if my script is: newName="Fred lives here" find . -name '*TEMPLATE*' -exec bash -c 'mv "$0" "${0/TEMPLATE/${newName}}"' {} \; then the word TEMPLATE is replaced by null rather than "Fred lives here" I need the "" around $0 because there are spaces in the path name, so I can't do something like: find . -name '*TEMPLATE*' -exec bash -c 'mv "$0" "${0/TEMPLATE/"${newName}"}"' {} \; Can anyone help me get this script to work so that all files and directories that contain the word TEMPLATE have TEMPLATE replaced by whatever the value of ${newName} is eg, if newName="A different name" and a I had directory of /foo/bar/some TEMPLATE directory/with files then the directory would be renamed to /foo/bar/some A different name directory/with files and a file called some TEMPLATE file would be renamed to some A different name file

    Read the article

  • gcc does not resolve extern global variables, with or without -c option

    - by Moons
    Hello everyone! So i have this issue : i am declaring some extern global variables in my C program. If I don't use the -c option for gcc, i get undefined references errors. But with that -c option, the linking is not done, which means that i don't have an executable generated. So how do I solve this? Here is my makefile. As I am not good with writing makefiles, I took one from another project then I changed a few things. So maybe I'm missing something here. # Makefile calculPi INCL = -I$(INCL_DIR) DEFS = -D_DEBUG_ CXX_FLAGS =-g -c -lpthread -lm CXX = gcc $(CXX_FLAGS) $(INCL) $(DEFS) LINK_CXX = gcc OBJ = approx.o producteur.o sequentialApproximation.o main.o LINKOBJ = approx.o producteur.o sequentialApproximation.o main.o BIN = calculPi.exe RM = rm -fv all: calculPi.exe clean: ${RM} *\~ \#*\# $(OBJ) clean_all: clean ${RM} $(BIN) cleanall: clean ${RM} $(BIN) $(BIN): $(OBJ) $(CXX) $(LINKOBJ) -o "calculPi.exe" main.o: main.c $(CXX) main.c -o main.o $(CXX_FLAGS) approx.o: approx.c approx.h $(CXX) -c approx.c -o approx.o $(CXX_FLAGS); producteur.o: producteur.c producteur.h $(CXX) -c producteur.c -o producteur.o $(CXX_FLAGS); sequentialApproximation.o : sequentialApproximation.c sequentialApproximation.h $(CXX) -c sequentialApproximation.c -o sequentialApproximation.o $(CXX_FLAGS);

    Read the article

  • Referencing not-yet-defined variables - Java

    - by user2537337
    Because I'm tired of solving math problems, I decided to try something more engaging with my very rusty (and even without the rust, very basic) Java skills. I landed on a super-simple people simulator, and thus far have been having a grand time working through the various steps of getting it to function. Currently, it generates an array of people-class objects and runs a for loop to cycle through a set of actions that alter the relationships between them, which I have stored in a 2d integer array. When it ends, I go look at how much they all hate each other. Fun stuff. Trouble has arisen, however, because I would like the program to clearly print what action is happening when it happens. I thought the best way to do this would be to add a string, description, to my "action" class (which stores variables for the actor, reactor, and the amount the relationship changes). This works to a degree, in that I can print a generic message ("A fight has occurred!") with no problem. However, ideally I would like it to be a little more specific ("Person A has thrown a rock at Person B's head!"). This latter goal is proving more difficult: attempting to construct an action with a description string that references actor and reactor gets me a big old error, "Cannot reference field before it is defined." Which makes perfect sense. I believe I'm not quite in programmer mode, because the only other way I can think to do this is an unwieldy switch statement that negates the need for each action to have its own nicely-packaged description. And there must be a neater way. I am not looking for examples of code, only a push in the direction of the right concept to handle this.

    Read the article

  • mysql query using global variables

    - by Carlos
    I am trying run a query to active the users account. I am not sure if I am having problem with the query itself or if there's something else that I dont know about. here is the code: if($_SESSION['lastid']&&$_SESSION['random']) { $check= mysql_query('SELECT * FROM members WHERE id= "$_SESSION[lastid]" AND random = " $_SESSION[random]"'); $checknum = mysql_num_rows($check); //$checknum = mysql_query($check) or die("Error: ". mysql_error(). " with query ". $check); if($checknum != 0) // run query to activate the account { $acti= mysql_query('UPDATE members SET activation = "1" WHERE id= "$_SESSION[lastid]"'); die('Your account has been activated. You may now log in!'); }else{ echo('Invalid id or activation code.') . ' lastid: ' .$_SESSION['lastid'] . ' random: ' .$_SESSION['random'] ; // die ('Invalid id or activation code.'); } }else{ die('Could not either find id or random number!'); } this is the warning I am getting from mysql: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /hermes/bosweb26b/b2501/servername/folder/file.php on line 30 but when I echo the variables out, I get the same values that are stored in the database.... Invalid id or activation code. lastid: 2 and random: 36308075 could someone please give me a hint? thank you.

    Read the article

  • correct way of initializing variables

    - by OVERTONE
    ok this is just a shot in the dark but it may be the cause of most of the errors ive gotten. when your initializing something. lets say a smal swing program. would it go liek this variables here { private Jlist contactList; String [] contactArray; ArrayList <String> contactArrayList; ResultSet namesList constructor here public whatever() { GridLayout aGrid = new GridLayout(2,2,10,10); contact1 = new String(); contact2 = new String(); contact3 = new String(); contactArrayList = new ArrayList<String>(); // is something supposed too go in the () of this JList? contactList = new JList(); contactArray = new String[5]; from1 =new JLabel ("From: " + contactArray[1]); gridlayout.add(components)// theres too many components to write onto SO. } // methods here public void fillContactsGui() { createConnection(); ArrayList<String> contactsArrayList = new ArrayList<String>(); while (namesList.next()) { contactArrayList.add(namesList.getString(1)); ContactArray[1] = namesList[1]; } } i know this is probably a huge beginner question but this is the code ive gotten used too. im initializing thigns three and fours times without meaning too because im not sure where they gp. can anyone shed some light on this? p.s. sorry for the messy sample code. i done my best.

    Read the article

  • Vim: change formatting of variables in a script

    - by sixtyfootersdude
    I am using vim to edit a shell script (did not use the right coding standard). I need to change all of my variables from camel-hum-notation startTime to caps-and-underscore-notation START_TIME. I do not want to change the way method names are represented. I was thinking one way to do this would be to write a function and map it to a key. The function could do something like generating this on the command line: s/<word under cursor>/<leave cursor here to type what to replace with> I think that this function could be applyable to other situations which would be handy. Two questions: Question 1: How would I go about creating that function. I have created functions in vim before the biggest thing I am clueless about is how to capture movement. Ie if you press dw in vim it will delete the rest of a word. How do you capture that? Also can you leave an uncompleted command on the vim command line? Question 2: Got a better solution for me? How would you approach this task?

    Read the article

  • Multithreading using pthread in C++ with shared variables

    - by Saviour Self
    I'm new to threading (and C/C++ for that matter), and I'm attempting to use multiple threads to access shared variables. In the main, I've created a variable char inputarray[100]; Thread 1: This thread will be reading data from stdin in 2 byte bursts, and appending them to the inputarray. (input by feeding a file in) Thread 2: This thread will be reading data 1 byte at a time, performing a calculation, and putting its data into an output array. Thread 3: This thread will be outputting data from the output array in 2 byte bursts. (stdout) I've attempted the input part and got it working by passing a struct, but would like to do it without using a struct, but it has been giving me problems. If I can get input down, I'm sure I'll be able to use a similar strategy to complete output. Any help would be greatly appreciated. Below is a rough template for the input thread. #include <stdio.h> #include <pthread.h> using namespace std; void* input(void* arg) { char reading[3]; fread(reading,1,2,stdin); //append to char inputarray[]..??? } int main() { char inputarray[100]; pthread_t t1; pthread_create(&t1, NULL, &input, &inputarray); void *result; pthread_join(t1,&result); return 0; }

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >