Search Results

Search found 22267 results on 891 pages for 'script'.

Page 7/891 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • OO Design / Patterns - Fat Model Vs Transaction Script?

    - by ben
    Ok, 'Fat' Model and Transaction Script both solve design problems associated with where to keep business logic. I've done some research and popular thought says having all business logic encapsulated within the model is the way to go (mainly since Transaction Script can become really complex and often results in code duplication). However, how does this work if I want to use the TDG of a second Model in my business logic? Surely Transaction Script presents a neater, less coupled solution than using one Model inside the business logic of another? A practical example... I have two classes: User & Alert. When pushing User instances to the database (eg, creating new user accounts), there is a business rule that requires inserting some default Alerts records too (eg, a default 'welcome to the system' message etc). I see two options here: 1) Add this rule as a User method, and in the process create a dependency between User and Alert (or, at least, Alert's Table Data Gateway). 2) Use a Transaction Script, which avoids the dependency between models. (Also, means the business logic is kept in a 'neutral' class & easily accessible by Alert. That probably isn't too important here, though). User takes responsibility for it's own validation etc, however, but because we're talking about a business rule involving two Models, Transaction Script seems like a better choice to me. Anyone spot flaws with this approach?

    Read the article

  • WordPress Problem with enqueing a script

    - by casben79
    I am trying to enqueue a script from the functions.php file for a custom theme. here is the code I am using: wp_enqueue_script('innerfade','correct/path/to/innerfade.js', array('jquery'), '', false); I also tried to hardcode from the the functions file like so: ?> <script type='text/javascript' src="correct/path/to/innerfade.js"></script> <?php and both are outputting the following: correct/path/to/innerfade.js'?ver=2.9.2 so It doesnt seem to be a wp_enqueue_script problem What I cannot seem to figure is where the hell is the comma after the .js is coming from, it is causing a dead link hence not loading the script, anyone have any ideas??

    Read the article

  • exiting script while running source scriptname over SSH

    - by CCG121
    I have a script with a number of options in it one of the option sets is supposed to change the directory and then exit the script however running over ssh with the source to get it to change in the parent it exits SSH is there another way to do this so that it does not exit? my script is in the /usr/sbin directory.

    Read the article

  • Google Script / Spreadsheet -- Shared permissions with Installed Trigger onEdit

    - by user1761852
    Using an installed trigger inside spreadsheet to call onUpdateBilling(). Purpose of this script is on edit, based on content of column "billed" (i.e. "d") will highlight the entire column the predetermined color. Page running script is shared with collaborators and they have been given edit access. My expectation at this point is the script should be run with owner permissions. My shared users are unable to run the script with the given error "You don't have permission for this action." Reached my limited knowledge and googlefu for this workaround. Any help to allow operation to my collaborators is appreciated. Script: function onUpdateBilling(e) { var statusCol = 16; // replace with the column index of Status column A=1,B=2,etc var sheetName = "Temple Log"; // replace with actual name of sheet containing Status var cell = SpreadsheetApp.getActiveSheet().getActiveCell(); var sheet = cell.getSheet(); if(cell.getColumnIndex() != statusCol || sheet.getName() != sheetName) return; var row = cell.getRowIndex(); var status = cell.getValue(); // change colors to meet your needs var color; if (status == "D" || status == "d") { color = "red";} else if (status >= 1) { color = "yellow";} else if (status == "X" || status == "x") { color = "black";} else if (status == "") { color = "white";} else { color = "white"; } sheet.getRange(row + ":" + row ).setBackgroundColor(color); }

    Read the article

  • Joomla execute script when timeout?

    - by Romain
    My question may be a noob one but: I want to execute a php script when a user timeout. The only way I found to do so is to make the server execute a script every second or minute for instance, get the last activity of every user and execute a script when the last activity is older than (now() - timeout). is this the appropriate solution? Is this will slow the website significantly? Many thanks in advance!

    Read the article

  • Batch file script for attrib

    - by Deven
    I want to create a batch file for run attrib script for pen drive. But problem is pen drive changes. batch file that 1st ask to write drive letter Then run attrib script for that drive. (my pendrive gets virus from class that i want to clear at home by aplying attrib script below everyday attrib -r -a -s -h /s /d

    Read the article

  • script calling script as other user

    - by viktor tron
    Using CentOs, I want to run a script as user 'training' as a system service. I use daemontools to monitor the process, which needs a launcher script that is run as root: : #!/bin/bash exec >> /var/log/training_service.log 2>&1 setuidgid training training_command This last line is not good enough since for training_command, we need environment for training user to be set. : su - training -c 'training_command' gives 'standard in must be tty' as su making sure tty is present to potentially accept password. I know I could make this disappear by modifying /etc/sudoers a la Bash & 'su' script giving an error "standard in must be a tty" but i am reluctant and unsure of consequences. : runuser - training -c 'training_command' gives runuser: cannot set groups: Connection refused. I found no sense or resolution to this message. I am stuck. Is this something so hard to achieve? I appreciate all insight and guidance to best practice.

    Read the article

  • Where can I find a Script for a crowdfunding website? [closed]

    - by Lincedit
    Possible Duplicate: crowd funding platform? I am looking for a project for a script (PHP/MySql) that provides me the functionality of a crowdfunding website. There are many scripts which should be usable, but I need maybe some scripts for Joomla CMS or any other kind of opensource CMS Websites. I checked all the Resources on Google and could not find some kind of this scripts, because there are no German language installed or prepared for multilingual websites. It is non profit project and I am just looking for any kind of advices, which can be helpfull to me. I hope you can help me here. Please send me some information about some scripts which are running? Many Thanks

    Read the article

  • Shell Script if else

    - by user34104
    #!/bin/bash echo "Int. a number" read num1 echo "Int. another numer" read num2 if ["$num1"="$num2"]; then echo "Equals" else echo "Dif" fi if["$num1"<0]; then echo "The number $num1 is negative" else if ["$num2"<0]; then echo "The number $num2 is negative" fi # this code is not working, i've something wrong when i see if the number is < 0. thanks

    Read the article

  • Bash Script Exits su or ssh Session Rather than Script

    - by Russ
    I am using CentOS 5.4. I created a bash script that does some checking before running any commands. If the check fails, it will simply exit 0. The problem I am having is that on our server, the script will exit the su or ssh session when the exit 0 is called. #!/bin/bash # check if directory has contents and exit if none if [ -z "`ls /ebs_raid/import/*.txt 2>/dev/null`" ]; then echo "ok" exit 0 fi here is the output: [root@ip-10-251-86-31 ebs_raid]# . test.sh ok [russ@ip-10-251-86-31 ebs_raid]$ as you can see, I was removed from my sudo session, if I wasn't in the sudo session, it would have logged me out of my ssh session. I am not sure what I am doing wrong here or where to start.

    Read the article

  • Batch Script to Find Certain words and delete those lines in a file

    - by SuperUserMan
    EDITED THE QUESTION as regarding type of solutions I am on Windows & some suggested SED etc. So i am OK with these 3rd party standalone exe's using command line Say i have following lines in abc.txt file "@yuy007 what are you doing friend #disneyrocks" "STFU, i dont care what you think @happy55" "@social88 @gg99 ok mate see you at the subway :)" "btw arnold was great in that movie @tt11 @gg11 #disneyrocks" "we are going to disney. Do you want to? #disneyrocks" "We dont like disney.#disneyrocks we are not going" ".@socialguy what are you upto #disneyrocks " I need to employ 5 filters with above file to get def.txt Delete all lines which start with @ character, like 1st and 3rd Delete all lines which start with .@ characters, like 7th Delete all lines which don't have any word starting with # like 2nd and 3rd In leftover lines, Delete all words starting with @ character (keeping the lines intact) like words @happy55 in 2nd , @social99 & @gg99 in 3rd, etc. In this case we still need to preserve quotes " at start and end of line Delete all the blank lines left after above lines are removed EDIT if i have following line , it wrongly deletes the content after @word's "btw arnold was great in that movie @tt101 @gb1997 #whatthehell" is edited to "btw arnold was great in that movie" Thanks

    Read the article

  • username and password for rsync in script

    - by sims
    I'm creating a cron job to keep two dirs in sync. I'm using rsync. I'm running an rsync daemon. I read the manual and it says: RSYNC_PASSWORD Setting RSYNC_PASSWORD to the required password allows you to run authenticated rsync connections to an rsync daemon without user intervention. Note that this does not supply a password to a shell transport such as ssh. USER or LOGNAME The USER or LOGNAME environment variables are used to determine the default username sent to an rsync daemon. If neither is set, the username defaults to 'nobody' I have something like: #!/bin/bash USER=name RSYNC_PASSWORD=pass DEST="server::module" /usr/bin/rsync -rltvvv . $DEST I also tried exporting (dangerous, I know) USER and RSYNC_PASSWORD. I also tried with LOGNAME. Nothing works. Am I doing this correctly?

    Read the article

  • Cisco Configuration backup with Windows Script.

    - by Jeff
    We have a client with a lot of Cisco Devices and we would like to automate the backups of these devices through telnet. We have both 2003 and 2008 servers and ideally use tftp to back it up. I wrote this: Set WshShell = WScript.CreateObject("WScript.Shell") Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim ciscoList ciscoList = "D:\Scripts\SwitchList.txt" Set theSwitchList = fso.OpenTextFile(ciscoList, 1) Do While theSwitchList.AtEndOfStream <> True cisco = theSwitchList.ReadLine Run "cmd.exe" SendKeys "telnet " SendKeys cisco SendKeys "{ENTER}" SendKeys "USERNAME" SendKeys "{ENTER}" SendKeys "PASSWORD" SendKeys "{ENTER}" SendKeys "en" SendKeys "{ENTER}" SendKeys "PASSWORD" SendKeys "{ENTER}" SendKeys "copy startup-config tftp{ENTER}" SendKeys "(TFTP IP){ENTER}" SendKeys "FileName.txt{ENTER}" SendKeys "exit{ENTER}" 'close telnet session' SendKeys "{ENTER}" 'get command prompt back SendKeys "{ENTER}" SendKeys "exit{ENTER}" 'close cmd.exe On Error Resume Next WScript.Sleep 3000 Loop Sub SendKeys(s) WshShell.SendKeys s WScript.Sleep 300 End Sub Sub Run(command) WshShell.Run command WScript.Sleep 100 WshShell.AppActivate command WScript.Sleep 300 End Sub But the problem with this is the sendkeys are sent to the console session, I'm trying to find a solution that would not require a user to be logged in. Does anyone have any ideas? I have some knowlage of VBS, PowerShell and a pretty good grasp on batching.

    Read the article

  • Obtaining list of files from php script?

    - by SenorSputnik
    Naenara/KCCKP offers a catalog of hundreds of mp3 files that can only be downloaded in small amounts at a time. Clicking on a song title invokes mp3player.php and downloads a plaintext link to the mp3 file: http://www.kcckp.net/mp3player.php?e+8 Going directly to mp3player.php will display Korean error messages and send you back 1 page in your history. Is there any way to parse/coax mp3player.php into dumping a full list of mp3 links? I am sorry if this is a painfully easy or impossible task, I have not even begun to delve into php. </newbiewhining>

    Read the article

  • How to script Win7 start menu customizations using powershell

    - by mandrake
    I'm creating an unattended installation of Windows 7 and like to customize the start menu programmatically. The goal is a minimalistic start menu with only "All applications" and perhaps a pinned program link. Is this scriptable using powershell (or perhaps wsh)? And is it possible to change this on the default user template so that new users inherit these changes? Code samples or documentation regarding this would be nice. Summary of changes I'd like to make: Change privacy settings "store recently opened programs" (and items) Don't display... Control panel. Connect to. Etc Pin program to start menu

    Read the article

  • Batch Script to Trim lines in text to first 30 or 50 characters only

    - by SuperUserMan
    I am now new to scripts but i find it really difficult understanding "for" command (especially with that tokens and delimiters etc) . Saying so, i think that for command can be used to do what i am doing. If its not and there is an easier way, ignore my ignorance :( Say i have multiple lines in a text file abc.txt with each line starting and ending with " (quotes) E.g. a file of 3 lines "hey what is going on @mike220. I am working on your car. Its engine is in very bad condition" "Because if you knew, you'd get shredded and do it with certainty" "@honey220 Do you know someone who has busted their ass on a diet only for results to come to a screeching halt after a few weeks" How can i trim each line, within the quotes, to a Fixed length say 30 or 50 or 100 characters (including spaces) I want to enter the number of character in batch and it can trim accordingly and produce a file def.txt with trimmed lines within quotes. Say i enter 50, results of above example should be "hey what is going on @mike220. I am working on you" "Because if you knew, you'd get shredded and do it" "@honey220 Do you know someone who has busted their" Thanks P.S. if you use For command, kindly please explain the command. EDIT: Though the answer provided worked, there is an issue with non english text. I am getting garbled text in Output file for non english text in input file . Any help @barlop here is the nonenglish text ( 1 line) "???? ?? ???? ?? ???? ???? ??? ?????? ???"

    Read the article

  • jquery selector problem with script tags

    - by Tauren
    I'm attempting to select all <script type="text/html"> tags in a page. I use <script> tags to store HTML templates, similar to how John Resig does it. For some reason, the following jquery selector doesn't seem to be selecting anything: $("script[type*=html]").each(function() { alert("Found script "+this.id); }); This markup is in the BODY of the HTML document: <body> <script id="filter-search" type="text/html"> <dt>Search</dt> <dd><input type="text"/></dd> </script> </body> I've also tried putting it into the HEAD of the HTML document, and it is still not found. No alert is ever shown. If I instead change my code to this: $("script[type*=javascript]").each(function() { alert("Found script "+this.id); }); Then it finds only the scripts in the HEAD that have a src to an external file. Scripts in the actual page are not found. For instance, with the following in HEAD: <head> <script type="text/javascript" src="jquery.js" id="jquery"></script> <script type="text/javascript" src="jquery-ui.js" id="ui"></script> <script type="text/javascript" id="custom"> $(document).ready( function() { $("script[type*=javascript]").each(function() { alert("Found script "+this.id); }); $("script[type*=html]").each(function() { alert("Found TEMPLATE script "+this.id); }); }); </script> <script id="filter-test" type="text/html"> <dt>Test</dt> </script> </head> <body> <script id="filter-search" type="text/html"> <dt>Search</dt> <dd><input type="text"/></dd> </script> </body> I get the following alerts: Found script jquery Found script ui The custom and filter-test scripts in the HEAD are not selected, nor is the filter-search script in the body tag. Is this the expected behavior? Why does this not work? I can work around it, but it is annoying that it doesn't work.

    Read the article

  • File does not exist: D:/wamp/www/script/products, referer: http://localhost/script/products/category

    - by Imran Naqvi
    Hi i am getting the following error File does not exist: D:/wamp/www/script/products, referer: http://localhost/script/products/category/product-123.html whenever in apache error log whenever following url http://localhost/script/products/category/product-123.html is parsed through this RewriteRule ^products/([~A-Za-z0-9-"]+)/([~A-Za-z0-9-".]+).html$ index.php?page_type=products&prod=$2 [L] .htaccess rule. Please can someone help me ???? The script and rule is working fine but i am getting that error in apache error log

    Read the article

  • Loading a javascript library in javax.script?

    - by Shane
    I want to run Protovis javascript from Java and get the evaluated SVG code. I am using javax.script.* to run the Javascript: public static void EvalScript() throws Exception { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); Object result = engine.eval("var vis = new pv.Panel().width(300).height(300) .add (pv.Line).data ([1,0.5, 0.1, 0.01, 0.001, 0.3, 0.2,0.1,1]) .left (function () { return this.index * 30; }) .bottom (function (d) { return d * 250; }); vis.root.render(); vis.scene[0].canvas.innerHTML;"); System.out.println(result); } This would complain because I never loaded Protovis itself, as would ordinarily be done with <script type="text/javascript" src="../protovis-r3.1.0.js"></script> Is there a good way, short of sourcing in the full Javascript into the eval() command, of loading a library when running Javascript through javax.script? (Incidentally, I know of examples that use Rhino to do this from the Google discussion group.)

    Read the article

  • R plotting multiple histograms on single plot to .pdf as a part of R batch script

    - by Bryce Thomas
    I am writing R scripts which play just a small role in a chain of commands I am executing from a terminal. Basically, I do much of my data manipulation in a Python script and then pipe the output to my R script for plotting. So, from the terminal I execute commands which look something like $python whatever.py | R CMD BATCH do_some_plotting.R. This workflow has been working well for me so far, though I have now reached a point where I want to overlay multiple histograms on the same plot, inspired by this answer to another user's question on Stackoverflow. Inside my R script, my plotting code looks like this: pdf("my_output.pdf") plot(hist(d$original,breaks="FD",prob=TRUE), col=rgb(0,0,1,1/4),xlim=c(0,4000),main="original - This plot is in beta") plot(hist(d$minus_thirty_minutes,breaks="FD",prob=TRUE), col=rgb(1,0,0,1/4),add=T,xlim=c(0,4000),main="minus_thirty_minutes - This plot is in beta") Notably, I am using add=T, which is presumably meant to specify that the second plot should be overlaid on top of the first. When my script has finished, the result I am getting is not two histograms overlaid on top of each other, but rather a 3-page PDF whose 3 individual plots contain the titles: i) Histogram of d$original ii) original - This plot is in beta iii) Histogram of d$minus_thirty_minutes So there's two points here I'm looking to clarify. Firstly, even if the plots weren't overlaid, I would expect just a 2-page PDF, not a 3-page PDF. Can someone explain why I am getting a 3-page PDF? Secondly, is there a correction I can make here somewhere to get just the two histograms plotted, and both of them on the same plot (i.e. 1-page PDF)? The other Stackoverflow question/answer I linked to in the first paragraph did mention that alpha-blending isn't supported on all devices, and so I'm curious whether this has anything to do with it. Either way, it would be good to know if there is a R-based solution to my problem or whether I'm going to have to pipe my data into a different language/plotting engine.

    Read the article

  • Write transparent HTTP Proxy script in PHP

    - by Leo Izen
    Is there an easy forwarding/transparent php proxy script that I can host on my web server? These are my conditions: I'm using free web hosting, so I have pretty much no control over my machine. Otherwise I could use Perl's HTTP::Proxy module. This means no root password. It does run php though. I already have a server running on port 80. What I mean is I would like to put a php script as index.php on my server that will forward all requests. I don't want a script like PHProxy or Glype where I go to the site, then enter a URL. I want a server so I can enter proxy.example.com:80 in Firefox's or IE's or whatever's proxy settings and it will forward all requests to the server. Preferably (though not fatal if not possible) I would like for it to pass on the USER_AGENT environmental variable (That's the browser) instead of setting itself to be the USER_AGENT I can't start a new Daemon. My server won't allow it. Is there a script that will do this? If so, which?

    Read the article

  • Ubuntu - Ruby Daemon script creates two processes - sh and ruby - PID file points at sh, not ruby

    - by Jonathan Scoles
    The PID file for a ruby process I have running as a daemon is getting the wrong PID. It appears that running /etc/init.d/sinatra start creates two processes - sh and ruby, and the PID that ends up in the PID file is that of the sh process. This means that when I then run /etc/init.d/sinatra stop or /etc/init.d/sinatra restart, it is killing sh and leaving the ruby process still running. I'd like to know a) why is my script launching two processes - sh and ruby, and not just ruby, and b) how do I fix it to just launch ruby? Details of the setup: I have a small Sinatra server set up on an ubuntu server, running as a daemon. It is set to automatically at server startup run a script named sinatra in /etc/init.d that launches the a control script control.rb, which then runs a ruby daemon command to start the server. The script is run under the 'sinatrauser' account, which has permissions for the directories the script needs. contents of /etc/init.d/sinatra #!/bin/bash # sinatra Startup script for Sinatra server. sudo -u sinatrauser ruby /var/www/sinatra/control.rb $1 RETVAL=$? exit $RETVAL To install this script, I simply copied it to /etc/init.d/ and ran sudo update-rc.d sinatra defaults contents of /var/www/sinatra/control.rb require 'rubygems' require 'daemons' pwd = Dir.pwd Daemons.run_proc('sinatraserver.rb', {:dir_mode => :normal, :dir => "/opt/pids/sinatra"}) do Dir.chdir(pwd) exec 'ruby /var/www/sinatra/sintraserver.rb >> /var/log/sinatra/sinatraOutput.log 2>&1' end portion of output from ps -A 6967 ? 00:00:00 apache2 10181 ? 00:00:00 sh <--- PID file gets this PID 10182 ? 00:00:02 ruby <--- Actual ruby process running Sinatra 12172 ? 00:00:00 sshd The PID file gets created in /opt/pids/sinatra/sinatraserver.rb.pid, and always contains the PID of the sh instance, which is always one less than the PID of the ruby process EDIT: I tried micke's solution, but it had no effect on the behavior I am seeing. This is the output from ps -A f. This output looks the same whether I use sudo -u sinatrauser ... or su sinatrauser -c ... in the service start script in /etc/init.d. 1146 ? S 0:00 sh -c ruby /var/www/sinatra/sinatraserver.rb >> /var/log/sinatra/sinatraOutput.log 2>&1 1147 ? S 0:00 \_ ruby /var/www/sinatra/sinatraserver.rb

    Read the article

  • What is the difference between executing script using Cygwin and PuTTY?

    - by Lily
    Now I get a script.sh, previously it was executed using PuTTY provided it was written in VMWare, but now I want to execute in Windows using Cygwin, I already copy the script.sh out to the corresponding directory, but some commands Cygwin can not recognise. generate(){ date +%T } TIME = generate() echo " Current Time: $TIME" After execute in Cygwin script.sh: line 3: syntax errot neat unexpected token '$'<\r'' script.sh: line 3:'generate<><

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >