Eclipse Helios + MinGw: Adding icons to the application build

Recently I’ve worked a Win32 API tutorial (www.winprog.org/tutorial) for creating a simple graphical program. At the point where the icon has been added to the app, however, I’ve got stuck. The compiler did not give an error messages but neither the icon nor the menu did appear. What the hell?

Continue reading

Advertisements

CSS3 Scribble: Rounded Corners

In CSS3 finally no more hacks are needed in order to get round corners. A simple command is all you need:

border-radius: 15 px;

Unfortunately FF does not support (yet) rounded corners from the scratch. An extra prefix is required. Following makes it work:

-moz-border-radius: 15 px;

More info about rounded corners: http://www.css3.info/preview/rounded-border/

JavaScript: “window.status” in Google Chrome

Code:

<a href="example.html" onMouseOver="window.status='This sentence should become visible in the status bar of chrome'; return true"
		onMouseOut="window.status=' '; return true">Hover da mouse</a>

Issue:
While the “window.status” command works correctly in the IE, it does not seem to work in Chrome. When hovering the mouse over the link, just the link adress is shown.

Solution: Actually no solution, at least I did not found out. Just the information that the ‘dom.disable_window_status_change’ is disabled in Chrome due to security issues. While you can configure it in FF by typing ‘about:config’ in the address, there is no such a ‘hack’ in Chrome.

However, if anybody does know a fix, feel free to comment. Thx.

Multiline Strings and Other Text Editing Features in MatLab GUI

Originally I intended to write only couple of lines about programmatically plot editing in MatLab. But then digging a bit more through the web, I found quite interesting stuff about possibilities you can do in MatLab with the GUI. So now it is a bit more, I hope you like it.

As I am a comfortable guy,  I find working in plot editor mode kind of annoying. I do not like clicking all around and enjoy much of doing things programmatically, especially things which have to be do 20-30 times or even much more often per day.

Today I had to plot several similar figures. All the figures needed a title, so instead doing this in editor mode, I wrote a line of code. Actually I wanted the title to be two lines long therefore multiline and thought a simple ‘\n’ like I know it from C++ would do it, but I was wrong.

The solution for multiline strings in MatLab is to handover the string as as a cell array where each entry? is a new line is . So if you want to give out

This is the first line

and this the second

just write

title( { ‘This is the first line’ ‘and this the second’} )

Simple need, simple solution.

Additionally while looking up on the web, I’ve found out another solution where actually the ‘\n’ – style input works. Just use ‘sprintf’ to format the text. So the above example would go like this:

title( ( sprintf(‘This is the first line \n this the second’ ) )

Of course you can also use value arguments as place holder:

test_string = ‘just testing’

title( sprintf( ‘print second line \n %s’, test_string ) )

where %s stands for a defined value like ‘just testing’ in this case.

So far, so good. But really interesting was to me to find out that you can use basic HTML commands to manipulate your figures beyond simple text strings. Actually it was new to me that you can define controls similar to those in PHP/HTML. By defining

handle = uicontrol

a simple button is created (default option for user interface control in MatLab). Of course be setting appropriate ‘Style’ you can create radio buttons, sliders, editable text fields and other useful controls, see uicontrol in the MatLab help.

Extened features come into play, when usage of ‘String’-property is made. Then you can just use HTML-tags and format the control in HTML Style, e.g.

uicontrol(‘Style’,’popup’, ‘Position’,[10,10,150,100], ‘String’, … {‘<HTML><BODY bgcolor="green">green background</BODY> </HTML>’, … ‘<HTML><FONT color="red" size="+2">Large red font</FONT></HTML>’,…'<HTML><BODY bgcolor="#FF00FF"> <PRE>fixed-width font’});

creates a nice and colorful pop-up menu. Having this you can improve your figure just by adding some simple HTML- tags.

Have fun playing around….

File Managing in MatLab Editor

Today rather by coincidence I’ve found a cool little feature of MatLab files editor, which makes file handling more comfortable (at least for me).

By the standard setup all opened files are shown like tabs at the bottom, see. picture below. If you have too many of them and it happens quite often if you work on a project, the tendency to lose overview is obvious. Longer file names will be cut and you have to scroll horizontally to get the one you want.

matlab_lost_overview

Like I mentioned, today I was really upset by scrolling and looking what files are selected, so I started clicking and discover that like in Windows you can determine where this bar has to be. Just right click on the bar and you see this little menu, got it?

 editor_right_click

For myself the best position is on the right side. This way I see the code and have full overview about all files opened right now. Additionally sometimes it’s useful to check the “Alphabetize” option. Of course if you have really many files opened,  you also have to scroll, but then you have a really large project to work on. What a pity 🙂

Try it out, it’s very simple, may be to obvious…

matlab_right_side