Bluetooth

Harald Bluetooth Gormsson (Old Norse: Haraldr blátǫnn Gormsson, Danish: Harald Blåtand Gormsen) (probably born c. 935) was a King of Denmark and Norway. He was the son of King Gorm the Old and of Thyra Dannebod. He died in 985 or 986 having ruled as King of Denmark from c. 958 and King of Norway for a few years probably around 970. According to legend, he gained the nickname “Bluetooth” from his love of blueberries, which stained his teeth.

1000 years later, in 1994, Jim Kardach developed a system that would allow mobile phones to communicate with computers (at the time he was reading Frans Gunnar Bengtsson’s historical novel The Long Ships about Vikings and king Harald Bluetooth). Then Bluetooth was born. Bluetooth is a wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks (PANs) with high levels of security.

The Bluetooth logo is a bind rune merging the Younger Futhark runes Runic letter ior.svg (Hagall) (ᚼ) and Runic letter berkanan.svg (Bjarkan) (ᛒ), Harald’s initials.

http://en.wikipedia.org/wiki/Bluetooth

Regular Expression in T-SQL

Regular Expressions can be very useful to the Database programmer, particularly for data validation, data feeds and data transformations.  In C#.NET, Regex.Replace Method replaces all occurrences of a character pattern defined by a regular expression with a specified replacement character string. We can do the same steps in T-SQL (2005/2008).

Use the Ole Automation Procedures option to specify whether OLE Automation objects can be instantiated within Transact-SQL batches. This option can also be configured using the Surface Area Configuration tool.

The Ole Automation Procedures option can be set to the following values.

0 OLE Automation Procedures are disabled. Default for new instances of SQL Server 2005.
1 OLE Automation Procedures are enabled.

When OLE Automation Procedures are enabled, a call to sp_OACreate, sp_OASetProperty, sp_OAMethod, sp_OAGetErrorInfo, sp_OADestroy will start the OLE shared execution environment.

In SQL Server 2005/2008 we need to start with the configuring the Ole Automation Procedures

sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE with override
go
sp_configure ‘Ole Automation Procedures’,1
GO
RECONFIGURE with override

Now we can create a new function in SQL as follow:

CREATE FUNCTION dbo.RegexReplace
(
@pattern VARCHAR(255),
@replacement VARCHAR(255),
@Subject VARCHAR(max),
@global BIT = 1,
@Multiline bit =1
)
RETURNS VARCHAR(max)
AS BEGIN
DECLARE @objRegexExp INT,
@objErrorObject INT,
@strErrorMessage VARCHAR(255),
@Substituted VARCHAR(8000),
@hr INT,
@Replace BIT
SELECT  @strErrorMessage = ‘creating a regex object’
EXEC @hr= sp_OACreate ‘VBScript.RegExp’, @objRegexExp OUT
IF @hr = 0
SELECT  @strErrorMessage = ‘Setting the Regex pattern’,
@objErrorObject = @objRegexExp
IF @hr = 0
EXEC @hr= sp_OASetProperty @objRegexExp, ‘Pattern’, @pattern
IF @hr = 0 /*By default, the regular expression is case sensitive. Set the IgnoreCase property to True to make it case insensitive.*/
SELECT  @strErrorMessage = ‘Specifying the type of match’
IF @hr = 0
EXEC @hr= sp_OASetProperty @objRegexExp, ‘IgnoreCase’, 1
IF @hr = 0
EXEC @hr= sp_OASetProperty @objRegexExp, ‘MultiLine’, @Multiline
IF @hr = 0
EXEC @hr= sp_OASetProperty @objRegexExp, ‘Global’, @global
IF @hr = 0
SELECT  @strErrorMessage = ‘Doing a Replacement’
IF @hr = 0
EXEC @hr= sp_OAMethod @objRegexExp, ‘Replace’, @Substituted OUT,
@subject, @Replacement
/*If the RegExp.Global property is False (the default), Replace will return the @subject string with the first regex match (if any) substituted with the replacement text. If RegExp.Global is true, the @Subject string will be returned with all matches replaced.*/
IF @hr <> 0
BEGIN
DECLARE @Source VARCHAR(255),
@Description VARCHAR(255),
@Helpfile VARCHAR(255),
@HelpID INT
EXECUTE sp_OAGetErrorInfo @objErrorObject, @source OUTPUT,
@Description OUTPUT, @Helpfile OUTPUT, @HelpID OUTPUT
SELECT  @strErrorMessage = ‘Error whilst ‘
+ COALESCE(@strErrorMessage, ‘doing something’) + ‘, ‘
+ COALESCE(@Description, ”)
RETURN @strErrorMessage
END
EXEC sp_OADestroy @objRegexExp
RETURN @Substituted
END
GO

The function RegexReplace requires 4 parameters:

  1. @pattern: it can be any pattern that we usually use to match any expression
  2. @replacement: will be the text or word that will replace the matched pattern
  3. @Subject: will be the text or the sentence that will be used to clean or match the pattern
  4. @global: If you want the RegExp object to return or replace all matches instead of just the first one, set the Global property to True.
  5. @Multiline: The caret and dollar only match at the very start and very end of the subject string by default. If your subject string consists of multiple lines separated by line breaks, you can make the caret and dollar match at the start and the end of those lines by setting the Multiline property to True.

As an example, we can clean the sentence “A bunch of ()/*++\’#@$&*^!% invalid URL characters ” from all non-letter words:

declare @stm varchar(1000)
set @stm = ‘A bunch of ()/*++\”#@$&*^!%     invalid URL characters  ‘
SELECT  @stm = dbo.RegexReplace(‘[^a-z0-9\s-]‘,”,@stm,1,1)
SELECT  @stm = dbo.RegexReplace(‘[\s-]+’,’ ‘,@stm,1,1)
– the ouput will return:
A bunch of invalid URL characters

dbo.RegexReplace(‘[^a-z0-9\s-]‘,’ ‘,’A bunch of ()/*++\”#@$&*^!%     invalid URL characters ‘,1,1) in T-SQL is equivalent to  Regex.Replace(“A bunch of ()/*++\”#@$&*^!%     invalid URL characters”, “‘[^a-z0-9\s-]“, ” “, RegexOptions.IgnoreCase)

For more T-SQL regex functions, you can check http://www.simple-talk.com/sql/t-sql-programming/tsql-regular-expression-workbench/

What’s new in Visual Studio 2012

It’s no secret that a new age of modern apps is here. With connected devices and cloud-based services, you have bigger and better opportunities than ever before. Independent developers can plug in from anywhere, build a brilliant app, and make it available to millions of user. Large, agile teams can give their businesses a significant advantage—and the faster they execute, the greater that advantage can be.

That’s why Visual Studio 2012 is one of our biggest releases yet. It comes purpose-built to help you thrive in an environment in which ideas are at a premium and speed is of the essence. Let’s look at some of the ways it can help you turn ideas into applications fast.

http://www.microsoft.com/visualstudio/eng/whats-new

What does “GOOGLE” mean?

I don’t remember how life was before Google. During school time,  the hardest homework was to do some research. I used to look in the encyclopedia and ask dummy questions to come out with 500-word paragraph. But that was history..

Google changed our life and gave us an answer to every question, no matter how silly it is, but yet you will still get an answer! Now if I want to know what I want to eat today, I would go ask Google. But one day, I just asked myself what does the word “Google” means? I use Google more that 100 times a day and never asked this question! But what worry, ask “Google” what does “Google” means.

“The name ‘Google’ is a play on the word ‘googol,’ coined by Milton Sirotta, nephew of American mathematician Edward Kasner. A ‘googol’ refers to the number represented by a 1 followed by 100 zeros. It’s a very large number.

Because it is a company name, Google is a noun. Logically. However, slowly but sure, it evolves and tends to become a verb as numerous users refer to the act of searching the Internet as “googling”. For example, I heard some friends saying “I’m going to Google it,” meaning that they will search the Internet using the Google search engine.

GOOGLE is stands for “Giving Opinions & Options Generously Linked Everywhere“.

read more http://wiki.answers.com/Q/What_Google_stands_for

Smart Phones Named After FRUITS

I still didn’t get it why they insist on naming the smart phones fruit names. Life was much easier when Apples, Blackberries, Mangoes were only fruits. I tried to find out the real reason behind the names, and here what i got:

Why Apples are called Apples?

In 1976 , Steve Jobs  and Steve Wozniak wanted to start a new computer company, and they were looking for some name . Jobs said ‘ I’ve got a great name: Apple Computer.’  Maybe he worked in apple trees. Maybe it had some other meaning to him. Maybe the idea just occurred based upon Apple Records. He had been a musical person, like many technical people are. Both Wozniak and Jobs tried other alternate names such as Executex and Matrix Electronics, but they didn’t like it as much as Apple Computers. And the name was born.

Why Blackberries are called Blackberries

RIM settled on the name “BlackBerry” only after weeks of work by Lexicon Branding Inc., the Sausalito, California-based firm that named Intel Corp.’s Pentium microprocessor and Apple’s PowerBook. It was originally suggested that the phones be called “StrawBerries” because the numerous buttons reminded the marketing dept of the little seeds on a strawberry. It was decided that “StrawBerry” sounded too country, so they went with “BlackBerry” instead, which sounded much more business-like.

Windows Phone 7.5 “Mango”

Windows Phone 7.5 (code-named ’Mango’) is a major software update for Windows Phone, the mobile operating system by Microsoft. During one of the Microsoft sessions, one of the audeinces asked about the reason why it is called “Mango”, Harish Vaidyanathan, who leads Microsoft Evangelism in India answered that the Windows phone team has had a tradition to end all code names with an “o”.  Thus, the King of Fruits has made it’s way into the digital world!

Now we must start of thinking what will be the next fruit in the smart phone world!!

Team Foundation Server vs. Visual SourceSafe

Wikipedia defines Source control as “Revision control is the management of multiple revisions of the same unit of information.” In other words: Source control allows distributed work in teams of any size, at different locations, while avoiding conflicts in source code changes. There are two famous source control software by Microsoft: Microsoft Visual SourceSafe and Team Foundation Server. Here is the definition for each on according to Wikipedia:

  • Microsoft Visual SourceSafe (VSS) is a source control software package oriented towards small software development projects. Like most source control systems, SourceSafe creates a virtual library of computer files.
  • Team Foundation Server (TFS) is a Microsoft product offering source control, data collection, reporting, and project tracking, and is intended for collaborative software development projects.It is available either as stand-alone software, or as the server side back end platform for Visual Studio Team System (VSTS).

We have been using the VSS for a long time, but developers always experience some network troubles when working on VSS, as well as the limited features in it. Like we can’t generate a report on the daily work, also many times developers experienced loss in their updated files. But its never too late to improve our work and look for a better solutions to protect our code and control the team work. So the decision was made to replace the VSS with the TFS.

Here is a brief list of major differences between VSS and TFS:

Architectural Differences

  • VSS: Read and write files and store them on the shared network folder
  • TFS: .NET web service that stored files and items in a SQL Server database
Security and Project Rights
  • VSS : All SourceSafe users are granted the same permission and have full access on all projects and files stored in SourceSafe
  • TFS : Team server users are window user accounts. Users will have specific permissions and project-level permission. No need to give full access to users on SQL and on all projects, the Administrator can give different permission levels to different users.
Reliability
  • VSS : Since we are dealing with transfer of data through a network, operation cannot be rolled back if a problem occurred. In the rare cases when a problem such as the loss of network connectivity does occur in the middle of a write operation, the integrity of the affected files can be compromised and information lost.
  • TFS : Team Foundation is a client-server application in which write operations occur in the database by way of stored procedures that are not subject to network connectivity issues and rolled back in the event of an error can be done. Thus no corruption of files occur, groups of files that contain dependent changes are all committed to the source control server at the same time.
Scalability
  • VSS : Teams of twenty or less users, and database size is limited to 4GB
  • TFS : up to 2000 users and can contain as much as a SQL Server database allows (terabytes)
Changesets

Both are databases organized hierarchically (folders contain files), files consist of versions, identified by number of date/time of creation.

  • VSS : No changesets
  • TFS : A changeset is a logical container in which Team Foundation stores everything related to a single check-in operation: file and folder revisions, links to related work items, check-in notes, a check-in comment, and other information such as who submitted the change. For more information
Add and Create
  • VSS : Adding a file or folder creates a version of the parent in addition to the file. In the parent history, the action is recorded as “add” and in the file history; the action is recorded as “create.”
  • TFS : adding a file or folder just creates a version of the file or folder itself with a “add” action. No version of parent is created for this action.
Rename, Delete, and Undelete
  • VSS : these actions create a new version of parent;
  • TFS : they create a new version of the item itself
Move
  • VSS : When you move a folder, new versions of both the source and destination parent folders are created, with actions recorded on each parent that moves the folder into or out of the parent. No version for folder F is created.
  • TFS : only a new version of F is created by using the “Rename” action.
 Check-Out and Check-In
  • VSS : you must do an explicit check-out and check-in only if you are editing a file
  • TFS : every action requires an explicit check-out and check-in
Features that Work Differently in Team Foundation
In the VSS:
  • Silent Get operation when you check out a file
  • Checkouts are exclusive, by default
  • Does not store the merge history between two branches of files or folders

In TFS :

  • Does not perform a silent Get operation when you check out a file
  • Multiple users can check out and change the same item at the same time, you can lock a file in Team Foundation to prevent other users from checking it out or checking in changes
  • Does have support for merge history. Without merge history
After all these new features in TFS, we are sure going to upgrade from VSS to TFS.
Read more on TFS

http://msdn.microsoft.com/en-us/library/ms181369(VS.80).aspx

http://blogs.msdn.com/b/jasonz/archive/2009/10/21/tutorial-getting-started-with-tfs-in-vs2010.aspx

http://blogs.msdn.com/b/bharry/archive/2009/10/01/tfs-2010-for-sourcesafe-users.aspx

Why its called a “bug” in your program

A “bug” in a computer program or system is a common term used to describe an error, flaw or a mistake that produces wrong results… Usually bugs arise from mistakes and error made by people in their program’s source code.

But the question remains, why it is called a bug?

In 1947, computers used relays instead of transistors as they are today (or vacuum tubes some time between). Relays are little (usually magnetic) switches which are essentially a mechanical representation of binary (on or off).

During that time, Grace Murray Hopper was working on the Harvard University Mark II Aiken Relay Calculator (a primitive computer). On the 9th of September, 1947, when the machine was experiencing problems, an investigation showed that there was a moth trapped between the points of Relay #70, in Panel F. The operators removed the moth and affixed it to the log. The entry reads: “First actual case of bug being found.”

The First "Computer Bug"
The First “Computer Bug”

The word went out that they had “debugged” the machine and the term “debugging a computer program” was born.

Read more in http://en.wikipedia.org/wiki/Software_bug

Why ASP Cookies are called Cookies ?

Have you ever wondered why we use the term “Cookies” in ASP ? Well that question didn’t pop up into my mind until one of my students asked me why do we call them like that?

When I checked for the history of cookies, nothing was clear enough about the origin of this name. But looking for some logical terms, I imagined that a cookie to be named as so, it must be similar to the real cookie (i.e. biscuits) the browser leave on client’s computers when browsing any website. But the truth was something else.

Cookies are named after the Chinese fortune cookies!! That was the last thing I would expect!!

If we go back to the history of Fortune Cookies, they are crisp cookies with a fortune wrapped inside. Some says fortune cookies are product of the U.S.A, invented in 1909 by Makota Hagiwara, manager of Golden Gate Park’s Japanese Tea Garden in San Francisco. Others say the origins were laid down by the Chinese 49′ers who worked on the building of the great American railways through the Sierra Nevada into California, these workers used the cookies to exchange secret messages for rebellion.

Whatever was the reason for inventing the fortune cookies, the concept is the same. Cookies contain simple text messages and so do the browser cookies. Cookies are little chunks of text passed from a Web server to a Web browser and back again.

Now the term is clear enough and we can have a logical reason behind this naming, thanks for Andrew Stuart that explained this in his blog (Using cookies in Lotus Domino applications is in your future)

Resolving: ASP.NET Ajax client-side framework failed to load

Sometimes you spend hours and days in finding some errors that can be solved in a simple way.

Here was the problem:

I was using AjaxToolKit in one of our web applications, it was running great for a long time, until one day our client reported that the website is like a mess. When I checked out, I found out there was a javascript error saying: “ASP.NET Ajax client-side framework failed to load” and all the ajax controls stopped working.

I tried to look out for some solution on the net:

I tried all the provided solutions, but my situation was different. When i checked the web application on any local PC, it was working fine, but on the hosting server it failed. So I followed up every single page in the application, and at the end I noticed something:

Any web application without the file “global.asax” with AjaxToolKit was working fine without any error, so when i removed this file, everything went ok. Now if you ask me what was the main cause of this problem i would say nothing since there isn’t any convincing reason for this, but removing this file was the solution for this sudden error!!

In case you encountered such a problem, try this option it might be the solution for this error !!

Google Map Interesting Step to follow

Google Maps directions can be cool if we follow them step by step, Go to Google Maps . and click “Get Directions” above left link.

Type Taiwan as the first location and China as the 2nd location….

Scroll down and read STEP 23 of the directions.

Now if you type Tokyo, Japan as first location, and China as the second location

Read STEP 48