Search Results

Search found 10355 results on 415 pages for 'shell extension'.

Page 24/415 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Optimize grep, awk and sed shell stuff

    - by kockiren
    I try to sum the traffic of diffrent ports in the logfiles from "IPCop" so i write and command for my shell, but i think its possible to optimize the command. First a Line from my Logfile: 01/00:03:16 kernel INPUT IN=eth1 OUT= MAC=xxx SRC=xxx DST=xxx LEN=40 TOS=0x00 PREC=0x00 TTL=98 ID=256 PROTO=TCP SPT=47438 DPT=1433 WINDOW=16384 RES=0x00 SYN URGP=0 Now i grep with following Command the sum of all lengths who contains port 1433 grep 1433 log.dat|awk '{for(i=1;i<=10;i++)if($i ~ /LEN/)print $i};'|sed 's/LEN=//g;'|awk '{sum+=$1}END{print sum}' The for loop i need because the LEN-col is not on same position at all time. Any suggestion for optimizing this command? Regards Rene

    Read the article

  • Safari Extension - How to respond to Settings changes?

    - by Martin Marlow
    Hi, I'm currently working on an Extension for Safari 5 and I want to run a listener function whenever Settings changes are made. Apple provides an example for that, but it doesn't work for me. I currently have this listener function in my global html file: function numberChanged() { if(event.key == "number") alert("Number has changed!"); } safari.self.addEventListener("change", numberChanged, false); I hope somebody can help me. Does somebody know what I'm doing wrong?

    Read the article

  • Recursive FTP directory listing in shell/bash with a single session (using cURL or ftp)

    - by Timo
    I am writing a little shellscript that needs to go through all folders and files on an ftp server (recursively). So far everything works fine using cURL - but it's pretty slow, becuase cURL starts a new session for every command. So for 500 directories, cURL preforms 500 logins. Does anybody know, whether I can stay logged in using cURL (this would be my favourite solution) or how I can use ftp with only one session in a shell script? I know how to execute a set of ftp commands and retrieve the response, but for the recursive listing, it has to be a little more dynamic... Thanks for your help!

    Read the article

  • Executing shell commands from Java

    - by Lauren?iu Dascalu
    Hello, I'm trying to execute a shell command from a java application, on the GNU/Linux platform. The problem is that the script, that calls another java application, never ends, although it runs successfully from bash. I tried to debug it: (gdb) bt #0 0xb773d422 in __kernel_vsyscall () #1 0xb7709b5d in pthread_join (threadid=3063909232, thread_return=0xbf9cb678) at pthread_join.c:89 #2 0x0804dd78 in ContinueInNewThread () #3 0x080497f6 in main () I tried with: ProcessBuilder(); and Runtime.getRuntime().exec(cmd); Looks like it waits for something to finish. Any ideas? Thanks, Lauren?iu

    Read the article

  • Shell script to process files

    - by Harish
    I need to write a Shell Script to process a huge folder of nearly 20 levels.I have to process each and every file and check which files contain lines like select insert update When I mean line it should take the line till I find a semicolon in that file. I should get a result like this C:/test.java select * from dual C:/test.java select * from test C:/test1.java select * from tester C:/test1.java select * from dual and so on.Right now I have a script to read all the files #!bin/ksh FILE=<FILEPATH to be traversed> TEMPFILE=<Location of Temp file> cd $FILE for f in `find . ! -type d`; do cat $FILE/addedText.txt>>$TEMPFILE/newFile.txt cat $f>>$TEMPFILE/newFile.txt rm $f cat $TEMPFILE/newFile.txt>>$f rm $TEMPFILE/newFile.txt done I have very little knowledge of awk and sed to proceed further in reading each file and achieve what I want to.Can anyone help me in this

    Read the article

  • Chrome Extension: How to display tab objects?

    - by Jalleluhah
    I am in the process of designing an extension for Google Chrome that helps to organize tabs (I know, there are many that already exist; that doesn't matter). I wish to open a popup window that will display tabs as objects (i.e., in the same way that it is displayed in the tab bar at the top of the browser). One way of doing this would be to pull various details (ID, Title, URL, etc.) from each tab, create a class and make instantiations of it upon the opening of each tab using these data, but this seems rather convoluted considering that what I want is sitting right there in the tab bar. Is there any simpler way to achieve this? In addition, I have seen several apps that utilize page previews. Is there something in the API that allows direct access to these?

    Read the article

  • Show last command with up arrow on a linux c shell

    - by nunos
    I have implemented a simple linux shell in c. Now, I am adding some features and one I immediately thought about was to be able to show the last commands with the up arrow. Question 1: However, I have no idea how to accomplish this. Do you? Question 2: Any comment on how to store the "history" commands are also appreciated. I suppose something like a queue which allows access to all elements would be a good idea. Am I wrong? Do I have to implement it or is there already some good implementation out there I should know about? Thanks.

    Read the article

  • change extension obfuscate XML file contents

    - by FFish
    I have SlideShowPro, a Flash photo app that loads an XML file with the paths to the images. Now I don't want people to go sniff in the XML file to get to the images. I tried changing the file images.xml to spacer.gif and it seems to work fine. But I would like to know if I would run into any problems changing the extension. btw already used a few techniques to make the images not so accessible, I know there is no bulletproof solution. Obfuscating the XML file is just another trick..

    Read the article

  • Call glutinit in a PHP extension

    - by Yijinsei
    Hi guys, I am developing a php extension that require the use of opengl. I tried to initialize the library with glutinit; it works in CLI environment but when I tried on browser it doesn't seem to execute the code. The code is actually executed on the server side. It is part of a process to extract features from an image, and the server will return a list of closest image to the user. I very new to opengl, so I'm not sure what kind of error is this, does anybody have any knowledge with this?

    Read the article

  • Firefox extension dev: observing preferences, avoid multiple notifications

    - by Michael
    Let's say my Firefox extension has multiple preferences, but some of them are grouped, like check interval, fail retry interval, destination url. Those are used in just single function. When I subscribe to preference service and add observer, the observe callback will be called for each changed preference, so if by chance user changed all of the settings in group, then I will have to do the same routine for the same subsystem as many times as I have items in that preferences group. It's a great redundancy! What I want is observe to be called just once for group of preferences. Say extensions.myextension.interval1 extensions.myextension.site extensions.myextension.retry so if one or all of those preferences are changed, I receive only 1 notification about it. In other words, no matter how many preferences changed in branch, I want the observe callback to called once.

    Read the article

  • Setting variables in shell script by running commands

    - by rajya vardhan
    >cat /tmp/list1 john jack >cat /tmp/list2 smith taylor It is guaranteed that list1 and list2 will have equal number of lines. f(){ i=1 while read line do var1 = `sed -n '$ip' /tmp/list1` var2 = `sed -n '$ip' /tmp/list2` echo $i,$var1,$var2 i=`expr $i+1` echo $i,$var1,$var2 done < $INFILE } So output of f() should be: 1,john,smith 2,jack,taylor But getting 1,p,p 1+1,p,p If i replace following: var1 = `sed -n '$ip' /tmp/list1` var2 = `sed -n '$ip' /tmp/list2` with this: var1=`head -$i /tmp/vip_list|tail -1` var2=`head -$i /tmp/lb_list|tail -1` Then output: 1,john,smith 1,john,smith Not an expert of shell, so please excuse if sounds childish :)

    Read the article

  • Firefox extension dev: observing preferences, avoid multiple notifications

    - by Michael
    Let's say my Firefox extension has multiple preferences, but some of them are grouped, like check interval, fail retry interval, destination url. Those are used in just single function. When I subscribe to preference service and add observer, the observe callback will be called for each changed preference, so if by chance user changed all of the settings in group, then I will have to do the same routine for the same subsystem as many times as I have items in that preferences group. It's a great redundancy! What I want is observe to be called just once for group of preferences. Say extensions.myextension.interval1 extensions.myextension.site extensions.myextension.retry so if one or all of those preferences are changed, I receive only 1 notification about it. In other words, no matter how many preferences changed in branch, I want the observe callback to called once.

    Read the article

  • Safari extension cookies not recognized/passed

    - by Alex
    I've recently been porting a Chrome extension to Safari, and encountered this kind of error (bug, feature, etc.) So, in global page i have a XMLHTTP request to a secure page which is available only after you login. Example: I simply login using browser - as usually you do on facebook or other secure pages After that, in global page, I load a login-only-available xmlhttp - and it says i'm not logged in it seems that global page somewhat has it's own cookies, so a secure page thinks i'm new ps: in Chrome i can load that page and it thinks i'm acting on behalf of logged in user, so i guess there are some restrictions in Safari pps: i heard there's a Block third-party cookies option in Safari, but even if i checked it to "Never block" it still doesn't work

    Read the article

  • C# extension method doesn't seem to exist

    - by blahblah
    I can't seem to get the following extension method to be found in another class in the same namespace (MyProject.Util). using System.Collections.Specialized; namespace MyProject.Util { public static class Extensions { public static string Get( this NameValueCollection me, string key, string def ) { return me[key] ?? def; } } } As you can see it's basically another version of foo[bar] ?? baz, but I still don't understand why VS2008 fails to compile telling me that no version of Get takes two arguments. Any ideas?

    Read the article

  • Shell script not picking up password file...

    - by BigDogsBarking
    Running the below shell script seems to ignore the password file I'm feeding it. I'm continually prompted for it. If I enter it, the rest of the script goes without a hitch, but as I'm running it via cron, I really need to get it to read from the file... Any suggestions? #!/bin/sh p=$(<password.txt) set -- $p pass_phrase=$1 destination="/var/www/d" cd /var/sl/ for FILE in *.pgp; do FILENAME=${FILE%.pgp} gpg --passphrase "$pass_phrase" --output "$destination/$FILENAME" --decrypt "$FILE" rm -f $FILE done

    Read the article

  • Best way to choose a random file from a directory in a shell script

    - by jhs
    What is the best way to choose a random file from a directory in a shell script? Here is my solution in Bash but I would be very interested for a more portable (non-GNU) version for use on Unix proper. dir='some/directory' file=`/bin/ls -1 "$dir" | sort --random-sort | head -1` path=`readlink --canonicalize "$dir/$file"` # Converts to full path echo "The randomly-selected file is: $path" Anybody have any other ideas? Edit: lhunath makes a good point about parsing ls. I guess it comes down to whether you want to be portable or not. If you have the GNU findutils and coreutils then you can do: find "$dir" -maxdepth 1 -mindepth 1 -type f -print0 \ | sort --zero-terminated --random-sort \ | sed 's/\d000.*//g/' Whew, that was fun! Also it matches my question better since I said "random file". Honsetly though, these days it's hard to imagine a Unix system deployed out there having GNU installed but not Perl 5.

    Read the article

  • shell script problem: does not work on the terminal, but works in a script

    - by jrharshath
    Hi, I was playing with shell scripting, when a strange thing happened. I need someone to explain it. I have a file 'infile', contents: line one line2 third line last a test script test.sh, contents: read var1 echo $var1 i executed: cat infile | ./test.sh output was line one Then I did: cat infile | read var1 echo $var1 Result: a blank line. I even tried cat infile | read var1; echo $var1; same result. why does this happen?

    Read the article

  • An simple Python extension in C

    - by celil
    I am trying to create a simple python extension module. I compiled the following code into a transit.so dynamic module #include <python2.6/Python.h> static PyObject* _print(PyObject* self, PyObject* args) { return Py_BuildValue("i", 10); } static PyMethodDef TransitMethods[] = { {"print", _print, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC inittransit(void) { Py_InitModule("transit", TransitMethods); } However, trying to call this from python import transit transit.print() I obtain an error message File "test.py", line 2 transit.print() ^ SyntaxError: invalid syntax What's wrong with my code?

    Read the article

  • A simple Python extension in C

    - by celil
    I am trying to create a simple python extension module. I compiled the following code into a transit.so dynamic module #include <python2.6/Python.h> static PyObject* _print(PyObject* self, PyObject* args) { return Py_BuildValue("i", 10); } static PyMethodDef TransitMethods[] = { {"print", _print, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC inittransit(void) { Py_InitModule("transit", TransitMethods); } However, trying to call this from python import transit transit.print() I obtain an error message File "test.py", line 2 transit.print() ^ SyntaxError: invalid syntax What's wrong with my code?

    Read the article

  • Shell Script - comparing lines of text, deleting matches

    - by SirRatty
    Hi all, I've done some searching for this but cannot find what I'm after, specifically. I have two files: "a.txt", "b.txt". Each contains a list of email addresses, separated by newlines. For all lines in "a.txt", I need to check for a match anywhere in "b.txt". If so, the email address in "a.txt" needs to be removed. (Alternatively, a new file "c.txt" could be created with the output if that is easier.) I'm using Mac OS X, so am looking for a shell script that could help, or pointers to how I'd go about constructing the script. Thanks for any help.

    Read the article

  • ff extension: how to read a cookie name and value on the current page

    - by encryptor
    My extension works on a application, which requires user login. Once the user has logged in, I need to read the cookies and use them in my xmlhttprequests. So initially i need to check if the cookie is set, if not, I direct the user to the login page. Once logged in, I need to read the cookies and send it as part of mt further requests. Can someone plese help me on how to read cookies from a xmlhttprequest or otherwise (if we dont even know the name of the cookie) there is to function as getRequestHeader.. but what i need is something like that

    Read the article

  • run program multiple times using one line shell command

    - by teehoo
    I have the following gifs on my linux system: $ find . -name *.gif ./gifs/02.gif17.gif ./gifs/fit_logo_en.gif ./gifs/halloween_eyes_63.gif ./gifs/importing-pcs.gif ./gifs/portal.gif ./gifs/Sunflower_as_gif_small.gif ./gifs/weird.gif ./gifs2/00p5dr69.gif ./gifs2/iss013e48788.gif ...and so on What I have written is a program that converts GIF files to BMP with the following interface: ./gif2bmp -i inputfile -o outputfile My question is, is it possible to write a one line command using xargs, awk, find etc. to run my program once for each one of these files? Or do I have to write a shell script with a loop?

    Read the article

  • How to kill all subprocesses of shell?

    - by depesz
    I'm writing bash script, which does several thing. In the beginning it starts several monitor scripts, each of them runs some other tools. At the end of my main script, I would like to kill all things that spawned from my shell. So, it might looks like this: #!/bin/bash some_monitor1.sh & some_monitor2.sh & some_monitor3.sh & do_some_work ... kill_subprocesses The thing is that most of these monitors spawn their own subprocesses, so doing (for example): killall some_monitor1.sh will not always help. Any other way to handle this situation?

    Read the article

  • Shell script for testing

    - by Helltone
    I want a simple testing shell script that launches a program N times in parallel, and saves each different output to a different file. I have made a start that launches the program in parallel and saves the output, but how can I keep only the outputs that are different? Also how can I actually make the echo DONE! indicate the end? #!/bin/bash N=10 for((i=1; j<=$N; ++i)); do ./test > output-$N & done echo DONE!

    Read the article

  • Extension method return using generics

    - by Steven de Salas
    Is it possible to return a generic type using extension methods? For example, I have the following method: // Convenience method to obtain a field within a row (as a double type) public static double GetDouble(this DataRow row, string field) { if (row != null && row.Table.Columns.Contains(field)) { object value = row[field]; if (value != null && value != DBNull.Value) return Convert.ToDouble(value); } return 0; } This is currently used as follows: double value = row.GetDouble("tangible-equity"); but I would like to use the following code: double value = row.Get<double>("tangible-equity"); Is this possible and if so, what would the method look like?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >