9Gagtension – Facebook comment, message and chat trendy meme emoticons support

I noticed I was using quite some meme references in my Facebook comments such as :sweet jesus: or :mother of god:. So, yesterday evening, I put together an Chrome extension for this. Very simple.

List of memes and other information: http://engin.bzzzt.biz/9gagtension

Source code: https://github.com/engina/9gagtension

This is where you install: Chrome Extension Page

Windows routing problem: Network is unreachable

I don’t know what got broken, or how did it get broken but IP connections on my interface which is using AUTO IP (169.254.0.0/16) stopped working all of a sudden.

$ nc  -nvvvv 169.254.2.206 23
(UNKNOWN) [169.254.2.206] 23 (?) : Network is unreachable
 sent 0, rcvd 0

When I explicitly bind to the correct interface it worked.

$ nc -s 169.254.46.68 -nvvvv 169.254.2.206 23
(UNKNOWN) [169.254.2.206] 23 (?) open
Welcome to ENDA Administration Terminal
Password:

The fact that the error is returned immediately and the content of the error points out that it is a routing problem. So I checked my routing table.

$ route -4 print
===========================================================================
Interface List
 37...00 1f 1f ea 7f 52 ......150Mbps Wireless 802.11b/g/n Nano USB Adapter
 28...00 ff 2d 67 65 d4 ......TAP-Win32 Adapter V9
 10...00 1d ba 68 a5 ac ......Intel(R) 82567LM Gigabit Network Connection
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
 39...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 26...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
 38...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1    192.168.1.104     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
    169.254.46.68  255.255.255.255         On-link     169.254.46.68    356
      192.168.1.0    255.255.255.0         On-link     192.168.1.104    281
    192.168.1.104  255.255.255.255         On-link     192.168.1.104    281
    192.168.1.255  255.255.255.255         On-link     192.168.1.104    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     169.254.46.68    356
        224.0.0.0        240.0.0.0         On-link     192.168.1.104    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     169.254.46.68    356
  255.255.255.255  255.255.255.255         On-link     192.168.1.104    281
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0      192.168.1.1  Default
          0.0.0.0          0.0.0.0      192.168.1.1  Default
===========================================================================

Looks like the problem is

169.254.46.68  255.255.255.255         On-link     169.254.46.68    356

Netmask should have been 255.255.0.0, so that any 169.254.C.D would be carried on with this routing record. So I deleted the faulty line

route -4 delete 169.254.46.68

then issued

route -4 add 169.254.0.0 mask 255.255.0.0 0.0.0.0 metric 3 if 10

10 being my Ethernet adapter as can be seen on the top “route -4 print”. Tricky part for me was to get the gateway was “On-link” in the routing table, after a couple of tries I figured using “0.0.0.0″ as the gateway just makes it “On-link”. After all, whole point of AUTO IP networks is that there’s no router present :)

Now, it works, but after reboots these could be screwed up all over again (despite the fact that route has -p parameter). We’ll see.

Mikrotik RouterOS: How to track each user’s bandwidth usage ?

There are many ways to keep an eye on your users with RouterOS. Two ways to track user bandwidth hoggers:

  1. Use packet sniffer to collect a sample (about a few minutes when there is problem), then examine the data in Connections and Hosts tab.
    1. Pros
      1. Does not consume resources all the time
    2. Cons
      1. Not convenient, you have to do a few clicks and wait for some time to see the result.
      2. You cannot directly act upon the hogger.
  2. Use Firewall rules to match packets for each host and add rate column.
    1. Pros
      1. You can see bandwidth usage of each IP on your network in real time
      2. You can act upon any user and enforce bandwidth limits
    2. Cons
      1. I’ve added ~250 rules to match the traffic for each IP and it caused around ~15% CPU overhead on 300MHz CPU.
As for making all the rules for the firewall. Obviously, I won’t enter those rules by hand, thanks to Mikrotik’s shell it is very easy:
:for i from=2 to=254 do={/ip firewall filter add chain=forward dst-address="193.168.1.$i" action=passthrough}

Passthrough means “do nothing”. We just use the rule to match the packets to each IP then we make use of the rule statistics to get the information we want.

Mysterious performance problems with your good old network

Even though we haven’t changed our network infrastructure for quite some time we started to have network performance problems. Eventually, the network started to stop working from time to time. Router stopped handing out DHCP leases and sometimes freeze all of a sudden.

Not only this, but the networked device which we are developing also started to suffer severely from network problems. The performance was so bad, we couldn’t connect to it over LAN and even if we did, it was a very fragile connection.

We have changed many ADSL Modem routers that you could find on your computer hardware store. None of them could handle it.

Lately, we bought a Mikrotik RB/450. It is a tiny box with 300 MHz CPU and 64MB RAM. With RouterOS installed on it, which is a Linux based solution. I put our ADSL Modem in Bridge Mode, than used the PPPoE client on the RouterOS to connect to the internet. This way, there is basically no load on the ADSL Modem. And voila! Network is performing fantastically.

Couple of observations:

  1. With around 30 active clients, you get 250-600 active connections in NAT table at any given time. 
  2. Our monthly bandwidth usage is around 190 GB
But why did this started to happen now ?

The reason the routers started falling is probably the evolving technology and internet using habits of users. Browsers are using more and more connections and users are opening more and more tabs. There this web site which claims listing how many simultaneous connections can a router handle. I haven’t checked reliability of their measurement methods but if we assume the list is accurate, you’d see there are plenty of routers that can’t handle 250 connections (which is our minimum).

I’m extremely pleased with the Mikrotik RB/450 and I recommended it to any SOHO.

The performance problem of our networked devices is another story however. Since, our PCs and devices are connected to the same switch, our connection does not even require a router to orchestrate the packets. Only problem a router could cause trouble for us is the DHCP problem, which can be worked around with assigning static IPs.

However, I started to get suspicious about all the broadcast traffic new Windows versions was generating lately. Then, I did some experiments with our networked device which was having serious network problems, I noticed that it works as expected when

  1. It is directly connected to the PC
  2. Only the device and the PC was connected to a switch — and nothing else is connected to the switch.
When I plug the company LAN to the switch the device started performing poorly again because it tried to check if all those broadcast messages was actually something useful or not. The problem is, there’s no hardware filtering available on the device. As an additional challenge, hardware buffer of the Ethernet is implemented as a FIFO, so I can’t read arbitrary points in the buffer. So, I have to copy the whole hardware buffer to user space before I can actually filter on it. Filtering is easy and not a problem but copying the data is. I’ll see if I can optimize this in the near future.
Moral of the day, new protocols that use broadcasting aggressively are not good network citizens.

uIP 1.0 for Windows

Thanks to some other guy’s (Higepon, I assume) efforts (whom site is now offline), I got uIP-1.0 to run on my Windows 7. You can see and get the code yourself https://github.com/engina/uip-1.0-win

Engin@Engin-VAIO ~/Code/uip-1.0-win/x86-gcc
$ ./uip
0 - (TAP-Win32 Adapter V9)
         fe80::b89d:19c6:5f43:ec4e%32 [0]
         0.0.0.0 [0]
1 - (VMware Virtual Ethernet Adapter)
         fe80::b98e:1fe8:9121:d0f2%24 [0]
         192.168.67.1 [0]
2 - (Microsoft)
         fe80::b4cb:2e7f:d890:9004%21 [0]
         0.0.0.0 [0]
3 - (Microsoft)
         192.168.1.223 [0]
4 - (Microsoft)
         fe80::cd43:876e:3b0b:5b79%14 [0]
         0.0.0.0 [0]
5 - (Microsoft)
         fe80::2daf:5bd7:5b32:618e%15 [0]
         192.168.1.111 [0]
6 - (VMware Virtual Ethernet Adapter)
         fe80::5431:7f2f:1920:632c%23 [0]
         192.168.9.1 [0]
7 - (Intel(R) 82567LM Gigabit Network Connection)
         fe80::5872:faab:8d21:2e44%10 [0]
         192.168.1.142 [0]
Choose:

This is useful as a debugging aid, a reference implementation and rapid development.

Importing something of a bit of a value for personal use in Turkey — part 3 finale

In the third installment of the series :) I have managed to get my package in my third visit to customs. This time everything took 2 hours I paid another €23 (for storage I think). OK, it boils down to this;

1. Ordered items cost: € 524.97
2. Tax paid here %18, €94,49
3. Total distance traveled to get it: ~400km which costs €100 for me here.
4. Another €23 (for storage I assume)
5. Other expenses €20 (see part 2)

Conclusion:

Ordered item: €524
Total expenses: €237 (%45 of item cost)

Anyway, I got all my stuff, including two sets of 8G RAM (one set for my vaio, one set for my macbook) and a C300 256G SSD.

I must tell you that, at first I was not impressed with the performance of SSD when I directly cloned my original hard disk to it. It was noticeably faster but not in a pants-dropping way.

Then, I’ve installed Windows 7 on it. I must say that it is quite fast, i.e. it cold starts Adobe Fireworks in 3 seconds, and hot starts in 1 second. Of course these are not scientific measurements, as I don’t care about those very much either. The perceived speed determines the user experience. So far, it is quite good. Very snappy. We can attribute some of these perforamnce increase to MS technologies such as pre-fetch and superfetch. Oh well…

MySQL Workbench fetching… problem solved

In my previous post about Restoring MySQL Databases from an HDD Image I’ve talked about restoring previous a MySQL development environment from a backup. First of all, there’s a documentation about it, which admittedly I haven’t read. I have simply copied @@datadir and my applications apparently worked fine but Workbench didn’t like it very much. Whenever I tried to expand database tables it kept telling me “Fetching…”. I checked the error logs and it looks something like this:

110406 23:09:00 [Note] Plugin 'FEDERATED' is disabled.
110406 23:09:00 InnoDB: The InnoDB memory heap is disabled
110406 23:09:00 InnoDB: Mutexes and rw_locks use Windows interlocked functions
110406 23:09:00 InnoDB: Compressed tables use zlib 1.2.3
110406 23:09:01 InnoDB: Initializing buffer pool, size = 128.0M
110406 23:09:01 InnoDB: Completed initialization of buffer pool
110406 23:09:01 InnoDB: highest supported file format is Barracuda.
110406 23:09:01  InnoDB: Waiting for the background threads to start
110406 23:09:02 InnoDB: 1.1.5 started; log sequence number 3061735
110406 23:09:02 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
110406 23:09:02 [Note] Event Scheduler: Loaded 0 events
110406 23:09:02 [Note] C:\PROGRA~2\EASYPH~1.0\MySql\bin\mysqld.exe: ready for connections.
Version: '5.5.10-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
110406 23:13:36 [ERROR] Incorrect definition of table mysql.proc: expected column 'comment' at position 15 to have type text, found type char(64).

If you look careful enough you’ll see please run mysql_upgrade to create it . So I’ve just did it and viola! It looks like fixed. Everything is working fine.

Importing something of a bit of a value for personal use in Turkey — part 2

Good thing, over the years life has thought me not to take her very seriously. Without a sense of humor, I couldn’t survive this day.

  1. I went to the cargo terminal, I’ve tried to fill the paper they gave me. It is complete non-sense to any untrained eye and you MUST find someone to fill it for you which they charge you €25 for it. I bargained and had it for €10 though. By the way, see the irony here ? There’s a totally off-the-record business market conceived around this government building. A government building with the sole purpose of making things on-the-record :)
  2. I’ve paid the %18 tax (which is €94).
  3. After a little bit more of paper work in the cargo terminal, they said that I could get my package from the antrepot now.
  4. I drove to the antrepot only to find out that the last paper work done by the officers were incomplete and I have to go to the cargo terminal again. Though, office hours were about to come to an end… and it turned out I need to drive all the way to the cargo terminal in next business day.
I started regretting not letting UPS did the work for me but I had one consolation so far which I was going to get my package before the weekend to play with it. Today those dreams are shattered :)
I think it is safe to say that I have spent around €200 (gas, tax, paper work) and wasted around 8 hours. Fantastic! That SSD drive better has a pants-dropping performance.
We’ll see if I can get the package in monday :)

Importing something of a bit of a value for personal use in Turkey

I have ordered some nerd stuff worth of a bit more than €500 to be shipped from UK. From package tracking, I can tell that it arrived to Istanbul the very next day after the purchase but guess what. It needed clearance for customs. I’ve been told that if the package worths more than €150, it is highly likely to be stuck at the customs.

So what can I do ?

  1. Get the package myself
  2. Pay a commission to UPS to get it for me (aprox. €83)
I chose the first one to get the whole thing done in one day (boy could I be any more wrong), latter one requires a few business days. I’ve called UPS to get some information about the procedure and they’ve told me that I’d go to cargo terminal make the tax payment, come by their building and get the package. I went to cargo terminal only to find out that the procedure includes one more roundtrip. Here’s the actual procedure.
  1. Go to the place called cargo terminal (next to the airport, a government facility) to get a paper signed by the manager that tells you want to get your package as a personal package.
  2. Take that paper to UPS antrepot so the government inspector can inspect your package and writes a paragraph of text that it is OK for you to pay the tax for it and get it.
  3. You go back to cargo terminal again to pay the tax (%18).
  4. You go back to UPS antrepot again and get your package.
OK, I’ve made a mistake and as manly tears of sorrow was running down my face I knew that I had to take it like a man! I started following the procedure.
  1. I’ve drove to the cargo terminal (47km from my office). I got on the road at around 14:00 and I was there in 30 minutes.
  2. Got the paper and paid €3 for parking in the terminal. I’d guess it took something around 30 minutes too.
  3. I’ve went to the antrepot (20 km), I went to wrong address first so it was 15:40 when I was at the antrepot.
  4. I got the government inspector to inspect my package and like 10 minutes but it took her 30 minutes to write one paragraph of text for me.
  5. So, I was back at the cargo terminal (10km) at 17:00, their office hours ends in 17:30.
  6. Long story short, with the delicate design of bureaucracy at the cargo terminal, I couldn’t make it on time. Now I need to go there again.
  7. I drove back to home (65km).
Aftermath:
  1. Wasted time: 4.5h
  2. Distance: 150km of driving = 20lt of gas = €38 (yes, you’ve read it right, gas is €1.91/lt in Turkey)
  3. Parking: €6 :)
Like all these are not enough, there’s this government officers’ culture in Turkey. Given the little authority, they act like little gods of their domains. Maybe, that’s because they get ridiculous salaries, do nothing useful in general and can be replaced with a few lines of code :) only god would know.
*sigh*
Oh, and for the curious ones among you, I’m getting a Crucial C300 256G SSD drive and 8gb RAM upgrade for my Vaio-Z790 and also for my Macbook.

Running an HTTP server in default port 80 on Windows

Summary: SQL Server Reporting Services is listening on port 80 from within System (PID 4) process.

I tried to run a HTTP server on my Vista box. It couldn’t bind to that port. So I looked around a bit.

Engin@Engin-PC ~
$ netstat -n -a -p tcp -b -o

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:22             0.0.0.0:0              LISTENING       3816
 [sshd.exe]
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4

 Can not obtain ownership information

From Process Explorer I can tell that it is System process. So why does such a core part of my OS listening on port 80. A rather easy way to find out is to simply netcat to that port.

$ nc localhost 80
help
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 31 Mar 2011 08:44:26 GMT
Connection: close
Content-Length: 326

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>

Server: Microsoft-HTTPAPI/2.0 hmm. A little bit googling told me that this is due to SQL Server Reporting Services. When you stop this service, port 80 will be available again.

Go to Top