Posts

Showing posts from 2006
Reasons you should learn other languages like lisp, scheme and haskell
continuations,macros,monads and method pattern matching .... just to name a few

Oracle Sequences and how to create one

Here is how to create a sequence and two of the most popular functions
to use on a sequence.CREATE SEQUENCE <seq_name>
INCREMENT BY <integer>
START WITH <integer>seq_name.NEXTVAL
seq_name.CURRVALExample:
CREATE SEQUENCE MySeq
INCREMENTED BY 1
START WITH 1

is it October 27th yet?

I can't wait to see Laurie, fall is my favorite time of year and miss
when I don't spend it with Laurie

Good Morning Vietnam

Another day is going by, traffic was brutal 2 hours to get to the train station to pick up my friend and coworker brent. Today I am working on data warehousing. Last night I spoke with Laurie I am so proud of her because she is working so hard studying for finals. Down side today I have a dentist appointment and am having a filling replaced with a mold.

Back in NY

I'm back. Took the standard red eye back into NY. Arrived early like
7:20 am my parents were nice enough to pick me up then I went sleep
promptly at 10am. Woke up like 5pm and that was my sunday. On the
upside spoke to my friend arizona.

Another Day in Southern California

Well, I am telecommuting in Southern California again, and am being quite productive with work and Laurie is staying up very late every night to fit more studying in. I am usually in bed before her for work in the morning. My arm has been bothering me again so I have been hitting the pool before work and after work. This is the first time I have been able to do this since the community pool just opened up. Evening have been okay filled with lots or reading and eating dinner with Laurie.

On the reading chopping block have been Atmel AVR Programming, Assembly Language and .net Mobile Programming. Little bit diverse I guess but all embedded programming a lot more embedded than I am used to.

Atmega8 Programming Resources Using GNU GCC

Resources - Great Place to start finding information
http://www.avrfreaks.net/AVRGCC/

From what I am told the best c library and environment to use with AVR's,
Also been told that WinAVR is used in conjunction with AVR Libc

WinAVR
http://winavr.sourceforge.net/

AVR Libc
http://www.nongnu.org/avr-libc/
http://savannah.nongnu.org/projects/avr-libc/

Lisp IDE

If you need a lisp IDE you have 3 good choices

1) Emacs -> lots of programmers use it.
2) Slime -> recommended, live interaction with lisp run time.
3) Allegro CL IDE - Commercial Lisp Product

Good Weekend in Manhattan

I enjoyed this weekend and celebrated my mom's birthday. I went to
Manhattan to treat my Mom and Dad to brunch at the boat house. Then
walked around the city with my parents and friend Brent. Saw the Top
of the Rock ( Much better view than Empire State Building with no
lines). Other than that spent some time relaxing, watching Underworld
Revolution and Studying atmel programming working on a Atmega8
Schematic. Now on to the wonderful work week

Fetotomy Defined

Well today Laurie has to do a Fetotomy in school and now am learning something new. A Fetotomy is when you have to remove a dead baby cafe from the mother cow surgically.

In Memory of the Crocodile Hunter

Me and Laurie were getting back from San Francisco and was about 4am the day Steve Irwin Died, Laurie room mate pointed it out to us. At that moment it didn't bother me very much because I was so tired. But it hit me the next day and since them has really bothered me. I am not sure if it's because he has little kids or such a giving person to the world through his conservation and teaching efforts. Either way the world lost a great man, and I wonder who will carry on his legacy.

http://www.crocodilehunter.com/

The family wants people to give to his charity Wild Life Warriors if you want to give in his memory.
http://www.wildlifewarriors.org.au/

RIP Steve Irwin you were a good man!

Stable

Think my cold has stableized and isn't getting worse I think that it's a good thing. But getting better is slow work.

Visiting Southern California

I love it every time I get to visit Laurie in SoCal. This time started off good, Spent time studying with Laurie. Then right after I arrived I caught a cold, I feel like dirt right now. It's so much harder being sick and telecommuting for work than being sick in the office especially because your under the gun to produce and all I want to do is crawl under a rock and die. On a brighter note, this past weekend I got to hang with an old SigEp Buddy of mine Craig Reiser

I am hoping my luck will change by the end of the week

Peace
Steve

Lauie is back as school

It's been a long and great summer having Laurie home for the summer. I am not looking forward to another year of flying back and forth to California. Already I have bought my first two tickets to Ontario Airport on JetBlue. By the way JetBlue is great but flights are usually late just about every other trip I take to the west coast. Better get back to work.

JBoss NestedSQLException No ManagedConnections

org.jboss.util.NestedSQLException: No ManagedConnections

http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigJCACommon

JBoss
Pooling parameters

* - whether separate subpools should be created for connections inside and outside JTA transactions (default false)
* - the minimum number of connections in the pool (default 0 - zero)
* - the maximum number of connections in the pool (default 20)
* - the length of time to wait for a connection to become available when all the connections are checked out (default 5000 == 5 seconds, from 3.2.4 it is 30000 == 30 seconds)
* - the number of minutes after which unused connections are closed (default 15 minutes)
* - whether the connection should be "locked" to the transaction, returning it to the pool at the end of the transaction (default true for Local, false for XA)

http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html
A.2.6. Too many connections

If you get a Too many connections error when you try to connect to…

Remote Java Debugging

java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:8000 com.debug.Run
jdb -attach 127.0.0.1:8000

http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html


JBoss
set JAVA_OPTS= -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,
server=y, suspend=n %JAVA_OPTS%

http://www.onjava.com/lpt/a/6174

NetBeans - adding extra folders

If you would like to add extra folders to your netbean project just add this
in this example web is a subdirectory of the project base directory.

<view>
<items>
<source-folder style="tree">
<label>Web Pages</label>
<location>web</location>
</source-folder>

Just a few links on Javascript

document.layers
e.style.zIndex

Javascript frameworks
http://script.aculo.us/
http://prototype.conio.net/

Dom Inspectors/Javascript Debuggers
http://script.aculo.us/
http://slayeroffice.com/tools/modi/v2.0/modi_help.html

Drag
http://www.brainjar.com/dhtml/drag/

ToCopy
http://www.blogger.com

Some cross browser javascript examples

//firefox only
slot = childNodes[j].textContent;
//Cross browser
slot = childNodes[j].firstChild.nodeValue;

//ie and firefox
attrvalue.value = products[i].sku;
attrname.value = products[i].sku;

//ie, firefox and safari
attrvalue.nodeValue = products[i].sku;
attrname.nodeValue = products[i].sku;

Javascript Dom access attributes cross browser

Works on ie and firefox not safari
activateSlot(slots[this.firstChild.attributes['id'].value].slot);

Works on all three(firefox,safari and ie)
activateSlot(slots[this.firstChild.getAttribute('id')].slot);

Javascript debugging Safari

Run this on the command line to enable Javascript debugging in Safari
defaults write com.apple.Safari IncludeDebugMenu 1
Dynamically including javascript in a web page
Aka: Ajax loading of javascript, runtime loading

AJAX Response 1: req1.reponseText, req1.responseXML

<script>
alert("worked");
</script>

AJAX Response 2: req2.responseText

alert("worked");


Footnote is that the body tag could be swapped with the head tag.
for scripts to work they have to be place in either the body or head tags

//Example 1 doesn't work

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
bodyElement.innerHTML = req1.responseText + bodyElement.innerHTML ;

//Example 2 doesn't work

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
bodyElement.appendChild(document.importNode(req1.responseXML.documentElement,true));

//Example 3 works

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
var script = document.createElement("script");
script.setAttribute("language…

Dynamically including javascript in a web page

Dynamically including javascript in a web page
Aka: Ajax loading of javascript, runtime loading

AJAX Response 1: req1.reponseText, req1.responseXML

script
alert("worked");
/script

AJAX Response 2: req2.responseText

alert("worked");


Footnote is that the body tag could be swapped with the head tag.
for scripts to work they have to be place in either the body or head tags

//Example 1 doesn't work

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
bodyElement.innerHTML = req1.responseText + bodyElement.innerHTML ;

//Example 2 doesn't work

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
bodyElement.appendChild(document.importNode(req1.responseXML.documentElement,true));

//Example 3 works

var body = document.getElementsByTagName("body");
var bodyElement = body.item(0);
var script = document.createElement("script");
script.setAttribute("language","jav…

How to create a core dump

>gcc -o null.exe null.c ; null.exe
//c program that I found on the net that will cause a core dump
//file null.c
int a (int *p);

int
main (void)
{
int *p = 0; /* null pointer */
return a (p);
}

int
a (int *p)
{
int y = *p;
return y;
}
Here are two other ways to create core dumps
>gcc -o crash.exe crash.c ; ./crash.exe
//file crash.c
int main(int argv,char *argc) {
int *numdie;
numdie[23] = 23;
}

>gcc -o sleep.exe sleep.c | ./sleep
//file sleep.c
#include
int main(int argv,char *argc) {
sleep(10000);
}

In another terminal
>ps aux | grep sleep.exe
replace pid with the pid you find from the previous command
pid will be a number in the second column
>kill -SIGV pid

if you see an error like
No core dump was created
>Bus error
An error like this means a core dump was created
>Bus error (core dumped)


>ulimit -c #will print the current core file max size
>ulimit -c unlimited to make it unlimited
#ulimit
# -c The maximum size of core files created.
Usually the core files are…

Is It "2>&1 file" or "> file 2>&1"? Why?

8.13 Is It "2>&1 file" or "> file 2>&1"? Why?

One of the common questions about the Bourne and Korn shells is why only the second command will redirect both stdout and stderr (13.1) to a file:

$ cat food 2>&1 >file
cat: can't open food
$ cat food >file 2>&1
$

Although lots of sh manual pages don't mention this, the shell reads arguments from left to right.

1.

On the first command line, the shell sees 2>&1 first. That means "make the standard error (file descriptor 2) go to the same place as the standard output (fd1) is going." There's no effect because both fd2 and fd1 are already going to the terminal. Then >file redirects fd1 (stdout) to file. But fd2 (stderr) is still going to the terminal.
2.

On the second command line, the shell sees >file first and redirects stdout to file. Next 2>&1 sends fd2 (stderr) to the same place fd1 is going - that's to the file. And that's …

bash loop through parameters

for i in $*
do
#will echo all the variable passes as parameters
echo $i
done

bash getopts example

while getopts ":c:sd" Option
# Initial declaration.
# c, s, and d are the flags expected.
# The : after flag 'c' shows it will have an option passed with it.
do
case $Option in
# w ) CMD=$OPTARG; FILENAME="PIMSLogList.txt"; TARGET="logfiles"; ;;
s ) PORT=20 ;;
d ) DEBUG=true ;;
c ) CMD=$OPTARG ;;
* ) echo "Not recognized argument"; exit -1 ;;
esac
done
shift $(($OPTIND - 1))

to install and remove System-V style init script links

update-rc.d is the Debian utility
chkconfig is the Red Hat utility

Debian package commands

# apt-get check # update cache and check for broken packages
$ apt-cache search pattern # search package from text description
$ apt-cache policy package # package priority/dists information
$ apt-cache show -a package # show description of package in all dists
$ apt-cache showsrc package # show description of matching source package
$ apt-cache showpkg package # package information for debugging
# dpkg --audit|-C # search for partially installed packages
$ dpkg {-s|--status} package ... # description of installed package
$ dpkg -l package ... # status of installed package (1 line each)
$ dpkg -L package ... # list filenames installed by the package

Referenced from http://www.debian.org/doc/manuals/reference/ch-package.en.html

Check for a pid in bash with out pgrep

pid_check() {
local PID=$1
local i
for i in `ps ax | awk 'BEGIN { FS = "[ \t]+" } ; { print $1 ;print $2 }'| grep $PID`; do
if [ "$PID" -eq "${i:=''}" ] ; then
echo "Matched $PID"
return 0;
fi
echo "$i"
done
return 1;
}

pid_check 1068

New Years Picture

Image
Here is a good picture from new years

Just passed the 100 post mark

Just passed the 100 post mark, see you at the 200 post mark

'Sleeping on it' best for complex decisions

Complex decisions are best left to your unconscious mind to work out, according to a new study, and over-thinking a problem could lead to expensive mistakes.The research suggests the conscious mind should be trusted only with simple decisions, such as selecting a brand of oven glove. Sleeping on a big decision, such as buying a car or house, is more likely to produce a result people remain happy with than consciously weighing up the pros and cons of the problem, the researchers say.
more ...
http://www.newscientist.com/article.ns?id=dn8732&feedId=online-news_rss20
#!/usr/bin/python
print "Hex"

li = []
for i in range(128,256) :
li.append(hex(i))
for i in range(0,128) :
li.append(hex(i))

javastring = "String bytelookup = { "
for i in li :
javastring = javastring + "\""+ i +"\"" + ", "


javastring = javastring[0:-2] + " }"

print javastring

Arizona is in town

My friend Chris Taylor (aka Zona) is in town, it's a good week. Also I am busy building planogramming software for my company.

A new year

The last six months have been very hard for me personally, but getting stronger, more independent. I can be very impatient, and have a hard time figuring out what I want out of life and work. Things are becoming clearer and find that simple things in life really make me happy, being around people, clear things to do, building new things, the gym and being just around Laurie. Commuting by car or plane is not one of them. This year is going to bring change just like last year did that's the only thing I can be sure of other than Loving Laurie. I am hoping to be able to cut through some of the bull in my head a be a more productive creator, mostly in the programming arena. Good luck everyone and have a happy new year.

Steve