|
the posted:Bleh. My professor assigned a numerical programming assignment for physics. He lets us use any language, but he decided this time to give us something that required such lengthy computation that using anything besides Fortran and C would be impossible. Well, maybe. Is this a physics class that uses numerical computing or a numerical computing class that uses physics? Especially in the former case, the Fortran may not be using the fastest algorithm for whatever you're doing, or it might be doing something stupid to slow down a fast algorithm (eg. walking through a matrix in row-major order [this is a misnomer but you probably know what I mean], which is fast in C but slow in Fortran), or it might be using more virtual memory than you have physical memory so it's hitting swap and slowing to a crawl, or whatever.
|
# ? Mar 12, 2013 20:53 |
|
|
# ? May 29, 2024 16:46 |
|
the posted:Bleh. My professor assigned a numerical programming assignment for physics. He lets us use any language, but he decided this time to give us something that required such lengthy computation that using anything besides Fortran and C would be impossible. If I were in your shoes I'd try NumPy.
|
# ? Mar 12, 2013 21:06 |
|
the posted:Bleh. My professor assigned a numerical programming assignment for physics. He lets us use any language, but he decided this time to give us something that required such lengthy computation that using anything besides Fortran and C would be impossible. Sounds like a good simulation of the real world.
|
# ? Mar 12, 2013 21:18 |
|
Otto Skorzeny posted:Well, maybe. Is this a physics class that uses numerical computing or a numerical computing class that uses physics? Especially in the former case, the Fortran may not be using the fastest algorithm for whatever you're doing, or it might be doing something stupid to slow down a fast algorithm (eg. walking through a matrix in row-major order [this is a misnomer but you probably know what I mean], which is fast in C but slow in Fortran), or it might be using more virtual memory than you have physical memory so it's hitting swap and slowing to a crawl, or whatever. It's a normal Physics course (Electromagnetism to be exact) that occasionally has programming assignments (I've posted about them before in the Python thread here and Numerical/Scientific thread in SAL). It's using RK2 approximation on a giant sphere of rotating current with respect to two different differential equations. In the assignment he uses the phrase, "Write a computer code to solve the Maxwell equations for the current sphere using RK2. You will need to use a compiled language, such as fortran or C; otherwise your code will be hopelessly slow." GrumpyDoctor posted:If I were in your shoes I'd try NumPy. I'm already using both numpy and scipy packages. the fucked around with this message at 21:46 on Mar 12, 2013 |
# ? Mar 12, 2013 21:44 |
|
Try adding http://pypy.org/ and maybe some of it is parallelizeable?
|
# ? Mar 12, 2013 21:57 |
|
Does anyone know if it is theoretically possible to make a Windows 8 touchscreen app that creates a graphic overlay that runs on top of other apps and has buttons that respond to touch without deactivating touch controls on the underlying app?
|
# ? Mar 13, 2013 01:18 |
|
If I wanted to write a toy operating system for a toy architecture, is Modern Operating Systems the book to buy?
|
# ? Mar 13, 2013 02:45 |
|
the posted:Bleh. My professor assigned a numerical programming assignment for physics. He lets us use any language, but he decided this time to give us something that required such lengthy computation that using anything besides Fortran and C would be impossible. JITs are very good these days. LuaJIT, PyPy, and recent JVMs can all approach (or in some cases exceed, thanks to dynamic optimization) C performance once they warm up. There are higher startup costs, but if you're going to be running one long-running computation rather than spawning lots of short-lived processes, that isn't a problem. And even if you don't have a JIT, in many languages it's possible to write a small module in C to handle the really computation-intensive part and do everything else around it in a HLL. If the problem is amenable to parallelization (I'm not a physics guy), some of these languages make that much easier to do than it would be in C or Fortran, too. (and on the flip side, just using a compiled language doesn't automatically make things fast. If you choose the wrong algorithm your code will run like poo poo on any reasonably-sized input even if, on paper, it's 10x faster than the interpreted equivalent. And if you're using something like Haskell, the "wrong" algorithm will sometimes blow everything else away because the compiler can optimize away most of it, while the "right" algorithm will turn out to have horrifying space complexity and send you into swap instantly.)
|
# ? Mar 13, 2013 02:46 |
|
ToxicFrog posted:JITs are very good these days. LuaJIT, PyPy, and recent JVMs can all approach (or in some cases exceed, thanks to dynamic optimization) C performance once they warm up. This is true mostly in contrived cases ToxicFrog posted:And even if you don't have a JIT, in many languages it's possible to write a small module in C to handle the really computation-intensive part and do everything else around it in a HLL. This is more on the ball; the poster in question mentioned he had tried Numpy and Scipy, which do exactly this with existing well optimized and tested Fortran and C routines.
|
# ? Mar 13, 2013 03:19 |
|
Not using numpy is the wrong answer to basically every problem that involves doing numerical simulation in python. Numpy is very fast. If you compile it against Intel's MKL or ATLAS then it's even faster. Your program can still be very slow if you do silly things like: code:
If your problem really is doing lots of little, dependent calculations in a tight loop then you should write it in C or cython and call it from python. Pypy and similar are non-options because as far as I know they're not supported by numpy and as I said above using python and not using numpy is basically always the wrong answer for numerical simulations.
|
# ? Mar 13, 2013 04:56 |
|
the posted:Bleh. My professor assigned a numerical programming assignment for physics. He lets us use any language, but he decided this time to give us something that required such lengthy computation that using anything besides Fortran and C would be impossible. edit: thought i had reached the bottom of the end. just use numpy!
|
# ? Mar 13, 2013 09:56 |
|
the posted:"You will need to use a compiled language, such as fortran or C; otherwise your code will be hopelessly slow." Here's the thing: your prof has told you that you need to use Fortran or C. If you get clever, use Python or whatever, and you can't make it work fast enough to satisfy the prof, he's going to say "this is why I told you to use a better language for this." There won't be a lot of sympathy or room for partial credit. Even if yours works faster than the other students' programs, written in C/Fortran/Assembler/whatever, he may still get pissy at you for not following his pretty clear instructions. It's also possible that he plans to follow up this assignment with another that builds on it, and that even if your Python wizardry makes this one work nicely, it will crumble under the additional strain you'll put on it later. If you use Python/Ruby/Perl/Excel, you're basically gambling that you can show the prof he's wrong, and get points for being so industrious and free-thinking. There are lots of ways that can go wrong, many of them involving the prof not being wrong after all. If you're really interested in seeing if you can do it, then I suggest that you work out the program in a compiled language, like he said, then re-implement it in whatever interpreted syntax you want, and do some comparisons between the approaches. THAT's how you brown-nose. Also, is Matlab an option for you? Though it's interpreted at the command line and even when running scripts, it's designed to run pretty fast for math stuff, and I think there used to be a compiler module you could get to generate executable files from it when you need some extra speed. Peristalsis fucked around with this message at 14:34 on Mar 13, 2013 |
# ? Mar 13, 2013 14:30 |
|
Peristalsis posted:Also, is Matlab an option for you? Though it's interpreted at the command line and even when running scripts, it's designed to run pretty fast for math stuff, and I think there used to be a compiler module you could get to generate executable files from it when you need some extra speed. Please don't do this to people.
|
# ? Mar 13, 2013 17:39 |
|
Bunny Cuddlin posted:If I wanted to write a toy operating system for a toy architecture, is Modern Operating Systems the book to buy? My course used Operating System Concepts, which was just fine. What toy architecture?
|
# ? Mar 13, 2013 17:52 |
|
JawnV6 posted:My course used Operating System Concepts, which was just fine. What toy architecture? Right now I'm using SIC, from this book that I used in school a while ago. I think I'm going to end up designing my own toy architecture as part of this project, though, primarily because SIC is subroutine-oriented and doesn't have enough spare GP registers to make a workable stack-based system (and I'm worried the publisher will get upset if I end up writing blog posts about it or something). This just a for-fun project that I don't have any timeline for completing so limiting my goals isn't really a concern.
|
# ? Mar 13, 2013 18:23 |
|
JawnV6 posted:My course used Operating System Concepts, which was just fine. What toy architecture? This book provides a decent overview of concepts, but implementation strategies tended to be beyond the scope of the book. Some chapter assignments were to implement the concepts of the chapter into Linux, but they rarely went into much detail about how to complete the assignment. If you know what you're trying to do and just want an overview on the cost-benefit of different strategies, this is a great book. But if you're looking for a book that will hold your hand though each step of implementing an OS, it would be wise to look elsewhere.
|
# ? Mar 13, 2013 20:02 |
|
How do I insert mathematical scripts (like a superscript 2 to denote a square) into jEdit? Perhaps the question is more about R, I'm trying to have an axis label that uses a superscript. This isn't making it very clear. http://127.0.0.1:27256/library/grDevices/html/plotmath.html actionjackson fucked around with this message at 21:16 on Mar 13, 2013 |
# ? Mar 13, 2013 21:01 |
|
I didn't realize Operating Systems: Design and Implementation had an edition as new as Modern OS. I think I'm going to go with that. Edit: Now that I've decided on an OS book, any recommendations on an architecture book? I have a second edition of Computer Architecture by Hennessy and Patterson, is the current (linked) version of that text worth buying? Is there something else I should look at? Bunny Cuddlin fucked around with this message at 22:09 on Mar 13, 2013 |
# ? Mar 13, 2013 21:58 |
|
Bunny Cuddlin posted:I didn't realize Operating Systems: Design and Implementation had an edition as new as Modern OS. I think I'm going to go with that. Tanenbaum's architecture book is pretty good as well.
|
# ? Mar 13, 2013 23:38 |
|
Bunny Cuddlin posted:I didn't realize Operating Systems: Design and Implementation had an edition as new as Modern OS. I think I'm going to go with that. what the gently caress has been going on in the world of CS textbook cover art
|
# ? Mar 13, 2013 23:54 |
|
Delightfully insane covers is a longstanding tradition for CS textbooks.
|
# ? Mar 14, 2013 00:24 |
|
Deus Rex posted:what the gently caress has been going on in the world of CS textbook cover art Seriously- you want me to believe it's a textbook about operating systems without a single god damned dinosaur on the cover?
|
# ? Mar 14, 2013 00:25 |
|
I'm trying to create a .htaccess RewriteRule that will match the first part of the url path up until the very first '/'. For example: http://www.asdf.com/test/hello/something/ would only match "test". So far the best I can come up with is: RewriteRule ^(.*?)/$ RewriteRule ^(.*?)$ But this will return: 'test/hello/something' and won't stop at the first '/'. I've tried a few searches, but I can't seem to find anything that works and I feel like I'm entirely off on the whole thing. Any help would be appreciated, thanks!
|
# ? Mar 14, 2013 01:26 |
|
I'm not too familiar with rewrite rules, but the $ at the end is forcing it to go all the way to the end of the string. So try just ^(.*?)/ and see if that works.
|
# ? Mar 14, 2013 01:31 |
|
yaoi prophet posted:I'm not too familiar with rewrite rules, but the $ at the end is forcing it to go all the way to the end of the string. So try just ^(.*?)/ and see if that works. Holy loving poo poo I feel like an idiot. I thought the $ on the end was for keeping the matched string as a variable for the rest of the rewrite. Thank you, good sir.
|
# ? Mar 14, 2013 01:33 |
|
Stephen posted:Holy loving poo poo I feel like an idiot. I thought the $ on the end was for keeping the matched string as a variable for the rest of the rewrite. Ah, balls. This breaks the URLs for all of my /css, /js and /images files now, even with the RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d lines in.
|
# ? Mar 14, 2013 02:06 |
|
I could probably help if you post more context for what exactly it is that you're trying to do, and what you have right now in terms of your .htaccess file.
|
# ? Mar 14, 2013 02:35 |
|
I am wondering about good forecasting/anticipation algorithms for predicting a fairly periodic, regular event. I'm trying to react to a change every minute, with a error of potentially a few seconds. Meanwhile, I'd like to keep the system otherwise occupied, to the point it wouldn't immediately respond to the change if it happened during the unresponsive period. I figure there are some approaches of this that teach itself after a little trial and error, and end up doing something like: time since reacting to last event + 0: Check for change. No change. Go unresponsive for 55 seconds time since reacting to last event + 55: Check for change. No change. Go unresponsive for 3 seconds time since reacting to last event + 58: Check for change. No change. Go unresponsive for 1 second time since reacting to last event + 59: Check for change. No change. Go unresponsive for 0.5 seconds time since reacting to last event + 59.5: Check for change. No change. Go unresponsive for 0.25 seconds time since reacting to last event + 59.75: Check for change. No change. Go unresponsive for 0.25 seconds time since reacting to last event + 60.00: Check for change. No change. Go unresponsive for 0.25 seconds time since reacting to last event + 60.25: Check for change. No change. Go unresponsive for 0.125 seconds ... [Change occurs] time since reacting to last event + 60.375: Check for change. Found change. React. Honestly I could probably just hard-code that and be done with it, but thinking about it made me wonder what else just might be out there anyways.
|
# ? Mar 14, 2013 06:44 |
|
Deus Rex posted:what the gently caress has been going on in the world of CS textbook cover art The second edition of Tanenbaum's OS book was pretty weird:
|
# ? Mar 14, 2013 12:52 |
|
Carthag posted:The second edition of Tanenbaum's OS book was pretty weird: This is fantastic. More CS text books need this kind of absurd yet strangely accurate humor. Knowing that something like this might be lurking a few pages ahead would definitely keep me reading.
|
# ? Mar 14, 2013 13:15 |
|
Carthag posted:The second edition of Tanenbaum's OS book was pretty weird: hahaha FAT-16 and FAT-32
|
# ? Mar 14, 2013 14:53 |
|
armorer posted:This is fantastic. More CS text books need this kind of absurd yet strangely accurate humor. Knowing that something like this might be lurking a few pages ahead would definitely keep me reading. If by strangely accurate you mean 'inaccurate'. Trojan horses do not poo poo core dumps.
|
# ? Mar 14, 2013 15:45 |
|
horse mans posted:If by strangely accurate you mean 'inaccurate'. Trojan horses do not poo poo core dumps. They do if they segfault
|
# ? Mar 14, 2013 16:17 |
|
horse mans posted:If by strangely accurate you mean 'inaccurate'. Trojan horses do not poo poo core dumps. That depends on your frame of reference. In terms of cartoon depictions of circus tents as metaphors for operating system concepts go, I'd say this one is pretty accurate.
|
# ? Mar 14, 2013 16:28 |
|
I have an old dbf from a Foxpro application that has a date field where the date is in the format of 2 ascii characters. I don't know but its possible other associated date information is missing from the dbf. But as an example Mû "might" represent today's date (3/14). Other examples include Mß or ;½ (might be a really old date) or MÝ They run the gamut, not just starting with M. I don't know if the rendered dbf is ordered by date.
|
# ? Mar 14, 2013 22:39 |
Ibsen posted:I have an old dbf from a Foxpro application that has a date field where the date is in the format of 2 ascii characters. I don't know but its possible other associated date information is missing from the dbf. But as an example Mû "might" represent today's date (3/14). Other examples include Mß or ;½ (might be a really old date) or MÝ I'm guessing your question is "how to decode that date"? I can think of two ways it can be encoded. Either as a set of bitfields, or as a number of days since some epoch. A likely bitfield representation would be 5 bits for day of month, 4 bits for month and 7 bits for year. If the database uses little endian integers it probably uses DMY ordering for the bitfields, otherwise YMD if it's big endian, based on those examples you gave. In little endian, Mû as an integer is 0xfb4d which is pretty high, in big endian it's 0x4dfb. If I treat either of those as a number of days and subtract it from 2013-03-14 I just get some random dates that don't look like they'd be chosen as the start of an epoch. (1958-07-18 and 1837-01-23 respectively.) Although I can't make out anything sensible from looking at it as bitfields either.
|
|
# ? Mar 14, 2013 23:08 |
|
Good information, nice shot anyways. Thanks. I'll post back here if I come up with anything else.
|
# ? Mar 15, 2013 16:02 |
|
I'm working on a little learning project. I want to make a little photo viewer thing with metadata and that sort of thing. I'd like to store everything (the photos and the metadata) in a database, presumably with SQLite, because that's one of the things I'm trying to learn with the project. However, I'm not sure the best way to iteratively develop a database application. Obviously I'm not going to be able to completely design the final database at the very beginning, because I'm totally new to this stuff. So what's the best way to make my little app able to read the "previous version" of the database? My initial thought is "make the application flexible in reading so that it can read the 'previous version' gracefully," but maybe there's a better way. Update scripts seem like more complexity than I'd like to deal with, although maybe SQLite makes that kind of thing easy. The project is Java (the other thing I'm trying to learn), if that matters.
|
# ? Mar 18, 2013 01:02 |
|
Look into database migrations. They specify changes to your schema. Usually you'll record in the db which migrations you've already run against that db. When your app opens the db, apply any newer migrations to bring the db up to the latest version. I don't know much about Java but I'm sure there's a library that's written to do exactly this. e: Also test out performance if you're dumping like 50MB+ blobs into SQLite. It won't fall apart or anything but it might slow down.
|
# ? Mar 18, 2013 01:15 |
|
|
# ? May 29, 2024 16:46 |
|
pokeyman posted:Look into database migrations. They specify changes to your schema. Usually you'll record in the db which migrations you've already run against that db. When your app opens the db, apply any newer migrations to bring the db up to the latest version. There is: http://flywaydb.org/documentation/database/ But it doesn't support SQLite. In Java, H2 is the database-as-a-file engine that seems to be the most convenient. I've used it before and it's decent -- and it also comes with a web interface. It's a little more of a 'proper' SQL, and it does work with Flyway for migrations.
|
# ? Mar 18, 2013 04:58 |