Updates from July, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • danielsaidi 10:40 pm on July 24, 2011 Permalink | Reply
    Tags: clone, , copy,   

    Cloney – clone your .NET solutions in no time 

    When working with .NET, I sometimes find myself wanting to clone a solution. I am not talking about code duplication, although I know that cloning a .NET solutions also means duplicating code, but just hear me out.

    For instance, you may want to clone a similar project or a project stub, where you can reuse code that should not be extracted into a base library, a convenient, frequently used project structure, 3rd part component setup etc.

    If you have never felt this need, feel free to read on if you find the topic interesting ūüôā

    In my opinion, the biggest problem with cloning a .NET solution by copying it to a new folder, is that you have to replace everything that has to do with the old namespace. For instance, if you have a solution called X, where X is the base namespace, X can contain several projects, such as X.Core, X.Domain etc. If you clone X and call the clone Y, the solution must be renamed along with all projects and everything that relates to the old X namespace.

    I therefore decided to create a small application that makes cloning a .NET solution a walk in the park. It is currently just a try-out beta that can can be downloaded at https://danielsaidi.github.com/Cloney or at http://github.com/danielsaidi/cloney

    With Cloney, you just have to point out a source folder that contains the solution you want to clone, as well as a target folder to where you want to clone the solution. When you then press “Clone”, Cloney will:

    • Copy all folders and files from the source folder
    • Ignore certain folders, such as bin, obj, .git, .svn, _Resharper*
    • Ignore certain file types, such as *.suo, *.user, *,vssscc
    • Replace the old namespace with the new one everywhere

    You then end up with a fresh, clean solution without a trace of old settings, version control-related folders and files etc.

    Feel free to download Cloney and give it a try. If you like it, let me know. If you hate it…well, I guess you should let me know that as well.

    • Adam Webber 3:50 am on December 27, 2014 Permalink | Reply

      Smart utility! Microsoft should simply buy out the program and install ‘Cloney’ in each instance of Visual Studio. I was able to simply name the target folder of destination. No pre-make directory required! Source folder was easy to navigate w built in finder. Once satisfied with name of folder source, and name of folder target, the program took over and performed the perfect clone. Saved me hours of porting over via add existing files, etc. Simply point to your My Websites directory, select the name of your source and assign the name to your target. Can’t get much simpler than that! 4-stars for easy of use … 5-stars if I experience no bugs when working on my new solution.

      • danielsaidi 5:40 pm on January 17, 2015 Permalink | Reply

        So happy to hear that Cloney worked so well for you. Was it a 5 star experience in the end? ūüôā

    • Adam Webber 9:11 pm on January 18, 2015 Permalink | Reply

      Still working w new target … no bugz yet … Must be a winner!

    • Ray 6:01 pm on February 15, 2015 Permalink | Reply

      I have used Cloney again and again and it works like a charm every time. Thanks for sharing such a great utility. I love the simplicity and the fact that IT WORKS. Thanks again.

    • Will 5:00 am on February 19, 2016 Permalink | Reply

      Maybe I’m missing something, but It’s just copying the solution and changing the solution file name, but none of the project names or namespaces are changing. The solution is named X while the projects are named X.Web, X.Api..etc. I was expecting it to change the Solution to Y and the projects/namespaces to Y.Web, Y.Api. I checked the command line parameters and I didn’t see any switches to change project/namespaces. This is a VS2015 solution…could that be why?

      • danielsaidi 10:54 pm on March 1, 2016 Permalink | Reply

        Hi Will! No, in that case something is wrong. It replaces the solution name everywhere it appears – files, folders, namespaces, projects etc. So, if your solution is named Solution1 and has two projects – Solution1.Foo and Solution1.Bar, and you clone it to a folder called Solution2, the new solution should be named Solution2 and the projects Solution2.Foo and Solution2.Bar.

        It seems like you have named your projects in that matter and that you have read up on how the cloner works, but it really should not depend on any VS version, since it only sweeps through the file system. I will have a look whenever I find the time. Thanks for getting in touch!

  • danielsaidi 7:01 pm on July 24, 2011 Permalink | Reply  

    Floods tear Denmark apart and cause massive domain and hosting problems 

    Two weeks ago, heavy rain and extreme weather hit large parts of Denmark, causing major problems. One victim was my hosting provider, who faced immense server problems as the flood hit them with full force (exaggeration possible).

    My .NET server went up after a day or so, but the one where I host my PHP sites (like saidi.se and wigbi.com) were down for more than a week. You may have noticed that the blog lacked some images and that you could not access some of the stuff I have linked to…

    …but I bet that the Danish population had larger problems than that, so I should not complain.

    Last weekend, the server came back online, so hopefully, everything will be back to normal. If it is not, and you find something that does not work, please let me know.

  • danielsaidi 1:48 pm on July 7, 2011 Permalink | Reply
    Tags: il instructions,   

    NDepend and IL instructions 

    I am currently running NDepend on various .NET solutions, to get into the habit of interpreting the various metric results.

    Today,¬†NDepend warned me that a¬†GetHtml method¬†was too complex. It¬†had 206 IL instructions, where 200 is NDepend’s default upper limit. Since this was the only method that NDepend considered too complex, I decided to check it out.

    The method was quite straightforward, but one obvious improvement would be replace all conditional appends. However, it only reduced the number of IL instructions with one per removal and resulted in a method with almost twice as many lines as the original one.

    I therefore decided to restore the method to its original state and look elsewhere.

    Next, a IsNullOrEmpty string extension method turned out to be a small contributor. Instead of being a plain shortcut to String.IsNullOrEmpty, it automatically handled string trimming as well, which made it a bit more complex.

    I now realized that this auto-trimming was crazy, bad and really, really wrong, so I decided to rewrite the method and watched the number of IL instructions drop to 202. Still, we need to improve  the code further.

    Another improvement would be to tweak how comparisons were made.¬†After re-running the analysis, I then had a green light! The number of instructions was now 197. NDepend was satisfied. Still…197? Seems like many instructions for a method with 15 lines of code.

    After some internal discussions, a colleague of mine suggested that I should extract the various attribute handlings to separate methods…and the number of IL instructions dropped to 96.

    Can we reduce them further? ūüôā

  • danielsaidi 10:33 am on July 7, 2011 Permalink | Reply
    Tags: , print screen   

    How to print screen in BootCamp using the Apple keyboard 

    I have decided to go wild and boot my computer in BootCamp, instead of running Windows under VMWare Fusion. I do it occasionally, I admit, skipping the OS X core to benefit from the wonders of GB of RAM, instead of having to share it with OS X.

    Greed is good.

    However, doing Windows with an Apple bluetooth keyboard, without being able to use some OS X keyboard shortcuts, can sometimes be a bit frustrating.

    Today, for instance, I had to take a screen dump. No OS X keyboard shortcut. No print screen button. I was at a total loss, despite all blog posts that spoke about the Shift+Fn+F11 combination. It did not work for me, because I had this option enabled:

    Screen dump

    With this option enabled, neither Shift+Fn+F11 or Shift+F11 work to print screen

    Before you rule me out as a no-brainer, I naturally tried to press Shift+F11 without the Fn key, but that did not work either.

    What did work, however, was:

    • Uncheck the checkbox above
    • Press Shift+Fn+F11
    • Enjoy your screen dump in any way you like
    • Re-check the checkbox above
    It’s a bit of a pain, yes. Any suggestions? Having to press the Fn-key every time I have to press an F-key is not an option.
    • Harry 5:14 pm on July 14, 2011 Permalink | Reply

      and it still doesn’t work with Windows XP under Bootcamp…..

    • Igor 7:23 pm on January 26, 2012 Permalink | Reply

      I found a way to do this.

      Just download SharpKeys, remap lets say your Right Command key in this case Right Windows Key to Print Screen. In Windows 7, works flawlessly.

    • J 11:15 am on August 11, 2012 Permalink | Reply

      Thanks for the info, but I can’t find how to get into the boot camp control panel. Could you please tell me? This print screen thing has been bugging me.

      • danielsaidi 10:20 pm on August 14, 2012 Permalink | Reply

        Oh, it is in the bottom-right system tray. It’s a tilted, black square if I remember correctly.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc