Macvim/Gvim + Janus (+ ctags)
https://github.com/carlhuda/janus/
Setup procedures on fresh installed OS:
$ sudo apt-get install vim-gnome
$ sudo apt-get install git
$ sudo apt-get install rake
$ sudo apt-get install curl
$ sudo apt-get install ack
$ sudo apt-get install exuberant-ctags
$ curl -Lo- http://bit.ly/janus-bootstrap | bash
Saturday, July 28, 2012
Tuesday, July 24, 2012
Thursday, July 19, 2012
Rename multiple files using regular expression
$> for i in *.avi; do j=`echo $i | sed 's/find/replace/g'`; mv "$i" "$j"; done
Wednesday, July 18, 2012
Ruby on Rails development notes, tips, practices
Development
- Performance tuning tools:
- New Relic
- Useful tips:
- Use rails console to counter check the SQL statements being executed.
Testing
- Unit tests should be written in a way that adding new records in test fixtures shouldn't affect the previous test results.
- New test fixtures should be added in a way that they should link to existing fixture data so as to avoid breaking existing test cases.
Quality Assurance
- Besides unit, functional and integration test within rails framework. Create automated browser test using tools like "Selenium" over test/real data.
Maintenance
- Avoid using unnecessary code reflection. It's not good for performance and maintenance.
Tuesday, July 17, 2012
Selected web resources and news feeds
- www.programmableweb.com - Keeping you up to date with APIs, mashups and the Web as platform.
- highscalability.com - Building bigger, faster and more reliable websites.
- aws.amazon.com - Amazon web services.
- linux.vbird.org - Comprehensive linux guide .... in Chinese.
- channel9.msdn.com - The microsoft community.
- engineering.twitter.com - Twitter's engineering blog.
(to be cont.)
Labels:
Industry
System design tips
General tips for develop web based system.
- Action Audits - Keep track of user actions. In Rails, system may log controller actions and corresponding params and response of every single request.
- Bug/Error tracking - Every error triggered in system should be notified to developers.
- Timestamps - Always keep creation, update and any other timestamps on every records in database.
(to be cont.)
Labels:
Practices
General guidelines for team software development
Development Environment
- Source control - e.g. Git (preferred choice) , Csv, Svn
- May use internal server or public source controls (e.g. Github/ Unfuddle)
- Team members should receive notification whenever there's new push/commit to the server repository.
- Knowledge base - Wiki
- Team members should try to contribute on:
- Project documentations
- Technical know-hows
- Workflow control for agile development. Some choices:
- Simple and easy to use - Pivotal Tracker
- More comprehensive one - Atlassian JIRA
- Continuous integration - Build and test server. For example:
- Jenkins - For Ruby on Rails developments
- CuriseControl.NET - For .NET developments
- Test Automation
- Browser test - Selenium IDE
General Coding Practices
- DRY - Don't repeat yourself. Never copy and paste same (similar) block of code in multiple places within the project. Instead, common functionalities should be "extracted" to a single access point like a helper function or by other means.
- Coding conversions - Team members should follow a single set of coding conversion.
- Try to keep each line under 120 to 150 chars.
- Code with comments.
- Should always keep the code clean and easy for maintenance.
- Should keep small code source files. Every source code file should in general not more than 500 or even 300 lines (excluding large blocks of comments).
- Should keep small functions - not more than 30 to 50 lines.
- Should keep functions as private/protected as possible. Only expose a function to public whenever necessary.
- Every single function/method should be unit tested.
- Regular code coverage test.
- Developers may keep a work diary to log everyday's work done.
Daily Collaboration Practices
- Team members MUST complete test (unit, functional, integration test) and make sure there's no unexpected error before pushing code to repository.
- The build server (e.g. Jenkins/CuriseControl.NET) should run complete test whenever there's code update on repository. In this way, whoever broke any tests can be clearly identified.
- If there's unexpected errors (except explicit NotImplementedError) reported by build server, whom pushed the related code should fix the errors ASAP.
- Responsibilities - whenever a feature raised a issue/bug need to be fixed/enhanced, the team member(s) who contributed to that feature should be have the priority to follow the case.
- Communications
- Better communications between team members always save development time and avoid unnecessary bugs.
- Always let other team members know what you're working on.
- Pending or unfinished feature can be marked as "NotImplementedException" and let the corresponding test fail. Then commit code to repository.
- Any bug reported from QA Engineers should state as much details as possible including the environment and steps to reproduce a bug.
- Code review
- Team members should review each others' code.
- For any problem spotted, one should inform the author of that code. In addition, adding unit tests to indicate the problem may also helps.
- It there's no QA team in the group. Developer should write additional test cases for each other! It's always better for a developer to find a bug before the end users!
- All developers should stand by when a new release is deployed to production.
- Business logic and any updates should be kept in a centralized repository such as work flow control or wiki.
- Every developer should try their best to commit/push the work done on that day before leaving the office.
Source Control Usage Practices
- New project feature should be developed on a separated branch. Then merge back to master/main trunk when finished and tested.
- Project releases should be tagged.
Labels:
Favourite,
Management,
Practices
Sunday, July 15, 2012
The Passionate Programmer
Marketing
- Both ends of the technology adoption curve might prove to be lucrative.
- You can't compete on price. In fact, you can't afford to compete on price.
- Supply and demand. Exploit market imbalances.
- Don't just know how to program. Now is the time to think about business domains you invest your time in.
- Be the worst guy in every band you're in.
- The people around you affect your own performance. Choose your crowd wisely.
- I haven't been given the opportunity...? Seize the opportunity!
- Be a generalist. Generalists are rare...and, therefore, precious.
- Your skill should transcend technology platforms.
- Be a specialist. Too many of us seem to believe that specializing in something simply means not knowing about other things.
- Don't invest on single technology or platform. Vendor - centric views are typically myopic.
- Passionate. Work because you couldn't not work.
Investment
- Learning. Don't wait to be told. Ask!
- Learn the business you work for. You can't creatively help a business until you know how it works.
- Find a teacher. It's ok to depend on someone. Just make sure it's the right person.
- Be a teacher. To find out whether you really know something, try teach it to someone else.
- Be a teacher. Mentors tend not to get laid off.
- Practice. Practice at your limits.
- Implementation. If you want to feel you own a process, help implement it.
- Stand on shoulder of Giant. Mine existing code for insights.
- Use existing code to reflect on your own capabilities.
Execution
- It's now. What can we do? Right Now?
- Mind reading. The mind - reading trick, if done well, leads to people depending on you.
- Daily report. Have an accomplishment to report every day.
- Don't forget whom you work for. Your managers' successes are your successes.
- Satisfaction. Be ambitious, but don't wear it on your sleeve.
- Get job well done today. How much more fun could you make your job?
- What's your value? Ask, "Was I worth it today?"
- Beware of being blinded by your won success.
- Enjoy Maintenance. Maintenance can be a place of freedom and creativity.
- Concentrate on 8 working hours per day. Projects are marathons, not sprints.
- Learn from failure. Every wrong note is but one step away from a right one.
- Stressful times offer the best opportunities to build loyalty.
- Say "No". Saying "Yes" to avoid disappointment is just lying.
- Don't panic. Heroes never panic.
- Say it, implement it, demonstrate it. Status reports can help you market yourself.
Sales
- Don't ignore feelings. Performance appraisals are never objective.
- Communication is important. Your customers are afraid of you.
- Communication and documentation. You are what you can explain.
- Show up. Learn about your colleagues.
- The right language to the right people. Market your accomplishments in the language of your business.
- Change the world. Have a mission. Make sure people know it.
- Let people hear your voice.
- Have your own brand. Your name is your name.
- Google never forgets.
- Publish your code. Anyone can use Rails. Few can say Rails contributor.
- Be a master.
- Relationships. Fear gets between us and the pros.
Leading technologies
- Outdated technologies. Your shiny new skills are already obsolete.
- You are not your job.
- Endlessness. Focus on doing, not on being done.
- Create yourself a product roadmap.
- Notice the market. Watch the alpha geeks.
- Developer, review themselves.
- Monkey catching trap. Rigid values make you fragile.
- Avoid waterfall career plannings.
- Daily improvement.
- Independent.
Monday, July 9, 2012
Git daily usage cheat sheet
Task | Command |
---|---|
Initialize a new git repository |
git init
|
View local branches | git branch |
Create new local branch | git branch [new_branch_name] |
Delete local branch | git branch -d [branch_name] |
Switch to a branch | git checkout [branch_name] |
Add files to git | git add . |
Undo all current changes. | git checkout . |
Commit changes | git commit -a -m "Log message" |
Show git logs | git log |
Push local to remote | git push origin [branch_name] |
Pull from remote | git pull origin [branch_name] |
Merge branch | git merge [from_branch] |
Show diff | git diff |
Show all branches | git branch -a |
Fix a tagged release |
git checkout -b [tag_name]_fixes [tag_name]
OR (for getting a remote branch)
git checkout -b [new_local_branch] origin/[remote_branch]
e.g. git checkout -b myfeature origin/myfeature
|
Create a new tag | git tag [tag_name] |
Push tags to remote | git push --tags |
Overwrite existing tag | git tag -f [tag_name] |
Delete tag |
git tag -d 12345
git push origin :refs/tags/12345
|
Merge individual commits | git cherry-pick [commit_hash] |
Stashing |
git stash
git stash apply
git stash list
|
Create an empty repository | git --bare init |
Adding a remote repository |
git remote add origin [server_name]:[directory_name]
|
Checkout a single file on another branch:
$ git checkout branch_name file_full_path
More on: http://gitref.org/index.html
$ git checkout branch_name file_full_path
More on: http://gitref.org/index.html
Labels:
Cheatsheet,
Favourite,
Git
Capistrano cheat sheet
Description | Command |
---|---|
List cap details | cap -T |
backup database | cap bullitt db:backup:adhoc |
Deployment without migration | cap bullitt deploy |
Deployment with migrations | cap bullitt deploy:migrations |
Labels:
Cheatsheet,
Favourite,
Rails
Linux system full backup
$>tar --exclude /proc --exclude /mnt --exclude /tmp --exclude
/backupdata -jcvp -f /backupdata/system.tar.bz2 /
/backupdata -jcvp -f /backupdata/system.tar.bz2 /
Add new drive to linux
Procedure:
- Locate the new device. e.g. $> ls /dev/sdb
- Create partition. $> fdisk /dev/sdb
- m - help
- n - new partition
- p - list partitions
- d - delete partition
- Reboot
- Format partition. $> mkfs -t ext3 /dev/sdb1
- Edit /etc/fstab to mount on startup. /dev/sdb1 /mnt/sdb1 ext3 defaults 1 2
- Done
Subscribe to:
Posts (Atom)