Tag 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.

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

iPhone development tools

Working with Iphone development is working with OSX, and we always need good tools and software for both IPhone and OSX environment to boost our productivity and reducing the repetitive, boring jobs

1/ Multitouch, Accelerometer and more : ISimulate

An application allows you to use your real iphone to control the IPhone Simulator. There is nothing better than the real IPhone device to get the real user feeling. The reason is that it will save a lot of time for you when you only build on simulator, debugging on simulator and you have a wide screen to see.

2/ Memory static analyzer : Clang

Help you a lot in the managed memory environment of iphone development. Good news is that the new XCode (3.2) will integrate directly with Clang help you to analyze and find memory leak much faster.

3/ Google tool box for Mac

You cannot write a good iphone app development without writing good unit testing. And I suggest you to use Google toolbox for Mac with a lot of supports, easy to integrate into your project. It is better than the default OCUnit in XCode. It also really runs your code, which takes more time, but gives you a real, better result and can help you to deal with some File IO or real code you need to run when running unit test.

4/ UI Automation Test: XCode Instrument

Stop running the UI everytime you fix a bug or adding new feature. UI Automation Instrument is a best tool for you like robot proxy in web testing.

5/ Screen capture software: Jing

Good, free software with high quality captured video. Good use for demo.

Catupre Screen Software

6/ Chat client: Adium or Imo

Why do I put a chat client here? Everybody need some way of communication, especially if some of your co-workers or clients are not there. In Mac, you can use Adium to integrate a lot of chatting services like Gmail, yahoo…

Open source and the openess

After learning and discussing to developers around me, I have some of my thoughts on open-source world and the more general one, the openness of the world. I will try to walk through some posts about this issue to discuss around those things. From now on, I will use open source software as a general term for open source software, library and framework. The viewpoint is quite based on start up environment.

What is open source?

Open source software is software that allows people to view the source code, to change, to modify or to link it (library, framework) with your software or system to build a new, bigger or better one.  It really depends on the license of the open source that I will list and discuss some of them later.

Open Source Users’ benefit?

In short, it can be quoted by Newton:”If I have seen further it is only by standing on the shoulders of giants” (http://www.cippic.ca/open-source/). Open source software development embraces this principle.

  • No buying cost => can try and fail then try another easily. (but it is not free, read the disadvantage part)
  • When there is an error, everybody knows and tells it out.
  • If you work with something really new, nobody else works on that before or no library reaching to the point that is acceptable to your application. You will know how much important it is to allow you to modify and extend a library. Famous companies will not take a big risk to go ahead in risky and new area to support you.
  • Can be already tested well by the huge community if there is a bug, people can find it already for you, already posted a patch for you.
  • Community Documentation is also a benefit when many people already asked and answered about the software.

Any risk or drawbacks?

  • Not all the open source software is good. Those open source software require a lot of testing from community. You may sometimes take a big risk yourself. My team already experienced some stupid bugs from an open source library. There is no 100% guarantee. If you buy some service/framework/library, you can sue them for the bad quality.
  • “Linux is free, if your time has no value” is correct no matter how you love Linux. You have to pay time for learning it, for testing the new library to make sure it runs like it is declared.
  • Many open source software is really bad at documentation. Some people create open source software just for fun, so they sometimes are not expert, not professional and not responsible enough to document it well.
  • The open source software can become out of date at sometime. When the authors start getting bored about their products and become too busy, they just don’t update it frequently. I have quite few experiences on open source software development, but I can see that all software need a leader, it can be an original author or can be any other people. It can be right that the whole community can contribute. However, if the software has no shared vision to grow or no people make sure that it keeps growing, it will become out of date soon

Licenses of Open Source

Now, I will move to the next part, which somebody may still misunderstand about it, the license. I will move from the most generous license to the strictest license. The license will really determine how we can use the open source software, varying from almost open like you can copy and redistribute it to really strict like you can only link to the library

Absolutely open, you can distribute, recreate, copy using whatever means you want.

Like public domain, but with a little bit more restriction: the name of its contributors is not allowed to be used to promote the software use the open source. Both of them have a little bit difference that you may want to read more yourself.

  • GNU GPL General Public License

This one is like BSD and Apache but it is stricter. If you modify the copy/copies or a portion of it, use it or distribute it, your program MUST BE under the GNU GPL.

It is GPL but with less strict. It means, if you modify the program, you still have to distribute your work under the same license. However, if you just use the open source program like a library (which means you link to it by source and compiled code), you are allowed to distribute your program

References and additional Materials

Software Engineering Process and Tools lecture, Quang Tran

http://www.informit.com/articles/article.aspx?p=376255

http://www.tamingthebeast.net/articles5/open-source-software.htm

http://googleblog.blogspot.com/2009/12/meaning-of-open.html

http://www.cippic.ca/open-source/

http://en.wikipedia.org/wiki/BSD_licenses

http://www.apache.org/licenses/