Room of a pleinolijf

Ask yourself this: how do I want to be remembered ?


1 Comment

Deleting Files and Folders With Paths/Names That Are Too Long for Windows

As a follow-up on the previous post, I found a better alternative to do this if you already use node.js. There’s a util available on GitHub, called rimraf, that seems to exist purely to help you and me out with this irritating problem (on a Windows machine).

And it’s easy-peasy. Simply open your favourite node.js prompt (I like to set up everything in the excellent Cmder, btw), and install rimraf like so:

npm install -g rimraf

Then, to actually see the ‘magic’ happen, execute:

rimraf <directory_to_delete>

Could it be any easier ?


4 Comments

Unable to Delete File when Source Path Name Too Long

I regularly suffer from this annoying Windows treat: being unable to delete files that are located in a path which name is too long. Specifically, this occurs on files created by Node.js. Maybe that might be the reason. But it’s still illogical, since the file was allowed to be written by the OS in the first place.

2015-06-02 12_39_43-path name too long at DuckDuckGo

An example: C:\SourceTree\dso\node_modules\grunt-spritesmith\node_modules\spritesmith\node_modules\pixelsmith\node_modules\get-pixels\node_modules\ndarray-pack\node_modules\cwise-compiler\node_modules\uniq\test

You would want to do that if you want to ‘clean’ your npm install folder, for example.

With tips and tricks suggested on support forums, -at least in my case- I was unable to delete this file/folder. Nothing will work, not even an Adminstrator PowerShell console.

The only solution ? 7-Zip. Yep, that’s right, the popular compression tool. When you do Shift-Del (bypassing the Recycle Bin), it actually uses it’s own internal file engine to delete the files, instead of hooking into the operating system. As a bonus, it deletes the files faster as well.

How ? Simply open the 7-Zip File Manager, and navigate to the big bad folder (containing the files) in question. Select what you want to see gone, and press Shift-Del. Done and done.


Leave a comment

Alphabetical Regular Expression for Non-English Languages

Just a quick tip I want to put out there. Whenever you need to match alphabetical characters using a RegEx in an environment that will contain non-english languages (which have diacritics like à, é, õ, Ü, ç, etc…) you can do so like this:

[a-zA-ZÀ-ÿ]

By the way, don’t make my mistake of shortening it to :

[A-ÿ]

Because that will include a number of special characters like the dollar and ampersand signs.

You can use the pattern as an input filter to disallow any characters that are not alphabetic (but allow an apostrophe and a whitespace for example):

([^a-zA-ZÀ-ÿ’\s])+


Leave a comment

Be wary of closures when using delegates

Just recently, I got caught out by a closure.  A closure is a piece of code that can be ‘executed later’, while still retaining the environment in which it was created.  A lot of developers mistakenly think anonymous delegates, like lambda expressions, are by definition closures.  They can be, but don’t have to (and usually aren’t).

I’ll illustrate with the actual code snippet that caught me out.  Unfortunately, at my current client, I can’t make use of the excellent Visual Studio add-in ReSharper, which would have alerted me on this with a “Access to modified closure” warning.

foreach (string keyword in keywords)
{
   ToolStripMenuItem keywordTsmi = new ToolStripMenuItem(text: keyword, image: null,
      onClick: (sender, e) => Clipboard.SetText(keyword));
   keywordsTsmi.DropDownItems.Add(keywordTsmi);
}

In this bit, I am filling up a context menu with new sub menu items, containing keywords that are copied to the clipboard when clicked on.

Obviously, this compiles just fine, and the submenu is correctly filled with all the distinct keywords.  However, no matter which keyword you click, it would always copy the last keyword in the list.  With this functionality being not-very-much-in-your-face, it slipped through (user) testing.  I’ll be the first to admit we need more unit tests 😉

The solution is dead-simple:

foreach (string keyword in keywords)
{
   var keyw = keyword;
   ToolStripMenuItem keywordTsmi = new ToolStripMenuItem(text: keyw, image: null,
      onClick: (sender, e) => Clipboard.SetText(keyw));
   keywordsTsmi.DropDownItems.Add(keywordTsmi);
}

By assigning the value to a local-scope variable, the compiler will save a separate reference for each keyword, instead of only one that gets modified with each loop (hence the ReSharper warning).  Because the latter is simply the standard behaviour when you use a delegate with a variable like that.


Leave a comment

Suppress Compiler Warnings in Visual Studio

Just a quick post to put this out there.  Chances are you already know of this, but I can imagine far from everybody does.

 

When building a project or solution, Visual Studio will report on what’s happening in the Output window.  (By the way, you can control the verbosity of said window in the Tools – Options… – Projects and Solutions – Build and Run screen.  And the first thing I do on a new system configuration, is enable the ‘Show Output window when build starts’ option in the screen before that.)  It will print informational lines of text, but also, and more importantly, warnings and errors while compiling.

Obviously, your attention should be focused on the errors, as they will likely prevent you from running your application.  Call it neurotical behaviour, but I always aim to have an as clear Output window as I can, so the warnings receive equal attention from me (although not as diligently of course).

But sometimes warnings will keep being generated by Visual Studio, even though you intentionally wrote the code the way you did.  An example can be fields that are declared and assigned, but only used in a

#if (!DEBUG)

statement, like a bunch of license key registrations meant for production.

 

 

To keep the warnings from always popping up in the Output window when building, use the #pragma preprocessor directive.

#pragma warning disable 414, 3021

You can get the warning numbers by building  your code. If you can’t or won’t, you can also wrap the code in question in a

#pragma warning disable

and

#pragma warning restore

‘block’. This will disable all warnings in between, so use with caution !

 

PS: VSCommands by Squared Infinity is a great extension for VS that will color-code the lines in the output window to increase readability.  You can even define your own custom formatting.


7 Comments

Switching webmail from Google’s Gmail to Microsoft’s Outlook.com

Update:

Over at the Microsoft blog was announced a new tool that makes all of the above obsolete.  You can now make use of this built-in Outlook.com feature to import all your e-mail, contacts, folder structure and read/unread mail status.  Easy peasy !

outlook_cover_640x360

As the (probably) final post in the series about switching online services from Google to Microsoft, this post describes what for many will be the most difficult migration / switch-over.  It sure was for me, as I have a very big e-mail archive that is meticulously organised with labels.

But I now had switched over my other services, so consistency demanded I did the same for my webmail.  Besides, I truly loved the minimal, modern UI of Outlook.com so much, I was even prepared to take some of the cons with it.

Personal cons of Outlook.com:

  • Message filtering.  It is by far one of my biggest gripes with MS’s webmail.  It’s just too limited, as you cannot specify multiple filters per filter field.  In Gmail, you can put ‘OR’ between e-mail addresses to filter a whole list of senders for example.  Also, you are unable to assign more than one action to a filter, like applying a category (which is Gmail’s label, btw) AND moving the message to a different folder.
  • Advanced searching.  There’s no search criterium available to search within categories.  Since I don’t organise on folders, but on categories (allowing to tag a message more than once, instead of making a copy), this annoys me a lot.

Well, that’s it really, for me 🙂  Nothing that can’t be fixed in a humble update.
YMMV (Your Mileage May Vary).

So how would you go about switching webmail accounts ?

To begin with, or even if you just want to try out Outlook.com, without giving up any part of Gmail, you can configure Gmail to forward any incoming message to your new Outlook.com account.  There’s an option to keep forwarded messages, which effectively gives you a mirrored inbox; one on Google’s interpretation of webmail, one on Microsoft’s vision.  This is an excellent way to compare the two services side-by-side, should you be in doubt.  As a word of advice, it might be a good idea to run this forwarded mode for a couple of days or weeks, in order for you to really get to grips with the new webmail interface.  It will take time to notice certain stuff (like message filtering, contact integration, etc.).  Another bonus is that you now have a free backup of any new e-mail 🙂

forwarding

Next, the big move.  I assume you want to migrate your old e-mail messages, and rightly so.  There is more than one way to accomplish this, or at least, there used to be.  You might have heard of a service called TrueSwitch, which promises to move all of your e-mails, contacts and agenda entries from Gmail to Outlook.com.  I actually used this, because it provided the only way to retain any labelling: it created a folder for each label, so I could then place all messages in a folder under a category, and next archive those messages in a big ‘Archive’ folder.  Only drawback was that it apparently took only the first label (alphabetically?).  Oh, and it had troubles with foreign characters, like ‘è’.

But that option is now gone since a couple of weeks, as the service has shut down.

That leaves you with the other option: manual import/export.  It’s not as bad as it sounds, though, and as you will find loads of tutorials online for this, I won’t go into details.  The bottom line is: for the moment, Outlook.com does not support the IMAP protocol, so you can’t use just any desktop e-mail client (like Thunderbird) to set this up.  The best option is to use the Outlook desktop software which does support EAS (Exchange Active Sync).  There, you configure both your Gmail (using IMAP) and your Outlook.com (using EAS) inboxes.  Sync them completely (remember to check all folders, also ‘sent’).  Once your e-mail is downloaded, you can simply drag & drop your Gmail messages in the desired Outlook folders, and the e-mail client will sync everything on the go.  Once it’s done, you don’t have to use the client anymore if you don’t want to.

There is actually a third option, but that is only worth considering if either you don’t want to put in a lot of effort in the migration, or you only need a dump of your Gmail messages, without organisation.  Outlook.com, like the other webmail services, offers you the ability to download messages from another account via POP.  You could configure your Gmail account here, and Outlook.com would start downloading Gmail e-mails to your inbox.  Best is to set up a filter for these messages as to not flood your inbox (when I tried this, I let the downloaded messages land in a separate ‘@gmail’ folder).  Take note that this will take a very long time (possibly several weeks, depending on the size of your Gmail inbox), and you don’t really have any control or progress indication available, so the risk is there that you miss out on some messages.  Like I said, only an option if you don’t care that much about your e-mail archive.

pop

It’s clear that the biggest hurdle – at least for me it was – is the organisation of your messages, as Gmail uses the label system only (no folders).  You should think through how important this is for you with regards to finding ancient mail.  Keyword search obviously will still work, but I have noticed that Outlook.com uses a ‘wider’ search.  You will find more, but it’s also more difficult if your keywords are generic.  So it actually might go either way for you in deciding you need your historical Gmail labels.

Finally, if you decide you like what Microsoft has cooked up, you can either delete your Google account (which is very straightforward), or play on the safe side, and simply put it in sleep mode.  That is, don’t use it anymore, and activate a permanent auto-reply (aka OutOfOffice).  Make sure to check the option ‘send reply only to people in your address book’; you don’t want to acknowledge spambots of your valid e-mail address.  This way, you inform your contacts that you now use an “[at] outlook.com” address, without having to send out a huge spam mail yourself.

OoO

I already talked about migrating your contacts, and for now I still use Google’s Calendar.  Microsoft’s Calendar just simply isn’t up to Google’s level at the moment, and together with personal limitations (sharing of my wife’s personal and work calendar), this prevents me from switching just yet.  However, I’m sure Microsoft will address this, and once they do I am able to wave goodbye to that as well, truly unifying my online services once more…

Read my other posts about my online services switch from Google to Microsoft:

Moving address book from Google Contacts to Microsoft People
Moving photo albums from Picasaweb / Google+ Photos to SkyDrive
Switching personal cloud service from Google Drive to SkyDrive
Moving file hosting service from Dropbox to SkyDrive
How Google is slowly losing me as a client to Microsoft
Switching search engines from Google to DuckDuckGo


6 Comments

Moving address book from Google Contacts to Microsoft People

Moving your Google contacts to Outlook.com promises to be one of the easiest aspects of the whole Google to Microsoft migration.  Because when you link your Google account in your (Microsoft account) settings, you get a very decent view on all your Google contacts.

There is a caveat in this,  however.  Like the majority of switching users, one of the first things I did in my new (old) Microsoft account, was link my Google account.  This would ‘sync’ my contacts and calendar automatically, and without error might I add. BUT this also means you no longer have the option to physically import Google contacts, which in turn means that you must keep your Google account alive and kicking.  Furthermore, you won’t be able to edit/delete contact details unless you create an Outlook version for the contact in question (this part is handled very well in the People UI, fortunately).  This latter fact is logical because there is no 2-way synchronization between the two, but it is annoying that you can’t remove a contact that was ‘linked in’ by Google.  Some users report that even after deleting the contact over at Google, the contact still remains in your address book…

I created an Outlook version of most, if not all, of my combined contacts (beautifully merged from Google, Facebook, LinkedIn, Skype and Twitter), thinking that Outlook would sync the information on first creation.  This apparently happens partially, from what I can tell.  It would take over someone’s personal e-mail address, for example, but not his/hers work e-mail.  So very inconsistent behaviour here, making it impossible to determine what information I have at Outlook, and what information will be removed once I cut the Google link…

An option would be to temporarily remove your Google account link, and then manually import Google’s CSV file of contacts.  Microsoft’s People has a good merging tool, so any duplicates won’t be much work to resolve.  Still, I feel like ‘People’ could use a lot more polishing.  E.g. there is no way you can manually choose a contact’s picture, it will always be the picture of the (most popular?) social network you have linked.
As a matter of test, I imported three contacts from a Google CSV file (formatted for Outlook).  Two contacts were imported as expected, and merged perfectly, but the last contact was screwed up, creating a duplicate, but with a scrambled name (containing part of the CSV record), making me fear to bluntly import all of my contacts, as the merge tool won’t be able to detect this kind of duplicate.

So if you, like me, should wish to sever the connection between the two contact management systems, there is a risk that you lose some (or all, depending on your manual additions) information.  This leads me to hang on to my Google Contacts list for now, although I do my updates in MS’s People application.

In hindsight, I recommend not to link your Google account when you switch, but first use the option to import Google contacts.
I can see myself trying the option I suggested rather soon though: temporarily decoupling my Google account, hopefully then getting the “Import Google contacts” option and import them through the People interface.

Btw: that’s another thing that’s unclear to me.  Decoupling your Google account; will it have a big impact ?  Does this decouple only Google contacts (unlikely) ?

In any case, I don’t like having two address books, so one will have to go.  I just wish Microsoft would provide an option to ‘reset’ your address book, and import Google contacts, also after you already linked you accounts.

Update: I know myself all too well, it seems 🙂  Even before publishing this post, I just had to know, so I have tried to just bluntly import Google Contacts’ CSV file into my already filled up address book of People.  As expected, I got all duplicates, but that’s for the merge tool to worry about.  I can now confirm that the imported Outlook contact does have all fields filled out that you had in the Google version of the contact (well, at least the important ones, not sure about the more exotic Google-specific fields like ‘Relationship’).  So after merging, you can be sure to have a complete contact, and if you so desire, you can delete (or archive, to be on the safe side) all of your Google contacts.

One word of caution though: make sure you go over the duplicates confirmation screen, as some contacts might be mistakenly proposed for merger.  Especially when you don’t have an e-mail address of a contact, and his/her name resembles another contact strongly.  Also a certain false positive: two different people using the same e-mail address.  This happens more than you want, but keep an eye out for them.  Luckily, they are very visible in the list, as you normally would have two boxes (the imported Google contact created as a new Outlook contact, and your existing Outlook contact), whereas the false positives will have three, so they stand out very cleary if you scroll through the list quickly.

 

Read my other posts about my online services switch from Google to Microsoft:

Moving webmail from Gmail to Outlook.com
Moving photo albums from Picasaweb / Google+ Photos to SkyDrive
Switching personal cloud service from Google Drive to SkyDrive
Moving file hosting service from Dropbox to SkyDrive
How Google is slowly losing me as a client to Microsoft
Switching search engines from Google to DuckDuckGo