Top tag
Next privilege 200 Rep.
See reduced ads
~2k people reached

  • 0 posts edited
  • 1 helpful flag
  • 16 votes cast
comment How widespread is the use of arabic numerals in Japanese and Chinese?
The interesting ones at the smaller restaurants (I'm in Japan at the moment) are the prices that look like this: 五00 - (the first character is 5). There isn't really a "0" kanji in this context.
comment Why should I use lookup tables at all?
A few things: 1) For the fastest lookup, you want a compact array, but under real-world use your lookups will use non-sequential ids (especially when dealing with internationalized data). 2) There are situations where this stuff is cached application-side, but there are tools/libraries for it (at least in Java). 3) You want this stuff stored in the db (in one or more flavors), because it enables all sorts of query chewy goodness anyways.
comment Injecting locking policy into a class the point where you'd know what your read/write situation is, you could use specialized collections instead of this locking policy. In the second instance it sounds like you want ConcurrentQueue, or maybe to implement the reader/writer interface in System.Collections.Concurrent
comment Injecting locking policy into a class
Note: Dispose isn't guaranteed to be called by the framework, so things could be locked longer than you think. Naming your release-lock method that is going to confuse people no end (that, and while you can safely call Monitor.Enter(...) multiple times, you need the same number of Exit(...) calls). My question was less about the exact implementation of the policy classes, and why you think you need them, or what the code calling them is actually doing.
comment Injecting locking policy into a class
Define "different situations". What particular problem are you trying to solve? Normally wouldn't a locking token have to be shared to be used between threads (ie, can't dispose it afterwards)? It feels like attempting to do this will make you think you're running stuff safely, but at some point you're going to put NoLockingPolicy instead of SimpleLockPolicy, and then...
comment Why pointer symbol and multiplication sign are same in C/C++?
Many older languages (such as BASIC) used the $ in variable declarations. Too, it's usually only available on US keyboards, although I don't know if this consideration would have been important to the original designers.
comment Knowing when a SQL table is done updating before Querying
If you don't need much maybe just use SQLite? Otherwise, depending on timing, you could simply not send a response back to the 'client' until the insert is complete (essentially, local 'remote' function hasn't returned yet). I'm assuming 'self-hosted' means on the client box, and not a cloud server instance somewhere else.
comment Alternatives to #if when polymorphism doesn't seem possible
What language/platform are you dealing with here? Potentially, you could move the relevant sections to a new .dll or whatever and include a reference.
comment Should I always return an error code from C functions?
Side note - time ranges, like all positive contiguous-range types, should have an inclusive lower-bound (that is, >=). The upper-bound should still be exclusive, though.
comment Single method with many parameters vs many methods that must be called in order
What set of methods are you working on here? I mean, I think the standard is to pass a transformation object (like Java's Affine Transform for 2D stuff) that you pass to some method that applies it. The contents of the transform are different depending on the order you call the initial operations on it, by design (so it's "you call it in the order you need it", not "in the order I want it").
comment Is using digital signatures and bytecode machines a viable technique to make reverse engineering hard?
This is going to be dog slow, regardless. Your scheme still has a fundamental flaw of almost all other DRM attempts - you have to trust the end user to do the decryption, on a standardized machine. Taking your proposal at face value, I could just give my buddy the entire thing, key and all. Pirates also aren't generally interested in getting the source code, anyways (which is effectively impossible for compiled code), but something that runs - which your system has to provide, to be able to run on real, physical hardware.
comment Boss is ordering me to send spam. How to I deal with this issue/what is my options?
Are you sure this is spam, and not legitimate mass-marketing emails? Consider - if the items advertised are your main business line, and the recipients registered customers, they may be waiting with bated breath for their monthly deals.
awarded  Citizen Patrol
comment Using audit trail as time machine?
Um, no, don't use BETWEEN, use an exclusive upper-bound. What you're doing will include 2 rows in some cases. end is best thought of conceptually as null, which it should probably be stored as (although this would require additional checks). Note that ending values are always derived values.
comment What level/format of access should be given to a client to the issue tracking system?
@AndreyRybak - it doesn't matter, the problem is that you have any tickets. If you measure it, somebody will judge based on it. Actually, no, the problem is that you have a ticket-tracking system; people will make judgments if you have no tickets. This transcends the bounds of reason - it's why some managers say things like "you sold a lifetime-widget to everybody in town this year, can you maybe sell everyone two next year?".
comment Should I use relational or noSQL databases for this problem
Note that if you store address from multiple countries, (physical) addresses will vary hugely in format anyways...
comment calculating the average of a value over a month
In SQL, conceptually what you want is a view - that is, you don't store the average, you store a query that calcs the value on-the-fly for you. Most RDBMSs provide ways to "materialize" these (store the computed value) if necessary. If you do store it (say, to "apply" it as a bank transaction), you need to explicitly call out the timeframe the calculation was performed over (lastAccessed is good audit information, but a terrible way to keep track of where you are). Finally, understand that averaging amounts in small groups will give different results than an average as one large group.
comment Using public final rather than private getters
@kritzikratzi - The problem is that you can't guarantee that your code won't run into idiots. At some point it will (which might even end up being oneself!), and the surprise could be a huge problem.
comment How to Safely Sell Source Code?
As usual: Technology (or just general processes) can't solve people problems. It can shift it to someone else, it can spread it to multiple people. But it can't actually solve it for you (this is a lie that we as technology people often whisper to ourselves, never mind our customers - and boy is it a seductive one).
comment How to change the state of a singleton in runtime
Initialization of the file link needs to be one of the first things your app does - otherwise you may end up calling log before there's an output file (a good library probably has a built-in buffer or at least a default destination file). If you're building a GUI app, you can probably do it before the launch of the UI via the Swing threads. Most servers come with the logging built-in, so it's not something you have to worry about.