homepage-image-bootloader

Unlocking HTC Sensation Z710e Bootloader for Android

Take the following steps to Unlock your Device’s Bootloader.

  1. Step 1

     After powering down, press Volume Down and while pressing Volume Down, press Power holding both buttons to start the device into Bootloader mode. If you have difficulty, power up normally, go to Settings->Battery and deselect Fast boot. Power down and try again.


  2. Step 2

    Use the Volume buttons to select up or down. Highlight Fastboot and press the Power button.


  3. Step 3

    Connect the device to the computer via a usb cable

  4. Step 4

    Download the following fastboot binary for your OS using the following links:

    Platform Download Size (bytes) Checksum
    Fastboot binary, Linux
    (Unzip the file before executing)
    fastboot 61887 ffd3b02cdf9aa7609462e3957663d238
    Fastboot binary, OS X
    (Unzip the file before executing)
    fastboot-mac 59071 0b3e2a8c5cfeb7c23b362483b93f7dd6
    Fastboot binary, Windows
    (Unzip the file before executing)
    fastboot-win 83753 a90c25141e306b3062dc8e47e14a1005
    1. Step 5

      Open a command Prompt: Windows: Start->”cmd” Mac: Applications->Utilities->Terminal.app Linux: Terminal

      Type in Command Prompt: fastboot oem get_identifier_token.

    2. Step 6

      You will see a long block of text. Copy and paste this text into the the token field below (in the Windows command prompt: Right Click > Mark > highlight the block of text > Right click to copy. Mac users can use cmd-option to mark and select text.).

      You will see one of the following two screens:

      Ref. 6a

      Ref. 6b

      When copying the token, start with this line:

      <<<< Identifier Token Start >>>> 

      And end with this line:

      <<<<< Identifier Token End >>>>> 

      (Note: Only copy the highlighted sections above. Do not copy the INFO or (bootloader) prefix)

    3. Step 7

      Paste this string of text into the token field and hit Submit in order to receive your unlock code binary file. You will receive this information in your email.

      Example:

Next you need to go to http://www.htcdev.com/bootloader/unlock-instructions/page-2 and enter you identification token there and click sumbit. HTC Dev will take you further from there.

Were you able to unlock your bootloader? Share with me your experience in comments below.

Git-Logo-2Color

git – the simple guide

create a new repository

create a new directory, open it and perform a
git init
to create a new git repository.

checkout a repository

create a working copy of a local repository by running the command
git clone /path/to/repository
when using a remote server, your command will be
git clone username@host:/path/to/repository

workflow

your local repository consists of three “trees” maintained by git. the first one is your Working Directory which holds the actual files. the second one is the Index which acts as a staging area and finally theHEAD which points to the last commit you’ve made.

add & commit

You can propose changes (add it to the Index) using
git add <filename>
git add *
This is the first step in the basic git workflow. To actually commit these changes use
git commit -m "Commit message"
Now the file is committed to the HEAD, but not in your remote repository yet.

pushing changes

Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute
git push origin master
Change master to whatever branch you want to push your changes to.

If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with
git remote add origin <server>
Now you are able to push your changes to the selected remote server

branching

Branches are used to develop features isolated from each other. Themaster branch is the “default” branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion.

create a new branch named “feature_x” and switch to it using
git checkout -b feature_x
switch back to master
git checkout master
and delete the branch again
git branch -d feature_x
a branch is not available to others unless you push the branch to your remote repository
git push origin <branch>

update & merge

to update your local repository to the newest commit, execute
git pull
in your working directory to fetch and merge remote changes.
to merge another branch into your active branch (e.g. master), use
git merge <branch>
in both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with
git add <filename>
before merging changes, you can also preview them by using
git diff <source_branch> <target_branch>

tagging

it’s recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0by executing
git tag 1.0.0 1b2e1d63ff
the 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the…

log

in its simplest form, you can study repository history using.. git log
You can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:
git log --author=bob
To see a very compressed log where each commit is one line:
git log --pretty=oneline
Or mabe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:
git log --graph --oneline --decorate --all
See only which files have changed:
git log --name-status
These are just a few of the possible parameters you can use. For more, see git log --help

replace local changes

In case you did something wrong (which for sure never happens ;) you can replace local changes using the command
git checkout -- <filename>
this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept.

If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
git fetch origin
git reset --hard origin/master

useful hints

built-in git GUI
gitk
use colorful git output
git config color.ui true
show log on just one line per commit
git config format.pretty oneline
use interactive adding
git add -i

AngularJS-large

AngularJS vs BackboneJS vs EmberJS? What I decided and why?

I was researching for Javascript frameworks/libraries to use in my next project. I found three promising JS frameworks.

  • Angular.js
  • Backbone.js
  • Ember.js

What I was looking for that framework should be easy to learn and should be integrated in the project easily. Keeping in that mind I searched a little bit about each and went through some reviews. What I concluded I’ll just say it in one line for each.

Backbone.js – You need to write lots of boilerplate code to get to working.

Ember.js – It has a steep learning curve.

Anguler.js – Just in between. Offers more than backbone and easier to learn than ember.

So, that was it! I picked Angular for my next project since it was easier to learn and you don’t have to do a lot to get it working in your project. Since, the project was new and deadline was short so this was the requirement. So, I decided to go with Angular and I’m glad I made the right decision.

What’s your call? What you picked and why? I would like to listen in comments.

windows10_windows_product_family_9-30-event-100464966-orig

Microsoft Windows 10 Great UI Changes

My first experience with Windows 8 inspired bafflement and frustration. But I walked away from my first few minutes with Windows 10 with a sense of jealousy. It looks like a significant improvement, and I want it on my PC right now.

Microsoft is launching Windows 10 as the new face of both Windows and eventually Windows Phone. At one point during Microsoft’s Tuesday press event, Terry Myerson, the executive vice president in charge of Microsoft’s OS group, called the new OS “our most open, collaborative OS project ever.” Collaborative, indeed. Microsoft is looking for user feedback, and what I demo’d on Tuesday may not be the same OS that customers receive next year.

Microsoft executives didn’t even characterize the system as an alpha; they referred to it as a “build.” So with Windows 10 tentatively scheduled to be launched around the middle of 2015, there’s quite a bit of time to change, remove or add features before the system launches.

windows10 tech preview start menuIMAGE: MICROSOFT

The Windows 10 Start Menu fues Windows 7 icons and Windows 8 Live Tiles.

That said, we can still point to various features that embody the new Windows 10 experience, and will almost certainly make the cut. These include the revamped Start menu; the new “task view,” virtual desktops and ALT-TAB features; windowed apps; and the new “snap assist” capability. Granted, I had a just a few moments to play around with each. But I quite liked what I saw, and if you sign up for the new Windows Insider program, you’ll have a chance to form your own impressions beginning on Wednesday.

The revamped Start Menu: clean, intuitive

I’m not wholeheartedly in love with the new Start Menu. Aesthetically, it looks like someone surgically conjoined the Windows 7 and Windows 8 experience. Move past that inelegance, however, and it’s darn useful. On the left, there’s a list of frequently used apps, along with shortcuts to PC settings, as well as your documents and pictures folders. At the bottom, there’s a shortcut to launch an “all apps” view.

On the right, the Live Tiles reproduce the functionality of the Windows 8 Start screen, with resizeable tiles that can dynamically show you how much unread mail is left. It appears that you should think of Live Tiles more like notifications rather than app shortcuts, although you can use them either way. Microsoft’s demo station had a large oversize tile showing the current calendar appointment, which seemed appropriate.

windows 10 start menu longMARK HACHMAN

If you want, you can resize the Start menu, increasing or decreasing its size and adjusting its position.

Also, if you want to resize the Start menu itself, you’re free to do so.

As some leaked videos foreshadowed, you can revert to the Windows 8 Start page, if you so choose. But that option wasn’t checked off, leading me to believe that most people would prefer the desktop experience.

A new Windows world: Task view, virtual desktops, and ALT-TAB

One of the Microsoft executives I talked to referred to the new “task view” as a “poor man’s multimonitor setup.” I can understand why.

Virtually all Windows users use ALT-TAB to quickly shuffle between windows. It’s a great way to move from one task to the next. That capability is still available in Windows 10.

windows 10 alt tabMARK HACHMAN

Using Alt-TAB to cycle through windows isn’t that different than Windows 8, but you can see more of what each window holds.

What’s different, however, is the new “task view” button. Down in the Windows 10 taskbar, third from the left, is a button that, when clicked, brings up an array of “virtual desktops.”

What’s a virtual desktop? Think of it as a virtual display.

If you’re running a multimonitor set-up, chances are you’re already allocating different applications to different screens: a browser window on one display, Outlook on another, and maybe a chat app on your docked notebook. But with Windows 10, Microsoft allows you to snap more than one app to a screen. So if you choose, you could fill a secondary monitor with an Outlook pane and a PowerPoint file that you’re referencing in an email to the colleague.

windows 10 taskbarMARK HACHMAN

The Windows 10 taskbar includes the Windows button, which launches the Start menu, the new Task View button, and the Search button. To the far right, the “underlined” apps show that they’re located inside a virtual desktop.

But if you have one monitor, tapping the task view button—or more usefully, Windows+TAB—swaps between desktops, which are displayed on the bottom of the display. So if you have a “project screen” with PowerPoint, a browser window, and OneNote all contained within it, you can swap to an entirely different virtual desktop, or workspace, perhaps with Facebook and Xbox Music. You’ll also notice the apps themselves are shown above the desktops themselves, so if you can’t remember what virtual desktop actually owned that app, you can just jump into it regardless.

There’s also a feature that may or may not make it to final release: On your taskbar, you’re probably used to instances of multiple browser windows stacked on one another. But in Windows 10, you may also see that app “underlined” by a horizontal bar, showing that it’s in a virtual desktop.

windows10 tech preview virtual desktopIMAGE: MICROSOFT

The new task view shows you your virtual desktops, and the apps contained within them.

For now, virtual desktops are a convenience, but they could also emerge as a security feature, allowing users to assign permissions to different ones. Microsoft officials wouldn’t tell me if they’ll be isolated from one another or “sandboxed” over time.

Snap snaps with Snap Assist and windowed apps

And what about Snap, the nifty little feature that fills half of a Windows 8 screen? That’s been improved as well. Every app in Windows 10 can be dynamically resized in a window, although it remains to be see how well this works in practice.

Windows 10 snap assistMARK HACHMAN

Snap a document to one side of the screen, and Snap Assist will suggest some others.

In Windows 8, apps can be snapped by clicking the Windows key and the left or right arrow, snapping them to the left or right of the screen. That fills half the screen. With Windows 10, up to four apps can be snapped per screen, maximizing your productivity.

What’s neat, though, is that once you snap an app, Windows 10 suggests another, similar app that you might want to snap next to it, from a small collection of windows. The feature is intended to save you the hassle of hunting about through menus to actually construct a virtual desktop. Time will tell whether these suggestions will prove useful, but it’s a good start.

You can see, however, that a number of different features—Snap Assist, windowed apps, virtual desktops—all flow somewhat organically into one another. I’m honestly interested to see what difference they make in my own daily workflow.

Last but not least: Search improvements

Windows 10 also adds a search button to the taskbar, moving the other major functionality of the Windows 8 Start page to the desktop environment. If you’re like me, you really don’t click icons on the Start page any more (or use bookmarks when searching the Web). Instead, “searching” for recent apps or documents is often quicker.

windows10 windows product family 9 30 eventIMAGE: MICROSOFT

Microsoft promises consistent experiences over a variety of form factors and screen sizes.

That approach is also found in Windows 10. Microsoft officials say that Search and File Explorer now displays your recent files and frequently visited folders, making finding files you’ve worked on faster and easier.

Granted, Microsoft’s Windows 10 demonstration was somewhat orchestrated to put its best face forward. But with potentially millions of eager Windows users prepared to bang away on it beginning Wednesday, any flaws will be quickly exposed. What’s refreshing is Microsoft is actually encouraging this, similar to the way in which “developers”—i.e., fans—were encouraged to take its latest Windows Phone builds for a spin.

Love it or hate it? Microsoft wants to know. But I think you’ll quite like Windows 10.

[This article was first published on PCWorld]

AngularJS-large

Create your first real-time AngularJS application

In my previous article I talked about creating real-time PHP application. That was on the server side and I demonstrated a very very basic client to connect with it. Let’s take that to next step and create a Javascript client with AngularJS.

Code

angular-client.html


<html>
 <head>
 css/bootstrap.min.css" rel="stylesheet">
 
 
 
 <script src="angular-client.js"></script>
<style>
 body { margin-top: 10px; }
 input.message { height: 30px; }
 </style>
 </head>
 AppCtrl">
 <form class="form-inline">
 <button ng-click="connect()" class="btn">Connect</button>
 <input type="text" ng-model="text" placeholder="input message to send" class="message"></input>
 <button ng-click="send()" class="btn">send</button>
 </form>
 
 <table class="table table-striped">
 <tr ng-repeat="message in messages">
 <td>{{message}}</td>
 </tr
 </table>
 </body>
</html>

 


angular-client.js


var app = angular.module('app', []);
app.factory('ChatService', function() {
 var service = {};
 
 service.connect = function() {
 if(service.ws) { return; }
 
 var ws = new WebSocket("ws://localhost:8080");
 
 ws.onopen = function() {
 service.callback("Succeeded to open a connection");
 };
 
 ws.onerror = function() {
 service.callback("Failed to open a connection");
 }
 
 ws.onmessage = function(message) {
 service.callback(message.data);
 };
 
 service.ws = ws;
 }
 
 service.send = function(message) {
 service.ws.send(message);
 }
 
 service.subscribe = function(callback) {
 service.callback = callback;
 }
 
 return service;
});
 
 
app.controller('AppCtrl', ['$scope', 'ChatService', function($scope, ChatService) {
 $scope.messages = [];
 
 ChatService.subscribe(function(message) {
 $scope.messages.push(message);
 $scope.$apply();
 });
 
 $scope.connect = function() {
 ChatService.connect();
 }
 
 $scope.send = function() {
 ChatService.send($scope.text);
 $scope.text = "";
 }
}]);


Details

It is pretty straightforward. We created an Angular Service and consumed that in our Angular controller. The only purpose of Angular service is handling communication. It will hand over the message to the subscriber in our case Angular controller and controller can do anything with that message. Here since we demonstrated the chat application so controller displays that message received.

That’s it! so simple.

Note: Both HTML and Javascript files are also available on Gist.

Code was referenced from here.

 

 

ratchet-logo

Create your first real-time PHP application

If you ever wondered if there is a way to write a real-time web application using PHP where any event or message is delivered/pushed to all recipients as they occur, in real-time? Then you are at right place. We’ll be building a sample real-time chat application using PHP and Ratchet and all messages will be pushed to all recipients in real-time. There are other technologies like node.js and socket.io but obviously there is a learning curve. If you don’t have time to learn a new thing or just want to stick with PHP then keep reading.

Goal

The goal of this application is to write a simple Chat application. Chats in event-driven programming are the “Hello World!” of applications. The chat will accept all incoming messages and deliver that message to all other connections.

The Chat class

Note: This document assumes you are familiar with PSR-0 and Composer. See Installation if you’re not yet familiar with this.

We’re going to hold everything in the MyApp namespace. Your composer file should look something like this:

{
    "autoload": {
        "psr-0": {
            "MyApp": "src"
        }
    },
    "require": {
        "cboden/ratchet": "0.3.*"
    }
}

We’ll start off by creating a class. This class will be our chat “application”. This basic application will listen for 4 events:

  • onOpen – Called when a new client has Connected
  • onMessage – Called when a message is received by a Connection
  • onClose – Called when a Connection is closed
  • onError – Called when an error occurs on a Connection

Given those triggers, our class will implement the MessageComponentInterface:

<?php
namespace MyApp;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {
    public function onOpen(ConnectionInterface $conn) {
    }

    public function onMessage(ConnectionInterface $from, $msg) {
    }

    public function onClose(ConnectionInterface $conn) {
    }

    public function onError(ConnectionInterface $conn, \Exception $e) {
    }
}

You’ll notice, in addition from just implementing methods from the MessageComponentInterface, we’ve given our application a namespace and are accepting the ConnectionInterfaceclasses. This class, usually implemented by a Connection instance, is a representation of a client’s connection on the other side of the socket. On each of the four triggered events, the client Connection representation is passed. These objects are re-used, you will receive the same Connection sometimes.

Save this as /src/MyApp/Chat.php. We’ll come back to our Chat class soon.

Instantiation

Our Chat class will be our application logic. Next, we’re going to piece together our shell script. This is the script/file we will call from the command line to launch our application.

<?php
use Ratchet\Server\IoServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new Chat(),
        8080
    );

    $server->run();

Above, you’ll see we create an I/O (Input/Output) server class. It stores all the established connections, mediates data sent between each client and our Chat application, and catches errors. The new instance of Chat class then wraps the I/O Server class. Finally, we tell the server to enter an event loop, listening for any incoming requests on port 8080.

Save this script as /bin/chat-server.php. Now, we can run it with the following command in your terminal:

$ php bin/chat-server.php

The script should now execute, taking possession of your terminal. You can cancel the script, as we’re not quite finished yet.

Logic

So far, we’ve just set up structure, both in our shell script and our Chat class. Now, to add code to our Chat to complete our application.

Let’s add some logic to our Chat class. What we’re going to do, is track all incoming Connections, in order to send them messages. Typically, you would store a collection of items in an array, but we’re going to use something called SplObjectStorage. These storage containers are built to store objects, which is what the incoming Connections are.

<?php
namespace MyApp;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {
    protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;
    }

    public function onOpen(ConnectionInterface $conn) {
        // Store the new connection to send messages to later
        $this->clients->attach($conn);

        echo "New connection! ({$conn->resourceId})\n";
    }

    public function onMessage(ConnectionInterface $from, $msg) {
        $numRecv = count($this->clients) - 1;
        echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"
            , $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');

        foreach ($this->clients as $client) {
            if ($from !== $client) {
                // The sender is not the receiver, send to each client connected
                $client->send($msg);
            }
        }
    }

    public function onClose(ConnectionInterface $conn) {
        // The connection is closed, remove it, as we can no longer send it messages
        $this->clients->detach($conn);

        echo "Connection {$conn->resourceId} has disconnected\n";
    }

    public function onError(ConnectionInterface $conn, \Exception $e) {
        echo "An error has occurred: {$e->getMessage()}\n";

        $conn->close();
    }
}

Running It

Complete, let’s run it and test it. Open up three terminal windows, typing:

$ php bin/chat-server.php
$ telnet localhost 8080
$ telnet localhost 8080

In each of the telnet windows, type a message (“Hello World!”) and see it appear in the other!

Next Steps

Now that we have a basic working Chat application, let’s make that work in a web browser (Chrome, FireFox, or Safari [for now]). First, let’s go back to our chat-server.php script. We’re going to utilize another component of Ratchet; the WsServer class:

<?php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new Chat()
            )
        ),
        8080
    );

    $server->run();

Run the shell script again, open a couple web browser windows, and open a javascript console or a page with the following javascript:

var conn = new WebSocket('ws://localhost:8080');
conn.onopen = function(e) {
    console.log("Connection established!");
};

conn.onmessage = function(e) {
    console.log(e.data);
};

Once you see the console message “Connection established!” you can start sending messages to other connected browsers:

conn.send('Hello World!');

This post was extracted from Ratchet documentation.


mod_rewrite_logo

How can I test if mod_rewrite on my server is enabled and working?

Note that mod_rewrite can only be used with web server Apache. Follow the instructions below to check whether module mod_rewrite is installed and correctly configured on your server.

Create the file .htaccess and add these two lines

RewriteEngine on
RewriteRule ^testing.php$ modrewrite.php

This tells the web server to load modrewrite.php when testing.php is requested.

Create the file modrewrite.php with this line

<?php echo "mod_rewrite works"; ?>

Create the file testing.php with this line

<?php echo "mod_rewrite does not work"; ?>

Now use your web browser to load testing.php. If you see “mod_rewrite works” your server has a working mod_rewrite instance. If you see anything else, including an internal server error, your server is not properly configured for mod rewrite.