|
Mustach posted:I assigned the result of realloc to another variable. A 'clearer' way would be: code:
quote:but really you'd be pretty safe with something like If it's so safe, why'd you bump it up from 100? :P
|
# ? Sep 7, 2008 09:21 |
|
|
# ? May 15, 2024 04:56 |
|
floWenoL posted:If it's so safe, why'd you bump it up from 100? :P *For the number of digits in a 64-bit unsigned long, I think? I dunno that's why I'd just use something big. edit: bleh, that was way too much explaination on my part Mustach fucked around with this message at 14:43 on Sep 7, 2008 |
# ? Sep 7, 2008 14:11 |
|
The Mechanical Hand posted:I want to learn .NET basically and I'm not sure where to start. Is there any poo poo I gotta get down pat before jumping in or is it feasible to pick up a book that tells you from scratch "Hey, here's where to get started, beginners!" and learn from that? Any thoughts? It's plenty feasible, I'm pretty sure there have been book suggestions for this purpose in the .NET Questions megathread
|
# ? Sep 7, 2008 15:51 |
|
Test.dat is a 64kb binary file so there should be 65536 characters, but at the end of the loop, n is only at 9388. What's going on?code:
|
# ? Sep 8, 2008 00:23 |
|
ante posted:Test.dat is a 64kb binary file so there should be 65536 characters, but at the end of the loop, n is only at 9388. What's going on? Open the file for binary (using "rb")
|
# ? Sep 8, 2008 00:52 |
|
Ugg boots posted:Open the file for binary (using "rb") That fixes a headache for me, thanks. I even tried that before, but I just realised that I hosed up my syntax on the attempt.
|
# ? Sep 8, 2008 01:20 |
|
For what it's worth, if you're dead-set on reading a single character at a time, you should use fgetc, not fread. Analogously, if you're dead-set on undergoing open-heart surgery unaesthetized, you should at least get good and drunk first.
|
# ? Sep 8, 2008 02:43 |
|
In C++ why is it that this: typedef CDLLclass (*CreateDllObject)(); is okay, but this: typedef CDLLclass* (*CreateDllObject)(); is a big no no? It simply wont compile. I need this to be possible, so is there some "extra" syntax rule that is needed for this to work? Jarl fucked around with this message at 22:21 on Sep 8, 2008 |
# ? Sep 8, 2008 21:56 |
|
Works fine, you should probably say what you are trying to do.
|
# ? Sep 8, 2008 22:14 |
|
Jarl posted:In C++ why is it that this: Works for me. What error message are you getting?
|
# ? Sep 8, 2008 22:15 |
|
I started from scratch and now I don't have the problem. The compiler kept telling me that I should put a ';' before '*' which made no sense.
|
# ? Sep 8, 2008 22:22 |
|
Jarl posted:I started from scratch and now I don't have the problem. The compiler kept telling me that I should put a ';' before '*' which made no sense. You missed a ; in an earlier line and the * was the first point the compiler knew for sure needed to be a new statement.
|
# ? Sep 9, 2008 00:04 |
|
JoeNotCharles posted:You missed a ; in an earlier line and the * was the first point the compiler knew for sure needed to be a new statement. No I didn't. Instead it was because I hadn't put a ';' at the end of my class declarations in a header file. Also in that header file I forgot "using namespace std" and these gave all sorts of obscure errors all over the place. I counted 86 in four files. I should ofc have realized that the function pointers wasn't wrong, but I had just started from one end of the error list. 86 errors. I should have thought something else was wrong. Jarl fucked around with this message at 09:46 on Sep 9, 2008 |
# ? Sep 9, 2008 09:44 |
|
Jarl posted:No I didn't. Instead it was because I hadn't put a ';' at the end of my class declarations in a header file.
|
# ? Sep 9, 2008 14:49 |
|
Jarl posted:I should ofc have realized that the function pointers wasn't wrong, but I had just started from one end of the error list. 86 errors. I should have thought something else was wrong. This is why it's a good idea to start at the beginning of the error list and, when you fix something that looks like it'll have ripple effects, just ignore the rest of the list and recompile. Usually a big chunk of them will go away. If you start at the end you might be looking at errors that were caused by earlier errors. (Assuming your project compiles quickly so it's faster to recompile and get a new error list than to go through the rest of the errors and manually skip the ones you know aren't valid anymore, that is.)
|
# ? Sep 9, 2008 16:05 |
|
I had a problem and it seems like this thread would be the best fit. I'm trying to write a vbs or batch file that reads values from a csv and creates Windows shortcuts with said values. I have a bit of experience with Perl and Java, but I can't really seem to make heads or tails of the few code snippets I've googled regarding creation of shortcuts (i.e. lnk files). Whould vbs or a bat file be the best way to go about this? VVVVVVVVVVVVV - Edit - Unfortunately its going to be used in a closed system, so I can't use third party software without a huge headache an approval process. Here is what I have so far: code:
Daggerpants fucked around with this message at 03:14 on Sep 11, 2008 |
# ? Sep 10, 2008 20:47 |
|
Daggerpants posted:I had a problem and it seems like this thread would be the best fit. I'm trying to write a vbs or batch file that reads values from a csv and creates Windows shortcuts with said values. EDIT: I know you're asking for bat/vbs, but this project might make your life a little easier. gold brick fucked around with this message at 21:10 on Sep 10, 2008 |
# ? Sep 10, 2008 21:06 |
|
A recent problem that just occured (I think it was after i added jQuery to my app) was in a certain page, HTML is not parsing when I change the contents of a DIV.code:
code:
ArchDemon fucked around with this message at 16:08 on Sep 11, 2008 |
# ? Sep 11, 2008 16:04 |
|
Well, it literally puts text into the DOM and not whatever nodes that would parse to. Because it is text and not magical html code. Just manually create the elements and plug them into the tree yourself. There are some people who would suggest you use some sort of abomination like .innerHTML but that is clearly non-standard and thus unportable and also heresy. Also you would run into escaping issues if you did it like that.
|
# ? Sep 11, 2008 18:06 |
|
ArchDemon posted:
I haven't tested this, and it's probably not the best way to go about this, but: $("#description").empty().append("<CENTER><b>" + item ...);
|
# ? Sep 14, 2008 10:15 |
|
I'm basically a programming retard, and while I've managed to cobble this Excel VBA together from various tutorials, it doesn't work, and I don't even know enough about what I'm doing wrong to know what to google for to try to fix it. code:
|
# ? Sep 14, 2008 14:26 |
|
Mola Yam posted:I'm basically a programming retard, and while I've managed to cobble this Excel VBA together from various tutorials, it doesn't work, and I don't even know enough about what I'm doing wrong to know what to google for to try to fix it. I don't know the Excel API well enough to know if you're doing something obviously wrong there, but if you're using this function as, well, a function, you'll want code:
|
# ? Sep 14, 2008 23:54 |
I'm really excited about using computers to test models of society. Books like Nexus and Complex Adaptive Systems convinced me that this was something I needed to learn. Maybe the model would help demonstrate an idea. Maybe it would only provide an excuse to say "Dance, puppets. DANCE!" Either way, science, mad or otherwise, would progress. Unfortunately I'm an end-user with mediocre math skills. One with more experience fiddling with hardware than fiddling with code. Worse than that, I'm a sociologist. Is it possible for the programming-ignorant to learn how to code relatively simple models?
|
|
# ? Sep 15, 2008 04:41 |
|
rjmccall posted:I don't know the Excel API well enough to know if you're doing something obviously wrong there, but if you're using this function as, well, a function, you'll want I believe in Excel VBA it's the old style, so <FunctionName> = State. If return doesn't work, try that. Also, it might be faster if you told it to process a specific range of the column and iterated over each cell, and populated a cell in another column.
|
# ? Sep 15, 2008 04:46 |
|
A student posted:I'm really excited about using computers to test models of society. Books like Nexus and Complex Adaptive Systems convinced me that this was something I needed to learn. Maybe the model would help demonstrate an idea. Maybe it would only provide an excuse to say "Dance, puppets. DANCE!" Either way, science, mad or otherwise, would progress. Absolutely -- Python is generally recommended in this area -- it's used very heavily in the sciences, all kinds, from NASA to bioinformatics. Python combines simplicity (thus easy to learn) with power (thus able to express lots of stuff, and do a lot of processing without a lot of code) and this makes it really attractive for people who aren't necessarily professional programmers, but still want to use computers to model the stuff they're working on. It can make use of C modules in the event that your particular modeling requires some highly performance-oriented code, too.
|
# ? Sep 15, 2008 05:29 |
Is python generally self-taught?
|
|
# ? Sep 15, 2008 07:16 |
|
A student posted:Is python generally self-taught? In that universities don't usually teach it, yes. Most everyone in CoC was probably self-taught at one point or another anyway. A university degree is really helpful to being the best programmer you can be, but it's by no means necessary. To put things in perspective, a few of my friends are physicists, and when they need to learn a new language, someone just throws a reference manual at them and they figure it out.
|
# ? Sep 15, 2008 07:24 |
I should feel excited about this. Instead it feels like I've just created more work I'd need to do for a thesis project that doesn't even exist yet.
|
|
# ? Sep 15, 2008 07:31 |
|
It's more math than computer science, but you might want to check out "Mathematical Models" by Richard Haberman. It's got a huge section on population dynamics, and it does a pretty good job of showing how you'd solve the differential equations using numerical (e.g. computer) methods.
|
# ? Sep 15, 2008 07:36 |
|
Jarl posted:No I didn't. Instead it was because I hadn't put a ';' at the end of my class declarations in a header file. Also in that header file I forgot "using namespace std" and these gave all sorts of obscure errors all over the place. I counted 86 in four files.
|
# ? Sep 15, 2008 18:11 |
|
TSDK posted:Putting 'using namespace ...' in a header file should earn you a punch in the throat, so please don't. It's a very bad habit, and not only defeats the whole purpose of having namespaces, it does it at random throughout your codebase depending on the presence and order of #includes. lol, ups - I see what you mean.
|
# ? Sep 15, 2008 20:50 |
|
I've got a basic question with some entry level scheme I've been given this block of code: code:
Viper2026 fucked around with this message at 21:54 on Sep 15, 2008 |
# ? Sep 15, 2008 21:49 |
|
Look up the difference between eager (or strict) evaluation and lazy evaluation.
|
# ? Sep 15, 2008 22:00 |
|
I have a hopefully laughably easy question for VB. For my VB class, I need to create a small program with an IF statement in it. Basically, I have 1 text field for a number to be input, and a compute button. The IF Statement I have for the button is code:
It errors on "price = CDbl(txtPrice.Text)" Conversion from string "" to type 'Double' is not valid. I really need help understanding this.
|
# ? Sep 15, 2008 22:07 |
|
TSDK posted:Look up the difference between eager (or strict) evaluation and lazy evaluation. Would that be something like this...? Applicative order: evaluate arguments, then apply procedure to values Normal order: substitute argument expressions for corresponding parameters in body of procedure definition, then evaluate body
|
# ? Sep 15, 2008 22:15 |
|
Dr. Horrible posted:It errors on "price = CDbl(txtPrice.Text)" Conversion from string "" to type 'Double' is not valid. txtPrice.Text is "". "" isn't a number, so it can't be converted to a number. What you're trying to do is put the calculated amount in txtPrice? Once you've done the calculation, try txtPrice.Text = CStr(price)
|
# ? Sep 15, 2008 22:16 |
|
csammis posted:txtPrice.Text is "". "" isn't a number, so it can't be converted to a number. What you're trying to do is put the calculated amount in txtPrice? Once you've done the calculation, try txtPrice.Text = CStr(price) I hopped in the chatroom real fast and instead of cdbl, I changed it to val, and then threw in code for price to output formatcurrency(price) and nailed it. thanks
|
# ? Sep 15, 2008 22:19 |
|
Viper2026 posted:Would that be something like this...? Proper "lazy" evaluation (as it appears in e.g. Haskell) is a little more subtle than that, but yeah, you get the general idea. code:
|
# ? Sep 16, 2008 01:15 |
|
rjmccall posted:
For example: code:
code:
|
# ? Sep 16, 2008 02:06 |
|
|
# ? May 15, 2024 04:56 |
|
Can you implement cond with a macro, without using if or whatever?
|
# ? Sep 16, 2008 02:36 |