Friday, September 14, 2012

Apple stops iPhone 3GS production

Apple has officially announced that it will discontinue production of iPhone 3GS which started was available for sale in 2009. 

Last year, after the launch of iPhone 4S, iPhone 3GS became the first free smart phone with a two year contract. Due to this, Apple was able to capture another market segment for low level smart phones.

Starting this Wednesday, after iPhone 5 has been announced, iPhone 4S received its new price of $99 with a contract and iPhone 4 is now free of charge also with a contract.

Even though Apple has discontinued the manufacturing of iPhone 3GS, consumers of these smart phones are still eligible for the new iOS 6.0 (which will be released next week Wednesday) but not all features will be operable because of iPhone 3GS's limitations.

A system which blocks notifications if the user is busy

Desktop notifications play a crucial role in warning the user about what's going on his/her system. Often times though, these notifications become more of a distraction from doing work or simply using the computer. In result, in university of Japan researchers developed a system which determines how busy the user actually is at any given time and makes a decision whether to show these notifications or not.


The system was developed by Takahisa Tani and Seiji Yamada which analyzes user's level of activity on the computer based on keyboard click. This technology involves the use of a built-in control panel with a sensor under keyboard buttons. Depending how actively and hard the user presses keyboard buttons, the system automatically calculates whether the user is busy or not. If the condition is true, all notifications and warnings are automatically blocked by the system and will be shown in the most convenient time for the user.

This technology has been tested on volunteers which had to complete a series of online tests. Every so often there would be a pop-up which required user's attention to select whether they wanted to read the notification or not. After a few user selections the system learned automatically to determine when (and when not to) show the notifications on the screen. The system proved to perform its correctness up to 80%.

More broad testing has been performed in Paris (France) during Ro-Man conference, from September 9 to 13.

Wednesday, June 27, 2012

PHP Search Text In Files (Recursively)

Many times when developers work with someone else's code they run into problems trying to find the location where variable has been initialized because of all "include" and "require" statements. Trying to go through every single time is a hassle and time consuming. Therefore, there has to be an easier way of accomplishing such task without having to pull the hair out of your head thinking "who wrote this non-sense?!?!??!"

After doing a little research online I found a solution to this problem and would like to share it with you guys. It's a little script which takes a the path of the folder where it's located and searches for the query you specify. The script will search inside every file in that folder and then output the results to you.

Here is the link to the file:

The concept is called "recursively searching text in files". The script is easy to you:

(1) Place the file inside the folder where you want to perform the search for text against the files

(2) Run the script in your browser

(3) *The script will automatically determine full path of the folder. You just enter the query and press "Submit" button. The script will perform a search against all your files and print the results on the page below the input fields.

Saving time one script at a time.


Monday, February 20, 2012

Owners of and Fined for Fraud

Website owners of and were fined $156,000. These resources duplicated web design and content from original valid sources and used as their own while charging users for use as well as misdirecting online users into winning a free Apple iPad.

This fine isn't big enough to affect the market or actual owners of valid websites but these copies fooled users into giving away money.

Given the factor that websites look alike, online users were fooled by being notified of winning a large prize (in this case Apple iPad) after which the user was requested to fill out a form sent through SMS. Each response sent by the user resulted in $2.3 charge on their bill.

A female consumer has filed a complained indicating that approximately $98 has been charged to her account. After a number of complaints special operations unit looked into the issue and closed down both websites and their domain names. As for the owners of these websites, they were fined and forced to return all money spent by users online.

Wednesday, February 1, 2012

PHP PDO Count Results - MySQL

Many PHP developers are seeking a solution in counting number of returning rows from a result set using SELECT statement. The PDOStatement::rowCount( void ) function only works for DELETE, INSERT and/or UPDATE statements by counting affected rows. So that's out.

To help you out there are two solutions I found to be most efficient (if you found other ones please post them so we can all learn from each other and continue developing efficient applications).

Method #1:
Create a database handle:
$dbh = new PDO("mysql:host=localhost;dbname=yourdb', 'username', 'password');
Create SQL query to retrieve records from your database:
$query = "SELECT * FROM table1";
Prepare your query for execution:
$stm = $dbh->prepare($query);
Execute the statement:
Get all records into one variable (fetchAll() returns an array):
$result = $stm->fetchAll();
$result variable is an array which holds other data arrays for each row, so just count them:
$number_of_rows = count($result);
Print result or whatever you want to do with it:
echo 'Number of rows: ' . $number_of_rows;

After some research I read that method 1 may break when working with large data sets, I personally haven't had a problem yet.

Method #2:
This method to count number of rows in a result set also works but this method requires two database requests. First (the example below) request is used to see if any results are returned and second time you run the same request to database without the use of COUNT() function.

Create database handle:
$dbh = new PDO("mysql:host=localhost;dbname=yourdb', 'username', 'password');
Create SQL query to retrieve records from your database but now use COUNT() function only:
$query = "SELECT COUNT(*) AS totalRows FROM table1";
Prepare your query for execution:
$stm = $dbh->prepare($query);
Execute the statement:
Save result into a variable:
$result = $stm->fetchColumn();
Display the value:
echo 'Number of rows: ' . $result;