manandbytes

Lessons learned contributing to EGit project

Posted in Uncategorized by manandbytes on Ноябрь 1, 2009

Now it’s possible to share a project using Git provider from any place in the workspace with only a keyboard. My contribution was finally accepted and there are some lessons I’ve learned:

  • Be careful with sources had been used on the way. You may be asked under what terms you received this material.
  • Your contribution may be accepted not with all speed. Don’t expect rapid feedback on your bugs, patches, e-mails etc.
  • Holes may be present in a contributor’s guide. Do you like nitpicking? Sometimes you may be forced to resubmit your patch due to a trivial style nit.
  • When users download your sources, they must always just build. Always. Build. Without a single failing unit test. Programs with failing unit tests are difficult to contribute to, because you cannot easily determine if any change you made improved the program or not.
  • Always open is a fundamental rule of open source, so internal conversations should be avoided at any cost. Unfortunately, right now you can’t reply to a comment posted via Gerrit using your e-mail client’s feature «reply to mailing list» so that it will be posted to the comment thread in Gerrit. I hope an incoming email gateway would be implemented in Google Gerrit, sooner or later.
  • Conversations must be conducted as close to the code as possible. Tools like git format-patch, git am and Google Gerrit make this a no-brainer task.
  • «Release early, release often» sounds as an easy goal but there is still no update site with a latest pre-build version(s) of EGit.
Помечено:, ,

No more ‘J-j g J-s J-j’, just ‘g’

Posted in Uncategorized by manandbytes on Октябрь 20, 2009

I read my e-mail with Gnus and have enabled agent mode because it’s impractical to be connected to the internet in order to compose or reply and even to read e-mail. I like an idea to get quick access to my e-mail no matter if I’m online or not.

Finally I have been tired pressing J-j g J-s J-j many times a day just to send and receive messages. Fortunately Emacs easily allows to reduce a number of key presses due to its great extensibility. What I needed is to tell Emacs which actions to run when a default keyboard shortcut g is pressed in the summary buffer.

Ok, C-h f define-key shows how to define a keyboard shortcut. But how do I figure out what functions to use? C-h c followed by a single key or its combination gives a function behind any keyboard shortcut. So the solution is simple:

(define-key
  gnus-group-mode-map (kbd "g") (lambda () (interactive)
   (gnus-agent-toggle-plugged t)
   (gnus-group-get-new-news)
   (gnus-agent-fetch-session)
   (gnus-agent-toggle-plugged nil)))

You don’t even have to know what does this lambda and interactive mean. Well, in most cases ;-)

… even more work for machines ©

Помечено:,

Emaclipse?

Posted in Uncategorized by manandbytes on Октябрь 8, 2009

I use Emacs and Eclipse for several years but just recently realized that the Quick Access feature in Eclipse and M-x in Emacs are the same and it would be better to use the same keyboard shortcut for both. So what should I choose: Ctrl+3 or M-x?

Помечено:, ,

Share project using Git without touching your mouse: Eclipse Command Framework and Quick Access

Posted in Uncategorized by manandbytes on Сентябрь 24, 2009

I’ve just imported M2Eclipse with its almost 60 plugins into my workspace. And later I want to share one of currently open projects in the midst of my current workflow using Git provider. What should I do?

Well, in most cases it is about reaching out for my mouse, moving it, pointing it to something and clicking. I’ve to switch to Package Explorer or Projects view to achieve my task. When using Package Explorer I found myself buried under several levels of folders to where my currently edited file is located because Package Explorer is a ‘good citizen’ who obeys Eclipse User Interface Guidelines and supports the ‘Link with Editor’ feature. But what if the target project is not in the active working set? Or not active in Mylyn’s context? Yes, there are even more extra clicks ahead. I have to admit that Projects view behaves much better in this case.

Ok, I’ve finally selected the project I want to share and am able to use its context menu. Task completed but I feel myself a bit tired ;-) The main problem with this obvious way of doing things is that I’m forced to interrupt my current task and to lose focus finding my mouse and switching between different views etc.

Are there any other ways? Are you one of those developers who try to get as much done as possible without lifting your fingers from the keyboard like me? Keep reading.

Back in 2007 Eclipse 3.3 introduced a new feature called Quick Access. With Quick Access, UI elements such as commands, views, wizards, preference pages etc. can be quickly listed, filtered through, selected and executed without even knowing the keyboard shortcuts to be pressed. It’s the first part of the solution. The second one is Platform Command Framework.

The combination of Quick Access and Command Framework allows us to implement solutions for tasks like the ones I described quite easily. My implementation was inspired by Eclipse Tips: Keyboard accessibility thru Command Framework, one of awesome articles about using Command Framework by Prakash G.R.

With this enhancement it is possible to share a single project using Git provider from almost any place in the workspace with only a keyboard:

    share-with-git

  • activating Quick Access (which is bound to Ctrl+3 by default) and typing SWG (which means ’share with Git’) will provide you with a list of all currently open projects not connected to any provider
  • after selecting a project share it using Configure Git Repository dialog
  • Помечено:, ,

    Уникальные имена буферов

    Posted in Uncategorized by manandbytes on Август 3, 2009

    Часто приходится работать вот так:

    • открыто несколько буферов с файлами, имеющими одинаковые имена, но находящимися в разных каталогах
    • нужно часто переключаться между этими буферами

    При настройках Emacs’а по-умолчанию это не очень удобно, так как при дополнении имена буферов выглядят вот так:
    emacs-non-uniq
    Понять, какой из файлов находится в буфере непросто, а запоминать – лень, да и не нужно :-)

    В Emacs уже есть средства для решения этой проблемы: uniquify. Решение было подсмотрено в More Random Emacs Config и после конфигурирования вот таким образом:

    diff --git a/.emacs b/.emacs
    index 601f018..533bb70 100644
    --- a/.emacs
    +++ b/.emacs
    @@ -32,6 +32,8 @@
     ;(gnus-demon-add-handler ‘gnus-group-get-new-news 10 2)
     ;(gnus-demon-init)
    
    +(require 'uniquify)
    +
     (require 'ido)
     (ido-everywhere t)
    
    @@ -546,6 +549,11 @@ org_html_manager.setup ();
      '(tabbar-mode t nil (tabbar))
      '(tabbar-mwheel-mode nil nil (tabbar))
      '(tabbar-use-images nil)
    + '(uniquify-buffer-name-style (quote forward) nil (uniquify))
    + '(uniquify-ignore-buffers-re "^\\*")
    + '(uniquify-min-dir-content 1)
    + '(uniquify-separator "/")
    + '(uniquify-trailing-separator-p t)
      '(visible-bell t)
      '(w3m-default-coding-system (quote utf-8))
      '(w3m-favicon-use-cache-file t)
    


    процесс упрощен до необходимого уровня:
    emacs-uniq

    Помечено:

    Architecture Rules eats his own dog food

    Posted in Uncategorized by manandbytes on Июнь 20, 2009

    While adding support for YAML configuration files I introduced a cyclic dependency (shame on me :-) ) in our code base. If this means nothing to you there are some reasons why introducing cycles considered as a bad practice.

    How to catch problems like this one?

    Sounds obviously for you? For sure ;-)

    As the problem popped up as soon as it was introduced, fixing it was a trivial task. I absolutely agree with a statement that every piece of code becomes «legacy» few hours after it’s written. Distributed development teams make such things even worse. `Individuals and interactions over processes and tools’ don’t work.

    How did I discovered this? First of all, this post is about eating your own dog food, right? One of the purposes of Architecture Rules is to report on cyclic dependencies among your project’s packages and classes. And my build system was ready to catch this with just running mvn test.

    How this looks like? As a plain old unit test’s failure:

    Results :
    
    Tests in error:
     testArchitecture(org.architecturerules.SimpleArchitectureTest)
    
    Tests run: 99, Failures: 0, Errors: 1, Skipped: 0
    

    In my case more details are in the target/surefire-reports/org.architecturerules.SimpleArchitectureTest.txt:

    -------------------------------------------------------------------------------
    Test set: org.architecturerules.SimpleArchitectureTest
    -------------------------------------------------------------------------------
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.54 sec <<< FAILURE!
    testArchitecture(org.architecturerules.SimpleArchitectureTest)  Time elapsed: 0.532 sec  <<< ERROR!
    org.architecturerules.exceptions.CyclicRedundancyException: 2 cyclic dependencies found:
    
    	-- org.architecturerules.configuration.xml depends on
    	|  |
    	|  |-- org.architecturerules.configuration
    	|	 |-- @ org.architecturerules.configuration.xml.DigesterConfigurationFactory
    	|	    \ while
    	|	     |-- org.architecturerules.configuration.DefaultConfigurationFactory
    	|	       \ depends on org.architecturerules.configuration.xml
    	|
    	-- org.architecturerules.configuration depends on
    	|  |
    	|  |-- org.architecturerules.configuration.xml
    	|	 |-- @ org.architecturerules.configuration.DefaultConfigurationFactory
    	|	    \ while
    	|	     |-- org.architecturerules.configuration.xml.DigesterConfigurationFactory
    	|	       \ depends on org.architecturerules.configuration
    	|
    
    	at org.architecturerules.services.CyclicRedundancyServiceImpl.buildCyclicRedundancyException(CyclicRedundancyServiceImpl.java:162)
    	at org.architecturerules.services.CyclicRedundancyServiceImpl.performCyclicRedundancyCheck(CyclicRedundancyServiceImpl.java:117)
    	at org.architecturerules.AbstractArchitectureRulesConfigurationTest.doTests(AbstractArchitectureRulesConfigurationTest.java:143)
    	at org.architecturerules.SimpleArchitectureTest.testArchitecture(SimpleArchitectureTest.java:51)
    

    Thanks to our Maven 2 plugin your build will fail too as soon as you introduce cycles in a dependency graph. Even if your project uses Apache Ant (sorry, it’s not my favorite tool ;-) ) as a build system, you can download and use our Ant task to get the same result.

    How-to setup Ant task? Sorry, it’s still not available and I have any clue. In a response to this post Mike provided this great how-to install and configure guide. Thank you, Mike!

    Помечено:, , ,

    Оксана Федюк против Рика Реннера: он крадёт «овец»

    Posted in Uncategorized by manandbytes on Декабрь 30, 2008

    В открытом письме Оксаны Федюк есть такой абзац:

    По поводу заявления пастора Рика Реннера, хочу сказать, что полтора года назад, когда он открывал церковь в Киеве, он разослал приглашения на свои служения трем тысячам человек церкви «Посольство Божье». Выводы сделайте сами о нем.

    Оксана предлагает делать выводы, вот они:

    • Оксана Федюк показала в этом абзаце, как минимум, непрофессиональный подход к вопросу. Мне кажется, любой секретарь должен знать, что отправить приглашения трём тысячам человек, не имея в своём распоряжении ФИО получателя и его почтового адреса практически невозможно.
    • Не является секретом, что Реннер присутствует в медиапространстве теперь уже бывшего СССР достаточно долго. Практически все передачи содержат почтовый адрес и явный призыв обращаться с вопросами. Я могу предположить, что за всё это время около трёх тысяч прихожан ПБ (упомянутых Оксаной) могли обратиться по почте по разным вопросам в служение Реннера.
    • «Разослал приглашение прихожанам» подразумевает наличие у Реннера адресной информации именно о членах ПБ. Для начала с подачи Оксаны я должен предположить, что с такой важной информацией, как список членов церкви и их адреса, в ПБ не умеют обращаться – либо её украли, либо её отдали добровольно. Мне интересно, какая версия может быть принята Оксаной?
    • Более реалистичным мне видится «разослал приглашение, среди получателей оказалось три тысячи членов ПБ» – есть собранная служением Реннера в течении некоторого времени собственная адресная база, в которой оказались и члены ПБ (и многих других церквей).
    • Если шум поднят из-за трёх тысяч писем (мол, попытка переманить «чужих овец»), то реальное количество прихожан ПБ не так уж и велико. Иначе к чему такой шум?
    • Я видел упоминаемое приглашение. И сам Реннер неоднократно в последующем подчёркивал, что «если Вы ещё не являетесь членом какой-либо поместной церкви, то…».

    How to import eclipse.org’s CVS into git with git-cvsimport

    Posted in Uncategorized by manandbytes on Декабрь 23, 2008

    In order to be able to update a local git repository later with changes from the foreign remote repository (which is Eclipse.org’s CVS repository in my case) I have to store CVS metadata somewhere. The first place which pops up in my mind is .git/config and git-svn uses this approach for storing SVN metadata:

    mn@tabernacle:~/src/git-mirrors/josm$ cat .git/config
    [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
    [svn-remote "svn"]
            url = http://josm.openstreetmap.de/svn
            fetch = trunk:refs/remotes/trunk
            branches = branches/*:refs/remotes/*
            tags = tags/*:refs/remotes/tags/*
    


    And this metadata may be retrieved at any time in a standard way using git config command:
    mn@tabernacle:~/src/git-mirrors/josm$ git config --get svn-remote.svn.url

    http://josm.openstreetmap.de/svn


    But for git-cvsimport I’m out of luck. Fortunately there is another solution:

    • create a working directory containing copies of the source files from original CVS repository using cvs checkout command
    • import a CVS module into Git repository using git cvsimport command

    So, lets start with importing org.eclipse.jdt.ui project:

    cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse co org.eclipse.jdt.ui
    cd org.eclipse.jdt.ui
    git cvsimport
    


    And a full history of org.eclipse.jdt.ui project since 2001 at my fingertips:

    Author: cvs   2001-05-02 20:50:00
    Committer: cvs   2001-05-02 20:50:00
    Child:  c43be3ba3c0e24ae62dda72232e0d191bcc6e05b (*** empty log message ***)
    Branches: JDK_1_5, NewSearchIntegration, Pioneering_5_0, R2_1_maintenance, content_assist_participants, editorWork, linkedPositions_rework, master, origin, pre_3_3_work
    Follows:
    Precedes: v0_102+



    *** empty log message ***

    git cvsimport uses cvsps for generating a patchset information from a CVS repository. A patchset is a set of changes made to a collection of files and all committed at the same time (using a single cvs commit command). And it works, as I can see with git log d27f355 --max-count=3 --name-only:

    commit d27f355593d46d301291e9f84ce263d8c19e42b2
    Author: mkeller
    Date:   Thu Dec 11 12:46:55 2008 +0000
        239347: Drag and drop any none java file doesn't refactor
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/JDTRefactoringDescriptorComment.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameCompilationUnitProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameFieldProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameJavaProjectProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameMethodProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenamePackageProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeParameterProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/IReorgPolicy.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/JavaMoveProcessor.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgPolicyFactory.java
    core refactoring/org/eclipse/jdt/internal/corext/refactoring/tagging/IReferenceUpdating.java
    ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameInputWizardPage.java
    ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMoveWizard.java
    
    commit 8ee13e0e34d9ab201abdfc0722a25cd8614dc796
    Author: dmegert
    Date:   Thu Dec 11 10:32:36 2008 +0000
    
        Require com.ibm.icu until Bidi is part of icu.base.
    
    .settings/org.eclipse.pde.prefs
    META-INF/MANIFEST.MF
    
    commit 4769cf70021ece07bce67cdc3563b0928dd50d87
    Author: dmegert
    Date:   Wed Dec 10 09:10:57 2008 +0000
    
        Fixed bug 258238: Typo in Delete Working Set dialog: space before '?'
    
    ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/ReorgMessages.properties
    


    It took me about a one day and 1G(?) of data transfer (but who counts all these bytes in our days?) for a full import and now I can work on stuff offline. And Git is really disk-space-friendly. Only 54M of disk space is been used for 19000+ commits which had been made to org.eclipse.jdt.ui project since 2001.

    And to update my local git repository with changes from the remote CVS I can just run git cvsimport from the project’s working directory:

    Fetching ui/org/eclipse/jdt/internal/ui/workingsets/ConfigureWorkingSetAssignementAction.java   v 1.19
    Update ui/org/eclipse/jdt/internal/ui/workingsets/ConfigureWorkingSetAssignementAction.java: 25116 bytes
    Tree ID bad5edfd1a0dac40fa3a2c865cd2a3e4401380bb
    Parent ID fcf05781ae88bf413904aca54a9c4ee745c7f3cb
    Committed patch 19257 (origin +0000 2008-12-15 10:23:40)
    Commit ID 1e13114d7f01024110c0495de0350d8cfb43d1d6
    DONE.
    Updating fcf0578..1e13114
    Fast forward
     .../ConfigureWorkingSetAssignementAction.java      |   37 +++++++++++++++++++-
     1 files changed, 36 insertions(+), 1 deletions(-)
    

    Помечено:,

    «Git» в исполнении переводчика Promt

    Posted in Без рубрики by manandbytes on Декабрь 16, 2008

    «a local git repository» = «местный склад мерзавца» (c) translate.ru

    Помечено:

    Джолли и Пит – не пример своим детям

    Posted in Без рубрики by manandbytes on Ноябрь 3, 2008

    Анджелина Джоли запрещает своим детям смотреть фильмы с ее участием:

    Брэд Питт и Анджелина Джоли запрещают своим детям смотреть боевики, в которых они снимались. Кроме того, голливудская пара не позволяет малышам развлекаться с игрушечным оружием.

    Анджелина не хочет, чтобы они видели, как она творит насилие. Хотя в самых успешных своих ролях она только и делает, что размахивает оружием

    Помечено: