I have a C++ program with a main routine which reads arguments from command line: int main(int argc, const char *argv[]) In my system I have defined some aliases in my bash environment which abbreviates directory names. Example: alias dst='home/username/Documents/test' alias src='home/username/Download/test' My program is called "dircopy" and I want to use the following input: `dircopy /home/username/Download/test /home/username/Documents/test` But I want to avoid writing the whole path for destination directory and source directory each time I run the program. Is there a clever way to use the alias definitions in bash when calling my "dircopy"-program ? (Example: dircopy $src $dst …

Member Avatar
Member Avatar
+0 forum 5

what is command line argument in java and how it is work public static void main(String []args){ for (int i = 0; i < args.length; i++) System.out.println(args[i]); and what is .length in upper code. is it function no it is not function is it class no it is not a class then what is .length plz help me

Member Avatar
Member Avatar
+0 forum 8

I am working on s code that i want to add command line arguments to. I have read the docs.python page on this subject 3 or 4 times and it still has me conffused. I want to be able to set my base directory, change a send and recive email adress if needed , change the list that a file gets posted to, and change the password to the email adresses login. I have a base that im startign from but dont know if its even right if someone could help me figure up how to do all of these …

Member Avatar
Member Avatar
+0 forum 7

Why is it that, the only way this will work is if I pass the entire: add(document.getElementById('num1').value) to the function, as opposed to simply adding: add(num1) <script> function add(num1){ total=num1*1+3; alert(total); } </script> </head> <body> <input type="text" id="num1" size="4"> <input type="button" onClick="add(document.getElementById('num1').value)"; </body> </html>

Member Avatar
Member Avatar
+0 forum 4

I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH. Edit: Fixed per Watael's suggestions.

Member Avatar
Member Avatar
+0 forum 1

I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.

Member Avatar
Member Avatar
+0 forum 3

Hi All, We can use Command name and argument for web controls such as imagbutton or button etc.. But Can we use Command name and argument for html tags such as(span,a)? It's urgent. Please put some light on it.. Thanks

Member Avatar
Member Avatar
+0 forum 4

I want to create a method that is meant to protect against entering a wrong value for gender. The method **fineGender** below, will return true if the correct gender is entered and false otherwise. // postcondition: fineGender returns true if argument g equals M, m, F or f // and returns false otherwise. public static boolean fineGender(char g)

Member Avatar
Member Avatar
+0 forum 6

in this program i'm writing the functions that have qt classes as parameters Qlabel, QSpinbox, etc. are causing compile errors, my other functions work fine i get the same 2 errors for each QT object i use as an argument this is the function definition that uses QT classes as 3 of the parameters the first isnt [CODE] void fraction::displayfraction(fraction toDis, QLabel nWhole, QLabel nNum, QLabel nDen) { nWhole.setText(QString::number(toDis.Whle())); nNum.setText(QString::number(toDis.Num())); nDen.setText(QString::number(toDis.Den())); }[/CODE] this is a test function call that causes the error [CODE]MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); fraction myfraction(7,4,5); QLabel d; QLabel n; QLabel w; /*error function*/myfraction.displayfraction(myfraction,w,n,d); …

Member Avatar
Member Avatar
+0 forum 3

Hello everyone, I'm attempting to make a email contact form for my website but I keep getting an error that reads "Warning: Invalid argument supplied for foreach() in /nfs/[......]/contact_fa.php on line 15." That points to this line right here: foreach($_POST['check[]'] as $value) { $check_boxes .= $value." "; } This is supposed to post the proper value from this checkbox input in the form: <input name="check[]" type="checkbox" id="tos" value="Agreed." /> I'm trying to have the value "Agreed" entered into the email via the line: $body_message .= 'Agree to TOS: '.$check_boxes; Can anyone help me understand why I'm getting this error? Many …

Member Avatar
Member Avatar
+0 forum 11

(I'm a Computer Science 101 student writing programs in C on a virtual Linux machine.) Suppose I wanted to apply a single (arbitrary) function to every element of an array, one at a time. Doing this once is easy enough, but I'd like to find a method that could accomplish the task in a variety of scenarios. In other words, I'm trying to make a function that would do this: /* With "array[y][x]" already defined and containing values */ int i, j; for (j = 0; j < y; j++) { for (i = 0; i < x; j++) { …

Member Avatar
Member Avatar
+0 forum 1

hi all, In the book "Programming Languages-Pragmatics" second edition by Michael l. Scott and Morgan Kaufmann, there is a sentence while explaining about copy constructor: "In recognition of this intent, a single-argument constructor in C++ is called a copy constructor." This is about the constructor of the form foo::foo(const foo& object); I could understand about that constructor but couldn't understand the statement I have quoted above...I think we cannot state that every single-argument constructor is a copy constructor....If I'm wrong or I seems to be misunderstood the sentence...please help me.... Copy constructor: foo::foo(const foo& object); Normal single argument constructor: foo:foo(int …

Member Avatar
Member Avatar
+0 forum 4

I'm trying to call a function from an if statement that is inside a for loop. I need to send the $i in "for i in *" to a function but i can find nothing that works. ex. [code] # Perform actual file grab for i in /Users/* ; do if [[ -d $i && $(excludedDir $i) ]]; then echo $i; fi ; done [/code] Can anyone hep?

Member Avatar
Member Avatar
+0 forum 1

am geting this error while testing the login panel of my website that am currently developing. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/smartie1/public_html/checklog.php on line 43 which is in red this is the php script used for login <?php session_start(); function session_defaults() { $_SESSION['logged'] = false; $_SESSION['uid'] = 0; $_SESSION['username'] = ''; $_SESSION['cookie'] = 0; $_SESSION['remember'] = false; } if (!isset($_SESSION['uid']) ) { session_defaults(); } $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="XXXXXX[CODE][/CODE]"; // Database name $tbl_name="Customer_Infor"; // Table name // Connect to server and select databse. $con = …

Member Avatar
Member Avatar
+0 forum 4

Ok so this time before I wrote this program I did more reading and practicing and reading examples of code with method statements and class examples. When I finished this program Im still getting a lot of errors...any help? [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Problem10Pg179 { class studentID { static void Main() { string studentID; int examScores, examAverage; DisplayInstructions(); Console.WriteLine("\nData Entry"); studentID = GetStudentID(); examScores = GetExamScores(); examAverage = examScores / 3; Console.WriteLine("\nPress any key to continue"); Console.ReadKey(); DisplayResults(studentID, examScores, examAverage); Console.ReadKey(); } public static void DisplayInstructions() { Console.Clear(); Console.WriteLine("Student ID and Exam Score Average"); Console.WriteLine("This …

Member Avatar
Member Avatar
+0 forum 8

Ok so while working on this I want to figure out at about line 23 for "hours" I understand the argument "NUMBER_OF_SECONDS_IN_AN_HOUR" but not "totalSeconds" is totalseconds the value coming from : "totalSeconds= GetNumberOfSeconds();" ? Which is the input received by the user? For lines 25-29 , how does totalSeconds play into each method , and is leftOverSeconds basically after the calculations from the previous method the left over value's ? Lines 55-59, the division operation thats happening is returning the data (which are in seconds) and then dividing by 60 as I have commented correct? Lines 61-64 , it …

Member Avatar
Member Avatar
+0 forum 5

Alright So I want to know when looking at the code below: every so often with each method argument there is an "identifier" starting with the first one: "Inside() , Show(), Outside(), Display() " I know the names can be made up literally but what do the parenthesis signify ? Second question: [CODE]Recto.Display();[/CODE] what exactly is recto more importantly "recto.display(); " mean surprisingly the web has no definition , i only see it shown up in examples on the web no mention of it whatsoever My Last Question is "return 0" is basically the void type but instead returns integer …

Member Avatar
Member Avatar
+0 forum 4

Hey guys, Just as the title says, I want to implement using an excel spreadsheet as an argument for a python script. I already have the layout of the spreadsheet, but I want to be able to assign the variables in my python script from specific cells of the spreadsheet. So, ideally I want to be able to type something like "script.py spreadsheet" in my cygwin command prompt. Thanks, kayoh

Member Avatar
Member Avatar
+0 forum 3

Hi guys, I've been trying for over 3 hours just to know how to compare a char to a letter in a string. This is sure confusing, consider that I am a mechanical eng. student >.< Lets get straight to the point Problem 1: passing string and char to a function, and display it [CODE] #include <iostream> #include <string> using namespace std; void CountLetter(string a, char b) { cout << a << "\n"; cout << b << "\n"; } int main() { CountLetter("tttyuttt", 't'); return 0; } [/CODE] Problem 2: after I can pass the char and string to that …

Member Avatar
Member Avatar
+0 forum 3

I made several functions, and this one assignment keeps giving me "expected primary expression before '..., HELP!", what is a primary expression?, all my code is ok I have made different files for the different functions and im using extern but the void argument I think keeps giving me trouble its pointed out down in my code, where the word HERE is, that one line is giving me trouble, does anyone know what could I do pleaaase: [CODE]#include <iostream> #include<stdlib.h> #include <stdio.h> using namespace std; float horas, tarifa; void capturaDatos(char nombre[]); void salarioBruto(void); float impuestoINSS (float sBruto); float ImpuestoIR (float …

Member Avatar
Member Avatar
+0 forum 1

Hi All, Can you please help me to understand why the following code is behaving this way? I think both outputs should be 1 ( 1 means const T), but its not!! [CODE] template <typename T> struct IsConst{ enum {isConst = 0}; }; template <typename T> struct IsConst<const T>{ enum {isConst = 1}; }; template <typename T> void print(T val){ cout << IsConst<T>::isConst << endl; //prints 0 } int main() { const int x = 10; print(x); //why dynamic argument deduction deducting it as normal integer? cout << IsConst<const int>::isConst << endl; //prints 1 return 0; } [/CODE] why dynamic …

Member Avatar
Member Avatar
+1 forum 3

Hi all, I was working on a MATLab program and I came to a point where I wanted to define a function such that one of the arguments would be used as a command. To clarify, the function being defined was an implementation of Simpson's rule that would integrate using the technique with given bounds, an even number of intervals, and, finally, the function being integrated. I wanted the user to be able to enter any function of his or her choice, but I'm unaware of any techniques or modules that could help me accomplish that. Although, I'm talking about …

Member Avatar
Member Avatar
+0 forum 5

Hello, I am working on a program for school and this is my first experience with arrays of objects. I am passing the array of objects into a function, and from within that function I am running another function that takes an individual object from the array as an arguemnt and then modifies some of its variables (the variables are public). It takes all of the arguemnts fine and no errors come up, however when I access the variables from within my main, they are not the modified versions that they are when accessed in my function. So overall my …

Member Avatar
Member Avatar
+0 forum 1

I am getting this error ,can anyone help me : Warning: Invalid argument supplied for foreach() in /home4/thesisth/public_html/pdfsearchmachine/classes/rss.php on line 14 Here is the rss.php code [CODE] <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <? $search = $_GET["search"]; $replace = " "; $with = "+"; $search = str_replace($replace, $with, $search); if ($rs = $rss->get("http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query=originurlextension%3Apdf+$search&adult_ok=1&start=$start")) { } // Go through the list powered by the search engine listed and get the data from each <item> $colorCount="0"; foreach($rs['items'] as $item) { // Get the title of result $title = $item['title']; // Get the description of the result $description = $item['description']; // Get the link eg …

Member Avatar
Member Avatar
+0 forum 7

Hi guys, Im pretty dam stuck at the moment on an assignment Im meant to do. Its my last question so everything is pretty laid out, but the question (to me is not useful) so if you could just help me out it'd be much appreciated Ok so what i had to do was "create" a rectangle where 4 co-ordinates were stored mapping out where, on an x, y grid this rectangle is. Then i had to make a way for the user to see where on the grid they are by allowing them to see the current x, y …

Member Avatar
Member Avatar
+0 forum 5

[CODE] // Hangman Redo Program #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include <string> #include <vector> #include <algorithm> using namespace std; //Functions void welcome(); void instructions(); int game(string sofar, const string THE_WORD, int MAX_WRONG, int wrong, string used); // Types and Arrays string choice; string inst; const int MAX_WRONG = 8; int main() { vector<string>words; words.push_back("ALPHABET"); words.push_back("SKUNK"); words.push_back("ANIMALS"); words.push_back("TABLE"); words.push_back("CASE"); words.push_back("MONITOR"); words.push_back("TELEVISION"); words.push_back("SOAP"); words.push_back("BERUIT"); words.push_back("WRAP"); words.push_back("CHAIR"); words.push_back("CHARTER"); words.push_back("COMPUTER"); words.push_back("SHARPENER"); words.push_back("PENCIL"); words.push_back("WALLS"); words.push_back("LUNG"); words.push_back("NOTHING"); words.push_back("HAIR"); words.push_back("SECRUITY"); words.push_back("NIXON"); words.push_back("DESTROY"); words.push_back("OUTLET"); srand(static_cast<unsigned int>(time(0))); random_shuffle(words.begin(), words.end()); const string THE_WORD = words[0]; int wrong = 0; string sofar (THE_WORD.size(), '-'); string used = ""; …

Member Avatar
Member Avatar
+0 forum 25

Greetings all, I've just started learning Ruby (and Geo Ruby), and am trying to create overlays for Google Maps. I found a [seemingly] great tutorial for doing this [B][URL="http://blog.newsplore.com/2009/02/22/spincloud-lab"]HERE[/URL][/B] ...and it uses Ruby to generate the final javascript - cool, eh? Have everything installed properly (as far as I can tell - gem list gives me the whole bundle including: mysql (2.8.1)). MySQL working fine. I get this error when trying to run the script (attached) from a shell: Command: [CODE]$ ruby ./Desktop/gen_encpolygons.rb[/CODE] Returns: [CODE]./Desktop/gen_encpolygons.rb:11:in `initialize': wrong number of arguments (4 for 0) (ArgumentError) from ./Desktop/gen_encpolygons.rb:11:in `new' from ./Desktop/gen_encpolygons.rb:11:in `generate_js_border_overlay' …

Member Avatar
Member Avatar
+0 forum 14

Hey everyone. I would really appreciate some help. I'm currently building a program in Python 2.6 for an introductory Comp Sci class. The program is supposed to use functions to read a text file from a URL, parse the data into tokens, and use the data to calculate a sort of average 'course grade' for hypothetical students using the URL data. This is all something I've done before, only I didn't use functions. Now that I'm using them, I'm running into errors and need help. Specifically, when I try to run the program I get an error like this: [CODE]Traceback …

Member Avatar
Member Avatar
+0 forum 2

Hi! The following Tkinter buttons should call [I]opt_def[/I] with [I]opt[/I] as 1 or 2 depending on which button is pressed (see code). [CODE]from Tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() self.opt1 = Button(frame, text="Opt1", command=self.opt_def(1)) self.opt1.pack(side=TOP) self.opt2 = Button(frame, text="Opt2", command=self.opt_def(2)) self.opt2.pack(side=BOTTOM) def opt_def(self, opt): print 'You have choosen option', opt root = Tk() app = App(root) root.mainloop() [/CODE] But when the code is ran (no Tkinter buttons pressed) it returns this: [CODE] >>> You have choosen option number 1 You have choosen option number 2[/CODE] Why does this happens and how do I fix …

Member Avatar
Member Avatar
+0 forum 4

is there anyway to get the another application environmenat commandline argument Thx in Advance

Member Avatar
Member Avatar
+0 forum 1

The End.