tag:blogger.com,1999:blog-74959685782440583862024-02-08T07:56:30.945-08:00BlogTalkwith Anantaanantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-7495968578244058386.post-51011752001307757552015-08-02T20:44:00.004-07:002015-08-02T20:44:46.550-07:00SOLID Principle<div dir="ltr" style="text-align: left;" trbidi="on">
S for Single responsibility principle<br />
<br />
<b>Note </b><br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"> <code style="color: black; word-wrap: normal;">
class Order < ActiveRecord::Base
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.find_purchased
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.find_waiting_for_review
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.find_waiting_for_sign_off
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.find_waiting_for_sign_off
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.advanced_search(fields, options = {})
<span class="Apple-tab-span" style="white-space: pre;"> </span>def self.simple_search(terms)
end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def to_xml
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def to_json
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def to_csv
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def to_pdf
<span class="Apple-tab-span" style="white-space: pre;"> </span># ...
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
# ...
end
</code>
</pre>
<br />
O for Open closed principle which means , a class should be close for modification and open for extension<br />
<br />
<b>Example:</b><br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"> <code style="color: black; word-wrap: normal;">
class Purchase
<span class="Apple-tab-span" style="white-space: pre;"> </span>def initialize(payment_process)
<span class="Apple-tab-span" style="white-space: pre;"> </span>@payment_process = payment_process
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>def charge_user!
<span class="Apple-tab-span" style="white-space: pre;"> </span>@payment_process.charge(user: user, amount: amount)
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
end
Purchase.new(MachPayAdapter).charge_user!
class Stripe
<span class="Apple-tab-span" style="white-space: pre;"> </span>def charge(user,amount)
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
end
class Paypal
<span class="Apple-tab-span" style="white-space: pre;"> </span>def charge(user,amount)
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
<span class="Apple-tab-span" style="white-space: pre;"> </span>
end
class MachPay
def charge_amount(amount,user)
end
<span class="Apple-tab-span" style="white-space: pre;"> </span>end
class MachPayAdapter
def charge(user,amount)
<span class="Apple-tab-span" style="white-space: pre;"> </span>MachPay.charge_amount(amount,user)
end
end
</code>
</pre>
</div>
anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-90911481073178887372014-04-13T23:09:00.001-07:002014-04-14T00:52:36.529-07:00Ruby on rails-The first application<div dir="ltr" style="text-align: left;" trbidi="on">
rails new first_app<br />
cd first_app/<br />
<br />
Update Gemfile with an explicit version for each Ruby gem.<span class="n"> </span><br />
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<pre><span class="n">************************************** </span></pre>
<pre><span class="n">source</span> <span class="s1">'https://rubygems.org'</span>
<span class="n">ruby</span> <span class="s1">'2.0.0'</span>
<span class="c1">#ruby-gemset=railstutorial_rails_4_0</span>
<span class="n">gem</span> <span class="s1">'rails'</span><span class="p">,</span> <span class="s1">'4.0.4'</span>
<span class="n">group</span> <span class="ss">:development</span> <span class="k">do</span>
<span class="n">gem</span> <span class="s1">'sqlite3'</span><span class="p">,</span> <span class="s1">'1.3.8'</span>
<span class="k">end</span>
<span class="n">gem</span> <span class="s1">'sass-rails'</span><span class="p">,</span> <span class="s1">'4.0.1'</span>
<span class="n">gem</span> <span class="s1">'uglifier'</span><span class="p">,</span> <span class="s1">'2.1.1'</span>
<span class="n">gem</span> <span class="s1">'coffee-rails'</span><span class="p">,</span> <span class="s1">'4.0.1'</span>
<span class="n">gem</span> <span class="s1">'jquery-rails'</span><span class="p">,</span> <span class="s1">'3.0.4'</span>
<span class="n">gem</span> <span class="s1">'turbolinks'</span><span class="p">,</span> <span class="s1">'1.1.1'</span>
<span class="n">gem</span> <span class="s1">'jbuilder'</span><span class="p">,</span> <span class="s1">'1.0.2'</span>
<span class="n">group</span> <span class="ss">:doc</span> <span class="k">do</span>
<span class="n">gem</span> <span class="s1">'sdoc'</span><span class="p">,</span> <span class="s1">'0.3.20'</span><span class="p">,</span> <span class="nb">require</span><span class="p">:</span> <span class="kp">false</span>
<span class="k">end</span></pre>
<pre><span class="k">*************************************** </span></pre>
</div>
$ bundle update<br />
$ bundle install<br />
$ rails server<br />
<br />
So far So good :):)<br />
<h3 style="text-align: left;">
Git for version control</h3>
<div style="text-align: left;">
To install Git, you need to have the following libraries that Git depends on: curl, zlib, openssl, expat, and libiconv.</div>
<div style="text-align: left;">
<br /></div>
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \<br />
libz-dev libssl-dev<br />
$ apt-get install git<br />
$ git config --global user.name "Your Name"<br />
$ git config --global user.email your.email@example.com<br />
<br />
<h3 style="text-align: left;">
Setup repository</h3>
<div style="text-align: left;">
$ git init</div>
<div style="text-align: left;">
Rails command creates a default .gitignore file in the application root directory, causing Git to ignore file mention inside it.</div>
<div style="text-align: left;">
<i><br /></i></div>
<div style="text-align: left;">
<div style="text-align: left;">
<i>$ git add . </i></div>
<div style="text-align: left;">
<i># dot ‘.’ represents the current directory, and Git is smart enough to add the files recursively,So it automatically includes all the subdirectories.It adds the project files to a staging area, which contains pending changes to your project;</i></div>
<i>$ git status </i><br />
<i># see which files are in the staging area using this command.<br />$ git commit -m "Initialize repository" </i><br />
<i># Tells Git you want to keep the changes.<br />$ git log </i><br />
<i># See a list of your commit messages ,To exit git log, you may have to type q to quit.</i><br />
<br />
<div style="text-align: left;">
<b>Generate SSH Key</b><i> </i></div>
<div style="text-align: left;">
<i>https://help.github.com/articles/generating-ssh-keys</i></div>
</div>
<h3 style="text-align: left;">
GitHub </h3>
<div style="text-align: left;">
<i>$ git remote add origin https://github.com//first_app.git <br />$ git push -u origin master<br /># Tells Git that you want to add GitHub as the origin for your main (master) branch and then push your repository up to GitHub. </i></div>
<h3 style="text-align: left;">
Deployment</h3>
<div style="text-align: left;">
Lets use Heroku, a cloud deployment service.</div>
<div style="text-align: left;">
Heroku uses the PostgreSQL database, which means that we need to add the pg gem in the production environment to allow Rails to talk to Postgres.<br />
<br />
<span class="n"></span><span class="k"></span>A Gemfile with added gems and explicit Ruby version:<br />
<br />
<pre><span class="n">******************************** </span></pre>
<pre><span class="n">source</span> <span class="s1">'https://rubygems.org'</span>
<span class="n">ruby</span> <span class="s1">'2.0.0'</span>
<span class="c1">#ruby-gemset=railstutorial_rails_4_0</span>
<span class="n">gem</span> <span class="s1">'rails'</span><span class="p">,</span> <span class="s1">'4.0.4'</span>
<span class="n">group</span> <span class="ss">:development</span> <span class="k">do</span>
<span class="n">gem</span> <span class="s1">'sqlite3'</span><span class="p">,</span> <span class="s1">'1.3.8'</span>
<span class="k">end</span>
<span class="n">gem</span> <span class="s1">'sass-rails'</span><span class="p">,</span> <span class="s1">'4.0.1'</span>
<span class="n">gem</span> <span class="s1">'uglifier'</span><span class="p">,</span> <span class="s1">'2.1.1'</span>
<span class="n">gem</span> <span class="s1">'coffee-rails'</span><span class="p">,</span> <span class="s1">'4.0.1'</span>
<span class="n">gem</span> <span class="s1">'jquery-rails'</span><span class="p">,</span> <span class="s1">'3.0.4'</span>
<span class="n">gem</span> <span class="s1">'turbolinks'</span><span class="p">,</span> <span class="s1">'1.1.1'</span>
<span class="n">gem</span> <span class="s1">'jbuilder'</span><span class="p">,</span> <span class="s1">'1.0.2'</span>
<span class="n">group</span> <span class="ss">:doc</span> <span class="k">do</span>
<span class="n">gem</span> <span class="s1">'sdoc'</span><span class="p">,</span> <span class="s1">'0.3.20'</span><span class="p">,</span> <span class="nb">require</span><span class="p">:</span> <span class="kp">false</span>
<span class="k">end</span>
<span class="n">group</span> <span class="ss">:production</span> <span class="k">do</span>
<span class="n">gem</span> <span class="s1">'pg'</span><span class="p">,</span> <span class="s1">'0.15.1'</span>
<span class="n">gem</span> <span class="s1">'rails_12factor'</span><span class="p">,</span> <span class="s1">'0.0.2'</span>
<span class="k">end</span></pre>
<pre><span class="k">*******************************</span></pre>
<pre><span class="k"> </span></pre>
<pre><span class="k"><span class="gp">$</span> bundle install --without production </span></pre>
<br />
The <tt class="verb">--without production</tt> option prevents the local installation of any production gems, which in this case consists of <tt>pg</tt> and <tt>rails_12factor</tt>.<br />
<br />
<pre><span class="gp">$</span> git commit -a -m <span class="s2">"Update Gemfile.lock for Heroku"</span></pre>
<pre><span class="s2"> </span></pre>
Create and configure a new Heroku account.<br />
Install heroku: https://toolbelt.heroku.com/debian.<br />
Upload your public key to Heroku.<br />
<br />
<br />
$heroku keys:add ~/.ssh/id_rsa.pub <br />
<br />
If you don't have a public key, Heroku will prompt you to add one automatically which works seamlessly. Just use:<br />
<br />
$ heroku keys:add<br />
$ heroku logs<br />
<br />
Running the logs 'heroku logs', has a key giveaway: PG::Error: ERROR: relation "<rails model="">" does not exist. This entry states your model could not be loaded. To provide an update to previous answers, heroku rake has been deprecated. Heroku requires: </rails><br />
<br />
$ heroku run rake db:migrate<br />
<br />
<br />
<br />
<br />
<pre><span class="gp">$</span> heroku login</pre>
<pre> </pre>
<pre> </pre>
</div>
<div style="text-align: left;">
Navigate back to your Rails project directory and use the <code>heroku</code> command to create a place on the Heroku servers for the sample app to live.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<pre><span class="gp">$</span> <span class="nb">cd</span> ~/rails_projects/first_app
<span class="gp">$</span> heroku create</pre>
<br />
<pre><span class="gp">$</span> git push heroku master</pre>
<pre><span class="gp">$</span> heroku open </pre>
</div>
<div style="text-align: left;">
<br /></div>
<style type="text/css">TD P { margin-bottom: 0in; }PRE.cjk { font-family: "WenQuanYi Micro Hei",monospace; }PRE.ctl { font-family: "Lohit Hindi",monospace; }P { margin-bottom: 0.08in; }TT.cjk { font-family: "WenQuanYi Micro Hei",monospace; }TT.ctl { font-family: "Lohit Hindi",monospace; }A:link { }CODE.cjk { font-family: "WenQuanYi Micro Hei",monospace; }CODE.ctl { font-family: "Lohit Hindi",monospace; }</style>
</div>
anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-6805567240198499092014-04-10T00:15:00.001-07:002014-05-12T02:09:46.812-07:00Ubuntu 12.04 tips<div dir="ltr" style="text-align: left;" trbidi="on">
1. Enable super user account password on Ubuntu<br />
<br />
$ sudo passwd root<br />
[sudo] password for :<br />
Enter new UNIX password:<br />
Retype new UNIX password:<br />
passwd: password updated successfully<br />
<br />
With with the new password you can login as super user with su command<br />
<br />
2. For anyone also wanting to liberate their system, this is one of the solution<br />
<br />
load the Terminal<br />
type: sudo passwd root<br />
input your user's password when prompted<br />
create UNIX password when prompted<br />
type: sudo sh -c 'echo "greeter-show-manual-login=true" >> <a href="https://www.blogger.com/etc/lightdm/lightdm.conf%27" style="color: #3465a4;">/etc/lightdm/lightdm.conf'</a><br />
reboot the system<br />
At the login screen there is now an option to login manually.<br />
<div>
<br /></div>
<div>
3. To install skype:</div>
<div>
<br /></div>
<div>
sudo add-apt-repository "deb <a href="http://archive.canonical.com/" style="color: #3465a4;">http://archive.canonical.com/</a> $(lsb_release -sc) partner"<br />
sudo apt-get update <br />
sudo apt-get install skype</div>
<div>
<br /></div>
<div>
4. To see hidden files in the particular directory, Press Ctrl + H.</div>
<div>
5. To install chrome using deb package:</div>
<div>
<br /></div>
sudo dpkg -i google-chrome-stable_current_i386.deb <br />
google-chrome-stable : to open the chrome.<br />
<br />
6. To change the ownership of all files and directories inside of directory and directory itself:<br />
groups <username> //to get the user group</username><br />
sudo chown -R username:group directory<br />
<br />
7. Install sqlite browser<br />
<br />
Go to development.sqlite3 {file with .sqlite3} extension. Right click the file. Select open with other application. Select search from internet to find the applicable software.System will search for SQLiteman. Install SQLiteman.<br />
<pre> </pre>
<pre> </pre>
<pre> </pre>
8. command to kill process running in ror localhost 3000 .<br />
lfos| grep 3000<br />
kill -9 5252 [ex]<br />
<br />
<div>
</div>
<div>
<br /></div>
</div>
anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-85715827146848664432010-07-25T06:09:00.000-07:002010-08-13T03:28:52.389-07:00In Ubuntu 9.04 Beta on a Dell Vostro 1320 I get no sound recorded.References: http://ubuntuforums.org/showthread.php?p=6589810<br /><br /><u>BACKGROUND:</u><br /><br />The audio functionality of any computer system belongs to the very basic functions of a PC and OS. No sound, poor sound, limited functionality - No use for such a system!<br /><br />The main idea behind upgrading ALSA with attached script is to make Linux available to a slightly wider community.<br /><br />The script bridges the huge delay (up to a year) of Alsa updates supplied through the official channels.<br />By running the upgrade you'll have a much bigger chance to get your soundcard working or problems resolved.<br /><br />The script installs the latest official stable ALSA release. (optional the even more up 2 date driver snapshot will be installed)<br /><br /><u>Upgraded packages</u><br /><br />Alsa 1.0.23 (stabil)<br /><br />See: <a href="http://www.alsa-project.org/main/index.php/Changes_v1.0.22_v1.0.23" target="_blank">Changelog Alsa 1.0.23 </a><br /><br />DRIVER=alsa-driver-1.0.23<br />FIRMWARE=alsa-firmware-1.0.23<br />LIB=alsa-lib-1.0.23<br />PLUGINS=alsa-plugins-1.0.23<br />UTILS=alsa-utils-1.0.23<br />TOOLS=alsa-tools-1.0.23<br />OSS=alsa-oss-1.0.17<br /><br />Supported kernels: 2.6.24/26/27/28/29/30/31/32 family (including rt-kernel & NON-Ubuntu ZEN-rt-kernel)<br /><br />Note: The restore currently does not not work on custom kernels!<br /><br /><u>UPGRADE:</u><br /><br />The script is not in line with Debian/Ubuntu rules for package handling. It just overwrites existing files.<br />You won't see any changes on the ALSA package-ids within Synaptic!<br /><br />The script recognizes severe problems during the installation and will stop automatically. It shouldn't mess up your setup.<br />If the script stops with an error-message nothing should have been touched!<br /><br />In the worst case scenario the -r restore option restores your old system status as good as possible. It'll reinstall kernel, kernel-headers and Alsa related packages.<br /><br />Ubuntu upgrades/updates might overwrite your Alsa installation once in a while (e.g. Major upgrades, kernel-upgrades or ALSA-package upgrades).<br />You just need to rerun the upgrade-script using the -i option in this case (if you still have the compiled sources on the disk).<br /><br />Disclaimer: I won't take any responsibility for mess-ups caused by using the script! -- Of course - I do my best to avoid these and support you as much as I can. <img src="http://ubuntuforums.org/images/smilies/icon_wink.gif" alt="" title="Wink" class="inlineimg" border="0" /><br /><br />As usual - Make a backup first! - A restore will just take 5 minutes with rsync. That might save you hours of troubleshooting and frustration <img src="http://ubuntuforums.org/images/smilies/icon_wink.gif" alt="" title="Wink" class="inlineimg" border="0" /> .<br /><br />Please consider that I rely on your support to improve the script and really appreciate your involvement.<br /><br /><br /><br />Short Alsa-Upgrade script install instructions:<br /><br />1. download the script and save it somewhere<br />2. cd <your-download-dir><br />3. tar xvf AlsaUpgrade-1.0.23-2.tar<br />4. sudo ./AlsaUpgrade-1.0.23-2.sh -d<br />5. sudo ./AlsaUpgrade-1.0.23-2.sh -c<br />6. sudo ./AlsaUpgrade-1.0.23-2.sh -i<br />7. sudo shutdown -r 0<br /><br />Logging: I recommend to log all the upgrade steps, e.g.<br /><br />script -a -c "./AlsaUpgrade-1.0.23-2.sh -d" /tmp/Alsa_1.0.23-2_upgrade_download.log<br /><br />You'll find a log file /tmp/Alsa_1.0.23-2_upgrade_download.log as soon as the script is finished.<br />You need to run this procedure for every single step. Choose whatever logfile names.<br /><br /><u>Test and Troubleshooting</u><br /><br />After reboot you can type:<br /><br />cat /proc/asound/version<br /><br />This will let you know if you're running the new version.<br /><br /><br />The easiest and most reliable test to verify if Alsa is working is "aplay" - the Alsa player application. If aplay won't work -- nothing else will work.<br /><br />Make sure that all your channels are unmuted and volume is up!<br /><br />Type in a terminal:<br />$ aplay -l<br />(This won't work on e.g. webcams with a microphone only. Here you need to do a $cat /proc/asound/cards to see if it is there"<br /><br />If you see your soundcards, you're almost there.<br /><br />To test your first (default-index 0 X=0) soundcard, type e.g.:<br />$ aplay -Dplughw:X,0 -fcd /<your-music-directory>/<replace-this-with-your-soundfile>.wav<br />or e.g.<br />$ speaker-test -Dplughw:X,0 -c2<br />replace the X with the index of your soundcard index , which you find out by typing "aplay -l" - look for "card X"<br /><br />Multichannel you can test the following way:<br />1. Type $aplay -L to find out about your pcm device . e.g "surround51"<br />2. Type $speaker-test -D surround51 -c6<br />Note: If the channel mapping should be wrong you need to adjust it in .asoundrc<br /><br />Before reporting "NO SOUND" problems - check if your alsamixer-channels are activated and unmuted (gnome-mixer/volume-control/preferences)!!<br />Very often there are headphone-jack, Toslink, SPDIF or microphone issues reported. Usually this has something to do with wrong alsamixer settings or more seldom with a wrong model-id assigned to your sound-driver in /etc/modprobe.d/alsa-base.conf .<br />If you're lacking certain controls in alsamixer or your driver is not even being loaded, you should check-out your model-id in attached HD-Audio-Models.txt.<br />I strongly recommend to try similar model-id's matching your codec to checkout if your faulty function gets working.<br />I'd guess 80% of the reported problems (group: other than alsamixer issues) over here are related to the model setting in alsa-base.<br /><br />Howto:<br />1. sudo gedit /etc/modprobe.d/alsa-base.conf<br /><br />2. Look for:<br />options snd-hda-intel index=-2<br />3. Lookup your model in HD-Audio-Models.txt and change entry accordingly:<br />options snd-hda-intel index=-2 model=XXXXX<br />4. Save & Exit & Reboot<br /><br />Please also have a look at these sides for further help:<br /><br /><a href="http://ubuntuforums.org/showthread.php?t=843012" target="_blank">http://ubuntuforums.org/showthread.php?t=843012</a><br /><a href="https://help.ubuntu.com/community/SoundTroubleshooting" target="_blank">https://help.ubuntu.com/community/SoundTroubleshooting</a></replace-this-with-your-soundfile></your-music-directory></your-download-dir><br /><br /><!-- AddThis Button BEGIN --><br /><script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script><br /><a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&username=ananta123"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=ananta123"></script><br /><!-- AddThis Button END -->anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com2tag:blogger.com,1999:blog-7495968578244058386.post-5963001977562873472010-03-25T21:33:00.000-07:002010-03-25T21:34:51.325-07:00How to restore Grub from a live Ubuntu cd.<span style="color:Red;">EDIT:</span> I have not been around in a long time, but it appears grub can still give people headaches<img src="http://ubuntuforums.org/images/smilies/icon_smile.gif" alt="" title="Smile" class="inlineimg" border="0" /> I notice people are still referring to this guide now and then, so I wanted to post a link to a grub2 guide. There are differences so you may want to check there as well <a href="http://ubuntuforums.org/showthread.php?t=1195275" target="_blank">http://ubuntuforums.org/showthread.php?t=1195275</a>. Glad to see Ubuntu is still going strong<img src="http://ubuntuforums.org/images/smilies/icon_smile.gif" alt="" title="Smile" class="inlineimg" border="0" /> Take care.<br /><br />This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.<br /><br />(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see "sudo" that will mean to you that the following command should be entered at a root terminal.)<br /><br />Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.<br /><br />When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)<br /><br /><div style="margin: 5px 20px 20px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:</div> <pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;">sudo grub</pre> </div>This will get you a "grub>" prompt (i.e. the grub shell). At grub>. enter these commands<br /><br /><div style="margin: 5px 20px 20px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:</div> <pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;">find /boot/grub/stage1</pre> </div>This will return a location. If you have more than one, select the installation that you want to provide the grub files.<br />Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)<br /><br /><div style="margin: 5px 20px 20px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:</div> <pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;">root (hd?,?)</pre> </div>Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)<br /><br />Next enter the command to install grub to the mbr<br /><br /><div style="margin: 5px 20px 20px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:</div> <pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;">setup (hd0)</pre> </div>Finally exit the grub shell<br /><div style="margin: 5px 20px 20px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:</div> <pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;">quit</pre> </div>That is it. Grub will be installed to the mbr.<br />When you reboot, you will have the grub menu at startup.<br /><br />Now the explanation.<br />Sudo grub gets you the grub shell.<br />Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub's files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.<br />So root (hd?,?) tells grub it's files are on that partition.<br />Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive's mbr.<br />Quit will exit you from the grub shell.<br /><br />Reference: http://ubuntuforums.org/showthread.php?t=224351anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-71444331412984443482010-02-23T03:04:00.000-08:002010-02-23T04:36:31.622-08:00Enable InnoDB as MySQL Engine on Windows<dl><dd>1. Shut down your MySQL server (stop the service) </dd><dd>2. Open my.ini (mysql's config file), which is located in your MySQL program folder. </dd><dd>3. In my.ini, find: </dd></dl> <pre> skip-innodb<br /></pre> <dl><dd>4. Replace this line with: </dd></dl> <pre> # skip-innodb<br /></pre> <dl><dd>5. Save the file </dd><dd>6. Start the MySQL server again </dd></dl>anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-3359656914322822942009-12-19T00:36:00.000-08:002009-12-19T00:57:32.565-08:00december 19Today is a 3rd day i was back from cambodai. I still have vacation for next 20 days so not any regular task to be done.<br />I wake up late in the morning and........<br /><input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div><input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div><input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div>anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com0tag:blogger.com,1999:blog-7495968578244058386.post-28206473867980474302009-12-18T22:27:00.001-08:002009-12-18T22:27:54.659-08:00HeyThis is the first time i am writng something in the blog <input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div>anantahttp://www.blogger.com/profile/03449454139159625016noreply@blogger.com1