Recommend Video: Happiness 101 with Tal Ben-Shahar

I have come across this video yesterday. And even though it takes more than 1 hour, it’s a good video which I would recommend.

One part I remember from the video is that if you have your email opened while you have to focus on something, you are loosing 10 IQ. To compare it – if you do not sleep and work 36 hours, you loose 10 IQ or if you smoke marijuana, you loose 4 IQ.

There are more interesting facts mentioned throughout the video. If you have a time, I really recommend to watch this.

Btw, it’s better to listen to this that to check a Facebook timeline ūüėČ

Property & Investment Expo 2015, Cyprus

ExpoCy.net - Property & Investment Expo 2015

Come discover the property market and meet the service providers in a unique one-stop setting for visitors & exhibitors on the sunny island of charming Cyprus.

Visit Cyprus Property & Investment Expo 2015  for more info.

Thomas A. Edison / Being busy does not always …

One motivation quote from Thomas A. Edison

Being busy does not always mean real work. The object of all work is production or accomplishment and to either of these ends there must be forethought, system, planning, intelligence, and honest purpose, as well as perspiration. Seeming to do is not doing.

How to find files with a content in directory

I have a directory with a lot of csv files and I need to find those which contain a specific string

1. Looking for tomas

grep tomas * | cut -d" " -f1

Track your hours with Harvest App

We all know this. You come to work in the morning and by time you are leaving, the last task of the day is to fill up your Timesheet – what you work on and how much time you spent on each task. And I will not lie – I always struggled with this. I never knew how much time I spent on what and I also found out, that my time estimation was always wrong – I spent more time than I thought.

I was trying to find out any solution for this – I’ve used paper where I tried to write time when I started new project, I tried to use any kind of application to keep tracking my hours, but nothing worked for me.

At the end, I tried Harvest –¬†Simple Online Time Tracking Software¬†and I finally found the solution which works for me.

The idea of the article is not to present Harvest as itself – you can go to the internet and find more information about this tool, but to give you and idea how I use it.

One thing to mention now – I am using Harvest for my every day job, tracking my working hours in the company and also tracking my hours for my private client and still, free subscription is enough for me.

You might say – ah ok, so you do not work on many different projects, but the truth is, that I do and I use a little trick to manage it completely with Harvest.

Harvest ¬†free subscription comes with¬†2 projects, 4 clients, and unlimited invoicing for 1 user and believe or not, it’s enough for me.¬†So how do I use the Harvest?

As mentioned above, I have 2 projects to use – so I created

  1. Company projects
  2. Private projects

The great thing that is not mentioned anywhere is, that each project can have unlimited tasks (at least I haven’t found any limitation for this) and that’s how my little trick works.¬†I use tasks to as company projects.

Another great thing is that a task has its own statistics, time tracking etc – so it can really be used as “a project”. And this trick saves me a lot of hassle per day.

Thanks to Harvest API, I was able to write a small integration with our own intranet, so when I need to report my hours, I just open our intranet, select specific day and press button – Import from Harvest.

What took me 10 – 15 minutes each day, now takes only 1. That’s a great time saving. Not talking about the fact, that I do not need to remember anything. All info is safely saved and can be used anytime.

To make it even more easier, Harvest can be integrated into Asana – so before I start working on any project, I can just press an icon and start a Harvest timer. And when I am done with a task, I just simply stop it. All perfectly works and my issue with timesheet is finally solved.

So try Harvest –¬†Simple Online Time Tracking Software yourself and let me know how it goes.

How to you track your working hours? Let me know your process in comments underneath.

Enable Phalcon Developer Tools in PHPStorm 8

I started to play with Phalcon PHP Framework – A full-stack PHP framework delivered as a C-extension and I wanted to enable its developer tool in PHPStorm. There is a video how to do it, but unfortunately I end up in situation that it was not working as on video.

Let’s see it step by step with pictures.

1. Download Phalcon Developer Tools
Just follow instruction from documentation, how to download Phalcon developer tools. It’s pretty easy and straight forward. I use XAMPP and I saved it under

D:\xampp\htdocs\phalcon-devtool\

I will have to do some changes in configurations, so if you use another folder, just use your path accordingly.

2. Update path in \ide\phpstorm\phalcon.bat

Let’s edit file D:\xampp\htdocs\phalcon-devtools\ide\phpstorm\phalcon.bat

@echo off
                  
set PTOOLSPATH=D:\xampp\htdocs\phalcon-devtools\
php %PTOOLSPATH%phalcon.php %*

3. Open PHPStorm and go to the settings

Open PHPStorm and go the the Settings (hotkey CTRL + ALT + S) and find Command Line Tool Support

settings-command_line_tool_support

4. Add new custom tool

Click on the green + (plus) icon to add new Tool

settings-command_line_tool_support_add

5. Select Custom Tool and Global

Select Custom Tool from drop-down list and Global as visibility

settings-command_line_tool_support_custom_tool

6. Complete Tool Settings

Complete tool settings

  • Tool Path: D:\xampp\htdocs\phalcon-devtools\ide\phpstorm\phalcon.bat
  • Alias: pcon (I like to keep is shorter)
  • Description: Phalcon Dev Tool

settings-command_line_tool_support_settings

Press OK to add this Custom tool and Apply and OK to save new Settings.

7. Open Command line

Open command line Tools > Run Command or CTRL + Shift + X and write pcon

settings-command_line_tool_support_command_line

8. Hit enter and check result

If you see the following result, congratulation – you have enabled it properly.

settings-command_line_tool_support_working

A) Cannot run program “D:\xampp\htdocs\phalcon-devtools\ide\phpstorm\phalcon.bat”
If you hit enter and instead of the screen above you see error like

Cannot run program "D:\xampp\htdocs\phalcon-devtools\ide\phpstorm\phalcon.bat" (in directory "D:\xampp\htdocs\ptx\blog"): CreateProcess error=5, Access is denied

settings-command_line_tool_error

Please make sure, you have correct permission on the file – basically that you are able to run this file.

The Prime Minister of Great Britain RT Hon David Cameron at RCCG Festival of Life London April 2015

CommitStrip.com – Eye-Opener commit

I came across this comics and I have to share it :)

11188448_421335631373677_8587646268000732084_n

PTX Clock – Generate Analog Clock from digital time in PHP

PTX Clock is a PHP Class to create analog clock from the time given. I have a son and they are teaching him the clock at school. I though it would be great to create a simple game to help him out. This class is just a beginning of the whole idea.

Installation

You will need a composer to install autoload for you

composer install --no-dev

Example

require_once './vendor/autoload.php';

try {
    $clock = new PTX\Clock('09:55');
    $clock->draw();
    $clock->to_browser();
} catch(\PTX\ClockException $e) {
    echo $e->getMessage();
}

Example online

Visit my PTX Clock – Generate Analog Clock from digital time in PHP and see it in action.

PHP Purchase Price – count final price for a purchase

Simple PHP class which counts final prices for a purchase and its product. It counts with VAT and with discount properly.

Notes

Some quick notes for the class

  • Product price is a price already with VAT
  • Tax is a % of VAT
  • Discount can be fix or percentage
  • If discount is fix, its value must be lower than product price
  • If discount is percentage, its value must be between 0 and 100

Installation
You need composer for auto-loading

composer install

Example

Quick example how it works. I recommend to check PurchasePriceTest.php and its tests to get better picture what else can be done.

require_once './vendor/autoload.php';

$products_data = array(
    array(
        'price'          => '79.96',
        'tax_percentage' => 19,
        'quantity'       => 5,
        'discount'       => 20,
        'discount_type'  => 'fix'),
    array(
        'price'          => '67.79',
        'tax_percentage' => 19,
        'quantity'       => 10,
        'discount'       => 10,
        'discount_type'  => 'percentage'));

$purchase_price = new \PTX\PurchasePrice();
$total_price = $purchase_price->count_total($products_data);

/**
 * RESULT
 * array(
 *    'total' => 909.9,
 *     'subtotal' => 764.62,
 *     'tax' => array(
 *         19 => 145.28),
 *     'discount' => 167.8);
 */

Download PTX-PurchasePrice

The project is on GitHub, download it from there.

© 2015 Tomas Pavlatka

Theme by Anders NorenUp ↑