RSrini @ Snip2Code
12 Snippets  (70th place)
1 Channel
2 Channels
3 points  (21691st place)
Top 10% Publisher
Serious Code Generator
Junior Popular Coder
Junior Autobiographer
Senior Autobiographer
Serious Famous Coder
Junior Wise Coder

Recent Snippets See all snippets by snip2codersrini

public by rsrini7  2724  0  3  0

basic oracle user setup

basic oracle user setup: oracle_basic_user_setup.sql
connect system/<password> as sysdba

create user srini identified by srini;
grant create session to srini;
grant create table to srini;
grant unlimited tablespace to srini;


public by dlee0113  2415  0  3  0

Simple Word Counter implemented using Akka

Simple Word Counter implemented using Akka: WordCounter.scala
import{ Actor, ActorRef, Props, ActorSystem }

case class ProcessStringMsg(string: String)
case class StringProcessedMsg(words: Integer)

class StringCounterActor extends Actor {
  def receive = {
    case ProcessStringMsg(string) => {
      val wordsInLine = string.split(" ").length
      sender ! StringProcessedMsg(wordsInLine)
    case _ => println("Error: message not recognized")

case class StartProcessFileMsg()

class WordCounterActor(filename: String) extends Actor {

  private var running = false
  private var totalLines = 0
  private var linesProcessed = 0
  private var result = 0
  private var fileSender: Option[ActorRef] = None

  def receive = {
    case StartProcessFileMsg() => {
      if (running) {
        // println just used for example purposes;
        // Akka logger should be used instead
        println("Warning: duplicate start message received")
      } else {
        running = true
        fileSender = Some(sender) // save reference to process invoker
        fromFile(filename).getLines.foreach { line =>
          context.actorOf(Props[StringCounterActor]) ! ProcessStringMsg(line)
          totalLines += 1
    case StringProcessedMsg(words) => {
      result += words
      linesProcessed += 1
      if (linesProcessed == totalLines) { ! result) // provide result to process invoker
    case _ => println("message not recognized!")

object Sample extends App {

  import akka.util.Timeout
  import scala.concurrent.duration._
  import akka.pattern.ask
  import akka.dispatch.ExecutionContexts._
  implicit val ec = global
  override def main(args: Array[String]) {
    val system = ActorSystem("System")
    val actor = system.actorOf(Props(new WordCounterActor(args(0))))
    implicit val timeout = Timeout(25 seconds)
    val future = actor ? StartProcessFileMsg() { result =>
      println("Total number of words " + result)


public by rsrini7  168862  0  3  0

Install Ruby and DevKit for Windows to install GEMs with DevKit dependency

Install Ruby and DevKit for Windows to install GEMs with DevKit dependency: ruby-devkit-gem-windows
Download Ruby installer and install / 7zip file and extract from
set the ruby bin directory available in the PATH variable.

Based on 32 / 64 bit arch, download DevKit from
Extract DevKit as RubyDevKit into your ruby installed directory (you can extract anywhere)

CD RubyDevKit
ruby dk.rb init
ruby dk.rb install

Now you can happily install gem with dev dependency

Looking for Jekyll Portable for windows ?? then :::


public by RSrini  237576  43  3  0

Installing db-sample-schema in windows (

Installing db-sample-schema in windows ( db-sample-schemas

download the zip file and extract to "D:\app\rsrini7\product\12.1.0\dbhome_1\demo\schema"

here rsrini7 is my username. extract the zip file to the dir according to your installation.

open command prompt as administrator
d: enter
cd D:\app\rsrini7\product\12.1.0\dbhome_1\demo\schema

mkdir log

perl -p -i.bak -e 's#__SUB__CWD__#'D:/app/rsrini7/product/12.1.0/dbhome_1/demo/schema/'#g' *.sql */*.sql */*.dat

(to install perl and other unix related tools - install babun - rocking tool for windows users. i love this )

edit mksample.sql and all '_main.sql' files and follow the below instructions

this is required :

1. in connect statement 
	add at the end 'as sysdba'
2. after the connect statement add the below line
	alter session set "_oracle_script"=true;

type in the command prompt : sqlplus enter
connect oracle with sys as sysdba and enter
type the dba-password 

At final execute the below script from sql prompt
@?/demo/schema/mksample <dba-password> <dba-password> password password password password password password EXAMPLE TEMP D:/app/rsrini7/product/12.1.0/dbhome_1/demo/schema/log/

replace <dba-password> with the actual dba password

happy learning:)


public by RSrini  151501  1  3  0

pkg-config opencv

pkg-config opencv: pkg-config-opencv
pkg-config opencv --cflags
pkg-config opencv --libs
pkg-config opencv --modversion