Ace Syntax Highlighter

Now I have configured Ace to work within my editor so It’s time to add the feature of Syntax Highlighter.

Generally, we’ll manually set mode to editor like

editor.mode(‘ace/mode/javascript’);

for this File extension must be known to us so that we can manually add mode but we don’t know the file extension before hand. so we have to use some intermediator which will tell the file extension.

Ace editor already have a built-in functionality

i.e modelist

now How we can use it?
1. Initialize modelist
var modelist = ace.require("ace/ext/modelist");
2. Get the mode for particular file
var mode = modelist.getModeForPath(path).mode;
3. Set the mode to editor
editor.session.setMode(mode);

That’s it, all this is done under javascript file.

 

July 16: Rails Rails Rails

First of all I wake up in the morning and rush towards laptop as I want to secure my database of gurbani so I remove my phpmyadmin using

$sudo apt-get purge phpmyadmin

then again installed it.

$sudo apt-get install phpmyadmin

and thank god it finally works and the happiest movement was my database was fine. I again took a backup and then take a break. and done breakfast and all the morning stuff

after that I again start reading the Book and for relaxation I completed Big Bang Theory Season 5 yeah but my book is still left so I again read a book.

July 15: Mess with Laptop

Today I thought to deploy my database of gurbani in ruby and rails as it scaffold very neatly and pleasantly as my database is in mysql and the default settings of rails are in sqlite 3 so I started changing that settings. I am facing a lots difficulty as its new for me and in every site there is a unique tutorial someone said you need to install mysql driver as they give the link I tried it but it’s not worth full As I mess up with my laptop by removing and adding new packages related to mysql :p I am feeling like a warrior :p
Then  I took a break and start watching Big Bang Theory Season 5 I really enjoy it.
Then I came back to work
And start searching I got a link they told me the right and easy way to do so.
I follow all the steps but shit my phpmyadmin crashes oh my god how’s that possible I haven’t touched it.
I again give it a break and start reading Agile web development with ruby on rails 4 without wasting time .
Its late night now I think I have to sleep. So lets continue tomorrow good night.

July 14: Magic is here!

Today i woke up early in the morning at 0730. Earlier past days i was suffering from fever but today i feel fresh and at 0800 i started working on rails from agile web development with ruby and rails 4
I read about ORM(Object relational mapping) layers in rails
ORM layer maps tables to classes, rows to object, columns to attributes of the class. Class method are used to prerform table level operation and instance method perform operation on individual row.

Then I read about Ruby names. I am sharing few with you.
Method names- lower case letter with an underscore
Instance variable-@
Class name- use capital letter ex- PurchaseOrder

Redrict_to :action=>”edit”, :id => params[:id]
:action-> thing named action

Then I read about how to create an array in Ruby. Let me share a shortcut with you :p
Shortcut to create an array of words
A=[‘ants’, ‘bee’ , ‘cat’]
#this is the same
A=%w {ant bee cast}

Then By all this my part one of the book is over now its time for the Part 2
In part 2, In this part I am creating a shopping website which has two user roles a buyer and a seller and in this i studied a magical command. As magician never reveled their trick :p same way you just need to use this command
And you will see the magic
Now i am creating a UI for a product details which we store in database and their attributes are
Title
Product description
Image URL
Price
Now the magic is going to happen
Type

$rails generate scaffold product title:string description:text image_url:string price:decimal

Product is the name of table
Now this will create a whole UI to add new item
Modify it
Delete it
Everything is done with this single command
U have to do nothing its like you got everything in a plate now u just have to eat it. Its just a Idiom :p
Its just a trailer for more details must read Agile ruby on rails 4
Seriously Ruby on Rails are very much interesting keep in touch with me to know more magic tricks.
Good nite 🙂

July13: Fever day

Today i was suffering from fever so i was unable to work much but still i read a new thing in the book here it is.
Create your own Rails Api Documentation
Just type in

terminal

$

Rails new dummy_app
$Cd dummy_app
$Rake doc:rails

The last step takes a while. When it finishes. You will have the rails API documentation in a directory tree starting at doc/api. We suggest moving this folder to your desktop and then delete dummy_app tree
To view the rails API documentation open the location doc/api/index.html in browser
Tomorrow will tell you much more about ruby and rails

July 12: lazy phase over

Today i was suffering from fever and cold. So I was unable to give my 100% but still i completed my first phase to create Gurbani database. Now my database contain a table name JapJiSahib with 353 tuples and 4 attributes.
Now previously i was left ruby on rails in middle as i was unable to get a good reference so yesterday Captain suggested me to follow a book name” Agile web development with rails 4″ After reading its introduction i conclude it was really a nice book now i started reading it.
Will share lots of thing on Ruby on Rails in future be in touch.

July 2: Journey ludhiana to Nanded

Today is the day which i was waiting from last two months today we(me, Gaurav, inder bro) departed to the most legendary and holly place i.e Takhat Sachkhand Shri hajur sahib, it is situtated in nanded in Maharashtra. It is the 5th takhat from where the 10th Guru Gobind singh g  departed to Sachkhand(heaven).
Now our bags are packed and we are ready to go to station. As we were in the great hurry. We quickly took our bags and searching for the S4 coach in train. And we got it.
With the start of train our journey started. Ahan thats give a warm and pleasant  feeling. As I am little interested in poetry writing  so i thought to wright. But it is baaaaad so i won’t share :p 
36 hours long we have to stay in this train oh god its to looong. But yeah we enjoyed really well.
Ah I forgot to tell i am on holiday for a week :p lol so no work in this weak.
1 day passed in train. Hope second day will much more entertaining and full of blessings 🙂