How-to Increase Adept’s Font Size under KDE4 (Kubuntu)

One issue that was bugging me for a while was the different font size (after adjusting it) on couple applications (including Adept) under my fresh installation of Kubuntu Interpid. After investigating and Google-ing I found out that it was due to running those proccesses as “root” which had different fonts and GTK+  settings.

Solution:

$ kdesudo systemsettings

After running the command above setup the font size as you like it. Working as normal user is something new to me and I’m not sure I like. Needing to write my pass to many times and having to chown my old files is just not that pleasant.

January 5, 2009 · Peter

VMware Player / Workstation Keyboard Mapping Problem

After switching from Debian Unstable to Kubuntu 8.10 I reinstalled my VMware Player 2.5.1 and started my Windows XP virtual machine. Soon I found that most of the keys near the numeric pad (del, home, right enter, etc) are either not working at all or doing wrong things. The obvious reason was some wrong keyboard mappings.

Solution:

$ echo 'xkeymap.nokeycodeMap = true' > ~/.vmware/config

or if the config already exists

$ echo 'xkeymap.nokeycodeMap = true' >> ~/.vmware/config

More info here

January 5, 2009 · Peter

Re-Launching CreonFX.com

It’s been quite a while from my last post but I have not been losing my time in this period.

Retrospection:

After some unfortunate events the company I was working for just disappeared and many good people were left on the street. Beside the obvious issue with the lack of incomes finally I could start working with technologies that were not so quite popular among my previous employers.  As a result of this I started digging into Adobe Flex development, Papervision3d library, Box2D Actionscript Physics engine and other interesting stuff.

Recently  I  launched my personal website at http://www.creonfx.com and received quite good responses from the community. There are couple of things that need fixing and of course looking from my current point of view it could have been done a lot better, however I’m quite happy with the result. You also might notice that this blog has updated look and feel to match the whole theme.

Future:

For now I want to try freelancing for a while so I can receive some income and still be able to gain new knowledge that is not restricted from my employer.

Also expect many new post with information about the issues I had during building the website, I think it will be worth since Papervision3d still lacks of good tutorials and resources.

Happy holidays

December 18, 2008 · Peter

Facebook Style Image Cropping (Javascript Preview)

While others are sun bathing somewhere on the shores of Black Sea I received another interesting task – to  implement cropping for user uploaded profile images. My first idea was to port MooCrop to Mootools 1.2 and apply couple of modifications, but the customer wanted the cropping to be exactly like in Facebook. For those who don’t know it is plain old boring mouse drag.

Instead of generating thumbnail and then cropping it (like in Facebook) I take the original (uploaded) image and resize it with CSS (yes I know it is not the right thing to do but for a quick preview IMO it is ok and we skip one resizing operation). Then I use the Drag Class to create a drag to scroll container (like in Adobe Acrobat) and finally with two hidden input fields I send the coordinates to the server side part which takes care of the resizing and cropping of the image.

Enough mumbojumbo – the cropping example and the pic

FaceBook cropping

August 26, 2008 · Peter

Javascript Dynamic Paging (MooTools Pager)

Couple of days ago I had to create a content pager which can dynamically insert page numbers including previous and next buttons.

The reason why I had to use Javascript and not any server side solution is quite interesting – the paging method should not really divide the content into different web pages. This is needed because if the text we want to split contains any XHTML markup and we divide it into separate web pages the markup will be broken (invalid). Just imagine having opening tag in the first page and closing in the second – not cool! Other break point is if we just split some tag in two.

Using my favourite Javascript Framework – Mootools and with couple of XHTML/CSS tricks I could get it working with the following code:

var pagerPageHeight = $('warper').getSize().y;
var contentArea = $('content');
var pagerCurPage = 1;
var pagerPagesCount = 1;
var pagerPages = $('pager');

var pagerInit = function(){

	var contentHeight = contentArea.getSize().y ;
	pagerPagesCount = (contentHeight / pagerPageHeight).toInt();
	if (contentHeight % pagerPageHeight != 0 ) pagerPagesCount++;
	if (pagerPagesCount === 1) return;

	var prev = new Element('a', {
			'class': 'cust-pager-prev',
			'html': '&lt',
			'id': 'cust-pager-prev',
			'events': {
				'click': function(){
					pagerChangePage(pagerCurPage - 1);
				}
			}
		});

	var next = new Element('a', {
			'class': 'cust-pager-next',
			'html': '&gt',
			'id': 'cust-pager-next',
			'events': {
				'click': function(){
					pagerChangePage(pagerCurPage + 1);
				}
			}
	});	

	prev.inject(pagerPages,'top');
	$('cust-pager-prev').setStyle('display','none');

	for (var i=1; i<=pagerPagesCount; i++){
		var anchor = new Element('a', {
			'class': 'cust-pager-item',
			'id': 'cust-pager-item-'+ i,
			'html': i,
			'events': {
				'click': pagerChangePage.pass(i)
			}
		});
		anchor.inject(pagerPages);
	}

	next.inject(pagerPages,'bottom');
};

var pagerChangePage = function(page){
	$('cust-pager-item-' + pagerCurPage).set('class', 'cust-pager-item');
	$('cust-pager-item-' + page).set('class', 'cust-pager-item-sel');

	pagerCurPage = page;

	if (pagerCurPage === 1) {
		$('cust-pager-prev').setStyle('display', 'none');
	}else{
		$('cust-pager-prev').setStyle('display', 'inline');
	}

	if (pagerCurPage === pagerPagesCount) {
		$('cust-pager-next').setStyle('display', 'none');
	}else{
		$('cust-pager-next').setStyle('display', 'inline');
	}

	contentArea.setStyle('top', (-1) * pagerPageHeight * (page - 1));
};

pagerInit();

The example and the picture as usual.

Custom Pager

August 16, 2008 · Peter