GTK+ library installation

I was trying to program a graphical iterface using GTK+ by following the video below.

However I didnt have the <gtk/gtk.h> library installed in my linux computer. So I tried to download it by going to gtk.org and downloading the source files but had no luck. Kept getting the same error saying
fatal error: gtk/gtk.h: No such file or directory
Then I tried to configure it but kept getting errors like
.
.
.
error: Package requirements (glib-2.0 >= 2.33.1 atk >= 2.5.3 pango >= 1.30.0 cairo >= 1.10.0 cairo-gobject >= 1.10.0 gdk-pixbuf-2.0 >= 2.26.0) were not met:

This was such a pain until I ran into the video below. The guy speaking you’ll not understand shit but he showed step by step

Here are the steps:
In command line:
$ sudo apt-get install libgtk2.0-dev

c++ sample code:

#include <gtk/gtk.h>
int main(int argc, char *argv[]){
    gtk_init(&argc,&argv);
    GtkWidget* window;
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(window,"delete-event",G_CALLBACK(gtk_main_quit),NULL);
    gtk_widget_show(window);
    gtk_main();
    return 0;
}

compile the program:

$ g++ test.cpp `pkg-config --libs gtk+-2.0` `pkg-config gtk+-2.0 --cflags`

run the program:
$ ./a.out

OwnCloud Server

ownCloud is a software suite that provides a location-independent storage area for data

Have php and webserver installed. (I’m using ubuntu 11.10)
$ sudo apt-get install apache2 php5 mysql-server php5-mysql phpmyadmin

Install ownCloud
$ sudo wget http://mirrors.owncloud.org/releases/owncloud-4.5.7.tar.bz2
$ sudo bunzip2 owncloud-4.5.7.tar.bz2
$ sudo tar -xvf owncloud-4.5.7.tar
$ sudo mv owncloud/ /var/www/
$ sudo chown -R www-data:www-data /var/www/owncloud/

Done. Now go to localhost/owncloud
Make ownCloud accessible outside your home network.

You may receive this error:
Your data directory and your files are probably accessible from the internet. The .htaccess file that ownCloud provides is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.

This mean that your .htaccess doesn’t have permission to override the php.ini
You don’t have to change anything to make owncloud work but if you want this feature read “Allow htaccess to override php.ini”

To increase amount of data that can be uploaded.
There’s two options you can edit upload_max_filesize and post_max_size in the /etc/php5/apache2/php.ini file or edit the .htaccess if you did the above configuration.

Allow htaccess to override php.ini

In order .htaccess to override the configuration on php.ini you must edit your apache configuration.

In order for the .htaccess code below to work in your site

<IfModule mod_php5.c>
php_value upload_max_filesize 10MB
php_value post_max_size 10MB
</IfModule>

You’ll will need to insert the code below to /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

.
.
.

    <Directory /var/www/>
        AllowOverride All
    </Directory>

</VirtualHost>

Then restart apache
$ /etc/init.d/apache2 restart

Resource

tags:
ubuntu server add .htaccess directory
allow php.ini to be override using .htaccess
php.ini increase upload size
php ini httpd conf htaccess
.htaccess is not overriding php.ini
.htaccess override php.ini
changing php ini values using .htaccess
change php ini htaccess not working

Quote: Your Memory

“Never commit to memory what can be easily looked up in books” – Albert Einstein.

This is so true except one thing has probably changed books to internet.

http://blog.framebase.io/post/43973262180/the-best-programmers-are-the-quickest-to-google

Automatic Night Light Circuit

Below is a schematic of two circuits that uses a photocell sensor to detect light and NPN transistor (2n2222) to turn on and off the LED. Its an automatic night light.

night light circuit transistor schematic

DSC02226 copy

Both LED are on because the location the light is dimmed.

 

I search for so long on how to make the transistor work as a switch and after long search I found two links that showed correct and simple schematics.

http://www.youtube.com/watch?v=_dcjzJfQZHk

http://www.youtube.com/watch?v=GDbzCal0NCQ

Arduino on Breadboard troubleshoot, the importance of Capacitors

I have an Arduino on a breadboard and having an issue with the voltage on the digital pin 13 outputing an low voltage when connect to a volt regulator.  Why is this happening? because when the breadboard is connected to an Arduino UNO power that is connected to the same power supply it works perfectly fine.  See images and descriptions below.  Thank you for the help.

Notes:
Power wires are connected at the bottom of the breadboard
Components:

Arduino on breadboard
Power Jack
9v – 300mA Power
L7805CV 5voltage regulator

Arduino Code:
Set to output LIGHT ON on digital pin 13

DSC02219
The voltage on the rails when breadboard is connected to power is 5 volts

DSC02221
The voltage on digital pin 13 when connected to power is 0.370 volts (why?)

 

DSC02222
The voltage on the rails when connected to arduino power is 5 volts

 

DSC02223
The voltage on digital pin 13 when connected to arduino power is 4.74 volts

Why is the voltage on digital pin 13 not the same when connected to an Arduino Uno Power to an Power supply using a voltage regulator?

 

Answer:
Its very important to add a electrolytic capacitor to the input and output caps of the voltage regulator because this will help SMOOTH out the ripple the battery pack/regulator is putting out.

I only added a 22uF electrolytic capacitor to the rails and it worked.  See picture below.

DSC02224 copy

Reference

Titanium Appaccelerator error fix

Error when trying to open Titanium: Your project contains error(s), please fix it before running it

This can be caused by an out of date “Debug Certificate” fixed as follows:

IF ALL FAILS THEN THIS GOTTA BE THE SOLUTION:

Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERPROFILE%/.androidon Windows.

The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.


Resource