Wednesday, 29 February 2012

LINQ to SQL


LINQ to SQL makes database programming a direct part of the VB.NET/C#  language. Before it was added to the language toolkit with Framework 3.5/VB.NET 2008, databases were a world apart from your application programming code and you had to get your data through an interface. Coding for SQL Server this way doesn't take advantage of some of the best features of VB.NET/C# development such as the use of  Intellisense. (Using older methods, the tables and fields in the database are unknown to the VB.NET code so Visual Studio can't tell you whether your names are right or wrong. And the compiler can't tell you whether your SQL commands are correct because they're passed directly to SQL Server. Your code has to be able to interpret whatever comes back from SQL Server.)

There are basically two problems to be solved when accessing a SQL Server database from your application:
  1. Data in a database doesn't have the same "types" as data in .NET. This is often called the database "impedance mismatch".  The process of converting types from a database into types in an application is called object relational mapping (ORM).  Today, LINQ to SQL provides a new tool in Visual Studio, the Object Relational Designer, and just takes care of the rest of the problem.
  2. SQL statements have to be passed to the database engine for execution and results (or errors) returned to the application. The SqlClient namespace in ADO.NET provides the ExecuteReader, ExecuteNonQuery, and ExecuteScalar methods to run queries. Part of the problem is that it's not always clear which one to use. LINQ to SQL gives you VB.NET/C# statements that you can compile in your application and eliminates the need to use these methods. The new LINQ to SQL syntax looks a lot like traditional SQL too.
Create SQL to SQL:
  1. Add database connection
  2. Add DataContext (LINQ to SQL Classes) (".dbml")

The bottom line is that LINQ to SQL is a lightweight technology that can make your SQL Server coding faster and easier. It's a good choice for most projects, but if you need the best performance or if your application has complex requirements, you might want to go the traditional route or consider the ADO.NET Entity Framework.

Relational Data Model            LINQ to SQL Object Model 
----------------------------     -------------------------------
Table                            Entity class
Column                           Class member 
Foreign-key relationship         Association 
Stored Procedure or Function     Method


Entity Framework

The Entity Framework provides a completely independent "conceptual model" of the data. When you use the Entity Framework, you code queries against this conceptual model and not against the actual data store. Entity Framework has its own dialect of SQL used to retrieve data called Entity SQL. It's not SQL Server's TSQL query language. In fact, the data store does not have to be a database.

The conceptual model contains what Microsoft calls "entities". The Entity Framework adds a layer of software to your application that maps the data from a data store to these entities. Of course, the data store still has to provide the data so the Entity Framework "conceptual model" has to be created and configured before it will work in your code.

LINQ to SQL gives you the ability to access a SQL Server data store using VB.NET/C# language elements.
LINQ to Entities gives you the abilty to access the Entity Framework model, which could potentially include data from any data store, using VB.NET/C# language elements.

Entity Framework can provide the many-to-many relationship in the data model automatically.

Install "Microsoft Visual Studio 2010 ADO.NET Entity Framework Tools"
Create the Entity Framework conceptual model
Right click on the project, select Add, New Item..., Data, ADO.NET Entity Data Model


Microsoft gives you two ways to access the data in the Entity Framework model:
  • LINQ to Entities
  • Entity SQL (A variant of the venerable SQL language just for the Entity Framework)
Since Entity Framework implements both IQueryable (used more in Entity Framework) and IEnumerable (used in LINQ), you actually get the advantages of both worlds.

more info...

LINQ

"Language INtegrated Query"

LINQ can be used to create and filter data into arrays, enumerable classes, XML, relational databases, and other data stores. You can even use LINQ query expressions as the basis for statements like building event handlers. This is one of the reasons LINQ can be confusing.


    From ...
    Where ...
    Select ...


LINQ adds the abililty to use the powerful query syntax.  LINQ is "language level" querying.

more info...

Technologies access Data in Microsoft world


ADO.NET
  • works directly through an API (program calls to an interface) that calls the internal functions of the database or other datastore
  • for maximum performance
LINQ to SQL
LINQ to DataSet
LINQ to Entities
Entity Framework

all use ADO.Net as their foundation

po po

the cops, the police

urban dictionary

Data Liberation

Data Liberation is a central location for information on how to move your data in and out of Google products.

Tuesday, 28 February 2012

CSS Sprites

A CSS sprite takes a large image and splits it into multiple smaller images for display. CSS sprites are useful because they allow you to store all your navigation and site maintenance buttons in one file. You simply reference that file with specific grid locations to display the image you want to display.

CSS Sprite Generator

Monday, 27 February 2012

Open a new tab when a link is clicked in Chrome and FireFox

Not focused:
  • <Ctrl> + click
  • <middle button> + click
Focused:
  • <Ctrl> + <Shift> + click
  • <middle button> + <Shift> + click




Friday, 24 February 2012

Moodle

Moodle (modular object oriented dynamic learning environment) is an Open Source Course Management System (CMS), also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). It has become very popular among educators around the world as a tool for creating online dynamic web sites for their students. To work, it needs to be installed on a web server somewhere, either on one of your own computers or one at a web hosting company.

more info...




Demonstration site

Moodle Docs

Getting Summary for multiple items on Mac

Press the <Control> key when selecting "Get Info" (or Command-I) will get the "Multiple Item Info".

Thursday, 23 February 2012

Unrecognizable Hard Disk under Windows

An external Hard Disk is not recognized by Windows (either using USB or eSATA, Windows XP and Windows 7 64-bit) and showed it as "RAW" type.  The system notifies the user to format this hard disk.  The hard disk was working before.

Backup the data
I connected this hard disk (with a dock) to my MacBook Pro with my new eSATA (express card) and I could see all the folders and files again.  Copied the files and folders to another hard disk.

Fix the problem
Ran "cmd" as Administrator in Windows 7 (64-bit) and ran chkdsk /f /r and fixed the problem.




Wednesday, 22 February 2012

ResourceBlender

ResourceBlender is an open-source translation and internationalization application which offers an easy way to manage localized resources for inclusion with different applications. Available as an ASP.NET web application and a WPF desktop application, it makes localizing applications a breeze. ResourceBlender generates localized resources in different formats from a central database for inclusion with different applications.

more info...

Thursday, 16 February 2012

Taking a photo...

"...if I see something, I take a picture. If I don't see anything, I don't..."

Bruce Gilden



Job Interview


The only three true job interview questions are:

1.  Can you do the job? - Strengths
2.  Will you love the job? - Motivation
3.  Can we tolerate working with you? - Fit


more info...

Wednesday, 15 February 2012

PluralEyes

PluralEyes® works with your favorite video editing tool to instantly sync all of your multi-camera video and audio tracks – eliminating complicated camera set-ups, timecode, and hours of tedious manual syncing. Save time and money, reduce frustration, and free yourself to focus on the creative editing process.

Try FREE for 30 days

I have tried with one of my project and it sync my six videos and an audio in minutes.

Tuesday, 14 February 2012

Cold turkey

The term 'cold turkey' is now predominantly used as the name of the drug withdrawal process. Also, by extension, it is used to refer to any abrupt termination of something we are accustomed to.

Thursday, 9 February 2012

Slow Sync Flash

shoot with both a longer shutter speed as well as firing the flash.

Rear Curtain Sync – this tells your camera to fire the flash at the end of the exposure. ie when you press the shutter your lens opens up and starts collecting light and just before it closes the flash will fire to light up and freeze your main subject (see the card shot to the left for an example where you’ll see the card trail ending in a nice crisp shot of the card).

Front Curtain Sync – this tells your camera to fire the flash at the start of the exposure. ie when you press the shutter, the flash will fire immediately and the shutter will remain open afterwards capturing ambient light.

Mastering Panning – Photographing Moving Subjects

Panning is a technique that you pan your camera along in time with the moving subject and end up getting a relatively sharp subject but a blurred background.

Panning works best with moving subjects that are on a relatively straight trajectory which allows you to predict where they’ll be moving to.

In order to pan successfully your camera has got to follow the subject’s movement and match it’s speed and direction as perfectly as possible.

  • Shutter Speed - starts with 1/30 (choose between 1/60 and 1/8, 1/200 flying subject, 1/40 runner on a track) it really depends on the speed of the subject
  • Background - Avoid the distracting shapes or colors; best with single colored or plain backgrounds
  • Move the camera smoothly (with monopod or tripod with a swiveling head)
  • Make sure the subject remains in the same portion of the frame during the entire exposure
  • Parallel to the path of the object (if possible)
  • Use automatic focus tracking (or pre-focus the camera)
  • Release the shutter (gently) and continue to pan with the subject, even after hearing the shot is complete

Beginner's Tip


  • Get Closer (try different f stops)
  • Try another angle


How to Shoot Through a Wire Fence

How to Shoot Through a Wire Fence


  • Switch to Manual Focusing
  • Get close the the Fence
  • Use a Large Aperture (making the number of your aperture as small as possible)
  • Wait Until your Subject is away from the fence (The closer they are to the fence the more the fence will be in focus.)
  • Position Your Lens to Shoot Through Larger Gaps Avoid Reflections (from the sun or other lights coming off the fence). As a result try to find a part of the fence that is shaded
  • Incorporate the fence into your composition


Orton technique

The Orton technique produces a dreamy soft focus effect that can make a relatively uninteresting photo take on a much more striking appearance.

The Orton Effect comes from a technique first used by Michael Orton in which one "normal" photograph or slide was sandwiched with another out of focus and overexposed photograph or slide.

The Orton Technique is also very useful in "saving" images that wound up accidentally out of focus.

Images of children, landscapes, and "cute" animals work especially well for this treatment.

Duplicate the image as the top layer, apply "Gausian Blur" and add the brightness to this layer.  Merging this new layer with the original image with "multiply" and adjust the opacity of the original image to 60-70%.

more info...

Wednesday, 8 February 2012

Windows System State Analyzer

An Introduction to the Windows System State Analyzer

Download the following file and install only the component "System State Analyzer":

Server Logo Program Software Certification Tool x86: http://go.microsoft.com/fwlink/?LinkID=140110
Server Logo Program Software Certification Tool x64: http://go.microsoft.com/fwlink/?LinkID=140109


Thursday, 2 February 2012

Silhouette Photography

Silhouettes are so open to interpretation.  The interpretation is dictated by the individual viewer's mindset. The viewer subconsciously projects her own hopes, fears, and mood onto the silhouette.  Human brain is constantly working to fill in the details of what it doesn't know.