- Install Cljr:
- Download cljr-installer.jar from
http://joyofclojure.com/cljr
or here.
- CD into the directory you' ve downloaded.
- java -jar cljr-installer.jar
- Add $HOME/.cljr/bin to your PATH.
(NOTE: Installer puts the Cljr into $HOME/.cljr).
I disliked having Cljr in my Windows home directory.
Also blanks in home directory (i.e. "Documents and Settings")
made problem in cljr.bat in the /bin folder. So, after running
the DynaFrame example, I moved Cljr environment to my favourite
folder. I will explain how I do in another blog entry
- Download book source code from
https://github.com/joyofclojure/book-source/zipball/master.
- Unzip source zipball into your favourite folder.
There would be 3 folders in your favourite folder.
|--<your-joy-folder>
|-- lib
|-- src
|-- test
- Create new folder classes near those 3 folder.
|--<your-joy-folder>
|-- classes
|-- lib
|-- src
|-- test
- Add folders src and classes to Cljr classpath
In cmd command prompt:
cljr add-classpath src <ENTER>
cljr add-classpath classes <ENTER>
You can display the classpath by using cljr list-classpath
- Setup is now complete !!!
- Download cljr-installer.jar from
http://joyofclojure.com/cljr
or here.
- When you want to run examples
- In cmd command prompt:
cd <your-joy-folder> <ENTER> (i.e. cd into sources root, not /src!)
cljr <ENTER>
- Run the examples in Cljr REPL.
If you want to run gui example:
user=> (use 'joy.gui.socks)
nil
user=> (example-gui)
nil
- In cmd command prompt:
10 Şubat 2012 Cuma
Running Joy of Clojure gui code with Cljr environment
I am Clojure beginner and I' ve begun studying
the book The Joy of Clojure.
It is very good book. As the authors mentioned, it is
not for beginners. So, beginners like me
experiencing some difficulties in running
example source codes. Yesterday, I' ve spent
many hours to install Cljr
environment (developed by David Edgar Liebke)
and to run joy.gui.DynaFrame and joy.gui.socks
example. Here' s my solution:
10 Kasım 2010 Çarşamba
Setting up a Clojure environment on Eclipse EE IDE
Menu Help > Install new software…
paste the following urls consecutively into "Work with:" textbox
for Counterclockwise (Clojure plugin)
http://updatesite.counterclockwise.googlecode.com/hg/
for Git plugin
http://download.eclipse.org/egit/updates
for maven plugin
http://m2eclipse.sonatype.org/sites/m2e
24 Mayıs 2010 Pazartesi
Service Locator vs Dependency Injection
Service Locator ile Dependency Injection arasindaki temel fark:
Service Locator' u kullanan user' larin her biri Service Locator' dan kendilerine bir servis sorgulamak zorundadir. Dependency Injection' da ise boyle bir sorgulama yok.
The key difference between the two patterns is about how that implementation is provided to the application class. With service locator the application class asks for it explicitly by a message to the locator. With injection there is no explicit request, the service appears in the application class - hence the inversion of control.
Service Locator' u kullanan user' larin her biri Service Locator' dan kendilerine bir servis sorgulamak zorundadir. Dependency Injection' da ise boyle bir sorgulama yok.
The key difference between the two patterns is about how that implementation is provided to the application class. With service locator the application class asks for it explicitly by a message to the locator. With injection there is no explicit request, the service appears in the application class - hence the inversion of control.
14 Ekim 2009 Çarşamba
Calling External C or Java Procedures From Oracle PL/SQL
Follow this link for detailed documentation:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm
Briefly
Briefly
- Load C procedures or Java Classes
- To load C procedures,
- Set Up the Environment
- set the parameter extproc by default, in the configuration files tnsnames.ora and listener.ora.
- Start a listener process exclusively for external procedures.
- If the agent will run in multithreaded mode, start the
agent using the agent control utility startup command.
In the OS shell prompt:
agtctl startup extproc agent_sid
- Identify the DLL, using CREATE LIBRARY
- Publish the External Procedure, CREATE FUNCTION or CREATE
PROCEDURE. For example:
FUNCTION SEND(Host VARCHAR2, Port VARCHAR2, sMsg VARCHAR2, rMsg IN OUT VARCHAR2 ) RETURN BINARY_INTEGER AS EXTERNAL LIBRARY MYXXXLIB NAME "SendAndReceive" LANGUAGE C PARAMETERS (Host BY REFERENCE, Port BY REFERENCE, sMsg BY REFERENCE, rMsg BY REFERENCE);
- Set Up the Environment
- To load C procedures,
2 Ekim 2009 Cuma
About Turkish Char Encodings
newStr = oldStr.replace("İ", "İ");
newStr = newStr.replace("ı", "ı");
newStr = newStr.replace("Ğ", "Ğ");
newStr = newStr.replace("ğ", "ğ");
newStr = newStr.replace("Ü", "Ü");
newStr = newStr.replace("ü", "ü");
newStr = newStr.replace("Ş", "Ş");
newStr = newStr.replace("ş", "ş");
newStr = newStr.replace("Ö", "Ö");
newStr = newStr.replace("ö", "ö");
newStr = newStr.replace("Ç", "Ç");
newStr = newStr.replace("ç", "ç");
or
newStr = oldStr.replace("İ", "\u0130");
newStr = newStr.replace("ı", "\u0131");
newStr = newStr.replace("Ğ", "\u011e");
newStr = newStr.replace("ğ", "\u011f");
newStr = newStr.replace("Ü", "\u00dc");
newStr = newStr.replace("ü", "\u00fc");
newStr = newStr.replace("Ş", "\u015e");
newStr = newStr.replace("ş", "\u015f");
newStr = newStr.replace("Ö", "\u00d6");
newStr = newStr.replace("ö", "\u00f6");
newStr = newStr.replace("Ç", "\u00c7");
newStr = newStr.replace("ç", "\u00e7");
or
newStr = oldStr.replace("İ", "\xDD");
newStr = newStr.replace("ı", "\xFD");
newStr = newStr.replace("Ğ", "\xD0");
newStr = newStr.replace("ğ", "\xF0");
newStr = newStr.replace("Ü", "\xDC");
newStr = newStr.replace("ü", "\xFC");
newStr = newStr.replace("Ş", "\xDE");
newStr = newStr.replace("ş", "\xFE");
newStr = newStr.replace("Ö", "\xD6");
newStr = newStr.replace("ö", "\xF6");
newStr = newStr.replace("Ç", "\xC7");
newStr = newStr.replace("ç", "\xE7");
23 Eylül 2009 Çarşamba
my favorites for today
NewLISP home http://newlisp.nfshost.com/
- It is an Lisp interpreter, not a compiler.
- It is a new lisp dialect, in my opinion.
- Especially effective for exploiting dynamic, highly asynchronous parallelism, which can be difficult to write in data-parallel or message-passing style
- A highly successful Cilk application is the Cilkchess computer chess program, which won first prize in the Dutch Open Computer Chess Championship in November 1996, and almost defended its title in 1997. Its predecessor *Socrates parallel chess program placed second in the ICCA 8th Computer Chess World Championship in Hong Kong, May 1995.
28 Ağustos 2009 Cuma
Some Ubuntu and FreeBSD tips
- To exit from X11 press Ctrl+Alt+Backspace
- To solve PS/2 mouse problem in Ubuntu:
http://ubuntuforums.org/showthread.php?t=844968
-
FreeBSD network setup:
In sysinstall- If FreeBSD is installed in Virtual PC (or another virtual
desktop solutions)
- run "ipconfig /all" (from Windows) or "ifconfig" (from Linux,
or others)
Take your IP address and change the last part with an unused value
e.g. if ipconfig says that your is IP 10.222.38.5, you can use 10.222.38.100
Use this value as IPv4 Address
- Take the gateway address from "ipconfig in Windows" or "route in
Linux".
Use this value as IPv4 Gateway
- Take the DNS server address from "ipconfig in Windows"
or "cat /etc/resolv.conf in Linux".
Use the first value as Nameserver
You can add the other DNS server adresses into FreeBSD' s "/etc/resolv.conf" file after exiting sysinstall.
- run "ipconfig /all" (from Windows) or "ifconfig" (from Linux,
or others)
- If FreeBSD is installed onto a home computer connected to a
ADSL modem
- Get IP address of your modem, it starts with
"192.168." and ends with ".1" (e.g. 192.168.0.1, or 192.168.2.1)
Use this value as IPv4 Gateway
- take this IP address and change the last part with an
unused value
e.g. if ipconfig says that your is IP 10.222.38.5, you can use 10.222.38.100
Use this value as IPv4 Address
- Get IP address of your modem, it starts with
"192.168." and ends with ".1" (e.g. 192.168.0.1, or 192.168.2.1)
- If FreeBSD is installed in Virtual PC (or another virtual
desktop solutions)
31 Temmuz 2009 Cuma
CVS Client and Server installation on Ubuntu
Before installing the server, install the CVS Client:
sudo apt-get install cvs
Then install the CVS server named "cvsd":
** If yo want to learn why we' ve chosen "cvsd", read this note,
otherwise skip to the step 1 below:
CVS was designed to use "xinetd" to startup service.
But now most Linux distributions do not install xinetd by
default, and configuration of CVS is somewhat complicated.
"cvsd" is a wrapper program for CVS in pserver mode, it can
startup CVS as a standalone daemon, under a special uid/gid
in a chroot jail. It is relatively easy to use cvsd and its
configuration file to setup CVS repositories.
So, we' ve chosen "cvsd" instead of "xinetd"
1. Install the CVS Daemon named "cvsd" :
sudo apt-get install cvsdWhen prompted for Repository, type in "/cvsrepo".
2. There is no need to add new group and new user !!!
In the step1, the group 'cvsd' and the user
'cvsd' have already been created.
3. If this is the last version of cvsd, skip this step.
To update the cvsd:
sudo cvsd-buildroot /var/lib/cvsd4. If the folder /cvsrepo does not exist, then create it.
sudo mkdir cvsrepo5. Set the owner of /cvsrepo to cvsd:cvsd
sudo chownn -R cvsd:cvsd /cvsrepo6. Initialize the repository
sudo cvs -d /var/lib/cvsd/cvsrepo init30 Temmuz 2009 Perşembe
Installing Ubuntu & FreeBSD on the same computer
You can look at
http://forums.freebsd.org/archive/index.php/t-614.html
Briefly, you can choose one of 4 options :
1. (assuming Ubuntu is installed first) Use grub loader. Then add FreeBSD to menu.lst
2. use 3rd party boot managers such as GAG
3. use vmware or other virtual machine software
4. one says that lilo boot manager can easily be configured to support linux and FreeBSD. But grub is preffered by the most of users.
http://forums.freebsd.org/archive/index.php/t-614.html
Briefly, you can choose one of 4 options :
1. (assuming Ubuntu is installed first) Use grub loader. Then add FreeBSD to menu.lst
2. use 3rd party boot managers such as GAG
3. use vmware or other virtual machine software
4. one says that lilo boot manager can easily be configured to support linux and FreeBSD. But grub is preffered by the most of users.
29 Temmuz 2009 Çarşamba
Using Oracle CREATE TABLE
I have prepared an example Oracle "create table" script with those characteristics:
-
compact, using "inline constraints", you can write
more readable scripts. I preferred inline constraints instead
of using "ALTER TABLE xxx ADD (PRIMARY KEY /
CONSTRAINT...)" statements. Using GUI tools to create
those scripts, we can easily miss more readable scripts. -
several constraints such as "multiple column PRIMARY KEY",
"REFERENCES (i.e. Foreign Key", "multiple column FOREIGN KEY", etc. - Options such as "ON DELETE SET NULL"
- Several CHECK constraints
- EXCEPTIONS INTO
- and more...
DROP TABLE sa_dept CASCADE CONSTRAINTS;
CREATE TABLE sa_dept
employee_id
NUMBER(4)
PRIMARY KEY,
last_name
VARCHAR2(10),
email
VARCHAR2(100) NOT NULL UNIQUE,
-- example for foreignkey const. with
-- "different column names"
-- (i.e, sa_dept.job_id = sa_jobs.id)
-- of course, it is better to use the same
-- column names if possible (sa_dept.job_id = sa_jobs.job_id)
job_id
VARCHAR2(9)
CONSTRAINT fk_job
REFERENCES sa_jobs(id),
-- ref. int. constr. with ON DELETE SET NULL
manager_id
NUMBER(4)
CONSTRAINT fk_mgr
REFERENCES sa_employees ON DELETE SET NULL,
-- composite foreignkey constr. + EXCEPTIONS INTO example
hire_date
DATE
CONSTRAINT
FOREIGN KEY (employee_id, start_date)
REFERENCES sa_job_history(employee_id, start_date)
EXCEPTIONS INTO sa_wrong_emp,
-- sa_wrong_emp should exists!
-- CHECK constr. Any boolean expression in
-- parentheses after "CHECK" is valid
salary
NUMBER(7,2)
CONSTRAINT check_sal
CHECK(salary * commission_pct <= 5000),
-- CHECK constr. with BETWEEN. As stated above,
-- any boolean expression in parentheses' after "CHECK" is valid.
commission_pct
NUMBER(7,2)
CONSTRAINT check_divno
CHECK(
BETWEEN10 AND 99)
DISABLE,
-- if we use DISABLE, Oracle defines
-- the constr. but does not enable it.
-- ref. int. constr. with ON DELETE CASCADE
department_id
NUMBER(2)
CONSTRAINT fk_deptno
REFERENCES sa_departments(department_id)
ON DELETE CASCADE
);
Kaydol:
Kayıtlar (Atom)