code's life
Better Code, Better Life
Better Code, Better Life
Sep 2nd
As I mentioned before http://nvie.com/git-model really gives a start point for you to arrange the branch disciplines for your product development, the main concepts are
Since we use gitolite now, therefore, I try to map it to rules in gitolite, the use case are
I take a look at the document in gitolite http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd#security_access_control_and_auditing, and have below in hands (part of conf/gitolite.conf)
@gearteam = alice bob charlie dave
@cmteam = euler
@admins = user
repo app
RW master$ = @cmteam
RW refs/tags = @cmteam
RW develop$ = @gearteam
RW+ = @admins @cmteam
And I made a quick test using alice and euler account, seems working
, I am checking with gitolite google group to get support to see whether it fullfils my needs.
[updated: corrected by sitaram, originally I treat the supporting branches exist in local only]
[updated: corrected by sitaram, it should be develop$ instead of develop to avoid develop1, develop2..]
Aug 27th
I am big fans of opensource development, and sourceforge.net is my favorite before, not now.
When sourceforge is started, it opens the door for lots of designers to share codes, and most of popular tools are host there, now you can notice most of projects are started to host in http://github.com and http://code.google.com , (not touch http://bitbucket.org now), what is the reason ?
Is it because github provides git and google code provides mercurial (hg) ? No, I don’t think so, one reason is that github, google code provides wanted features quickly and nicely.
Normally you need request the project and fill something (category) and start to introduce the project (since it is where user will access).
clean homepage and fast access, it is more like iPhone and other phone, yes functionality is almost the same, but the user experience is total difference.
Let’s show other nice features in github, every feature you can find it in sourceforge, just slow and not user friend.
online edit: When I browse code in github, sometimes I want to make small changes, I can do it in github and it is treated as one commit
online comments: it is kind of quick code review function
support markdown format: show the document easily, it can avoid write information in seperate place, this is a reason most project in github don’t use wiki, see http://github.com/progit/progit/blob/master/en/01-introduction/01-chapter1.markdown
issue track: this is embedded into github, but most of people select google groups
This is a most excellent feature in github to encourage sharing codes but still keep the relation and credits to the origin, this feature is quite unique, it exist in github only and based on git.
All the forks in github are related into one network, you can clearly see where it comes from and what’s change in other place.
Aug 25th
I have one document white in markdown format, and when it is converted into HTML, it is quite long (>20 pages), I need to print it out to read it . (I am not used to read e-paper before I got iPad).
Then I meet several problems
It is so wide (>1024px), after print it out, it make the normal paragraph narrow, it looks urgy.
Surely I can using my favorite gimp to change the size, but it means I need to change a lot of files, I can also set the <img “width=640px”> like to push to this size, but I also have pictures in small size, I don’t want them to grow as well.
Can we handle this in CSS, my CSS expert JiHao say yes, after google, the correct way is using “max-width”, simple but it works.
img { float: none; max-width:640px; display:block;}
There is a media tag in css, and screen is for browser, projection is for projector and print is for printer, and there are other media, it more depends on browser.
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection"><link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
In M$ Word, there is page break, and it is similar one (page-break-before in CSS, but when I try it, it seems available for IE only
<style type="text/css" media="print">
p img { float: none; max-width:640px; display:block;}
h1 { page-break-before: always; }
</style>
Then it in printed out document, it is well formatted.
One thing left, how to make sure the image is not acrossed into two pages ?
Aug 20th
When you are using git, you need work towards public and private git repository (if u r open source fans), then you need configure different account for this.
And also you may have different account for git repository, which you don’t want to share the same private key, like user in virtual machine with windows machines.
This is simple, just remember there are two level account configuration, one is in ~/.gitconfig, which is set like
git config --global user.name “Larry Cai (company id)”
git config --global user.email larry.caiyu@company.com
git config user.name “larry cai”
git config user.email larry.cai@privatemail.com
You just need to judge which is preferred in global, simple and very useful, normally company doesn’t recommed to use company email in public.
One user for many keys, it may depend on your git server tool, in gitolite, I simple create my key prase pair in virtual machine (same account like larrycai), and send the public key and saved as larrycai@virtual.pub then gitolite will treat them as same user to my normal larrycai.pub
See http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd for more
Aug 18th
Nowadays, most of webpages are powered by CSS, you seldom see “<table><tr>” those HTML tags, instead, use “div” and control the display in CSS. I don’t want to repeat CSS basic, instead give some small tips on this area.
For the image in CSS, besides normal set like
1: background:url("../images/ebottomgrad.jpg") repeat-x scroll 0 0 transparent;
Typically there are lots of small pictures are installed under “images” directory, it also decrease the performance.
“sprites” method is used to solve this problem, let’s see example:
This is a menu image used for gitorious, it contains all item including different color (usage) for them, then in CSS, you can get them like below.
1: #top #menu li a {
2: background: url(../img/external/menu.png) no-repeat;
3: }
4:
5: #top #menu li.home a {
6: background-position: 0px -22px; width: 40px;
7: }
8: #top #menu li.home.active a {
9: background-position: 0px -11px;
10: }
11: #top #menu li.home a:hover {
12: background-position: 0px 2px;
13: }
quite simple and powerful, isn’t it ?
It is also good for UI designer to draw those kind of pictures in one place.
Reference (just google)
- http://www.svidgen.com/sprites
- http://www.alistapart.com/articles/sprites2
And remember this technology exists for long time (>5 years), but still some designers don’t notice this
Aug 16th
In Vircent’s A successful Git branching model, he recommends to create master/develop branch in central repository only. This is very useful for git in enterpreise to control the branches in central especial in the beginning.
It also means the feature and other supporting branches are short-alive branch and located in person notebook only, it is risky for feature branch because if the PC is dead or lost, the work disappears.
Vircent didn’t discuss this a lot, and one way that gitolite provides is person branch (see http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd#personal_branches)
In gitolite.conf, we can define like below
1: repo myphone
2: RW+ = larrycai
3: RW+ personal/USER/ = @userlist
Then for larrycai, some work are done in feature1 branch and backup to private repo in central
1: $ git checkout -b feature1
2: # develop feature1
3: $ git commit -am "test feature branch"
4: $ git push origin feature1:refs/personal/larrycai/feature1
For other user then can do below for get this branch
1: $ git clone git@gitserver:myphone
2: $ cd myphone/
3: $ git fetch origin refs/personal/larrycai/feature1:feature1_from_larry
4: $ git branch -a
5: feature1_from_larry
6: * master
7: remotes/origin/HEAD -> origin/master
8: remotes/origin/master
9: $ git checkout feature1_from_larry
10: # yes, we get it.
See details in http://www.kernel.org/pub/software/scm/git/docs/git-push.html to understand more for git push command.
There are two issues I need to think about besides understanding git push command
Aug 4th
After quickly writing the draft of “Git deployment guideline” which will be my major task in this month, i start to play with markdown (Markdown – another format to write document) again. (editor, converter..)
And I notice actually I am super fans of text2html, I found my old homepage since 19xx
The webpages are written in plain text (mix some html tag) like below and generated with scripts
1: .H3 Internet & WWW
2: <UL>
3: <LI>$(*htmlpp=Htmlpp) is a pre-processor for HTML documents ,
4: this homepage is generated from this tool. Its purpose is to
5: simplify the work of writing and packaging large numbers of
6: HTML documents. I just write <TT>$(*filehtp=rdccaiy.htp)</TT>.
7: and use htmlpp to generate all the homepages . You can
8: download the unix version from $(*imatix=Imatix web site) .
9: </UL>
It is very interesting that the htmlpp application (http://legacy.imatix.com/html/htmlpp/) still existing, though I can notice it is not updated any more after my usage.
Aug 3rd
During the git-svn study, I notice there are lots of document in github are in markdown format, and showing in html looks very concise like wiki page.
Wikipedia gives excellent definition for markdown, see http://en.wikipedia.org/wiki/Markdown
Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz to help maximum readability and "publishability" of both its input and output forms. The language takes many cues from existing conventions for marking up plain text in email.
Let’s compare it to other my used document format
Compare to M$ Word, it is plain text, easy to write and controlled by version control system, and best of all, it lets me focus on content instead of format
Compare to Wiki, the format is quite similar, and markdown is a file, it means, I can easily put into svn/git and publish in other place, wiki system force in most of time to write online
Compare to Docbook (http://www.docbook.org/) it is a plain text instead of xml format, it can help me to focus on the contents I am writting and reach to “publishability”, since it is more readability from the source, for docbook, mostly I need to generate html to see what it looks like, or rely on my software like
Compare to apt (http://maven.apache.org/doxia/references/apt-format.html), the format is quite similar, markdown seems more popular and well acceptable by community and it is better for publishability.
And always remind myself, “how to write the information is more important than choosing tools”
Jul 23rd
In software development, the most challenge thing is when you solve one problem another new problem comes out quickly, it demands you to find the solution in smart way.
Like my svn-git study
In normal standard product setup, it seems most of problems solved, yesterday when I look into the real svn repository, Wooh, it is different, it use multi projects in one repository, and in svn, probably this is also “standard”, but this is not friendly to git.
Since git is designed to be one repo, one project, and all the study I did before is try to map master branch (git repo) to svn trunk (svn repo), now we have several (more than 30) projects, then it is tricky.
One possible solution is to create git repo for every project, and for local git repository, I can create the scripts to rebase and initialize them easily, but it will be difficult to commit back and push to git main repository, managing so many repos is also a complex tasks.
The good things is normally one designer only face to 5 projects.
Another possible solution is treat them as one big repo, then every designer will see trunk, tags, branch directly in file directory, this is not nice.
So what ?
Probably I need to give up git-svn integration transition phase and cut to git directly, since for this kind svn repo, it goes to complicated, when it is complex, more problems will pop up when implement them.
See reference:
* http://stackoverflow.com/questions/2732020/git-repository-layout-for-server-with-multiple-projects
* http://stackoverflow.com/questions/3075171/importing-subversion-to-git-problem-with-subpaths
Jul 22nd
In old blog, I asked myself why to use seperate git server, and got nice ideas today, see architecture
Originally we use svn to remote access the server, and it will be nice to let hudson or sonar (also trigged by hudson) to talk to git server directly, it will be much fast.
And it is also the step to later switch to git system directly.
To be clear, the git master branch is always sync with svn trunk branch, and people (Larry, Peter) can use Git repo to collaborate on other branch like develop.
From the figure above, larry’s local master branch is always sync with “remotes/trunk” (svn repo), “remotes/local/master” (git repo), and Peter’s master is sync with “remotes/origin/master” (git repo) only, And both of them work on develop branch (link to git repo).
So Larry and Peter normally work on develop branch (clone from master) towards git repo, when it reachs to some level, larry will be responsible to rebase back master branch and commit back to svn repo, after that, it is sync back to git repo, therefore Peter’s master repo is up to date as well
If we have other branch from svn (i.e. demo) , in order to not confuse people, we can name demo-svn when clone to git repo, so everyone will notice this is from svn, no one should collaborate on it
Hope you can follow this
Recent Comments