Tuesday, July 25, 2006

Disable Synaptics Touchpad

original article:


http://ubuntu.wordpress.com/2006/03/24/disable-synaptics-touchpad/


March 24, 2006

Posted by ubuntonista in ubuntu, guides. trackback

I needed a quick way to disable and enable my synaptics touchpad at will, and I found one.

Make sure that in you /etc/X11/xorg.conf file, you have:


Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "on"
EndSection

Notice the Option “SHMConfig” “on” line — that is the one that you really need to have in there. This allows you to change some configuration parameters for the synaptics touchpad without restarting Xorg (Xserver).

Now that is taken care of.

All you have to do to disable your synaptics touchpad is to execute the command:
$synclient TouchpadOff=1

and to turn it back on, you can execute the command
$synclient TouchpadOff=0

TIP: To make it even easier to turn the touchpad on and off, you can set a keyboard shortcut and bind the shortcuts to the command to turn it on, and off, and use the keyboard shortcuts.

Sunday, July 23, 2006

change keybindings of show desktop, Ctrl+Alt+d to Windows D

With each release of GNOME, I think it pulls further ahead of KDE. I’ve been using GNU/Linux for 5 years now, and I have seen GNOME destroy KDE in terms of usability, and now (finally) in terms of speed as well. I love the things you can configure with GNOME when you know what youre doing. Using GConf, you can go to “apps–>metacity–>global_keybindings” and edit the keybindings to whatever you want. Change “show_desktop” to “M” and you’re set (Mod4 is the Winblows key). You can further your Windows-esque interface by setting “panel_run_dialog” to “R” and making one of the run_commands “F” and editting the corresponding command to be “gnome-search-tool”. T is nice to run an xterm, and I like to set B and Z to be “xmms -f” and “-r” to control xmms skipping while its still minimized. I am excited for 2.8! One question, my mouse cursor has a shadow with transparency, why can’t my windows have shadows?

customized keybindings and desktop elements

gconf-editor

unix autoexec.bat

/etc/profile

/etc/bash.bashrc

Friday, July 21, 2006

ubuntu: No sound in youtube.com (flash)

Original Article:

http://ubuntuforums.org/showthread.php?t=187752&highlight=sound+flash

The problem is that Flash is old and doesn't support Ubuntu's directory structure for esd properly. It wants to use /tmp/.esd/socket for the sound connection. But Ubuntu uses /tmp/.esd-/socket for the sound (the uid for the user that installed Ubuntu is 1000). A quick hack you can do to fix this is to symbolic link that directory. To do that, go to System - Preferences - Sessions - Startup programs and add
Code:
ln -s /tmp/.esd-1000 /tmp/.esd
to the list (assuming your uid is 1000, change it accordingly if it isn't), then logout and log back in. After doing this, Flash sound should work properly.


to get the the current logged user's id: go to terminal: Application > Accessories > Terminal. type: id



Wednesday, July 19, 2006

sql injection attacks increasing

PHP doesn't force you to do that by hand, you can make use of the numerous database abstraction layers for PHP, like PDO [php.net] or PEAR::DB [php.net].

Here is an example, taken straight from PDO's page:
$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);

$name = 'one';
$value = 1;
$stmt->execute();
The framework is there, PHP developers need to make use of it, but sadly things like the following are still common:
mysql_query('SELECT value FROM REGISTRY WHERE name = "' . $name . '"');

cpu frequency scaling

Original Article:


http://ubuntu.wordpress.com/2005/11/04/enabling-cpu-frequency-scaling/

I use the CPU Frequency Scaling Monitor on my panel to see the speed of my CPU. I have a centrino laptop. Ubuntu automatically increases the speed (frequency) of my laptop when the demand is more, and manages things very well.

However, when I am plugged in, I want to run my laptop at the maximum possible frequency at certain times. It turns out that the CPU Frequency Scaling Monitor can also have the functionality to change the Frequency, by “Governing” the CPU frequency. However, by default, on my laptop, left-clicking on the Monitor in the Panel did not give me the option to change the frequency.

In order to be able to change the operating frequency, your processor should support changing it. You can find out if your processor has scaling support by seeing the contents of files in the /sys/devices/system/cpu/cpu0/cpufreq/

For example, on my system:

$cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
gives:

1300000 1200000 1000000 800000 600000

Which means that the above frequencies (in Hz) are supported by my CPU.
and…
$cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
gives:

userspace powersave ondemand conservative performance

All those are the different “modes” I can operate the CPU at. Userspace, for example, regulates the frequency according to demand. Performance runs the CPU at max-frequency, etc…

On the Ubuntu Forums, I read that one can manually change the frequency by executing commands like:
$ cpufreq-selector -f 1300000
which will set the frequency to 1.3 GHz.

Now, I was interested in being able to change the power mode (between the different values listed in the “governors” above, manually by using the Cpu Frequency Panel Monitor.

I found out from the Forums, again, that changing the permissions of the cpufreq-selector binary by doing a:
$sudo chmod +s /usr/bin/cpufreq-selector

will allow me to acheive this. However, I was curious as to why Ubuntu does not, by default, allow me to choose the frequency using the CPU Frequency Panel Monitor, and what the “right” or “correct” way of enabling this is.

With a little bit of detective work, I found the reason why things are the way they are in Bug #17604 :

Oh, please, not another setuid root application if we can avoid it. Which file does cpufreq-selector need access to to change the CPU speed? And why should a normal user be able to change the CPU speed in the first place? The automatic CPU speed works well enough for the majority of users, and control freaks can always use sudo to manually set the speed, or deliberately shoot themselves in the foot by making the binary suid root (as explained in README.Debian).

Anyways, since I really want to “shoot my self in the foot” using my CPU ;) , so I read the readme:
$cat /usr/share/doc/gnome-applets-data/README.Debian

and as suggested in it, I did a
$ sudo dpkg-reconfigure gnome-applets
and answered “Yes” to the question regarding setting the suid of the cpufreq-selector executable. Now, by left-clicking on the CPU Frequency Monitor Applet, I can choose the frequency for my processor, and things couldn’t be better!!

P.S.: A lot of my detective work could have been avoided had I read the README in the first place. Stupid me.


install httrack from source

http://spiderzilla.mozdev.org/installation.html


Spiderzilla for GNU/Linux (or other *nix systems) Linux

This version is working only when you have xfree and HTTrack packages installed.
Why Xfree? Because Spiderzilla is using xterm.
After that you can install HTTrack from sources from this address httrack-3.33.tar.gz.

To install HTTrack here are the command lines:
$ tar xvfz httrack-*.tar.gz
$ cd httrack-*
$ ./configure --prefix=/usr/local && make
# make install
(root permissions required to install HTTrack)
$ /usr/local/bin/httrack

For more information look to www.httrack.com.

Install SpiderZilla for Linux
Download SpiderZilla for Linux (88 KB)

A script "skrypt.sh" has to be executable!
$ chmod +x skrypt.sh
(in ~/.mozilla/firefox/profiles/xxxxxxxx.default/extensions/{3cd27e92-1a30-11da-94c6-00e08161165f}/httrack/skrypt.sh)

Spiderzilla for MacOSX MacOSX

This version is working only when you have X11 and HTTrack packages installed.

You must install X11 for Apple in order to have xterm,
After that you can install HTTrack from sources from this address httrack-3.33.tar.gz.

To install HTTrack here are the command lines:
$ tar xvfz httrack-*.tar.gz
$ cd httrack-*
$ ./configure --prefix=/usr/local && make
# make install
(root permissions required to install HTTrack)
$ /usr/local/bin/httrack

./configure is crazy

TIA
configure: error: C++ preprocessor "/lib/cpp" fails sanity check.

Try apt-get gcc cpp g++

guess what, this substantial code works in linux mono c# yipee!!! :D

to compile in mono:


mcs m.cs -r:System.Data -r:System.Windows.Forms -r:System.Drawing

to run:

mono m.exe




-----------------------------------



original article:

http://www.bobpowell.net/dropshadowtext.htm

using System;

using System.Drawing;

using System.Drawing.Text;

using System.Drawing.Drawing2D;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;



namespace textdropshadow

{

///

/// Summary description for Form1.

///


public class Form1 : System.Windows.Forms.Form

{

///

/// Required designer variable.

///


private System.ComponentModel.Container components = null;



public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();



this.SetStyle(ControlStyles.ResizeRedraw,true);

}



///

/// Clean up any resources being used.

///


protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}



#region Windows Form Designer generated code

///

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

///


private void InitializeComponent()

{

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(16, 36);

this.BackColor = System.Drawing.Color.White;

this.ClientSize = new System.Drawing.Size(376, 293);

this.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

this.Name = "Form1";

this.Text = "Form1";

this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);



}

#endregion



///

/// The main entry point for the application.

///


[STAThread]

static void Main()

{

Application.Run(new Form1());

}



protected override void OnPaintBackground(PaintEventArgs e)

{

LinearGradientBrush b=new LinearGradientBrush(this.ClientRectangle,Color.Blue,Color.AliceBlue,90f);

e.Graphics.FillRectangle(b,this.ClientRectangle);

b.Dispose();

}



private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

{

//Make a small bitmap

Bitmap bm=new Bitmap(this.ClientSize.Width/4,this.ClientSize.Height/4);

//Get a graphics object for it

Graphics g=Graphics.FromImage(bm);

// must use an antialiased rendering hint

g.TextRenderingHint=TextRenderingHint.AntiAlias;

//this matrix zooms the text out to 1/4 size and offsets it by a little right and down

Matrix mx=new Matrix(0.25f,0,0,0.25f,3,3);

g.Transform=mx;

//The shadow is drawn

g.DrawString("Text with a dropshadow",Font,new SolidBrush( Color.FromArgb(128, Color.Black)), 10, 10, StringFormat.GenericTypographic );

//Don’t need this anymore

g.Dispose();

//The destination Graphics uses a high quality mode

e.Graphics.InterpolationMode=InterpolationMode.HighQualityBicubic;

//and draws antialiased text for accurate fitting

e.Graphics.TextRenderingHint=TextRenderingHint.AntiAlias;

//The small image is blown up to fill the main client rectangle

e.Graphics.DrawImage(bm,this.ClientRectangle,0,0,bm.Width,bm.Height,GraphicsUnit.Pixel);

//finally, the text is drawn on top

e.Graphics.DrawString("Text with a dropshadow",Font,Brushes.White,10,10,StringFormat.GenericTypographic);

bm.Dispose();

}

}

}

Tuesday, July 18, 2006

What users hate about IT pros

http://www.networkworld.com/news/2006/071706widernet-end-users.html?page=2

Which brings up another common complaint: techno-jargon. The technical terms and shorthand that IT managers throw around create an air of mystery and superiority to those not in the know, some say. And that may be by design.

"While they make you feel stupid on the one hand, they also shroud solutions in mystery, which I believe is a job protection/justification strategy," says Lisa, a partner with a financial services firm in the Boston area.
—-FIXED!!!!——

/dev/snd/seq failed: No such file or directory

solution: modprobe snd-seq

Monday, July 17, 2006

how to change domain or workgroup in Ubuntu

How to change computer Domain/Workgroup

* Read #General Notes
* Read #How to install Samba Server for files/folders sharing service

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
sudo gedit /etc/samba/smb.conf

* Find this line

...
workgroup = MSHOME
...

* Replace with the following line

workgroup = new_domain_or_workgroup

* Save the edited file

sudo testparm
sudo /etc/init.d/samba restart

equivs (for yahoo messenger dependency workaround)

Circumvent Debian package dependencies
This package provides a tool to create Debian
packages that only contain dependency information.

If a package P is not installed on the system, packages
that depend on P cannot normally be installed. However,
if equivalent functionality to P is known to be installed,
this tool can be used to trick the Debian package management
system into believing that package P is actually installed.

Another possibility is creation of a meta package. When this
package contains a dependency as "Depends: a, b, c", then
installing this package will also select packages a, b and c.
Instead of "Depends", you can also use "Recommends:" or
"Suggests:" for less demanding dependency.

Please note that this is a crude hack and if thoughtlessly used,
it might possibly do damage to your packaging system. And please
note as well that using it is not the recommended way of dealing
with broken dependencies. Better file a bug report instead.


Cedega on Dapper
April 22nd, 2006.

The .deb package of Cedega will not install on Ubuntu’s Dapper, because of the missing “xlibs” dependency. Lots of workarounds are available on Ubuntu Forums and Transgaming’s support page. “Installing the Breezy version of xlibs” and “converting the .deb into .tgz and back to .deb” are examples of them. I like neither of them.

Introducing “equivs”. With equivs one can create dummy packages used to satisfy the (Debian) package administration. The process of creating a dummy involves two steps: creating a control file, and building the package. After installing this package with dpkg, the system “believes” the software to be installed, an will accept other packages depending on it.


-------------------------------------------------------------

So, let’s create a xlibs dummy package:

# sudo apt-get install equivs
# mkdir $HOME/temp ; cd $HOME/temp
# equivs-control xlibs
# pico xlibs
(contents of xlibs)

Section: misc
Priority: optional
Standards-Version: 3.5.10

Package: xlibs
Version: 6.8.2-77
Maintainer: Your Name

# equivs-build xlibs
# sudo dpkg -i xlibs_6.8.2-77_all.deb

Sunday, June 11, 2006

LAMP. Linux Apache Mono PostgreSQL

ubuntu debian packagement really rocks. just by doing apt-get install or using synaptic package manager i was able to run mono xsp in no time.

i had written my first c# webservices in linux mono today.

next thing to learn is how to install mono from source and use mod_mono (faster than xsp)

and use codebehind, i.e. dll deployment, no source on server (for security reason)

Saturday, June 10, 2006

just setup ubuntu 6.06 last night

tried samba sharing

kailangan pa i-execute sa commandline yung:

smbpasswd -a yourusernamehere


iba pa yung samba password kesa password ng OS

Wednesday, May 31, 2006

Slashdot | Ubuntu 6.06 'Dapper Drake' Beta Available: "Ubuntu is not _just_ for n00bs.

Does a 'n00b' system admin run Debian?
not usually.

Debian is preferred because
(a) 'apt-get' makes life so blindingly simple that you don't need to worry about 90% of the hassels that come with other distros (rpm-hell anyone?)
(b) It's stable
(c) 'It Just Works!' (tm)

Ubuntu is: ALL the best of Debain + Quicker updates.
How long did it take for Debain to support SATA in the stable release? Too damn long!

Ubuntu is not totally user friendly, ie it wasn't untill Dapper that there was a GUI for setting up a pppoe internet connection. (try telling Mom to: open a terminal, type pppoe-conf, and follow the prompts.)
Sounds great on paper.

My mom, Uncle x2, wife, Mother & Father in-laws, and CLIENTS all run Ubuntu because it is easier for me to manage/admin.
I'm not a n00b. I got desperately tired of waiting for Debian Stable. Now I have all the good of Debian + modern packages.
"



The thing that makes Ubuntu the distro to have is that it has a growing "n00b base". This benefits experienced Linux users, because if they are running the same distro as the people they will end up supporting, then the Linux community as a whole becomes stronger and easier for people to get into. Wouldn't it be nice to run the same system as everyone else you know, and still be using Linux?

Sunday, May 14, 2006

This can be applied to programming : )

Jeet Kune Do - Wikipedia, the free encyclopedia:


Bruce Lee's Jeet Kune Do Quotes

  • "The usefulness of a cup is its emptiness". - Be prepared to accept new knowledge and not be hindered or biased by old knowledge.
  • "Using no way as way". - Don't have preconcieved notions about anything.
  • "Having no limitation as limitation". - Don't be confined by anything, achieve true freedom.
  • "From form to formless and from finite to infinite". - Don't be confined by limitations and forms.
  • The consciousness of "self" is the greatest hindrance to the proper execution of all physical action - This is actually a Zen or Chan maxim which means to "be in the moment" and NOT be distracted by your own thought process. The Zen quote is: "If you seek it, you will NOT find it". The "Western" counterpart to this is the term "Being in the Zone".
  • "If people say Jeet Kune Do is different from "this" or from "that," then let the name of Jeet Kune Do be wiped out, for that is what it is, just a name. Please don't fuss over it." - Don't get hung up on labels and parameters. JKD is alive and therefore always changing; don't try to box it in.

Friday, May 12, 2006

Things to learn

* integrate Windows Desktop App to Webservices hosted on Linux's written in Mono C#

* on near future, learn desktop front-end using GTK# or WxWidgets.NET(whichever of the two is more mature for the task) C# under Linux, but need to learn first the good stuffs on VS.NET 2005 System.Windows.Forms

Sunday, April 30, 2006

Minimalist XML. Formula Script Generator

i created this XML to avoid creating database for sql server script generator, this would simplify adding formula to summary tables. code generator is written in c#, c#'s literal string are way too cool for this task :)


<?xml version="1.0" encoding="utf-8"?>

<TableSummary
nbsp;Comment="
nbsp;This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">


<?xml version="1.0" encoding="utf-8"?>

<TableSummary
 Comment="
 This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">


 <ByActualCount>

   <Tables Comment="the following tables have no date:">
     <BranchIndividualMotor/>
     <IndividualMotor/>
     <Motor/>
     <RptOnBranchMotor/>
   </Tables>

   
   <Formulas Comment="formulas of by actual count, no date trailing">
     <InQty>
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
     </InQty>

     <OutQty>
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
     </OutQty>


     <ActualQty>
       (
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
       )
       -
       (
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
       )
     </ActualQty>

     
     <InCost>
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
     </InCost>




   </Formulas>




 </ByActualCount>



 <ByTrailCount>

   <Tables Comment="the following tables have date to facilitate trailing:">
     <RptOnBranchMotorDaily/>
     <RptOnBranchMotorMonthly/>
     <RptOnBranchMotorYearly/>
     <RptOnMotorDaily/>
     <RptOnMotorMonthly/>
     <RptOnMotorYearly/>
   </Tables>

   <Formulas Comment="formulas of bytrail count, with date:">
     <InQty>
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
     </InQty>

     <OutQty>
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
     </OutQty>

     <EndQty Comment="if sql server facilitates nested formula, we can simplify the formula below  with this: BeginQty + InQty - OutQty">

       BeginQty
       
       +
       
       (
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
       )
       
       -
       
       (
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
       )
     </EndQty>


     <InCost>
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
     </InCost>

     <OutCost>
       MPR_D_COST
       + MMB_D_COST
       + MSI_D_COST
       + MSC_D_COST
       + MMN_D_COST
       + MAM_D_COST
     </OutCost>

     <EndCost>
       BeginCost
       
       +

       (
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
       )

       -

       (
       MPR_D_COST
       + MMB_D_COST
       + MSI_D_COST
       + MSC_D_COST
       + MMN_D_COST
       + MAM_D_COST
       )
     </EndCost>

     <InstallmentProfit>
       MSI_D_PRICE - MSI_D_COST
     </InstallmentProfit>

     <CashProfit>
       MSC_D_PRICE - MSC_D_COST
     </CashProfit>

     <RepossessedProfit>
       MAM_D_PRICE - MAM_D_COST
     </RepossessedProfit>

     
     <TotalProfit Comment=
       "InstallmentProfit + CashProfit + RepossessedProfit">


       (MSI_D_PRICE - MSI_D_COST)
       +
       (MSC_D_PRICE - MSC_D_COST)
       +
       (MAM_D_PRICE - MAM_D_COST)

     </TotalProfit>


   </Formulas>


   
 </ByTrailCount>



</TableSummary>