The Linux Page

My JavaScript code does not get the correct widget size, why?

As I am developing a set of pages for a customer, I ran in an intersting problem: my JavaScript function could not properly define the sizes of a box.

That box is heavily tweaked with the CSS assigned to it, as well as all of its neighbors. So I thought that may have something to do with it.

What I hadn't realized so far is that the ready() function of jQuery() is called once the script that includes it is ready (as in loaded) and not once the document as a whole is ready (done loading, i.e. onload event.)

With that knowledge it was easy to understand that I was actually finding myself ...

RJ45 and crossover cable

Basics

I got a cross over CAT6 cable and somehow the computers on which I used it do not like it...

So I thought maybe it was not a valid crossover cable. After all, it would not be the first time I buy some hardware which is not exactly what it was advertised as being.

The following are a few pictures that give us the answer, though. You have to look for the colors of the wires in the RJ45. It's not very easy to see, but it is different enough (assuming you are not color blind... sorry if you are, you probably will have to test with a device or a battery and an LED or light bulb) ...

Setting tag attributes in a dynamic way in XSLT with XQuery

I wanted to dynamically manage the attributes of the HTML tag. As I'm working on the Snap! C++ system, I thought that should be done with the standard XSLT feature: <xsl:attribute-set name="...">. Unfortunately the the XQuery implementation does not currently support such, at all.

There is a way, though, to still make it work with a central template definition which can be used to decide what should be and what should not be added to the HTML tag.  Especially, in this way we can make use of one template that is a system defined template. This being said, if you use ...

Console color: dark blue on black unreadable

As I work in consoles every now and then, I run in that one problem:

Some text is written in Dark Blue over the Black background:

This is a good example of what I'm talking about.

And if you can read that text, wow! (without selecting it first.

So... how could you change the color of that blue to make it readable? There is a way by sending some escape command to the console:

echo -e "\\e]R\\e]PC6495ed"

That command changes the color of the blue to a light blue (somewhat "cyan", although not light cyan.)

The "\\e]R" part is to reset the colors to ...

Using non-default private key for Launchpad

As I was looking around for the way to specify the correct key for launchpad, I could not find it. Luckily the ssh process is running when it asks for the passphrase so I could see the URL used to access the launchpad server from Bazaar. It is:

bazaar.launchpad.net

The address is not visible by default because you use the lp: protocol instead of a full URI to access launchpad.

  Host bazaar.launchpad.net
    HostName bazaar.launchpad.net
    User <your launchpad username>
    PasswordAuthentication no
    HostbasedAuthentication no
    IdentitiesOnly yes
    IdentityFile ...

Classes in JavaScript (from complex objects to proper classes)

When creating objects (commonly called JavaScript classes) in your JavaScript code, you want to use the prototype. This is the only clean way of doing it. In JavaScript, you can create objects on the fly, but those are not considered safe.

Quick and Dirty

The quick way is to create an object directly. This works, but it has potential problems with used against a powerful optimized such as the Google Closure Compiler.

All the Quick and Dirty examples can make use of this in their myFunc examples. However, the closure compiler will warning about all of them because it doesn't know for ...

Large scale Linux console

As I am working on our Snap! C++ CMS, I created a set of virtual systems to test the compilation on "clean" system (yeah! my main computers has all sorts of things that I don't even know about...)

In those virtual system, I only install the basic server and then do a sudo apt-get install of anything else the server needs to get compiled. This includes libraries such as libmagic, boost, and Qt and some tools like xmllint. This is pretty cool, but when working in a console, and that console is very small, it makes it a bit difficult, so I looked into making it big.

For this ...

Readonly content cannot be changed. Libreoffice preventing edits...

Today I opened a document where I had to make a few edits and LibreOffice decided to tell me:

Readonly content cannot be changed.
No modifications will be accepted.

There is a screenshot of that message:

Error message: Readonly content cannot be changed. No modifications will be accepted.

The error may be justified, I do not know, but apparently not too many people know how to unlock a document. I found pages and pages that tell people to check the read/write protection of the file, as if a read-only file on disk could not be updated in the editor... (yes! you cannot write it back, but you can edit it and do a Save As ...)

One person, though, had the correct answer to ...

My NVG 510 broadband light is blinking red

Somehow my NVG 510 broadband light started blinking red a couple of time in the last few days. I've been wondering why and I think I have the answer now.

In most cases it may just be that the broadband signal disappears for too long and the modem disconnects.

However, in my case, I think it was because they made an upgrade (a push!) on the modem because a few things do not work as expected anymore. (i.e. I cannot access the nsh shell anymore...)

Whenever software is upgraded, the likelyhood that you have to reset the whole thing is very high. I had to restart twice and even after that, ...

Remote access to another MS-Windows computer

I have used several different software to gain remote access to other's computers.

With a Unix system, it's easy. You use ssh and you can do everything you want (although some people just cannot handle a console, I'm fine with such, but ssh allows you to access X-Windows if you'd like with the -X command line option.)

With MS-Windows, since that system is just a desktop application, you need a special tool in order to achieve that feat. Most of them are for money or make use of things that do not work under Linux. Yet, there is one that I like, it is called TeamViewer. It was ...