Misadventures with varnish

I like experimenting. It keeps life interesting. You discover something new and get excited. It advances the world, ushers in a new era of new found knowledge expanding the horizon of human understanding.

It does not come without a cost though. Sometimes the cost is too much to bear. You start questioning your life decisions while drowning in a sea of your tears. Lots of tears I might add.

Part of experimenting is failing. Oftentimes miserably. I wanted to try out the Conservar Isolating Varnish. I had read about how it is great for isolating the paint film from the final varnish. So, if your painting got dirty or damaged and needed to be restored, you could easily remove the final layer of varnish without dissolving/damaging your painting. What could go wrong?

Little did I know it had really powerful solvents and made the mistake of applying a thick layer with a fat brush. Which would have probably been fine had I not accidentally brushed over already varnished areas again.

The varnish dissolved the top layer of my painting and brushing over it accidentally caused the layers beneath to show up. I guess the fact that my varnish brush was turning blue should have alerted me to stop and asses what I was doing. Lesson learned.

Now I understand why artists stress so much about not brushing over already varnished areas even if some spots were left dry. You can go over those spots when you apply the second layer of varnish.

I am a bit sad that my painting got damaged and I will need to retouch it. But (because I didn’t learn my lesson) I am also excited about painting thin layers (glazing) over the isolating varnish and seeing what kind of affect it will have. Maybe the painting will be as luminous as the old master paintings!

I don’t recommend you try this at home. Painting over a reversible varnish layer means your top paint layer will become removable and will get off the painting when you try to restore the painting . Oh, did I mention it makes it really hard to restore a painting?

My plan is to paint over the isolating varnish. Use more isolating varnish over that paint film then go over the whole thing with regalrez varnish. This should keep all the layers of my painting safe if it needs to be restored later on. Regalrez will come off with Gamsol (or any other odorless mineral spirit). Conservar varnish, I will need more powerful solvents which should (theoretically anyway) keep the paint film intact.

I plan to keep this one in my private collection so I feel safe experimenting with it but I’m making dua as I try to think through my blood soaked tears that this painting will turn out even more amazing than before.

I will post pictures of the painting before and after varnish . See if you can figure out where the paint film dissolved into the varnish .



My experience with PHP/Zend certification

This post has been sitting in my drafts since 2013. I figured it was time to finish and publish it.

I passed PHP Certification exam. It felt nice. I had read about how people failed more than once so it was cool that I passed it on my first try.

Registering for the test

I’m sure there’s more than one way to do it but I went to Zend’s website and bought an exam voucher, which was $195. They have various packages where they offer to give you a crash course or study material and such but I decided to study on my own.

When you buy the voucher Zend will send you an email with the voucher code. You will, then, have to register with Pearson Vue on http://pearsonvue.com/ for the test. Provide them the voucher code Zend gave you. Then, you can pick a date when you want to take the test, and take it.

After buying the voucher you have a year to use it before it expires. You can set an exam date that’s more than year away as long as you register for the test within the year on buying the voucher. My voucher was going to expire in November 2011 so I registered for the test one day before the expiration date and set the exam date to Jan 2012.

Preparing for the exam

The exam isn’t super hard but it’s not something you can pass without preparing for it. And, it looked like the people designing the questions put effort into it.

  • Download the Zend Certification Study Guide from their website and read it
  • Go to php.net and read up on all functions related to strings, arrays, streams, the standard PHP library
  • I would recommend taking mock exams if you can get them. It will give you an idea about what type of questions to expect

Does getting the certification do anything for your career?

A lot of times, recruiters confuse Zend certification with , being certified for the Zend framework. Surprisingly, more than PHP certification, people have asked if I was certified for Zend framework.

The certification definitely helps give recruiters some confidence in hiring you over another developer but I wouldn’t say it catapulted my career to new heights. When I did the certification, I got a free perpetual license for Zend Studio which was nice. I, however, decided to ditch the free license and pay for PHPStorm.

Should you take the test?

I would say, yes. I studied for it for a little over a month and discovered gems of knowledge I probably wouldn’t have found otherwise. Taking the test and passing was a great experience for me.

So, if you can spare a few hundred dollars and put in some studying, I say go for it.

Here are some sample questions similar to what you might see in the PHP certification exam:

Which of the following cannot be used to set a cookie

  • setcookie
  • $_COOKIE
  • setrawcookie
  • header

What is the output of the following code

<?php

try {
    class MyCustomException extends Exception {}
    try {
        throw new MyCustomException();
    } catch (Exception $e) {
        print '1:';
        throw $e;
    } catch (MyCustomException $e1) {
        print '2:';
        throw $e1;
    }
} catch (Exception $e) {
print get_class($e);
}

Which of the following can be used to traverse the file system:

  • ArrayObject
  • RecursiveDirectoryIterator
  • SplTmpFileInfo
  • TraversingIterator

How often will func() run?

function func(&x=0, &y=1)
{
if ($x > $y) {
return;
}
$r = $x + $y;
$x = $y;
$y = $r;
}

func()

Oaths in Islam – Part 2

Since I posted an article on “Oaths in Islam”, I have gotten quite a few questions from readers (most of which I have not published) asking me to clarify if an oath they took is valid or something else related to oaths they took. I figured I would write another article providing examples to help such people out.

First I’d like to state that I am not a scholar, or even a formal student of sacred knowledge. I just happen to like learning and get my knowledge from reading various books, articles and listening to lectures. I had written the original article as a reminder for me after having read articles about oaths on sunnipath.com (now qibla.com) and other sources. Here is the original article, I am talking about: http://moazzam-khan.com/blog/oaths-in-islam/ if you are curious.

My friend/whoever took an oath that they will do something bad to themselves if I don’t do what they want.

If your friend, or anyone else takes an oath to not eat (or harm themselves) until you do something, that is between them. You are not responsible for their oaths. If they break those oaths, they will have to pay kaffarah for it. It doesn’t affect you. No one can force you to do something by taking an oath. Allah will not hold you accountable for an oath someone else took.

I swore that I will not let my son/daughter do something (like play soccer), but I want to let them play it. What should I do?

Firstly, try not to take oaths you can’t keep. Secondly, if you break your oath, you will have to pay the kaffarah. If you don’t break that oath, then you son/daughter will not get to play soccer (or whatever you forbade them from) .

Go – Finding and removing duplicate files on a Mac

My laptop’s hard drive is plagued with the same family pics stored in different folders. So, I wrote a simple app in Go to take care of this for me. The app does this by comparing MD5 hashes of files.

Usage

Assuming you saved the code in a file called main.go, here is how you can use it to find duplicate files:

This will print duplicate files to the terminal. I added the flag -dupe_action=sym flag in the app which will sym-link all duplicates to one file.

3D Printing

The future is here – with 3D printing. If anyone has seen Star Trek, they will know about the synthesizer used in the show to make (synthesize) anything from coffee to costumes to anything else. This is how I felt when I first got my 3D printer and started making (printing) things with it.

You can pretty much design and print anything. It is, however, not as fast as the ones on the show (or the movies). They take a while to print somethhing but they are precise and will make almost anything you want/need. I have printed a holder for dry-erase markers and cleaning spray (which turned out to be better than anything I have ever bought for it), green latern rings for the kids, toy cars and many other things. It is also not as expensive as I thought it would be. To be fair, there are printers out there that cost upwards of $10,000 but they are not meant for a hobby-ist.

I got my printer for (I am not kidding) $250 on a sale. It’s regular price is $300 (Monoprice maker select v2).The plastic it uses to print stuff cost me $14.00 and will print things that cost a lot more than that.I printed a car phone ring holder. Each ring holder in the store costs $20. I printed it for less than a dollar.

I will try and post pictures of things I have printed in another post and my experiences with my printer and 3D printing in general.

Why Golang/Go is so awesome

I have been working with Go for quite some time now and know more about it. My initial thoughts about it were accurate, I think with some variations. Go really can do almost everything.

It can be run like any interpreted language for development and compiled for production

This is something I love about Go a lot. You can run any Go code by just typing:

And, you can compile your whole app into a binary, copy that binary to a production server and just run it. No dependencies needed. If you have assets that your app reads (like images, etc) , they can be compiled into the binary as well! This gives a whole new meaning to portability (at least for me).

It supports parallelism and concurrency

With Go routines, you can run multiple things at the same time (assuming you have a multi-core CPU). Go takes care of splitting your routines into multiple-threads and all the house-keeping chores that come along with it. It is, by far, the best multi-threaded language I have come across.

Many developers think Node supports parallelism but it doesn’t. Node is a great language for its asynchronous model but it executes only 1 thread at a time. Most scripting languages that I know of (Ruby, Python, etc) have this issue. They have a global interpreter lock, which makes sure only one thread executes at a time. So, they are concurrent but do not support parallelism (running multiple things at the same time).

Since, web servers spawns multiple processes for processing multiple HTTP requests, you don’t generally notice the bottleneck.

It has a unit testing framework in its standard library

It’s the first language, I’ve seen doing this. No need to install external libraries. The testing framework (in a package called “testing”) is very performant. It also lets you run benchmark tests and example code for generating documentation.

It has support for GUIs apps

There are a bunch of libraries in Go that will let you write native applications for Windows, Mac, etc. Go has bindings for GTK, QML, etc. Some Go libraries will even let you write hybrid apps (for desktop applications – will talk about mobile later).The content in these native UIs can be done using HTML/CSS. I tried this for a proof-of-concept app that generates configuration for a proprietary ETL tool at my work and it is so easy to do! The library I used was : https://github.com/murlokswarm/app

It has support for writing web services and web applications

Go, with it’s standard library has a templating engine built-in. And, it is very performant. No need to worry about which library to use for templating, etc. You can, with a few lines of code, create a web service!

There are quite a few features that make Go a great language to work with. I hope it proliferates the IT market so much that more companies ask for Go as a main requirement for jobs (and not just a nice-to-have).

How are paints made for various painting mediums?

Paints are made by adding pigment (color) to something that will help it stick to the surface of a canvas (or anything else it can be painted on).

Color
Color, also referred to as pigment, is a powder with a specific color. For artist grade and premium grade paints this is ground up metal in most cases. Cobalt blue is made with Cobalt powder mixed into a medium.

For Student grade paints, the pigment is usually obtained by using a colored die and mixing it with chalk (the one you write on a black board with) or marble dust. This helps manufacturers reduce the cost of the paint.

Oil Paints
Oil paints are generally made by grinding the pigment powder with linseed oil. The grinding can be done by manually (with grinding stone, etc) or using a machine that can do it much faster.

Linseed oil has forms the most flexible film when it dries compared to other drying oils. The disadvantage of linseed oil is that it tends to yellow more than other oils over time. The other oil used for making oil paints is walnut oil, which doesn’t yellow as much but is forms a less flexible film than linseed oil does. It is, sometimes, mixed with linseed oil so the resultant paint will have a strong film and yellow less.

Cheaper oil paints tend to have less pigment and oil and more filler (marble dust, chalk or any other filler). Artists grade paints have less filler but they do contain some. Premium grade paints have no filler. They may, however, have stabilizers for certain pigments.

Acrylic paints
Acrylic paints are made by mixing pigment into acrylic emulsions (plastic). Like oil paints, artist grade acrylic paints have more pigment and than student grade paints.

Watercolor paints
The medium for watercolor paints is not water. It is gum arabic. Pigment added to gum arabic to make watercolors. Gum arabic is soluble in water which is why water can be used with watercolors as medium (to move the paint around, etc)

Egg Tempera
This is not as popular as the other 3 mediums but this has been around for a while. Egg tempera paints are made by mixing pigment into the egg yolk (not the egg white).

Encaustic paints
Encaustic paints are wax sticks that heated and the wax is used for painting while it is hot. When the wax dries it cannot be manipulated. Encausing paints are made by adding pigment to heated beeswax

Golang: Restart web server on file change

A great feature of scripting languages like PHP, Python and Ruby is that you don’t need to re-compile the app or restart a web server every time you change something. With Go, you need to restart the web server for your changes to take affect. This can be a pretty daunting task.

We can, however, have this feature in Go as well (with some extra code). We just need to write a file watcher that will restart the web server on any file changes. Below is working code (from a project I am building) that does exactly this. You can modify it to suit your needs or just put it in your project as is.