## SeSim - Stock Exchange Simulator

By | February 19, 2017

Earning money by day trading is considered to be extremely hard. I've often read that about 95% of people who attempt day trading will lose money. This might be true and coincidences with my observations among people I know, because I don't know anybody who is able to make money by day trading.

But who are these 5% of people making money by day trading ? Do they really exist?

Sometimes I believe the only people making money by day trading are people writing about day trading or people teaching other people in day trading or people selling software for day trading or any other people doing things related to day trading but actually don't do day trading.

Do these 5% really exist?
If they exist, they are already rich, for sure, because they are the successful day traders, and if they still keep on day trading, they have a lot of power  to move the market.

So there was the question: What if I was one of these 5%? What if I was mighty? What if I had a nearly  unlimited amount of money? What if I had such a huge amount of money, that my orders will move the market? How does it feel to move the market by placing huge orders? What can I achieve by placing big orders?

Because it's very hard to jump out from the 95%  to the upper 5%  in real live, I decided to write a little piece of software which simulates real live market situations while cheating me into the upper 5% of day traders with a lot of money.

The program is called SeSim - The Stock Exchange Simulator. It is open source. You can download the source code from github. The software is still under development, but basic functionality is already given.

In the future I will write more about it here, how to us it, how to install it.

Stay tuned.

## Day Trading and Commission Fees

By | December 25, 2016

Imagine you were a day trader, and you make in average one trade per day on 200 days a year.
Further imagine you have to pay a commission fee of $10 when buying shares, and again you have to pay a commission fee of$10 when selling shares, which is effectively $20 per trade. So you can simply calculate: You will pay$4,000 per year in commission fees.
Or in other words: You have to make with your trades a profit of at least $4,000 a year to make no losses. And now take a look at your account balance. If you start with$1,000, you have to have a yearly performance of 500%, which would results in a profit of $4,000, only to pay the commission fees. You are only on the winning side, if your performance is better than 500%. If you start with$10,000 you have to raise your account only 40% up ($14,000), to pay the commission fees to make no loss, but still no win. And last: If you start width$100,000, your performance has to be at 4%, to pay the commission fees.

## Hykker Mechanical Keyboard

By | December 23, 2016

A Hykker mechanical keyboard with pretty nice Chinese blue switches illuminates my desktop. It's Christmastime.

## Integer Factorization Using Backtracking with Erlang

By | December 18, 2016

In an earlier post I showed an algorithm to factorize integers using backtracking. The algorithm was implemented in python. Here we have now the same thing in erlang.

To run the code, copy the script and save it to a file named "factorize.erl".

Then enter a shell and compile the module using the following command:

$erlc factorize.erl  Now you can factorize an integer (in our example 129) with this command: $escript factorize.beam 129
[3,43]


It seams, the erlang version is much faster than the python version.

Here is the Erlang code.

Have fun!



-module(factorize).

-export([
main/1
]).

getbit(X, N) ->
(X bsr N) band 1.

setbit(X, N, 1) ->
X bor (1 bsl N);
setbit(X, N, 0) ->
X band (bnot (1 bsl N)).

bitcmp(_I1, _I2, _N, _N)->
0;
bitcmp(I1, I2, N, I)->
B1=getbit(I1, I),
B2=getbit(I2, I),
if
B1 /= B2 ->
B1 - B2;
true ->
bitcmp(I1, I2, N, I + 1)
end.

bitcmp(I1, I2, N) ->
bitcmp(I1, I2, N, 0).

fac_check(I, 1, _I2, P, _Bits) when P == I ->
false;
fac_check(I, _I1, 1, P, _Bits) when P == I ->
false;
fac_check(I, _I1, _I2, P, _Bits) when P > I ->
false;
fac_check(I, _I1, _I2, P, _Bits) when P == I ->
true;
fac_check(I, _I1, _I2, P, Bits) ->
bitcmp(I, P, Bits).

fac_check(I, I1, I2, Bits) ->
fac_check(I, I1, I2, I1 * I2, Bits).

fac_run(I, _I1, _I2, _N, 4) ->
[I];
fac_run(I, I1, I2, N, B) ->
B1 = getbit(B, 0),
B2 = getbit(B, 1),
I1N = setbit(I1, N, B1),
I2N = setbit(I2, N, B2),

R = fac_check(I, I1N, I2N, N + 1),

case R of
true ->
lists:append(factorize(I1N), factorize(I2N));
0 ->
F=fac_run(I, I1N, I2N, N+1, 0),
if
F =/= [I] ->
F;
true ->
fac_run(I, I1, I2, N, B + 1)
end;
_ ->
fac_run(I, I1, I2, N, B + 1)
end.

fac_run(I, I1, I2) ->
fac_run(I, I1, I2, 0, 0).

factorize (I) ->
lists:sort(fac_run(I, 0, 0)).

main(Val) ->
[X]=Val,
R=factorize(list_to_integer(X)),
io:write(R),
io:format("~n").


## Edward Snowdens Cryptic Post

By | August 10, 2016

ffdae96f8dd292374a966ec8b57d9cc680ce1d23cb7072c522efe32a1a7e34b0

## Comparing an IBM Model M Keyboard with an HP C1405A

By | April 16, 2016

IBM Model M Keyboard from 1985

HP Keyboard from somewhere in the 90ies

Today I want to  compare my both favorite keyboards, an IMB Model M from 1985 and an Hewlet Packard keyboard C1405A from the 90ies. Both keyboards have a good  typing sound, a good feedback, both are very heavy wighted,  but I don't want to lose too many words, see yourself, which is the better one. Next I give you two text examples, on typed on the IBM Model M and the other on the HP C1405A.  I have marked them both in different colors, so you can better distinguish them.

This is typed on the IBM Model M keyboard:

The quick brown fox jumps over the lazy dog.

And this is typed on the HP C1405A keyboard:

The quick brown fox jumps over the lazy dog.

Do you see the difference?

## Want to SSH or Telnet into a Cisco Wireless AP with Default Username and Password?

By | March 28, 2016

You probably know, that you can't enable ssh or telnet on a Cisco AP, until you have set a custom password, different from the default credentials ( username = Cisco, password = Cisco).

The Cisco WLC prevents you from that indeed bad practice.

But finally, with AC-Tube, the Open Source CAPWAP AC, you are free to do even this! Because AC-Tube is still in an early development stage, there is no fool proof web interface, where you simply check a box to enable SSH or telent. But if you open an sqlite3 shell and modify the wtpprops table while you have actube running with a  joined AP you get it to work.

Isn't it nice? Isn't it?

## Problems with FTP when Installing FreeBSD

By | February 13, 2016

If you have problems installing FreeBSD using FTP, because you are behind a NAT that doesn't handle FTP properly, simply chose HTTP.

In the "Mirror Selection" dialog select the "Main Site", and then chose "Other":

And now simply replace ftp with http:

The installation should work now.

## Integer Factorization Using Backtracking

By | February 1, 2016

Here is an algorithm, written in Python, to factorize integers, using backtracking. The time consumption should be around  $\mathcal O 2 ^ {\frac n 2}$.
So it's not the fastest one, but it's nice.
To use it, save the code to a file. If you call the file, for example, "factorize.py", then run

python factorize.py <integer to factorize>


Have fun!


import sys
def getbit(i,n):
return (i>>n)&1

def setbit(i,n,val=1):
if val==1:
return i | (1<<n)
return i & (~(1<<n))

def bitcmp(i1,i2,n):
for i in range (0,n):
b2 = getbit(i2,i)
b1 = getbit(i1,i)
if b1!=b2:
return b1-b2
return 0

def fac_check(i,i1,i2,bits):
p = i1*i2
if p>i:
return -3
if p==i:
if i1==1 or i2==1:
return -4
return 10
return bitcmp(i,p,bits)

def factorize_run(i,i1,i2,n):
for b in range (0,4):
i1 = setbit(i1,n,getbit(b,0))
i2 = setbit(i2,n,getbit(b,1))
rc = fac_check(i,i1,i2,n+1)
if rc==10:
return factorize(i1)+factorize(i2)
if rc==0:
f = factorize_run(i,i1,i2,n+1)
if f!=[i]:
return f
return [i]

def factorize(i):
l = factorize_run(i,0,0,0)
l.sort()
return l

fpr = int(sys.argv[1])

print "Factorizing "+str(fpr)+" ..."
rc = factorize(fpr)
print rc



## Don't use Hotmail.com, Live.com, Outlook.com ...

By | January 30, 2016

Have you ever missed an important event, because you haven't got the invitation email, but an invitation email was evidently sent to you?
If so, you are probably using an email address at hotmail.com or outlook.com or in general Microsoft's mail services, also including addresses at live.com and other  domains.

The reason for this is Microsoft's questionably spam protection. When an email arrives at their servers, the email is nearly always accepted, but then, if they think the email came from a server, which sends spam, the email is silently dropped. Neither the sender will ever get a notification, that the email didn't arrive, nor the recipient will be notified, that there was an email for her or him, respectively. The email is not even delivered to the recipients spam folder. The email is lost.
In terms of paper mail:  its the same as the sender brings the paper mail to the post office, the sender pays for a stamp, the post officer accepts the mail, postmarks the mail, and as soon as the sender turns aways from the counter, the post officer throws the mail into the trash under the desk.

So, Microsoft's mail services are not reliable. Silently dropping emails violates RFC 5321 as you can read in chapter 6.1.

If you want to be reachable by email, you must not use Hotmail or any of Microsoft's mail services. You should use Gmail or any other mail service instead, where the sender gets an appropriate error message if an email is not accepted or delivered to the recipient. In case of an error message the sender can take action to fix the problem with the mail server, that might send spam, or the sender can try to contact you over another path, like snail mail or telephone.