Thursday 17 June 2010

List of web builder for e-Commerce FREE

Famous:
http://www.oscommerce.com/
http://www.zen-cart.com/


Well-known (I like this):
http://virtuemart.net/home/demo


Good to have (Not clear either e-commerce or cart-only):
http://sourceforge.net/projects/profbiz-cart/
https://www.storesprite.com/secure/download.php
http://mymarket.sourceforge.net/

Chart Only:
http://www.unibia.com/unibianet/super-simple-shopping-cart-php

Checking http protocol over telnet

This summary is not available. Please click here to view the post.

Tuesday 15 June 2010

C++ pointer

& is reference operator
* is deference operator

<><><><><><><>

int p=10; assuming p address is 1200.
so &p is 1200 and p is 10. In this case : & = address of

<><><><><><><>

POINTER

int * q
q = &p ==> q is containing address!
*q = 11 ==> *q is containing value, in this case : * = value pointed by

Important :
int * q and *q, those 2 * (stars) have diffrent meaning.
One is denotes a pointer (not variable nor constant value).
One is deference operator.

><><><><><><><

End result : p is 11.

Excerpt from : http://www.cplusplus.com/doc/tutorial/pointers/

Monday 14 June 2010

C++ common pitfall

czz61240@LMPH8MF:~/testing123$ g++ -Wall a -o z
/usr/bin/ld:a: file format not recognized; treating as linker script
/usr/bin/ld:a:1: syntax error
collect2: ld returned 1 exit status

>>>>>>>>>>>>>> Because a does not have .c extension, should be a.c


czz61240@LMPH8MF:~/testing123$ gcc a.c -o z
a.c:3:20: error: iostream: No such file or directory
a.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
a.c: In function ‘main’:
a.c:9: error: ‘cout’ undeclared (first use in this function)
a.c:9: error: (Each undeclared identifier is reported only once
a.c:9: error: for each function it appears in.)


>>>>>>>>>>>>>>> Because iostream (successor of iostream.h) is C++ header, so must use g++ compiler.

Friday 11 June 2010

Email : reply-to in headers

IDEA : recipient will reply to specific address, not the sender.

Note: in headers email, X-parameter denotes this parameter is inserted by human.


>>>>>>>>>
To add the Reply-To header to an email, you need to use the MailMessage.Headers property. For example:

mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com")

The following code snippet demonstrates this technique.

[ C# ]

MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com" );
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );


[ VB.NET ]

Dim mail As New MailMessage()
mail.To = "me@mycompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.Body = "this is my test email body."
mail.Headers.Add("Reply-To", "alternate_email@mycompany.com")
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)


Reference : http://www.systemwebmail.com/faq/2.7.aspx


LOTUS NOTES:

In new email creation, go to delivery options - advance - reply this memo to.....

Thursday 10 June 2010

Jython to check the Q numbers in JMS

su - wasown -c /applications/WebSphere/AppServer/6.0.0.0/profiles/XXX/bin/wsadmin.sh -lang jython -f /home/wasown/listQueueDepth_WAS60.jy --v


the listQueueDepth_WAS60.jy :

4:root@defrqap100mssxm:/opt/XXX/jms # cat /home/wasown/listQueueDepth_WAS60.jy
import sys
import os
import time
from java.util import *

# global DEBUG setting: 1 = active, 0 = disabled
DEBUG=0

##
## In this sequence, define the partial names of SIB destinations you are interested in!
##
_sibusName = "Saturn_JMS_Bus"
_myDests = ( '_SYSTEM.Exception', 'JMS' )


###########################################################################
###########################################################################
###
### FUNCTIONS
###
###########################################################################
###########################################################################


#get the command line
def _getScriptName():
p = java.lang.System.getProperties();
keys = p.keys();

while( keys.hasMoreElements() ):
name = keys.nextElement()
# print "Property: ", name," - ",
# print java.lang.System.getProperty(name)
return "not implemented in WAS6.0's jython versio!n"


# returns a timestamp string e.g. "2009.01.01 23:47:59"
def getCurrentTimeStamp():
timeArray = time.localtime(time.time())
tstmp = str(timeArray[0]) + '.' + str(timeArray[1]).zfill(2) + '.' + str(timeArray[2]).zfill(2)
tstmp = tstmp + ' ' + str(timeArray[3]).zfill(2) + ':' + str(timeArray[4]).zfill(2) + ':' + str(timeArray[5]).zfill(2)
return tstmp

# returns the name part from any MBean identifier string
# MBean id strings look like:
# "WebSphere:name=JMSTestOutboundQueue,process=server1,platform=dynamicproxy,node=esbNode,SIBus=MediaBus,......"
#
def getNameFromMBeanID(mbeanId):
t1 = mbeanId.split('name=')
t2 = t1[1].split(',')
return t2[0]

def usage(scriptname):
options = "--h --v --d "
print "\n\nusage: ",scriptname, options
print ""
print "\t d secs if is not specified, program exits after one iteration."
print "\t Otherwise it will run forever, sleeping for seconds between iterations."
print "\t v verbose mode for better (human) readability. Non verbose means CSV list output."
print "\t "
print "\n\n"


### MAIN
#
#
#



###############################################################
## getopt start

args = sys.argv
if (DEBUG > 0):
print "len argv = ", len(args)
print "args = ",args
print "-----"



sleepTime = -1
verbose = 0

# process single (toggle) args first
#
argscopy = args[:]

for i in range(0,len(argscopy)):
if (argscopy[i] == "--h"):
print "HELP"
args.pop(i)
usage("")
sys.exit(0)
elif (argscopy[i] == "--v"):
args.pop(i)
verbose = 1

# process parameter args next: e.g. "--d 120"
#
if ((len(args) % 2 ) == 1): args.append(" ")
if (DEBUG > 0):
print "remaining args are:",args

argscopy = args[:]
for i in range(0,len(argscopy),2):
opt = argscopy[i]
val = argscopy[i+1]
if (DEBUG > 0): print "option: ", opt, " - value: ",val
if (opt == "--d"):
sleepTime = val
args.pop(i)
args.pop(i)

if (DEBUG > 0):
print "dbg: cmdline options found:"
print "dbg: sleepTime:",sleepTime
print "dbg: verbose :",verbose
print ""

if (len(args) > 0):
print "unprocessed args: ",args
print

## getopt end
###############################################################


# AdminControl.queryNames() output strings look like this:
#
# WebSphere:name=JMSTestOutboundQueue,process=server1,platform=dynamicproxy,node=esbNode,SIBus=MediaBus,version=6.1.0.23,
# ID=4BF5F7FBBD2C16D3F7D10B5B_QUEUE_10000005,type=SIBQueuePoint,mbeanIdentifier=com.ibm.ws.sib.admin.impl.JsQueuePoint,
# cell=esbCell,spec=1.0,SIBMessagingEngine=esbNode.server1-MediaBus
#

# retrieve all SIBQueuePoints
#
allSIBusDestinations = AdminControl.queryNames("WebSphere:*,type=SIBQueuePoint,SIBus=" + _sibusName).split()

# container for the QueuePoints we are interested in
matchedDests = []


for destMBeanId in allSIBusDestinations:
destName = getNameFromMBeanID(destMBeanId)
if (DEBUG > 0): print "dbg: found destination: ", destName
#
# see if we are interested in this particular SIBus destination
for m in _myDests:
## if (m == destName):
if (destName.startswith(m)):
matchedDests.append(destMBeanId )
# end if
# end for
# end for
if (DEBUG > 0): print ""



# begin CSV output

if (verbose == 0):
# print header row
print "time",",",
for i in matchedDests:
qname = getNameFromMBeanID(i)
print qname,",",


# print data rows
while (1):
print
if (verbose == 0):
print getCurrentTimeStamp(),",",

for d in matchedDests:
print AdminControl.getAttribute(d, "depth"),",",
else:
print getCurrentTimeStamp()
print "-------------------"
for d in matchedDests:
print AdminControl.getAttribute(d, "identifier")+":",
print AdminControl.getAttribute(d, "depth")
## print AdminControl.getAttribute(d, "state")

if (sleepTime == -1):
print ""
sys.exit(0)

time.sleep(int(sleepTime))

Wednesday 9 June 2010

RMI, IIOP, CORBA vs DCOM, RPC

Java Tech Client - Server Process connection

RMI is remote method invocation

CORBA is general tech/architecture, ORB = object request broker (interface to communicate with others P language)

IIOP is CORBA's protocol. CORBA IIOP has its own IDL (I... definition language).

RMI over IIOP is to run RMI to overcome the other P language, so that you dont need to learn the IIOP special language.



Windows Tech

DCOM - Distributed COM : is CORBA in windows

RPC : remote procedure call : the technology connected client and server, there is a spesial dll, called for example : rpcrt4.dll. Some application uses this dll as the interface. This to overcome a developer to create their own dll in their own language.

RPC/IP : used by exchange server and outlook client
RPC/HTTP : used by exchange server and outlook client which has slow connection


Unix Tech
Open Group’s Distributed Computing Environment (DCE) : RPC in UNix


Conclusion:
I would say the DCOM+RPC is equal to CORBA+IIOP.

Reference: http://technet.microsoft.com/en-us/library/cc787851(WS.10).aspx

Unix trick : ctrl - r and ctrl - s

Tips and tricks

ctrl - r ==> find reverse command in history
ctrl - s ==> ctrl - r in forward direction
if ctrl - s does not work : type stty -ixon beforehand.
Keep in mind those command can be pushed over and over again till you find what you want.


alt > ==> repeat cmd from last line in history
alt < ==> repeat cmd from first line in history

In VI:
type r ==> to replace a character after the cursor.
type R ==> to replace some characters after the cursor.

Monday 7 June 2010

process affinity processor

Linux:


xx@XX:~$ chrt --help
chrt (util-linux-ng 2.14.2)
usage: chrt [options] [prio] [pid | cmd [args...]]
manipulate real-time attributes of a process
-b, --batch set policy to SCHED_BATCH
-f, --fifo set policy to SCHED_FIFO
-i, --idle set policy to SCHED_IDLE
-p, --pid operate on existing given pid
-m, --max show min and max valid priorities
-o, --other set policy to SCHED_OTHER
-r, --rr set policy to SCHED_RR (default)
-h, --help display this help
-v, --verbose display status information
-V, --version output version information

You must give a priority if changing policy.
Report bugs and send patches to


xx@XX:~$ taskset -pc 1 32752
pid 32752's current affinity list: 0
pid 32752's new affinity list: 1



xx@XX:$ taskset --help
taskset (util-linux-ng 2.14.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process

-p, --pid operate on existing given pid
-c, --cpu-list display and specify cpus in list format
-h, --help display this help
-V, --version output version information

The default behavior is to run a new command:
taskset 03 sshd -b 1024
You can retrieve the mask of an existing task:
taskset -p 700
Or set it:
taskset -p 03 700
List format uses a comma-separated list instead of a mask:
taskset -pc 0,3,7-11 700
Ranges in list format can take a stride argument:
e.g. 0-31:2 is equivalent to mask 0x55555555


xx@XX:$ pidstat
Linux 2.6.28-11-generic (XX) 06/07/2010 _i686_ (2 CPU)
01:44:27 PM PID %usr %system %guest %CPU CPU Command
01:44:27 PM 1 0.00 0.00 0.00 0.00 0 init
01:44:27 PM 3 0.00 0.00 0.00 0.00 0 migration/0
01:44:27 PM 4 0.00 0.05 0.00 0.05 0 ksoftirqd/0
01:44:27 PM 6 0.00 0.00 0.00 0.00 1 migration/1

pmap ==> pmap - report memory map of a process

strace ==> strace - trace system calls and signals



WINDOWS:

start cmd_process (you can set the cpu affinity)
taskmgr (you can change the cpu affinity)