SASS tutorial for Beginners

SASS is preprocessor of CSS, we can also refer it as CSS with superpower. SASS stands for Syntactically Awesome Style Sheets.

To save the file in SASS format we need to add .scss extension in the file.

Here we will learn how to use SASS in Visual Studio Code.

Initially in VSC we need to make a basic html file naming index.html and a folder for SASS naming sass.

Inside the sass folder we need to create a file naming main.scss.

Before executing the file we need to install an extension in our Visual Studio Code named as “Live Sass Compiler” which is shown below:

Once we install the extension we can see an option Live Sass in the status bar of Visual Studio Code, we need to click on that to make the Sass live.

If the status changes to “watching” automatically we can see that in the Scss folder main.css and main.css.map files are created.

Now whatever code we execute in main.scss it will be imported automatically to the main.css file.

Also we have to pay attention in linking the css script with the html file, as we will not link main.scss file in the html rather we will link main.css file in the html file.

Now we can start styling our file in main.scss and automatically all the codes will be imported in main.css and if it requires any conversion for being compatible with browser it will convert the codes automatically and make it compatible.

  • Key features of Sass which make it better than CSS is we can use :-

– Operators

– Variables

-Nesting

-Mixin

-Parameter

-Partials

It make it convenient for us to execute complicated codes very easily with these features.

Now we will see the features in details:-

  • Operators – We can use operators in Scss as shown below:

And if we see the same code in main.css we will see the actual values without the operators:

  • Variables – We can use variables in scss as shown below:

Here we can see that we have declared a variable named as $bg-color and we have assigned a color to it and we can assign the same variable where we want to use that color.

  • Nesting – We can use nesting in scss as shown below:

Here we can see that inside the class main_header itself we have assigned the values for <h1> and <h2>.

  • Mixin – We can use mixin in scss as shown below:

With the help of mixin feature we can use a set of codes which is suppose to be used number of times in the project, we can assign that set of codes under @mixin file name{} and we can just use the name with @include in the front wherever we want to add those codes.

  • Parameter – We can use parameter in scss as shown below:

In this feature we can use parameters under the mixin feature. In the Line 16 we can see that we have created a mixin named as “name2” in which we have assigned a parameter “$rem” which is assigned in “letter-spacing” and we have called that parameter in the line 31 and 38 by giving it a value of “1rem”.

Similarly we can pass number of parameters to make some changes in the codes which are under the “mixin”.

  • Partials – In partials we can make our scss file less complex by making separate files for variables and mixin and then importing those files in the main scss. By this way we can easily make any changes in the mixin and variable without any complexity.

We need to keep one thing in mind that we have to use “_” while creating the partial files for ‘mixin’ and ‘variables’ so that it does not make any issue with the main scss file.

We can see the example below:

_mixin.scss:

_variable.scss:

main.scss:

Index.html:

main.css:

This is the codes for all the files and we can see the following output:

To know more about SASS you can refer the video given below:

Tagged : / /

How to verify of cobertura.jar file is loaded into jvm

scmuser created the topic: How to verify of cobertura.jar file is loaded into jvm

How to verify of cobertura.jar file is loaded into jvm? I have instrumented class but Automated test is not writing any thing in ser file? Any verification checklist?

rajeshkumar replied the topic: How to verify of cobertura.jar file is loaded into jvm

As far as i know, there is no password protection for OST file. Yes there is for .pst file.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Could not find or load main class net.sourceforge.cobertura.instrument

scmuser replied the topic: Could not find or load main class net.sourceforge.cobertura.instrument

Still could not resolve the issues as below;

C:\Users\rkumar11>cd C:\cobertura
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>cobertura-check.bat
Error: Could not find or load main class net.sourceforge.cobertura.check.Main
C:\cobertura>ls -1
11.txt
cobertura-2.0.3.jar
cobertura-report.sh
EnhancedFor.java
cobertura-check.bat
coberturaFlush.war
LICENSE.txt
cobertura-check.sh
datafile
PrimitiveParameters.java
cobertura-instrument.bat
examples
README. markdown
cobertura-instrument. sh
instrumented
basedir
cobertura-merge.bat
lib
cobertura-2.0.3-javadoc.jar
cobertura-merge.sh
cobertura-2.0.3-sources.jar
cobertura-report.bat

C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
C:\cobertura>echo %JAVA_HOME%
C:\Tools\Java\jdk1.7.0_25
Tagged :

A simple Ruby method to send email

scmuser created the topic: A simple Ruby method to send email

A simple Ruby method to send email

require 'net/smtp'
 
def send_email(to,opts={})
  opts[:server]      ||= 'localhost'
  opts[:from]        ||= 'email@example.com'
  opts[:from_alias]  ||= 'Example Emailer'
  opts[:subject]     ||= "You need to see this"
  opts[:body]        ||= "Important stuff!"
 
  msg = <<END_OF_MESSAGE
From: #{opts[:from_alias]} <#{opts[:from]}>
To: <#{to}>
Subject: #{opts[:subject]}
 
#{opts[:body]}
END_OF_MESSAGE
 
  Net::SMTP.start(opts[:server]) do |smtp|
    smtp.send_message msg, opts[:from], to
  end
end

send_email “admnistrator@example.com”, :body => “This was easy to send”

Source – jerodsanto.net/2009/02/a-simple-ruby-method-to-send-email/

Tagged :

Add each array element to the lines of a file in ruby

scmuser created the topic: Add each array element to the lines of a file in ruby

Add each array element to the lines of a file in ruby

Either use Array#each to iterate over your array and call IO#puts to write each element to the file (puts adds a record separator, typically a newline character):

File.open("test.txt", "w+") do |f|
a.each { |element| f.puts(element) }
end

Or pass the whole array to puts:

File.open("test.txt", "w+") do |f|
f.puts(a)
end

Source –http://stackoverflow.com/questions/18900474/add-each-array-element-to-the-lines-of-a-file-in-ruby

Tagged :

What is the way to iterate through an array in Ruby?

scmuser created the topic: What is the way to iterate through an array in Ruby?

What is the way to iterate through an array in Ruby?

This will iterate through all the elements:

array = [1, 2, 3, 4, 5, 6]
array.each { |x| puts x }

Prints:
1
2
3
4
5
6

This will iterate through all the elements giving you the value and the index:

array = ["A", "B", "C"]
array.each_with_index {|val, index| puts "#{val} => #{index}" }

Prints:

A => 0
B => 1
C => 2

Source – stackoverflow.com/questions/310634/what-…ugh-an-array-in-ruby

Tagged :

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

scmuser created the topic: Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Short Notes – Ruby Arrays- Insert, Append, length, Index, Removed

Create a Ruby Array

letters = Array.new
letters = []
letters = Array.new()
letters =
letters = Array.new(3) ( Define how many elements you array would be)
letters = Array.new(3, 'me rocks') (Define each element with default values)

Accessing Elements

letters[0] - accessing First element
letters[-1] - Accessing last element
letters[-2]

Inserting/Adding elements

letters = Array.new() OUTPUT = ["a", "b", "c"]
letters.insert(0, 1) OUTPUT [1, "a", "b", "c", "d"]
letters.insert(-1, 'd') OUTPUT [1, "a", "b", "c", "d"]
letters << 'e' OUTPUT [1, "a", "b", "c", "d", "e"]
letters.push('f') OUTPUT [1, "a", "b", "c", "d", "e", "f"]

Removing Elements

letters.pop - Remove the last elements
letters.delete_at(2) - Delete the element of particular index
Tagged :

Common ways to read a file in Ruby?

scmuser created the topic: Common ways to read a file in Ruby?

File.open("my/file/path", "r") do |f|
f.each_line do |line|
puts line
end
end
# File is closed automatically at end of block

It is also possible to explicitly close file after as above (pass a block to open closes it for you):

f = File.open("my/file/path", "r")
f.each_line do |line|
puts line
end
f.close

Source – stackoverflow.com/questions/5545068/what…-read-a-file-in-ruby

Tagged :

How to process every line in a text file with Ruby

scmuser created the topic: How to process every line in a text file with Ruby

Example 1

# ruby sample code.
# process every line in a text file with ruby (version 1).
file='GettysburgAddress.txt'
File.readlines(file).each do |line|
puts line
end

Example 2

# ruby sample code.
# process every line in a text file with ruby (version 2).
file='GettysburgAddress.txt'
f = File.open(file, "r")
f.each_line { |line|
puts line
}
f.close

Source –
alvinalexander.com/blog/post/ruby/how-pr…-line-text-file-ruby

Tagged :

Script for time stamp update.

scmuser created the topic: Script for time stamp update.

write a batch Script for time stamp update?

sgadmin replied the topic: Re:Script for time stamp update.

data=data.txt
tfile=`cat data.txt |wc -l`


for (( i = 2 ; i <= tfile ; i++ ))
do

mfile=`cat $data |head -$i|tail -1|tr -s ” ” ” ” |cut -f8 -d” “`
mdate=`grep -i $mfile $data|tr -s ” ” ” “|cut -f6,7 -d” “`
myy=`echo $mdate |cut -b 1-4`
mon=`echo $mdate |cut -b 6-7`
mdd=`echo $mdate |cut -b 9-10`
mhh=`echo $mdate |cut -b 12-13`
mmin=`echo $mdate |cut -b 15-16`
mresult=`echo $myy$mon$mdd$mhh$mmin`
touch -t $mresult $mfile

done

Tagged :