I've searched around to figure out whether or not PUT operations are atomic in Riak. Are they?
Riak is an eventually consistant system with absolutely no concept of anything atomic.
Probably the best resource for explaining this is our page on the subject: http://wiki.basho.com/Eventual-Consistency.html
Related
So I'm having a hard time grasping the idea behind pointers and all that memory allocation.
I'm thinking nowadays with computer as powerful as they are right now why do we have to use pointers at all?
Isn't there always a workaround to do things without the help of pointers?
Pointers are an indirection: instead of working with the data itself, you are working with (something) that points to the data. Depending on the semantics of the language, this allows many things: cheaply switch to another instance of data (by setting the pointer to point to another instance), passing pointers allows access to the original data without having to make (a possibly expensive) copy, etc.
Memory allocation is related to pointers, but separate: you can have pointers without allocating memory. The reason you need pointers for memory allocation is that the actual address the allocated block of memory resides is not known at compile time, so you can only access it via a level of indirection (i.e. pointers) -- the compiler statically allocates space for the pointer that will point to the dynamically allocated memory.
Pointers are incredibly powerful. Just because computers have a faster processing time nowdays, doesn't mean that's any reason to abandon something as essential as pointers. Passing around giant chunks of memory on the stack is inefficient at best, catastrophic at worst. With pointers, you only need to maintain a reference to where the data resides, rather than duplicating huge chunks of memory each time you call a function.
Also, if you're copying all the data every time, how do you modify the original data? Aside from returning the copy of the structure in every call that touches it.
I remember reading somewhere that Dijkstra was assessing a student for a programming course; this student was quite intelligent but s/he wasn't able to solve the problem because there was sort of a mental block.
All the code was sort of ok, but what was needed was simply to use the expression
a[a[i+1]] = j;
and even if being so close to the solution still the goal seemed to be miles away.
Languages "without pointers" already exist... e.g. BASIC. Without explicit pointers, that is. But the indirection idea... the idea that you can have data to mean just where to find other data is central to programming.
The very idea of array is about being able to use computed values to find other values.
Trying to hide this idea is an horrible plan. According to Dijkstra anyone that has been exposed to the BASIC language has already received such a mental mutilation that is impossible to recover as a good programmer (and probably the absence of explicit indirection was one of the problems).
I think he was exaggerating.
Just a bit.
When I am investigating the heap, looking at exceptions, under/after a crash with windbg, I always get listed these three,
System.ExecutionEngineException
System.StackOverflowException
System.OutOfMemoryException
And I know why they are there. It makes sense. But every time I do these dumps, I see these two hanging on the list,
System.Text.DecoderExceptionFallback
System.Text.EncoderExceptionFallback
I have always neglected these two. But why is the two on the heap? I have tried to sniff up some info, but I can not seem to find anything usefull. Maybe someone here can tell me why they are on the heap? I have read about the classes on MSDN, but this does not give me anything. I do not think that they, after what I have read on MSDN, are important like the first three. But maybe they are?
Please fill me in :)
They are not exceptions, they just happen to have the word "Exception" in the type name. See http://msdn.microsoft.com/en-us/library/system.text.decoderexceptionfallback.aspx.
Unfortunately SOS doesn't support listing of all instances derived from a specific type, so there's no accurate way to dump all the actual exceptions on the heap. I.e. you will often see false positives.
I'm a bit of a polyglot when it comes to programming languages, and most of the languages I use have Error/Exception handling of some sort.
In most languages there's a default implementation of error ID's with their associated messages, but I've never found a list of production codes to base my own error codes off of.
Does such a thing exist?
If not would it be useful, or just noise that most programmers ignore?
The closest thing I can think of is POSIX error constants (though their numeric values are not standardized.)
Short answer - no, it doesn't exist. Every OS, platform and piece of software pretty much has its own error IDs. These are not synchronized or based on any standard set.
I would say that apart from the common errors, this would indeed just be noise, and even with the common one, one one need to standardize them and ensure they are used universally.
Let me define the problem first and why a messagequeue has been chosen. I have a datalayer that will be transactional and EXTREMELY insert heavy and rather then attempt to deal with these issues when they occur I am hoping to implement my application from the ground up with this in mind.
I have decided to tackle this problem by using the Microsoft Message Queue and perform inserts as time permits asynchronously. However I quickly ran into a problem. Certain inserts that I perform may need to be recalled (ie: retrieved) immediately (imagine this is for POS system and what happens if you need to recall the last transaction - one that still hasn’t been inserted).
The way I decided to tackle this problem is by abstracting the MessageQueue and combining it in my data access layer thereby creating the illusion of a single set of data being returned to the user of the datalayer (I have considered the other issues that occur in such a scenario (ie: essentially dirty reads and such) and have concluded for my purposes I can control these issues).
However this is where things get a little nasty... I’ve worked out how to get the messages back and such (trivial enough problem) but where I am stuck is; how do I create a generic (or at least somewhat generic) way of querying my message queue? One where I can minimize the duplication between the SQL queries and MessageQueue queries. I have considered using LINQ (but have very limited understanding of the technology) and have also attempted an implementation with Predicates which so far is pretty smelly.
Are there any patterns for such a problem that I can utilize? Am I going about this the wrong way? Does anyone have any of their own ideas about how I can tackle this problem? Does anyone even understand what I am talking about? :-)
Any and ALL input would be highly appreciated and seriously considered…
Thanks again.
For anyone interested. I decided in
the end to simply cache the
transaction in another location and
use the MSMQ as intended and described
below.
If the queue has a large-ish number of messages on it, then enumerating those messages will become a serious bottleneck. MSMQ was designed for first-in-first-out kind of access and anything that doesn't follow that pattern can cause you lots of grief in terms of performance.
The answer depends greatly on the sort of queries you're going to be executing, but the answer may be some kind of no-sql database (CouchDB or BerkeleyDB, etc)
I was wondering what it requires to write a standard which targets programmers (e.g. JSON) and where to get started?
Does anyone has hands-on experience on that?
i think, a better question is, "how to write a good specification?" ...
most RFCs are bad specs, in my eyes ... personally, i quite hate them ... they are still better than ECMA-specs, but that's not a real criterium i think ...
for example: compare JSON-"specs" on json.org with the actual RFC ... i do agree, the first is not 100% exact (well, actually it is more exact then most JSON encoders), but in a few lines and a few syntax diagrams it says where JSON comes from, what its usage is, and defines the format ...
i don't see a real point in writing endless RCFs, because in the end noone reads them leading to the point where
you don't get the comment you requested for
people make implementations without really knowing your standard
if you really want to propose a standard, or make it comprehensible, do not use documents with countless pages ... it's just a waste of time ... when the standard is mature, you can start bothering making a very formal and strict definition, which is a good basis for highly consistent behaviour accross implementations, if it is really clear ...
do not obscure ideas by using too many strange and invented words, abreviations or refering to thousands of other things ... the simplicity of a solution is a measure for it's actual worth ... and treating the reader of your document, like a slightly dumb alien, to whom you have to explain everything, but at the same time expecting they can follow unjustifiably complex and bloated explanations, does not seem very sane to me ... just KISS ... ;)
The first thing you need is a community that need something. Then you need to get this community discussing.