|
I want to write a certain program that will update a website with some new information everyday. Since my computer is not on 24/7, and I have web hosting, I was thinking of writing this in either php or python and have it run on the web server. I really have no idea how these things work, but would I need to have the script constantly be running? Or is there a way to have it run once per-day and then terminate? Or is there some easier way to do this? Thanks!
|
# ? Nov 13, 2008 15:50 |
|
|
# ? May 15, 2024 03:23 |
|
This depends on what kind of access you have to your web server. Running stuff periodically sounds like a cronjob, but if you just have webhosting, you probably cannot do that, or really do anything beyond responding to http requests.
|
# ? Nov 13, 2008 15:52 |
|
Vanadium posted:This depends on what kind of access you have to your web server. Running stuff periodically sounds like a cronjob, but if you just have webhosting, you probably cannot do that, or really do anything beyond responding to http requests. I'm not 100% sure if I can do cronjobs, but there is a section in cPanel labeled cronjobs. If I were able to do that, say I wanted to run a php script foo.php, would I just set the cronjob command to "php foo.php" ?
|
# ? Nov 13, 2008 16:28 |
|
Bodhi Tea posted:I'm not 100% sure if I can do cronjobs, but there is a section in cPanel labeled cronjobs. If I were able to do that, say I wanted to run a php script foo.php, would I just set the cronjob command to "php foo.php" ? Commandline php might run in a different environment if it is available at all than apache's mod_php, but it might work. I have no experience with cpanel, so just try it.
|
# ? Nov 13, 2008 18:26 |
|
Bodhi Tea posted:I'm not 100% sure if I can do cronjobs, but there is a section in cPanel labeled cronjobs. If I were able to do that, say I wanted to run a php script foo.php, would I just set the cronjob command to "php foo.php" ? Generally yes, but I've also had success using "wget" to get the page (wget is a command line tool to download a file. You can just have it do something like "wget -o /tmp/myfiletmp http://myserver.com/myfile.php". Alternately there are ways to have it email you when it fails, but I forget the specifics.
|
# ? Nov 14, 2008 01:59 |
|
Ugg boots posted:Generally yes, but I've also had success using "wget" to get the page (wget is a command line tool to download a file. You can just have it do something like "wget -o /tmp/myfiletmp http://myserver.com/myfile.php". Alternately there are ways to have it email you when it fails, but I forget the specifics. Thanks both of you, the wget solution seems to work.
|
# ? Nov 14, 2008 03:22 |
|
This is probably a moronic question but there's someone I know who wants to migrate a REALBASIC project to something more modern (because they're having problems finding developers, libraries, community). Rather than starting from scratch I guess they should modularise their code as a library, perhaps exposing interfaces in COM or .Net? It's just that I can't find any way out of realbasic, or any way to compile to something else. I'm hesitant to recommend a rewrite but what would you suggest?
|
# ? Nov 14, 2008 06:38 |
|
N.Z.'s Champion posted:This is probably a moronic question but there's someone I know who wants to migrate a REALBASIC project to something more modern (because they're having problems finding developers, libraries, community). Rather than starting from scratch I guess they should modularise their code as a library, perhaps exposing interfaces in COM or .Net? Trying to expose interfaces through COM directly will be more of a headache than just porting the whole thing, unless it was designed that way from the start. If Realbasic can target .NET, modularising to expose .NET interfaces and then do new development in Visual Basic is probably the way to go. Otherwise, I think you'll have to bite the bullet and port the whole thing to Visual Basic.
|
# ? Nov 14, 2008 07:22 |
|
So I'm using sybase and perl together, and I fork the perl process. The child process does its thing, and then I have it exit. When the child process dies, I get the below errors from the parent process the next time it tries to call a function with a sybase statement in it. Why the hell would the child process exiting invalidate a sybase statement? I've tried both prepare and prepare_cached methods. edit: I figured it out: http://www.perlmonks.org/?node_id=594175 baquerd fucked around with this message at 10:49 on Nov 14, 2008 |
# ? Nov 14, 2008 09:08 |
|
In Haskell, let's say I have a list of coordinate pairs, and am interested in deleting anything that has a first of 4, while I don't care what the second value is. Is there anyway I can use the delete function for this, or do I have to write my own recursive function?
|
# ? Nov 14, 2008 15:15 |
|
Clock Explosion posted:In Haskell, let's say I have a list of coordinate pairs, and am interested in deleting anything that has a first of 4, while I don't care what the second value is. You will probably want to use filter, as in filter ((/=) 4 . fst) yourList.
|
# ? Nov 14, 2008 15:37 |
|
Vanadium posted:You will probably want to use filter, as in filter ((/=) 4 . fst) yourList. Haskell lets you write (/= 4), and it does what you think.
|
# ? Nov 14, 2008 19:21 |
|
rjmccall posted:Haskell lets you write (/= 4), and it does what you think. How is ((/= 4) . fst) better than ((/=) 4 . fst)?
|
# ? Nov 14, 2008 20:48 |
|
Vanadium posted:You will probably want to use filter, as in filter ((/=) 4 . fst) yourList. Bah! That's a good idea. Thanks!
|
# ? Nov 14, 2008 22:22 |
|
I wish I would use this place more often, lots of knowledge here. I'm working on a Google Maps app. I have an event listener for a click on the map. The click passes the latlng to a javascript function. I'd like the javascript function to then pass the latlng to a seperate php script (external file). The php script takes the latlng, queries a DB and gets some XML data back, does some formatting, then generates a HTML string. The php script would then pass back the HTML string, which could be opened in the Google Map in an infoWindow. I'm getting hung up on how do I go from javascript->php->javascript. code:
|
# ? Nov 15, 2008 00:03 |
|
XMLHttpRequest, and some more asynchronicity than you are using right now?
|
# ? Nov 15, 2008 00:58 |
|
Vanadium posted:How is ((/= 4) . fst) better than ((/=) 4 . fst)? Well, the grouping is more obvious, but you're right, it doesn't make a difference in this case.
|
# ? Nov 15, 2008 02:24 |
|
Does anyone have an easy way to implement web services in Java? I've done them in C# with Visual Studio 2003 at a previous job and it was fairly easy overall (create web service project, setup the service, setup client to call the webservice). Our professor said to use this: http://java.sun.com/webservices/docs/2.0/tutorial/doc/index.html I spent several hours attempting to get hello world to work using glassfish but had no idea where the magical build.xml file comes from and I just couldn't get asant create-war to work. I have many more important projects to do right now for school so I won't have time to do anything too complicated but if there's a straight forward solution I'd rather try that before giving up.
|
# ? Nov 17, 2008 02:32 |
|
Is there a decent way to debug a Haskell through a program like gdb or something of that sorts, or am I forced to do it pen and paper? I have a function that keeps returning an empty list, and I don't know why. It's times like this that makes me wish I was using Visual Studio...or even Eclipse for that matter. EDIT: While my question still stands, I just wanted to inform the Cavern that I am an idiot who should remember to make sure that he doesn't call a function by a state where it only gives you an empty list. ndb fucked around with this message at 10:01 on Nov 17, 2008 |
# ? Nov 17, 2008 08:27 |
|
You can use GHCi for debugging, which would be simpler than trying to coax gdb into it. I don't know about Hugs or whatever, though.
|
# ? Nov 17, 2008 12:27 |
|
Debugging Haskell kind of really goes against the grain of strongly typed functional programming. Haskell programs are pure and have no concept of state. They're an equation instead of a series of steps. So if your function typechecks but is still giving you wrong results, try thinking and reasoning about your function a bit more. If that doesn't work, go into GHCI and try to transform some input into your desired output and then see what you did along the way.
|
# ? Nov 17, 2008 14:24 |
|
Where could I find decent free 3rd part information on learning how run windows scripts ala running remote executables and running remote install scripts for software
Bishop01 fucked around with this message at 01:30 on Nov 19, 2008 |
# ? Nov 19, 2008 01:03 |
|
Can someone give me a common sense explanation, or link to one, explaining the difference between local and global variables? I think I've got the gist of it almost, but it still seems confusing in practice somehow.
|
# ? Nov 19, 2008 01:21 |
|
The Remote Viewer posted:Can someone give me a common sense explanation, or link to one, explaining the difference between local and global variables? I think I've got the gist of it almost, but it still seems confusing in practice somehow. What language? For most common languages all variables belong in a scope. This scope defines where the variable can be used. Global variables have global scope, which means ANYBODY in the program can modify them (this can be very dangerous!). Local variables means that the scope is limited to the local block (usually we talk about function scope for a particular function) and once you've exited the block/function, that variable no longer exists.
|
# ? Nov 19, 2008 01:39 |
|
chocojosh posted:What language? For most common languages all variables belong in a scope. This scope defines where the variable can be used. Global variables have global scope, which means ANYBODY in the program can modify them (this can be very dangerous!). Local variables means that the scope is limited to the local block (usually we talk about function scope for a particular function) and once you've exited the block/function, that variable no longer exists. Python. I think what might be confusing me is the example: code:
code:
|
# ? Nov 19, 2008 01:58 |
|
The Remote Viewer posted:The example is confusing enough that I'm having trouble extracting exactly what point I'm supposed to get out of it. What if we assigned a value to x before the function, would it change from 50 to 2 (when the function is called) and then back to 50, or does the local variable exist independently when func(x) is being called? It exists independently. The point you're supposed to get is that the x in func is not the same x as in the code calling func. The lesson is that all names are local to the scope in which they're defined. edit: This is called passing by value, by the way - the parameters passed to a function are copied, and local changes to them don't persist. Passing by reference causes the actual object to be passed to the function instead of a copy, and any local changes to them persist after the function call. csammis fucked around with this message at 02:05 on Nov 19, 2008 |
# ? Nov 19, 2008 02:02 |
|
The Remote Viewer posted:
Ah, in this example you're creating a new x variable for your function that is not related to the outside environment. Since you're creating a new x, when you're in that function, talking about x is talking about the local one (the argument.) See if you understand this example: code:
code:
|
# ? Nov 19, 2008 02:03 |
|
The Remote Viewer posted:Python. I think what might be confusing me is the example: One suggestion may be to try what you want to see. "What if we assigned a value to x before the function" -- try it! The thing here is you have a global x (x = 50), which is outside the function call. The function func accepts a parameter, which is also called x. This parameter ("local variable") exists independently of the global x. You may find it easier to understand if you change func as follows: def func(y): print 'y is', y y = 2 print 'Changed local y to', y Edit: beaten.
|
# ? Nov 19, 2008 02:04 |
|
csammis posted:It exists independently. The point you're supposed to get is that the x in func is not the same x as in the code calling func. The lesson is that all names are local to the scope in which they're defined. So basically it exists in a vacuum whenever the function is called, and then goes poof afterwards? That's what I had assumed, I might be just be assuming things are more complicated than they are. Another thing that's confusing me from the same page: In the example I posted, the function is func(x). In the next example, which is exactly the same except x is defined as global, it's just func(). Is this a significant difference? Why does it have a parameter of x in the first example?
|
# ? Nov 19, 2008 02:08 |
|
The Remote Viewer posted:Another thing that's confusing me from the same page: In the example I posted, the function is func(x). In the next example, which is exactly the same except x is defined as global, it's just func(). The lesson is all about variable scope and naming, right? Presumably it's to show that things happen differently when you pass a variable to a method rather than leave a variable at the global scope and have a method operate on it.
|
# ? Nov 19, 2008 02:15 |
|
csammis posted:The lesson is all about variable scope and naming, right? Presumably it's to show that things happen differently when you pass a variable to a method rather than leave a variable at the global scope and have a method operate on it. Yes, I'm not sure what a method is, though. Let me reproduce the second example so we're all on the same page. code:
|
# ? Nov 19, 2008 02:29 |
|
func() changes a specific x that any other function can use. func(x) changes a copy of whatever variable you pass to it. "Method" is a synonymn for "function."
|
# ? Nov 19, 2008 02:35 |
|
Bishop01 posted:Where could I find decent free 3rd part information on learning how run windows scripts ala running remote executables and running remote install scripts for software What does this even mean???
|
# ? Nov 19, 2008 09:12 |
|
how would I make an input box in vbscript that accepts multiple lines? like a comment box, but im passing the comment into some variable.
|
# ? Nov 19, 2008 23:43 |
|
rugbert posted:how would I make an input box in vbscript that accepts multiple lines? like a comment box, but im passing the comment into some variable. <textarea>? I haven't used vbscript, but I'm pretty sure that's the HTML tag..
|
# ? Nov 20, 2008 00:25 |
|
dumb MATLAB Q: I'm trying create a set of vectors which includes every possible combination of 1 and 0 in the n elements of the vector. My first idea is making the set, putting 1 in the first element for the first half of the vectors, then putting 1 in the second element for the first quarter and 3rd quarter of the vectors, and so on. So, for n = 3, I'd get these 8 vectors in this order: code:
|
# ? Nov 20, 2008 13:07 |
|
Turkmenbashi posted:dumb MATLAB Q: I'm trying create a set of vectors which includes every possible combination of 1 and 0 in the n elements of the vector. I have no clue about MATLAB so this might very well be a stupid idea.
|
# ? Nov 20, 2008 14:36 |
|
quadreb posted:<textarea>? I haven't used vbscript, but I'm pretty sure that's the HTML tag.. yea it is, I need it in just VBS. I have a script that spoofs email in my domain: code:
rugbert fucked around with this message at 18:50 on Nov 20, 2008 |
# ? Nov 20, 2008 17:22 |
|
I am starting my first software development job in about a month and a half, and I want to get a good understanding of the software development life cycle. Are there any good books on this subject?
|
# ? Nov 20, 2008 19:31 |
|
|
# ? May 15, 2024 03:23 |
|
Vanadium posted:Would you not just count up to 2^n, and then set the elements of the current vector to 1 that correspond to the bits that are set in the counter? No, I should be able to implement that. Thanks!
|
# ? Nov 21, 2008 00:16 |