GIT SHIT (deep shit, crazy tool)

0

Disclaimer Smaller Agile Teams (5 members)
I miss the svn days. Frankly the only issue and pain svn gives is when you copy folders from one place to another within it. That is the only time when it gives you grief without bounds. If you just create the new folder and copy the files in that folder things are GREAT with svn.

Now that I have moved to GIT, have realized a few tricks to survive. So here goes
1) Dont install any git plugin on eclipse
2) Dont think GUI will make it any easier, it will only make matters worse
3) Command line is your saviour

To get code from the repository to your machine
use clone

To checkin code to the repository after you made changes (and in the mean while someone else checked in stuff)

1) git add *
2) git commit -m "message"
3) git stash, this is for backing up your changes until you can syncup code from the repository
4) git pull, get the code from the repository
5) git stash pop, overlay your changes on the latest code
6) now, go back to your IDE and fix all the errors and conflicts, use merge tools
7) hit git commit -m "message", again
8) PRAY someone else has not checked in between step 4 and now :)
9) PRAY HARDER
10) When GOD RESPONDS, with a GO AHEAD
11) git push
12) Dance..
13) Your code is someone elses problem now.. hahahahha

Errors in Git and what they mean

Error
warning: push.default is unset; its implicit value is changing in bla bla bla.. JUST SHUT THE F up....

related stackoverflow question

What to do, since its a small team and you wont have any branches just run
git config --global push.default matching

What happens then ? Life is good again.. no more irritating long error messages that dont help.

Continuous Collaboration with Mingle, SVN, Email and Wiki – Part 1 (Forming)

0

Agile has been around for sometime now. Most use it as a buzz word, not benefiting from its core principles people maturity and and need to extreme communication. This development life cycle is initiated by developers essentially. Think about it. All that CMMi gives you, is a top bottom approach. And since the acceptance of the young generation to agile is just so high, CMMi has to give way. So they just “accept” what you say, and today CMMi is just a certificate with very less value with the young generation.

Obviously just like PMI, CMMi is struggling to prove its point today. That processes are important and if not done the CMMi or PMI way, will fall flat. The fact remains that organizations with PMI and CMMi are falling flat. They no longer do the amount of software development they use to. They now focus their business on “servicing” software products already developed. Basically they could not keep up with the pace. Not their fault in my opinion, just that the pace is too fast for anyone to keep up.

It needs you to think that you are “worthless”, and start studying again. Pick up your database book, design patterns book and programming language book and start writing some code, debuggers, watch’s. Get your head out of excel sheets, ppts and mpp’s :). It is when you dont get your head out and start studying, you realize that you cannot keep up with the pace. And start believing that without CMMi and PMI projects cannot run. Until you get a rude wake up call by a young engineer (but considering the youngsters today, I dont think they care about wasting their time with you). So guys/gals wake up. Get your head out, and into the right things.

So what has this got to do with Continuous Collaboration. Well, everything.

The above was a wake up call for you to realize that today running projects is about collaboration. As a manager if you frequently think, “if the Iteration Manager/Business Analyst will do this, what will I do”, its time for you to wake up (read the first few para’s).

You have to do some real contribution. Martin Flower says it. Write some code (gain respect of your fellow’s). Create a framework that can replace and refactor some dirty code. Reproduce some bugs, play with the interim builds of the product and give valuable feedback. Dont need your tech leads to sit thru all meetings to give feedback to UX. In other words do some real contribution. Ask relevant questions, effectively communicating with lesser words and more diagrams. Do some tech talks. Show them that analytical ability only increases with time and age, and not the other way around.

zXing into Android for Barcode reading functionality (original project 100Mb, imported 3Mb)

17

The zXing documentation is rather complex. A simple task of integrating the zXing library can be painful. Here I am trying to document the steps needed for including zXing as part of your android application.

We have 2 choices. Either to include all the source as part of the android application project itself, or create a new project and import relevant files into this new project. Obviously if you create a new project we need to add the zxing project as a dependent project to your android app project.

This is what I did and things worked for me. I was able to only include 3Mb worth files, instead of the entire 105 Mb.
– checkout the sources from (using svn) http://code.google.com/p/zxing/source/checkout
– Use svn export on the checkedout project, so that you dont get the .svn folders (if u miss this step, you will not be able to import this project into your svn server)
– Create a new java project
– Right click on src directory and hit import
– Select only the “src” sub directory of the following zXing project directories
* core
* javase
* android
* androidtest
* android-integration
– Do not import the test directories from core/javase/android/androidtest/android-integration at first. Do the src imports, get things to work and then play around with test (the same way you did the src).

In your AndroidManifest.xml

In your button click

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
intent.putExtra("SCAN_MODE", "ONE_D_MODE");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myAndroidAppActivity.startActivityForResult(intent,0) ;

In your response listener (source of below code snippet, http://stackoverflow.com/questions/2050263/using-zxing-to-create-an-android-barcode-scanning-app)

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}

Troubleshooting
Q : Getting multiple errors in the src directory of my new project. The import changed the package name to something like “android.src.com.google……”.
A1 : While you import you need to “right click” on the “src” folder of your new project. And hit import. You may have selected import on your project instead of the “src” folder.
A2 : While importing you may have selected the folder “android”, instead of “android/src”.

SVN for developers (avoid all svn Error: 155005 Error: 150002 Error: 200009 Error: 155007)

2

This blog will help you “prevent” all the svn shit you and your team have been going thru.
– As a developer I care for coding, a tool is to help me make things easier. svn helps, but has its own pitfalls. I have managed to find a organized way of doing things that help me keep things clean.
– As a manager, I cant let my dev’s fall into the trap of svn issues.

You and me both know that a troublesome svn commit can kill your evening. Right ?

So I’ll try to explain and go into detail of every step explaining “why” too, but you dont have to understand why. Just follow the steps and you should be fine.

Create 3 directories (checkout, wip and bb)
wip stands for work in progress, you knew that.. didn’t u..
bb stands for buddy build

1) You use “svn checkout” to get your project from the svn server.
2) Now dont start work, copy these files to your “wip” directory. Do all that you want to here.
3) When you are ready to checkin, create a subdirectory in your bb directory. May be call it YYYYMMDD. In this directory create wip and checkout directory.
4) copy stuff from the wip directory to your bb/YYYYMMDD/wip directory
5) in your checkout directory, run a “svn update” so that you get the latest from svn
6) copy the project from your checkout directory to your bb/YYYYMMDD/checkout directory
7) Now, open a directory compare tool, meld, araxis merge or beyond compare. On the left keep your bb/YYYYMMDD/checkout directory and on the right keep you bb/YYYYMMDD/wip directory
8) Move only “files” from your right to left, DO NOT move directories. Delete files in your checkout directory if need be
9) Copy your bb/YYYYMMDD/checkout directory to your checkout directory and overwrite your checkout folder
10) Build the bb/YYYYMMDD/checkout directory to ensure that you dont mess up the build.
11) in your checkout directory do a ‘svn status’.

This is where the fun starts
For every ? do a svn add file/directory name
For every ! do a svn delete file/directory name

12) Do a ‘svn status’ again unless you get a M, A or a D against all the files (MAD). If you have a MAD, then you are ready for commit.
13) ‘svn commit -m “your message”‘. It will work :).

Now, why create so many directories.
– checkout is obvious, you want to get the latest and best from svn folder
– wip is obvious, you want to work somewhere, with no worries to get screwed by a svn update
– bb, is not obvious, a file/folder compare can screw up very easily. If you move a file from left to right instead of right to left, you are screwed. you can loose all your changes in your wip folder.
– why step 9, you ask, since you dont want to check in .class files and .obj files right ?
– why only copy files and NOT directories. Since svn maintains the state of your file/directories in a hidden folder .svn. If you copy directories, you can overwrite your checkout folder and mess things up.

More details for the people who want to know about the svn commands.
svn checkout – will check out the files from the project.
Here you will edit your source files, unit test to ensure that u have all covered. By now you have 3 things to worry about.
1) Someone else make checkins to the same project you are working on.
2) Someone made changes to your source files
3) You may break them, or they may break you.

svn status – will check the status of your files. Ideally you should just have a M, A or a D before each file name. M, meaning modified file, A meaning this file was added to your directory and D, meaning a file was deleted.

svn status -u – will do that sanity check for you. It will return a list of files with the result of the sanity test. The character denotes the status of the file you have checked out.
U means the server has a more later checkin of the file, from the last time you checkedout/updated the local working repository
G means that svn can automatically merge the files (the changes are in different parts of the source code)
C There are conflicts, same part of the code has been modified by a different dev on the svn server. This needs to be merged manually.

(CVS guys please note : cvs update does both status and update of svn, so get used to using status and update separately on svn).

For every file labelled C on the svn status output, 3 files will be created .mine (file before editing), .rold (file after editing), .rnew (updated file from svn server)

One more change is made, to your original source file. Markers are added to your orignial code to identify what code was yours and what has come from the svn server.

To Merge you have the following options
– Manually edit the source file, since you can search the markers, you can identify and play around with the code.
– Use a graphical tool like kdiff3 source.cpp.mine source.cpp.rnew -o source.cpp
– Use tkdiff -conflict source.cpp
– Junk the changes, you dont want changes from the svn server :), svn revert source.cpp

Hope I have kept it simple for you to understand and play round with.

Accessing your home SVN server from office (Server setup)

0

Objective : of this exercise is to allow svn server access from my broadband connection at home.
Hardware Setup : BSNL twisted pair telephone connection, connected to a ADSL router. The ADSL router is connected to a Linksys wifi router. I plan to put a UTM device between the ADSL and Linksys. But thats for later.
ADSL has a external IP and a internal IP
Linksys router has a external IP and a internal IP

The choice I have is to create 1 subnet between my ADSL and Linksys and 1 subnet between Linksys and laptops/desktops. But thats for later. I rather have one subnet for ADSL, Linksys and my desktops/laptops.

The choice is to have DHCP configured, but thats for later :).

You see what I am doing here, I am focusing on just getting the following test thru.

Tests :
Environment,
1) svnserve -d running on desktop with ip 10.0.0.20. By default it runs on 3690.
2) Create a repository “svnrepository”
3) Import a “test” project to the repository
Test
1) svn list svn:\\10.0.0.20\svnrepository, Result expected “test” should be listed as a project.
2) svn list svn:\\\snvrepository, Result expected “test”, that is if the linksys router is correctly.
3) svn list svn:\\\svnrepository, Result expected “test”, that is if the linksys router is correctly.
4) svn list svn:\\\svnrepository, Result expected “test”, that is if the linksys and ADSL router are correctly.
5) svn list svn:\\\svnrepository, Result expected “test”, that is if the linksys and ADSL router correctly.

I can use http:\\ping.eu website to test if svn port 3690 is open on my network (the ip address is the external ip of the ADSL router).

Extra Information
Why do I call the ADSL as a router, and not a modem. Look it up on wikipedia. ADSL is a router, since it has DNS, DHCP, NAT and other router capabilities. A modem is a simple modulator/demodulator. Just so that I use the correct technical terminology.

Impediments
– The ADSL router I have does not expose the port forwarding interface to its configuration http page. So I have to telnet to it :).
– The linksys router has more configuration than just port forwarding, I need to read up and get the funda’s right here.