mysysgit git error – Permission denied (publickey)
by iampeterbanjo on August 28, 2010
I was trying to push some changes to GitHub using mysysgit and kept getting this “Permission denied” error. The problem was with my public keys. I changed my email address when I set -
git config user.email “emailaddress”
Clever, I know :] Anyway, so what I did to get around it was –
- go into – C:\Users\username\.ssh
- If there’s a file there called ‘id_rsa.pub’ or ‘id_rsa’ delete both of them. If there isn’t no worries.
- Next right click on the folder of your git repository and select ‘Git GUI here’
- Select Help > Show SSH key
- This should be empty and what we want to do here is click generate key
- Follow the prompts until you get your public key
- Click copy to clipboard
- What we want to do now is save this public key on our GitHub account. So go to your Account Settings on GitHub and select the public keys link
- Click add public key and give it some meaningful name. I used the user identifier after the ‘==’
I hope that works for you and saves you some time. Live long and prosper.
Ubuntu and Windows 7: the best of both worlds
by iampeterbanjo on August 20, 2010
I found a way to share folders between my Ubuntu virtual machine and Windows 7. Here’s why.
I’ve been getting into server side JavaScript recently with node.js and it is a lot of fun. But the downside is that it’s constantly changing and I have to use git a lot. I find it easier to get my head around git in the command line than the Windows GUI. Go figure. And I would love to try and use Visual Studio to code some JavaScript because it’s faster than other JAVA based IDEs on Windows and I saw Scott Gu using it at the Guathon and I was well impressed.
Also, I want to be able to have the command line goodness of Linux and all the luxuries of Windows (including playing music files of any format I want). I did think about buying a Mac if only for Coda. Drool.
Here’s how. Get a Ubuntu virtual machine up and running. The Ubuntu 9 iso and the VMware player worked for me. The rest goes something like this -
In Ubuntu
- Create a new folder
- Right click on it and select "Sharing options"
- Check "Share this folder" and "Allow others to create and delete files in this folder"
- Download Samba Server configuration
- Add a share – using the new folder you created previously
- Add a user – with a username and password
In Windows
- Go to My Network
- Log in to folder using user name and password set in Ubuntu
Note:
Ubuntu permissions override Samba permissions which is why we have to share the folder in Ubuntu first before we can create/modify files/folders in Windows.
If in Windows you get the error message "Multiple connections to a server or shared resource by the same use etc.." open up the command prompt and run "net use * /delete" this will delete current users saved by Windows.
How buildings learn
by iampeterbanjo on August 15, 2010
I was listening to a podcast a few weeks ago (I think it’s this one) when someone gave a shout-out to this BBC series now on Google video.
Apart from being interesting in it’s own right, the reason I was watching it was to see what design principles I could apply to my code practice. On a side note, I agree with Effective UI that software design is more like warfare than building construction. Anyway, here’s what made sense to me.
The best buildings are -
- Built to change – by the user for the user because not all use cases can be predicted before hand. Write code looking ahead to make it easier for someone else to understand and change.
- Valuable because they are disposable – can be re-purposed easily and therefore develop a rich history. Disposable code? Umm. . how about making better interfaces so modifications don’t break things.
- Make problems visible – easier to maintain. Less fancy designs.
What I found insightful is that (if the narrative is to be believed) architects are reluctant to learn from their mistakes e.g. flat roofs are notorious for leakage but are popular and that a lot of problems can be solved by adopting a user focused design approach. It looks suspiciously agile! Go to time stamp 16:20. I’ve become quite keen on user centred design and usability in general recently. More on that later.
Coupling – not the dating kind
by iampeterbanjo on August 15, 2010
I just watched Grand Unified Theory of Software Design by Jim Weirich on Vimeo and I found it quite insightful.
The main aim of his talk as I understand is to come up with an object way of recognizing and talking about good code design and more specifically code coupling. He referenced the idea of ‘connascence’ which basically means “things which change together”. There are different types of ‘connascence’ (I wonder when I’ll get bored of using quotes on that word).
Types of ‘connascence’
- name – method name and method call. When the name of a method changes you have to change the corresponding method calls. This is the weakest type of coupling and we refactor code in this direction.
- position – order specific process. Think of an array as opposed to a hash or collection of some sort – the latter is better. By using a collection/hash we reduce our coupling to ‘connascence of name’.
- meaning – variables mean arbitrary things that need to be understood to use them properly. Use constants instead.
- contranescene – namespace conflicts. Ever heard of jQuery.noConflict()? Make your variables play nice with each other by using namespaces.
- algorithm – duplication of algorithm in more than one place. I usually spot this very quickly.
- timing ie. race conditions. This happens when a function or process finishes sooner or later than it is expected to. In JavaScript callbacks are really useful.
- execution – order of execution matters.
- identity – objects have to be the same.
Coupling drives me crazy and I need to get better at reducing it. It’s scary when I want to change some code and I keep wondering if some function far away is going to break. (Tip: keep related functions close together). I found this mnemonic SOLID helpful. Maybe I should write each letter on a finger.
Using python IRB generates this error "ImportError settings cannot be imported because environment variable %s is undefined"
by iampeterbanjo on July 2, 2010
This is being caused because "Unfortunately, the tagging module’s __init__.py file globally imports some models which rely on the rest of Django’s infrastructure to be up and running (hence the need for settings)."
- Option 1: launch the python IRB by using "python manage.py shell"
- Option 2: in python IRB enter "from django.conf import settings; settings.configure()"
How to run multiple versions of Firefox simultaneously
by iampeterbanjo on July 2, 2010
- Install two versions of Firefox. Version A and B in separate folders.
- Launch Firefox profile managment by running "firefox -P" in Run window (Window + R).
- Create a new profile. It’s sensible to name the profile the version of Firefox that you wish to run "firefox_A".
- Click on "Choose folder" to set where the profile will be stored. In this folder is where profile information such as add-ons will be stored. Again it is sensible to use the target Firefox version number.
- Create a shortcut to Version A of Firefox.
- Right click and select the properties of the shortcut.
- In the target field specify which Firefox profile should be used by appending at the end of the field "-P firefox_A -no-remote". Include a space between the closing quote. e.g. "C:\Program Files\Mozilla Firefox 3.6\firefox.exe" -P firefox_A -no-remote.
- Done!
- Do the same for Version B of Firefox.
Brave New World of HTML5: The "No, I’m not Bruce Lawson" Edition by Patrick Lauke
by iampeterbanjo on July 2, 2010
@WebDirections London 2010
What it is:
- HTML5 is anything but Opera started it in reaction to XHTML 2.0 via Web Application 1.0 with WHAT-WG. Joined forces with Mozilla, Apple, Microsoft and Google.
- HTML5 supports existing standards with additional features
Features:
- <!dochtml /> is used to kick browser into standards mode
Mark-up is loose but browser behaviour is strict. Mark-up is not case-sensitive, you don’t need quote marks but browser behaviour relative to mark-up is well defined. - New elements – header, nav, article, footer, section etc. machine readable and in older browsers it is styled as in-line elements. To render as block level elements use CSS and IE use document.createElement(‘header’);
- Canvas
- Audio (mp3, ogg vorbis, WAV) [not that accessible]
- Video – API controls plays nice with the rest of the page and it’s accessible (H.264 [Apple] vs. Ogg Theora vs WebM [Google]). Browser will check source of video element in cascading order – top to bottom.
NB: Chrome prefers WebM. There’s a bug in Safari iPad that causes it to only check the first .mp4 file source.
Web forms – use built in validation and new input types. Use feature detection.
Anchor elements can be used around block level elements.
Questions
- Is it a flash killer? Not really, there is a valid place for flash.
- How were the new elements chosen? Scooby Doo algorithm. Google made a short list from the most used identifiers and then made decisions based on those.
You can start using it today!
Register a nick name on IRC
by iampeterbanjo on June 1, 2010
Maybe you want to get involved on an open-source project and want to open up some lines of communication via IRC. It wasn’t as straight forward as I hoped so here’s the 411 (how-to).
- Install Pidgin
- Add account.
- Select server e.g. IRC freenode enter username and password
- Tick checkbox next to account name to connect to server
- Nick server window will open a window with the message that your username "is not a registered nickname."
- In the input area at the bottom of window enter –
/msg nickserv register your_password your_email_address
- An email will be sent to your email accout to verify it.
- Copy the command from verification email and paste it into the input window.
Why make it easy when it can be hard? (sarcasm).
Tip of the Day: no SVN for Chrome extensions
by iampeterbanjo on June 1, 2010
It is futile trying to get chrome samples via SVN. It’s not possible!!
How to use browser back-button functionality with JavaScript
by iampeterbanjo on February 28, 2010
Use jQuery BBQ plugin in combination with hash change plugin to listen for window has change events.
Let’s assume that you have a button with an ID of ‘button’. Let’s assume it does something useful like close a pop-up but it can do anything really.
e.g.
1: //listen for hash tag changes so we can remove the popup
2: $(window).bind('hashchange',
3: function(event){
4: //did we add or substract the hash?
5: var currentHash = window.location.hash;
6: currentHash = currentHash.slice(1);
7: if(window.console && debug){
8: console.log(['listings.js: hashchange event detected. currentHash is ', currentHash ].join(''));
9: }
10:
11: if(currentHash === 'close' || currentHash === ''){
12: //remove event listener to prevent premature trigger
13: $(window).unbind('hashchange');
14: if(window.console && debug){
15: console.log('listings.js: haschange event unbound ');
16: console.log(['listings.js: haschange event.trigger is ',event.target].join(''));
17: }
18:
19: $("#button").trigger('click');
20: } else {
21: if(window.console && debug){
22: console.log('hash is not empty. doing nothing.');
23: }
24: }
25: event.preventDefault();
26: }
27: );
What’s with the Array.join(‘’) method?
Well I learnt from Google that this method is faster than concatenating a string with ‘+’. I’m always learning new ways to write better code.