Sunday, October 24, 2010
Saturday, January 30, 2010
Zend Frame work in wamp -------
Tuesday, September 29, 2009
sh^M: bad interpreter: No such file or directory
Monday, September 7, 2009
How To Enable Adobe's Flash Player In Google Chrome (Ubuntu 9.04)
If the Flash plugin is already installed for Firefox, we have to find out where it is located:
sudo updatedb
sudo locate libflashplayer.so
If it is installed, output should be similar to this one...
falko@falko-desktop:~$ sudo locate libflashplayer.so
/opt/Adobe AIR/Versions/1.0/Resources/libflashplayer.so
/usr/lib/flashplugin-installer/libflashplayer.so
falko@falko-desktop:~$
... which means the Flash plugin is located in /usr/lib/flashplugin-installer/libflashplayer.so. If there's no output, this means that the Flash plugin isn't installed - you can then install it as follows:
sudo aptitude install flashplugin-installer
Now we create a plugins directory for Google Chrome...
sudo mkdir /opt/google/chrome/plugins
... and copy the Flash plugin to it:
sudo cp /usr/lib/flashplugin-installer/libflashplayer.so /opt/google/chrome/plugins
Finally we have to tell the Google Chrome launcher that it should look out for plugins. To do this, we right-click on Applications and select Edit Menus:

In the Menu Editor, go to Internet > Google Chrome and click on the Properties button:
Tuesday, August 25, 2009
Seting-Up a HTTP Proxy Server with Authentication and Filtering
Configure Squid by opening /etc/squid/squid.conf using your favorite text editor. In the configuration file, search for the following directives and modify (or add, if they don't exist) as it follows: http_port 3128 - The port Squid will listen for connections. If your system has two or more interfaces, you can specify which IP address to use. Eg: http_port 192.168.0.1:3128 http_access deny all - Search for it in the config file, uncomment it (remove the # in front), and replace deny with allow so it becomes http_access allow all. Restart the Squid proxy with: CODE $ sudo /etc/init.d/squid restartNow you should have a fully functional HTTP proxy. To try it out, open a browser, open its preferences dialog and go to proxy settings. Here, enter the IP address of the machine running Squid and the port set in squid.conf. Now load a webpage. SETTING UP SQUID AUTHENTICATION AND WEB FILTERING This section will allow you to set up a web site filter for kids. The first time an address is entered in the browser's address bar, an authentication dialog will pop-up, prompting for a username and password. We will set-up two usernames, one with full and another with restricted access. First, open the /etc/squid/squid.conf and add the following line in the auth_param section: auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd Now create the user accounts using htpasswd (use -c only for the first user): CODE $ sudo htpasswd -c /etc/squid/passwd dadCreate the ACLs by adding the following lines in the ACCESS CONTROLS (acl) sections in Squid.conf: CODE acl dadUser proxy_auth dadCreate the whitelist by opening a text editor, adding allowed domains like this: .google.com .kids-play.com .yahoo.com .msn.com and save it as /etc/squid/whitelist. Finally, search for http_access allow all in the Squid config file and modify it so it looks like this: http_access deny all This is how my Squid config sections look like: CODE # NETWORK OPTIONSUse deny all for squid with authentication and allow all for basic squid configuration. | |
create a shared and a static library with gcc
The code for the library
The header file
double mean(double, double);
Creating the static library
ar rcs libmean.a calc_mean.o
Creating the shared library
cc1: warning: -fPIC ignored for target (all code is position independent)
The programm using the library
#include#include "calc_mean.h" int main(int argc, char* argv[]) { double v1, v2, m; v1 = 5.2; v2 = 7.9; m = mean(v1, v2); printf("The mean of %3.2f and %3.2f is %3.2f\n", v1, v2, m); return 0; }
Linking against static library
Linking against shared library
Executing the dynamically linked programm
LD_LIBRARY_PATH=. ./dynamically_linked
Creating a library with the GNU archiver
Creating a library with the GNU archiver
The GNU archiver ar combines a collection of object files into a single archive file, also known as a library. An archive file is simply a convenient way of distributing a large number of related object files together
To demonstrate the use of the GNU archiver we will create a small library ‘libhello.a’ containing two functions hello and bye.
The first object file will be generated from the source code for the hello function, in the file ‘hello_fn.c’ seen earlier:
#include#include "hello.h" void hello (const char * name) { printf ("Hello, %s!\n", name); }
The second object file will be generated from the source file ‘bye_fn.c’, which contains the new function bye:
#include#include "hello.h" void bye (void) { printf ("Goodbye!\n"); }
Both functions use the header file ‘hello.h’, now with a prototype for the function bye():
void hello (const char * name); void bye (void);
The source code can be compiled to the object files ‘hello_fn.o’ and ‘bye_fn.o’ using the commands:
$ gcc -Wall -c hello_fn.c $ gcc -Wall -c bye_fn.c
These object files can be combined into a static library using the following command line:
$ ar cr libhello.a hello_fn.o bye_fn.o
The option cr stands for "create and replace".(33) If the library does not exist, it is first created. If the library already exists, any original files in it with the same names are replaced by the new files specified on the command line. The first argument ‘libhello.a’ is the name of the library. The remaining arguments are the names of the object files to be copied into the library.
The archiver ar also provides a "table of contents" option t to list the object files in an existing library:
$ ar t libhello.a hello_fn.o bye_fn.o
Note that when a library is distributed, the header files for the public functions and variables it provides should also be made available, so that the end-user can include them and obtain the correct prototypes.
We can now write a program using the functions in the newly created library:
#include "hello.h" int main (void) { hello ("everyone"); bye (); return 0; } This file can be compiled with the following command line, as described in section 2.7 Linking with external libraries, assuming the library ‘libhello.a’ is stored in the current directory:
$ gcc -Wall main.c libhello.a -o hello
The main program is linked against the object files found in the library file ‘libhello.a’ to produce the final executable.
The short-cut library linking option -l can also be used to link the program, without needing to specify the full filename of the library explicitly:
$ gcc -Wall -L. main.c -lhello -o hello
The option -L. is needed to add the current directory to the library search path. The resulting executable can be run as usual:
$ ./hello Hello, everyone! Goodbye!
It displays the output from both the hello and bye functions defined in the library.

