Copy paste in urxvt

March 10th, 2012 Kristoffer Sjögren No comments

I recently switched to a urxvt terminal on my Debian desktop but was a bit annoyed with how copy paste is handled and thought of adjusting it to my liking. But first a bit of background.

X server have 3 selection buffers: PRIMARY, SECONDARY and CLIPBOARD. PRIMARY is (conventionally) where the current selection is copied and pasted from using middle mouse button. CLIPBOARD on the other hand is primarily used by applications to copy selection when users explicitly request it, such as “copy” from a menu or pressing C-c, C-x, C-v keyboard shortcuts.

Urxvt use PRIMARY for copy/paste, which is a pain for me since my middle button is a bit sketchy when clicking it, sometimes slipping and scrolling away accidently. So I wanted to be able to paste urxvt selection using the CLIPBOARD instead, i.e. paste using C-v.

Turns out this is pretty easy. First you need ‘xsel‘ which is a command-line program for getting and setting the contents of the X selection.

$ sudo apt-get install xsel

Then you need create the following perl program /usr/lib/urxvt/perl/clipboard, which takes the current urxvt selection and copies it into CLIPBOARD using xsel with the -b flag.

#! /usr/bin/perl

sub on_sel_grab {
    my $query=quotemeta $_[0]->selection;
    $query=~ s/\n/\\n/g;
    $query=~ s/\r/\\r/g;
    system( "echo " . $query . " | xsel -i -b -p" );
}

The final piece of the puzzle is to active this script by adding the following line to your ~/.Xdefaults.

urxvt*perl-ext-common: default,matcher,clipboard

This post got inpiration from the ArchWiki, more specifically from Skottish.

spacer Tweet This Post

Categories: Linux Tags:

Logo for tools4j-config

February 23rd, 2012 Kristoffer Sjögren No comments

Tools4j-config is in steady progress but there are still a lots and lots of ideas and functionality to be implemented. At the moment i am working mostly on integration with OSGi and Eclipse RCP/SWT which have been very time-consuming since I havent had any past hands-on experience.

I spend roughly 20h a week on the project and it can be quite exhausting to be honest, especially since I do this on my own. There is a lot more involved than just happy hacking. I need to do field research, take notes, learn new technologies, write documentation and examples, testing, release management and of course think long and hard about purpose, goals, design and conceptual integrity etc.

It is very easy to get carried away into one direction and then accidently neglect the rest. But one good thing about having a tight time-account is that I have gotten (even more) obsessed about my productivity. Good tools truly are a key ingredient in the software development soup.

But the hardest part is the lack of feedback. I have only myself to trust that the project is going in the right direction which can be a bit demoralizing sometimes. I have to tell myself to stay focused, have patience and work hard. However, no users means that the project can change easily, but I cross my fingers that the open source community gradually will begin support me with feedback in the future.

It is not all about wanting success. The project is of course also a very stimulating and fun hobby. I love programming and this something that I wanted to do for a long time. I did not anticipate the great feeling of freedom that allow me to take my time to do stuff right. Very refreshing! I have also stopped watching all that junk on TV and doing mindless website surfing. There is still time over for friends, training and work. Blogging maybe not so much, eh?

Anyway, there is now also a logo for tools4j-config to give the project some identity and style.

I knew I wanted something fresh that would not invite old-fashioned hierarchical thinking into mind. With the logo I have tried capture what I think configuration management is all about: decentralized, autonomous and organic patterns that tell how small pieces connect together to make a whole.

The picture was bought from www.shutterstock.com for a few dollars then resized, some text added, convert to png using GIMP and Voila!

What do you think?
spacer

spacer Tweet This Post

Categories: misc, open source Tags:

tools4j-config

February 1st, 2012 Kristoffer Sjögren No comments

I am proud to announce my open-source project tools4j-config; a project that will try to address configuration concerns in Java once and for all.

I have seen and heard about far too many projects that handle configuration carelessly, causing endless headaches when put into production. Some notable nuisance are non-uniform interfaces, unmanageable structural and data changes in disparate sources, diffuse configuration intents and correlation to system concepts and lack of documentation.

Tools4j-config is my reaction from scratching an itch trying to help developers, operators and administrators (devops) to cooperatively manage configuration. This is the starting point and an honest attempt to try implement a framework that handle these concerns in a simple, productive, uniform, extendible and portable way.

The mission statement and motivation for tools4j-config is taken from the announcement on freecode.com and goes something like this.


Tools4j-config support long-running enterprise Java applications with a framework for handling configuration changes without restarting themselves.

It also aids in developing applications which are decoupled from knowing how and where to store, retrieve, and validate configurations.

The aim is to liberate applications to use configurations seamlessly on the terms of their particular environment, without constraining them to Java SE, EE, OSGi, Spring, CDI, or any other programming model or framework.

Tools4j-config is a true open source project, contributing ideas or criticism on any collaborative level is highly appreciated and will never be neglected or considered too small. Committers are welcomed with open arms.

The information on tools4j-config is presentable but a bit scarce at the moment but will build up gradually towards a 1.0 release.

  • Documentation HTML, PDF
  • API javadoc
  • License
  • Version Control
  • Bug Tracking
  • Wiki
  • User Mailing List – tools4j-user@googlegroups.com
  • Dev Mailing List – tools4j-dev@googlegroups.com
  • Blog

Sure been a long time coming but expect a lot more on the topic of Configuration Management from me this year spacer

spacer Tweet This Post

Categories: Java, Java EE, open source Tags:

Personal gains from contributing to Open Source

January 2nd, 2012 Kristoffer Sjögren 1 comment

Many may find it difficult to understand why certain people spend a lot of their spare time producing stuff without being paid and then give it away for free. Is this altruism on the edge of stupidity or are there personal benefits gained from participating in such activities?

The act of charity and joy of programming arise but may not be the ultimate goal. The motives for participation is subjective but it seems that many does it to boost professional work in one way or another.

This is my attempt to try seduce you to start practicing the arcane arts of Open Source.

Contribution
Schools benefit greatly from reduced costs and many students would not have had the opportunity to get a computer science degree without the wealth of information and experience found in open source. Many corporates certainly also benefit from open source.

Yes, some people actually develop feelings of wanting to give something back. Maybe not trying to make a difference but simply showing a token of gratitude to a community providing such a strong foundation for learning and education to anyone in society.

Appreciation
Programmers want others to use their stuff. We are social beings and it feels good to hear someone express their appreciation for your work. Appreciation motivates the will to understand different point of views, reduce insecurity and allow you to put others before yourself. Collaboration and social interaction create a feeling of belonging and coding for a community can make this activity even more energizing and enjoyable.

Corporate companies sometimes have a tendency to give managers most of the props, which can be disappointing and demoralizing indeed. Reading emails of gratitude and receiving help from others can feel refreshing, especially for those who have been working under less gratifying conditions.

Self-education
This is your chance to work on projects and problems that excite and inspire you the most. A strong motivator for doing your best and reach creative heights.

It may seem scary to know that your work will be reviewed and criticized publicly. But this is a tool for improving your skills, strengthening your attitude and habits towards quality. You will not code sloppy knowing that your work will be accessible anyone.

The larger projects that have survived for years and continue to evolve often have great leadership, organization and development guidelines. Technical skill is just one of the many things to observe and absorb. There is also a chance that you will join a team and learn from people that are many levels better than yourself.

Reputation
Open sourcing will build a public resume that is accessible to anyone. It looks good to have worked on a open source projects, especially famous ones. Meritocracy has a tendency to arise so offering bug corrections, improvements and ideas will earn your peers/users recognition and enhance your reputation. But keep in mind that quality is key. People do not want to spend time on contributions not following guiding principles just because the contributor was too lazy to read them.

Such a relationship can be quite stimulating as compared with the typical interaction trying to impress your manager, which interest usually lies with delivering on-time.

Transparency also feeds honest and humble communication since nobody can hide bad or selfish decisions. Strong disagreement that otherwise may end in rudeness and cruelty behind closed doors are likely be discussed more calmly knowing that others observe.

Control
Most people wish for freedom to control their lives. It can be incredibly frustrating to work on a project with budget constraints where software is rushed into a unmanageable mess. Reorganization and outsourcing can also seed feelings of disappointment and helplessness.

With open source you are no longer are a victim of such circumstances. You are free to implement and improve the features you think matters, while users help with finding relevance and set priorities.

Reuse
Most programmers develop an urge to not repeat themselves throughout their careers. Producing open source software is the freedom to truly reuse efforts when changing jobs (or starting your own company) and share them with anyone.

These intentions stimulate thinking using broader perspectives and designs that are cooperative, flexible and adaptable to different environments in order to maximize opportunities for reuse. Keeping users loyal often means maintaining version compatibility and upgradability. Having to deal with all this complexity will make you a better programmer.

And this is the right thing to do. Newton would have been proud to see this tradition of code-sharing and reuse. Reinventing wheels is a terrible waste of time and human skill.

Many view patents as the direct opposite. A threat that prevents reuse and slow programmers down. Patents also encourage a culture where people build barriers instead of helping each other. It is understandable that patents make the open source community frown.

Conclusion
Open source is a lot about a community of freedom and sharing and it is not hard to see why open source developers often are highly respected. Participation will introduce you to a community of incredible talented, like-minded and caring people that may help improve your skills beyond imagination.

Unexpected and exciting job opportunities may indeed arise, maybe at a company that will give you the fortune to produce open source software and get paid at the same time.

Last but not least: you will help support an open world where liberty and justice is praised.

And with that I leave you with a thoughtful quote from the King Penguin spacer

Software is like sex: it’s better when it’s free.

- Linus Torvalds

spacer Tweet This Post

Categories: business, ethics, open source Tags:

On a new road

December 16th, 2011 Kristoffer Sjögren No comments

Yesterday was my last day at Ericsson. Wow, has it been 8 years already? Time sure flies.

I have met great and interesting people, made a lot of friends, learned an ocean of things and had a helluva great time. Of course there have been ups and downs – but mostly a pleasant ride. Ericsson is truly a remarkable company. It sure wasnt easy to make the final decision.

It is not only about making a career move. Deep inside I know my soul need to experience different things, develop new perspectives and almost unconciously embrace change.

And so I am moving from the telecommunications into finance. It feels exciting to know that I will learn a lot of new concepts and face an entirely different domain of challenges. I cannot help to think of how this will affect my beliefs of how to develop software.

There is a lot learning for me to do in coming years and I hope to contribute with past experience to the best of my ability.

I sure gonna do my best.

spacer Tweet This Post

Categories: misc Tags:

I am alive

December 1st, 2011 Kristoffer Sjögren No comments

Sorry for the inactivity: but yes, my blog is still alive.

I have been terribly busy the last month with some exciting changes that are bubbling in my life at the moment. I have a lot of drafts on different topics that I plan to publish, but I cannot find the time at the moment.

I will pour out random thoughts on twitter in the meantime: @deephacks

Cheers!

spacer Tweet This Post

Categories: writing Tags:

Zenburn

October 18th, 2011 Kristoffer Sjögren No comments

I like coding at night.

Turned off phone, twitter, mail and facebook – quiet with no distractions or interruptions. Dimmed-down lights, but not dark. 3-4 hidden low-light sources does the trick. It is really easy for me to get into the zone under these conditions.

Typing speed increase, keyboard-shortcuts comes easy, not a log statement get missed, bugs get slapped silly, clarity – there is no spoon, creativity flows, time disappear and nothing but the activity itself exist. A highly productive state of absolute concentration and focus.

Long coding sessions like this hurts my eyes since my blinking rate goes down dramatically under these conditions. A lot of bright colors on the screen is not an option for me. I need colors that are easy on the eyes and blends into the environment.

Zenburn is low-contrast color scheme that was originally designed for vim, but there are themes for Eclipse, Emacs, bash and other editors aswell. You can of course also use the palette as inspiration to adjust your environment to your liking.

Here is an example of what my desktop can look like during a coding session with zenburn’ish settings. I haven’t yet figured out how to get Ubuntu to tone down that bright grey colors around the edges of Eclipse though.

spacer

It may seem like a silly detail but zenburn really help me to not loose focus from tired and sore eyes. I can code for hours and hours with it and it is by far the best color scheme I have found.

What tricks/techniques do you use to get yourself into the zone and stay there for longer periods of time?

spacer Tweet This Post

Categories: coding, misc Tags:

Twitter

October 8th, 2011 Kristoffer Sjögren No comments

Hurray, im on twitter! Dont get it twisted, I love my facebook friends… really. But finally I can follow people that I actually find interesting.

Fantastic!

spacer Tweet This Post

Categories: misc Tags:

How to Increase Your Likability

October 4th, 2011 Kristoffer Sjögren No comments

Im starting to suspect that I have some kind of motivational frenzy on my mind at the moment – its all good spacer

Anyway, here are some advice from Guy Kawasaki that will make our world a better place to live in. Enjoy.

spacer

spacer Tweet This Post

Categories: ethics Tags:

Motivation, Creativity and Innovation

October 2nd, 2011 Kristoffer Sjögren No comments

I am a strong believer in that every individual on this earth can be creative and that hard focused work beats natural talent in every way.

Personally I get really inspired by observing skillful people come up with amazing and creative ideas. Others may feel rivalry and/or envy. I am not sure why certain people react one way or another but dare I speculate that it insecurity have something to do about it?

I feel confident to say that truly creative people does not feel intimidated or sentimental about their ideas being trumped by better ideas. In fact they encourage it. Because they know competition will inspire and push themselves further. There is nothing to fear if you are humble enough to accept and build on other peoples ideas to find ways to continuously elevate your intellect.

Isaac Newton indicated that innovation is the continuous process of creating value from existing ideas, knowledge and inventions. So it is reasonable to think that most companies want to have motivated employers that are original, think differently and are highly creative. Right. And CEOs should not forget that this is just as important for them aswell.

So how do you engage people to be high performing, innovative and creative? I think Dan Pink is spot on.

  • Autonomy: The disire to be self directed.
  • Mastery: The urge to get better at stuff.
  • Purpose: People are happiest when working for something larger than ourselves.

Economical rewards are great. But they stop working as motivator for intellectual work when reaching a certain level – it is a lot better to empower people with freedom to express their creativity.

I have observed that management sometimes carry out this form of hypocrisy, pushing employees in this direction without giving them the freedom to actually start doing it. As an example, do you recognize the following leadership style?

According to Command-and-Conquer, managers-slash-leaders figure out where the business is going to go, and then issue the appropriate orders to their lieutenants to move the business in that direction. Their lieutenants in turn divide up the tasks into smaller chunks and command their reports to implement them. This continues down the org-chart until eventually someone at the bottom actually does some work. In this model, a programmer is a cog in the machine: a typist who carries out one part of management’s orders.

Some businesses actually run this way. You can always tell when you are dealing with such a business, because the person you are talking to is doing something infuriating and senseless, and they know it, and they might even care, but there’s nothing they can do about it.

Joel Spolsky: The Development Abstraction Layer

This is an excellent example of how to efficiently kill motivation and creativity; encouraging a workforce with breaths smelling like urine and an awful way of growing skillful developers.

Visionary people who have learned self-motivation and able to visualize patterns and connect the dots in a conceptual age and converging world will not accept this kind management and will find ways to escape it one way or another.

Leadership is a crucial part in business and military success in the same way as creating a culture of innovation. If innovation does not happen in the organization, your leaders are probably killing it one way or another. For example, only trusting your users to tell you how to run your business.

If I had asked people what they wanted, they would have said faster horses.

Henry Ford

Users know what problem they have, which is important and you should listen to your users. But listening to users *exclusively* will never make you entrepreneurial. Steve Jobs told customers what they wanted instead of asking for feedback. And before i forget – Henry Ford built cars…

What will happen if peoples ideas are rejected over and over again, maybe because their leaders does not trust them? They will quickly stop sharing them because clearly their ideas are worthless to the company.

But lets assume that you have a lot of creative people with mindblowing, innovative and relevant ideas.

It takes almost as much creativity to understand a good idea as to have it in the first place.

Alan Kay

Having wonderful ideas is not enough. If you have to spend just as much time to convince people of the idea as on the idea themselves there will be no innovation left at the end of the day. Leaders must realize that innovation is fragile and must actively try to find and encourage it. Stakeholders must also accept risk and communicate that failure is expected and not punish failures.

At the same time – execution is critical. Ideas are not useful if they are irrelevant to business or if you cannot make reality out of them. It is important to build excellent teams that are able take an idea and work with it.

If you give a good idea to a mediocre group, they’ll screw it up. If you give a mediocre idea to a good group, they’ll fix it. Or they’ll throw it away and come up with something else.

Ed Catmull, Pixar: Keep Your Crises Small

This is why people should be allowed to work on the things that motivates them. Motivation is of course not a guarantee for success. But with a good ideas, passion and dreams your chances for success increase drastically since individuals will be way more productive and caring than on average. Ignore this and you may find your co-workers spending most of their time at the coffee machine or surfing the web instead of doing incredible work.

Some say “ignorance is bliss” and I guess they are right. But I do not want to take the easy way out… My brain is simply allergic to ignorance.

Fish rot from the head as do organisations. Remember that.

spacer Tweet This Post

Categories: ethics, learning, software methodology Tags:
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.