Thursday, November 25, 2010

mysql find duplicate record

I take it from here. Put in my own blog cause I keep using them
http://www.petefreitag.com/item/169.cfm

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

31 May 2011
It turns out these code was pretty awesome when I want to make a dynamic drop down selection
I can make it display unique value and sorted by most use at the top

Thursday, November 4, 2010

Redhat I always use command

Last update, 25 April 2011
This is not only for Redhat, but for most of Linux machine (I think)

Source of this command is from here. I keep using them
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/4/html/Step_by_Step_Guide/s1-manipulate-current.html
http://redhat.activeventure.com/71/gettingstartedguide/s1-managing-working-with-files.html

This is a good reference for VI - Visual Editor (Command line interface for text editor)
http://www.cs.colostate.edu/helpdocs/vi.html

Check folder size
du -hs /path/to/directory


Check harddisk space
df


List all the content within the current folder (or path)
ls OR ls -all


Remove file
rm thefilename.txt


Move file
mv thefilename.txt /home/asipo/


Delete directory and all its content
rm -rf /home/asipo/backupdocuments


Zip a file or folder
zip -r iWantTheZipFileNameToBeLikeThisOkay.zip theActualFileName.txt


Unzip a file (not sure for folder)
unzip thefilename.zip


Change folder owner
chown -R asipo.asigroup '/var/www/smellynomore/app/tmp'


Change folder permission
chmod -R 777 '/var/www/smellynomore/app/tmp'


Copy all except one folder

shopt -s extglob
cp -r A/!(B) dest_dir


Execute bin file
chmod u+x qt-sdk-linux-x86-opensource-2010.05.1.bin
./qt-sdk-linux-x86-opensource-2010.05.1.bin

Connect to server and control it (Telnet / SHH I think)
ssh -p 22 asipi@langit.com.my

Monday, October 11, 2010

Detect keyboard button press

This javascript function is to detect KEYCODE of the keyboard you press.
Note that pressing 'P' will not return 'P' but they will send signal in integer called KEYCODE

This is engineering guys who did it, so we IT guys just follow. Dont questioned

To detect and return what is the KEYCODE for each button. Refer this link
http://help.dottoro.com/ljlkwans.php

Or I give you guys the code, ha

Javascript code
function callSearchPressEnter(event)
{
var keyCode = event.which;
if (keyCode == undefined)
{
keyCode = event.keyCode;
}
alert ("The Unicode key code is: " + keyCode);
}


For the HTML
bla bla bla onkeydown="callSearchPressEnter(event)"

Monday, October 4, 2010

Convert PDF into Excel or Words

I use Able2Extract Pro. Of course I download the Pirate one with the crack

Thursday, September 30, 2010

PHP ' become '

in PHP What happen when I output the string into text file is
The character ' become '

Copy this ' to create this '

' is a html character special code that represent ' symbol
Means it will display correctly as ' if you see it in web browser

Simply solving the problem by html_entity_decode( "'", ENT_QUOTES)

Note that html_entity_decode( "'") will not work
I found this solution in some page (didnt remember the site URL, sorry >.<)

So what is this html_entity_decode(...) function?
It is use to convert special html character into the normal character
Detail was in http://php.net/manual/en/function.html-entity-decode.php

The inverse of it was htmlentities(...)
Detail was in http://www.php.net/manual/en/function.htmlentities.php

Tuesday, September 28, 2010

Software Architecting Success Factors and Pitfalls

My boss give to my email so sharing it with myself

Software Architecting Success Factors and Pitfalls

The top critical success factors for the architecting effort that we have identified are:

The architecting effort must:

* address a strategic business objective of your key sponsor
* have a good lead architect with well-defined role and style
* have a lead architect and architecture team who are able to "sell" (lead); conversely, the organization must be willing to "buy into" (follow)
* contribute immediate value to developers (utilizers of the architecture)

The architecture is more likely to be successful if:

* there are architecture advocates at all levels of the organization
* architecture is woven into the culture
* there is customer involvement/pressure/demand

Critical Success Factors

* Interpersonal and team communication and ownership
* Leadership
* Vision
* Teamwork
* Availability of talent/resources
* Must have strong management sponsorship
* Market/business understanding
* Good match between technology and business strategy
* Customer focus
* Clear specifications including dependencies
* Simple architecture
* Deployed in phases/incrementally
* Architecture is understandable by all
* Solve at least the current problem
* Validation of requirements during each step of the process
* Project management

The architect must have the following skills:

* good domain knowledge
* good communicator/listener
* good persuader
* good project management skills

The architect must

* have a clear and compelling vision
* champion the cause
* provide constructive feedback

Pitfalls

* Poor leadership
* Thinking at too low a level
* Poor communication inside/outside the architecture team
* Not enough "selling"
* Lack of resources/talent
* Poorly designed roles and responsibilities
* Bad design/idea
* Lack of extensibility
* Doesn't solve the project team's problems
* Lack of control/authority
* Requirements unclear, not well-defined, not signed off, changing
* Architecture team loses touch with the product team's problems
* Product team believes "we can solve it better ourselves"
* Development management not penalized for "stalling"
* Politics

PHP display all error on server

If you do the programming in localhost (yours PC) the debugging might be easier
But when uploaded into the server, the error come out (even in localhost is okay)

So you need to debug at the server because only the server have the error. Mostly because of develop in Windows while server in Linux cause the error

So you need these code
Taken from http://www.wallpaperama.com/forums/how-to-display-php-errors-in-my-script-code-when-display-errors-is-disabled-t453.html

I write it here

ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);



I know these can be done in PHP cause I meet the code before, but until now still didnt find the 'easy copy paste' yet. So the tutorial really save my day

these code will display the error (Including Notice)
*Notice is not an error, program can still continue