Saturday, March 27, 2010

Humus kitchen on 84th and 22nd loved their Shakshuka


Tuesday, March 23, 2010

Useful Visual Studio shortcut keys

Shortcuts Association
F8/Shift-F8 Navigate compilation errors
Ctrl-D Move to mini-buffer
Ctrl-Shift-G in mini-buffer or Open file name in mini-buffer (Ctrl-O seems to open stuff Ctrl-Shift-G does not)
Ctrl-O in mini-buffer
"> command" in mini-buffer Execute command
Ctrl+/ Move to mini-buffer, typing the leading > for you
Ctrl-Alt-A Open the command window
Ctrl-PageUp in HTML Design View Open source view
Ctrl-PageDown in HTML Source View Open design view
F7 in Form Design View Open source view
Shift-F7 in Form Source View Open design view
Ctrl-Alt-L Solution Explorer
F4 or Alt-Enter Properties of selected item
Ctrl-Shift-B Build
F5 Debug
Ctrl-F5 Run, but not debug
Ctrl-Alt-J Object Browser
Ctrl-Shift-C Class View
Ctrl-Space when typing a symbol Complete the symbol you're currently typing or give you a choice of possibilities
Ctrl-Space when entering arguments Show the function prototype
"-" (no quotes) as the name of a menu item Menu item becomes a separator
Ctrl-K Ctrl-F Reformat selection
} Reformat scope being closed
Ctrl-K Ctrl-C Comment out selected lines
Ctrl-K Ctrl-U Uncomment selected lines
Ctrl-} Match braces, brackets or compiler directives
Shift-Ctrl-} Select match between braces, brackets or compiler directives
Ctrl-L or Shift-Del or Delete entire line
Ctrl-X w/ no selection
Ctrl-Del Delete next "word"
Alt-F6 Next visible pane (not for use with all windows unpinned)
Ctrl-Shift-F12 Jumps to next *whatever*, depending on what's active, e.g. next find result, next task, next error, etc.
Ctrl-"-"/Ctrl-Shift-"-" (no quotes) Jumps to last/next place you worked
Ctrl-C in the Class View Copies fully qualified name to the Clipboard
Ctrl-M Ctrl-M Collapse or expand a region or outlined block (as marked by the [+] and [-] on the left hand side of the editor).
Ctrl-M Ctrl-O Collapse everything in the current file
Ctrl-M Ctrl-L Expand everything in the current file
F12 Jump to the current symbol's declaration
Ctrl-G, line #, Enter or Jump to line
Ctrl-D, line #, Ctrl-G
Ctrl-I/Ctrl-Shift-I + string Incremental search for string
Ctrl-R+Ctrl-R Turn on/off word wrap
Ctrl+Up/Down Arrow Scroll window up/down without moving the cursor away from the current line
Shift+Alt+Arrows Column selection (include of line selection)
(Alt+Mouse works, too)

Posted via email from ullfindsmit's posterous


Monday, March 22, 2010

Yahoo Mail is absolutely worthless

I have been having this problem for over four weeks now.

Every time I log into my yahoo account it shows the message below.

There was a problem accessing your account. Please try again in a moment.
Error #1

Not sure what the cause is but it stops me from accessing my account.

I was able to access my account yesterday via yahoo's widget on their homepage.

I am not sure if you have run into this issue... but incase you have and know the resolution please let me know

Thanks
Smit.

Posted via email from ullfindsmit's posterous


Saturday, March 20, 2010

Rishi working hard


Go Devils


Friday, March 12, 2010

.Net 3.5 and Partial Classes and Multi Layered System

.Net 3.5 and Partial Classes and Multi Layered System

I want to break my project down into 3 layers of code.

Mainly

Shortcut
 I was hoping to be able to simply create partial classes in the Logic library so I would not have create a brand new set of classes
 Unfortunately you can not create partial classes outside the main library which contains your DBML

Solution
 I can create a class with the same name under the Test1.Logic namespace, and simply inherit the Test1.Data class.

This gives me all the classes and their methods in the Logic library without a lot of code and now I can build my entire logic in the LOGIC library

Hope this gives you a jump start on your project.

I would use this script to quickly create the LOGIC classes from your DATA classes

DECLARE @TableName VARCHAR(500)

DECLARE tc CURSOR FOR

      SELECT      Table_Name

      FROM  Information_Schema.Tables

      WHERE Table_Type = 'BASE TABLE'

      ORDER BY Table_Name

 

OPEN tc

 

FETCH NEXT FROM tc INTO @TableName

WHILE @@FETCH_STATUS = 0

BEGIN

      PRINT 'class ' + @TableName + ' : Test1.Data.' + @TableName + '

      {

      } '

 

      FETCH NEXT FROM tc INTO @TableName

END

 

CLOSE tc

DEALLOCATE tc    

 

Remember though that you will still need to create the datacontext manually

Have an excellent day.


Thursday, March 11, 2010

Cannot add an entity with a key that ...

Cannot add an entity with a key that is already in use


This ERROR has caused me a lot of aggrevation over the last couple of days as a sniplet that I was using earlier all of a sudden stopped working.

And even when I went back and checked the history it showed no change to that code block.

I read a bunch of articles online (for over 3 days) which led me to believe that the problem was with the LINQ framework and not my code.

Despite strongly disagreeing with the idea to add an IDENTITY column, I finally bit the bullet and added the column but still no luck.

I yelled out in pain "WHY THE HELL WOULD THIS NOT WORK" after a couple of sleepless nights, I tried something else, I tried calling the db.SubmitChanges() function in the begining of my function.

P.S. I am extending my datacontext by using Partial Class

So I had code that looked something like this

Partial Class FancyDataContext
 Public Sub AddYahoo()
  Dim db as FancyDataContext = Me
  Dim NewRecord as New FancyRow
  db.Fancy.InsertOnSubmit( NewRecord )

  db.SubmitChanges() 'THIS IS WHERE IT ERRORED OUT

 End Sub
End Class

I tried variations of my code to see if there was something that I could do to fix this code that was working perfectly fine previously.

AND
What I found was simply AMAZING.
I simply chagned my code from above to

Partial Class FancyDataContext
 Public Sub AddYahoo()
  db.SubmitChanges()

  Dim db as FancyDataContext = Me
  Dim NewRecord as New FancyRow
  db.Fancy.InsertOnSubmit( NewRecord )
  db.SubmitChanges() 'THIS IS WHERE IT ERRORED OUT
 End Sub
End Class

And it errored out.
And Ofcourse, what I noticed was that the function calling my AddYahoo() function was making changes to the datacontext that were not being committed in its block and handing my function the bad data

I did a quick search on LINQ Discard Chagnes and used the article on http://graemehill.ca/discard-changes-in-linq-to-sql-datacontext and created the discard function

Public Sub DiscardInsertsAndDeletes(ByVal data As DataContext)
    ' Get the changes
    Dim changes = data.GetChangeSet()
 
    ' Delete the insertions
    For Each insertion In changes.Inserts
        data.GetTable(insertion.GetType).DeleteOnSubmit(insertion)
    Next
 
    ' Insert the deletions
    For Each deletion In changes.Deletes
        data.GetTable(deletion.GetType).InsertOnSubmit(deletion)
    Next
End Sub

So my code now said 

Partial Class FancyDataContext
 Public Sub AddYahoo()
  DiscardInsertsAndDeletes()

  Dim db as FancyDataContext = Me
  Dim NewRecord as New FancyRow
  db.Fancy.InsertOnSubmit( NewRecord )

  db.SubmitChanges() 'THIS IS NOW WORKING :D YEAY

 End Sub
End Class

So at the end of it all it was human error.

My apologies to the MSFT team for doubting them.

Hope this saves you some aggrevation in the future.

Have an excellent day.












Friday, March 05, 2010

Headed to CHASKO on Oak Tree Rd :D


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]