Search Results

Search found 25663 results on 1027 pages for 'script programmer'.

Page 39/1027 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • How do I pass a variable number of parameters along with a callback function?

    - by Bungle
    I'm using a function to lazy-load the Sizzle selector engine (used by jQuery): var sizzle_loaded; // load the Sizzle script function load_sizzle(module_name) { var script; // load Sizzle script and set up 'onload' and 'onreadystatechange' event // handlers to ensure that external script is loaded before dependent // code is executed script = document.createElement('script'); script.src = 'sizzle.min.js'; script.onload = function() { sizzle_loaded = true; gather_content(module_name); }; script.onreadystatechange = function() { if ((script.readyState === 'loaded' || script.readyState === 'complete') && !sizzle_loaded) { sizzle_loaded = true; gather_content(module_name); } }; // append script to the document document.getElementsByTagName('head')[0].appendChild(script); } I set the onload and onreadystatechange event handlers, as well as the sizzle_loaded flag to call another function (gather_content()) as soon as Sizzle has loaded. All of this is needed to do this in a cross-browser way. Until now, my project only had to lazy-load Sizzle at one point in the script, so I was able to just hard-code the gather_content() function call into the load_sizzle() function. However, I now need to lazy-load Sizzle at two different points in the script, and call a different function either time once it's loaded. My first instinct was to modify the function to accept a callback function: var sizzle_loaded; // load the Sizzle script function load_sizzle(module_name, callback) { var script; // load Sizzle script and set up 'onload' and 'onreadystatechange' event // handlers to ensure that external script is loaded before dependent // code is executed script = document.createElement('script'); script.src = 'sizzle.min.js'; script.onload = function() { sizzle_loaded = true; callback(module_name); }; script.onreadystatechange = function() { if ((script.readyState === 'loaded' || script.readyState === 'complete') && !sizzle_loaded) { sizzle_loaded = true; callback(module_name); } }; // append script to the document document.getElementsByTagName('head')[0].appendChild(script); } Then, I could just call it like this: load_sizzle(module_name, gather_content); However, the other callback function that I need to use takes more parameters than gather_content() does. How can I modify my function so that I can specify a variable number of parameters, to be passed with the callback function? Or, am I going about this the wrong way? Ultimately, I just want to load Sizzle, then call any function that I need to (with any arguments that it needs) once it's done loading. Thanks for any help!

    Read the article

  • What is the perfect skill set for a software engineer? [closed]

    - by Sergey
    Of course, except technology stack. I'm asking about more fundamental skills such as design patterns or math. POSSIBLE DUPLICATES: http://stackoverflow.com/questions/76364/what-is-the-single-most-effective-thing-you-did-to-improve-your-programming-skill http://stackoverflow.com/questions/132798/what-should-every-programmer-know http://stackoverflow.com/questions/1177724/what-soft-skills-make-a-great-programmer

    Read the article

  • Python for a hobbyist programmer ( a few questions)

    - by Matt
    I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions: Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines Does python handle networking tasks fairly well? Can python source be obscufated (mispelled I think), or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language. Thanks a ton for any help you can provide.

    Read the article

  • Hiring a programmer: looking for the "right attitude"

    - by Totophil
    It's actually two questions in one: What is the right attitude for a programmer? How do you (or would you) look for one when interviewing or during hiring process? Please note this question is not about personality or traits of a candidate, it is about their attitude towards what they do for living. This is also not about reverse of programmers pet peeves. The question has been made community wiki, since I am interested in a good answer rather than reputation. I disagree that the question is purely subjective and just a matter of opinion: clearly some attitudes make a better programmer than others. Consecutively, there might quite possibly exist an attitude that is common to the most of the better programmers. Update: After some deliberation I came up with the following attitude measurement scales: identifies themselves with the job ? fully detached perceives code as a collection of concepts ? sees code as a sequence of steps thinks of creating software as an art ? takes 100% rational approach to design and development Answers that include some sort of a comment on the appropriateness of these scales are greatly appreciated. Definition of "attitude": a complex mental state involving beliefs and feelings and values and dispositions to act in certain ways; "he had the attitude that work was fun" The question came as a result of some reflection on the top voted answer to "How do you ensure code quality?" here on Stack Overflow.

    Read the article

  • Old desktop programmer wants to create S+S project

    - by Craig
    I have an idea for a product that I want to be web-based. But because I live in Brasil, the internet is not always available so there needs to be a desktop component that is available for when the internet is down. Also, I have been a SQL programmer, a desktop application programmer using dBase, VB and Pascal, and I have created simple websites using HTML and website creation tools, such as Frontpage. So from my research, I think I have the following options; PHP, Ruby on Rails, Python or .NET for the programming side. MySQL for the DB. And Apache, or possibly IIS, for the webserver. I will probably start with a local ISP provider for the cloud servce. But then maybe move to something more "robust" and universal in the future, ie. Amazon, or Azure, or something along that line. My question then is this. What would you recommend for something like this? I'm sure that I have not listed all of the possibilities, but the ones I have researched and thought of. Thanks everyone, Craig

    Read the article

  • Learning C++ as a Perl programmer

    - by meneldor
    Hello all, I'm a Perl5 programmer for 7 years and I'm trying to learn C++ now. Some of the c++ syntax is hard for me to understand and to think in c++ way. For example: In perl you can mix the data in the arrays @array = (1,"string",5.355); You can assign any value to a scalar variable: $var = 1; $var = "string"; $var = \$reference_to_scalar; There are many examples. The friend of mine recommend me the book "Thinking of C++" by Bruce Eckel, but I haven't any C background and it's hard for me to understand some things. So my question is - could you recommend me a book for this situation. I don't want to learn C. I understand OOP (I'm getting more familiar with C++ oop aswell), I understand the point of the pointers(and some arithmetic) and references(widely used in perl). I dont need some of the manuals for dummies (what is int,bool,double,if,while), I just need a direction how to learn C++ from my point of perl programmer, because I,m sure that there are many like me. Thank you in advance.

    Read the article

  • script not found or unable to stat: /usr/lib/cgi-bin/php-cgi

    - by John
    I have just seen a new series of error in the /var/log/apache2/error.log [Thu Oct 31 06:59:04 2013] [error] [client 203.197.197.18] script not found or unable to stat: /usr/lib/cgi-bin/php [Thu Oct 31 06:59:08 2013] [error] [client 203.197.197.18] script not found or unable to stat: /usr/lib/cgi-bin/php5 [Thu Oct 31 06:59:09 2013] [error] [client 203.197.197.18] script not found or unable to stat: /usr/lib/cgi-bin/php-cgi [Thu Oct 31 06:59:14 2013] [error] [client 203.197.197.18] script not found or unable to stat: /usr/lib/cgi-bin/php.cgi [Thu Oct 31 06:59:14 2013] [error] [client 203.197.197.18] script not found or unable to stat: /usr/lib/cgi-bin/php4 This server is running Ubuntu 12.04lts. I have never seen this sort of attack before, should i be concerned or securing my system in any way for them? Thanks, John

    Read the article

  • Rackspace copy script failure message "java.net.SocketTimeoutException: Read timed out"

    - by user53864
    I am using Rackspace for Ubuntu cloud server. Everyday a script(I guess the script is from rackspace) executes on the cloud servers which copies the backfile to the Rackspace CloudFiles and sends the mail as if the files are copied and I've scheduled the script on the cloud servers. I've no much knowledge of the script and I guess the script is based on Cruise(as I could see build.xml, some jar files ...). Everyday the files are copied to the Rackspace from cloud servers but sometimes don't know why, the files will be copied to Rackspace sending an error failure message or sometimes the files will not be copied and sends the error failure message like the one below. Error while backing up on Station1 on 03/03/2011 04:50 AM and reason for error is java.net.SocketTimeoutException: Read timed out Anybody using Rackspace?, anybody has any fix for this?

    Read the article

  • PHP script timed out, or otherwise killed on Apache under CentOS (shared host)

    - by MarkS
    When trying to run a PHP script (CentOS, Apache, PHP 5.2), that may take a long time, it is apparently killed after 45 minutes. PHP script is invoked from a web browser, and in certain situations, it will do a lot of work processing a POP3 mailbox and sending emails as part of an automated monitoring system. Running the PHP script from the command line might be a better option, but I want to understand what is going on so far. I ran a test script, and it appeared to finally give an internal server error (500?) after 45 minutes. Where is this limit set and what is killing the script, if that is what is happening? It's running on a shared host on Hostgator.com.

    Read the article

  • More advanced 'Apple Automator' software?

    - by OrangeBox
    Is there any software similar to automator but more advanced? In our situation we have two files with the same name, one is a MOV the other XML. We want to use some of the metadata within the XML to rename both files. Then we want to re-arrange the contents of the XML file so that it is compatible with another piece of software we use (I think this is called mapping) Essentially some software that takes a bunch of variable from existing file and peforms file actions to them. I imagine this would be an easy task using applescript, but im wondering if there is a OSX application similar to Automator that can do the above? Questions are: Is there software that can do the above? Could Automator achieve this? What is the name of this process? If no such software exists, what would be the best kind of script to use? eg. Make an Apple Script, python script etc.

    Read the article

  • Ubuntu Upstart script hangs on start and stop

    - by sbwoodside
    I have an upstart script that will start a custom jetty server. When I do sudo start [myservice] nothing happens. Subsequently, sudo status [myservice] show it as: [myservice] start/killed, process 3586. Here's the script in /etc/init/[myservice].conf: description "[description]" author "[my name and email]" start on runlevel [2345] stop on runlevel [016] respawn expect fork script sudo -u www-data /path/to/grafserv-start.sh >> /tmp/upstart.log 2>&1 end-script And here is grafserv-start.sh: #!/bin/bash /usr/bin/java -Djetty.port=3070 -jar /path/to/grafserv/trunk/start.jar echo "Done starting GrafServ" I've tried redirecting the output of the script command to a tmp logfile, but that file is never created. When I start it, I just get a hang, until I ^C. Also, I tried running it with strace but that gave me a lot of stuff about sockets.

    Read the article

  • bash : "set -e" and check if a user exists make script exit

    - by Dahmad Boutfounast
    i am writing a script to install a program with bash, i want to exit on error so i added "set -e" in the beginning of my script. the problem is that i have to check if a user exists inside of my script, to do this i am using "grep "^${USER}:" /etc/passwd", if the user exists, the script runs normally, but if the user doesn't exist, this command exists, and i don't want to exit on this case (i have to create the user and continue my installation). so what's the solution to make my script continue running ?? i tried to redirect the output of "grep" to a variable, but i still have the same problem :( thanks.

    Read the article

  • FTP script download from linux to windows

    - by user53864
    I'm using following FTP script on windows xp to download zip files from ubuntu cloud servers. A zip file is created every day on ubutnu servers and I will download it to windows via this ftp script. I run this script everyday manually as I have to edit the last line(mget /usr/backup_02-11-2010.Zip) of the script to match today's date. I want to edit this script so that it will download only today's zip file at the scheduled time without needing to edit it everyday, when scheduled. It's clear that date is appended to the zip files and is in the format dd-mm-yyyy. Need help... open server-ip-here username-here user-password-here lcd C:\Backup\files bin hash prompt mget /usr/backup_02-11-2010.zip

    Read the article

  • Run command before and after printing with CUPS?

    - by leto
    Hello, this is a home setup. A central printer server (Linux) manages the queue, a HP 2430DTN is attached to it via 100Mbit/sec Ethernet. The printer is hooked up to a managable power source. A shell script watches the queue on the server (lpstat -o) and turn on the printer when there is a job. If the queue is empty for 10 minutes it turns the printer off. Now this setup messes up, stops the printer etc. after a couple of weeks and is in general "not so reliable". I now know how to change the stop-printer thing, but: Is there a way to run my turn printer on script and turn printer off script directly from cups without watching the queue? That would be so cool!

    Read the article

  • View Script Over SSH?

    - by user74781
    A friend, using a remote machine, ran a script that SSHed to my machine, and ran the following python script that resides on my machine: while (1): ....print "hello world" (this script simply prints 'hello world' continuously). I am now logged in to my machine. How can I see the output of the script my friend was running? if it helps, I can 'spot' the script my friend is using: me@home:~$ ps aux | grep justprint.py **friend 7494 12.8 0.3 7260 3300 ? Ss 17:24 0:06 python TEST_AREA/justprint.py** friend 7640 0.0 0.0 3320 800 pts/3 S+ 17:25 0:00 grep --color=auto just what steps should I take in order to view the "hello world" messages on my screen?

    Read the article

  • Restrict Administrators from changing system time - Windows XP machines (no domain)

    - by user72128
    I need to write a script that will remove all users under Local Computer Policy > Computer Configuration > Windows Settings > Security Settings > User Rights Assignment > Change the system time from the local group policy (gpedit.msc) on all Windows XP machines. These machines are not on the domain. I DO have a way to distribute and run the script automatically. Can someone point me in the right direction for creating a script like this?

    Read the article

  • Mac OS X: Change $PATH from within python script

    - by Eye of Hell
    I have a bunch of python scripts. One of them installs software (subversion) that requires it's path to be added to $PATH. After it is installed, I want the next script to use the software. If I run export PATH=/opt/subversion/bin:$PATH in bash between the first and second script, all is ok. But if I add os.system( 'export PATH=/opt/subversion/bin:$PATH' ) as the last command of the first script (that installs subversion), $PATH remains unaltered after it exits. Is it any way to change $PATH from within python script so it will remain changed after the script finishes (inside single bash session, of course, I know about /etc/profile).

    Read the article

  • CGI Script not running in PHP file

    - by Unykvis
    I have a CGI script in the server called script.cgi and I have added the following code to the domain vhost: Action add-footer /cgi-bin/script.cgi AddHandler add-footer .htm .html I have change it to: Action add-footer /cgi-bin/script.cgi AddHandler add-footer .htm .html .php If the page is HTML the code will run but if the page is PHP the code will not run. Is there any code I need to add to the vhost so that PHP files can run this script? **EDITED:** I want to "inject" an HTML code in every possible page of the server this includes HTML and PHP files. The code only works for html files and I don't know why.

    Read the article

  • Shell Script to Start Mysql Server if not running

    - by user103373
    I have written a shell script to start mysql server & send a mail to admin user if it's restarted via shell script. What i am facing an issue if I run this shell script on terminal it's work perfectly & If same script runs via cronjob it's only sending the mail to the user & problem remains same. Is this problem relates to permission & how can i resolve it. Shell Script-------- #!/bin/bash EMAIL="[email protected]" SERVICE='mysql' if ps ax | grep -v grep | grep $SERVICE > /dev/null then echo "$SERVICE service running, everything is fine" else echo "$SERVICE is not running" /etc/init.d/mysql start cat <<EOF | msmtp -a gmail $EMAIL Subject: "Alert (Test Server) : Mysql Service is not running (Manually Restarted)" Mysql Server Restarted at: `date` EOF EXIT I am using msmtp for sending mail to the user on ubuntu 12.04 Server.

    Read the article

  • Shell script only executes partially when run with CRON

    - by binaryorganic
    I've written a shell script that does the following: Retrieve mail from a POP3 account (using GetMail) Save a copy of that email to S3 (using AWS CLI) Email me the filesize of the email The script runs fine manually, and technically runs from CRON, but it only seems to be sending the email. The getmail and S3 bits don't seem to run. Everything I've read seems to hammer home the message that I need to be careful about relative paths and the like when using CRON, but I think I'm using absolute paths everywhere I need to be, so I'm stumped as to what the issue could be. My Shell Script is here: #!/bin/bash # Run GetMail getmail -r /PATH/TO/EMAIL/getmail.email # Save to S3 aws s3 cp /PATH/TO/SCRIPT/email-backup.mbox s3://XXXXXXXXXX/email-backup.mbox # Send Confirmation Email SUBJECT="EMAIL SUBJECT" EMAIL="[email protected]" # Get current filesize FILENAME=/PATH/TO/SCRIPT/email-backup.mbox FILESIZE=$(stat -c%s "$FILENAME") # Email Content EMAILMESSAGE="/tmp/emailmessage.txt" echo "EMAIL BODY" >$EMAILMESSAGE echo "" >>$EMAILMESSAGE echo "Current File Size: $FILESIZE bytes" >>$EMAILMESSAGE # Send the Mail /bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

    Read the article

  • Exit to command line in Python

    - by fuenfundachtzig
    I have a script that I want to exit early under some condition: if not "id" in dir(): print "id not set, cannot continue" # exit here! # otherwise continue with the rest of the script... print "alright..." [ more code ] I run this script using execfile("foo.py") from the Python interactive prompt and I would like the script to exit going back to the command line. How do I do this? If I use sys.exit(), the Python interpreter exits completely.

    Read the article

  • Recieving and organizing results without server side script (JavaScript)

    - by Aaron
    I have been working on a very large form project for the past few days. I finally managed to get tables to work properly within a javascript file that opens a new display window. Now the issue at hand is that I can't seem to get CSS code to work within the javascript that I have created. Before everyone starts thinking "just use server side script idiot" I have a few conditions and info about the file: The file is only being ran local due to confidential information risks. Once again no option for server access. The intranet the computers are on are already top security and this wouldn't exactly be a company wide program The code below is obviously just a demo with a simple form... The real file has six pages of highly confidential information Only certain fields on this form will actually be gathered (example: address doesnt appear in the results) The display page will contain data compiled into tables for easier viewing I need to be able to create css commands to easily detect certain information if it applies and along with matching design of the original form Here is the code: <html> <head> <title>Form Example</title> <script LANGUAGE="JavaScript" type="text/javascript"> function display() { DispWin = window.open('','NewWin', 'toolbar=no,status=no,width=800,height=600') message = "<body>"; message += "<table border=1 width=100%>"; message += "<tr>"; message += "<th colspan=2 align=center><font face=stencil color=black><h1>Results</h1><h4>one</h4></font>"; message += "</th>"; message += "</tr>"; message += "<td width=50% align=left>"; message += "<ul><li><b><font face=calibri color=red>NAME:</font></b> " + document.form1.yourname.value + "</UL>" message += "</td>"; message += "<td width=50% align=left>"; message += "<li><b>PHONE: </b>" + document.form1.phone.value + "</ul>"; message += "</td>"; message += "</table>"; message += "<body>"; DispWin.document.write(message); DispWin.document.body.style.cssText = 'color:#blue;'; } </script> </head> <body> <h1>Form Example</h1> Enter the following information: <form name="form1"> <p><b>Name:</b> <input TYPE="TEXT" SIZE="20" NAME="yourname"> </p> <p><b>Address:</b> <input TYPE="TEXT" SIZE="30" NAME="address"> </p> <p><b>Phone: </b> <input TYPE="TEXT" SIZE="15" NAME="phone"> </p> <p><input TYPE="BUTTON" VALUE="Display" onClick="display();"></p> </form> </body> </html> >

    Read the article

  • Sourcing a shell script, while running with sudo

    - by WishCow
    I would like to write a shell script that sets up a mercurial repository, and allow all users in the group "developers" to execute this script. The script is owned by the user "hg", and works fine when ran. The problem comes when I try to run it with another user, using sudo, the execution halts with a "permission denied" error, when it tries to source another file. The script file in question: create_repo.sh #!/bin/bash source colors.sh REPOROOT="/srv/repository/mercurial/" ... rest of the script .... Permissions of create_repo.sh, and colors.sh: -rwxr--r-- 1 hg hg 551 2011-01-07 10:20 colors.sh -rwxr--r-- 1 hg hg 1137 2011-01-07 11:08 create_repo.sh Sudoers setup: %developer ALL = (hg) NOPASSWD: /home/hg/scripts/create_repo.sh What I'm trying to run: user@nebu:~$ id uid=1000(user) gid=1000(user) groups=4(adm),20(dialout),24(cdrom),46(plugdev),105(lpadmin),113(sambashare),116(admin),1000(user),1001(developer) user@nebu:~$ sudo -l Matching Defaults entries for user on this host: env_reset User user may run the following commands on this host: (ALL) ALL (hg) NOPASSWD: /home/hg/scripts/create_repo.sh user@nebu:~$ sudo -u hg /home/hg/scripts/create_repo.sh /home/hg/scripts/create_repo.sh: line 3: colors.sh: Permission denied So the script is executed, but halts when it tries to include the other script. I have also tried using: user@nebu:~$ sudo -u hg /bin/bash /home/hg/scripts/create_repo.sh Which gives the same result. What is the correct way to include another shell script, if the script may be ran with a different user, through sudo?

    Read the article

  • How to run perl script with a few arguments from php

    - by Cristalla
    My html webpage calls php script to upload files to the server from a local computer as follows. <form enctype="multipart/form-data" action="upload.php" method="POST"> <p><b><h3> <font color="#003366"> (1) Upload your reading text file. </font> </h3> </b> </p> <INPUT type="file" name="uploaded" size="50" > <br/> <input type="submit" name="files" value="upload"> </form> In order to process with an uploaded file, my php script calls shell script $output=system('/bin/sh connector_0.sh'); and my shell script is composed of a series of python/perl scripts. #!/bin/sh python main_senselearner_final_0.py senseLearner.pl -i Uploaded_Files/slinput_0.txt -o Uploaded_Files/presloutput_0 .txt -model modelNNCollocations -model modelJJCollocations -model modelVBColloc ations -pos python smutngslout_0.py python genhtml_0.py Now, the problem is the following: all python scripts in shell script worked fine through php. But perl script didn't work. When I run shell script by myself in my server, all four scripts in shell worked perfectly. However, when I run shell script from php, only perl script doesn't work. Would you please give me any tips to solve this problem? Many thanks!!!

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >