Category Archives: Open Source

Openess v.s closeness

Open v.s close

Open v.s close

I have a long support for open source system, the open standard, a more open and shared data in the web. 3 years ago, I thought that the win of Android is obvious and the reality has proven me right. I was confident with my knowledge and guessing until I read a long fan boy of Apple. Yes, he is a fan boy of Apple, and the article has really favoured Apple. But he made an important point great product wins. Not the great product in terms of technology, nor in terms of openess. It is a great product in users’ minds, either by its value provision or by good marketing.

By opening the platform, Android opens the door for more hardware suppliers. But that openess means nothing if the operating system sucks, it means nothing if the compatibility and the user interface are not good. Looking at Linux and all the free open source operating system. They are more opened, easier to adopt into the hardware by the suppliers, but they suck. Either the UI, the lack of applications and features, but they suck.

I think this article gives a very good point of view as well.

iPhone v.s Android

The smartphone game is over. The tablet game will be finished soon, within 2 years.

iPhone versus Android

iPhone versus Android

 

 

Android wins, iPhone loses. 75% v.s 15%, soon will become 85% v.s 5%. But that doesn’t matter much for Apple. Apple is a brand for high-end products. They don’t aim to gain all market share. To gain market share, Apple has to attack more of the low-end market, which means they have to lower their price. However, matching other supplier’s price may be harmful for Apple’s brand, although they may achieve it by more efficient supply chain and factories.  To become a high-end brand, Apple spends a significant amount of money on their brand and will not scarify it for the market share.

But in this ecosystem war, the bigger ecosystem leads to a win by monopoly. When 75, 80 or 85% of the market is using Android, app developers will flock to there, and make the ecosystem become much more valuable for customer. To continue earning a lot of money, Apple has to continue what it has done best under Steve Jobs’s empire. New product, new market, new value, or new software that people are willing to purchase with high-price.

What will be the next Apple’s product? Probably Apple TV, I am not even sure about that.

And the important questions for most of us, as app developers, what should we do? Should we all move to Android yet, should we change our strategy of iOS first, Android second? Or should we start discussing about Mobile Web App?

I am writing more on the Mobile Web App v.s Mobile Native App in the next post, catch it soon.

Legal Case: Apple v.s Samsung

Apple v.s Samsung

Apple v.s Samsung

From CNN  and ABC:

(CNN) — A federal jury in California on Friday recommended that Apple be awarded more than $1 billion in damages after finding Samsung was guilty of “willful” violations of a number of Apple’s patents in the creation of its own mobile products.

(ABC) — Apple has scored a sweeping legal victory over Samsung as a US jury found the Korean company had copied critical features of the hugely popular iPhone and iPad and awarded the US company $1.051 billion in damages.

 

Finally, the legal battle seems to be over. I do not favor Apple much in this case, although I said earlier that a clone and direct copy should be avoided. But many later cases of the Samsung devices do not copy that much, so it would not be so fair that Samsung still has to pay for that fine. Apple has released so many secrets  that would come and harm them later.

This legal victory will certainly scare other android device owners like HTC…

 

http://edition.cnn.com/2012/08/24/tech/mobile/apple-samsung-verdict/?hpt=hp_t3

http://www.abc.net.au/news/2012-08-25/apple-wins-us-court-case-against-samsung/4222348?section=business

 

iOS Readability Parser

Hearie - News Aloud

Hearie - News Aloud

 

 

I have just released part of my source code in the Hearie project to be open source, this project will do the html readability parsing by objective-C. It still has some issues over threading, performance and may not work with all sites.

Feel free to use it and contact me if you have any issues

 

Hearie gets rid of distractions in webpages. Also, a high quality voice reads the content for you.

How many times have you complained your iPhone screen is too small to read? Hearie removes all useless contents including advertisments, links and more. Open your Safari, go to New York Times, tap our button and enjoy.

Hearie reads the content for you with human voice. Free your hands and eyes. Plug in your earphones and hear the content.

Robocode New Beta Release

Robocode Logo

Robocode Logo

 

Robocode has released a beta version for 1.7.3.0, I am happy to contribute 1 feature and 1 bug fix in this release. Please download, test it and tell us any bugs you found

 

 

 

Reference:

Robocode in SourceForge

New Twitter XAuth and Sharing on iPhone

This Twitter sharing library for iPhone has a great User Interface, comparing to my current library for Twitter Sharing, the only problem is that it does not work with new XAuth project. So, I decided to take that UI and merge into my existing codebase for twitter xauth and sharing. The new library allow you to login, share and logout

https://github.com/vodkhang/Twitter-XAuth-and-Sharing

And here is the result. It looks great and really like the UIAlertView in iPhone

Login To Twitter with iPhone

Login To Twitter

Share on Twitter

Share on Twitter

 

 

 

 

 

 

 

 

 

 

 

 

http://amanpages.com/sample-iphone-example-project/multiple-login-for-twitteragent/

Why should we join and support community?

There are always people keep asking me the same question: “Why do I actively join free community like Stackoverflow/BarcampSaigon/MobileDevCamp/My Blog/Top Coder? What is the value and the benefit?”. It is nice that people ask this question and actually think about it. And I hope that I can answer them fully with this post somehow.

vodkhang on stackoverflow

1/ Fun.

It is fun. Really? Yeah, it is actually fun. Wait a little bit, why is it fun for working? I love playing game, I love to see my level going up and my mark changes everyday, I love beating the top challenging problem. It is just so fun there. If you still suspect this for somehow, I would rather ask you why you play football and play guitar in the church outside of working time. If you think this is not a good example because people don’t have headache over those things, then we take a look at some others. Do you play chess? Why do people play chess and what is the value and benefit when playing chess? If you can figure out the answer at this point of time, then we are done. It is fun, that should be it.

At this point of time, if you still don’t feel anything fun to do so, I don’t know if you should continue reading about other benefits: brand advertising, learning and contributing. If you don’t get fun out of the work, especially the overtime work, it is hard to persuade the goal just by other visible benefits. Moreover, these benefits are only long-term seeing and require lots efforts and time.

2/ Brand Advertising/Social Networking & Trust.

WordPress Sharing

WordPress Sharing

Brand Advertising and Social Networking is important. When you actively join communities, you get to know more people and more people get to know about you. Nobody knows if these people turn out to be your next employer or your next friend that can help you out in the difficult situations.

I partly believe in the theory that sometimes, we should hire people that we are familiar and can trust rather than hiring some talented stranger. So, when people can see how you engage to help the community, people started to trust you. The more people know about you, the more people may trust you. And when people can trust you, they can give you the chance to work together or hire you as an employee or even work for you.

Moreover, these things are not built overnight, there is no overnight success. It may take you couple of months, or even years to write a blog and only your friends read it. It is the same with answering on stackoverflow, topcoder. It takes years for you to reach to an acceptable point that people start to recognize your name/your company’s name.

3/ Learning & Contributing.

Open Source

GNU Open Source

Now, we go to the last reason. It is the last not because it is the least important reason, it may be the most important reason for many people. However, many people want to see the something visible, something that either gives them lots of money or reputation to move forward to their career first. So, I just leave them read things they want to read first.

It is so obvious. When you answer something in stackoverflow, it is either help you to solid your knowledge or help you to think deeply to debug. I really like debugging on stackoverflow, it is challenging. You have to find the bug as soon as possible, and sometimes, you don’t have debugger, you don’t even have IDE to help you. You just read over the code, verify each line of the code and try your best to guess the part that can create the bug. That’s challenging and fun, actually.

References:

http://iphonedevelopment.blogspot.com/2010/12/non-deterministic-problems-aka-finding.html

Image Sources:

http://stackoverflow.com/users/flair/227698.png

http://en.flossmanuals.net/floss/publish/WordPress/rsrc/WordPress/Introduction/icon_big.png

http://t0.gstatic.com/images?q=tbn:ANd9GcQj7UR1webcv1NlEzFaRpAUeudZjWyOYYAA27iiaxot4X9vdDa2

Twitter: XAuth + Sharing

DDSocialDialog for Twitter

DDSocialDialog for Twitter

Showing a place for logging and sharing a tweet in Twitter with my new library. You now can use XAuth without even understanding about how it works and you also have a nice facebook-style pop up.

For details about XAuth and how to use the XAuth functions, you can follow this link: Aralbalkan’s blog and his feather apps.

For showing a Twitter Pop up Dialog, I appreciate the effort of DDSocialDialog and the quick image is like in the left hand image.

I hope that this will help other iphone developers and me to cut their time and efforts to redo this dialog again and again.

 

iPhone Http Server – Bug Fix

Recently, I encountered a serious bug in Cocoa Http Server (for iPhone) that took me and my colleagues time to fix it. However, it turned out to be a simple, easy to fix bug.

If you use the sample code (e.g iPhoneHttpServer3.zip) in the google site, you will sooner or later, recognize a bug that if you upload a file B if file A is still uploaded, you get a crash. Another crash case is that you request to a page, turn off the server and turn it on again, and then upload a file into the server, you get a crash.

What’s going on? Why does this server not behave like any other web servers we know? Generally, the bug is due to the fact that some variables are not init in the correct place. The server assumes that whenever you send it a get request, it will init the data for handling the POST request, which is not always correct. Here is the way you can fix it. Or you can just redownload the whole sample code for CocoaHttpServer for iPhone here
In file HTTPConnection.h

@interface HTTPConnection : NSObject

{

// vodkhang

// Added properties

NSInteger dataStartIndex;

NSMutableArray *multipartData;

BOOL postHeaderOK;

}

// vodkhang

// Added methods

- (BOOL)supportsPOST:(NSString *)path withSize:(UInt64)contentLength;

@end

In file HTTPConnection.m

@implementation HTTPConnection : NSObject

/**

* This method is called after the socket has successfully read data from the stream.

* Remember that this method will only be called after the socket reaches a CRLF, or after it's read the proper length.

**/

-        (void)onSocket:(AsyncSocket *)sock didReadData:(NSData*)data withTag:(long)tag {

. . .

// Find some places look like this

if(expectsUpload)

{

// Reset the total amount of data received for the upload

requestContentLengthReceived = 0;

// Prepare for the upload

[self prepareForBodyWithSize:requestContentLength];

// Start reading the request body

uint bytesToRead = requestContentLength <

POST_CHUNKSIZE ? requestContentLength : POST_CHUNKSIZE;

[asyncSocket readDataToLength:bytesToRead

withTimeout:READ_TIMEOUT tag:HTTP_REQUEST_BODY];

// vodkhang

 // Add this line in

[self supportsPOST:@""  withSize:0];

}

else

{

// Now we need to reply to the request

[self replyToHTTPRequest];

}

}

// vodkhang

// Add this method:

/**

* Returns whether or not the server will accept POSTs.

* That is, whether the server will accept uploaded data for the given URI.

**/

- (BOOL)supportsPOST:(NSString *)path withSize:(UInt64)contentLength

{

//     NSLog(@"POST:%@", path);

dataStartIndex = 0;

multipartData = [[NSMutableArray alloc] init];

postHeaderOK = FALSE;

return YES;

}

@end

In file MyHTTPConnection.h

//  Remove properties dataStartIndex, multipartData and postHeaderOK
// Remove method `supportsPOST:(NSString *)path withSize:(UInt64)contentLength;`

In file MyHTTPConnection.m

// Remove method

- (BOOL)supportsPOST:(NSString *)path withSize:(UInt64)contentLength;

I hope it works well. If you have any problem, feel free to contact me at : vodkhang@gmail.com

Git auto and tips (windows + OS X)

Git auto and configuration

Git Configuration Tips

1/ Configure git with your identity and colors:
To make some identity and colors change, type this line in Terminal:
vi ~/.gitconfig
Then enter (put your name instead of mine)
[user]
name = Khang Vo
email = vodkhang@gmail.com
[color]
ui = auto
2/ Git alias
You can also define some git aliases for the shell command line by doing vi ~/.gitconfig
Enter these lines (these aliases are just my suggestions — you can change it if you want, but here is my preference)
[alias] st = status ca = commit -am br = branch co = checkout lg = log -p au = add -u l = pull s = push
Reference:
https://git.wiki.kernel.org/index.php/Aliases

3/ Bash shell auto-completion

In Windows, auto completion is by default, in Mac OS, you have to manuall set it up to have auto completion. These steps will help you to have an auto complete git on your MAC machine. It also display the current branch when you are in a git repository.

cd /tmp
git clone git://git.kernel.org/pub/scm/git/git.git
cd git git checkout v`git --version | awk '{print $3}'` cp contrib/completion/git-completion.bash ~/.git-completion.bash cd ~ rm -rf /tmp/git echo -e "source ~/.git-completion.bash" >> .profile
vim .profile
Put the following line
PS1='u@h:W$(__git_ps1 " (%s)")$ '

Then restart your terminal

4/ Pull/Push auto-completion

By default, the git pull auto complete will contact with server. If you want to make auto-complete always complete using local branch names, then you can change the behavior.
This might only be useful if your local branch names are identical to remote branch names.

Edit the file
~/.git-completion.bash and around line 458, look for this code:

fetch)
if [ $lhs = 1 ]; then

        __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    fi
    ;;
pull)
    if [ $lhs = 1 ]; then
        __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    fi
    ;;
push)
    if [ $lhs = 1 ]; then
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
    fi
    ;;
esac

…and change it to this:

fetch)

    if [ $lhs = 1 ]; then
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
    fi
    ;;
pull)
    if [ $lhs = 1 ]; then
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
    fi
    ;;
push)
    if [ $lhs = 1 ]; then
        __gitcomp "$(__git_refs)" "$pfx" "$cur"
    else
        __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur"
    fi
    ;;
esac

(Notice that we changed the “fetch” and “pull” sections to use the same logic as “push”. This means it will be looking for local branch names instead of remote branches.)

Reference: http://superuser.com/questions/137689/git-pull-auto-complete-osx

http://blog.recursivity.com/post/834210510/there-is-something-rotten-in-the-state-of-computer