Archive

Archive for February, 2010

Glade 3 + GtkBuilder + Anjuta Example.

February 23rd, 2010 Jimmy No comments

Today I whipped up a simple GTK application using the Anjuta IDE, Glade 3, and the new GtkBuilder system. As some of you know, Glade 3 and GTK changed things up. First Glade stopped using generated code which required you to use libglade. Now the GTK developers created their own interface interpretor called GtkBuilder. Your whole entire Gtk+ application is now done using mainly signals, making it fairly easy to develop Gnome type applications.

Note: This is not an in-debth tutorial on using Anjuta however I did provide a few screenshots. This is just to give you a quick idea of how to grab widgets with GtkBuilder and how to process signals from a Glade 3 interface. I just happen to be using Anjuta as my IDE.

Here is my development setup:
Anjuta: 2.82.2
Glade: 3.6.7-1
GTK: 2.18.7-1

If you are running Arch Linux these are available through pacman.

Once you have the above installed you’ll want to create a GTK+ project. Select File -> New Project, Select C (not C++), then GTK+. I unchecked the option to support other languages, but you don’t have to if you want to make your app multi-lingual.

Once you have a project setup you should see a few source files and a UI file. The UI file contains a user interface file which you can edit in glade. The screenshot below shows a basic setup after a project is created. I use horizontal and vertical splitters to align all my GtkWidgets. I created two buttons and one entry box.

Now to put text in the textbox (entry1) when a user clicks on the “button” you’ll need to add a GtkEntry pointer to your callback.c file.

callback.c

#include <gtk/gtk.h>
GtkEntry *myEntry;
void destroy (GtkWidget *widget, gpointer data);

main.c

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <config.h>

#include <gtk/gtk.h>

#include "callbacks.h"

/* For testing propose use the local (not installed) ui file */
/* #define UI_FILE PACKAGE_DATA_DIR"/gtk_foobar/ui/gtk_foobar.ui" */
#define UI_FILE "src/gtk_foobar.ui"

GtkWidget* create_window (void)
{
	GtkWidget *window;
	GtkBuilder *builder;
	GError* error = NULL;

	builder = gtk_builder_new ();
	if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
	{
		g_warning ("Couldn't load builder file: %s", error->message);
		g_error_free (error);
	}

	/* This is important */
	gtk_builder_connect_signals (builder, NULL);
	window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));

Now we need to populate the myEntry GtkEntry pointer in callback.c to our object that we made in the Glade interface builder. I named my entrybox “entry”. In the glade interface you can name your Widgets in the properties section. Remember, we defined GtkEntry *myEntry in callback.c.

    myEntry = GTK_ENTRY (gtk_builder_get_object (builder, "entry1"));

    gtk_entry_set_text (myEntry, "Hello World!");

	g_object_unref (builder);

	return window;
}

int main (int argc, char *argv[])
{
 	GtkWidget *window;

	gtk_set_locale ();
	gtk_init (&argc, &argv);

	window = create_window ();

	gtk_widget_show (window);

	gtk_main ();
	return 0;
}

void
button1_clicked_cb (GtkButton *self, gpointer user_data)
{
gtk_main_quit();
}

Here is the signal I created when creating my interface in Glade 3 from within Anjuta. Click on your Widget, then properties (lower left), then Signals (upper right, left side bar). If you don’t see a signals tab you might have to scroll over to see it using the scroll (left/right arrow looking things) buttons they built in.

void
btn1_Click (GtkButton *self, gpointer user_data)
{
    gtk_entry_set_text (myEntry, "Hello From Button Click!");
}

Now you can click build and execute your program! The program will populated your entry box when the application starts and then change the text when you click the “button” button.

Categories: Programming Tags: ,

Arch Linux + Kdevelop + Irrlicht 3D + Blender

February 19th, 2010 Jimmy 5 comments

If you’re into any type of 3D development in Linux be sure to give Arch a try with your 3D tools. The i686 compiled binaries offered up by Arch Linux gave me a little more of an edge, especially when it came to developing models in Blender and running them in the Irrlicht 3D engine. The performance is actually fairly amazing when compared to Windows XP, Windows 7 and even Ubuntu.

The Irrlicht 3D Engine is a super fast, high performance open source 3D engine. The software was developed in C++ and comes with some .NET bindings (although unstable). What attracted me to Irrlicht was the fact that it compiled from source with out a hitch and it was fairly easy to get started. I played with Microsoft’s XNA (3D game development using DirectX) tools and I actually hard more difficulty understanding their API than Irrlicht’s. With just a few lines of code in Irrlicht you can display and even animate a 3D model. Check out their Tutorials only to get an idea of what the code looks like.

Blender seemed to have gotten a speed boost as well. I can render the same models in Arch Linux and also notice an improved performance. I mainly notice how much quicker Blender starts. It’s really strange how Arch opens application quicker and how much you notice it!
blender linux arch linux

Kdevelop was another application that I noticed was much quicker. Under Ubuntu I could barley use KDE as it was but now I can use KDE and the KDevelopment system and I have no lag issues at all. I’m really starting to wonder what the Ubuntu team is adding to their distribution to make it such a hog.
kdevelop arch linux

Check out my initial review of Arch Linux here.

Categories: Power Computing Tags: ,

Arch Linux smokes all others. My Arch Review.

February 15th, 2010 Jimmy 6 comments

Last week I finally decided to try another Linux distribution. Even though I started off with Slackware on floppy disks I eventually got really lazy and started to use Ubuntu Linux. I remember those days when I was helping out with the KDE project on the first KDE Beta release. What I remember is my system being fast and also being just how I liked it. Recently I tried running KDE under both Ubuntu and Kubuntu and noticed how slow it ran. It was ver sluggish, even on my Core 2 Duo with 2gigs of ram.

Needless to say I have switch to a more traditional Linux, this time Arch Linux. Arch Linux gives you the old-school feel but lets you be a little bit lazy at the same time. Using the console program pacman you can easy download and install applications for your system. The cool thing is, the application binaries you get are compiled as if you compiled them from source, and they are compiled for Pentium class (i686) and above! With noob distributions such as Ubuntu, Fedora or even Debian, you really never know what you are getting as the software comes with everything pre-installed. They also load a ton of additional crap during boot and for your GUI! Arch compiles from the authors source code, not from a modified version, giving you the real deal.

Well today I decided to really test out Arch Linux and give KDE (my GUI roots) a try again. Keep in mind this is the same exact unmodified system that I used when I tested KDE under Ubuntu 9.10. So i fired up pacman -S kde…. and waited for my work’s proxy server to download at an awesome (fail) 50kb/s. After more than I wanted to wait I edited my ~/.initrc file and put in exec startkde. I ran startkde and all of a sudden there was a full blown KDE desktop in front of my face. I really wasn’t even sure if it was KDE at first because it loaded so fast. Seriously? Yeah. It’s very obvious that the noob distros (Ubuntu, Debian, Fedora etc..) are loading a ton of extra stuff at boot eating up loads of system resources.

Apologies.
I’m sorry for picking on Ubuntu and the other guys. They are GREAT Linux distributions, but if you have a little bit of Linux experience, know how to read (arch wiki FTW!) and know the basic Linux commands, Arch Linux might give you a better edge performance wise. I’m the super lazy type when it comes to computers and even I spent the time, and it was worth it!

I’ll continue to use Arch Linux as my main O.S. at work and we’ll see how it adds up in the Long run. Although Ubuntu and noobs seem to be a little hoggish, they did run pretty durn good without any issue.

Note: I had no problem getting ndis wrappers working for my WiFi card. The Broadcom (Those pain in the ass Dell WiFi) 4312 WiFi card works out of the box which was surprising. I guess the Linux kernel has included these drivers now. (Note, I found out those pesky Broadcom/dell Wifi cards now have native Linux drivers. Yay!)

Note #2: If you have know experience what-so-ever in Linux, I recommend Ubuntu for trying it out, and Gentoo for learning how it works. If you really want to learn Linux, Google “Linux from Scratch” and try to do an install that way.

Check out my extended Arch Linux Review Here. (Testing Blender, Kdevelop and Irrlicht.

Categories: Power Computing Tags: ,

Howto install Gnome Shell in Ubuntu.

February 11th, 2010 Jimmy No comments

Installing the new Gnome Shell is fairly easy. If you are using Ubuntu you simply install Gnome Shell from your synaptic package manager and run it from the command line. If Gnome Shell doesn’t show up in your package manager make sure you are using the Community-maintained repository along with the Canonical repository. After you are finished installing Gnome Shell you will need to disable compiz and other windows composers. In Ubuntu goto System > Preferences > Appearances and disable it under the Desktop Effects tab. Once that is done you can open up a shell and run gnome-shell –replace & to start up the Gnome Shell. This will replace you currently running windows manager.

gnome shell ubuntu howto 1

Below is a screenshot of the application switcher. You click the “Activities” button in the upper left hand corner and you’ll get a fancy pop-out with all your running applications.

gnome shell ubuntu howto 1

Notes:
For some reason I can not add anything to the top bar. I can see my tray icons on the right hand side but I can’t left or right click anywhere. It may be because I am running this is a temporary window manager.

Also keep in mind that Ubuntu will be using this by default in their next Ubuntu release (latest rumor at least).

Categories: Power Computing Tags: ,

Has Verizon been hacked? Security certificates revoked!

February 9th, 2010 Jimmy No comments

Has Verizon been hacked? Google Chrome seems to think so. Just a few minutes ago I tried to log into Verizon to see why my phone isn’t making any calls and to also see why I can’t make any text messages. I’m going to have to probably assume they haven’t been hacked, but how does one know for sure? No need to fear everyone, I’m running Linux.

The message I received was:
“You attempted to reach ebillpay.verizonwireless.com, but the certificate that the server presented has been revoked by its issuer. This means that the security credentials the server presented absolutely should not be trusted. You may be communicating with an attacker. You should not proceed.”

Here is a screenshot taken just a few minutes ago. (10:37AM EST).

Categories: General Tags: ,

My first blocked number in Google Voice.

February 8th, 2010 Jimmy 4 comments

Today I received my first piece of spam in Google Voice. At first I was really PISSED-OFF but then a feeling of serenity passed over my whole body as I noticed the “block” button. Slowly and cautiously I clicked it, making my day THAT MUCH better. Just knowing that I will no longer be getting text messages or spam from that phone number makes me feel so good inside. Sorta like that feel you get after drinking hot coca from a hard day of skiing on the mountain or a cold beer from a hot days hike in the hills. Thank you Google for the Blocked, Pwnt, Owned, Face Palmed, Jacked Up, Beat Down button called “Block” in Google Voice, it is much appreciated.

Why am I so excited? Because Google Voice came through when all other phone providers couldn’t. You can’t block phone numbers on other service providers such as Verizon. My wife was getting these spam calls, sometimes 6 a days. After asking over and over again to stop calling they kept on calling. We had no block features and Verizon said they couldn’t block it and we’d have to “take legal” action against the caller. The problem is we couldn’t get the details of the phone number’s owner without getting a court order, so we were screwed. If the wifey was using Google Voice, it would have been a matter of….right click….block, a.k.a face pwnt, a.k.a pwned.

Categories: Power Computing Tags:

Howto build a custom Linux kernel.

February 8th, 2010 Jimmy 2 comments

In this tutorial I will hopefully teach you how to configure and build a custom kernel. We’ll be using the unmodified generic Linux source code available here. Many Linux distributions sometimes add custom code to their kernel but for this example we’ll be using a pure Linux kernel. Creating a custom kernel can not only be educational but also make your computer run smoother and use less resources such as disk space. You may be required to install some additional software in order to build a custom kernel. We will not be covering boot loaders and initial rams disks in this article. I will however give you a general idea on where to go to test your kernel.

Note: You’ll need to be logged into your system as root in order to follow this tutorial.

1.
First lets make sure you have the necessary tools to build a kernel. Using your package manager or software installer check and make sure you have the following software installed. This version information was pulled directly out of the Change file for the latest 2.6.32 kernel. Usually if you have the update-to-date versions of GNU C and GNU make you should be fine but if you experience problems when doing an actual build come back and check to make sure the version below are installed.

Gnu C 3.2 # gcc –version
Gnu make 3.80 # make –version
binutils 2.12 # ld -v
util-linux 2.10o # fdformat –version
module-init-tools 0.9.10 # depmod -V
e2fsprogs 1.41.4 # e2fsck -V
jfsutils 1.1.3 # fsck.jfs -V
reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
xfsprogs 2.6.0 # xfs_db -V
squashfs-tools 4.0 # mksquashfs -version
btrfs-progs 0.18 # btrfsck
pcmciautils 004 # pccardctl -V
quota-tools 3.09 # quota -V
PPP 2.4.0 # pppd –version
isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
nfs-utils 1.0.5 # showmount –version
procps 3.2.0 # ps –version
oprofile 0.9 # oprofiled –version
udev 081 # udevinfo -V
grub 0.93 # grub –version
mcelog 0.6

2.
Download the latest 2.6 kernel into your /usr/src folder and uncompress it with the bzip2 -dc linux-2.6.32.tar.bz2 | tar xvf - command.

3.
Change your directory to the 2.6.32 directory. cd linux-2.6.32

4.
Now that you are in the 2.6.32 folder lets configure your kernel. Type make menuconfig to enter the kernel configuration menu. Once in the menu you can use your arrow keys to navigate up and down, enter key to enter a sub-menu, ESC key to exit out of sub-menus or the kernel menu and space bar to select an option from the menu.
build custom kernel linux make menuconfig

When you select and item with the space bar you’ll notice that sometimes the item is selected as <*> or as a . The <*> indicates to build this option into the kernel and the indicates to build this option as a kernel module. Kernel modules are files located on your computer that generally represent drivers for hardware. Generally modules are loaded after your system boots. If you build everything into your kernel you don’t have to worry about kernel modules loading later on. Certain options and drivers such as file system types and partition types must be built into the kernel and not as a module because they are needed to mount your file system. Compiling other drivers and options such as network devices directly into the kernel and not as a module is generally a good idea too. It’s my opinion that building everything you need into a kernel is best for systems with low resources as kernel modules tend to take up more memory, disk space and can increase boot times.

5.
Once you configure everything you think you need, exit out using the ESC key. When asked, save your kernel configuration.

6.
Now that you have exited the menu it is time to build your kernel. Type make and press enter. Now you get to see a whole bunch of nerdy output. If your build breaks you’ll probably see a bunch of Error and Exiting messages. Once the system is done building the kernel you can check and see if the file bzImage is in /usr/src/linux-2.6.32/arch/x86/boot.

7.
Booting using your new kernel is going to very from system to system. For this tutorial I am going to cover Grub and the very very very basics of adding a new boot option to your boot loader. This is what will be used to boot your system. For more details on Grub, use Google.

7a.
Copy your new kernel to your /boot folder. The kernel is located in /usr/src/linux.6.32/arch/x86/boot/ and is called bzImage. Copy this file to your /boot folder and call it custom-2.6.32.1 (cp the bzImage file to /boot/custom-2.6.32.1).

7b.
Edit the /boot/grub/menu.lst file. Look for a few lines that look like this:
title Ubuntu 9.10, kernel 2.6.31-17-generic
uuid d0ec0e7d-3ec5-4b5b-ace4-111792a2fbc1
kernel /boot/vmlinuz-2.6.31-17-generic root=UUID=d0ec0e7d-3ec5-4b5b-ace4-111792a2fbc1 ro quiet splash
initrd /boot/initrd.img-2.6.31-17-generic

Copy (do not remove, COPY) those lines and change the title to Custom Linux 2.6.32.1. Also make sure and change the kernel line to represent the kernel you copied to /boot. So /boot/custom-2.6.32.1. Don’t worry about the initrd lines, leave those as is.

Now run grub-install, reboot and give it a go. When your system boots select the kernel you just added. If it fails to boot simply reboot and load a previous kernel.

Notes:
If you run into boot issues Google search the errors and problems. You may need to compile in certain drivers to get stuff working. Double check your kernel configuration and make sure you have covered everything for your hardware.

Don’t get frustrated if your boot fails. Creating custom kernels isn’t the easiest thing to do and should generally only be done if you need an optimized system or if you are working with embedded systems.

The boot loader we used in this tutorial is Grub however there are many other boot loaders around such as Lilo, Bootcamp and SYSLINUX.

Categories: Power Computing Tags: ,

3500 Netflix on Linux petitions.

February 6th, 2010 Jimmy 6 comments

Currently you can not watch Netflix if you are a Linux user and all those new Ubuntu Netbook owners will not be watching Netflix anytime soon either. Watching movies online through Netflix is an awesome service, but worthless to Linux users. Netflix has chosen to only allow Windows and MAC users access to their online streaming movie service and they are losing tons of money because of it.

Currently there are over 3500 signatures on the petition to get Netflix to support Linux users. Currently Netflix charges $9.9 (at the time of this post) per month for 1 DVD in the mail and unlimited movies online. That is over $35,000 per month Netflix could be racking in right now.

Is Silverlight the issue? Possibly. If Netflix has already spent $millions of dollars on a Silverlight streaming solution it’s doubtful they will spend more money on a Flash based streaming system.

This is how I look at it. If youtube can convert almost all of their videos to support the iPhone, it can’t be that hard to get Linux users up and going on Netflix.

SIGN THE NETFLIX LINUX PETITION HERE

Categories: Power Computing Tags: ,

Apple bans “android” from apps store.

February 6th, 2010 Jimmy 1 comment

apple sucks badApples waving the ban stick around again, this time rejecting an educational iPhone app because it contained the word “Android”. The application? Flash of Genius: SAT Vocab 2.2, an iPhone app developed by Tim Novikof. The app did really well in the Android Developer Challenge that Google puts on and decided to mention that in his app to let potential customers know the value of his software. Apple however, rejected his app and sent this email to Novikof.

“During our review of your application, we found that your application contains inappropriate or irrelevant platform information in the Application Description and/or Release Notes sections.

“While your application has not been rejected, it would be appropriate to remove ‘Finalist in Google’s Android Developer’s Challenge!’ from the Application Description.

“Please log into iTunes Connect to make appropriate changes to the Application Description now to avoid an interruption in the availability of Flash of Genius: SAT Vocab 2.2 on the iPhone App Store.”

Categories: Power Computing Tags:

Fallen Earth Gameplay Video

February 5th, 2010 Jimmy No comments


Here is a short video which shows you what the melee game play is like in Fallen Earth. It’s basically a slashing style game play with no special moves or anything. There are some animations with some of the buffs but nothing as far as your physical movement.

Categories: General Tags: