.NET Dreaming

Just another programming blog

New Tool for Trial “NDepend”

So yesterday I got a surprise in my inbox when I found a message from one “Patrick Smacchia” who offered me a free professional license of his companies NDepend (http://www.ndepend.com/) product, which is a tool for developers, if I would be happy to post some comments on my blog about it.

Now, in case any of you out there are curious I’m not really a trained programmer. I’m self-taught meaning, I went out bought programming books and ask a lot of questions from others to understand what I’m trying to do. That said I would say this application is probably more than I really need but, hey! I’m willing to give it a shot and see what it does.

Ok, so I’ll give you some of my first impressions of the software.

Installation:

After receiving my licensing file and the link to the download everything went pretty smoothly. Now I was expecting a nice .msi or setup.exe file to be the way the product is delivered to my hard drive. However, that doesn’t seem to be the case. What I got was a zip file with all the application files that I could put pretty much anywhere I wanted on my computer. Naturally I put it in the Program Files folder of my computer. Now I normally would prefer to have an installer for applications like this. They usually help with the integration of the application into the windows system and also creates the shortcuts I like to use. This method doesn’t create short cuts so I’m forced to create the short cuts by hand. However, maybe this application can be ran from a USB stick which would make it more flexible. Anyway once the files were in place and I saved my license XML into the root directory I was ready to begin.

User Interface

The User Interface has a nice layout and looks like it should be a Visual Studio (I’m sure this is the look they were going for). On the start page there is a place where you can install VisualStudio and Reflector add-ons. Right now I’m not using a full version of Visual Studio but the express version so I can’t really do anything with that yet (coming soon hopefully). As well as informing you if you are using the most recent version of NDepend. It seems that this alert, which of course checks the internet for this information, uses the Internet Explorer’s proxy settings. Now I can understand why some applications do this but as I’m not a IE user I would like to see some independence in how the proxy is handled (sorry pet peeve of mine), at least it doesn’t handle proxies like Yahoo Messenger (ewww).

That’s all the time I’ve got for this right now. I still need to play with this tool some more as it does seem to be pretty complicated. I’ll be posting more things as I use it. I might remove the copy from this machine and use it on the Sharepoint development machine where I DO have a copy of Visual Studio 2008 running ;) and see how that works with some of my Sharepoint developments.

5Aug09 Posted by JRSofty | Projects, Tools | | No Comments Yet

Proper Deployment of Sharepoint Webpart?

So does anyone know how to do this? It seems there are about 500 people with tutorials on how to do it, and every tutorial is different. Microsoft doesn’t even clearly describe this.

Anyone?

No?

Fine, then I’m going to do this myself and then I’ll post here on how to DO IT RIGHT!

Just so you people know:

  • Simply dropping the DLL into the bin folder of the web application and clicking “new” under the webpart gallery DOES NOT WORK!
  • .webpart and .dwp files are not the same and are required for uploading to sharepoint.

24Mar09 Posted by JRSofty | Sharepoint/MOSS | | No Comments Yet

Sharepoint and the “Browseris is not defined” Browser Error

While building my default masterpage for my company’s sharepoint installation I started (as well as everyone else) an annoying little error displaying in IE (usually as a small yellow triangle down in the status bar of the browser). When you clicked it a message came up and said “Browseris is not defined” (or something to those words it was in German).

Now the funny thing is that everything displayed correctly only this little error that although not serious enough to cause problems with the rendering of the site was annoying me to no end. SO I started the big search about the “Browseris” error. I hit Google and apparently this has been going on since about 2004 and nobody really knows where it is coming from (at least if you read the posts on forums all over the place). So what did I do? I went straight to the source and made a post on the Sharepoint forums at Microsoft (by the way if you didn’t know this is a great place to find information). We tested the problem on IE6, IE7, and IE8 Beta. The results were that the error showed up in both IE6 and 7, but IE 8 never showed the error. We are not sure as to why, however, since we mostly target for < IE 8 in house as of now I needed to find a solution.

It was here I was informed on where to find the “Browseris” variable and function (yep the silly buggers used the same name twice one as “browseris” the other “Browseris”). It can be found in the INIT.JS file. This file can be found in the following location: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\{LANGUAGECODE}\.

Replace {LANGUAGECODE} with the correct number for the language you are working with. US English is 1033, German is 1031. You can find more information from Microsoft documentation.

Now the problem is that for some reason other Javascripts that call the Browseris function are called BEFORE init.js has been loaded by the browser. So how to fix this? Simply by adding a new script tag at the very top of your head tag in your masterpage. When you do this the Browseris goes away. Basically do as follows:


<head>
     <script language='javascript' type='javascript/text' src='~/_LAYOUTS/1031/init.js'></script>Sometitle
</head>

23Mar09 Posted by JRSofty | Errors, Fixes, Sharepoint/MOSS | | No Comments Yet

HttpWebRequest and Proxies.

One of the things I can’t stand about many applications that work over the internet is that they by default will use Internet Explorer’s proxy settings. Examples of this is Yahoo! Messenger. Even if you tell it to use “No Proxies” then it will use IE’s proxy settings. With the explosion of Twitter apps that need access this problem is there too. For example I’m using TweetDeck currently, and there is no place in the application for me to manually set the proxy settings. They only assume that I’m going to be using IE as my main browser and use whatever IE is set for.

So why is this a problem? Here’s my reasons:

  • I’ve got a company laptop, proxy settings are set by the company net’s group policies. When I travel or am at home the proxy is of course not in use. Since I use Firefox for most of my browsing needs I don’t care to change the proxy settings of IE.
  • Web products of any sort should have their own parameters for overriding defaults. Since I don’t use IE I would prefer that any web application that I’m using either let me choose for my self what proxy settings to use OR to pick them up from Firefox.
  • To change IE settings requires about 7 different clicks (just to access the properties and make the settings change). Changing them on Firefox is only two (one to launch the program and a second to change turn off the proxy). When I’m forced to use IE for a third web application that can get a bit annoying.

So in the process of building my own Twitter application (since TweetDeck is nice but not exactly what I want) I of course read some wonderful information on how to use the HttpWebRequest function and most importantly its Proxy property.

The Proxy property of the HttpWebRequest class uses a WebProxy class, now here’s the thing, if you do NOT set this property to null it will automatically assume that you wish to use IE’s proxy settings. You can find this information here: HttpWebRequest.Proxy Property. NOW here’s the tricky thing. In the linked article from MSDN library online it suggests that if you don’t want to use a proxy settings you should set the proxy property by calling the GlobalProxySelection.GetEmptyWebProxy however doing so in Visual Studio 2008 will generate the warning that the GlobalProxySelection class and GetEmptyWebProxy method are now DEPRECIATED. This is not stated anywhere on MSDN library online.

If you really want to use an empty web proxy you need to set it to null;

So how am I handling this in my application? Simply I’m putting the proxy parameters in the settings portion of the application. There I test if the settings are asking for No proxy, IE Proxy or Local Proxy settings. I then have a function that returns the specified WebProxy. Here’s an example of how I’m doing it:

private WebProxy GetProxySettings()
{
       WebProxy proxy = new WebProxy();
       if (Properties.Settings.Default.proxy_selection == 0)
       {
           // No proxy selected
           proxy = null;
       }
       else if (Properties.Settings.Default.proxy_selection == 2)
       {
           // Local Proxy Settings
           string prxyAddr = Properties.Settings.Default.Proxy_Address;
           string prxyPort = Properties.Settings.Default.Proxy_Port;
           string prxyUser = Properties.Settings.Default.Proxy_username;
           string prxyPass = Properties.Settings.Default.Proxy_password;
           if (!string.IsNullOrEmpty(prxyAddr) && !string.IsNullOrEmpty(prxyPort))
           {
               if (prxyAddr.Substring(0, 7).ToLower() != “http://”)
               {
                   prxyAddr = “http://” + prxyAddr;
               }
               string proxyAddress = prxyAddr + “:” + prxyPort;
               Uri proxyUri = new Uri(proxyAddress);
               proxy.Address = proxyUri;
               if (!string.IsNullOrEmpty(prxyUser))
               {
                   NetworkCredential proxyCred = new NetworkCredential(prxyUser, prxyPass);
                   proxy.Credentials = proxyCred;
               }
           }
           else
           {
               // If not filled out then we use No Proxy Settings
               proxy = null;
           }
       }
       else
       {
           // Otherwise we use IE’s proxy information
           proxy = (WebProxy) WebRequest.GetSystemWebProxy();
       }
       return proxy;
}

20Mar09 Posted by JRSofty | .NET 3.5, C Sharp, Internet and Web Applications | , | No Comments Yet

Challenge #1 Make a decent looking master page.

My first challenge for our company Sharepoint was to make a nice looking master page. Since we don’t want our company intranet to look like it belongs to Microsoft I needed to come up with something with our company logo and colors, and make sure it works with Sharepoint. So I started reading up on Masterpages. There is tons of information on masterpages on the internet, most of them say “modify one of the ones that comes with Sharepoint”. So I took my Sharepoint Designer and opened a Masterpage to see what it looked like. My first thought …. ick. The mixture of ASP tags and HTML was pretty hard to follow. While looking through the code I realized that the HTML markup was horrible. It was pretty old stuff with in-line styles as well as using tables for the layout. Now as a pretty much W3C standards nut case I decided “Nope I’m not going to work with that!” So I started looking into building a masterpage from scratch.

Thankfully I found some information on the Minimal Master Page. My first stop was MSDN online for their How To: Create a Minimal Master Page. The information was basically “Copy our example into your masterpage file and it should work”. After reading the comments however, I realized that there were plenty of errors in MSDN’s article which I was able to fix. What I should have done is visit Heather Solomon’s website. She has a wonderful ready to customize minimal master page available for download.

My original plan was to build a simple two column page. My problem is that I didn’t yet understand all the concepts for the navigation, in particular the so called “QuickLaunch” navigation on the left side of the site. So I made a very simple master page with only a banner area for the company logo, a small area for the topnav where I used the pretty much default Asp:Menu, and finally an area for the Main Content. Super, super simple but not exactly what I wanted. However until I better understood the navigation the rest of this challenge had to be put onto hold.

20Mar09 Posted by JRSofty | Sharepoint/MOSS | | No Comments Yet

Sharepoint 2007 My First Thoughts

It was decided by my company’s IT department that for a requested solution for team collaboration that we would use Sharepoint. I was tapped as the web developer, which for me opened a whole new area for me to study. Originally I have done work in PHP using MySQL backend for generating a few web based applications. Nothing fancy mind you but I’m pretty proud of them. Now I’m learning ASP.NET and Sharepoint 2007. Talk about two different worlds. So that I could get my mind into focus for this project I decided to layout some PROS and CONS for me and working with Microsoft’s web products.

PROS:

  • Sharepoint integrates easily into a house network that is already based on Microsoft Windows Servers. No need for LDAP or anything for authentication. It is all there already.
  • Workflows. Not that I know how to use them yet but they are there and I don’t have to program them from scratch.
  • ASP Tags which allow you to insert controls and such without mixing code with your HTML (at least in theory) as a standard part of the operation
  • Programing in .NET is not to hard with all the namespaces organizing the classes so nicely.

CONS:

  • Outdated and Depreciated HTML sometimes with in-line styling instead of using CSS.
  • Microsoft developers are lazy and do everything with tables inside of tables inside of tables ….
  • Masterpages aren’t really the master. Other sub pages can overwrite styling and information in the master pages making modification via css difficult at best.
  • Tutorials and Demos are lacking or are wrong. Much of the information found on the internet and in books doesn’t seem to actually work with a live Sharepoint environment. Even when it comes from Microsoft’s own SDK.
  • Too many tools needed to develop. When doing PHP I pretty much use one editor for all my needs and just upload it to a directory and launch it with a browser. To do much of this with Microsoft I have to use several tools.
  1. Visual Studio 2008 for development,
  2. Sharepoint Designer for the Masterpage and CSS editing,
  3. Commandline tools for deployment (at least three of them),
  4. browser based management for configuration and administration of the sharepoint
  5. browser based management for the individual web collections.

I’m sure that I’ll come up with more of both Pros and Cons later but that’s to get you started. Before you say anything, no I don’t think I’m coming down too hard on Microsoft’s products. It is just that I’m forced to try new things and of course it is easier to see the bad side of things than to see the good ones.

19Mar09 Posted by JRSofty | .net, Sharepoint/MOSS | | 5 Comments

Finally a Post!

Yeah I know I haven’t posted much on this project recently and I’m really sorry for those who are actually reading this, much to my surprise.

Anyway one of the main reasons I’ve not been busy with this project is that I’m currently working on an actual work project right now that is taking about 110% of my time.

My company has decided that they want to go with a Sharepoint/MOSS intranet installation and start running a lot of collaboration stuff there. Guess who got the job to implement all this? Yep, me, pretty much all by myself, with pretty much no idea on what I’m doing. SO I’ve immersed myself in learning about Sharepoint and most importantly how to develop for it. Since I’ll be doing a lot of .NET programming over the course of several months (or years?) I figured I could also document some of my trials and errors here, since this is actually a .NET blog and not just about my image management software.

By the way if any of you out there who are actually reading this blog (there can’t be that many), who do have some knowledge about Sharepoint and MOSS and would be willing to comment on some of the stuff I’m going to be posting up here, your free assistance will be most appreciated.

18Mar09 Posted by JRSofty | C Sharp, Projects, Sharepoint/MOSS | | No Comments Yet

Defining Metrics.

A key to Near-Duplicate Image Detection is the metrics used to define an image. This is turning out to be more complicated than I originally thought. However, I might have had a breakthrough after deciding to use the brightness attribute of the HSB color format as a way to define brighter points. Let me try to describe this a little better. Read more »

14Feb08 Posted by JRSofty | Commenting, Projects | , , , , | 3 Comments

Epiphany! HSB would work better than RGB for the algorithms … DUH!

Don’t you hate it when you are deep into a project and you kind of have an epiphany about how something should work? Well that is what happened to me today. I realized I’ve been going about this whole color format issue the wrong way. Some time ago (around the time I started this project) I read this article at CodeProject, however I didn’t really think any thing of it other than, “Hey that’s a pretty neat idea and something that I might need in the future”. Then I started working on ways to reduce the RGB to Single and Integer datatypes. Talk about stupid things to do. If you look at the HSB setup the values are 0 – 360 for H and 0 to 100% for both S and B. H which stands for Hue tells you what color it is (wow look a single number for color slap me with a wet fish), S is for saturation or how much of the color is present, and B is for Brightness with 0 being black and 100 being either white or what ever the saturation of the given Hue (boy to I have egg on my face). Not only does the article describe the differences of RGB and HSB but it also shows you how to convert from RGB to HSB (as well as some others but that’s more than I think I need right now). Now I’m going to re-look my code for the wavelet, and if I can’t really do that too well (I’m not sure if the return conversion from array of singles to image will actually work right) I’m going to at least use it for my metrics because I think it will make things much simpler to deal with.

11Feb08 Posted by JRSofty | Code Project Articles, Commenting, Mathematics | , , , | 6 Comments

Introducing “My Wavelet Class”

I’ve been promising to release some code on how I’m handling the Haar Wavelet transformation and doing the work needed for creating metrics for the Photo Manager Project, so here it comes. I’m going to make this a more type post so that people who don’t want to see a lot of source code can skip it ;)

I know it isn’t perfect and I know that I still have a lot to do with the code to make it usable (I’m missing the output for the Metrics) but once I’ve got that down the functionality should work. I’m defining my own class to store metrics right now. Once that is finished I’ll finish up this class to make it more user friendly :D

Read more »

30Jan08 Posted by JRSofty | .NET 2.0, C++, Commenting, Mathematics, Porting, Projects, Visual Basic | , , , , , | 1 Comment