Category Archives: General

All uncategorized stuff

A new project

Hey, long time haven’t posted here. I just started a new project called extensioncart.com. It’s a tool to help people looking for good Opencart extensions/modules to find them.

Here are the main features of the project:

Hope you like it and take care

Quick tip: How to run php script like application

It’s really quick tip:
Sometimes you need to make a shell script which need to be executed either on regular basis, or like infinite loop.

You always can run it by:

/usr/bin/php /path/to/script.php

but if you add a shebang line, the script can be run as standalone application.

Example:

#!/usr/bin/php -q
<?php
//Your php code goes there
?>

Then you can run it like:

/path/to/script.php

Hope this helps

How to use Opencart default admin over Joomla’s Component like jCart/Mijoshop or other CMS

This article is going to explain how to run a Opencart default admin with Joomla Opencart Extensions like jCart and mijoshop. This could apply to any other CMS which provide bridge between opencart and the CMS.

Some background

Opencart components are usually a opencart installation, wrapped with some code, so it will appear in Joomla or other CMS as a part of the site. Because of collisions between Joomla’s javascript libs and some opencart extensions, which heavily uses javascript they couldn’t work on the Joomla Opencart Admin. For this very reason, the following steps need to be done. The result – you will get fully functional opencart Admin, linked to the frontend of your shop. This way you can use extensions like Bulk Product Update PRO or similar.
Continue reading

How to check your php project (many files in a folder) for parse errors

Hey hadn’t wrote anything for a while here, but this is so brilliand and convenient, so I couldn’t resist to share it.

It’s about to check your project for obvious errors before releasing the changes on the production server. I found this answer in StackOverflow, but the solution is for SVN repository and while currently I am working with snv it suits me, but looking forward to migrate to Git, I was thinking “Wasn’t it nice to check the all php files within a folder?”

So here is the solution:

for i in $(find . -iname \*.php ) ; do php -l $i ; done | grep "Parse error"

This should be executed in terminal (at least in Ubuntu it is straight forward) and it print all files which had Parse errors within the folder. I think it’s a must for any php developer who release their code in production server. I already put it as alias in my .bashrc, but I will add it in my “build” script too.

Probably it could be optimized, but for me is pretty much enough.

Deadline tool – deadlinez.com

Over the weekend I had an idea and after day and a half (mostly spent in design) the final “product” is ready. It’s a tool for deadlines.

The idea: It came when I had tough conversation with a client of mine about some money which he owe. I wrote a short email notifing him that if he don’t pay within 2 weeks, we are stopping the supprt and cutting one of his main functionality (since he didn’t pay for it) of his app. And I was thinking: Woudn’t be nice to have a tool which could track the deadline like “You have 14 days, 23 Hours and 30 Minutes to pay is, otherwise – no support” – short and clear. Well this is what the Deadline tool is doing. Here it is:

deadlinez.com
deadlines.chankov.net

The main functionaliy: At the first screen you need to select date and time then the deadline is reached as well as the target name and the task (message) which need to be completed. When you submit the form it will create a short url which is the actual counter. This url can be send to the target.

deadlinez.com - Deadline tool

You can also set target’s e-mail as well as yours. If you did it you will receive a mail with a link when the deadline is reached. so both parties will be notified.

deadlinez.com - Deadline tool

Few ideas for deadlines:

  • Set deadline for business client (like me :))
  • Set deadline to your roommate to move out
  • Set your personal deadline to reach some level of income, or career growth
  • Set deadline to your govermnent…

Or whatever you imagine. Please use this for fun mostly!

Codecademy – Javascript tutorials for newbies

It’s not every day you see a tutorial set that really makes you smile, but Codeyear’s attempt to teach people Javascript through weekly courses and projects is admirable, especially given the quality of the site, the clarity of the courses, and the potential for knowledgeable programmers to start writing similar courses for other languages, such as Python.

To top it all off, they’re using a badge and points system to encourage people to complete new courses, which is a great way to motivate people to finish what they’re learning and move on to something new. In addition, it also means that as they see their projects come to life, they can show people how far they’ve progressed and encourage a little online competition – which, if you’re a partycasino.com fan, is never a bad thing.
Continue reading

How Converged Networks Will Revolutionize Telecommunications

Phone calls aren’t what they used to be. The antiquated system of wires and telephones that once crisscrossed the country becomes increasingly irrelevant as more companies and consumers switch to voice calling over data networks.

Called Voice over IP, this technology uses high speed Internet connections, private networks and internal LANs to deliver enhanced telephone services at a lower price. Very soon, data networks will handle nearly three-quarters of all phone calls. As different types of networks converge, they soon will handle almost every form of communication.
Continue reading

CSS Web design for your website

As can be supported by anyone who has ever tried it, starting your own website can be a complicated and somewhat intimidating process. It is not always as simple as just naming your page and uploading content, as there are a number of complex setup-related factors that must go into your site before it is up and functional, at least if you want it to appear professional and well constructed. This is why many people turn to professional companies like Network Solutions, which specialize in website hosting and allow you, not shortcuts, but easier methods for setting your website up the way you imagine it. Continue reading

CakePHP saveAll() quick tip

Saving data with Model->saveAll() is really time savior. There is something specifics while saving multiple records of a single model.

The data provided from the form should be in the numerically indexed array of records like this:

Array
(
    [Article] => Array(
            [0] => Array
                (
                            [title] => title 1
                        )
            [1] => Array
                (
                            [title] => title 2
                        )
                )
)

Your code for saving this data with saveAll() should look like this:

$this->Article->saveAll($data['Article']);

Ok, but if you pass only

$this->Article->saveAll($data);

it won’t work. So if you want to save multiple records of a single model provide the proper data. It took me 1/2 hour to detect that this is the problem.

Of course this is written in the CookBook, but somebody need to read it carefully 😉

CSS trick

Probably everybody know how to match dom elements with css. For example if you want to match all <li> elements. you are doing something like this:

<style>
li{color: red}
</style>

This way every list element will have red text color.

The more advanced example is if you want to select only the active element – an element with a specific class. This way you are adding a style like:

<style>
li.active {color: red;}
</style>

This way only the active elements (list elements with class active) will have red text color.

Ok, but what if we want to match elements which has 2 specific classes?

Let’s say you have following structure:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CSS Selectors</title>
</head>
<body>
    <ul>
        <li class="first second">test 1</li>
        <li class="first">test 2</li>
        <li class="second">test 3</li>
    </ul>
</body>
</html>

How to make the first list element to be with red color?

The obvious solution is to add an extra class like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CSS Selectors</title>
    <style type="text/css">
        .third{color: red;}
    </style>
</head>
<body>
    <ul>
        <li class="first second third">test 1</li>
        <li class="first">test 2</li>
        <li class="second">test 3</li>
    </ul>
</body>
</html>

but what if there is an easiest solution?

Try this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CSS Selectors</title>
    <style type="text/css">
        .first{color: green;}
        .second{color: blue;}
        .first.second{color: red;}
    </style>
</head>
<body>
    <ul>
        <li class="first second">test 1</li>
        <li class="first">test 2</li>
        <li class="second">test 3</li>
    </ul>
</body>
</html>

As you may notice the css selector which is used is .first.second, so no spaces between them.

This way you can assure that only the element which has class first and second will meet the criteria and will be colorized in red. This notation works with ID’s as well, but basically if you have ID, then you know what is the exact element, so it’s useless, but for selection of two classes I think it really useful.

I would like to know if somebody knew about this way of selecting elements?

Demo