I have a strange problem with a simple program. I have a container class that holds a pointer. I did this so I could use another container class that does several pass by value calls. I didn't want to be copying the object over and over again, so decided to build this simple container that simply copied the pointer in the copy constructor.
However, the pass by value call seems to be failing in a strange way. When the pass-by-value function is called, the program jumps into the copy constructor just fine and performs the pointer assignment operation. The program will copy the pointer value 0x20 (for argument sake) to the "this->base" location. Within the copy constructor, this has the address 0x28. Then when it jumps into the function, instead of pass by value argument being at 0x28 (as expected), it is at 0x36. Then 0x36->base has the address 0x28. Thus the base is now pointing at what was the new pointer container. At this point the data is corrupted and random things happen.
It seems that there is some strange assignment and double nesting going on. I really do not understand what is going on.
Below is some code. I have stripped away all the other code trying to isolate the problem. I have added comments explaining what my debugger is telling me.
Code:
using namespace std;
class paramPnt // Need to determine how order is tracked
{
private:
long order;
I hace some code C/C++ STL, which i need to use for android, using SDK-NDK-JNI.my problem is that i need to pass some STL structures across JNI, I can't pack/unpack data into basic types or arrays of basic types, doing my own simple streaming between the two layers.My application need to pass a pointer to a STL structure which is updated by eachuser interaction wonder if it is possible using NDK-JNI ?Other option is "native activity" but it also needs JNI in some way ... and passing the STL structures wille a requirement, yet.I only can package data into an own streaming if there is a second (concurrent) application running (implementing the STLfunctionality). Is it possible ?
I need to pass variable from sc1.sh to sc2.sh and update the value of the passed variable in sc2.sh and then return the updated value of the variable from sc2.sh to sc1.sh.
I'm trying to pass a path as a string to an array, but its evaluating it as a command instead. I want to take the literal string "/mnt/accounts/user/temp/*.jpg" and assign it to an array{1}, but when i echo the array variable, it displays it as
pic1.jpg pic2.jpg pic3.jpg
[code]....
I just want it to be the actual text "/mnt/accounts/user/temp/*.jpg" which i will be combining with other text to create a longer path elsewhere in the code.
I need to pass a large number of arguments to a function which takes variable number of arguments, such as gtk_list_store_new. But it doesn't look nice if i write something like gtk_list_store_new(NUM,TYPE_A,TYPE_B,TYPE_C,...,TYPE_OMEGA); because of large number of arguments. And, it will be a trouble to change number of columns because of need to manually change arguments to large number of such functions. So, how can i pass all the arguments to a function using a loop? Something like
My hosting server does not allow exec() or system() calls, for security reasons. I can call a cgi process in two ways. From a .shtml page, i can issue a directive like code...
I am building a pipeline for image processing. I would like to be able to take the png images in a folder and pass them to clusterImage.pl once that is done I would like to then pass the outputted file to seperateObjects.pl the outputted file is of the same name but has kmeansOutput.all.matrix attached to the end. Below is what I have so far, but it is not working.
#!/bin/bash #This script will take in an image and a matrix file. #The output will be an image and a matrix file. list=`ls *.png` for i in $list
I have an array...n i want to display it as a popup window ...the array elements...as buttons that are clickable...
so can i pass an array to the window as argument..i know we can pass parameter values..but array?and is so how can the individual array elements be accessed inside the window?
I have some messy code that I wrote a while back and I am trying to organize it. The program opens xpaint and uses xwit and xte to draw packman and so on. I want to split it all up I am going to add more to it. Basically like i would want drawing packman in one function i guess you could call it and then coloring him or the background in another
#xwit -id $paintersMom -focus -raise #sleep 1 #xwit -id $paintersMom -warp 30 390 #// fill in command on tool bar #sleep 1 #xte 'mouseclick 1' #sleep 1 #xwit -id $canvasWin -warp 221 40 #// color selection #sleep 1 #xte 'mouseclick 1' #sleep 1 #xwit -id $canvasWin -warp "$(($X-150))" "$Y" #//location on pac man #sleep 1 #xte 'mouseclick 1' #sleep 1
#xwit -id $canvasWin -warp 62 44 #// selecting color black #sleep 1 #xte 'mouseclick 1' #sleep 1 #xwit -root -warp 62 120 #// selecting back to canvas #sleep 1 #xte 'mouseclick 1' #// color canvas black #sleep 1 #xwit -id $paintersMom -focus -raise #xwit -id $paintersMom -warp 27 108 #//click back to pencil #sleep 1 #xte 'mouseclick 1' #sleep 1 </code>
Here for example $paintersmom is would be in the drawing of pacman but I would also want to use it when I colored him in.. but I would want both processes in a different shell script.
Page.php -- has a special division thats empty and on Link Click calls Javascript to change inner.html to an IFRAME call So the user clicks the link and then it shows the division and loads the IFRAME The IFRAME Source is iframe.php in IFRAME.PHP I need to take the Session Variables that were set already in Page.php all sessions work fine when not using Iframe (open iframe.php in its own window) but doesnt work when its Iframed and sadly I have to use Iframe on this page NOW the CATCH is -- I CANNOT use any POST or GET Values the iframe src MUST be straight url to the page [URL] cannot use variables in the url [URL] etc..
IS it possible to do what I need Without passing variables via the url? Page1 has all session variables set, calls the iframe command when users presses a button, Iframe loads but DOES not have the Session data that was saved on Page1 -- and IFRAME cannot pass variables via the URL it must be a direct url to the page only Page1.php java used to set the HTML / IFRAME into its Div
Code:
<script> function changeText(){ document.getElementById('iframediv').innerHTML = "<iframe scrolling='no' frameborder='0' margin='0' src='http://mypage.blah/iframe.php'></iframe>";
I have a problem passing a file descriptor from one process to another.
I have two processes A and B. Both are running in different network and filesystem namespaces, so it is impossible to use unix domain sockets or net sockets to pass a file descriptor from process A to process B.
The usage of STREAMS is also impossible, as you can see in fixunix.com/unix/84093-streams-pipes-ioctl-i_sendfd.html
[quotation begin] Linux doesn't have STREAMS, which are the System V way of doing this task. ... [quotation end]
Are there additional possibilities for file descriptor passing like using named pipes or something like that or does anybody know a good workaround for this problem ?
I am attempting to script some tasks I have to do, but I have no control over one of the scripts I have to use... and they output all kinds of useless things on the screen. My goal is simple: Capture all output from their scripts, and create a progress line that only shows the most recent output from their stuff. So, here was my first solution; a file I called "spin":
To use it, you pass it a process ID and a file that contains the output from that process. As the process continues, a kurby dances on the screen (To let you know that the process has not hanged), and the tail of the output is shown (To let you know what it is doing). When the process ends, the kurby stops dancing and the time it took is displayed.
And here is the file I call "noise": Code: #!/bin/bash while [ i -lt 100 ];do i=1 echo "Look at me count!$" sleep 1 let "i=$i+1" done
This does nothing but create random output, for testing. It counts from 1 to 99 on the screen. To run my test, I do the following: Code: (noise) &>tmp.txt & spin $! tmp.txt
It works relatively well, but it is messy. I don't like creating a temp file, and I don't like the messy syntax for calling my program. I decided that I would rather move everything into the spin program, to make using it less messy: Code: #Spin Psuedo code #$1 = command I am about to run (exec $1) &>tmp.txt & spinX $! tmp.txt
By executing the process inside of the spin code, I can get rid of the tmp file later on without changing a lot of scripts (Or move it, or whatever). I can also call it by passing the command to the script, which I find more elegant.
So here is what I would like to know: 1) If possible, I would love to get rid of the tmp file all together, and store the most recent line of output from script 1 into a variable that script 2 can print out instead... is it possible? 2) How can I run a random command that is passed as an argument? Basic ones work fine, but anything with a pipe fails me.
Example of a script: Code: #!/bin/bash #myEcho.sh echo;echo "Recieved command: ";echo $1;echo; echo "Attempting to run command: ";echo exec $1
Example code for passing commands to script: > myEcho.sh "ls -al" #works > myEcho.sh 'ls -al' #works > myEcho.sh "ls -al|grep *.sh" #fail # Output: #ls: invalid option -- | #Try 'ls --help' for more information. > myEcho.sh "ls -al|grep "*.sh"" #fail # Output: #ls: invalid option -- | #Try ls --help' for more information. > myEcho.sh 'ls -al|grep *.sh' #fail # Output: #ls: invalid option -- | #Try 'ls --help' for more information.
I'm trying to create a program that would locate the oldest file of a certain type on a server. Here's the commands:
OLDEST_PATH=`find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1` OLDEST_FILE=`find -L $OLDEST_PATH | grep .mp3 | sort -f | head -1` ls -al $OLDEST_FILE
I'm writing this all in expect but I'm having problems. The main problem I have is whenever I try to run the first command, I can't seem to isolate the result of the OLDEST_PATH so that the 2nd command will work. There always seems to be a newline in the variable and the result is only "find -L" command running and it bypasses the variable. If I can just figure out how to get the 1st and 2nd command to work, then I can figure out the 3rd. Here's some code:
I know there is a better way to write this. I've tried multiple ways and this just happens to be the last way I've tried it. If you try running this, you'll notice that there is still carriage returns after the result of OLDEST_PATH and it prevents the 2nd "find" command from working properly.
How can I pass carriage return to a command in the shell script. I am writing a shell script whcih generates ssh key pair. It ask for input from user three times. I want to pass carriage return (i.e., press Enter button) to this command.
How can I pass by reference, a parameter, without assigning a new object? In my first example, var = "changed" creates a new local object. In the second, mylist.append will affect the reference target. How to i achieve the same effect with example 1?
Code: #!/bin/python var = "unchanged" def print_string( var ):
I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:
vlc $( ls | sed 's/ /\ /g' | tr ' ' ' ' )
ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:
01 - Music Track.mp3 02 - Another Track.mp3 to
01 - Music Track.mp3 02 - Another Track.mp3
"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'
I wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:./mybin arg1 arg2 ...then during program execution there's an interactive prompt asking for more parameters:
... >> (second bunch of arguments here) ...
I'd like to run my program inside a bash script, but I don't know how to give the second level arguments.
1st variable CDR_2010-07-21(passed by var1) is the file name inside which i am trying to search string 9892614477(passed by var2). i have tried following script
I have a huge binary log file. There are lets say 4 id's that I want to find in a log file. I know that those 4 id's will be present in the log file and I also know in what order they will be present. I want to find 1st id from the log then 2nd id and then third id and so on..
Simple/inefficient solution is: Loop through the id's and then grep in the log file. Problem with this solution is for each id grep will search from the beginning of the file.
Better/efficient solution would be: Sine I know the order in which id's will be present in the log file. Loop through id's, grep 1st id and then move on to grep 2nd id and so on...this way I can grep all id's in one pass. Is this solution possible ?
I have 500000 + values to find in log files and I have to find efficient solution for it.
I'm trying to do a shell script which are suppose to run a program as a specific user at system boot up. The problem is that I don't know for sure how to make the script add the users password to the prompt when it's necessary.
How would I make this script run this program as user extrema with the password "hidden" at boot-up? I know how to put the script in the rc.X directory and so on, its more the syntax of the code.
I'm trying to write a python script that will use the current user's name when interacting. Ex: when started, it should say "hello daweefolk" when I am logged in. I've tried Code: username=os.system("echo $USER") but the variable remains empty. What is the correct code?
I'm modifying a working udev rule which runs a script that mounts a USB HDD and synchronises files to it.The USB HDDs have been troublesome, losing many files and even losing file systems a couple of timesTo investigate,I want to log the USB HDD product name and serial number so would like to pass ATTRS{product} and ATTRS{serial} values to the script.This may not be possible; I cannot see anything about how to do it in either the udev man page nor Daniel Drake's "Writing udev rules" Version 0.74 but it seems such an obvious thing to want to do, I'm wondering if I've overlooked something.