Archive for the ‘Linux’ Category

ecofont in LaTeX

Dimanche, mars 7th, 2010

Introduction

ecofont is a TrueType font developed by the netherlandees (more specificly by Spranq). Its aim’s to reduce the ink usage when documents are printed while maintaining the same readibility as the original font. After trying several concepts, they “deduced” that putting little holes inside the fonts does the trick. Now we’ve got a ttf file, which can be used considerably easily in some OS-es and maybe in OpenOffice, but gives a headache under LaTeX.

LaTeX and ttf

The main problem with tutorials on how to put the ecofont (or a ttf font) in LaTeX is, that they all begin with

ttf2afm -o ecofont.afm ecofont.ttf

and  this gives a segmentation fault. When debbugging the code (and I did that) you discover, that the problem is in the format. ecofont references some table, which it does not contain and this gives ttf2afm a deadly stab.

fontforge

I understand people’s passion to develop fonts. But after a short while, you discover two things:

  1. That drawing the 26 letters of the english alphabet is not enough
  2. if you only redraw some letters, than your font will be inconsistent and inevitably ugly.

Maybe that’s why, when you run up fontforge (which appears to be an excellent font editor), you have a nostalgic feeling of DOS times. I ever wondered how difficult would it be to update the gui to qt? Anyhow, in the matters of engine, there is no missing feature, so you can export the ecofont.ttf to PostScript type 1 including all the neccessary complement files. In the end you create two more files:

 t1ecofont.fd

\ProvidesFile{t1ecofont.fd}[ecofont]
\DeclareFontFamily{T1}{ecofont}{}
\DeclareFontShape{T1}{ecofont}{m}{n}{ <-> ecofont }{}

ttfonts.map

ecofont ecofont.ttf Encoding=ecofont.enc

and you’re done. My solution is here, so if you just want to use ecofont in LaTeX, download it and look at the example.

Caution

I am not convinced about the environment-friendliness of ecofont. Depending on where you read it they claim about 15-20% of ink save. The idea behind the design is, that if you have smaller surface, you save ink. Do you have smaller surface? It depends compared to what. If you compare ecofont to itself you may have this ratio, but if you compare it to the LaTeX standard cms font, you inevitably notice, that ecofont is considerably thicker. Also the default 10pt size, which is set up in LaTeX is considerably bigger (this is a subjective notice). Now I set the ecofont to 8pt in the example. At this size, the letters seem to be the same size az the standats LaTeX font (though the cms still seems a little more thin at some placeses). Furthermore, you have the pixel thin sans sherif fonts (fonts without a practical thickness), but these may be bigger to achieve the same redibility.

Conclusion

You can use ecofont in LaTeX, and it’s quite easy, once you have the necessary files generated. To determine the objective truth, wheather it’s worth it to use ecofont, the letter surface should be calculated, but this is beyond my interest in the matter.

External Links:

ecofont

ecofont on wikipedia

fontforge

VirtualBox OSE - with rdp server or without?

Mercredi, mars 3rd, 2010

VirtualBox is an incredibly useful virtualization tool. Here are the possible uses of virtualization that may interest you:

  • You’re company and you have to use some old software with no recent os compatibility (for example old DOS accounting software)
  • You want to set up several web-servers on the same machine and you want to give the administrators unlimited access over their own server but no access to the others.
  • You’re a teacher who teaches linux programming and you want your students to practice at home, but they don’t have linux on their machines.
  • You’re an os-geek, who wants to try out tons of OS-es, but don’t want to reinstall everything
  • You’re favorite os does not support you’re new hardware
  • You just want to have fun with virtual machines.

As you are looking at the feature list of VirtualBox you can see, that most of it is free software, but there are two features particularly useful for corporate users, which are binary-only. These are the RDP support and the USB support. In this essay I am going to talk about the built-in RDP server and the possible improvements and workarounds.

RDP-in-depth

First of all I want to waste a few words on what is RDP. Well with the advancement of local network and Internet,  more and more computers are accessible from distance. The classical very fledged method of accessing them is SSH. SSH, on the contrary of that some may believe, DOES support graphical access, but (by default)  it lacks the possibility of accessing the Desktop as you would see it from the display next to the iron. Also somewhat out of my consern, but SSH cannot access not unix-like os-s. To overcome these limitation RDP protocol has been designed, to allow remote graphical access to your computer. It is well supported on regular unixes and other os-es as well. The model is simple, you give your username, password and you get the same screen as you would have sitting in the computer room.

What has RDP to do with VirtualBox?

A regular home enthusiast may have some problem with understanding, what is the interest in RDP for VirtualBox. To see this you have to imagine a 16-core machine with lots of capacity. These machines even nowadays are to be used by many people. These people sometimes need regular os-es to do they work. The reason for this lies in the much hate-able  binary-only software. Imagine, that ten years ago your company bought an accounting software or a stacking software. It has been working for ten years and they’d put all their company history in it. They would like to keep that history, but that was a ten years old operating system which you can’t even install on a normal computer. What do you do? You virtualize. So you put together a virtual machine, and you install it on the server. To access this machine VirtualBox offers you an RDP connection. This means, you access it from home. This is convenient.

Slow internet? Nomachine can help.

One of the inconveniences of RDP is, that the compression it uses is bad. If you have a regular connection to you’re computer through one or two corporate proxy’s you might find it almost unusable. What can you do about that. The answer comes from the movie file formats. Now for more than a decade (since the uprise of the DVD-s) companies have put uncountable working hours in video compression.  If you realize that a distant screen is essentially a movie, the answer is right there. Most fortunately for us, there is a company specializing in remote access WITH lossy compression. They achieve higher compression rates and thus lower bandwidth need than traditional RDP … and they solution is also free.The software is called Nomachine.

Connecting Nomachine and VirtualBox - first approach

I will not give here a detailed tutorial, because there are lots of tutorials on the Internet of how to configure a virtual machine with an RDP server on it. You needn’t look further than the VBox manual. Once you’ve finished the configuration of both systems and you run up nomachine, here’s the line in the configuration file yo have to change

/usr/NX/etc/node.cfg

CommandStartKDE = “rdesktop localhost:1525″

Supposing of course, that you’ve configured the virtual machine on port 1525. If you connect now with Nomachine and set up the session with KDE, you’re going to access the virtual machine, instead of a new session. This screen will be nomachine-compressed thus much faster on slow connections. If you have a good network access it may still serve because nomachine’s much reliable authentication.

Connecting Nomachine and VirtualBox - the ultimate free software solution

You can say, OK this solution works, but hey if I use the rdp front-end I’m still stuck with the proprietary version of VirtualBox. You are right, but you can enhance this schema even further to only use the capabilites of VirtualBox OSE. You can transport any graphical interface with Nomachine, so you can in theory transport the

VBoxManage startvm ‘MyMachine’ –type sdl

command. The only inconvenience is, that the command quits as soon as the machine is started so you need to wrap it with a shell-script that you keep alive. The example is like this:

#! /bin/bash
# UjoImro, 2010
# starts the virtual machine and never quits so we can use it with nomachine.

VBoxManage startvm ‘MyMachine’ –type sdl

while [ 1==1 ]; do date; sleep 10; done

# LuM end of file

and you set up in the node.cfg:

CommandStartKDE = “/path/to/my/script.sh”

Thats it. A complete enhanced free VirtualBox with remote access capability. The only inconvenience of this method, that it needs an X system and the qt libraries installed on the server machine, thus having more dependencies than VBoxHeadless.

Further improvements - authentication

When you access the server, you are authenticated by nomachine. This is already a good start, but if you have many users, it might not be enough. In the script however you can access the username with the `whoami` command, and you can make further choices according to that. A deeper authentication is also possible, but there is no general schema, because it can depend very much on your particular needs.

Conclusion

VirtualBox is a great free software tool. As you can see from the above example the enhanced features are only for collecting some money from companies/professional users. This solution can be useful for those, who need better compression/lower bandwidth or for those, who insist on free software.

External links

All the above methods where tried on the following software.

Re: the Emacs Lock-In

Lundi, novembre 30th, 2009

Very recently I was reading one of the articles in wikipedia about software lock-in. I was a little surprised by how blog entries make into wikipedia as references. The article stated, that there was a software lock-in in emacs. Yes, I did not mistype it! They claim, emacs uses unusual shortcuts intentionally to make switch to other editors more difficult. As ridiculous as it may seem, I would like to react to the arguments in the referenced blog entry.

You can find the original article at the following address:  http://www.davids-world.com/archives/2006/05/free_and_propri.html

“Unfortunately, Emacs uses totally different key commands from what you’re used to. If you’re used to a Windows machine, you expect Control-C to copy and Control-V to paste.”

Except that in recent emacs-es you can actually select the text with the mouse and paste it with the middle button. It works as it would in any kde application. Also you can of course ask for the list of hot key-s

M-x describe-bindings

as well as you can (re)define any shortcut  for any function

Emacs has a closed user interface. Once you’ve learned the codes, you’ll stick with them because other editors use a different (standardized) interface. The same issue occurs if you are familiar with another text editor, say, BBEdit, TeXShop, TextPad, WinEdt, XCode, C++Builder. They all behave in very similar ways

I think, the author completely misunderstands the concept of free software. Tell me, if you would, all these software with the same functionality just what is the point in switching between them? What possible good could it bring? The answer is of course: Any. The point of the free software that you can use/adapt any tool that has already been written. You only switch if you need explicitly different model. And so you shouldn’t have to learn, configure and switch all the time between software, you can just add the functionality to the one you use for all the rest.

Software lock-in comes almost only from licenses and formats. If you have a software that uses windows API? You put it in a virtual machine, set up a virtual network (socket) and you connect it with anything. What is the problem there? No1: The license fee you don’t want to pay and you shouldn’t have to pay. Problen No2: The missing functionality you shouldn’t need to switch to a new API just because of one missing function. You should be able to add it. You can do both with emacs.

The most common misconception I ever meet? It is different, so its worse. People make it all the time. When they switch to linux they are looking for they shortcuts, programs even fonts. The strength of the linux kernel, the gnu userland and as matter of fact emacs is, that they follow a different model and every time for them you should switch for the model and not for the “free windows”. If you want free windows you have free editions from visual c++, you have openoffice you have firefox even kde for windows.

You have similar software designed for the same purpose but using a different model:

  • OpenOffice vs. LaTeX
  • OpenOffice vs. Scribus
  • nothing vs. Bash
  • C vs. C++
  • Python vs. Java

and the list could go on. These software are not replacement for each other and you couldn’t add a few features here and there to have equivalent functionality.

In conclusion I would like to tell this: If you think the middle way between emacs and other editors exists, try to design a new emacs on paper, and you may discover a few things:

  • as with the terminology, you have listed almost all the differences the other 500 built-in functions have no “common name”
  • as with the short cuts, if you change the ones you listed to windows-ish, the newcomers will not be able to use anything else (they won’t even know that they should look for some)
  • if you change the feeling of emacs to standard windows-ish editor like, than the other half of the users will dislike all the changes.

Emacs is not perfect, it’s far from it, but is you want to make it better you shouldn’t want to make it like other editors. Because it is for that other editors don’t/can’t do/won’t do that you have started to use emacs in the first place.

openSuSE, nvidia-settings can’t X server doesn’t appear to be running, also some applications are transparent and unusable

Mercredi, janvier 28th, 2009

The transparency thing comes from the official nvidia driver. It’s not cooperating with X. Now what I wanted was to have compiz, no-transparency and nvidia-settings at the same time. It is possible the following way:

on opensuse you must have the two packages installed:

nvidia-gfxG01-kmp-default-173.14.12

x11-video-nvidiaG01-173.14.12-0.3.x86_64.rpm

I’ve found theme here:

http://anorien.warwick.ac.uk/mirrors/opensuse/nvidia/download.nvidia.com/opensuse/

both packages are absolutely necessary, also their version must be synchronized. After the installation, you can run

SaX2 0=nvidia

and set up the correct resolution. The dual screens and other tricks are not treeted here.

then I’ve run nvidia-xconfig with:

nvidia-xconfig –no-allow-dfp-stereo –allow-glx-with-composite –composite –depth=24 -a –no-logo

or

nvidia-xconfig –add-argb-glx-visuals –allow-glx-with-composite –depth=24 -a –load-kernel-module –no-logo –multigpu=ON –no-sli –no-stereo –no-xinerama

to get composit among the options.

After you must set up in YaST -> Sysconfig -> … -> XServer -> xorg

it’s not XGL. But don’t worry if you set up right all the three things will function.

OpenSUSE ehci module (usb) suddenly shuts down 2

Mercredi, novembre 12th, 2008

As I mentioned in one of my previous posts there was a very annoying bug in OpenSUSE (and possible in other distributions too). When I started to use an usb hard-disk or flash media, after a while the usb subsystem shut off. As it turned out after (when I’ve got a ps/2 keyboard) restarting the usb system solves the problem, but only temporarily. After mounting the usb storage(s) and starting copying, the error reappears. As it turns out, the cause of the problem were the usb hubs. I had them two. One was the keyboard itself (apple aluminium) and the second was a self powered belkin hub. Later if I will have time I will investigate further whether it was the keyboard, the hub or both. In the mean time the usb appears to be working.

OpenSUSE ehci module (usb) suddenly shuts down

Dimanche, octobre 12th, 2008

I have been experiencing one of the most annoying bugs on linux so far. Usually the only worse of not working is if something is working just slow. When I switched on the computer, the usb devices are stopped to work (every single time) after a while, then after about 3-5 minutes they have started to work again (!), only they were impossibly slow (FullSpeed, about 800k). As I had two usb harddisk attached, this has been unacceptable.

The cause of the problem was that I plugged an usb hub into an other one. However the primary hub was self powered (plugged) into electricity, the system got confused. The second hub, and this is important, was a keyboard with usb connectors. As a solution, I have plugged the keyboard into the computer instead of the hub.

Truecrypt container suddently turns read-only

Vendredi, septembre 19th, 2008

I have experienced a very inconvenient bug in TrueCrypt. The bug has been reported by several users at the TrueCrypt forum. After mounting a volume with TrueCrypt, when launching a (triggering) application the container suddenly becomes read-only. The effect repeats in 100% percent of cases and it remains happening at 5.0a and 6.0 whether you recompile the source or you use pre-compiled packages. The back-thirsted 4.3a version no longer appears to compile on the kernel.

The most irritating part of it is that for a long time the system functions correctly. I have a clue what may cause this and I am checking it out as I write this entry.  I think the filesystem has been contaminated (this happens frequently on reiserfs), and when the driver returns an error the Fuse or TrueCrypt (I am not sure which) closes the write acces to protect the drive. If my conjecture is correct, than after the

fsck.reiserfs –rebuild tree

This  bug will disappear. Even if this is a self-protection mechanism I still can’t understand why isn’t it reported in dmesg or in the truecrypt state log?

I use a via-epia en 1.5GHz, with OpenSUSE 11.0

update:

That was indeed the filesystem, which had to be checked. The driver probably returned an error and as  protection mechanism the container became read-only. Whether it makes sense? maybe. How to switch this protection of? I don’t know.

If you had the same error and filesystem check didn’t work, than please leave a comment.