Search found 337 matches

by mrkite
Sun Jul 04, 2010 5:37 pm UTC
Forum: Coding
Topic: Perl Communication Across a Network
Replies: 4
Views: 769

Re: Perl Communication Across a Network

I would look into the Parallel:PVM module.. which is an interface to PVM (Parallel Virtual Machine).
by mrkite
Thu Jul 01, 2010 7:10 pm UTC
Forum: Coding
Topic: Best way to read a barcode in Ruby?
Replies: 6
Views: 2846

Re: Best way to read a barcode in Ruby?

Tesseract reads the digits with about 90% accuracy, and there may be a way to verify by reading the page's typed header. You can verify by checking the CRC on the barcode. Here's how to check the CRC for EAN13: Say the barcode is "9780735200449" It's EAN13 because it's 13 digits. The last...
by mrkite
Thu Jul 01, 2010 4:58 am UTC
Forum: Coding
Topic: Best way to read a barcode in Ruby?
Replies: 6
Views: 2846

Re: Best way to read a barcode in Ruby?

zxing does have a jruby wrapper... and a partial c++ port.
by mrkite
Fri May 28, 2010 7:43 am UTC
Forum: Coding
Topic: why does always Flash perform so badly?
Replies: 28
Views: 5762

Re: why does always Flash perform so badly?

Even with html5, flash won't go away very quickly. HTML5 has nothing like flash's authoring tools.
by mrkite
Wed May 19, 2010 8:37 am UTC
Forum: Coding
Topic: How does the "Random" button work?
Replies: 20
Views: 3362

Re: How does the "Random" button work?

In most programming languages there are functions that return random numbers. What I would do is assign every comic a number from 0 up to n, ask for a random number, divide that random number by n, and return that new number's comic. If I'm feeling very lazy.... select id from comics order by rand(...
by mrkite
Tue Apr 27, 2010 9:18 am UTC
Forum: Coding
Topic: A really simple and fast 2D rendering canvas window? [C]
Replies: 6
Views: 1950

Re: A really simple and fast 2D rendering canvas window? [C]

I would recommend Cairo+SDL.
Cairo is a full blown vector library, even uses hardware acceleration when available.
You can have it draw to an SDL buffer
http://cairographics.org/SDL/
by mrkite
Fri Apr 23, 2010 6:54 pm UTC
Forum: Coding
Topic: Does this work like free(); ( C ) ?
Replies: 6
Views: 1154

Re: Does this work like free(); ( C ) ?

Dropzone wrote:It looks to me like it's implementation-defined.


You're right... thread on the linux-man talks about how the manpage is wrong:

http://www.mail-archive.com/linux-man@v ... 00078.html
by mrkite
Fri Apr 23, 2010 4:44 pm UTC
Forum: Coding
Topic: Does this work like free(); ( C ) ?
Replies: 6
Views: 1154

Re: Does this work like free(); ( C ) ?

dvdme wrote:My question is: when it does

Code: Select all

realloc(vec, i*sizeof(int));
and

Code: Select all

i=0
is this like to do free(vec); ?


Yes.

According to the realloc manpage

if size is equal to zero, and ptr is not NULL, then the call is
equivalent to free(ptr).
by mrkite
Fri Apr 23, 2010 8:08 am UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 783025

Re: Coding: Hacks and Snippets

Not a hack, but a nice preprocessor feature I use a lot: #define op(m,v,o,a) {m,v,#o,#a} ... op(0xffff,0x003c, ori.b, ibcr), op(0xffc0,0x0000, ori.b, ibeb), ... which preprocesses into {0xffff,0x003c,"ori.b","ibcr"}, {0xffc0,0x0000,"ori.b","ibeb"},
by mrkite
Fri Apr 23, 2010 7:27 am UTC
Forum: Religious Wars
Topic: Coding Fonts
Replies: 117
Views: 30422

Re: Coding Fonts

A year later.. I've switched to a grey-on-dark (semi-transparent) scheme.. still vim though.
by mrkite
Wed Jul 01, 2009 8:29 am UTC
Forum: Coding
Topic: C versus C++
Replies: 20
Views: 2273

Re: C versus C++

(Objective-C, on the other hand, is a strict superset of C). That is to say, not all valid C programs will be valid C++ programs, and if they are, they may behave differently. That's not entirely true. Objective-C added some reserved words that aren't in C. You can have a variable named "super...
by mrkite
Sun Jun 28, 2009 9:53 am UTC
Forum: Coding
Topic: Random number generation in C++
Replies: 27
Views: 4299

Re: Random number generation in C++

btw, good move going with simulating a 5d6 roll with 5 different rands instead of just a random number from 5-30, since they are indeed different things. Look at the odds for just a 2d6: the odds of rolling a 6 are higher than rolling a 12. There's only one way to roll 12, that's two 6s. But rolling...
by mrkite
Sun Jun 28, 2009 4:00 am UTC
Forum: Religious Wars
Topic: Coding Fonts
Replies: 117
Views: 30422

Re: What font do you use for coding? What colour scheme?

dasada122 wrote:What environment does one code with in Linux?


Mine was from linux. vim in gnome-terminal.
by mrkite
Sat Jun 27, 2009 10:33 pm UTC
Forum: Coding
Topic: A web design question involving hover and CSS
Replies: 3
Views: 808

Re: A web design question involving hover and CSS

Yeah you'll need to do javascript. You can't change the style of a parent based on the status of a child in css, there is no selector for it.
by mrkite
Sat Jun 27, 2009 10:28 pm UTC
Forum: Religious Wars
Topic: Coding Fonts
Replies: 117
Views: 30422

Re: What font do you use for coding? What colour scheme?

Good idea, attaching a screenshot.
by mrkite
Sat Jun 27, 2009 2:29 am UTC
Forum: Religious Wars
Topic: Coding Fonts
Replies: 117
Views: 30422

Re: What font do you use for coding? What colour scheme?

Deja Vu Sans Mono 10pt. Black on white. Stock vim coloring.
by mrkite
Mon Jun 15, 2009 8:48 am UTC
Forum: Coding
Topic: Shooting yourself in the foot: Part two
Replies: 50
Views: 5231

Re: Shooting yourself in the foot: Part two

Assembly: you hot patch the new leg right onto the stack. You're off by 4 and you replace your arm with the new leg.
by mrkite
Sun May 31, 2009 4:25 am UTC
Forum: Coding
Topic: Encryption Algorithms
Replies: 14
Views: 1405

Re: Encryption Algorithms

There's Rjindael, now known as AES

http://en.wikipedia.org/wiki/Advanced_E ... n_Standard

It's used by a lot of things. Most notably, the iTunes store.

You can use the OpenSSL library to do AES fairly easily. It's also built into .NET.
by mrkite
Sun May 31, 2009 3:36 am UTC
Forum: Coding
Topic: PHP file uploading
Replies: 13
Views: 1360

Re: PHP file uploading

It's easiest to do this:

Code: Select all

if (is_uploaded_file($_FILES['ep_sound']['tmp_name']))
{
   move_uploaded_file(...)
}
by mrkite
Wed May 27, 2009 6:42 am UTC
Forum: Coding
Topic: SICP
Replies: 14
Views: 1625

Re: SICP

I notice that they never make it clear that they're actually using Scheme, which isn't identical to Common Lisp.
by mrkite
Mon May 25, 2009 8:57 am UTC
Forum: Coding
Topic: Project Euler time attack
Replies: 5
Views: 1148

Re: Project Euler time attack

It's probably the only C program I've written that doesn't just output hello world or segfault. Hey, segfaulting is a sign of Enterprise Programming.. you should be proud :) (in seriousness, valgrind is the solution to all your segfault woes) I need to get back to project euler. I had been solving ...
by mrkite
Sun May 24, 2009 8:28 am UTC
Forum: Coding
Topic: Quick question about flow control!
Replies: 27
Views: 2198

Re: Quick question about flow control!

No.. because you can see that if timer_rate is 7, then there are 7 extraneous comparisons being made, combined with 6 jumps.

That's not necessarily a lot of extra time, but it is extra time.
by mrkite
Fri May 22, 2009 7:23 pm UTC
Forum: Coding
Topic: SICP
Replies: 14
Views: 1625

SICP

Thought some of you might be interested to know that the SICP videos are on youtube now.

http://www.youtube.com/view_play_list?p ... CABEA24090
by mrkite
Thu May 21, 2009 8:07 am UTC
Forum: Coding
Topic: TADS 2 coding problem.
Replies: 6
Views: 1054

Re: TADS 2 coding problem.

I don't know TADS (I'm an Inform fan), but it seems to me that verTurnOn needs to return true or false. Or is it implied by the presence of output? Does it display "the flashlight is already on" right before "you turn on the flashlight..."?
by mrkite
Thu May 21, 2009 8:04 am UTC
Forum: Coding
Topic: How did you learn to program?
Replies: 60
Views: 6284

Re: How did you learn to program?

(Well, there was logo: which might actually have been my first programming experience. But that gets fuzzy. It is shocking how young someone can learn how to use logo, however.) Logo is a tricky language to classify. The turtle graphics part is fairly simple, and it intuitively shows kids how givin...
by mrkite
Wed May 20, 2009 8:03 am UTC
Forum: Coding
Topic: Sweetest Error EVER
Replies: 31
Views: 3763

Re: Sweetest Error EVER

Pretty much, yeah. I don't claim it makes sense. Well, this is C we're talking about here :) If I were in charge of C, I'd clear up some of the ambiguous specs. Like the order arguments are evaluated in a function call. That's needlessly unspecified. (Note that's not the same as saying it doesn't m...
by mrkite
Wed May 20, 2009 7:12 am UTC
Forum: Coding
Topic: Sweetest Error EVER
Replies: 31
Views: 3763

Re: Sweetest Error EVER

Also, ""-7 doesn't include any casts between pointers and integers, so I don't know what §6.3.2.3 has to do with it (actually, I do, and it's nothing). You're right, a string literal is considered an array. But with casting, 6.3.2.3 takes effect. You're saying ""-7 is undefined,...
by mrkite
Wed May 20, 2009 6:26 am UTC
Forum: Coding
Topic: Sweetest Error EVER
Replies: 31
Views: 3763

Re: Sweetest Error EVER

If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined. That is, merely evaluating ""-7, let alone dereferencing the result,...
by mrkite
Wed May 20, 2009 5:16 am UTC
Forum: Coding
Topic: Sweetest Error EVER
Replies: 31
Views: 3763

Re: Sweetest Error EVER

The point of this is that all of this is engaging in undefined behaviour. If your compiler formatted your hard drive when you did std::cout << "" -7 << "\n", it would not be violating the C++ standard. Well, yeah it would. If it helps, any literal string, including "" ...
by mrkite
Thu May 14, 2009 12:52 am UTC
Forum: Coding
Topic: How did you learn to program?
Replies: 60
Views: 6284

Re: How did you learn to program?

Copying Applesoft BASIC programs out of Byte and Nibble magazines. Then moved to assembler when BASIC wasn't fast enough.
by mrkite
Sat May 09, 2009 2:25 am UTC
Forum: Coding
Topic: Stackoverflow
Replies: 12
Views: 1722

Re: Stackoverflow

I read an article whenever it gets posted to reddit/r/programming.. but I don't go out of my way to read the site...
by mrkite
Fri May 08, 2009 12:12 am UTC
Forum: Coding
Topic: Endiannessityness and Unions
Replies: 46
Views: 3049

Re: Endiannessityness and Unions

Kurushimi wrote:Okay, I'm sorry, but I'm a bit confused. Wouldn't the inverse square root of a number be it's square?


They actually mean 1/sqrt(X);
by mrkite
Fri May 08, 2009 12:12 am UTC
Forum: Coding
Topic: Endiannessityness and Unions
Replies: 46
Views: 3049

Re: Endiannessityness and Unions

Uh, while we're on the discussion of unions. I'm just wondering...what are they used for? What benefits does someone gain from being able to interpret the same memory in several different ways? I used it recently for a 6502 emulator. A union was the cleanest way I knew of doing this: // this isn't ...
by mrkite
Mon May 04, 2009 6:07 am UTC
Forum: Coding
Topic: Fortran 77
Replies: 45
Views: 7919

Re: Fortran 77

I have fortran77 compiler running on my Apple IIe emulator... but that'd be a pretty convoluted way of writing software :)
by mrkite
Fri May 01, 2009 7:31 pm UTC
Forum: Coding
Topic: Newbie regular expression problem
Replies: 5
Views: 859

Re: Newbie regular expression problem

Simple enough, you can just match on .I or end-of-string.

Code: Select all

/blahblah(\.I|$)/
by mrkite
Fri May 01, 2009 8:56 am UTC
Forum: Coding
Topic: Poll: Wich grammatic genre do you favor?
Replies: 29
Views: 2754

Re: Poll: Wich grammatic genre do you favor?

Without curly brackets, I would be lost... what would the '%' key in vim be used for?
by mrkite
Fri May 01, 2009 6:30 am UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 783025

Re: Coding: Hacks and Snippets

// open paren expression push y push x xor pop x // comma here... sequence point, x is definitely stored push x push y xor dup pop y // close paren expression push x xor pop x Course it is funny that we're trying to use assembly tricks in higher languages where the compiler sees something crazy and...
by mrkite
Thu Apr 30, 2009 7:38 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 783025

Re: Coding: Hacks and Snippets

Speaking of IOCCC and abuse of the standard:

Code: Select all

       d=b+++a---c;


Valid code.
by mrkite
Thu Apr 30, 2009 8:41 am UTC
Forum: Coding
Topic: Truly Random
Replies: 24
Views: 2572

Re: Truly Random

I don't want to sound like a killjoy here but what's wrong with /dev/random. It uses data from device drivers and other unpredictable input as an entropy source. It's as close to random as you're reasonably going to get without some kind of precision quantum apparatus. For one, if the entropy pool ...
by mrkite
Thu Apr 30, 2009 12:50 am UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 783025

Re: Coding: Hacks and Snippets

Yakk wrote:Hmm -- ya, if you are dealing with registers, and you can do compile-time or design-time checks that you aren't dealing with the same register (either implicitly or explicitly), and you are at the cusp of a storage-speed hit, the trick can be worth it.


If you're dealing with registers, use XCHG.

Go to advanced search