Attach macro

A visual studio macro to attach to a program to your choice:

Public Sub AttachPRogram()
        Try
            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim compName As String = System.Net.Dns.GetHostName()
            Dim procAll = dbg2.GetProcesses(trans, compName)
            For Each proc2 As Process2 In procAll
                If (proc2.Name.ToLower().Contains("your program name here")) Then

                    proc2.Attach()

                End If
            Next proc2

        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Tags:

1 Comment

friday links 18

MVC 4 beta was the release of the month : http://www.asp.net/mvc/mvc4 

  1. NETFx3 Samples – Home – dynamic calling WCF services
  2. Alan Turing’s reading list (with readable links) | John Graham-Cumming
  3. Six Whys – Or, Never Trust Your Network Switch – Blog – Stack Exchange
  4. In a New Era for Marketing, Parental Discretion Advised – Leslie Gaines-Ross – Harvard Business Review
  5. Dynamic Proxy and Memory Footprint – Vipul Modi’s Blog – Site Home – MSDN Blogs
  6. A look at ASP.NET MVC 4 | Techdays 2012 the Netherlands | Channel 9
  7. How to: Create Custom Configuration Sections Using ConfigurationSection
  8. RESTful Services with ASP.NET MVC and XHTML
  9. ASP.NET MVC Localization: Generate resource files and localized views using custom templates | Rui Jarimba
  10. ASP.NET: Downloading files from a UNC share | Rui Jarimba
  11. Single Page Application Overview: The Official Microsoft ASP.NET Site
  12. XML Visualizer v.2 – CodeProject®
  13. Calling a WCF service from a client without having the contract interface – CodeProject®
  14. 52 Things People Should Know To Do Cryptography
  15. Must-have Tools on Windows – Part 1 of 2 – Punit Ganshani
  16. Download HelpNDoc Personal Edition | HelpNDoc
  17. HelpNDoc’s feature tour | HelpNDoc
  18. Recruiting: 8 Qualities Your Best Employees Should Have | Inc.com
  19. Ubuntu for Android Effort Takes Flight – InternetNews.
  20. Mark Shuttleworth » Blog Archive » Ubuntu in your pocket
  21. Simple Talk Newsletter
  22. Automated Script-generation with Powershell and SMO
  23. How to Kill a Company in One Step or Save it in Three
No Comments

Programmer settings ebook

I have put all my programmer settings in this ebook .

It contains:

  1. Visual Studio(Visual Web Developer Express) settings
  2. Command prompt settings
  3. Windows Send To Settings
  4. Sql Server Management Studio Settings
  5. Windows 7 – Programmer Explorer settings
  6. Problem steps recorder settings
  7. Winmerge settings

Download here: http://msprogrammer.serviciipeweb.ro/wp-content/uploads/ProgrammerSettings.pdf

Enjoy!

Tags:

No Comments

friday links 17

 

  1. Basic Instructions – Basic Instructions – How to Help Someone See Their Mistake
  2. Instant Development: iTextSharp PDF rendering in a medium trust ASP.Net environment
  3. EF Power Tools CTP1 Released – ADO.NET team blog – Site Home – MSDN Blogs
  4. Top Executive Recruiters Agree There Are Only Three True Job Interview Questions – Forbes
  5. Mastering the Art of Living Meaningfully Well – Umair Haque – Harvard Business Review
  6. Why Love Matters More (And Less) Than You Think – Umair Haque – Harvard Business Review
  7. Create a Meaningful Life Through Meaningful Work – Umair Haque – Harvard Business Review
  8. Windows 8 Skypad – SkyDrive Sample
  9. Are You a Zen Coder or Distraction-Junkie? « Owl’s Blog on .NET development
  10. Hashing for privacy in social apps – Matt Gemmell
  11. dust
  12. Productive Living
No Comments

Visual Studio Macro – copy from old code

I have a class ( not under my control) and I want to make a shallow copy of his properties.
I was tired to wrote this

newObject.Prop1= this.Prop1;
newObject.Prop2= this.Prop2;
...

And I have not want to use reflection or expression trees ( http://hydrating.codeplex.com/)

So I have made a fast Visual Studio Macro

Public Module TextRelated

    Public Sub CopyOld()
        Dim t As TextSelection = DTE.ActiveDocument.Selection
        Dim text As String = t.Text
        Dim str As String = "newObject." + text + " = this." + text + ";"

'http://svenmaes.blogspot.com/2007/03/access-clipboard-from-visual-studio.html
        modClipboard.ClipboardText = str

    End Sub
End Module

So the work was only to
1. wrote the property
2. click a button
3. CTRL+V

The only part that was difficult was how to put into the clipboard -see the http://svenmaes.blogspot.com/2007/03/access-clipboard-from-visual-studio.html

Simple, but efficient – Enjoy!

No Comments

friday links 16

  1. Real World: Startup Lifecycle of a Windows Azure Role
  2. Utilizing the Power of Startup Tasks in Your Windows Azure Web Role | Windows Azure Customer Advisory Team (CAT)
  3. Android Development: Do You Know Your Options? » BuildMobile
  4. Fluqi – Ease using jQuery UI with ASP.NET and ASP.NET MVC
  5. SquishIt – The Friendly ASP.NET JavaScript and CSS Squisher | CodeThinked
  6. loads.in – test how fast a webpage loads in a real browser from over 50 locations worldwide
  7. 35 Highly Advanced Yet Simple To Use jQuery Plugins | Free and Useful Online Resources for Designers and Developers
  8. gMap – Google Maps Plugin For jQuery | Download
  9. FullCalendar – Full-sized Calendar jQuery Plugin
  10. 8 Powerful Wordpress Plugins You Probably Don’t Use But Should | Free and Useful Online Resources for Designers and Developers
  11. 10 Completely Free Wireframing and Mockup Tools
  12. Scale of the Universe 2012 – OneMoreLevel.com
  13. LayeringPrinciples
  14. svenM: Access the clipboard from a visual studio macro
  15. Using Async for File Access – C# Frequently Asked Questions – Site Home – MSDN Blogs
  16. Microsoft Key Tools and Resources for Microsoft Developers – Developers, Developers Developers – Site Home – MSDN Blogs
  17. Visual Studio 2010 UML Design Pattern Toolbox Items Extension – Microsoft Visual Studio UK Team – Site Home – MSDN Blogs
  18. What is Microdata?
  19. What are Microformats?
  20. ASP.NET MVC DropDownList, MultiSelect and jQuery – Ricka on MVC and related Web Technologies – Site Home – MSDN Blogs
  21. LosTechies | Se Habla Code
  22. Lean Startup: Look Before You Leap — Visual Studio Magazine
  23. Talking to Customers: What a Concept — Visual Studio Magazine
  24. 4 ways to do Mail Merge using Google Apps Script – Google Apps Developer Blog
  25. GUI Architectures
  26. The Build Your Own CAB Series Table of Contents | Jeremy D. Miller
  27. Romcyber | ScrapySharp in english :)
  28. What Level Programmer Are You?
  29. What are your favorite Nuget MVC packages » BuildStarted.com
  30. Jang a server-side/client-side view engine for MVC and javascript » BuildStarted.com
  31. Razor Engine v2.x » BuildStarted.com
  32. Database Performance Transparency – SQLServerCentral
  33. Productive Living
  34. Constraints, expectations and real estate | Jimmy Bogard’s Blog
  35. Linux 2.6.39-rc3 :
    << There really are only two acceptable
    models of development: "think and analyze" or "years and years of
    testing on thousands of machines". Those two really do work.>> Linus Torvalds
No Comments

Clearer as Nuget package

It was not so difficult to make Clearer as NuGet package. Just analyzing MVC Sitemap package done the trick. So the package looks like:

image

 

You can install from http://nuget.org/packages/Clearer or download a sample application  http://clearer.codeplex.com

( What he does ?

In every application there are some variables that are set by the ASP.NET application( ASP.NET_SessionId cookie ) and some that are set by the programmer( cached data in Application/Session/Cache/Cookies and so on).
I wanted every time to have a page where I can “clear” / delete those – and not found. So it’s the Clearer project.
Possible uses:
For developers – when they want to see what happens when a cache item no longer exists
For developers – to put to site admins some simple tool to reload data from Cache/Application . Just edit the LoadAll function to load only Cache/Application
For developers – to test easily the session. Just delete ASP.NET_SessionId cookie – you will get another one when you refresh the page.

)

So please install Nuget package from http://nuget.org/packages/Clearer and tell me if it works!

No Comments

friday links 15

  1. Interviewstreet – Facebook Programming Challenge
  2. Ebooks: List of our free books – Microsoft Press – Site Home – MSDN Blogs
  3. Javascript and CSS Minifying/Bundling with the Microsoft.Web.Optimization Nuget package – Canadian Developer Connection – Site Home – MSDN Blogs
  4. Good JavaScript Habits for C# Developers | MIX11 | Channel 9
  5. Customizing Error Messages in Asp.Net MVC
  6. From Concept to Code in 6 hours: Shipping my first Windows Phone App – Scott Hanselman
  7. 8 Things You Ought to Know If You Do Not Know Anything About Hiring A Software Developer | 8th Light
  8. dust
  9. It’s not about you
  10. Mythical man month : 10 lines per developer day | Patrick Smacchia
  11. The world’s first computer password? It was useless, too
  12. Stephen Hawking’s New PC
  13. The Hungry Programmer
No Comments

Clearer MVC

In every application there are some variables that are set by the ASP.NET  application(  ASP.NET_SessionId  cookie ) and some that are set by the programmer( cached data in Application/Session/Cache/Cookies and so on).

I wanted every time to have a page where I can “clear” / delete those – and not found. So it’s the Clearer project.

It consists of :

  1. ClearerController with 2 Actions:   Index and DeleteItem
  2. 2 Views : Index.cshtml and EditAppData.cshtml
  3. Different Models:
    • SourceData  – enum  – can be  :  None ,        Application ,        Cache ,        Session ,        Cookies
    • AppData -  maintains Key/Value and SourceData pairs
    • ListAppData – loads data from Application , Cache , Session , Cookies  – and deletes.

To make an example, I have put in the Application_Start and Session_Start different values. So the screen is the following:

image

What I learn from the code:

  1. The Cookies, Applications, Session , Cache items can be easily converted to an DictionaryEntry and the code can be like this:
     DictionaryEntry de = new DictionaryEntry(item, sess[item.ToString()]);
     AddNew(de, SourceData.Session);
    
  2. Code must be error prone – what if some item in Session is null ? So , if I have the Key, all is good:
    private void AddNew(DictionaryEntry de, SourceData sd)
            {
                AppData ap = new AppData() { source = sd, Key = de.Key.ToString() };
                try
                {
                    var obj = de.Value;
                    ap.Value = (obj == null) ? Null : obj.ToString();
                }
                catch (Exception ex)
                {
    
                    ap.Value = string.Format(ErrorToString, ex.Message);
                }
                this.Add(ap);
            }
    
  3. The dog-food is good: I have followed my advice from msprogrammer.serviciipeweb… and it works ( used for Remove )
       [HttpPost]
            public JsonResult DeleteItem(string TheKey, int Source)
            {
                try
                {
                    var lad = new ListAppData();
                    lad.DeleteItem(TheKey, (SourceData)Source);
                    return Json(new { ok = true, message = "" });
                }
                catch (Exception ex)
                {
                    return Json(new { ok = false, message = ex.Message });
                }
    
            }
    
  4. When you pass strings in Javascript, there is a simple way to encode: HttpUtility.JavaScriptStringEncode
    <a href="javascript:removeItem('@HttpUtility.JavaScriptStringEncode(Model.Key)','@((int)Model.source)','@id')">Remove</a>
    

Possible uses:

  1. For developers -  when they want to see what happens when a cache item no longer exists
  2. For developers – to put to site admins some simple tool to reload data from Cache/Application . Just edit the LoadAll function to load only Cache/Application Winking smile
  3. For developers  – to test easily the session. Just delete ASP.NET_SessionId  cookie – you will get another one when you refresh the page.

You can view online at http://clearer.apphb.com/Clearer
The project could be found at http://clearer.codeplex.com and have all – source code, downloadable project .

Next week it will be a Nuget item.

For more features , please leave me a comment here or on codeplex at issues
Nuget package at http://nuget.org/packages/Clearer

Tags: , , , ,

5 Comments

friday links 14

  1. YSlow “Grade A” website with ASP.NET MVC 4 In the trenches with .NET by Harvey Kandola
  2. Rob Miles – C# Yellow Book
  3. Anyone over the age of 35 should read this, as I copied this from a friends status .. « Gaasedal’s Weblog
  4. Raphaël—JavaScript Library
  5. tompipe.co.uk | Utilising MEF to self-register HTTP modules
  6. Why Stack Exchange Isn’t in the Cloud – Server Fault Blog
  7. So You Want to Get a Job in Information Technology? – Server Fault Blog
  8. The top 20 HTML5 games | Feature | .net magazine
  9. EF 4.3 Beta 1: Automatic Migrations Walkthrough – ADO.NET team blog – Site Home – MSDN Blogs
  10. 20 Pieces of Programming Wisdom | danielmiessler.com
  11. Need a workaround to use MVC2 view page or control to generate html without controller context : The Official Microsoft ASP.NET Forums
  12. The Morning Brew – Chris Alcock
  13. So many interfaces, part two – Fabulous Adventures In Coding – Site Home – MSDN Blogs
  14. Schauderhaft » Tips for Testing Database Code
  15. Code review made simple and affordable | Nitriq Code Analysis for .Net
  16. PatternCraft | johnlindquist.com
  17. JavaScript InfoVis Toolkit
  18. How I Program Stuff – Randall Degges
  19. Nancy – Lightweight Web Framework for .net
  20. Providing an HTML5 Date Input control with Fallback
  21. The Game Bakers – Money and the App Store: a few figures that might help an indie developer
  22. The Hungry Programmer
  23. Stephen Hawking’s New PC
No Comments