This blog has moved to Medium

Subscribe via email

(No Ratings Yet)

Posts tagged ‘Programming’

## The Fractional Fractal

As I was running yesterday, this image flashed into my mind.

I believe I had never seen this fractal before. It is original.
It’s possible someone else discovered it, maybe even that I saw it somewhere. The mind works in mysterious ways.
But if that happened, I repressed the memory of seeing it.

In other words, I believe I came up with this one all by myself.

So, after seeing this image flashing in my head, I just had to make it a reality. To code it.
Some Googling led me to this awesome post on 7 awsome free tools for creating fractals. I tried out a couple of tools – they were awesome indeed! But they were too limited and could not produce the image that haunted me.

So, I turned to the basics. Coding it from scratch. Using Logo.

Logo was the first programming language I ever learned. My dad taught me how to code in Logo when I was a young kid. I don’t know how old I was, maybe 8 or 9. I had a 286 computer which was rad, because all the other kids had xt, except my friend who had a 386 powerhouse.

I never thought I would use Logo for anything. But yesterday, it was the best tool for the job.

So, here I present the code for Fractional Fractal. This Fractal represents the series of fractions 1/2, 1/3, 1/4, 1/5, 1/6…

Finally, I’d like to end this post with a thank you.

Thank you dad, for believing in me. For teaching a young kid how to program. How think. How to love math, logic, programming and reasoning. How to be analytical. This is a core part of myself that I owe to you. #StillYourKid.

<tears of joy>

## Leading Snowflakes – Inspiration codified in a book

Oren Ellenbogen taught me so much along the years. He was my manager/team lead for a year, and I’ve learned from and worked with him on several other occaisions. I would love to co-found a startup with him one day.

Engineering management has been his passion and dedication for years. Finally – he achieved his dream and codified his passion into an eBook & package: Leading Snowflakes, The Engineering Manager Handbook. I highly recommend it for anyone wishing to increase their leadership abilities.

If you don’t want to commit or don’t have the time right now, you can start by subscribing to his weekly newsletter – Software Lead Weekly – it’s one of the most known newsletter that investigates and teaches engineering management.

## Wanted: CTO

Want to be the CTO of a new Israeli Bitcoin Startup?

Things are moving.
Teams are assembling.
Join the revolution!

(Even if you’re not familiar with Bitcoin, but looking for an interesting CTO position, feel free to approach – we’ll teach you all you need to know about Bitcoin)
(Even if not relevant to you, we’ll appreciate a like/share/referral)

## How to do a production hotfix

Situation
It’s Thursday/Friday evening, the daily version / master branch was deemed too risky to install, and you decide to wait for Sunday/Monday with the deploy to production.

There’s a new critical bug found in production.
We do not want to install the bug on top of all the other changes, because of the risk factor.

What do we do?
Develop the fix on top of the production branch, in our local machine, git push, and deploy the fix, without all the other changes.

How can I do this?

My example uses a Play Framework service, but that’s immaterial.

1. gitk –all – review the situation
2. Suppose the latest version deployed in prod is 1.2.3, and master has some commits after that.
3. You checkout this version:

git checkout 1.2.3

4. Create a new branch for this hotfix.

git checkout -b 1.2.3_hotfix1

5. Fix the bug locally, and commit.
6. Test it locally.
7. git push
8. On the production machine:
1. git fetch (not pull!)
2. sudo service play stop
3. git checkout 1.2.3_hotfix1
4. sudo service play start
9. Test on production
10. Merge the fix back to master:
1. git checkout master
2. git merge 1.2.3_hotfix1
3. git push
11. Clean up the local branch:

git branch -d 1.2.3_hotfix1

(Note: the branch will still be saved on origin, you’re not losing any information by deleting it locally)

## Summary of JavaScript Weekly – Issue 86

I recently subscribed to Javascript Weekly, a weekly newsletter (yes, no RSS! or RSS feed) rather high quality weekly collection of Javascript cool stuff.

I’ve been picking the best links and sending to people at work, when I thought … hmm, I actually have a blog, why not summarize it here instead?
So, whenever I feel like it, I’ll be posting my own picks out the this week’s JS weekly.

Today, we have:

## Interviewing? Keep it simple, stupid!

If any of you are intereview for a job any time soon, please take this advice to heart – just like KISS is a good principle in your every day job, it’s a great principle in a job interview.

Some people like to boast their skills when interviewing.

“I’m a Java Guru”

“I’m excellent at Big Data analysis on a NoSQL system in the cloud”

“I like well designed code … here are my favorite design patterns, I use them all the time”

Some of the above statements could apply to you … but be sure to be relevant to the job you’re interviewing for, and the tests you’re given. If you are asked to do a simple hands on coding session, know that your interviewer just want to see you code, he doesn’t need to you implement Map Reduce or show off your Uber Design Pattern skills.

Sure, it’s nice to sprinkle in good design, unit tests, and write scalable code … but before you do all those things, make sure you get the job done, on time, without bugs. Do the important stuff first, and show off later, if you have the time.

## First Java & JVM Tel Aviv Tools Night!

After a few months of gathering forces, we have a critical mass of people interesting in learning and teaching about Java & JVM related technologies.

Our first Tools Night is this upcoming Sunday (29/04), in Sears Israeli (Hertzelia Pituah).

Please check out the schdeule on EventBrite, and subscribe if you’re interested. Also don’t forget to subscribe to the google group.

## A few jQuery tricks from a newb

Hi all, this is your newb web developer talking again. While some of the following might be obvious to the more experienced web devs among you, this is a post that I wish I’d read when I just started using jQuery.

The word “plugin” usually entails something complicated and with some non-trivial learning curve (e.g. how many of you ever wrote a Chrome of Firefox plugin?) Well, in jQuery, this is really not the case. Here is how you write a simple jQuery plugin:

```\$.fn.enable = function() { \$(this).prop("disabled", false); };   \$.fn.disable = function() { \$(this).prop("disabled", true); };```

I find it useful to wrap even simple one liners such as .prop(“disabled”, false) with a plugin, because the semantics of writing \$(“#foo”).disable() is much nicer than playing with properties/attributes directly. I haven’t written a lot of plugins yet, but it’s something to keep in mind as a useful tool to wrap actions on specific DOM elements.

Know the commonly used plugins
There are a ton … I still know very few of them. Here are a bunch of useful ones (and the ones I personally know and use).

A lot of plugins are very easy to use, and have good documentation and demos, so not using them and rolling your own solution is usually just a result of ignorance. Take the time to educate yourself!

UI Queues
For a long time I’ve that you can do things like \$(“#mydiv”).show(), \$(“#mydiv”).hide() and even \$(“#mydiv”).show(1000) for a simple animation. Only recently I discovered you can actually chain these using Event Queues:

```\$("#mydiv") .hide(1000) .delay(500) .show(200) .fadeOut();```

Each call to an animation method gets queued up and executes after the previous one.

Deferred
jQuery Deferred is a little gem. It lets you write fluent code similar to the queue example above. Here is how you use it:

```\$.when(\$.post('http://api.com/request_1'), \$.post('http://api.com/request_2')) .then(function(){alert("Got two responses")});```

You can also use them with the event queue:

``` \$("#mydiv") .show(1000) .delay(500) .promise() .then(function(){/*do something */});```

That’s all I have for now. Have any essential tips & tricks that I’m missing out on?