Google alerts
Last week I found a new cool application/service from Google. It’s called “Google Alerts” and it will simple let you save a normal search query for Google search and on a daily or weekly basis you will get an email containing any changes in the search result. The first alert I did put up was a simple search on the keyword “NAV” to get any news around Dynamics NAV sent directly to my inbox. I also found that this is a really good way to find new blogs and other people/companies interested in the same thing as you and of course general news about the product. Give it a try at http://www.google.com/alerts and newer miss any news in your area of interest.
Installing NAV 2009 R2 without Active Directory
Normally you need to have an Active directory server running to use multi-tier of NAV 2009 R2. But in some cases this is not possible or existing. In NAV 2009 R2 we got an new configuration option called ClientCredentialType that is meant to be used over WAN. But I will in this blog post show one simple way to get this up and running for development and test purpose, in a LAN environment Read more
How to install more than one Dynamics NAV 2009 Demo Database alternative 2
Earlier I did describe how to duplicate an installed and existing database in post “How to install more than one Dynamics NAV 2009 Demo Database”. This time I will attached the DB directly from DVD.
The steps is as follow
1. Create the directory where you would like to have the new database.
2. Copy the database from DVDSQLDemoDatabasePFilesMicrosoft Dynamics NAV60Database Demo Database NAV (6-0)_Data.mdf to the new directory.
3. Run the following command in SQL manager studio and replace the @physname path with the new created on and set @dbname to the database name you would like to use.
sp_attach_single_file_db @dbname= ‘new_Demo Database NAV (6-0)’, @physname= ‘C:Program Files (x86)Microsoft Dynamics NAV60Database – CopyDemo Database NAV (6-0)_Data.mdf’
You need to ensure that the SQL server user have correct permissions to ‘C:Program Files (x86)Microsoft Dynamics NAV60Database – Copy’ or where you put the db files. I’m using ‘NETWORK SERVICE” as the SQL server user account, the NAV will use this account by default when doing demo installation.
To set permission
1. Open properties for the directory.
2. Click security tab
3. Click advance
4. Click edit
5. If the SQL server user is not present press add and pick the user else select the SQL server user and click edit
6. Change the permission so that the following permission is checked
a. Read attributes
b. Read extended attributes
c. Create files / write data
d. Create folders / append data
e. Write attributes
f. Write extended attributes
g. Delete subfolders and files
h. Delete
7. Click OK
8. Click Ok
9. Click OK
10. Click OK
Strong name versus certificate signing
When I have been looking around on the net about strong naming and signing I have found some confusion about the purpose and the difference between does two methods.
Strong naming
Strong names make names cryptographically strong. When you load banan.dll by its strong name you are saying “load banan.DLL which was signed by XCompany”. The loader verifies that the named dll was signed with the correct key, and if not the loader will refuse to load the dll. This is the only thing that strong naming does (making the name of a dll cryptographically strong). Strong names are not a mechanism for expressing trust decisions. Strong names are just about making a name stronger so that you have a guarantee that the code you are loading at runtime is the code you compiled against. That is the ONLY thing you can safely use a strong name for. Strong name keys go into a “snk” file, which you then typically include with your project.
Certificates signing
Certificates signing are completely different. Certificates form a chain of trust, where a trusted root certificate (Verisign, for example) is installed in every user’s root certificate store. Those trusted root certificates are then used to certify the identities of organizations that issue code signing certificates. This enables the customer to setup trust policies. For example, they can say “I want to trust anything that comes from XCompany”. How will they do that? They first check to see if the dll was signed by an XCompany certificate. But how do they know that the XCompany certificate actually came from XCompany? Because Verisign says so – Verisign signed the XCompany certificate saying “we certify that this dll signing certificate actually came from XCompany”. Why do they trust Verisign? Because Verisign is part of the Microsoft root certificate program. Acceptance into this program means Microsoft trusts these certificate authorities and places their root certificate in the Trusted Root store on Windows machines. That’s the root of the chain of trust. Certificates doesn’t go into strong name key files, they go into the operating system’s certificate store.
Microsoft .NET Framework – Windows-Based Client Development
After 1 month of preparation and a weekend that disappeared I have passed my second MCTS exam. I did use the “MCTS Self-Paced Training Kit (Exam 70-526): Microsoft® .NET Framework 2.0 Windows®-Based Client Development” book for my preparation and Measureup’s online test questions. I did also try ActualTest.com’s question that I did borrow from a friend. I found that the questions many times were almost exactly the same (Found some question with exactly the same options). So I can’t recommend ActualTests.com. Measureup did cover all the areas good except the custom control integration to VS design toolbox and properties dialog. Many questions on the real exam were about this functionality that I had not read about in the book or had any questions about in the practice online tests. So for that area I would recommend to read MSDN.
My study strategy was more or less as last MCTS exam. I did read 1 chapter in the book per day/ every second day (15 chapters in total). I also did plan to do the labs in the book but I never got the time for it. Instead I did concentrate on the lesson and chapter review questions plus the summary in the end of every part of the book. The last weekend that totally disappeared from my life, I did go through all lessons and chapter reviews plus summaries. I also did use the Measureup’s web site very heavily. Went through all 150 questions and read all explanations to all questions (this gave me the most). Another good part with the web questions is that it contain link to relevant MSDN sites for more information.
Measureup
MCTS Self-Paced Training Kit (Exam 70-526): Microsoft® .NET Framework 2.0 Windows®-Based Client Development book
.NET Framework 3.5 SP1 source code
Have you ever wondered how Microsoft does thing inside .NET? Now it’s possible to see the source code by configuring Microsoft reference source server inside visual studio. Just go to ‘Serversetup’ and setup you visual studio 2008 to use symbol files from Microsoft symbol server when you debugging. You can also download the symbol files and use them offline by follow this guide ‘Downloadsetup’.
The symbol files are available for this dll’s in .NET 3.5 SP1.
• mscorlib.dll
• Microsoft.Visualbasic.dll
• system.dll
• System.ComponentModel.DataAnnotations.dll
• system.data.dll
• system.drawing.dll
• System.Web.Abstractions.dll
• system.web.dll
• system.web.extensions.dll
• System.Web.Extensions.Design.dll
• System.Web.DynamicData.dll
• System.Web.DynamicData.Design.dll
• System.Web.Routing.dll
• system.windows.forms.dll
• system.xml.dll
New hotkeys in Windows 7
In Windows 7 Microsoft have added some additional hotkey compared with Vista. This a small list of the new keys.
General
Win+Up | Maximize |
Win+Down | Restore / Minimize |
Win+Left | Snap to left |
Win+Right | Snap to right |
Win+Shift+Left | Jump to left monitor |
Win+Shift+Right | Jump to right monitor |
Win+Home | Minimize / Restore all other windows |
Win+T | Focus the first taskbar entry Pressing again will cycle through them, you can can arrow around. Win+Shift+T cycles backwards. |
Win+Space | Peek at the desktop |
Win+G | Bring gadgets to the top of the Z-order |
Win+P | External display options (mirror, extend desktop, etc) |
Win+X | Mobility Center (same as Vista, but still handy!) |
Win+# (# = a number key) |
Launches a new instance of the application in the Nth slot on the taskbar. Example: Win+1 launches first pinned app, Win+2 launches second, etc. |
Win + + Win + – (plus or minus key) |
Zoom in or out. |
Fun with UIAutomation and calc 2 (event handling)
Last week, I wrote about UIAutomation and calc. Now it’s time to revisit or little example program and replace the automatic start of calc and replace it a method that will wait for any calc to start and take control over that session. To abstract away the waiting code, I did create a new class called WindowOpenWaiter. Let’s take a look how we can use or new class. The full code to this blog can be found in the bottom.
The first thing we need to-do is to create a new instance of WindowOpenWaiter and give the title to the window that it should look for. Next thing is to call the wait methods with a timeout time in mille seconds so that we will not wait forever. The last thing we do is to get the element that the waiter has found for us and save it in some variable.
AutomationElement calc = null; using (WindowOpenWaiter waiter = new WindowOpenWaiter("Calculator")) { try { waiter.Wait(1000 * 10); } catch (TimeoutException e) { Console.WriteLine(e.Message); return; } calc = waiter.Element; } |
Zipping files in C#
For a while ago I tried to create zip files to be used by windows built in zip functionality. Did try to use GZipStream but I found out that I needed a GZip expander installed to be able to use it. I don’t understand why we have an inbuilt function in VS to create a compressed format that Windows can’t open natively. Anyway after a lot of search I found DotNetZip. It has a really easy to use API and no dependencies to other DLL’s.
It supports the following scenarios
-creating a zip archive, adding files or directories into the archive
-extracting files from an existing archive
-modifying an existing archive – removing entries from an archive or adding new entries to an archive
-password protecting entries in the archive
-getting entry input from a file or a stream
-reading a zip file from a file or a stream
-extracting an entry into a file or a stream
Example Usage
try { using (ZipFile zip = new ZipFile("MyZipFile.zip") { zip.AddFile("c:\photos\personal\7440-N49th.png"); zip.AddFile("c:\Desktop\2005_Annual_Report.pdf"); zip.AddFile("ReadMe.txt"); zip.Save(); } } catch (System.Exception ex1) { System.Console.Error.WriteLine("exception: " + ex1); } |
How to delete a element in an array
This problem sounds where simple, but it did take me a lot of effort to figure out that PHP doesn’t have any really good functionallity for it. So did create my own version.
<?php function in_array_delete($array, $item) { if (isset($array[$item])) { unset($array[$item]); } return array_merge($array); } ?> |