Pages

Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Tuesday, June 22, 2010

Make ubuntu's screen play nice with nano shortcuts

I use nano a lot either for programming or editing configuration files on linux. At work we use both ubuntu servers for vmguests and vmhosts.

The main reason I use nano is because they have a preconfigured shortcut-key on your keyboard to save your current document: F3.

You will not catch me hitting esc,colon,w; escape to non-insert mode; :w to write from edits on memory to file in vim. Nor will I do whatever they do in emacs.

I'd rather gain mastery of the language, than mastery of an editor, with my limited time.

Since I have to do stuff simultaneously, I use screen a lot to switch between shells and tasks.

Anyways, in ubuntu the maintainers accidentally hijacked the F3  shortcut with a conflicting shortcut F3 in screen; So, what happened is this, I edit a file with nano, I attempt to save, it but find myself in another screen. You could imagine why that would piss me off. Context-switching craziness.


What you do next to fix the unintentional context-switching is to attack screen. Namely, the configuration files.


In ubuntu they put this in your home dir.

You want to find change your keybindings file.


find ~/ -name "keybindings"


When you crack the file open you'll find something like this:


source /usr/share/screen-profiles/keybindings/common


All I needed to do was to copy that common file up there to /home/user/.screen-profiles/user-common-keys and adapt keybindings to reflect the change.

All I wanted was to regain the ability to save my files with F3 function key. So I smote away this line from the file:


bindkey -k k3 prev ...


and change the keybindings file.


source /home/user/.screen-profiles/user-common-keys


Then they lived happily ever after.

Monday, May 24, 2010

Wine, winetricks and naughty fonts

When using wine and winetricks, winetrick might complain about samyak and oriya fonts; being naughty non-conformistic naughty fonts and so on.

Apparently, these are included in a bunch of linux distros.

In slackware 13.1 they are included in the package: "ttf-indic-fonts-0.4.7.4-noarch-...".

Just grep oriya in /var/log/packages/ if you don't believe me:

grep -nr oriya /var/log/packages ; xlsfonts 2>/dev/null | egrep -i "samyak|oriya"

Once you've blown the package away, you will find that winetricks will keep on complaining, about those fonts. This is due to "xlsfonts"; this binary is a part of Xorg to show all of your fonts. Run it, to see it for yourself.

I turned off this check in winetricks, by commenting off the code, but somehow the installation of .NET 1 to 3 kept crashing on me. Evidently that check is there for a good reason.

A quick google search reveals that xlsfonts reads its input from /etc/fonts. (edit: This is false. I still have no idea where xorg gets the idea samyak is on my system.)

I crafted a silly little sed command to try to remove it like this:

grep -nr riya . | sed 's@\(Lohit Oriya\)@<!--\1-->@'

Then I committed the changes to the files. Notice the parameter "-i".

sed -i 's@\(Lohit Oriya\)@<!--\1-->@' /etc/fonts/conf.avail/65-nonlatin.conf


Alas, that was a mistake. Since, samyak was found not oriya. Anyway, no harm done. Just uncommented some xml file. This can be easily undone, by firing up an editor and removing it by hand.

That'll teach me to want to use .NET instead of mono.

Argh. Dead end. How do I remove samyak from the system completely?!

Update 20-07-2010:  This is still broken in wine 1.2 with the winetricks from winehq.org. It still prematurely finds the offending samyak. Although .NET 1 through 3 can all install now. You can uncomment the lines in winetrick though to prevent the nagscreen; but you're on your own from there on.

Slackware 13.0 x86_64 cross-compiling to 32-bit

I'm a programmer.

I like programming.

I want my computer with slackware 13.0 x86_64 to churn out 32-bit and 64-bit linux binaries; and I want to run wine.

I want to learn to compile to multiple targets using HaXe. Those targets are flash, android, php, javascript, C/C++/SDL (iPhone). So, download it; unpack it (tar xf); install it as root.

So the first thing I had to do was to refit my x86_64 compiler to cross-compile to 32-bit.

The first thing you find on the intarweb is this: http://connie.slackware.com/~alien/multilib/. Don't skim it. You'll thank me. Oh, you also owe a thanks to Eric Hameleers (aka AlienBob) and Fred Emmott (aka fred, of slamd64 fame). Go on irc.freenode.net and thank them. Thanks to them you can run wine on slackware 13.0 x86_64 and thus access win32 applications e.g. Flash Develop (note: must get .NET 2 to work on wine; used winetricks but failed horribly, removed some fonts, gave up, subject of another blogpost ).

Do everything described in the previous link.

When compiling with slackbuilds from slackbuild.org (SBo), you need for 32-bit applicationsto run on your machine. It would be wise to run the slackbuild like this from the shell as root:


$ ARCH=i686 sh gc.SlackBuild


ARCH=i686 will force the variable inside the slackbuild script to take on this value: "i686" which activates a few parameters for gcc to compile to this architecture, which is the canonical x86 architecture. By the way, my example "gc" is Boehm's garbage collector. It is required for neko to run properly.

Next thing, learn to use "ldd". Type `which ldd` to find your ldd binary, it checks whether the dependencies of a certain binary you're running can find the libraries they depend on.

You might find out that the slackbuild for gc on SBo fails, with the following message:


checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.


Fortunately, someone only forgot to put "-m32" in this line:

...
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686" # <-- this line!


So add it there.

SLKCFLAGS="-O2 -march=i686 -mtune=i686 -m32"


Run it again, then you're good to go!

Good luck.