Thursday, January 28th
at 5:38pm
Trusted by

If you're new here, you may want to subscribe to my RSS feed or become a fan of this blog on Facebook. Thanks for visiting!
Hitler has been dreaming about the day that Apple’s tablet will be announced. That day has come and he is not pleased.
What’s your take on the Apple iPad? I am truly not very impressed with all the hype that preceded it’s release I was waiting for something more impressive.
Good or Bad? Leave a comment!
Hatim
Thursday, January 28th
at 4:48pm
This blog is going 3.0
I have created a Facebook fan page for it and I would like to invite you to join. Also if you know friends that might be interested by the content of this blog be sure to invite them.
Hatim
Monday, January 18th
at 4:04pm
We all have that idea (or ideas) that want to make happen, but don’t have the time or would get started on it as soon as we finish this current task, or that this time of the year is not the best time because all the stars are not aligned the way they should… If you have just the smallest bit of ambition you would probably know what I am talking about. (otherwise you suck!!)
Well I came upon this post by Seth Godin talking about how Tim Burton had a poster of all the failed projects that he was part of.
This is a guy that is behind some of the greatest movies of all time like Batman, Edward Scissorhands, you can check the whole list here http://us.imdb.com/name/nm0000318/ but just because he does fail sometimes he should stop. NO!!
The reasoning behind this is stop postponing whatever you wanna do and do it now and stop being afraid of failure. it’s inevitable you would fail most times than not but eventually the satisfaction and the rewards from that single win would out weight all those failures.
One key element of a successful artist: ship. Get it out the door. Make things happen.
The other: fail. Fail often. Dream big and don’t make it. Not every time, anyway.
Tim got his ideas out the door, to the people who decided what to do with them. And more often than not, they shot down his ideas. That’s okay. He shipped.
So do it and move on!
Hope this was helpful.
Hatim
Monday, January 18th
at 9:18am
This is a following to my previous post (thanks Khalil)
Monday, January 18th
at 9:09am
I love that we live in exponential times. Check it out!
Tuesday, January 5th
at 6:42pm
this is related to my earlier post on dropping all indexes from an sql database but this one is to delete all foreign key relations from a database.
set nocount on
declare @statements cursor
set @statements = cursor static for
select 'alter table ' + quotename(ctu.table_schema) + '.' + quotename(ctu.table_name) +
' drop constraint ' + quotename(cc.constraint_name)
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS as cc
join INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE as ctu
on cc.constraint_catalog = ctu.constraint_catalog
and cc.constraint_schema = ctu.constraint_schema
and cc.constraint_name = ctu.constraint_name
open @statements
declare @statement nvarchar(1000)
While (1=1)
begin
fetch from @statements into @statement
if @@fetch_status <> 0
break
exec (@statement)
end
Hope this was Helpful!
Hatim
Tuesday, January 5th
at 6:38pm
I was doing some performance tweaking of a batch job that was hanging and i was suspecting the indexes in the database to have something to do with it shocking up so I used this script to clear all indexes.
Ironically it was a missing index that caused the bottleneck. But here it is for anyone that might need it.
DECLARE @indexName VARCHAR(128)
DECLARE @tableName VARCHAR(128)
DECLARE [indexes] CURSOR FOR
SELECT [sysindexes].[name] AS [Index],
[sysobjects].[name] AS [Table]
FROM [sysindexes]
INNER JOIN [sysobjects]
ON [sysindexes].[id] = [sysobjects].[id]
WHERE [sysindexes].[name] IS NOT NULL
AND [sysobjects].[type] = 'U'
OPEN [indexes]
FETCH NEXT FROM [indexes] INTO @indexName, @tableName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'DROP INDEX [' + @indexName + '] ON [' + @tableName + ']'
FETCH NEXT FROM [indexes] INTO @indexName, @tableName
END
CLOSE [indexes]
DEALLOCATE [indexes]
Hope this was helpful!
Hatim
Friday, December 18th
at 10:06am
These are some of my favorite and most used shortcuts in visual studio:
- Ctrl + - and the opposite Ctrl + Shift + - To move the cursor back or forward to the last position without having to scroll or switch files.
- Shift+Alt+Enter Switches to Full Screen Mode
- Ctrl+K, Ctrl+C Comment a block, Ctrl+K, Ctrl+U Uncomment the block
- Shift + Alt + F10 then Enter expands the smart tag to insert a using statement or implement an Interface
- Ctrl+K, Ctrl+D Auto format the file (Source, xml or html)
- Ctrl+M, Ctrl+ O Collapses all outlining to definition and then Ctrl+M, Ctrl+M to toggle the current block to expanded or collapsed.
What about you what are your favorites. I would like this post to become a repository for the most used Visual Studio Shortcuts. So do share
Hope This Helps!
Hatim
Thursday, December 17th
at 12:10pm
DebuggerDisplayAttribute
Namespace: System.Diagnostics
Usage: The DebuggerDisplayAttribute can be a sweet shortcut to avoid expanding the object to get to the value of a given property when debugging. All you have to do is mouse over the object and any property defined in the attribute will show up with it’s value.
Sample:
[DebuggerDisplay("ProductName = {ProductName},ProductSKU= {ProductSKU}")]
public class Product
{
public string ProductName { get; set; }
public string ProductSKU { get; set; }
}
ConditionalAttribute
Namespace: System.Diagnostics
Usage: This is a great attribute to use with code that you only want to run in debug mode. what it does is pretty much is that the body of any method that has the conditional attribute is not compiled when that condition is false.
Sample:
[Conditional("CONDITION1")]
public static void Method1(int x)
{
Console.WriteLine("CONDITION1 is defined");
}
DebuggerStepThroughAttribute
Namespace: System.Diagnostics
Usage: This attribute is great to skip through methods or properties that only have getters and setters defined.
Sample:
[DebuggerStepThrough()]
public virtual int AddressId
{
get { return _AddressId;}
set
{
_AddressId = value;
OnPropertyChanged("AddressId");
}
}
FlagAttribute
Namespace: System
Usage: Indicates that an enumeration can be treated as a bit field; that is, a set of flags.
Sample:
[Flags] public enum MyColors : short
{
Black = 0,
Red = 1,
Green = 2,
Blue = 4
}
XmlIgnoreAttribute
Namespace: System.Xml.Serialization
Usage: Tells the the xml serializer to ignore a certain field.
Sample:
public class Group
{
// The XmlSerializer ignores this field.
[XmlIgnore]
public string Comment;
// The XmlSerializer serializes this field.
public string GroupName;
}
Hope this helps.
Haitm
Tuesday, December 8th
at 12:41pm
A great tutorial by Brad Abrams about building business applications using Silverlight, RIA Services and Visual Studio 2010
Recent Photos