Archive for March 30th, 2006

Linix Drivers / Modules

Linux refers to drivers sometimes as modules. Generally root permission is required to use any of these commands:

lsmod = lists all modules
rmmod = remove a module
modprob = add a module

drivers are located (usually)
/lib/modules

PCMCIA devices are controlled by the card manager
/etc/pcmcia.conf

Network Devices:

ifconfig = utility for network
iwconfig = utility for wireless network

ifconfig eth0 up = starts eth0
ifconfig eth0 down = shuts down eth0

Mandrake Linix 10 / Remote Desktop / Terminal Service / VNC

I spent quite a bit of time trying to figure out how to remotely control my Mandrake 10 box as I do other Windows servers using Remote Desktop. I found that VNC seems to be the primary method of doing this. Only after compiling and configuring VNC server, though, did I realize that Mandrake 10 comes with an alternate service pre-loaded. There is one catch that I’ve discovered, though, which makes installing VNC still separately somewhat desirable.

The default Mandrake 10 installation includes the following app:

Start -> Internet -> Remote Access -> Virtual Network Connection

Running this application basically opens a Wizard-type application that prompts you with three choices:

1. Control Another Linux Box
2. Allow this machine to be controlled
3. Windows Terminal Service Client

When you select an option, it will launch the appropriate application:

1. Launches TightVNC client
2. Launches rfbdrake – (which is a VNC server)
3. Launches rdesktop (a windows remote desktop client)

Selecting option 2 starts rfbdrake, which starts a VNC service, allowing you to connect to your Linux box using any VNC client ( downloadable from www.tightvnc.com ).

This is pretty handy, but there is one major drawback. That is, you must physically be at the box to launch KDE or GNOME in the first place, then launch rfbdrake. So, if you reboot or your machine goes down, or rfbdrake crashes, you can no longer control the server without physically being at the box. I find this somewhat ironic, seeing as how i don’t normally want to remote control my box if i have physical access to it!

If you compile and install the VNC server, however, you have another option. The VNC server is interesting in that you can first SSH or Telnet into the server, startup VNC server, then login using a VNC client. It also supports multiple, concurrent user sessions, whereas rfbdrake only shares your current session. So, if you need to reboot or the machine goes down, you can always terminal back in and restart the VNC server. The installation process is somewhat complicated if you’re not used to compiling software. You need root permission. Downloading the Linux version of VNC server from www.tightvnc.com and following the basic instructions will do the trick.

The drawback to this is that VNC runs on a really bizarre low-level of X-windows. So, the windows environment will be somewhat uncomfortable and unusual for most people. But, at least you can run GUI apps. When you first start VNC server at the command prompt, a .vnc directory will be automatically created in your home directory. In this directory a file called xstartup will be created. This controls your VNC session. You can append the following line to the end of this file to launch VNC GNOME windows manager:

exec gnome-session &

Of course you have to restart the VNC service to recognize these changes. Starting and closing the VNC service is done using a shell script that is included with the app called vncserver. The one thing to note is that each time you start VNC server, it will create a new instance. So, you can have many instances running on the same machine. When you start the VNC service, it will tell you the ID number of the instance. The VNC instances are specified when you connect from the client like so:

192.168.1.150:1 (instance 1)
192.168.1.150:2 (instance 2)
etc..

to terminate an instance, you use the vncserver script again like so:

vncserver kill :1 (kills instance 1)

I know this is quite a bit of information all in one post. I hope that it at least gives you some clue and/or sends you off in the right direction!

set php allow_call_time_pass_reference in .htaccess

I just spent about an hour trying to figure this out, but when you have a php application that requires call time pass reference to be enabled, you can set in the .htaccess file.  The trick on some systems is that it must be set to “1″ and not “on” as is indicated on the PHP support forums. here’s the code:

php_flag allow_call_time_pass_reference 1

Whether or not you need to use “1″ or “on” seems to depend on the install and whether you’re using PHP version 4 or 5.

Could not load type Foo from assembly NHibernate

This error indicates that the class could not be found when NHibernate is initializing. The key here is “from assembly NHibernate” The reason I was getting this error is because I didn’t realize that you have to specify not only the name of the class (including the namespace prefix), but also the assembly name after the class. I would have thought that NHibernate would have known the assembly name since I was giving it the full namespace, but apparently this is not the case.

For example:

[code:1:441355f572]
<class name="myassembly.model.Foo" table="foo">
[/code:1:441355f572]

This is not enough information. You must also specify the assembly name, or else NHibernate uses the default assembly name of "NHibernate" It should really look like this:

[code:1:441355f572]
<class name="myassembly.model.Foo,myassembly" table="foo">
[/code:1:441355f572]

myassembly would typically being the name of your .NET project. In this case, all objects are being organized in the namespace myassembly.model.

this also applies when mapping relationships:

[code:1:441355f572]
<many-to-one name="child" column="child_id" class="myassembly.model.Child" not-null="true"/>
[/code:1:441355f572]

should be:

[code:1:441355f572]
<many-to-one name="child" column="child_id" class="myassembly.model.Child, myassembly" not-null="true"/>
[/code:1:441355f572]

.NET controls don’t display formatting correctly in FireFox

If you’re writing .NET applications, when you test them in FireFox, they may look totally different than in IE. The first thing you probably notice is that input boxes are all the default width. Anything that you’ve resized in the designer doesn’t display in FireFox. If you use the Visual Studio designer to resize controls, when you look at the source, you’ll see that this is all done with the style attribute and not using width/height attributes.

The reason that this is happening it turns out is that .NET doesn’t recognize FireFox as a modern browser and is “dumbing down” the html output. It’s removing all the style attributes because it doesn’t know if FireFox can handle them.

Luckily, this is one of those problems that has a quick fix, as it turns out. All you have to do is tell .NET how to identify FireFox. In the old days of classic ASP, there was a file on the server called browscap.ini that contained all of this information. For .NET apps, there’s a couple of places to configure the info. machine.config has settings using for the entire server. If you don’t have access to this file, you can even put it in your web.config file just for your app.

Today is really your lucky day because Rob Eberhardt has already created the browser identification code and you can just copy/paste it. The code is found at his site [url]http://slingfive.com/pages/code/browserCaps/[/url]

Rob’s page explains it all but in brief, just download his BrowseCap code and copy/paste it in your web.config file just above the </system.web> tag.

Return top