|
rjmccall posted:Proper "lazy" evaluation (as it appears in e.g. Haskell) is a little more subtle than that, but yeah, you get the general idea. Yeah, after doing some more reading this is clear now, thanks
|
# ? Sep 16, 2008 07:16 |
|
|
# ? May 15, 2024 04:28 |
|
Vanadium posted:Can you implement cond with a macro, without using if or whatever? Here's IF without COND code:
There's IF. COND is based (generally) an IF, you could see some sample source here. Here's it defined with my IF: code:
ps: lisp rules defmacro fucked around with this message at 23:00 on Sep 16, 2008 |
# ? Sep 16, 2008 17:53 |
|
GT_Onizuka posted:ps: lisp rules Now if only someone would take all the cool features and put them into a useful language.
|
# ? Sep 16, 2008 18:29 |
|
Vanadium posted:Now if only someone would take all the cool features and put them into a useful language. that's cool, not enough parentheses though defmacro fucked around with this message at 18:37 on Sep 16, 2008 |
# ? Sep 16, 2008 18:34 |
|
Vanadium posted:Now if only someone would take all the cool features and put them into a useful language. That's pretty much what every language developement in the last 40 years has been (except for the "all").
|
# ? Sep 16, 2008 21:49 |
|
Vanadium posted:Now if only someone would take all the cool features and put them into a useful language. Man C++ needs a seperate symbol table for functions and variables.
|
# ? Sep 16, 2008 22:08 |
|
I have various data formats that drive a data import system. And some of these formats have one database table worth of information, which is easy to work with. Others have multiple tables. In either case, I want to see one row (one atomic concept) worth of information that is used by the rest of the data import system. So, with one table, each row is a complete entity. With the multiple tables, they need to be joined together (on a key, obviously), and together, they will represent one complete entity (similar to the one table scenario). My question is, how do I model/design this to handle an N amount of tables? I realize that for joins, you have a base table and then a set of auxilary tables, and each auxilary table has a join condition... How do I program this? Do I manually make an SQL statement that creates a view, and program this into the data format (implemented by a class)? Or do I somehow make a join condition per auxilary table and associate that with each auxilary table (implemented by metadata in a database)?
|
# ? Sep 17, 2008 15:33 |
|
I have extensive experience using MATLAB to write a variety of programs mostly related to image analysis. I have zero experience with anything that's lower-level than that, except a brief introduction to Java when I first learned MATLAB 5 years ago. However, I have begun feeling somewhat limited with only this experience and so I want to learn a more 'proper' language. I actually have a little project in mind that I want to do, and I feel that it would be a good opportunity to expand my horizons a bit. I could write this program very quickly in MATLAB, but aside from wanting to try something new, I also have an eye to eventually running it on Windows Mobile so I can use it on my phone. Will my experience with MATLAB be helpful as I delve into something new, or will it still feel like starting from scratch? I have a good but not formal understanding of complexity theory and so on from having to write time constrained programs, but at what point is it necessary for me to deepen this understanding with a more formal background (ie from classes or a proper text book or CS reference)? And finally, if I can actually do this and want to use it on my phone, is there anything in particular I should know about programming for Windows Mobile? Any languages that aren't well supported or different considerations I need to always keep in mind, like screen size?
|
# ? Sep 17, 2008 22:20 |
|
I'm not sure where the most appropriate place for this question is, but does anyone have a recommendation for a good SMS/Text Message API provider? Have you used any specific company before? This is a smaller project (maybe a couple hundred SMS messages a month) for a client and we're both located in the US, if that matters.
|
# ? Sep 18, 2008 00:01 |
|
Farrok posted:Will my experience with MATLAB be helpful as I delve into something new, or will it still feel like starting from scratch? I have a good but not formal understanding of complexity theory and so on from having to write time constrained programs, but at what point is it necessary for me to deepen this understanding with a more formal background (ie from classes or a proper text book or CS reference)? And finally, if I can actually do this and want to use it on my phone, is there anything in particular I should know about programming for Windows Mobile? Any languages that aren't well supported or different considerations I need to always keep in mind, like screen size? Knowing any programming language makes learning the next one easier, until you eventually can just pick them up, study the novel parts and get going. (I'm onto my 14th language. After a while, they all look the same ...) And Matlab is a decent structured language that basically Algolic, so you'll be in familiar territory with most modern programming languages. I think you can just leap in and worry about theoretical considerations a little later. Matlab has a lot of similarity to Python, which I'm a big fan of, but if you're looking to target WinMobile, it might not be the right choice. (There are people doing work with Python on mobile devices - but it's unclear to me if the tools are solid or if it's still at the the hacking stage.) In that case, it may make the most sense to target Windows tools and frameworks, so you're looking at .Net, C# and VB. More experienced people can tell you what the preferred approach is. Now my question: at my place of work (a scientific laboratory), there are people that spend their time manually classifying fly wings. That is, they receive a strange fly, photograph its wing, blow it up and compare it to a bunch of reference photographs to determine what species and strain the fly is. Apparently, flies have characteristic wing shapes and vascular patterns in their wing. While observing this, I idlely thought that this should be a relatively simple image analysis and categorisation problem. The photos are good quality, there's no background, and the wings are simple but distinctly different. But it's been years since I did anything with imaging. Any pointers on the sort of tech or algorithms I should be looking at? Even a bunch of buzzwords would give me something to google for.
|
# ? Sep 18, 2008 15:18 |
|
outlier posted:Useful Words Thanks for the info, thats quite helpful! As to your question, if the vein patterns are as regular for a given fly as you say, it should be quite easy to use any of a variety of image similarity measures to classify them. In particular, cross correlation or sum of square differences (especially the latter) are very easy algorithms to implement. The hard part is determining whether your image of interest needs to be translated or rotated in order to compare it to the reference image...that can be done manually, but then you might as well go ahead and classify it manually, too. You can use methods like gradient decent that iteratively approaches the the right orientation based on improvements in the similarity measures. Be sure if you try different measures that its easy to switch back and forth between looking for minima and looking for maxima, though. Sum of square differences is a perfect match if it is 0 and cross correlation is perfect if it is 1, for example.
|
# ? Sep 18, 2008 18:37 |
|
I want to write a program to access .map files from old Build engine games(specifically Blood), get the architecture information, and extract it as a model file for use in 3ds max. Only problem is, I have limited programming knowledge, I want to write it in Java as it's the only language I know, I can't find any information as to how the .map files are constructed, and I don't really know where to start. Does anyone have any suggestions?
|
# ? Sep 18, 2008 18:45 |
|
Boz0r posted:I want to write a program to access .map files from old Build engine games(specifically Blood), get the architecture information, and extract it as a model file for use in 3ds max. http://www.advsys.net/ken/build.htm For output into a format that art packages can read, you should probably investigate Collada.
|
# ? Sep 18, 2008 19:07 |
|
TSDK posted:Check out Ken Silverman's page for the source code and file format information: Thanks, that was actually pretty helpful. I think I'm going with the Wavefront OBJ. file format, as I know it already and it's pretty straightforward. Now I just have to interpret this code, as I don't know too much C. EDIT: Does anyone know how to parse an array of bytes as an integer in java? Boz0r fucked around with this message at 22:56 on Sep 18, 2008 |
# ? Sep 18, 2008 20:37 |
|
C# case/switchcode:
code:
What I'm doing is passing a string abbreviation into a subroutine and returning a different abbreviation (migrating systems) based on what it finds. There are 96 possible abbreviations that I'll be passing in, but not quite so many that I'm passing out. For instance there are several 'types' of certain documents that I'm just transferring into an overall type of document. I have a long as hell subroutine (one case for each of the 96 possibles), but I figured that the switch/case was the way to go. That being said - I'm going to be calling this routine about 3000 times per day. I didn't use any break; lines because the only processing is the return value, and the compiler warned that the break wouldn't be reachable anyway (I suppose since I'm passing directly to return). Is there anything else I should look at doing to optimize this portion, or is it pretty much negligible in performance? TL;DR: I've got a subroutine with a string parameter that returns a string based on one of 96 string cases in a switch statement. Anything I can think of doing to make the code faster?
|
# ? Sep 18, 2008 22:57 |
|
SiLk-2k5 posted:TL;DR: I've got a subroutine with a string parameter that returns a string based on one of 96 string cases in a switch statement. Anything I can think of doing to make the code faster? Why in god's name are you not using a hashtable.
|
# ? Sep 18, 2008 23:08 |
|
SiLk-2k5 posted:
None whatsoever. The only difference between switch and if is that switch only evaluates the condition once, and if evaluates it for each "else if" clause. When the condition is a simple variable like this, there's nothing to evaluate so there's no difference at all. Also, if the condition is a complex expression or a function call that the compiler can determine returns the same result every time and has no side effects, any decent compiler will optimize it out so it only gets evaluated once anyway. Finally, this is a trivial change to make later, so when you've finished writing and debugging your program and the last problem with it is that it's slow, and you track down the slowness to this particular section of code, then you can start wondering whether changing between if and switch will fix it. (It won't.) quote:I have a long as hell subroutine (one case for each of the 96 possibles), but I figured that the switch/case was the way to go. That being said - I'm going to be calling this routine about 3000 times per day. 96 possible values? 3000 times per day? Miniscule. You've now wasted more time thinking about this than you could ever possibly save by optimizing.
|
# ? Sep 18, 2008 23:44 |
|
JoeNotCharles posted:None whatsoever. This is so off-base it's not even funny.
|
# ? Sep 19, 2008 01:07 |
|
floWenoL posted:Why in god's name are you not using a hashtable.
|
# ? Sep 19, 2008 01:11 |
|
Just convert the string into a long by ORing together the individual chars, then you can switch on the long and then you get O(1) instead of O(96) wait no
|
# ? Sep 19, 2008 01:12 |
|
Just put every output string into a separate file with input string as the name, then your function can just open it and read out the result and you do not have to switch or anything.
|
# ? Sep 19, 2008 01:14 |
|
Can you not just use LINQ or something in this casecode:
Vanadium fucked around with this message at 01:33 on Sep 19, 2008 |
# ? Sep 19, 2008 01:15 |
|
Vanadium posted:Can you not just use LINQ or something in this case
|
# ? Sep 19, 2008 01:24 |
|
floWenoL posted:This is so off-base it's not even funny. Really? How does it work then?
|
# ? Sep 19, 2008 01:38 |
|
JoeNotCharles posted:Really? How does it work then? Switch statements lend themselves to jump tables when the data types are bounded integer values, but this is only in C or C++, and I guess maybe C# sometimes, but of course for strings this can't be done. I don't know if C# does inter-procedural optimization. Maybe it does. But generally unless its inlined data flow analysis won't optimize it out for ifs.
|
# ? Sep 19, 2008 02:13 |
|
Bah, I didn't even notice we were talking about strings and not ints.
|
# ? Sep 19, 2008 02:23 |
|
Conceivably, a compiler could compile a string switch into an int switch on a perfect hash, where each case verifies the match. I don't know of any compilers that actually do it, though.
|
# ? Sep 19, 2008 02:58 |
|
Farrok posted:Thanks for the info, thats quite helpful! As to your question, if the vein patterns are as regular for a given fly as you say, it should be quite easy to use any of a variety of image similarity measures to classify them. In particular, cross correlation or sum of square differences (especially the latter) are very easy algorithms to implement. The hard part is determining whether your image of interest needs to be translated or rotated in order to compare it to the reference image...that can be done manually, but then you might as well go ahead and classify it manually, too. You can use methods like gradient decent that iteratively approaches the the right orientation based on improvements in the similarity measures. Awesome - thanks. I think I'll try and translate and rotate automatically before doing the manual, but even the manual fitting should be helpful.
|
# ? Sep 19, 2008 10:58 |
|
quote:Conceivably, a compiler could compile a string switch into an int switch on a perfect hash, where each case verifies the match. I don't know of any compilers that actually do it, though. quote:96 possible values? 3000 times per day? Miniscule. You've now wasted more time thinking about this than you could ever possibly save by optimizing. The biggest hangup in the program is built-in WebService calls. The send/response is taking a while, which I'm not sure if it is the server latency (server in Florida) or local code on the server. In any event, my program is virtually complete aside from waiting on emails to confirm the return strings. Basically this isn't "ABCD" stuff like I put, it is every type of court document that could possibly be filed in a specific county has its own abbreviation in the courthouse, and we have our own abbreviation in our own system. Just trying to figure out the most efficient methods to shave whatever time I can from the web-service lag. I figure it is a minuscule gain regardless, but now was a good time to ask about it for future projects. Thanks guys.
|
# ? Sep 19, 2008 15:20 |
|
SiLk-2k5 posted:Is there any particular reason why I'd want to convert the strings to a numerical value considering that C# handles strings in switch statements just fine? (Using Visual Studio 2005) Comparing integers is faster than comparing strings.
|
# ? Sep 19, 2008 15:28 |
|
Is there some sort of smart method when I've extracted an array of bytes from a file, to convert them to long, short, or chars in Java?
|
# ? Sep 19, 2008 15:33 |
|
I'm trying to add a dynamic number of items to a Windows CMenu. The only example of doing this in our codebase is this horrible hack: Every menu item has to have a unique resource ID, so what this person did was to reserve a range of IDs in the resource.h file like this: code:
code:
This is obviously a lovely solution, and I was pissed when one of our Sr. developers told me that it was the only way to do this. Surely there must be a way to set up a message map that can take a parameter of some sort, and make a menu item that passes the parameter along? I couldn't find anything that would tell me how to do this, or if it were even possible, but really I don't know what to search for.
|
# ? Sep 19, 2008 15:41 |
|
Boz0r posted:Is there some sort of smart method when I've extracted an array of bytes from a file, to convert them to long, short, or chars in Java? The Java megathread might have something to help you out. very posted:Surely there must be a way to set up a message map that can take a parameter of some sort, and make a menu item that passes the parameter along? I couldn't find anything that would tell me how to do this, or if it were even possible, but really I don't know what to search for. You shouldn't be creating static IDs for dynamic menus. Does this help?
|
# ? Sep 19, 2008 18:35 |
|
csammis posted:You shouldn't be creating static IDs for dynamic menus. Does this help?
|
# ? Sep 19, 2008 23:06 |
|
What are good papers/books that offer an introduction to financial market analysis algorithms? I'm mostly interested in analyzing historical trends, but I know absolutely nothing about this area of research and will happily read anything pertinent to the field.
|
# ? Sep 20, 2008 04:03 |
|
Plastic Jesus posted:What are good papers/books that offer an introduction to financial market analysis algorithms? I'm mostly interested in analyzing historical trends, but I know absolutely nothing about this area of research and will happily read anything pertinent to the field. Check out Fama 1970 and Fama 91, they're both an overview of market efficiency which will basically tell you that technical analysis (ie some sort of algorithm) has not and will not yield profit. I'm not sure exactly what you're looking for but you can't do any sort of futuristic prediction. If you want to analyse past data you're be better off looking at statistical methods for doing so.
|
# ? Sep 20, 2008 13:54 |
|
The B Man posted:Check out Fama 1970 and Fama 91, they're both an overview of market efficiency which will basically tell you that technical analysis (ie some sort of algorithm) has not and will not yield profit. I'm not sure exactly what you're looking for but you can't do any sort of futuristic prediction. If you want to analyse past data you're be better off looking at statistical methods for doing so. No, I'm not trying to open my own quant shop. I'm mostly looking to learn about software and mechanisms are used by analysts to evaluate markets and trends. I'm also specifically wanting to analyze interactions/dependencies between index fund components, in particular when these dependencies contradict overall market performance.
|
# ? Sep 20, 2008 14:51 |
|
I have a question about C++. First though I wanna provide some of my background so you know where I'm coming from. Basically I studied Java for 2 years in high school, then after that I studied some C++ on my own. I can read C++ very well and I've done some programming, but I haven't actually done any programming in a while. Recently I got hired at my university to help a professor with her physics research. I run and maintain this clunky Fortran (I learned on my own from the ground up) program we use to crunch numbers, Fortran is great for number crunching but I just don't feel comfortable doing some things with it. And well, I think I could save us some time if I could program something on top of Fortran, using C++. So I need someone to point me in the right direction I need to go to learn how to run another program via C++. Just some commands and a tutorial link would be greatly appreciated. I can figure out the rest on my own probably. Thanks in advance goons
|
# ? Sep 21, 2008 03:41 |
|
kruna posted:So I need someone to point me in the right direction I need to go to learn how to run another program via C++. I can't search for it to find you a precise post, but I'm almost positive that this has been covered in the C++ megathread. Launching another program (and waiting for response, or not) is platform-dependent, so if you need to post in that thread, be sure to mention what OS this will be running on.
|
# ? Sep 21, 2008 05:01 |
|
|
# ? May 15, 2024 04:28 |
|
Also if your problem is that the Fortran program is clunky, using C++ to call out to it isn't exactly going to resolve that.
|
# ? Sep 21, 2008 05:14 |