background preloader

General Tecniques

Facebook Twitter

Simple algorithms. Neat Algorithms - Flocking. OLAP cubes, outdated BI technology? As businesses demand that more employees have access to the benefits of expansive, real-time data analysis, it seems that the latency and complexity associated with OLAP cubes will soon see them rendered to the pages of technological history by a new breed of operational Business Intelligence (BI) tools. – Tools that cater for pervasive and virtually instantaneous data analysis and reporting through in-memory analytics. But they’ll survive; for now. What do OLAP cubes offer? The ability of OLAP cubes to facilitate multifaceted data analysis in response to complex business queries, will see them maintain some degree of usefulness, as businesses accumulate increasingly large data volumes of increasing complexity. Because OLAP cubes can be made up of more than three dimensions (hypercube), in-depth analysis is enabled, allowing users to gain comprehensive and valuable business insights.

OLAP cubes can also perform data analysis without internet connectivity. In-memory analytics. 10 Common Mistakes Made by API Providers. Twitter was one of the first to see what happened when traffic to the site came more from the API than the Web. It now has more than 65 million tweets per day, most coming from services that use the Twitter API. Twitter has made numerous changes to fix its API. Those experiences have taught providers what mistakes not to make when launching a service. But there is still a lot for providers to learn. Considering this, we asked developers and service providers to help us prepare a list of 10 common mistakes made by API providers. Our group of commentators include Adam DuVander executive editor at Programmable Web; Mike Pearce, a developer out of the United Kingdom who writes a lot about scrum and Agile; Mashery's Clay Loveless and Sonoa Systems Sam Ramji. 1.

"Databases fail, backend dependencies get slow, and/or someone somewhere along the line doesn't escape output properly. 2. "Sometimes we see providers expecting the API alone to attract developers. 3. 4. 5. 6. Source: San Ramji 7. 8. 9. Google Code Jam - Rotate. It’s time for some basic finger exercise. The Google Code Jam Rotate is very trivial, so relax and fire up your IDE. I was a bit lazy, so there is no reading of the input sets, just a two-dimensional array and two functions Rotating As the Google solution pointed out, there is actually no need to really rotate the 2dim array. So here is the “gravity from the right” code public static void fakeRotate ( char [][] board ) { for ( int i = 0 ; i < N ; i ++) { for ( int j = N - 1 ; j >= 0 ; j --) { if ( board [ i ][ j ] ! // push to right int m = 1 ; while (( j + m ) < N && board [ i ][ j + m ] == '.' ) { board [ i ][ j + m ] = board [ i ][ j + ( m - 1 )]; board [ i ][ j + ( m - 1 )] = ' m ++; Checking for a winner Now we have everything ready to look for a winner.

Progressing this way, I only need to check in four directions. Public static void checkForWinner ( char [][] board ) { boolean redWins = false ; boolean blueWins = false ; for ( int i = 0 ; i < N ; i ++) { for ( int j = 0 ; j < N ; j ++) { break ; How I Explained REST to My Wife. Visualising sorting algorithms. This is another one of my rare technical posts, as opposed to news of which countries I've been visiting. If you're in computer science, you've probably seen an animation of sorting algorithms, maybe heard a rendition, or seen a visual representation. I have, somewhat by accident, discovered a different way to visualise a sorting algorithm: plot points for memory accesses, with address on the X axis and time (counted by accesses) on the Y axis, and different colours for reads and writes. It produces some rather pretty pictures. Note that these are not to scale relative to each other - the Y axis has been compressed to fit the entire sort into a fixed height.

Ye olde bubblesort. Some of the patterns are an optical illusion due to aliasing, but the green spikes are a feature of the algorithm. Insertion sort - the version optimized for mostly sorted content. Shellsort, clearly showing the phases. Selection sort: Divide-and-conquer algorithms have a pretty fractal nature.

Coin Tosses, Binomials and Dynamic Programming. Today someone asked about the probability of outcomes in relation to coin tosses on Stackoverflow. It’s an interesting question because it touches on several areas that programmers should know from maths (probability and counting) to dynamic programming. Dynamic programming is a divide-and-conquer technique that is often overlooked by programmers. It can sometimes be hard to spot situation where it applies but when it does apply it will typically reduce an algorithm from exponential complexity (which is impractical in all but the smallest of cases) to a polynomial solution.

I will explain these concepts in one of the simplest forms: the humble coin toss. Bernoulli Trials A Bernoulli trial is an event (or experiment) that randomly has two outcomes. The probability of each outcome is known. What constitutes success is arbitrary. Assume a fair coin (p = 0.5). If you ignore the actual values and reduce it to the number of permutations: Binomial Distribution (1 + x)n For example: f(n,k) = nCk = n! 10 Great Tips for Writing Better And More Comprehensive CSS. There are many different coding styles, some do not like indentation, some like to capitalize certain things, others like to add more than one element on a line, the main train of thought is they are all after one common thing: organization and better code.

Without influencing my coding style, we’ll discuss ten tips for writing better CSS. Let us know what you think in the comment section! See you there ;) Comments Commenting throughout your style sheet significantly helps you locate certain code blocks of CSS quickly and efficiently. Imagine trying to search through a CSS file with hundreds of lines of code, it can take quite some time to get where you want. Indentation Indentation is another key to keeping your code neatly organized and easy to flip through.

Shorthand Code I have seen many style sheets consist of non-shorthand code. One Line per Rule Hacks Should Stay Out Meaningful Names for Classes and IDs Eliminate Unused CSS Classes and IDs Immediately Alphabetical Order Your Turn To Talk.