submited by krishnas on Thu Mar 10th, 2011
java
At the beginning of this series I reviewed the difference between trees and hash tables and defined when you might use one over the other. As a quick recap, a hash table stores its information in a contiguous block of memory, akin to an array, and executes a hashing algorithm on its objects to determine how those objects map to indexes within the hash table. Because objects are hashed to indexes within the hash table it is possible to insert, retrieve, and remove objects from a hash table in constant time. ...
more »
submited by krishnas on Sat Oct 16th, 2010
java
Because of the excellent job of the Java development team at Sun (now Oracle), Java developers are probably more familiar with the Iterator design pattern than developers in other languages. So much so that we seldom refer to traversing over a collection, but instead use the vernacular of “iterating over” a collection. While you may have used iterators built into the Java programming language, this article shows you the rational behind iterators and describes how to build an iterator of your own....
more »
submited by krishnas on Sat Oct 16th, 2010
java
It's been a busy year for MySQL. Perhaps you've heard. Here are some recent improvements to the speed, scalability, and user-friendliness of the MySQL database and the InnoDB storage engine that we think deserve their own headlines. Now is a great time to beta test the 5.5 release and give feedback to the MySQL engineering team....
more »
submited by krishnas on Sat Oct 16th, 2010
java
MySQL Cluster Carrier Grade Edition is a clustered real-time database that is deployed in some of the most demanding subscriber database systems found in the telecommunications industry. In this paper we describe how MySQL Cluster Carrier Grade Edition can be used to build a scalable, highly available, geographically replicated Subscriber Database. We show how user-defined partitioning and distribution keys help a subscriber database to scale its performance linearly with cluster size, while maintaining the benefits of a relational database, accessed via an SQL API....
more »
submited by krishnas on Sat Oct 16th, 2010
java j2me
The original intention of web services was to provide a mechanism to integrate different systems together. The systems could be running on different operating systems that are hosting applications written in different programming languages. The basic technology underlying web services is XML, which is can be transported between systems using a variety of protocols, most commonly HTTP or HTTPS. XML makes for a power conversational language, not only because it is human readable, but because everything is represented as a String, with specific rules defined for how that String value should be interpreted. This is important because “250” will be interpreted as 250 regardless of whether your application is written in Java or C/C++ or if it is running on Windows or Unix. There is no ambiguity with things like “big endian” or “little endian” interpretations of bytes....
more »
submited by krishnas on Thu Sep 30th, 2010
java
The code I wrote nine months ago sucks. And I'm happy about it.
Of course back then I thought what I was writing was the bee's knees, and that the code that I had written nine months before that was what sucked. And at that time, I thought that it was the code written nine months prior to that was what sucked. And on and on and on back to the beginning of my programming career, when 110 baud teletypes were all the rage.
So why am I so happy about it? Simple: if I can look back at code I had written previously and know that the code I am writing today shows significant improvement, it means that I am still learning and growing as a coder.
The day that I look at my older code and think that it is perfect will be a sad day indeed, as it will mean either: (a) I have learned all that there is to learn (highly unlikely), or (b) that my brain has calcified and can accept no more information. Either of these would be a sad state of affairs. ...
more »
submited by krishnas on Thu Sep 30th, 2010
java
I discovered lombok which uses annotations to generate getters and setters. http://projectlombok.org/index.html
Is this recommended?
Another question is:
Is it better to make all the fields which should be accessed by other objects public
and access fields instead of getters/setters - encapsulation is therefore secured?
So I do not need to write that boilerplate code an do not need something like lombok....
more »
submited by krishnas on Thu Sep 30th, 2010
java
Using prepared statements with parameters helps to defend against SQL injection in most common cases, when you would otherwise interpolate untrusted content into a string and then execute the string as an SQL statement. ...
more »
submited by krishnas on Thu Sep 30th, 2010
java
Previously, I discussed techniques for freeing up memory on video and images in Flex, but I neglected to include a discussion of event handlers. With the release of ActionScript 3, Adobe added the notion of strong references and weak references. Strong references are those references that, if present, will prevent the object from being garbage collected. The presence of only weak references, on the other hand, will allow an object to be garbage collected. When most developers consider garbage collection, they often consider only strong references, those references they explicitly know about. The age-old wisdom, that if you remove all active (strong) references to an object, it will become eligible for garbage collection, overlooks the fact that the object may have strong references from other objects, created via event handler registration....
more »
submited by krishnas on Tue Sep 21st, 2010
java
In the previous section I presented a strategy that allows you to trace through your application's execution using a ThreadLocal variable that records method actions: start, stop, or exceptional exit. Before we dive into using bytecode instrumentation to add tracing to an application, this section provides a sample application that manually uses the tracing library so that we can better understand what we want the bytecode instrumentation to accomplish. In the next section we'll accomplish the same result using bytecode instrumentation....
more »