Tools and Utilities

.docker/machine/machines/default/ca.pem: no such file or directory

Was doing a
docker-machine env default
where it seems to be getting stuck (waiting longer than usual) and when I open Virtualbox and look at the preview, it is already initialized and ready to accept commands but my terminal command is still waiting.

Then when I exit (e.g. Ctrl+C or Cmd+C) this error will show up.
open /Users/yourUsername/.docker/machine/machines/default/ca.pem: no such file or directory

The error could also be
Daemon not responding yet: dial tcp : xxx operation timed out

These resolved it for me.

docker-machine regenerate-certs default
docker-machine restart default

I was not using existing/custom certificates and letting docker toolbox create/manage it and willing to loose any information in that virtual/docker-machine. It should be true for most people but if you use custom certificates or don’t let docker-machine manage it for you, this will not apply to you and you need to find answers elsewhere.

There is also some references that AnyConnect (VPN) + your VirtualBox networking settings could cause it so if these do not work, try turning it off as well. Then find out more about VirtualBox networking settings. If you must be in VPN then
> you can use this script (while on VPN) – script found here – it will fix routes/rules that gets changed by AnyConnect

* Docker Toolbox

Tools and Utilities

switched home pc from vista to ubuntu

i have a > 5-yr old thinkpad t400 with windows vista business and noticed that time was taking it’s toll on it so started rescue and recovery (thinkvantage blue button)

rescue and recovery has started for a minute when I remember that it might be a good idea to disconnect some of my license keys etc (itunes disconnect accounts, and other software i have) and luckily there is a cancel button in the progress bar.

or not… lucky enough
i clicked on cancel then it restarted
then windows is broken (cannot load winload.exe etc etc)
cannot even get to thinkvantage again (apparently it uses windows boot to get there)

so i needed to recover my windows vista:
* i did not have rescue and recovery disk (yes, i know i should have)
* but my DVD/CD reader/writer is no longer reliable (did i say time has taken it’s toll)
* i have no vista CD (even if i had my CD drive is not working)

so seems i have these options:
1- get a new CD/DVD drive then find a recovery CD (any variant of windows i guess should work)
2- have bootable USB with Windows 7 (implies that i have to have windows 7)
3- take a leap of faith and install ubuntu

I was able to borrow a windows CD then figured I should give my CD drive a chance. Slowly creeped it’s way into the recovery mode but never got there. So ok, maybe I should go for USB bootable Windows 7 tomorrow (need another PC for this).

Or…. try Linux from USB if it will work fine on my machine. And so I did and it worked (fast….) and shutdown fast too. I was left with no choice but to switch (well not really, I left my Lenovo recovery partitions in case I could fix Vista later on)

So this is now being written on Ubuntu 12.04 LTS Desktop. And so far so good.

1- no native support to stream Netflix instant videos (since they run Silverlight) but was able to find Netflix Desktop (seems to be WINE + Silverlight + Firefox)

2- no GotoWebinar support (no easy work-around so instead of spending time I just used my iPhone for now).

the new journey with Ubuntu continues…

Agile Career Growth Tools and Utilities

remove/delete svn folders

Since I’ve been using SVN and stumbled upon this technique I’ve also been using since then

This is one of the many (but easiest way) to remove SVN folders (.svn) recursively from a given folder. Effectively “unbinding a folder from SVN

Follow these easy steps: [more]

1) download this registry file : DeleteSVNFolders.reg (313.00 bytes) – see below notes for more information (security issues/verification and code source). I urge you to review them but if you don’t want to worry about the details and trust me enough then please go ahead and download.

2) double click on the file you downloaded

    you will be prompted to confirm that you really want to perform the action (differs depending on your OS). just continue and should all go well you will have a successful message/dialog

3) then to see it work go to the folder you want to remove the .svn folders from, then right click it

you should see the “Delete SVN folders” menu item

4) Click the said menu item and the .svn folders will be removed (there will be a command window that will show up displaying progress too – though if the folder structure is not that deep enough it might disappear very quickly).


And you’re done

** Notes

1) altering your registry not for the faint-hearted and you’d have to trust the author/publisher. In this case I do and I have been using it for years

    and if you could also look into it (edit e.g. notepad or text editor) and understand what it does if you want to make sure you’re not letting it do something you don’t want

    i have taken this from : Jon Galloway’s Shell Command – Remove SVN Folder and simply created the reg file to be downloadable (for those who are not so confident on how to deal with reg files)

Tools and Utilities Web

Link: IE 8 Release Candidate 1

"Internet Explorer 8 has been designed from the ground up to be enterprise-ready.  It helps reduce security risk through features such as a cross-site scripting filter, the SmartScreen® Filter, and safer controls and management of the Microsoft® ActiveX® technologies, platform, controls, scripting, and server framework. And when you download the latest RC1 software, you're automatically registered to access valuable RC1 resources assembled in one convenient location.

Evaluate Windows Internet Explorer 8 RC1 today"


.NET Tools and Utilities

My Simple Talk article on ANTS Profiler and Performance

A couple of weeks back, RedGate/SimpleTalk contacted me for a short article about ANTS Profiler. I've been using it for sometime and has definitely been very useful so I won't think twice about recommending it.

Here's the link (below) and please do drop by to read it. Feel free to rate/comment

Using a profiler to speed (up) application Performance

.NET Tools and Utilities

remove malicious script tags from file

Here's a small Windows Forms application that I created to automate removal of malicious SCRIPT tags inserted into some web files. [more] (or in general – even non malicious scripts).

Of course, you can always do this manually but if we're talking of hundreds or thousands of files, it will be one heck of a job.

The idea is to:

1) retrieve list of all script tags in all files in a given folder (including subfolders)

2) list scripts found

3) select the scripts to remove – ALSO, if the script contains line break, select it then click on the [View Script Detail] button. Also note that the checkedListBox is not set to check on click

4) set a folder to save the "cleaned" file

5) then process (remove the selected scripts and they will be saved on the Target Folder – retaining their folder hierarchy)

That's it

Here's a glimpse at the "core" code for the application. Note that I employed recursion inside of the faster, better performing stack approach for simplicity.

The complete source code can be downloaded below. Along with the output (executable).

** Search a root folder (and subfolder and files) for script tags (and their contents ofcourse)

   70 // recursive

   71         private void SearchFolder(string newRootFolder)

   72         {

   73             DirectoryInfo rootDir = new DirectoryInfo(newRootFolder);

   74             foreach (FileInfo fi in rootDir.GetFiles())

   75             {

   76                 SearchFile(fi);

   77             }


   79             foreach (DirectoryInfo di in rootDir.GetDirectories())

   80             {

   81                 SearchFolder(di.FullName);

   82             }

   83         }


   85         private void SearchFile(FileInfo fi)

   86         {

   87             using (StreamReader sr = new StreamReader(fi.FullName))

   88             {

   89                 string fileContent = sr.ReadToEnd();

   90                 MatchCollection ms =

   91                     Regex.Matches(

   92                         fileContent,

   93                         @"<script([^>]*)>.*?</script>",

   94                         RegexOptions.Singleline); // handle line breaks inside script tags


   96                 foreach (Match m in ms)

   97                 {

   98                     if (checkedListBox1.Items.Contains(m.Value))

   99                         continue;


  101                     checkedListBox1.Items.Add(m.Value);

  102                 }

  103             }

  104         }

** Process a root folder (and subfolder and files), check if a script marked as to be removed is found, replace it with empty string (effectively removing it) then save the file on the Target Folder.


  106         // recursive

  107         private void ProcessFolder(string newRootFolder)

  108         {

  109             DirectoryInfo rootDir = new DirectoryInfo(newRootFolder);

  110             foreach (FileInfo fi in rootDir.GetFiles())

  111             {

  112                 ProcessFile(fi);

  113             }


  115             foreach (DirectoryInfo di in rootDir.GetDirectories())

  116             {

  117                 ProcessFolder(di.FullName);

  118             }

  119         }


  121         private void ProcessFile(FileInfo fi)

  122         {

  123             string path = fi.FullName;

  124             using (StreamReader sr = new StreamReader(path))

  125             {

  126                 string fileContent = sr.ReadToEnd();

  127                 StringBuilder sb = new StringBuilder(fileContent);

  128                 int origLength = sb.Length;

  129                 foreach (string stringToRemove in selectedScripts)

  130                 {

  131                     sb.Replace(stringToRemove, String.Empty);

  132                 }


  134                 if (sb.Length != origLength)

  135                 {

  136                     string newFilePath = path.Replace(textBox1.Text, textBox2.Text);

  137                     string newFileDirectory = Path.GetDirectoryName(newFilePath);

  138                     if (!Directory.Exists(newFileDirectory))

  139                     {

  140                         Directory.CreateDirectory(newFileDirectory);

  141                     }


  143                     string newFileContent = sb.ToString();

  144                     using (StreamWriter sw = File.CreateText(newFilePath))

  145                     {

  146                         sw.Write(newFileContent);

  147                     }

  148                 }

  149             }

  150         }

Files for Download: (11.11 kb) (10.57 kb)

Hope this helps in one way or another and as usual, feel free to make comments/corrections. This has been haphazardly made but tried my best to make it useful and working.


*** Note that this has some known limitations (due to the regex expression used):

1) script tags has spaces like <script>abc</script > (note that the end script tag has a script before >)

2) self closing script tags <script src="url" />

as there was no need for me to handle these cases, however should you need to handle them, feel free to drop me a message and I'll try to help out.

By the way, Happy 2009 everyone!

.NET Data Tools and Utilities

Performance, Measure and ANTS Profiler

Might need to create a separate page for notes on performance since I've been doing a lot of C# and database tuning lately but having them on this post so far. Here are some of my notes on performance [more]

* Before you optimize, ensure that your results are accurate first before optimizing. I would suggest Test Driven Development or at least some unit testing but that's another story. Just make sure your results are correct first otherwise your optimization is useless.

* Before you optimize, always MEASURE MEASURE MEASURE

* If you can measure without introducing extra code, go with it. Aside from saving time, it will keep your code clean and introduce what could be unnecessary complexity. And for this very reason I just purchase ANTS Profiler 4 from RedGate software. Another alternative is dotNetTrace from JetBrains and although I love Resharper from the same company I prefer ANTS profiler. I said prefer because as I haven't explored dotNetTrace that much, i would say it is really preference, UI/usability and being able to view the timings embedded in a window which shows the source code. Also like the call graph, drill down on significant methods in terms of time spent on it. I got a quote for a no support/update version of the software when I emailed RedGate about their pricing which is admittedly very high for a personal purchase when you are earning from a 3rd world country. So will be receiving fixes but not major upgrades (so as they say but haven't dug deep – besides the version looks pretty good and turns out to be very useful for me already). It really sucks to try to optimize something only to find out that it is not the bottleneck

* If your application involves database access and you're slow then more often than not your database is not tuned. And SQL Profiler and Database Tuning Advisor is a very good start. You can apply the recommendations or you can just evaluate them and make your own adjustments. In my experience however the recommended changes does make a lot of performance improvement. You think you know enough about indexes and database design? You might be surprised how much performance you can gain from these tools.

Again measure, measure, measure but if you can only identify some specific parts then data access seems like a good start.

* Then look into you application logic. Even if your code is optimized but your algorithm/logic is wrong, it will still turn out bad

* Also know about database/table statistics, indexed views and partition. If you can take advantage of partitions and involving considerable data access the improvement is quite impressive.

* <string>.SubString(…) does some considerable lifting so if you want to check if the first two chars in a string is equal to some other string then you should consider using <string>.StartsWith instead or avoid the SubString if you can

* Hashtable is faster than SortedDictionary, SortedList or List. I know I should provide stats for this (have a URL somewhere and will update this soon)

* When using nullable types, use <variable>.HasValue as much as possible than comparing using != null. Or even "!<var>.HasValue" vs. "== null". But avoid negation if you have to

Finally this list will grow soon hopefully and if feel like you disagree please feel free to comment and have other benefit from your thoughts too 🙂

Tools and Utilities

RedGate Software to continue development of .NET Reflector

Big names. RedGate Software the popular creator of SQL Server (eg. SQLPrompt, SQLDoc, SQLBackup) and .NET (ANTS Profiler, Exception Hunter) tools will be taking over the future development of .NET Reflector a browser and analysis tool for .NET authored by Lutz Roeder. Worth noting that reflector which has been hosted in Roeder's site for a long time is not hosted in redgate's site. [more]

Reflector has always been in my must have tools and proved to be useful a lot of times already especially in providing valuable insight as to the inner workings of .NET libraries (eg. DLL, EXE) among other things. Also a good way when you're working on performance tuning and optimization and even just to familiarize with how other people's code looks like (though might differ with orignal source code since the compiler makes some optimizations). Although it has been working as intended and could not think of necessary additional features at this time I'm hoping the take over of RedGate will bring about more helpful features and other improvements.

Read interview on take over of RedGate for development of .NET Reflector

Tools and Utilities

FREE Web Conferencing with

Just like to share about Nopz, this is not a social networking site like friendster or myspace, nor a paid blogging site, ad site or a multilevel marketing site where i'd convince you to sign for me to get a referral fee 🙂 is a web conferencing/meeting service/platform similar to the popular WebEx or GotoMeeting. The only catch is it's for FREE. Yes you read it right. For Free. [more]

Just go to Sign up, start a meeting, allow some plugin/extension to be installed in your browser (and allow it to access some resources if you have a personal firewall – which I also recommend in my case ZoneAlarm) then you're good to go.

When I had to use it, our needs were simple : to share my desktop and it was straightforward.

I believe that it also has support for voice (access to your microphone) and video (on top of the online screen sharing – and thus access to a webcam).

Furthermore, it has a "shared whiteboard" feature where you have some sort of a painter application on screen then you can either do the writing/painting or unlock it and let the other attendees write/paint to. How cool is that.

Once sharing, you will have a link at the upper right for "Meeting Info". clicking on it will popup a dialog with the meeting url. just share it.

The only concern you might have is that:

1) if you are the starter of the meeting and thus the presenter, you can't view how your desktop appears. The work-around for this is to join the meeting from another browser instance (just tried and works).

2) if sharing a desktop, the whole desktop is shared and no option to share only a region, a window or hiding the taskbar. Now I cant remember very well if WebEx or GTM has this feature but if you're particular about this one then you might not want it and find another solution supporting it.

3) I believe you can't change presenter or allow another attendee to control the mouse/keyboard

4) I'm not sure but I didn't notice an authentication support like requiring attendees to enter password

5) Some limitations: like Maximum participants is 20, maximum meeting length of 2 hrs 45 mins, maximum attendee mics to 3.

I also didn't dig much deeper on the level of access and security risk the application poses but I don't have critical, confidential files on this machine and I can restore it from my Acronis Secure Zone Restore anytime. Plus the added confidence on Firefox 3, IE and ZoneAlarm (i opt to not "always" whatever prompts that needs needs access to restricted resource).

Bottomline; for most of my requirements and I have nothing to hide on my desktop 🙂 this is more than just good enough for me. Need not post screen shots, just go ahead and try it, I'm sure you'd find your way around.

Hope you'd find it useful too.

** Thanks to Ozer UNAT for introducing this cool stuff to me 🙂

.NET Tools and Utilities

SubSonic and Club Starter Kit

If you don't code generate your DAL or use OR/M or anything that would
make you worry less about DataAccess like LINQtoSQL, Entity Framework, NHibernate, Castle
ActiveRecord then you should definitely give SubSonic a shot.

On the side I'm currently working on a C# version of Extended Club Starter Kit Version 3 Beta 1 for one club that I was part of in college (and probably a few others) and one thing to note is that the project has opted to use SubSonic. It's an open source project developed by Rob Connery and a few other popular developers in the .NET. It simplifies generation of Data Access code and some utility functions common to development. And don't forget about the cool Scaffolding support. As I've heard this is one of the popular features of the Rails framework where pages are generated on the fly to serve as you're admin tool for add/edit operations against your database table. They could be considered your admin pages or at least help during development. Bottom line is, all these features will save your time (which is what SubSonic aims for). [more]

You can opt to have the DAL generated on the fly using ASP.NET build providers, generate them using command line or as of the current version a GUI tool called "SubStage" (it is also were I view the auto scaffolding).

You can also download the SubSonic Starter Kit and get a web site already configured to work with SubSonic, UrlRewriter.NET (which is also keeping me busy considering that IIS 7.0 now allows httpmodule to run for all requests simply by configuring web.config) and a built in Content Management System. Not as complicated (a good thing) as other full blown CMS but will probably integrate this with the Club Starter Kit (so the club won't need to know programming or get back to me if they need some new pages or the sort).

It would be a good practice for me to leave the ClubSK on VB.NET and make some modifications but since I'm new with SubSonic and intend to use it for other projects, will have to remove the language barrier first so C# it is 🙂

I will definitely post the code here (or some other open source hosting like CodePlex) and try my best to keep this version abreast with the original ClubSK once I'm done. So far I have the DAL (separate project), App_Code and some pages converted to C# already and using SubSonic 2.1. Hopefully I'll have enough time to finish sometime soon.