I recently bought a Dell Inspiron and installed Ubuntu Jaunty Jackalope on it. I was having a hard time making skype work on this. Every time I started skype, it gave me a "Problem with audio playback" error. I googled a lot and on Ubuntu forums found following solution to this.
First go to Skype->Options->Sound Devices and set "Sound In", "Sound Out" and "Ringing" all to pulse. Uncheck the "Allow Skype to automatically adjust my mixer levels".
Now go to the volume settings by double by clicking on the speaker icon on top panel. Here in the preferences, check the capture option. Now in the recording tab unmute the mic.
Go to Skype and make a test call. Everything should be working by now.
This solution was found here.
Thursday, June 25, 2009
Sunday, January 11, 2009
Resolve Conflicts in Git
I am going to tell you something very basic here. These basics are really important though.
Today when I tried to merge one of my branch say phuddu to my master, I got some weired messages from git.
Looks like I crashed into a merge conflict today.
My app/models/activities.rb file looked like following.
Every chunk of code above within the
Today when I tried to merge one of my branch say phuddu to my master, I got some weired messages from git.
...
ERROR: Merge conflict in app/models/activity.rb
Auto-merging app/models/death_report.rb
...
fatal: merge program failed
Automatic merge failed; fix conflicts and then commit the result.
Looks like I crashed into a merge conflict today.
My app/models/activities.rb file looked like following.
<<<<<<< .merge_file_sdfPaP
# == Schema Info
=======
# == Schema Information
>>>>>>> .merge_file_LT3vRO
# Schema version: 20090530092020
#
# Table name: activities
#
<<<<<<< .merge_file_sdfPaP
# id :integer(4) not null, primary key
# item_id :integer(4) not null
# user_id :integer(4) not null
# item_type :string(255) not null, default("")
# created_at :datetime
# updated_at :datetime
#
=======
# id :integer(11) not null, primary key
# user_id :integer(11) not null
# item_id :integer(11) not null
# item_type :string(255) not null
# created_at :datetime # updated_at :datetime
#
>>>>>>> .merge_file_LT3vRO
Every chunk of code above within the
<<<<<<< and ======= reflects the modifications made by other commiter (Oh! why!! why did you do this?) whereas the code within the ======= and >>>>>>> reflects the changes made by me. Now to resolve above conflicts we will edit our files according to the need and do the following.git update-index <filename>It actually tells the git that conflicts have been resolved in the files. Now just do a commit and you are done.
Thursday, January 3, 2008
My Emacs Encounter
An old vim user: This is the trap of the Catholics.Whenever I visit a website or read a book which says something about any editor, its mostly about emacs or vim and most of them talk about emacs only.
A somewhat-old vim user trying emacs: Now *sigh* I want to be a Protestant again.
I have been reading a lot about emacs so I thought why don't give it a shot. I want to tell you that I have been using vim from quite long, almost two years now, since I started writing code. I wrote the first "hello world" of my life in vim, and it was really a very good experience.
So lets try emacs. I typed
emacs on my terminal and what I got was a separate window of the powerful rhino with a very neat look and a lot of options to manipulate text on its Toolbar a lot like GVim. I played with it for a while and then tried to know more about it. I started its tutorial to know it's basics.First thing its tutorial teaches you is the movement of the cursors on the screen. Its straight C-p, C-n, C-f, C-b are used to move the cursor to the previous line, next line, one character forward on the same line and one character backwards respectively. The same movement of the cursor in Vim is achieved using k, j, l, h. You can also use the arrow keys to move the cursor but it is recommended to use the other key combinations so that while editing you won't have to move your fingers away from the touch-typing position of the keyboard. These key combinations, both of Vim and emacs, let you move the cursor very fast throughout your text.
But truly, I don't like the C-p, C-n, C-f, C-b of emacs because you have to hold the C or the Ctrl key of the keyboard for all the time. My little finger started aching after a while. Moreover the characters p, n, f and b are scattered on the typing pad far-far away from each other. You can't really use these key combinations unless You really have long fingers (thank god my fingers are long enough). You actually have to wrestle with the keyboard while using these key combinations.
With a lot of pain in my fingers I was still going through *the mighty* emacs Tutorial. There a are several jobs in emacs which can be done in the Vim in fewer key strokes. Two to tell you are C-L (Ctrl-Shift-l) these are three keys to put the current line under the cursor in the middle of the window in Vim you have to use zz and to view the next and previous screen full of text in emacs you have C-v and M-v (M is your Meta or Alt or Esc key) the same thing in Vim is done using PageUp and PageDown keys.
I really don't want to talk about which editor is superior. You use what You have been using and what suits Your needs more. There is no point in learning to use a new editor when you already know a lot about the other one. Moreover there a lot of features in both Vim and emacs both which We won't use in our entire coding career.
Tuesday, December 4, 2007
* and \*
I was coding from past 25 minutes in my favorite language C (that's because this is the only language I know :-).
Any ways I was writing a program which could evaluate reverse Polish expressions taking input from command line (yeah yeah you must be thinking pretty simple, what's so special). The logic of the program is very simple. You just push any incoming operand in the argument list to a stack and whenever any operator comes you just pop last two operands and push the result back to the stack after operating them with the operator.
Well I wrote the code and started testing it.
I was surprised and thought a bug might have been crept in and checked the code for logical errors. But hey I guess my logic ain't bad. Then I threw the dice another way.
which is the correct output.
Now comes the funny part. I had faith only in GDB. So I ran a GDB session.
Yes, to pass arguments when you are debugging your code using GDB, you have to specify the arguments on the
It's the right output.
The problem I was facing is that the gnulinux shell considers * as wild card character meaning any number of character. So when I passed * to the program I was actually passing all the files currently present in my current directory so the result was erroneous and when I passed \* I was actually telling the shell that it was '*' not the name of all the files present in my current directory. So GDB saved the day.
Moral of the *experience*..
1. Avoid hand-hacking. Had I tried solving the problem without using GDB, I would have wasted my precious hours.
2. When passing wild cards to a program on the Shell escape them using \ unless you really mean them to be wild cards.
3. Free Software is great.
Any ways I was writing a program which could evaluate reverse Polish expressions taking input from command line (yeah yeah you must be thinking pretty simple, what's so special). The logic of the program is very simple. You just push any incoming operand in the argument list to a stack and whenever any operator comes you just pop last two operands and push the result back to the stack after operating them with the operator.
Well I wrote the code and started testing it.
$./a.out 2 3 4 + *
$0I was surprised and thought a bug might have been crept in and checked the code for logical errors. But hey I guess my logic ain't bad. Then I threw the dice another way.
$./a.out 2 3 +
$5which is the correct output.
Now comes the funny part. I had faith only in GDB. So I ran a GDB session.
$gcc -g expr.c
$gdb ./a.out
(gdb)run 2 3 4 + *Yes, to pass arguments when you are debugging your code using GDB, you have to specify the arguments on the
(gdb) prompt when you are going to run it using run or r. I checked the values of different variables. The first culprit was argc or argument count it's value was 19 it was supposed to be 6. I just checked the first few starting lines. Everything was going on fine. Push and Pop operations to the stack, conversion of strings i.e. "2" to integer 2 everything was cool. Then suddenly when i checked the value of *argv it showed itoa.c which is another C source file in my current directory. I was surprised what the hell was going on. After scratching my head for another five minutes I typed following on the command line.$./a.out 2 3 4 + \*
$14It's the right output.
The problem I was facing is that the gnulinux shell considers * as wild card character meaning any number of character. So when I passed * to the program I was actually passing all the files currently present in my current directory so the result was erroneous and when I passed \* I was actually telling the shell that it was '*' not the name of all the files present in my current directory. So GDB saved the day.
Moral of the *experience*..
1. Avoid hand-hacking. Had I tried solving the problem without using GDB, I would have wasted my precious hours.
2. When passing wild cards to a program on the Shell escape them using \ unless you really mean them to be wild cards.
3. Free Software is great.
Sunday, December 2, 2007
ShortHowTo: Aliasing
This is a ShortHowTo on aliasing commands in gnulinux so lemme get to the point fast.
Every time We write some command on the terminal like poweroff,or mplayer or some other long command, We have to hit a lot of keys. And this really is time consuming. Although auto-completion of commands is really useful but I guess We have to be much more efficient. Well the solution to this problem is aliasing commands.
In gnulinux or other UNIX like environment you have a .bashrc shell script in your home directory. Every time you open a new terminal or new terminal tab this script executes and sets some environment variables for current terminal or terminal tab opened.
Lets alias a command say clear to just c.
1. open the .bashrc file using your favorite text editor.
2.Go to the end of the file and type following line.
3.save the file.
Now to check if it really worked open a new tab into your termianl and spread some mess on the termianl screen say
WoW it worked.
aliasing long commands is really very good but the real exploitation of
Following are the commands which I have aliased. Tell me if also have some more aliases up your sleeve.
Every time We write some command on the terminal like poweroff,or mplayer or some other long command, We have to hit a lot of keys. And this really is time consuming. Although auto-completion of commands is really useful but I guess We have to be much more efficient. Well the solution to this problem is aliasing commands.
In gnulinux or other UNIX like environment you have a .bashrc shell script in your home directory. Every time you open a new terminal or new terminal tab this script executes and sets some environment variables for current terminal or terminal tab opened.
Lets alias a command say clear to just c.
1. open the .bashrc file using your favorite text editor.
$vim ~/.bashrc2.Go to the end of the file and type following line.
alias c=clear3.save the file.
Now to check if it really worked open a new tab into your termianl and spread some mess on the termianl screen say
$ls
$cWoW it worked.
aliasing long commands is really very good but the real exploitation of
alias is when you use it for most frequently typed commands by you.Following are the commands which I have aliased. Tell me if also have some more aliases up your sleeve.
alias c=clear
alias l=ls
alias t=touch
alias d=cd
alias v=vim
alias mp=mplayer
alias off=poweroff
Sunday, November 4, 2007
/*Why*/ You Should Blog
Do me a favor, please blog.
Even if nobody reads, you should blog. You must be thinking "This guy is nuts. Why should I waste my time, get my fingers pressing all the buttons on the keyboard, end up with severe pain and in the end nobody reads it."
Well, I'll say, you should write blogs not for anybody else but for your own self. Blog is a way of achieving innovation and clarity in your own ideas. Blogs make you stand right out from the crowd, heck, every now and then born a new blogger. Tell me which guy will get the notice of the people, who keeps mum or who speaks. What the guy is speaking and why people notice him is another matter.If you really do something innovative and find out to be useful to other people, including me, it's worth sharing and blog, in my ways, is the best way to do this.
You say that you don't have time, nobody will read your blog, you have nothing worth saying. Hell no!! Why? Let me explain..
Oh come on I'm also too busy to press these tiny black buttons with white alphabets. However, you must be certainly doing some amount of writing, "No!", you're kidding. You must be writing emails, "not even in a month?" You must be writing some document, "not even in a year?" You must be taking some notes, the subject you like studying most, "never?" You must be highlighting lines in the book which you are currently going through (don't tell me you don't read books), there you go start a blog then. You just keep an eye on your writings or saying that might be worth publishing. Now it's never time consuming to dump some document into a blog. Who asks you to submit a blog before 3:00 pm of every Friday. It's not like an *ass*ingment your teacher gave and you've to submit it before the deadline. You write a blog in a week, in a month, who cares, in a year, but make sure you do write one. So now you both have something to say and time to say. Remember there is a draft button just below.
Nobody will read. I say this is the best thing which can happen to your blog. Because every time you come to know that this good guy read your blog, you'll try to make this guy happy and here goes originality. Comments are good they really tell you where you lack and what you should improve in. Some might also contain praise of your work, it really makes feel happy. Criticism is *good*, but redirect all the comments to /dev/null in your root(read brain), making you change what you really want to say.
It seems good advice.
Blogging is weired, you are writing something you already know, or some person has already written about. Something you really take for granted is "common knowledge". You never know the guy who's Bill Gates in the field of having most A+s in your class might not know a simple thing and the guy who is nothing but a road-side punk might know method to create a new rocket engine. The Bill Gates guy can help the punk to get some As or B+s and the punk can teach the guy one or two about rocket science. There's too much to learn in this world and I hope we are still learning. The point behind the blogging is sharing. Get what we can from other smart *asses* and give away the knowledge we have. Don't poke fun at people who seem to be behind us, because they might have something which we'll never understand for years, if ever.
One more sincere advice, please make sure you don't write the blogs with the length of giraffes neck.
Consider me as one of those guys who are behind you and please re-read the first line of this blog.
Even if nobody reads, you should blog. You must be thinking "This guy is nuts. Why should I waste my time, get my fingers pressing all the buttons on the keyboard, end up with severe pain and in the end nobody reads it."
Well, I'll say, you should write blogs not for anybody else but for your own self. Blog is a way of achieving innovation and clarity in your own ideas. Blogs make you stand right out from the crowd, heck, every now and then born a new blogger. Tell me which guy will get the notice of the people, who keeps mum or who speaks. What the guy is speaking and why people notice him is another matter.If you really do something innovative and find out to be useful to other people, including me, it's worth sharing and blog, in my ways, is the best way to do this.
You say that you don't have time, nobody will read your blog, you have nothing worth saying. Hell no!! Why? Let me explain..
Oh come on I'm also too busy to press these tiny black buttons with white alphabets. However, you must be certainly doing some amount of writing, "No!", you're kidding. You must be writing emails, "not even in a month?" You must be writing some document, "not even in a year?" You must be taking some notes, the subject you like studying most, "never?" You must be highlighting lines in the book which you are currently going through (don't tell me you don't read books), there you go start a blog then. You just keep an eye on your writings or saying that might be worth publishing. Now it's never time consuming to dump some document into a blog. Who asks you to submit a blog before 3:00 pm of every Friday. It's not like an *ass*ingment your teacher gave and you've to submit it before the deadline. You write a blog in a week, in a month, who cares, in a year, but make sure you do write one. So now you both have something to say and time to say. Remember there is a draft button just below.
Nobody will read. I say this is the best thing which can happen to your blog. Because every time you come to know that this good guy read your blog, you'll try to make this guy happy and here goes originality. Comments are good they really tell you where you lack and what you should improve in. Some might also contain praise of your work, it really makes feel happy. Criticism is *good*, but redirect all the comments to /dev/null in your root(read brain), making you change what you really want to say.
To be successful in writing, you should pick one person and write just for that person. Forget for the moment that other people will be reading what you write, and just write as if you a re talking to that one person.
--Kurt Vonnegut Jr.
It seems good advice.
Blogging is weired, you are writing something you already know, or some person has already written about. Something you really take for granted is "common knowledge". You never know the guy who's Bill Gates in the field of having most A+s in your class might not know a simple thing and the guy who is nothing but a road-side punk might know method to create a new rocket engine. The Bill Gates guy can help the punk to get some As or B+s and the punk can teach the guy one or two about rocket science. There's too much to learn in this world and I hope we are still learning. The point behind the blogging is sharing. Get what we can from other smart *asses* and give away the knowledge we have. Don't poke fun at people who seem to be behind us, because they might have something which we'll never understand for years, if ever.
One more sincere advice, please make sure you don't write the blogs with the length of giraffes neck.
Consider me as one of those guys who are behind you and please re-read the first line of this blog.
same article can be found here
Subscribe to:
Posts (Atom)