|
Newbie question, want to populate a database on a timer every morning, the data being made up off data I've scrapped from yahoo finance. I've written python methods to make calculations and scrap it, now I need a way to store each days scrap on a webserver that will also be hosting django. What is the best way to go about this?
|
# ? Mar 21, 2010 06:10 |
|
|
# ? Jun 8, 2024 04:28 |
|
Make it into a plain old cronjob, or, if you're feeling like a more Pythonic ( ) solution, you can look into the sched module, which I can't speak personally on.
|
# ? Mar 21, 2010 06:52 |
|
Dijkstracula posted:Make it into a plain old cronjob, or, if you're feeling like a more Pythonic ( ) solution, you can look into the sched module, which I can't speak personally on. Honestly, a cronjob is usually the most Pythonic way to run periodic tasks, because real Pythonistas know when the best tool for a job is one not written in Python And nothing says the cronjob can't be calling a Python script, of course.
|
# ? Mar 21, 2010 15:36 |
|
bitprophet posted:Honestly, a cronjob is usually the most Pythonic way to run periodic tasks, because real Pythonistas know when the best tool for a job is one not written in Python And nothing says the cronjob can't be calling a Python script, of course. The cleanest way to do this would be for the cron job to call a Python script. The script imports the models from the Django app, scrapes Yahoo finance, and populates the database using Django's model methods. If you know what cron is, you already know how to use Django, and you've already written the code to scrape then it shouldn't take more than 5 minutes.
|
# ? Mar 23, 2010 15:48 |
|
I wrote a quick little function in Lisp (ACL2 to be precise) to do compute the factorial of a number. Nothing fancy, just:code:
code:
|
# ? Mar 24, 2010 02:06 |
|
What do you mean by freaking out? Naive recursion grows the stack for reasons that are obvious, so you could be hitting your process stack size limit.
|
# ? Mar 24, 2010 02:09 |
|
define "freaking out". (e: fb)
|
# ? Mar 24, 2010 02:09 |
|
Hmm, could be stack overflow... Here, have a gigantically trimmed-down version of the output for (! 1362)code:
|
# ? Mar 24, 2010 03:56 |
|
NO! I DONT DO ANAL! posted:I wrote a quick little function in Lisp (ACL2 to be precise) to do compute the factorial of a number. Nothing fancy, just: quote:http://userweb.cs.utexas.edu/users/moore/publications/gentle-intro-to-acl2-programming.html
|
# ? Mar 24, 2010 17:30 |
|
NO! I DONT DO ANAL! posted:Hmm, could be stack overflow... Here, have a gigantically trimmed-down version of the output for (! 1362) Is there any reason you're using ACL2 in lieu of a nicer Lisp implementation (mzscheme, SBCL, Clojure, CLisp, etc.) for general programming? ACL2 is for computer-aided proofs, not general purpose programming. Here's the error generated by SBCL: code:
code:
defmacro fucked around with this message at 03:40 on Mar 25, 2010 |
# ? Mar 25, 2010 03:37 |
|
Anyone know how to mount an .iso file programmatically (in Windows) so that the files and their contents can be searched? I have many .iso files so would rather not do it a few at a time using Virtual CloneDrive.
|
# ? Mar 25, 2010 12:21 |
|
mincepiesupper posted:Anyone know how to mount an .iso file programmatically (in Windows) so that the files and their contents can be searched? I have many .iso files so would rather not do it a few at a time using Virtual CloneDrive. Why does it need to be mounted? I'm pretty sure 7-zip reads ISO files and can be run from the command line.
|
# ? Mar 25, 2010 15:44 |
|
I'm working on a personal project that might end up being a product at some point (and I'd like to retain that option). I've come upon a complicated section and I've found a GWT widget that fills the role EXACTLY, BUT it is licensed as GPLv3. Now, GWT code is compiled into Javascript, which would imply to me that GPL requires I make the entirety of my GUI code open source, but I wouldn't be modifying the GWT widget at all, just using it for a portion of my UI. So, which is it, is the compilation activity of GWT killing me and requiring me to make my entire project GPLv3, or can I include the widget without internal modification and call it an 'aggregate' usage of the widget? Or should I just e-mail the guy writing the code with my question and ask him to modify the license to one less stupid for GWT?
|
# ? Mar 26, 2010 04:22 |
|
If you want to use it, ask him to let you use it under different license terms (asking him to relicense it generally would probably be a non-starter for reasons you can guess). He probably won't if he specified GPLv3, and in that case, don't use it.
|
# ? Mar 26, 2010 04:36 |
|
FunOne posted:Or should I just e-mail the guy writing the code with my question and ask him to modify the license to one less stupid for GWT? He doesn't necessarily need to -change- the license, there's nothing preventing him from releasing the software under two different licenses. It's common for companies to do dual-licensing: You get the GPL version for free, but you can also pay a fee to get access to a version under a license that lets you keep your source closed.
|
# ? Mar 26, 2010 14:05 |
|
Maybe this isn't the right thread for someone who just wants to rant, but... Is it me or is Eclipse a steaming pile of poo poo? First the default Eclipse C/C++ install couldn't compile its own Hello World template without tweaking, then I find out the long painful way that printf() doesn't work, and now it's refusing to compile a project I'm working on, pointing to errors that are no longer there. (I deleted the lines, they're not even in the cpp file anymore!) I tried "Build Project" and "Clean Project" and even closing and reopening Eclipse which has worked for me with previous bugs. I've been programming Notepad-style for the last 5 hours, knowing the project won't compile and hoping I can fix things later. The OSS world really, really needs a quality IDE that can be mentioned in the same breath as Visual Studio if they want to recruit from the new generations of programmers.
|
# ? Mar 26, 2010 14:23 |
|
I'm trying to export multi-line text from Delphi (TRichEdit) into Excel. The problem is that all the CR/LFs are accompanied by a question mark in a box. If I copy that character and paste it elsewhere, its a CR/LF. In the string in Delphi it appears as '#$D#$A#$D#$A' (with the single quotes) I tried replacing it with the normal #13+#10, tried ascii replace, tried formatting the cell in Excel as text, drat things keep showing up. Any suggestions? E: Figured it out code:
Arms_Akimbo fucked around with this message at 15:42 on Mar 26, 2010 |
# ? Mar 26, 2010 14:53 |
|
Peao posted:The OSS world really, really needs a quality IDE that can be mentioned in the same breath as Visual Studio if they want to recruit from the new generations of programmers. Give NetBeans a shot http://netbeans.org/features/cpp/index.html It's significantly less annoying than Eclipse in my experience.
|
# ? Mar 26, 2010 16:50 |
|
Avenging Dentist posted:Why does it need to be mounted? I'm pretty sure 7-zip reads ISO files and can be run from the command line. Thankyou for that suggestion, I tried 7-zip out and it does exactly that.
|
# ? Mar 26, 2010 21:19 |
|
A question regarding MATLAB: I have an assignment to basically produce a "jumble" type of game, where a word (read randomly from a given list of words,) is scrambled up, and the user has to guess it. Where I am stuck right now is at the actual scrambling function. We were told to make a function that generates a random integer between two values, ok, I got that and it works fine. We are then told to use that function during the scrambling of the word. Here's the notes from the prof.: Algorithm for scrambling a word: for i = 1 : length(word) %once for each letter in the word select a random number between 1 and length(word) (let's call this r) swap the letter at index i and the letter at index r This makes sense at first, but then I think to much...what's stopping this loop from picking the same letter to swap multiple times? I mean...let's say we are scrambling the word "hello." We could get: "lehol" But isn't it possible to get: "leeho" instead? There is nothing stopping that loop, from what I can tell, from getting the same random number more than once. So how would I go about creating some kind of error check against that? I assume I'll have to store all of the 'r' values into a vector, and then compare the newest one generated with what's in there, and if it matches any of them, reject the number and try again?
|
# ? Mar 28, 2010 18:18 |
|
DrBouvenstein posted:But isn't it possible to get: There is only one "e" in the string "hello". No matter how many times you swap its position with some other letter, there will still only ever be one "e". What sequence of random numbers do you think will cause this result?
|
# ? Mar 28, 2010 18:22 |
|
ShoulderDaemon posted:There is only one "e" in the string "hello". No matter how many times you swap its position with some other letter, there will still only ever be one "e". What sequence of random numbers do you think will cause this result? But that's the thing, they aren't actually swapping! At least not using the algorithm given to us. All it's doing is making a new word based on random letters from the existing word, so you can get copies of the same letter. Here is my actual code: code:
code:
|
# ? Mar 28, 2010 18:33 |
|
DrBouvenstein posted:But that's the thing, they aren't actually swapping! At least not using the algorithm given to us. All it's doing is making a new word based on random letters from the existing word, so you can get copies of the same letter. DrBouvenstein posted:Algorithm for scrambling a word: Your pseudocode says to swap, not to create a new word. Your code is not doing the same thing as your pseudocode.
|
# ? Mar 28, 2010 18:37 |
|
ShoulderDaemon posted:Your pseudocode says to swap, not to create a new word. Your code is not doing the same thing as your pseudocode. OK, I see what you're saying. So if I just change my code to: code:
|
# ? Mar 28, 2010 18:54 |
|
DrBouvenstein posted:OK, I see what you're saying. So if I just change my code to: [snip] It should be ok? Edit: Wait, misread your new code. You need to swap, not just assign once. So, scrambled(i) needs to have the value that was in scrambled(r), and scrambled(r) needs to have the value that was in scrambled(i). You'll probably want to introduce a temporary variable for this.
|
# ? Mar 28, 2010 19:03 |
|
I'm not sure where to ask, but I am having trouble generating the correct SSL info in Plesk on a CentOS/Apache server. When I generate the CSR via Plesk and use that to create a 3rd party certificate, it supplies all the wrong data. The certificate says "test.domain.com" by "SomeCompany" and it fails to pass in the browser. I'd like to know where this info is pulled from on the server, because I've never entered it anywhere. I've gone through every field in Plesk and stored the correct data, so this is probably something outside of Plesk. I've been digging through openssl.cnf files via SSH, but none contain the data that is being supplied on the certificate, so I'm not sure which one to edit. Does anyone know where I can enter the SSL configuration for the entire server that Plesk pulls from?
Little Brittle fucked around with this message at 21:30 on Mar 28, 2010 |
# ? Mar 28, 2010 21:27 |
|
Little Brittle posted:I'm not sure where to ask, but I am having trouble generating the correct SSL info in Plesk on a CentOS/Apache server. When I generate the CSR via Plesk and use that to create a 3rd party certificate, it supplies all the wrong data. The certificate says "test.domain.com" by "SomeCompany" and it fails to pass in the browser. I'd like to know where this info is pulled from on the server, because I've never entered it anywhere. I've gone through every field in Plesk and stored the correct data, so this is probably something outside of Plesk. I've been digging through openssl.cnf files via SSH, but none contain the data that is being supplied on the certificate, so I'm not sure which one to edit. Does anyone know where I can enter the SSL configuration for the entire server that Plesk pulls from? This is a software problem, not a programming problem - check SH/SC tech support subforum?
|
# ? Mar 29, 2010 07:54 |
|
This may seem like an odd request, but can anyone point me in the direction of some interesting/old/possibly famous open source C++ code? I'm trying to learn it and I personally find that I get motivated well by giving myself a glimpse of what I'm eventually going to understand (does anyone else do this?). A 3D engine or physics simulator or something would be ideal.
|
# ? Mar 29, 2010 15:52 |
|
Inverse square posted:This may seem like an odd request, but can anyone point me in the direction of some interesting/old/possibly famous open source C++ code? I'm trying to learn it and I personally find that I get motivated well by giving myself a glimpse of what I'm eventually going to understand (does anyone else do this?). A 3D engine or physics simulator or something would be ideal.
|
# ? Mar 29, 2010 16:32 |
|
I'm working on this small python script for something school related. This being pretty much the first time I've done anything with python I've run into a problem that I can't seem to work out. I have a list that I must iterate over backwards so I have something like: code:
|
# ? Mar 29, 2010 18:40 |
|
What are you actually trying to do? I have no idea why you're doing what you're doing in that way, and the code you supply works on my end:code:
|
# ? Mar 29, 2010 18:55 |
|
Dijkstracula posted:What are you actually trying to do? Presumably sum = list[-1] - sum(list[:-1])
|
# ? Mar 29, 2010 19:01 |
|
Avenging Dentist posted:Presumably sum = list[-1] - sum(list[:-1])
|
# ? Mar 29, 2010 19:06 |
|
Inverse square posted:This may seem like an odd request, but can anyone point me in the direction of some interesting/old/possibly famous open source C++ code? I'm trying to learn it and I personally find that I get motivated well by giving myself a glimpse of what I'm eventually going to understand (does anyone else do this?). A 3D engine or physics simulator or something would be ideal. Famous? Quake I/II/III source code: http://www.idsoftware.com/business/techdownloads/ Vinterstum fucked around with this message at 20:06 on Mar 29, 2010 |
# ? Mar 29, 2010 20:04 |
|
Vinterstum posted:Famous? Quake I/II/III source code: http://www.idsoftware.com/business/techdownloads/ Doom 3 was the first C++ game engine from id Software.
|
# ? Mar 29, 2010 21:09 |
|
Also, it should be noted that if you're looking for good, clean C++ to learn good style from, a 3D engine that a) uses all sorts of tricks to squeeze performance out of and b) may have been rushed in order to meet a release deadline might not be the best choice.
|
# ? Mar 29, 2010 21:34 |
|
Carmack actually gave up some performance to unify light and shadows in the Doom 3 engine in a way he thought was elegant (and probably does fit with most people's naive mental model pretty well). This being said, Carmack's C was never very good looking and I doubt his C++ is much better. The code to the HL2 engine (called 'Source' for reasons that are comedic) got leaked years ago and is still floating around if you look, and is also very bad (unless you're looking for an example of why piecemeal growth and bolting poo poo on can be dangerous).
|
# ? Mar 29, 2010 21:40 |
|
Otto Skorzeny posted:Carmack actually gave up some performance to unify light and shadows in the Doom 3 engine in a way he thought was elegant (and probably does fit with most people's naive mental model pretty well). This being said, Carmack's C was never very good looking and I doubt his C++ is much better. The code to the HL2 engine (called 'Source' for reasons that are comedic) got leaked years ago and is still floating around if you look, and is also very bad (unless you're looking for an example of why piecemeal growth and bolting poo poo on can be dangerous). Also, thanks for the help so far, but how about just any 3D engine? I just wanna know what they look like.
|
# ? Mar 29, 2010 22:34 |
|
Inverse square posted:Thanks, and cripes that is so weird to hear. I'm still wet behind the ears; how is it possible that the source engine, something made in 2004 that I personally still think of as current gen, possibly be badly coded? Souce wasn't purpose built from scratch. If I remember correctly, it's an evolution of half life 1 code, which itself has adapted from Quakeworld source code, which was adapted from Quake source code. Theres probably more links in there that I'm not remembering.
|
# ? Mar 29, 2010 22:41 |
|
|
# ? Jun 8, 2024 04:28 |
|
Inverse square posted:Thanks, and cripes that is so weird to hear. I'm still wet behind the ears; how is it possible that the source engine, something made in 2004 that I personally still think of as current gen, possibly be badly coded? The HL2/Source engine is essentially the HL1/GoldSrc engine modified and with poo poo bolted on. The HL1/GoldSrc engine is a heavily modified version of the Quakeworld engine (which Valve licensed) with poo poo bolted on. Quakeworld is the Quake 1 engine with modified netcode and slightly different physics. So you've got a codebase from 1995 originally written in C, modified piecemeal several times, adapted to C++ and modified more, with 3rd party middleware (Havok physics) grafted in. When the code got leaked, it was found that a good bit of the Havok stuff was copy/pasted from the demo code from Havok's website, and that a fair amount of Carmack's old Quake code was recognizable after all the years. This all being said, I should say that the code isn't horrible per se, so much as a bad example to learn from. e: tripwire!!!
|
# ? Mar 29, 2010 22:50 |