Oct 142011
 

If you like the Singleton Pattern checkout this post by Daniel R.
There are 3 Methods discussed, achieving the goal to use the Singleton Pattern in ActionScript 3.

I prefer the third method, this worked out very well for me, so far ;)

package
{
	public final class Singleton
	{
		private static var instance:Singleton = new Singleton();

		public function Singleton()
		{
			if( instance ) throw new Error( "Singleton can only be accessed through Singleton.getInstance()" );
		}

		public static function getInstance():Singleton
		{
			return instance;
		}
	}
}
Sep 212011
 

Sometimes you need to identify the tempfile usage because temp is eaten up quickly by a large statement. To get a clear look into the tempfiles just use the following statement and you can easily see the program/user/session using all your assigned tempspace.

SELECT su.TABLESPACE
   ,su.segfile#
   ,su.segblk#
   ,ROUND(((su.blocks * pa.VALUE) / 1024),2) size_kb
   ,ROUND(((su.blocks * pa.VALUE) / 1024 / 1024),2) size_mb
   ,s.SID
   ,s.serial#
   ,s.username
   ,s.osuser
   ,s.program
   ,s.status
FROM v$session s
   ,v$sort_usage su
   ,v$process p
   ,v$parameter pa
WHERE pa.NAME = 'db_block_size'
   AND s.saddr = su.session_addr
   AND s.paddr = p.addr
ORDER BY su.TABLESPACE
   ,su.segfile#
   ,su.segblk#
   ,su.blocks;
Aug 242011
 

Yesterday a teammate sended me a very nice part out of an article about calculating Oracle’s “undo_retention”. Sadly I do not know the real author but I found these two references at the internet:

The Article contains 2 very useful statements for the undo calculation:

Needed UNDO Size in MB

SELECT
ROUND(d.undo_size/(1024*1024),2) "ACTUAL UNDO SIZE [MByte]",
SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]",
ROUND((TO_NUMBER(e.value)*TO_NUMBER(f.value)*g.undo_block_per_sec)/(1024*1024),2) "NEEDED UNDO SIZE [MByte]"
FROM
(
SELECT
SUM(a.bytes) undo_size
FROM
v$datafile a,
v$tablespace b,
dba_tablespaces c
WHERE
c.contents = 'UNDO'
AND c.status = 'ONLINE'
AND b.name = c.tablespace_name
AND a.TS# = b.TS#
) d,
v$parameter e,
v$parameter f,
(
SELECT
MAX(undoblks/((end_time-begin_time)*3600*24))
undo_block_per_sec
FROM
v$undostat
) g
WHERE
e.name = 'undo_retention'
AND f.name = 'db_block_size'
;

Optimal UNDO Retention in seconds

SELECT
ROUND(d.undo_size/(1024*1024),2) "ACTUAL UNDO SIZE [MByte]",
SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]",
ROUND((d.undo_size/(TO_NUMBER(f.value)*g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION [Sec]"
FROM
(
SELECT
SUM(a.bytes) undo_size
FROM
v$datafile a,
v$tablespace b,
dba_tablespaces c
WHERE
c.contents = 'UNDO'
AND c.status = 'ONLINE'
AND b.name = c.tablespace_name
AND a.TS# = b.TS#
) d,
v$parameter e,
v$parameter f,
(
SELECT
MAX(undoblks/((end_time-begin_time)*3600*24))
undo_block_per_sec
FROM
v$undostat
) g
WHERE
e.name = 'undo_retention'
AND f.name = 'db_block_size'
;
Aug 082011
 

2 month ago, I decided to participate at the FXCM – Trading Championship June 2011 on myfxbook. I traded manually and used my pivot point indicator, released some posts before. There were some really good entrys and I ended up at rank #78 what I think is great! Besides, I finished as the best german participant :D

Sadly, I can’t show you some screenshots because they immediatly closed all the contest accounts after the challenge ends.
Next time I will make some shots directly during trading *promise* :)

Watch my contest account.

May 102011
 

You know Pivot Points?
If not checkout babypips.com -> School -> Pivot Points.

I’ve written this Pivot Points Indicator to use PP’s in MetaTrader4 Charts or in Expert Advisors.

Parameters

iMode – Choose the calculation mode. Default: 0

0 => Standard

The calculation for a pivot point is shown below:
Pivot point (PP) = (High + Low + Close) / 3
Support and resistance levels are then calculated off the pivot point like so:
First level support and resistance:
First resistance (R1) = (2 x PP) - Low
First support (S1) = (2 x PP) - High
Second level of support and resistance:
Second resistance (R2) = PP + (High - Low)
Second support (S2) = PP - (High - Low)
Third level of support and resistance:
Third resistance (R3) = High + 2(PP - Low)
Third support (S3) = Low - 2(High - PP)

1 => Woodie

R2 = PP + H - L
R1 = (2 X PP) - Low
PP = (H + L + 2C) / 4
S1 = (2 X PP) - High
S2 = PP - High + Low

2 => Camarilla

R4 = C + ((H-L) x 1.5000)
R3 = C + ((H-L) x 1.2500)
R2 = C + ((H-L) x 1.1666)
R1 = C + ((H-L) x 1.0833)
PP = (H + L + C) / 3
S1 = C - ((H-L) x 1.0833)
S2 = C - ((H-L) x 1.1666)
S3 = C - ((H-L) x 1.2500)
S4 = C - ((H-L) x 1.5000)

3 => Fibonacci

R3 = PP + ((H - L) x 1.000)
R2 = PP + ((H - L) x .618)
R1 = PP + ((H - L) x .382)
PP = (H + L + C) / 3
S1 = PP - ((H - L) x .382)
S2 = PP - ((H - L) x .618)
S3 = PP - ((H - L) x 1.000)

iBasePeriod – Choose the Base Period (TimeFrame). Default: 1440 (H1)

With this parameter you can apply the H1 Pivot Points for example to a M5 chart.
You are selecting the Base Period for the Pivot Points. If you like to see the Weekly Pivot Points enter 10080.
More about TimeFrames you can find at MQL4 Reference -> Standard constants -> Timeframes.

iShift – Choose the indicator shifting. Default: 1

Normally PP where calculated with the prices of the day before. Changing iShift to 2 will
use current day-2 for calculation.

Example

Scratchs Pivot Points - Daily Pivot Points in a H1 chart

Scratchs Pivot Points - Daily Pivot Points in a H1 chart

Download
Scratchs_PivotPoints.mq4 (Creative Commons License This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Germany License.)

Mar 242011
 

The way I install Git on Windows.

Mar 092011
 

To change the portable git gui language to english just add “@set LANG=en” at the top of git-cmd and/or git-bash.

Example:

@echo off

@set LANG=en

rem Copyright (C):  2001, 2002  Earnie Boyd
rem   mailto:earnie@users.sf.net
rem This file is part of Minimal SYStem
rem   http://www.mingw.org/msys.shtml
rem
...
Feb 272011
 

I tried to setup Git on my windows machine the last days (maybe weeks) and it was really anoying. There are many tutorials out there for many different setups, but it still was a bit tricky. This will just be another tutorial, but this was working for me …

Step 1

Download and install Git @ git-scm.org (I used Git-1.7.4-preview20110204.exe) you need this for the server and later for the client, too.
I prefer to use the Explorer-Integrated Git-Bash.

Step 2

Download Apache and all you need to configure SSL.
I used the bundle (xampp-win32-1.7.4-VC6.zip) available on apachefriends.org, because it is easy to install and we can jump right into the configuration.
Just unpack the .zip-File to C:\

Step 3

Goto “C:\xampp\htdocs” and right-click on the folder to open the Git-Bash.

git init --bare test.git
cd test.git
git update-server-info

Now we have created an empty server repository.

Step 4

Goto “C:\xampp\apache\conf” and edit the httpd.conf file.

LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so

Activate the dav modules by uncommenting.

DavLockDB "/xampp/apache/logs/Dav.Lock";

<Directory "C:/xampp/htdocs/test.git">
   # Enable WebDAV
   Dav On

   # Authentication
   AuthType Basic
   AuthName "test.git"
   AuthUserFile "C:/xampp/apache/conf/htuser.git"
   AuthGroupFile "C:/xampp/apache/conf/htgroup.git"

   # All users from group test can access
   Require group test

   # Refuse .htaccess-Files
   AllowOverride None

   # Allow List dir
   Options Indexes

   # Acces only with SLL
   SSLRequireSSL
</Directory>

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On

Now the test.git repository is only available for the users in group test.

Step 5

Now you can start your Apache and switch to the client.
To clone the repository just type:

git clone https://user@mydomain.com/test.git/

Be sure that you don’t forget the trailing slash!

Now we will enter the repository, adding a file, commit our changes and upload the new version to our git repository.

# Enter repository
cd test.git
# Create file foo.txt
echo foo > foo.txt
# Add foo.txt ot our local repository
git add foo.txt
# Commit changes
git commit -m "Adding foo.txt"
# Push changes to our remote repository
git push origin master

Done.