scripting

How to get the date from a file in a bat file?

I'm writing a bat script and I have to save the date from a file to a variable. How can I do that? I will use the variable to check wether the file is older than N days, so it would be nice to save the date in a format that would allow me to do such test. ...

how to visit every computer on the network and modify the host file in windows xp

Hello all, We need to append a line to the hosts file for every user on our network. I have admin privileges, but don't know the first thing about windows scripting. Can someone point me in the right direction on this? I don't have the list of all the machine names, so I'd prefer a script that would discover all the machines on the n...

Socket communication?

What are the preferred platforms to implement TCP socket communication? I'm interested in: scripting languages (eg Swocket for Python) and runtimes (eg .NET / Java). ...

awk gives the following error

"awk: Function systime is not defined." but systime is a built in command ...

source all files in a directory from .bash_profile

I need to allow several applications to append to a system variable ($PYTHONPATH in this case). I'm thinking of designating a directory where each app can add a module (e.g. .bash_profile_modulename). Tried something like this in ~/.bash_profile: find /home/mike/ -name ".bash_profile_*" | while read FILE; do source "$FILE" done; but i...

Updating every profile's registry on Windows Server 2003

I have a Windows Server 2003 system that is used for terminal services. We do not use roaming profiles. We do not use login scripts. I have about thirty to fourty accounts that log into this system and as such have local profiles. One of the software packages that are installed onto this system uses HKCU/Software reg tree for its...

How do scripting languages use sockets?

Python, Perl and PHP, all support TCP stream sockets. But exactly how do I use sockets in a script file that is run by a webserver (eg Apache), assuming I only have FTP access and not root access to the machine? When a client connects to a specific port, how does the script file get invoked? Does the script stay "running" for the durat...

Delete a line with a pattern

Hi I want to delete a line from a file which matches particular pattern the code I am using is BEGIN { FS = "!"; stopDate = "date +%Y%m%d%H%M%S"; deletedLineCtr = 0; #diagnostics counter, unused at this time } { if( $7 < stopDate ) { deletedLineCtr++; } else ...

How can I calculate the date preceeding a given date in unix?

I have two variables: X and Y. The value of X will be a date given in the format mmddyy and I want to calculate the date preceeding that date and have it be returned in in the format yyyymmdd. Let me give you an example. When X="091509" (mmddyy format) Y should be "20090914" (yyyymmdd format) ...

BASH script: Downloading consecutive numbered files with wget

I have a web server that saves the logs files of a web application numbered. A file name example for this would be: dbsclog01s001.log dbsclog01s002.log dbsclog01s003.log The last 3 digits are the counter and they can get sometime up to 100. I usually open a web browser, browse to the file like: http://someaddress.com/logs/dbsclog01s...

adsutil.vbs usage on IIS6

I have an interesting request from my client and am trying to figure out the best way to handle it - with a script preferably. They want me to have 2 sites on production. The first is the actual live website, the second is the last version (in case we need to roll back) and will be the target of the next upgrade. Once the upgrade is d...

Can a PHP script continue running after ending the HTTP request?

How do I write a PHP script that continues running, even after flushing out some text and ending the HTTP request? Is this possible? ...

Can a PHP script abort itself or detect abortion?

PHP scripts can continue executing after the HTTP page request, so how do I finally stop it executing when I'm done with it? Also, is there an event to detect when the OS is going to forcibly abort the script? or how do I keep an internal timer to predict max_execution_time? ...

How would you write a .bat or .cmd file to remove an element from the PATH?

Related: How to list the elements of the path in a batch file? How does FOR work? How would you write a batch file or CMD file to remove an element from the path? It should handle gracefully: differences in case shortnames and long names I've done this using tr.exe but it's slow and complicated and uses temporary files, which mak...

Can instances of the same PHP script cross communicate?

I'm assuming that for every page request, the webserver (eg. Apache) creates a new instance of a script in memory. Can these instances communicate with each other while running? and pass data too? ...

How can i see what variables are sent from flash to a php script?

Hello i was wandering how i could see what variables my flash sends to my php sccript. Is that possible? Maybe an extension or something else? i don`t know if my flash is sending any variables. My problem is that i have a flash wich i can`t change and i the flash has a form. in that form the variables are sent to a php script.. we had t...

How can I access RDF-XML from Perl (or other scripting language)?

I'm backing up my Flickr pics locally using a Perl script and the Net::Flickr::Backup module. This pulls down the original picture, a thumbnail, and the associated metadata (title, tags etc) in a RDF-XML file. I'd like to extract a subset of this metadata so I can generate a "poor man's Flickr" HTML page. This should display the thumbna...

Exemplary server side code

Hi It's all well and good talking about best practices and so on, but if you're anything like me there is so much to be learned from looking at great code. I regularly examine HMTL, CSS, Javascript using firebug, or when coding in C++ I can call upon any of the vast number of high quality open source projects, like boost. However, I d...

Can PHP asynchronously use sockets?

Typical PHP socket functionality is synchronous, and halts the thread when waiting for incoming connections and data. (eg. socket_read and socket_listen) How do I do the same asynchronously? so I can respond to data in a data received event, instead of polling for data, etc. ...

Ant, (over)write into a file

How to write (or overwrite) the following contents: <dependencies> <dependency> <groupId>ged.eprom</groupId> <artifactId>epromx</artifactId> <version>${version.to.set}</version> <classifier>stubjava</classifier> </dependency> </dependencies> into file called pom.xml in the current directory. I have tried...