Tech

Mecer Laptop Xpression W940TU: Review

I recently purchased a new Mecer Xpression W940TU laptop from Computer Mania as my (not so) beloved MacBook Pro started giving me troubles. Seeing that a full repair would cost something around R5000 I decided to give a new laptop a try as I was in need of a fallback device anyway.

The Mecer laptop was the cheapest laptop I could buy right-on-the-spot at one of the Computer Mania franchises – for only R3600.
Mecer itself seems to be a brand of Mustek Limited which does not seem to be affiliated with the Mustek I know from Germany.

Unfortunately there is not a lot of tech review going on in South Africa so it was difficult to find any information or opinion about this specific or similar model. It was a risky buy, but so far I am happy.

The laptop comes with the following specs:

  • Intel Celeron N2840
  • 2GB DDR3L RAM
  • 500GB HDD
  • 14″ – 1366×786 – 16:9 (they call it here “HD”)
  • Windows 8 pre-installed (mine even came with a pre-configured user… yay)
  • UEFI
  • No CD/DVD player
I have never heard of this kind of CPU before but I am pretty impressed – it’s definitely lagging way behind my older i5 – but since I am only using it for work and not doing anything multimedia richy it’s perfectly fine. The power consumption is very low, thus also not really generating heat under high load – which is great! You will find the exact details here.
The quality of the chasis is pretty good – feels very cheap but also very durable. Same goes for the keyboard which I actually enjoy using. The touchpad is unfortunately disappointing – especially the buttons.
Of course from the beginning on it was clear that the specs are not enough for my usage – so I had to open it up and upgrade it.
This gave me also the possibility to have a look in side, and damn it looks cheap. Anyways:
  • replaced the 2GB RAM module with 2x4GB DDR3L (low voltage, got 1600 but they will anyway went down to 1333 automatically)
  • Samsung EVO 840 250GB SSD
  • removed Windows 8 in favour of Debian 8 (+ Mate)
Works like a charm, pretty fast, and the only bottleneck now is really the CPU.

Pros:

  • Absolutely NO fucking vendor locking – want to upgrade the hard drive or replace the RAM? Just do it!
  • Pretty simple technology – many things you can replace by yourself – so no exotic stuff soldered/glued on (well except the battery, see cons)
  • You can get (at least here in South Africa) a replacement for pretty much every part (won’t be always the original though) – and thats because they did not build anything “special behind closed doors” but just jammed in popular components together

Cons:

  • Being used to a Macbook, jesus the power connector on the laptop itself is fucked up – I need to jam it in with force and taking it out feels like I am ripping some inner parts out
  • the battery is unfortunately not easy changeable – similar to other laptops with this form – but still much better as it looks like they are some generic ones I can get from RS – so no special build or glued on
  • the battery have a very very low quality – it is reporting the wrong status under Debian and once it hits 50% it shuts off automatically
  • keyboard is not backlit
Conclusion: A cheap, but not the cheapest, laptop.Having nothing special built in and no vendor locking means upgrades and repairs will be easy and cheap to do.

Update: please don’t buy this laptop – unreliable 😀 😉

Cleaning up PHP short-open-tags with Eclipse

One major problem of old/legacy or unmaintained PHP scripts is, that they usually use short-open-tags to enclose PHP code:

<? echo “foobar”; ?>

This used to be common in the old days, but trying to run those scripts on a modern LAMP stack will most likely result in 500-code errors.

Sure you could just enable short_open_tag in the php.ini and it would solve the problem. But even though there are no official hints that it might get deprecated or removed, it is still a bad practice. The Basic Coding Standard by the PHP Framework Interop Group clearly states:

Files MUST use only <?php and <?= tags.

So why should you hold on to bad practices, if you can just easily mass replace them to normal open-tags? Eclipse offers a feature where you can do a project based search & replace, and even use Regular Expression with group matching. Follow the steps below to refactor your (or someones else) code.

Steps to fix under Eclipse (PDT):

1) Select via the “File Navigator” your root project folder

Eclipse File Navigator

2) Go to the menu: “Search” -> “File…”

3) Configure as seen in the screenshot below, type into “Containing text:” the following: <?($|s+)

Eclipse Search & Replace in Files

4) Click on the button “Replace…”

5) Again, configure as seen in the screenshot. Type into “With:” the following: <?php$1

Eclipse Regular Expresion Text Matches

6) Click on “OK” -> Done! 🙂

Basically with that regular expression we just used, you are searching for all “<?” occurrences that are followed by either a newline or white space (tabs, spaces). It will then replace it by “<?php” including the same amount of white spaces (or newline) after. This will ensure we are not breaking the code or changing anything else except the PHP short-open tag.

Compile tinyproxy as anonymous proxy

Tinyproxy is a small light-weight proxy daemon for Linux environments. Espescially usefull if you have some spare dedicated/virtual servers running with multiple IPs. In this tutorial I will show you how to compile it from source on a Debian server – as the current official .deb package does not allow running it in complete anonymous mode.

Additionally if you don’t want to install asciidoc (1GB!!!) you can use the modified patch from my compile steps (original). My version of the patch works with the current stable (1.8.3) version of tinyproxy. Not using the patch might give you following error:

checking for a2x... no
configure: error: Test for asciidoc failed. See the file 'INSTALL' for help.

 

Compile


$ wget --no-check-certificate https://banu.com/pub/tinyproxy/1.8/tinyproxy-1.8.3.tar.bz2
$ wget --no-check-certificate https://github.com/lifeofguenter/patches/raw/master/tinyproxy/tinyproxy-1.8.3-no-asciidoc.patch
$ tar xvfj tinyproxy-1.8.3.tar.bz2
$ cd tinyproxy-1.8.3/
$ patch -p1 < ../tinyproxy-1.8.3-no-asciidoc.patch
$ ./configure
--prefix=/usr
--sysconfdir=/etc
--localstatedir=/var
--disable-xtinyproxy
--disable-filter
--disable-upstream
--disable-reverse
--enable-transparent
$ make && sudo make install

Config


$ sudo nano /etc/tinyproxy.conf
User nobody
Group nogroup

Port 8888
BindSame yes
Timeout 600
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatFile "/usr/share/tinyproxy/stats.html"
Syslog On
LogLevel Error
PidFile "/var/run/tinyproxy/tinyproxy.pid"
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 10000
Allow 127.0.0.1
DisableViaHeader Yes
ConnectPort 443
ConnectPort 563

Run


$ sudo mkdir /var/run/tinyproxy
$ sudo chown nobody:nogroup /var/run/tinyproxy/
$ sudo tinyproxy