Wednesday, December 19, 2012

HTML5 Definition Complete, W3C Moves to Interoperability Testing and Performance

W3C published today the complete definition of the HTML5 and Canvas 2D specifications. Though not yet W3C standards, these specifications are now feature complete, meaning businesses and developers have a stable target for implementation and planning. "As of today, businesses know what they can rely on for HTML5 in the coming years, and what their customers will demand," said Jeff Jaffe, W3C CEO. HTML5 is the cornerstone of the Open Web Platform, a full programming environment for cross-platform applications with access to device capabilities; video and animations; graphics; style, typography, and other tools for digital publishing; extensive network capabilities; and more. Read the full press release and W3C Member testimonials.

Thursday, December 13, 2012

You should use JSON.stringify() and json2.js

Do you find often writing code like the following:

$.ajax({
   url:'/xxx/yyy',
   data: '{action:' + action + ', id:' + id + '}',
   success: function (data) {
      console.log('ajax success...');
   },
   error: function (request, status, error) {
      console.log('ajax error...');
   }
});

Don’t do like that anymore, this code is ugly and buggy! You know that you should use JSON.stringify() for serializing ajax data parameters, don’t you? Buggy code should be changed to the following version:

var args = { 'action': action, 'id': id };
$.ajax({
   url:'/xxx/yyy',
   data: JSON.stringify(args),
   success: function (data) {
      console.log('ajax success...');
   },
   error: function (request, status, error) {
      console.log('ajax error...');
   }
});

Many modern browsers have native implementation for JSON.stringify(). For old ones you should use json2.js. The script automatically makes sure it only adds a JSON.stringify() method if it doesn't already exist so there is no danger including it in a browser that already has native support.

Thursday, December 6, 2012

A Few New Things Coming To JavaScript (link)

I believe the day-to-day practice of writing JavaScript is going to change dramatically for the better when ECMAScript.next arrives. The coming year is going to be an exciting time for developers as features proposed or finalised for the next versions of the language start to become more widely available.

In this post, I will review some of the features I'm personally looking forward to landing and being used in 2013 and beyond.

Read more...

Tuesday, December 4, 2012

Voyager 1 spots new region at the edge of the Solar System (link)

Several years ago the Voyager spacecraft neared the edge of the Solar System, where the solar wind and magnetic field started to be influenced by the pressure from the interstellar medium that surrounds them. But the expected breakthrough to interstellar space appeared to be indefinitely put on hold; instead, the particles and magnetic field lines in the area seemed to be sending mixed signals about the Voyagers' escape.

Read more...

Saturday, December 1, 2012

Dont Be Clever (link)

I've come across way to much clever code. If your writing code that you think is clever, just stop it.

- Scott Radcliff

Read more...

Friday, November 23, 2012

Vim save file as utf-8

This time it's quick tip: how to save file as utf-8 in vim

:set bomb
:set fileencoding=utf-8
:wq

Monday, November 19, 2012

Quotes from the Nato Software Engineering Conference in 1968 (link)

Programming management will continue to deserve its current poor reputation for cost and schedule effectiveness until such time as a more complete understanding of the program design process is achieved.

We build systems like the Wright brothers built airplanes — build the whole thing, push it off the cliff, let it crash, and start over again.

Production of large software has become a scare item for management. By reputation it is often an unprofitable morass, costly and unending. This reputation is perhaps deserved.

Read more...

Friday, November 16, 2012

9 uses for cURL worth knowing (Hacking on HTTP from the Command-Line) (link)

Working with HTTP from the command-line is a valuable skill for HTTP architects and API designers to have. The cURL library and curl command give you the ability to design a Request, put it on the pipe, and explore the Response. The downside to the power of curl is how much breadth its options cover. Running curl --help spits out 150 different flags and options. This article demonstrates nine basic, real-world applications of curl.

Read more...

Thursday, October 25, 2012

Rob Pike - Concurrency Is Not Parallelism (link to video)

Rob (@rob_pike) is a software pioneer. His influence is everywhere: Unix, Plan 9 OS, The Unix Programming Environment book, UTF-8, and most recently the Go programming language.

Watch this video...

Turning to the past to power Windows' future: An in-depth look at WinRT (link)

Windows 8 supports all the traditional Windows applications that have been developed over past decades. But the centerpiece of Windows 8 is not its support for legacy applications. With Windows 8, Microsoft wants to develop a whole new ecosystem of applications: touch-friendly, secure, fluidly animated. The new aesthetic was known as Metro, though rumored legal issues have chased the company away from that particular name. These new applications aren't built with the time-honored Windows APIs of yore. They're built with something new: the "Windows Runtime," aka "WinRT."

Read more...

Friday, October 12, 2012

Performance Tips for JavaScript in V8 (link)

It's important to indentify and understand how the V8 engine works with your code to prepare to build performant JavaScript. Once more, the basic advice is:

  • Be prepared before you have (or notice) a problem
  • Then, identify and understand the crux of your problem
  • Finally, fix what matters
This means you should ensure the problem is in your JavaScript, by using other tools like PageSpeed first; possibly reducing to to pure JavaScript (no DOM) before collecting metrics, and then use those metrics to locate bottlenecks and eliminate the important ones. Hopefully Daniel's talk (and this article) will help you understand better how V8 runs JavaScript - but be sure to focus on optimizing your own algorithms, too!

Read more...

How 3.6 nearly broke PostgreSQL (link)

In mid-September, the 3.6 kernel appeared to be stabilizing nicely. Most of the known regressions had been fixed, the patch volume was dropping, and Linus was relatively happy. Then Nikolay Ulyanitsky showed up with a problem: the pgbench PostgreSQL benchmark ran 20% slower than under 3.5. The resulting discussion shows just how hard scalability can be on contemporary hardware and how hard scheduling can be in general.

Read more...

Friday, October 5, 2012

Wait, DevTools could do THAT? (link)

A whirlwind tour of DevTools tips and tricks

  • Hidden features, new features & things I wish I knew about...
  • Extending & customizing DevTools to meet your needs
  • 3rd party tools and integrations!

Read more...

NHibernate: Using The Guid.Comb Identifier Strategy

As you may have read by now, it's a good idea to avoid identity-style identifier strategies with ORM's. One of the better alternatives that i kinda like is the guid.comb strategy. Using regular guids as a primary key value leads to fragmented indexes (due to the randomness of the guid's value) which leads to bad performance. This is a problem that the guid.comb strategy can solve quite easily for you.

Read more...

Thursday, October 4, 2012

The Cost of GUIDs as Primary Keys (link)

In this article, Jimmy Nilsson presents the pros and cons of using globally unique identifiers (GUIDs) as the datatype for primary keys in SQL Server 2000. In doing so, he shows you test results that hint of performance characteristics and introduces you to a special type of GUID that he invented, called COMBs, that solves what otherwise might give you a big throughput problem.

Read more../

Friday, September 28, 2012

Basic Authentication for Windows Azure Websites (link)

Suppose that you are building a fancy new website and want to show your progress to your client. You create a new website in the Windows Azure management portal and eploy your code. You also want to make sure that only trusted users can access the website. Basic authentication seems like the most logical solution, but you suddenly realize that you cannot use basic authentication in Windows Azure websites in the same way you used it on your on-premises web server. In this article I will show you how to build your own HTTP managed module to achieve the same goal in Windows Azure websites.

read more..

SQL SERVER – DATEDIFF (link)

In SQL statement below the time difference between two given dates is 3 sec, but when checked in terms of Min it says 1 Min (whereas the actual min is 0.05Min)

SELECT DATEDIFF(MI,'2011-10-14 02:18:58' , '2011-10-14 02:19:01') AS MIN_DIFF
Is this is a BUG in SQL Server ?

read more..

Thursday, September 27, 2012

Three Hidden Extensibility Gems in ASP.NET 4 (link)

ASP.NET 4 introduces a few new extensibility APIs that live the hermit lifestyle away from the public eye. They’re not exactly hidden - they are well documented on MSDN - but they aren’t well publicized. It’s about time we shine a spotlight on them.

Read more...

Tuesday, September 25, 2012

The Architecture of the High-Speed Web Server (link)

The IIJ-II Research Laboratory began development of a Web server called Mighttpdblank (pronounced "mighty") in Fall of 2009, and has released it as open source. Through its implementation we arrived at an architecture that has enhanced multi-core performance while maintaining code simplicity. Here we take a look at each architecture one at a time.

Read more...

Friday, September 14, 2012

PostgreSQL 9.2 released

Improved Performance and Scalability

...With the addition of linear scalability to 64 cores, index-only scans and reductions in CPU power consumption, PostgreSQL 9.2 has significantly improved scalability and developer flexibility for the most demanding workloads...

Flexible Developer Support

...Range Types allow developers to create better calendaring, scientific, and financial applications. No other major SQL database supports this feature, which enables intelligent handling of blocks of time and numbers...

...With PostgreSQL 9.2, query results can be returned as JSON data types. Combined with the new PL/V8 Javascript and PL/Coffee database programming extensions, and the optional HStore key-value store, users can now utilize PostgreSQL like a "NoSQL" document database, while retaining PostgreSQL's reliability, flexibility and performance...

Read more...

Thursday, September 13, 2012

Keeping JS Sane (link)

I gave a talk at #DDD10 this Saturday about keeping JS sane, I had some questions after about the list of things I ran through so documented in all its glory are my current thoughts on development with a dynamic language like JS.

Read here more...

Wednesday, September 5, 2012

Named and Optional Arguments (C# Programming Guide) (link)

Named arguments enable you to specify an argument for a particular parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list. Optional arguments enable you to omit arguments for some parameters. Both techniques can be used with methods, indexers, constructors, and delegates.

Read more ...

Monday, September 3, 2012

Why do web sites and software take so long to build? And why is it so hard? (link)

... in the history of the world, he said, is there one thing you can think of that has been hand-made, and on such a large scale as software, that was as complex?

Read more here...

Sunday, September 2, 2012

The Most Important Writing Lesson I Ever Learned (link)

Here it is. Here’s the #1 lesson you learn working in advertising (and this has stuck with me, to my advantage, my whole working life): Nobody wants to read your shit.

Let me repeat that. Nobody–not even your dog or your mother–has the slightest interest in your commercial for Rice Krispies or Delco batteries or Preparation H. Nor does anybody care about your one-act play, your Facebook page or your new sesame chicken joint at Canal and Tchopotoulis. It isn’t that people are mean or cruel. They’re just busy. Nobody wants to read your shit.

Read here more..

Saturday, September 1, 2012

An Introduction to Lock-Free Programming (link)

Lock-free programming is a challenge, not just because of the complexity of the task itself, but because of how difficult it can be to penetrate the subject in the first place.

I was fortunate in that my first introduction to lock-free (also known as lockless) programming was Bruce Dawson’s excellent and comprehensive white paper, Lockless Programming Considerations. And like many, I’ve had the occasion to put Bruce’s advice into practice developing and debugging lock-free code on platforms such as the Xbox 360.

Read more here...

Friday, August 31, 2012

Complexity of simple data types (link)

Sometimes the simplest of things have complex answers. In programming we like to think of simple data types, but in reality there aren’t any. While it is nice to consider things as pure data, it is possible that such things don’t actually exist.

Read more here...

Saturday, August 18, 2012

A* Pathfinding for Beginners (link)

Pathfinding or pathing refers to the plotting, by a computer application, of the shortest route between two points. It is a more practical variant on solving mazes. This field of research is based heavily on Dijkstra's algorithm for finding the shortest path on a weighted graph.
- Wikipedia

The A* (pronounced A-star) algorithm can be complicated for beginners. While there are many articles on the web that explain A*, most are written for people who understand the basics already. This article is for the true beginner.

This article does not try to be the definitive work on the subject. Instead it describes the fundamentals and prepares you to go out and read all of those other materials and understand what they are talking about. Links to some of the best are provided at the end of this article, under Further Reading.

Read here... more

Monday, August 13, 2012

A comparison of C++11 language support in VS2012, g++ 4.7 and Clang 3.1 (link)

If you need an excuse for celebration, today happens to be an anniversary! The C++11 standard was approved by ISO on 12 August last year, exactly one year ago. I decided to take a look at the state of C++11 language support one year on across three compilers: the upcoming VS11 (Visual Studio 2012), g++ 4.7 and Clang 3.1.

Please note I didn’t detail the non-language concurrency changes. Generally, support for those remains limited. Read more here

Friday, August 10, 2012

Automating JavaScript Testing with QUnit (link)

QUnit was born May 2008, out of the testrunner embedded into the jQuery core repository. It got its own name and documentation and a new home for the code. Late 2009 QUnit was refactored to be independent of jQuery, making it useful for testing all kinds of JavaScript frameworks and applications. Its assertion methods now follow the CommonJS assert specification. While QUnit can run in server-side or command line environments, it’s still most useful for testing JavaScript in the browser. This article explores how to write unit tests with QUnit, and how QUnit can help developing applications.

Read more here...

Thursday, August 9, 2012

Free JavaScript tutorials (link)

"Level up your skills with our on demand, pragmatic training solution. No signup required. No catch. No kidding." For Learning jQuery & JAVASCRIPT for free go here

Wednesday, August 8, 2012

Mastering JavaScript Console Logging (link)

The console object crops up everywhere. But what is it, and what can it do? Most people seem to use it without realising the sheer convenience it can provide. Let’s take a look at where it comes from, and how to use it correctly.

Read more here

Tuesday, August 7, 2012

My JavaScript IDE: vim + nodejs + JSLint

Recently I had chance to spend more time to work with JavaScript. So I have created custom Vim configuration for JavaScript editing. Here is link to my dofiles on GitHub.

I have mapped JSLint to 'F5'. So I can run JSLint by hitting 'F5' and JSLint output will be shown in separate window. This mode activates then I open JavaScript file.

The easiest way to install JSLint first to install nodejs and then jslint node module:

npm install jslint -g

Thursday, August 2, 2012

My new gitignore file for C# projects

I have updated my old gitignore file. The following is my new git ignore (.gitignore) file for C# projects. I use both VisualStudio and MonoDevelop as IDE's, NUnit for unit testing and also vim for quick view/edit ;)
# Build and Object Folders
bin/
Bin/
obj/
Obj/

# User Specific Files
*.user
*.suo
*.userprefs
*.pidb


# Resource Caches
_ReSharper.*
*.cache

# Nuget
packages

# Vim
*~
*.swp

# Unit tests
TestResults
test-results

# Upgrade Report Files
_UpgradeReport_Files/

# Nuget
packages/**
!packages/repositories.config

# Logs
*.log
You can always find the up-to-date version of this file in my GitHub repository: dotfiles

Wednesday, August 1, 2012

Monday, July 30, 2012

The making of Warcraft part 1 (link)

Back before the dawn of time, which is to say when PC games were written for the DOS operating system, I got to work on a game called Warcraft.

Read more...

Three Rules for Database Work (link)

Some developers love working with relational databases, and other developers can't stand to touch them. Either way - if your application uses a database, you have to treat the database with some respect. The database is as much a part of an application as the code and the models inside the software.

Here are three rules I've learned to live by over the years of working with relational databases.

Read here more...

Monday, July 23, 2012

The Entity Framework source code is today being released under an open source license (Apache 2.0)

Scott Guthrie (form Microsoft) wrote this in his blog:

The Entity Framework source code is today being released under an open source license (Apache 2.0), and the code repository is now hosted on CodePlex (using Git) to further increase development transparency. This will enable everyone in the community to be able to engage and provide feedback on code checkins, bug fixes, new feature development and build and test the product on a daily basis using the most up to date version of the source code and tests. Community contributions will also be welcomed, so you can help shape and build Entity Framework into an even better product. You can find all the details on the Entity Framework CodePlex Site.

Friday, July 20, 2012

Git, SSH, PuTTY, GitHub, Unfuddle, the kitchen sink (link)

After reading a good number of the guides for getting Git/ GitHub/ Unfuddle working correctly in Windows, I finally got it sorted out. I had to use a bunch of things I had not used before so I realized it's probably a good idea to share my findings, hoping to help someone else (and maybe myself again) in the future. Read more...

Tuesday, July 17, 2012

Get Your Database Under Version Control (link)

Here is old but good intro into Database Under Version Control

How to consume YouTube video feed from C#

Before starting you should register developer key: https://code.google.com/apis/youtube/dashboard

Here is link to documentation: https://developers.google.com/youtube/2.0/developers_guide_protocol_audience

We will start by installing Google.GData.YouTube NuGet package:

PM> Install-Package Google.GData.YouTube
**Note** If you using MonoDevelop IDE, sorry but first you will have to download .NET library for the Google Data API manually from here

Let's create new console application project. In our example will fetch title and id of all uploaded videos of TobyGames user. Pay attention that we will use StartIndex and NumberToRetrieve on query object for result pagination. And here follows the source code of our example:

using System;
using Google.YouTube;
using Google.GData.Client;
using Google.GData.YouTube;

namespace YouTubeApiSample
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var settings = new YouTubeRequestSettings ("API_YouTube", "YOUR_API_KEY_HERE");
            
            int index = 1;
            int pageSize = 9;

            while (true) {

                var request = new YouTubeRequest (settings);
                var query = new YouTubeQuery("http://gdata.youtube.com/feeds/api/users/windowsazure/uploads");
                
                query.OrderBy = "published";
                query.StartIndex = index;
                query.NumberToRetrieve = pageSize;

                Feed<Video> feed = null;

                try
                {
                    feed = request.Get<Video>(query);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error have occurred while retrieving data from YouTube: {0}", ex.Message);
                }
                
                if (feed != null && feed.Entries != null) {

                    int count = 0;
                    try
                    {
                        foreach (var entry in feed.Entries) {
                            Console.WriteLine("Video title: {0} -> Id: {1}", entry.Title, entry.Id);
                            count++;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error have occurred while retrieving data from YouTube: {0}", ex.Message);
                        break;
                    }

                    if (count < pageSize) {
                        Console.WriteLine("All data fetched!");
                        break;
                    }

                    index = index + count + 1;
                }
                else {
                    Console.WriteLine("Error have occurred while retrieving data from YouTube.");
                    break;
                }
            }
        }
    }
}

Thursday, July 12, 2012

Wednesday, July 4, 2012

Github syntax highlighting style for VisualStudio

I created Github inspired syntax highlighting theme for VisualStudio. This theme is very light on colors. Here follows screenshot of github theme in action:

As always you can find it on github.com

Tuesday, July 3, 2012

Guidelines and rules for GetHashCode by Eric Lippert

This is best post about GetHashCode guidelines in C# world.

Thursday, May 31, 2012

How to add a unique constraint on multiple columns with FluentNHibernate

For example, we have table ‘WebsiteLinks’ and two columns ‘WebsiteId’ and ‘Url’ and we would like to make unique constraint which includes those two columns. In FluentNHibernate this is archived by using ‘UniqueKey’ construct. Here follows example:
public class WebsiteLinkMap : ClassMap<WebsiteLink>
{
    public WebsiteLinkMap()
    {
        Table("WebsiteLinks");

        Id(x => x.Id).GeneratedBy.Identity();

        Map(x => x.Url).Not.Nullable().Length(256).UniqueKey("UQ_WebsiteLinks_URL_ WebsiteId");
        References(x => x. Website).UniqueKey("UQ_WebsiteLinks_URL_WebsiteId ");
    }
}

Saturday, May 19, 2012

Domantas Razauskas "Lietaus kambarys"

Domantas Razauskas "Lietaus kambarys"
Man pasirodė, kad tu nubudai.
Arba čia tiesiog pasidarė šilčiau.
Paklausei „Ar girdi,
kaip dega laidai mano viduje“ ?
Aš prisėdau arčiau,
Aš nežinau, kaip kvėpuoti.
Dangus man rodo ženklus,
Kurių nematau.
O tu sakai „Bandyk išgirsti, brangus.
Šita širdis liepsnoja tik tau.“

Atsitiko kad mūsų buvo tik trys.
Tu, aš ir lietaus kambarys.
Aš negalėjau įžiūrėti raidžių.
Aš užsimerkiu ir atrodo girdžiu,
Kaip tyliai smilksta, kaip dega giliai,
Į viršų kyla šviesos spinduliai.
Ir nebelieka nei vakar, nei ryt.
Tu pakeli ranką – ir pradeda lyt.

Galėjo būti, kad išaušo diena
Laikrodis mušė trečia nakties
Mušė taip, kad ši išėjo viena 
ir aš atsimerkiau vien nuo šios minties
taip ir sėdejau metus, o gal tris
tu aš ir lietaus kambarys

kaip garsai kurių nieks negirdės
degančiais laidais prie širdies
Skamba juokas giliai šuliny
Aš esu, o tu gyveni
Mane nupūs vėjas rytų
Jei sudegsiu anksčiau negu tu
Sakai nera pabaigų ir pradžių, ir aš
Tikiu tavim nors beveik negirdžiu
Žiurėk į šviesą į mane nežiūrėk
Sako jis išėjo ir tiek.

Friday, May 18, 2012

Free .NET Decompiler from JetBrains Goes Live

list of features:
  • Decompiling .NET Framework 1.0-4.5 assemblies to C#.
  • The look and feel of a code editor, ensuring a familiar environment for developers.
  • Quick overview of code structure and hierarchy.
  • Powerful ReSharper-inspired navigation and search, including instant jump to a specific type, assembly, symbol, or type member, as well as navigation to symbol declarations, implementations, derived and base symbols.
  • Accurate search for symbol usages with advanced presentation of search results.
  • Connecting to symbol and source servers to fetch original source code, if available.
  • Keyboard shortcuts for most actions that would be familiar to ReSharper users.
Learn more about the decompiler and download dotPeek 1.0!

Wednesday, May 9, 2012

PostgreSQL Magazine #01 is out!

In this first issue, we will talk of the wonders of PostgreSQL 9.1 and we'll get a sneak peek at the upcoming 9.2 version. We'll take a look at Mac OSX Lion and we'll ask a bunch of questions of Stephan Kaltenbrunner, one of the sysadmins behind the postgresql.org infrastructure… Read here...

Monday, May 7, 2012

New NHibernate version 3.3.0.GA is now available

Summary of changes:
  • Many improvements to the LINQ provider to extend the set of queries which it can handle.
  • Introduction of the "enhanced" family of id generators. These can be backed by either a sequence or a table, have built in support for tracking several id series in the same table, and share a common set of optimizers, which implement e.g. HiLo or Pooled algorithms.
  • Some new abilities in Mapping-By-Code
  • And a nice batch of bug fixes in other areas.
Read more here...

Friday, April 13, 2012

Articles Worth Your Time 2011-04-13

1. Can JITs be faster? (from http://tirania.org/blog/)
Very interesting article about JITs compiler. Covers principals of JIT optimization with some examples from modern JITs (JAVA HotSpot and Mono JIT compiler).
Read more...

2. C Finally Gets A New Standard (from http://drdobbs.com)
Tom Plum explores the new additions to C in a series of articles, starting with language-level atomic operations and thread primitives.
Read more...

Thursday, April 12, 2012

I was mentioned in .Net Rocks! Show. Awesome!!!

I was mentioned in .Net Rocks! The following is transcript form show #743:

Carl Franklin:
So, what I went out and did is I found a really good blog post on something that we haven’t really talked about. Google has this GeoCoding API so that you can convert an address like, whatever, a real physical address into geographic coordinates. Well, I went looking for some good examples of how to access that in C# and I found the Random Thoughts blog which is a guy named Darius in Lithuania, and he did this awesome article. It was from last year, about this time: GeoCoding with C# and Google GeoCoding API V3 which is still the current version. If you go to www.tinyurl.com/geocodingdotnet you’ll get to that article. And I thought it was good because it’s something you don’t see every day, and he’s using... He has another version that uses JSON to access it, and it’s just clean and easy and commented well. There’s a couple of comments that this is exactly what these people are looking for.

Richard Campbell: Awesome!

Thank you “.Net Rocks!” guys, thank you!

Tuesday, April 10, 2012

It's time to move on

I have worked in SoftDent for 2 years 8 months but is time to leave now for new opportunities. I have many people to thank for supporting me and teaching me. My teammates and coworkers. Something that I will miss the most is the joy of creating and joy of solving hard problems together, all the years of fun and learning. Many of my teammates have become very strong developers and it has been a privilege to work with them. We have tried so many new shiny things: TDD, Continues integration, Scrum, Git, NUnit, NHibernate and PostgreSQL... So long, and thanks for all the fish ;)

I wish good luck in all your future endeavors!

P.S. And one more time morning motivation song...

Wednesday, April 4, 2012

Quote of The Day 2012-04-04

The brain works as naturally as the kidneys and the blood-vessels. It is not dormant just because there is no conscious purpose to be served at the moment…

…it goes right on manufacturing ideas – streams and deluges of ideas, that the sleeper is not using to think with about anything. But the brain is following its own law; it is actively translating experiences into symbols, in fulfillment of a basic need to do so. It carries on a constant process of ideation.

- Susanne K. Langer

Monday, February 27, 2012

15 Best Practices of Variable & Method Naming (link)

1. Use short enough and long enough variable names in each scope of code. Generally length may be 1 char for loop counters, 1 word for condition/loop variables, 1-2 words for methods, 2-3 words for classes, 3-4 words for globals.

Read more...

Saturday, February 25, 2012

The Sun is Setting on Rails-style MVC Frameworks (link)

Lately I've been thinking a lot about the impact of the move to a thick client architecture for web applications, and I'm becoming more and more certain that this means that Rails-style MVC frameworks on the server-side are going to end up being phased out in favor of leaner and meaner frameworks that better address the new needs of thick-client architecture.

There are a few major reasons for this:

Read more here...

Friday, February 24, 2012

what is Func<T>, really?

Have you ever wondered what the hell is this Func thing? Wonder no more because simply is is the following thing:
public delegate TResult Func<out TResult>();
Don't believe? Here is the screenshot of reflector:

Wednesday, February 22, 2012

MonoDevelop syntax highlighting style inspired by GitHub site

Hi,

I created new syntax highlighting style for MonoDevelop inspired by Github.com site. This time it's light style. The following is screenshot of this theme.

You will find all my themes at github repo: MonoDevelop-Styles.

Tuesday, February 21, 2012

MonokaiNotBold theme for MonoDevelop

Hi,

I have finished alternative version of Monokai theme for MonoDevelop. This time I removed bold style from all keywords. You can grab copy of MonokaiStyleNotBold.xml from my Monokai github repo. By the way original (bold) style is available from the same github repo. It is called MonokaiStyle.xml. Here is post about original version of Monokai for MonoDevelop.

P.S. How to install

  • in MonoDevelop open menu -> Tools -> Options
  • navigate to -> Text Editor -> Syntax Highlighing
  • press 'Add' button
  • nvigate to file 'MonokaiStyle.xml'
  • press 'Open'
  • select 'Monokai' theme and then press 'OK'
  • close and reopen all your file tabs
Have fun ;)

Essential JavaScript Design Patterns For Beginners (link)

I hope this book helps on your journey to improving your knowledge of design patterns and the usefulness of their application to JavaScript. Read more...

Monday, February 20, 2012

What Level Programmer Are You? (link)

Everybody's talking about how programming is the skill that we all are going to need. [Except those folks who might feel that most programming could be turned into wizard-like tools. Insert long discussion about Strong AI.] But what's a programmer? Is the guy who set up his own Apache Web Server a programmer? How about the guy who created a complex Excel spreadsheet? The guy who made his own RPG level? Minecraft players? When we say "Everybody is going to have to know programming" what, exactly, does that mean? Read more...

My git ignore (.gitignore) file for C# projects

The following is my git ignore (.gitignore) file for C# project. I use both VisualStudio and MonoDevelop as IDE's, NUnit for unit testing and also vim for quick view/edit ;)
bin
obj
Obj
TestResults
test-results
*.csproj.user
*.suo
*.cache
*~
*.swp
*.userprefs
*.pidb

Sunday, February 19, 2012

20 Linux System Monitoring Tools (link)

Need to monitor Linux server performance? Try these built-in command and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide metrics which can be used to get information about system activities. You can use these tools to find the possible causes of a performance problem. The commands discussed below are some of the most basic commands when it comes to system analysis and debugging server issues such as:
  • Finding out bottlenecks.
  • Disk (storage) bottlenecks.
  • CPU and memory bottlenecks.
  • Network bottlenecks.
Read more

Wednesday, February 15, 2012

Wayland - the life beyond X Windows (link)

Although current discussion of the Linux desktop tends to focus on the disharmony around Unity and the GNOME shell, the true revolution on the desktop is taking place out of sight of users. The Wayland display server is expected to reach version 1.0 later this year, and is seen by many as the long term replacement for the X Window System, with real potential to improve and transform the performance of the desktop for Linux users. Read more...

Visual Studio 2010 Keyboard and Mouse Shortcuts (link)

It's time to learn a thing or two about VisualStudio keyboard shortcuts...

Tuesday, February 14, 2012

Create your first code template for MonoDevelop

I switched from VisualStudio to MonoDevelop as my primary IDE not long time ago. Wat satisfies me in MonoDevelop most it is the level of customization you can applay to it... I was long time user of VisulaStudio and I always used VisualStudio defaults. Monoevelop triggered something in me and in few weeks I created MonokaiStyle for MonoDevelop and MonoDevelop custom code templates. Now I'll show you how you can create yours code templates... Tools->Options
Text Editor->Code Templates->C# and then press add. We will implement IDisposable code template as an example. Start by pasting the following code into code editor:
namespace MyNamespace
{
 public class MyClass : IDisposable
 {
  private bool _disposed = false;

  public MyClass()
  {
  }

  public bool IsDisposed
  {
   get { return _disposed; }
   private set { _disposed = value; }
  }

  protected virtual void Dispose(bool disposing)
  {
   if (!IsDisposed)
   {
    if (disposing)
    {
    }

    IsDisposed = true;
   }
  }

  public void Dispose()
  {
   Dispose(true);
   GC.SuppressFinalize(this);
  }

  ~MyClass()
  {
   Dispose(false);
  }
 }
}
Now we will replace namespace and class names with placeholders (placeholders starts and ends with '$' characters). Your template should look like this:
namespace $MyNamespace$
{
 public class $MyClass$ : IDisposable
 {
  private bool _disposed = false;

  public $MyClass$()
  {
  }

  public bool IsDisposed
  {
   get { return _disposed; }
   private set { _disposed = value; }
  }

  protected virtual void Dispose(bool disposing)
  {
   if (!IsDisposed)
   {
    if (disposing)
    {
    }

    IsDisposed = true;
   }
  }

  public void Dispose()
  {
   Dispose(true);
   GC.SuppressFinalize(this);
  }

  ~$MyClass$()
  {
   Dispose(false);
  }
 }
}
press OK (now your template will be saved).
Now you can use it Edit->Insert template->dsp

Github repo you should watch 2011-02-14 - Xwt

Xwt is a new .NET framework for creating desktop applications that run on multiple platforms from the same codebase. Xwt works by exposing one unified API across all environments that is mapped to a set of native controls on each platform. This means that Xwt tends to focus on providing controls that will work across all platforms. Which means that the functionality available is usually a common denominator across all platforms. The following code taken from github repo README:
using Xwt;

class XwtDemo 
{ 
    static void Main () 
    { 
        Application.Initialize (); 

        var mainWindow = new Window ()
        { 
            Title = "Xwt Demo Application", 
            Width = 500, 
            Height = 400 
        }; 
            
        mainWindow.Show (); 
        
        Application.Run (); 
        
        mainWindow.Dispose (); 
    }
}
Link to GitHub repo

Monday, February 13, 2012

Practical Garbage Collection, part 1 – Introduction (link)

This is the first part of a series of blog posts I intend to write, whose aim will be to explain how garbage collection works in the real world (in particular, with the JVM). I will cover some theory that I believe is necessary to understand garbage collection enough for practical purposes, but will keep it to a minimum. Read more...

Sunday, February 12, 2012

Van Gogh's Starry Night comes to Life (link)

A fluid simulation gently creates a flowing fabric from Van Goghs impressionist portrait of the Milky Way and night sky over Saint-Rémy in France using the thick paint daubs as the particles within the fluid.

A touch interface allows a viewer to deform the image, altering both the flow of the particles and the synthesized sound, and then watch it slowly return to its original state. The sound itself is created using a MIDI interface to create a soft ambient tone out of the movement of the fluid that underscores the soft movement. Beauty through simplicity at its finest and most playful.

Saturday, February 11, 2012

Friday, February 10, 2012

NNXT - DRNK TXTNG (free music at www.digsin.com)

Github repo you should watch 2011-02-10 - node.native

Excerpt from README:

node.native is a C++11 (aka C++0x) port for node.js.

Sample code:

Simplest web-server example using node.native.

#include <iostream>
#include "http.h"
using namespace native::http;

int main()
{
    http server;
    if(server.listen("0.0.0.0", 8080, [](request& req, response& res){
        res.set_status(200);
        res.set_header("Content-Type", "text/plain");
        res.end("C++ FTW\n");
    })) std::cout << "Server running at http://0.0.0.0:8080/" << std::endl;

    return native::run();
}
Go to repo

Bjarne Stroustrup: C++11 Style (link)

We know how to write bad code: litter our programs with casts, macros, pointers, naked new and deletes, and complicated control structures. Alternatively (or additionally), we could obscure every design decision in a mess of deeply nested abstractions using the latest object-oriented programming and generic programming tricks. Then, for good measure, we might complicate our algorithms with interesting special cases. Such code is incomprehensible, unmaintainable, usually inefficient, and not uncommon. But how do we write good code? Watch here...

Thursday, February 9, 2012

Escaping the Cycle of Technical Debt (link)

If you are not familiar with the concept, technical debt is essentially the idea that you build and program things quickly, skipping the niceties in order to ship, and then fix it later. By putting things off you build up debt that needs to be paid down later. One of the places this most commonly shows itself is in performance. It works like this. Developers make features because the business and users want features. Performance is hard, and the benefits of good performance are not usually as obvious or concrete as the benefits of new features. Therefore, nobody really pays attention to performance or it is intentionally skipped until it gets so bad that people consciously notice it. Then the developers need to do a “feature freeze” and fix things until performance is at least “okay.” again. If you don’t mind the cliche, the feature freeze is the “Rinse.”, and then it all starts over again — “Repeat.” This is the cycle of technical debt. At Stack Exchange I saw this happen, the developers had to stop working on features and fix performance because it got the point where we were getting timeouts. However, here is where things get interesting: After that, it never happened again. Read more

Wednesday, February 8, 2012

How I learned to stop worrying and love REST (link)

Buzzwords can be a funny thing. I’ve been writing (what I thought were) ‘RESTful’ web apps and APIs for five years now, and it wasn’t until a couple of weeks ago that I really began to understand what that meant. I’d like to share my ‘AHA’ moment, and give a concrete example of why following the REST style correctly can save you headaches in the long run. Read more here...

Keep It Simple, Stupid (link)

K-I-S-S: Keep It Simple, Stupid. It’s a mantra that always pops into my head when I’m looking at new startups. A lot of them seem to want to do a million different things because other companies have been successful at one of those things in the past. But that’s a bad idea. Way too many new products and services are too complicated. And I would suggest, often fail as a direct result of that. Read more here...

Tuesday, February 7, 2012

One way to defeat boredom

In his blog post Scott Hanselman writes that one of methods for defeating lack of motivation is "skinning and themeing" of your IDE...

"More and more I find myself "skinning and themeing" my Visual Studio development environment 
in order to stay frosty. It's surprising how changing your theme (fonts, colors, etc.) can 
re-energize me when I'm having trouble with some problem or motivation."

- Scott Hanselman

But I took one step further and switched my IDE from VisualStudio to MonoDevelop.

One week later...

Performance:

  • on my 32-bits Windows MonoDevelop is very stable (Warring: colleagues had many problems with MonoDevelop on 64-bit Windows).
  • consumes less memory...
  • feels snappier
  • don't do magic tricks with your code

Customization:

I think the best MonoDevelop feature is that you can customize it the way you like.

  • customize visual style (Tools->Options->Preferences->Visual Style) however this requires some work in LINUX you jest download GTK+ 2.x theme (and it's engine) you like from gnome-look or install it from your package manager. In Windows it's a lot more work (most of gtk themes didn't worked). If you like the dark gtk theme from my screenshot download it from here. (Download uzip and place extracted files into 'c:\Program Files\GtkSharp\2.12\share\themes' directory).
  • customize your syntax highlighting (Tools->Options->Text Editor->Syntax Highlighting if you like my screenshot you can use my syntax highlighting scheme: Monokai for MonoDevelop)
  • you can change key bindings the way you like (Tools->Options->Preferences->Key Bindings) also there are 4 predefined key binding Visual Studio/MonoDevelop1.0/MonoDevelop2.0/GNU Emacs.
  • fonts (Tools->Options->Preferences->Fonts) on Windows I use Consolas 10 for everything...
  • you can customize every aspect of code formatting (Tools->Options->Source Code->Code Formatting->C# source code->C# Format->Edit)

Verdict

I am very happy I made switch. MonoDevelop consumes less memory, feels snappier and is solid. I am more then surprised by it's ability to customize according to your needs... I feel fresh again thanks to MonoDevelop I can work long hours...

Monday, February 6, 2012

Good git cheat sheet (link)

Even with a GUI application at hand there are times when you resort to the command line. We admit we can’t memorize all important Git commands... Read here...

Friday, February 3, 2012

C# example search GitHub API for user

Here follows simple example how to search Github for user with C# WebRequest and Github API V2
using System;
using System.Net;
using System.IO;

namespace SimpleGitHubAPI
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            HttpWebRequest request = WebRequest.Create ("https://github.com/api/v2/json/user/search/dkucinskas") as HttpWebRequest;
            request.Method = "GET";
            request.Proxy = null;
   
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) 
            {
                using (StreamReader reader = new StreamReader(response.GetResponseStream())) 
                {
                    Console.Write(reader.ReadToEnd());      
                }
            }
        }
    }
}
Have fun :)

Thursday, February 2, 2012

Why does it take Task Manager longer to appear when you start it from the Ctrl+Alt+Del dialog? (link)

Why does it take Task Manager longer to appear when you start it from the Ctrl+Alt+Del dialog? Well, you can see the reason right there on the screen: You're launching it the long way around. Rea this post for longer answer...

Wednesday, February 1, 2012

Three ways to tell if a .NET Assembly is Strongly Named (link)

Here are several convenient ways to tell whether a .NET assembly is strongly named. Read here

Monday, January 30, 2012

Tilera preps many-cored Gx chips for March launch (link)

Upstart multicore RISC chip maker Tilera is timing the launch of its third generation of Tile processors to rain a little on Intel's forthcoming parade, and to try to blunt all of the excitement that is building for ARM-based alternatives for servers. Read more...

Read "CouchDB The Definitive Guide" online

Here is draft of "CouchDB The Definitive Guide" second edition and you can read it online!

Friday, January 27, 2012

Howto: resize VirtualBox image

How would your resize VirtualBox image? The answer is simple:
Usage:

VBoxManage modifyhd         |
                            [--type normal|writethrough|immutable|shareable|
                                    readonly|multiattach]
                            [--autoreset on|off]
                            [--compact]
                            [--resize |--resizebyte ]


Example
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd YourImageFile.vdi --resize 20480
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

PUT or POST: The REST of the Story (link)

Web service designers have tried for some time now to correlate CRUD (Create, Retrieve, Update and Delete) semantics with the Representational State Transfer (REST) verbs defined by the HTTP specification–GET, PUT, POST, DELETE, HEAD, etc. So often, developers will try to correlate these two concepts–CRUD and REST–using a one-to-one mapping of verbs from the two spaces, like this:
  • Create = PUT
  • Retrieve = GET
  • Update = POST
  • Delete = DELETE
Read more...

Thursday, January 26, 2012

The free lunch is over now welcome to the hardware jungle (link)

The good news is that Moore’s “local scale-in” transistor mine isn’t empty yet; it appears the transistor bonanza will continue for about another decade, give or take a half decade or so, which should be long enough to exploit the lower-cost side of the Law to get us to parity between desktops and pocket tablets. The bad news is that we can clearly observe the diminishing returns as the transistors are decreasingly exploitable – with each new generation of processors, software developers have to work harder and the chips get more difficult to power. And with each new crank of the diminishing-returns wheel, there’s less time forimage hardware and software designers to come up with ways to overcome the next hurdle; the motherlode free lunch lasted 30 years, but the homogeneous multicore era lasted only about six years, and we are now already overlapping the next two eras of hetero-core and cloud-core. Read more...

Wednesday, January 25, 2012

Javascript Best Practices (link)

This document is a list of best practices and preferred ways of developing JavaScript code, based on opinions and experience from many developers in the JavaScript community. Since this is a list of recommendations rather than a list of absolute rules, experienced developers may have slightly differing opinions from those expressed below. Read more...

Good intro to couchdb (link)

Go read here...

Tuesday, January 24, 2012

JavaScript on the server: Growing the Node.js Community (link)

While we all know and love JavaScript as a language for browser-based scripting, few remember that, early on, it was destined to be used as a server-side language as well. Only about a year after JavaScript’s original release in Netscape Navigator 2.0 (1995), Netscape released Netscape Enterprise Server 2.0: Read more...

Monday, January 23, 2012

Monokai theme for MonoDevelop

Hi,

I have ported Textmate Monokai theme to MonoDevelop, this is work in progress so try it and give me feedback.

Link to my github repo. Update I have also created MonokaiNotBold theme for MonoDevelop. Have fun :)

Saturday, January 21, 2012

Node.js case study: The Trello at Fog Creek

"That led us toward a single-page app that would generate its UI on the client and accept data updates from a push channel. This is pretty far from any of the work we’ve done before at Fog Creek, so from a technical perspective Trello has been an adventure." Read here...

Friday, January 20, 2012

Node v0.6.8 verson released (link)

  • Update V8 to 3.6.6.19
  • Numeric key hash collision fix for V8 (Erik Corry, Fedor Indutny)
  • Add missing TTY key translations for F1-F5 on Windows (Brandon Benvie)
  • path.extname bugfix with . and .. paths (Bert Belder)
  • cluster: don’t always kill the master on uncaughtException (Ben Noordhuis)
  • Update npm to 1.1.0-2 (isaacs)
  • typed arrays: set class name (Ben Noordhuis)
  • zlib binding cleanup (isaacs, Bert Belder)
  • dgram: use slab memory allocator (Michael Bernstein)
  • fix segfault #2473
Read here...

Thursday, January 19, 2012

Building a Modern Web Stack for the Real-time Web (link)

The web is evolving. After a few years of iteration the WebSockets spec is finally here (RFC 6455), and as of late 2011 both Chrome and Firefox are SPDY capable. These additions are much more than just "enhancing AJAX", as we now have true real-time communication in the browser: stream multiplexing, flow control, framing, and significant latency and performance improvements. Now, we just need to drag our "back office" - our web frontends, app servers, and everything in between into this century to enable us to take advantage of these new capabilities. Read more...

Case study: How & why to build a consumer app with Node.js (link)

Node.js has been getting great press for being used to build real-time web applications and fast networking tools that help big web sites run and scale. But is Node just as good a fit for web agencies and developers that build dozens, scores, or even hundreds of sites a year? Read here...

Wednesday, January 18, 2012

What is the defining characteristic of a local variable? (link)

If you ask a dozen C# developers what a "local variable" is, you might get a dozen different answers. Read more...

node.js GitHub API search repositories by keyword example

Not long time ago I started learning JavaScript and node.js. Today I found this node.js module called node-github. I had fun while played with it. And here it goes one little sniped for searching GitHub source repositories by keywords.

var GitHubApi = require('github').GitHubApi;

var github = new GitHubApi(true);
var repoApi = github.getRepoApi();

repoApi.search('node github', function(err, repos){
    if (repos){
        var i;
        for(i = 0; i < repos.length; i++){
            console.log(repos[i].name);
        }
    } else {
        console.log('Not found any repos!\n');
    }
});
How to run
  • download and install node.js from here
  • run 'npm install github' in your source directory
  • create new file 'example.js' and paste code sniped into it and save changes
  • run 'node example.js'
Output you should see the following output to console:
C:\code\node\npm-index>node scripts\example_github.js
The "sys" module is now called "util". It should have a similar interface.
get:  post
send GET request: /api/v2/json/repos/search/node%20github
node-github
node-buildbot-github
node-bus.github.com
node-github-receiver
node-uso-github
node-github-issues
node.github.com
github-node-tools
NodeGithubResumeWriter
g-node.github.com
node-github-deployhook

Tuesday, January 17, 2012

JSON will be a core type in PostgreSQL 9.2 (link)

On Wednesday, four days before the start of the final commitfest for release 9.2 of PostgreSQL, Robert Haas published YA patch to include JSON as a core type. Read more here...

Monday, January 16, 2012

Quote of The Day 2012-01-16

"If you want to do something big in your life, you must remember that shyness is only the mind," she said. "If you think shy, you act shy. If you think confident you act confident. Therefore never let shyness conquer your mind."

- Arfa Karim Randhawa the computer programming prodigy who became the world’s youngest Microsoft Certified Professional at 9 years old, has passed away at the age of 16, according to reports out of her native Pakistan this weekend.Read more...

Thursday, January 5, 2012

Prozac Extinguishes Anxiety by Rejuvenating the Brain (link)

"...new study in the December 23 issue of Science shows that the antidepressant Prozac (fluoxetine) gives mice the youthful brain plasticity they need to learn that a once-threatening stimulus is now benign." Read more...

A Man. A Van. A Surprising Business Plan. (link)

We've all been there. Trapped in line at the DMV. Or stuck on hold while trying to call a city agency. It's easy to complain about government bureaucracy. But it's the rare person who sees such inefficiency as a business opportunity. Go to article...

Wednesday, January 4, 2012

DoS using Hash Collisions in ASP .net (link)

This weekend in the 28C3 Alexander “alech” Klink and Julian “zeri” Wälde presented Effective Denial of Service attacks against web application platforms which can make a server with 99% CPU usage using very low resources. Read more...

Tuesday, January 3, 2012

Richard Stallman Was Right All Along (link)

Late last year, president Obama signed a law that makes it possible to indefinitely detain terrorist suspects without any form of trial or due process. Peaceful protesters in Occupy movements all over the world have been labelled as terrorists by the authorities. Initiatives like SOPA promote diligent monitoring of communication channels. Thirty years ago, when Richard Stallman launched the GNU project, and during the three decades that followed, his sometimes extreme views and peculiar antics were ridiculed and disregarded as paranoia - but here we are, 2012, and his once paranoid what-ifs have become reality. Read more...

The Coming War on General Purpose Computation By Cory Doctorow (link)

"As a member of the Walkman generation, I have made peace with the fact that I will require a hearing aid long before I die, and of course, it won't be a hearing aid, it will be a computer I put in my body, so when I get into a car - a computer I put my body into - with my hearing aid - a computer I put inside my body - I want to know that these technologies are not designed to keep secrets from me, and to prevent me from terminating processes on them that work against my interests." The Coming War on General Purpose Computation By Cory Doctorow

Supercolliding a PHP array (link)

Did you know that inserting 2^16 = 65536 specially crafted values into a normal PHP array can take 30 seconds? Normally this would take only 0.01 seconds. Read here more...

Monday, January 2, 2012

Reducing Code Nesting (link)

"This guy’s code sucks!" It’s something we’ve all said or thought when we run into code we don’t like. Sometimes it’s because it’s buggy, sometimes it’s because it conforms to a style we don’t like, and sometimes it’s because it just feels wrong. Recently I found myself thinking this, and automatically jumping to the conclusion that the developer who wrote it was a novice. The code had a distinct property that I dislike: lots of nesting. But the more I think about it, the more I realized that it’s not really something I’ve heard discussed much. Read more on Reducing Code Nesting here...