Monthly Archives: May 2014

First year of blogging – summary

1st year stats

Today is my small anniversary: in May 31, 2013 I wrote my first blog post. Since that day I wrote 54 blog posts (this is 55th), which is 1 post per week in average. According to Google Analytics, my blog was visited by 810 users. Is it good?

When I started blogging, this blog was hosted by Webio.pl. Now, it is on Azure. My primary domain is jj09.net. I have also two alternative domains:

This blog helps me to summarize stuff I am working on. Additionally, it helps me to improve my writing. I think I am less anonymous in Passionate Programmers World now. Occasionally I am finding my blog listed on some websites. My post about Multithreading in C# and Java was listed on Geek Reading.

I do not have any specific plans for the second year. I am graduating from Kansas State University in August and I am about to start a new job in September. This, along with moving to a different city will be the biggest challenge in this year.


Transferring domain (from Webio to GoDaddy)

Recently, I purchased new domains at GoDaddy. I decided to transfer my existing domain jj09.net to GoDaddy as well. I thought it would be easy. However, I have never done this before.

Making long story short, here are steps to accomplish the transfer:

  1. Request the current registrar (in my case: Webio) to remove Privacy Protection and Theft Protection
  2. Request the current registrar (in my case: Webio) to give you authinfo code
  3. Start domain transfer at GoDaddy
  4. You should receive Transaction ID and Security code from the current registrar (requested by GoDaddy)
  5. Authorize transfer at GoDaddy using:
    • Transaction ID
    • Security Code
    • Authinfo code

After that it should take around 7 days to perform the transfer. I received e-mail (from current registrar) that the transfer will be performed in a few days if I do not cancel it. It is some sort of theft protection. In your case (if you have different registrar) it may be different. E.g. you may need to confirm the transfer.

The best way is to contact you current registrar and destination registrar about the specific instructions. That’s what I did and both was very nice and helpful.

EDIT: Do not forget to change Nameservers and DNSes on GoDaddy after transfer is completed 😉


Regular Expression Translator

Another class I am taking this semester (except Real-Time Systems which I blogged about) is Formal Language Theory. It is very theoretical course. Most of the time is spend on formal proofs. Fortunately, one programming assignment was very fun.

The goal was to implement the program, which checks if one regular expression is subset of another. Thus, the input is two regular expressions.

RegEx AutomatasThe program use basic regular expressions notation and supports following operators:

  • + (union)
  • * (Kleene closure)
  • ε (Epsilon, empty expression)
  • 0,1,2 (literals)

To solve the problem, I had to take advantage of finite automatas (ε-NFA and DFA) in following order:

  1. Parse regular expressions E1 and E2
  2. Create ε-NFAs N1 and N2 using Visitor pattern and transition described here
  3. Convert ε-NFAs N1 and N2 to DFAs D1 and D2 based on this
  4. Create D’I DFA, which is intersection of D1 and D2 DFAs generated in step 3

Implementation details

Tools/Technologies:

  • Eclipse
  • Scala
  • Java
  • ANTLRWorks 2
  • Scala JUnit tests

I took advantage of ANTLR for parsing. I want to learn Scala and I am using it for every programming assignment in this semester if possible. ANTLRWorks 2 does not support Scala (it does not generate parser/lexer/visitor in Scala). However, ANTLRWorks 2 generates Java and interoperability between Scala and Java is easy. I decided to try it!

Scala is a main language in which this application was developed. ANTLRWorks 2 was used for parsing regular expression. The new version (v.2) generates Visitor class, which enables iterating through AST (Abstract Syntax Tree) nodes and perform appropriate actions. As I mentioned, ANTLRWorks 2 does not generate Scala code yet. Thus the generated parser and Visitor is in Java language.

During the intersection of DFAs creation, there is an exception thrown in 2 cases:

  • There exists some node of newly created D’I DFA, which is sum of D1 final node and D2 not final node
  • Some transition, which exists in D1 leads to dead node in D2

Exception contains string, which is accepted by L(E1), but not by L(E2). Then, this string is returned as a result of execution. If no exception was thrown, it means, every final state of D1 is also final state of D2. That means L(E1) ∈ L(E2) and ‘true’ is returned.

Running program

The main program is Main.scala. You can find there String variables defined with sample Regular Expressions. The easiest way is to replace them (if you want to test different ones). You can also read input from the console (by commenting and uncommenting appropriate lines).

Empty regular exception cause Exception throw.

There is also set of unit tests to test some regular expressions. You are more than welcome to add new Unit tests if you want to.

Input

Every closure has to have parenthesis: (exp)*
Union also require parenthesis and multiple unions are allowed: (exp1+exp2+exp3)
Sample inputs:

  • (0+1+2)*
  • ((0(0+2)*+1)*+2)
  • ((0(0+2)*+1)*+2+12+(00+21)*+0000110102)

Details about accepted input can be found in ANTLR grammar file.

Summary

In this assignment I was able to reuse my knowledge about compilers, learnt last semester in Compilers course I had. Additionally I had to implement automata representation and apply recursion to accomplish required tasks.

It is very simple translator. Handle only basic regular expressions and small language (only 0,1,2 literals allowed). However, the goal was to practice and understand how Regular Expressions work internally.

You can check the code of my translator on github: RegExpTranslator.


New domains

Today I bought two, new domains for my blog: jedryszek.com and jakubjedryszek.com.

jedryszek.com jakubjedryszek.com

I purchased them on GoDaddy. The price was reasonable ($12.99 per domain for first year, $14.99 for renewal). GoDaddy is quite popular service. Thus I will get many online resources and support from the community.

Are you looking for domain name register? Check Five Best Domain Name Registrars.


Replacement for Logitech UltraX: Logitech Wireless Solar Keyboard K750

Logitech UltraX Media Keyboard

Six years ago I purchased Logitech UltraX, which is still the best keyboard I have ever had. Unfortunately, as you know, keyboard cannot live for ever. Two years ago I wanted to buy the same model again, but…UltraX is no longer made. I was looking for some on amazon and ebay, and I found only Logitech Ultra X with PS/2. I bought it and it was fine, but I needed also PS/2->USB converter (my laptop doesn’t have PS/2 like most of laptops today). It works fine, but sometimes it loses connection. Only solution I found is to disconnect and insert it again into the USB port.

Logitech UltraX Premium

Recently I split a tea on the keyboard and keys are not working very well anymore. Thus I needed a new one. I wanted to buy the same model. It was still available on eBay, but I found this discussion, where one guy recommended Logitech K750. Its price is around $60 (too much), but I found refurbished for $30 (acceptable) and I bought it.

Logitech wireless solar keyboard k750

After a month, I can say that I am satisfied. It is wireless, but works smoothly (almost like wired). I didn’t have any communication issues so far. The cool thing is the fact that it doesn’t have replaceable batteries. It charges itself through solar panels. Additionally Logitech provides Solar App, which shows the battery condition and how much ‘light power’ is it getting from the light/sun. The two screenshots below shows Solar App when light is turned on (left) and turned off (right).

Logitech Solar AppLogitech Solar App - Light Off

The most important capability: keys. They are nice, low profiled, but a bit loose and loud. It doesn’t bother me though. I can say that K750 is a one class lower than Apple Keyboard, which I was using for 2 months in last summer (working on Mac). I would purchase Apple keyboard (better keys), if it would have ‘Windows’ version. For now, I am satisfied with K750.

If you are looking for UltraX-like keyboard, then K750 is definitely worth to consider!