Zaki Mirza’s Blog

Icon

… About software and beyond!

Visual Studio Add-in : Creating Context Menus

Note: I assume basic knowledge of what Visual Studio Add-ins are and how to create a sample add-in and tweak it.

There are several articles around the internet that will get you up and started with creating a visual studio add-in (sorry to say, most of them are just rip-offs of the stock-msdn-walk-through on how to create a visual studio add-in from the extensibility wizard). I present here my findings (the hard way, due to lack of proper documentation of these things).

So you have decided to create a visual studio add-in and know what you want to add where. Let’s take the simplified form of what I created and while we do this, we will come across issues that you might not find answer of elsewhere (at least I couldn’t).

Most add-ins require a Menu Items to be added in the main toolbar. Now I’m not going to tell you about how to do that since there are several articles on that already (heck even the walk-through that comes with MSDN tells you how to do that). I’m going to tell you how to add a button anywhere in the visual studio environment (say, on a context menu).

Read the rest of this entry »

Advertisements

Filed under: programming, Troubleshooter, visual studio, , , , , ,

ASP.Net Misconfiguration Solution

Many time when creating ASP.Net Application or ASP.Net  XML Web services people get into error reports e.g. Server Application Error, Authentication error in web.config file and more. I can’t really list all the errors that lie under this solution, but most problems are rooted from this very issue. (Im not really a professional solution provider or a troubleshooter, this post happens to come from my own experience. )

The issue is about multiple versions of ASP.Net installed on you machine. For example, you were working with Visual Studio 2003 and then switched to Visual studio 2005 or vice verse. You installed .Net platform 2.0 and even 3.0. Asp.net, usually, is left unconfigured during this configuration and if your very unfortunate, get misconfigured. One of the major root of this problem is, when people install IIS after they install the .Net Framework, or uninstall and reinstall it. If you are having problems with ASP.Net configurations, try the following method.

To solve this problem, following the following simple steps:

navigate to you Windows installation folder. Ill assume its C:\Windows\

navigate to Microsoft.Net\Framework\[version] (depending on which version of asp.net you want with IIS.)

You will see that there are many utilities in that folder. (in my case, it is C:\Windows\Microsoft.NET\Framework\v2.0.50727). The utility that we require is aspnet_iisreg.exe. (for a more technical introduction to this utility, click here). This utility reconfigures this version of asp.net for IIS. This utility requires command line arguments. Here’s what microsoft has to say about it:

When multiple versions of ASP.NET are installed on a computer, ASP.NET is said to be running side-by-side. In this setup, Internet Information Services (IIS) needs to know which version of the ASP.NET ISAPI (aspnet_isapi.dll) should process a page in an ASP.NET application. The ASP.NET ISAPI version that is associated with an ASP.NET application determines which version of the CLR is used for the application. An ASP.NET application is associated with an ASP.NET ISAPI version using a script map in IIS. To simplify the configuration process for an ASP.NET application, each version of ASP.NET comes with a linked version of Aspnet_regiis.exe.

Goto start menu and click Run and type “cmd”. A terminal window should open. Drag this aspnet_iisreg.exe file onto the terminal window. The terminal window will now be showing this file’s name and a prompt after it. type -i after it. Basically we need to run the command “aspnet_regiis.exe -i”. This will reinstall this version of asp.net for iis. It will take some time to configure IIS.

If the above solution does not provide the adequate result, or creates any problems feel free to ask.

A very good online magazine to read for IT professionals is the microsoft TechNet. For more information about configuring asp.net versions for IIS refer to this article on TechNet. For more information about .Net Framework tools check this out.

I hope this helps some poor souls out there who are too exhausted having to post on forums and searching on google.

Filed under: .net, Troubleshooter, , , , , , , ,

Mounting Windows shared folders in Fedora 6 under vmware

I was lately asked by some taking the Operating systems course for mounting/accessing windows shared folders inside linux installation under vmware virtual machine so here it is. (btw, if you are new to this check out the links i have put in this post for further reference)

Note: this is not a linux/windows security related post. Infact this post might create some security hazards in your enviornment. I do not take the responsibility for any kind of demage since putting security considerations in this problem is out of scope. I expect that these steps are applied in isolated enviornment(no-internet, or atleast firewalled internet). Sharing folders under windows may create security issues.

My Enviornment:

Windows XP sp2.
VMWare version 5.5.1 with vmware tools installed.
Fedora Core 6 Linux (default settings for installation)
Virtual Machine Custom settings (LSI Logic SCSI Harddrive. BusLogic SCSI is not detected by Fedora 6 during installation. either switch it IDE when asked between IDE and SCSI or to LSI Logic SCSI. this is set when creating a new virtual machine. instead of selecting “typical” option, select “custom” option and when asked about SCSI type click in LSI logic SCSI)

I am assuming that you will have the above enviornment or close to it. I also assume that you have not tempered with VMware settings since you installed it. because basically you get two virtual network connections when you install vmware. (to verify, go to control panel>network connections. Vmnet01 and VMnet08 will be connected and firewalled.) VMnet8 is the one we are going to use because it utilizes NAT which you can eventually use to expose linux installation inside your virtual machine to the internet connection in windows XP. To do additional tweaks or settings, vmware provides your with a virtual network editor tool (inside vmware software , edit>virtual network settings) where you can modify DHCP, NAT and other settings. do not temper with them if you have no idea what they mean.

Now on to settings up a shared folder inside windows. Create a folder on you desktop and call it anything (lets call it LINUXSHARE for now). Right click on it and select properties. In the sharing properties, enable sharing for it and check “allow network users to change my files”. Go to control panel>network connections and right click on vmnet8 connection and click properties. enable “show icon in notification area when connected” and click ok. that will show the network’s icon in the notification area of your task bar. right click on it and select “status”. click on support tab and note the IP address alloted to you by the vmnet DHCP server. mine is 192.168.23.1. Yours will be similar as well. DHCP server will allocate IP address to all network connections in this virtual network.

Fire up vmware, and on the home page of your linux installation before starting the virtual machine double click on ethernet icon. In the network connection option, select the “custom” radio button and select vmnet8(NAT) from it. This is the same network that our windows XP is connected to and which is being controllled by the DHCP server.

Start the virtual machine. Login to linux. Hopefully the ethernet card will be detected by your linux distribution and will connect it too. easiest way to connect to the LINUXSHARE folder now in fedora 6 is, goto Places>Network servers. A file browser will open with “busy” icon on your mouse. Thats ok. We’re not dealing with that. Click on File>Connect To Server in that window. A dialog box will apear. in “Service type” select “windows share”. (see picture below)

windows share mounting

Click Connect. If you are lucky, this will take you to your windows shared folder and create a mount point on you desktop as well which will retain between bootups (cool ainnit?:) now you can use this folder in windows and linux both to transfer files.

Another way to do this is by using “mount” (mounting) command under root access. to do that, fireup the terminal. (assuming you have the root access, if not run the “su” command and supply the root password. you will get access of root, if you do not have it, contact your network admin but since we’re installing under vmware i hope you* are the admin). in the terminal type the command

mkdir Desktop/linuxshare
mount -t cifs //192.168.23.1/LINUXSHARE Desktop/linuxshare

Edit:
comment by Bogdan:
Thanks, mounted xp’s shared folder from Topologilinux (cool thing, you may want to try it out). However, for slackware-based Topologilinux the mount command is slightly different:

mount -t smbfs //192.168.23.1/LINUXSHARE Desktop/linuxshare

the only changed thing is from ‘cifs’ to ’smbfs’ filesystem type.

(the above command is case-sensitive. also, use the IP address alloted to your window’s side of the network. the command also requires root access). this command will mount your shared drive on the folder on desktop called linuxshare which is now accessible on both windows and linux. To automate this task on bootup (so that you dont have to run this command over and over again) search the internet for details about “/etc/fstab” file and how to use it to automount drives and network shared folders. The earlier method i mentioned using the GUI is lot more easier though and will not require you to repeat steps everytime you boot your linux distribution (atleast in fedora 6).

If you have any problems feel free to ask. I would highly recommend anyone who is doing operating system assignments in linux to install linux directly on your system and not through a virtual machine and get used to it. Since we’re born with windows we find linux very hard but infact that is really not the case. Heck you are CS students and you think a couple of commands are a pain :s. Here are some good tutorials on linux file system (one of the biggest set back for windows users when shifting to linux). Required is a good habit to learn by one’s ownself and have a sense to explore and conquer.  Linux is a stable, secure, robust and highly efficient operating system which is growing in market every minute. It is used by highend servers and is slowly but steadily moving towards desktops (though desktops was never its target audience. But hey im not gonna start that religious debate). Best of all, its opensource and free. It lets you surf the net securely. You can have all you chat sessions in linux. You can access all your office documents in linux. It is a very fertile programming learning enviornment. And it gives you a sense of satisfaction that you are not using a stolen property. and btw commands are not as bad as people think it is. once you start using them your productivity increases manyfolds. (yes, citations needed) 

ah i know im using windows too right now … im in a serious shifting process to linux enviornment. Just too stuck on some windows application development projects. Im also planning to shift to java for a while and linux development in general. Hope i get to do that soon. (this has nothing to do with microsoft btw. microsoft is also a great company with great minds. I need to scale out and explore more frontiers in computing. I need a more free enviornment. Linux is a huge market and is challenging. Thats what attracts me. Most of all, Ill use windows when i can afford it. )

Till then, happy exploring linux and happy coding. Feel free to drop in feedback or queries about this post so that i can add more scenerios and more people can get advantage of this post.

Filed under: linux, Troubleshooter, windows

Setting up SDL-OPENGL in Visual Studio

And this CG assignment’s been giving some people pain in the gut so i thought okay why not share this with others. hopefully they’ll learn from it. So here goes.

Well the problem lies in the fact that people cant setup SDL and OpenGL together in Visual Studio (6,7,8).

Here are the steps you can follow to make it all work:

Downloading and setting up SDL:

1. For the Easiest way to do this, (on your home PC) download the sdl libraries and headers from www.libsdl.org . extract the file (in my case its: SDL_devel-1.2.11-VC6.zip). hunt the folder where you installled the visual studio. Find the folder (VC98 on VC6… VC7 on .net 2003 and vc8 on .net 2005).

2. in the include folder, create a folder called “sdl” and copy the contents of the “sdl_devel-1.2.11/include” folder ( where you jus extracted the sdl headers). These will be many header files. in other words copy *.* from sdl_devel-1.2.11/include to vc6/include. 🙂

3. in the lib folder (of visual studio) copy *.lib of the “lib” folder in sdl_devel-1.2.11 folder.

4. copy the sdl.dll file in the sdl_devel-1.2.11/lib folder to your windows/system32 folder.
Creating The SDL-OPENGL Project:

1. fireup Visual Studio of your choice.

2. Create a new Windows 32 Console Application. Name it .. i_suck :p

3. Click finish. The visual studio will create a default cpp file with the main() function declared in it.

4. In VC6 goto Project>Settings, in VC7 and VC8 right click the project in the solution explorer and click properties.

5. Under Linker>Input option: include the following libraries:
opengl32.lib glu32.lib sdl.lib sdlmain.lib

6. (OPTIONAL STEP) in the Linker>System option (im not sure if this is in VC6, but it is in VC7. This step is optional. Only if you do not want to show the console window with the graphics window) Set the subsystem to windows (or add /SUBSYSTEM:WINDOWS to the commandline option in the linker). in the linker>advanced option, set the entry point to “mainCRTStartup” or add “/ENTRY:mainCRTStartup” to commandline option of linker.

7. In c/C++ > Code Generation option, set the Runtime Library option to MULTI-THREADED DEBUG DLL.

8. Click ok and the project is setup for opengl and sdl.

The Code:

1. In you code, include the following files:
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <sdl/sdl.h>

Note that the ordering of the file should be right. because gl.h file requires that windows.h be included beforehand.

2. build your code. it should be successful. if it isnt, reconsider the above steps.
The Coding Part:
Do it yourself :p. Read the SDL Documentation that came with the SDL libraries and headers. Its right there in the doc folder :p. And ah yes, it will be very comfy once you switch to Visual Studio .net 2003 (and even more to .net 2005, but .net 2003 is more stable. Thats from my experience and mishi and umar manzoor recommend that as well). I have tested these steps on .Net 2003. ( dunno about VC6, i left using it ages ago). Any problems you find drop in a comment. Yes i do take donations as well :p
 

Filed under: opengl, sdl, Troubleshooter, visual studio

Blog Stats

  • 104,467 landed here so far...
November 2017
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
27282930  

tweet

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

RSS Google Shared Items

  • An error has occurred; the feed is probably down. Try again later.

RSS Google Reader Starred Items

  • An error has occurred; the feed is probably down. Try again later.

Top Clicks

  • None