Indian Homemade Cleaners & Beauty Products


My terrace garden plants are dying due to some insect attack. I do not want to put pesticides and eat some poison along with them. So I was researching on how to make one homemade insecticide. But the challenge is to get the same ingredient in India. I am now struck up on how to get liquid Castille Soap. Will do some more research and update you the developments. Meanwhile to keep you interested i am reposting the ingredients Rebeka had prescibed in her blog.

Home made insecticide

3 C Warm Water
6-8 Cloves Garlic, Peeled
1 TBS Cayenne Pepper (Kashmiri Chilli ?!?)
1/2 Medium Onion, quartered
1/2 tsp Liquid Castille Soap, fragrance free

Its turns out that Garlic and Pepper are negative (pranic) food according to Meditators. Hmnnn … Insects know it.

Toothpaste

Easy Laundry Soap

  • What you’ll need to make your very own Easy Laundry Soap (this makes approx. 48 loads):
  • 1 Bar (14 oz) Fels-Naptha, Zote Soap or Ivory Soap
  • 2 C Arm & Hammer Super Washing Soda (make sure it says “Super Washing Soda”)
  • 2 C Borax

I will try to get source of buying all the ingredients and update this post soon.

Advertisements

YII webapp customising from ground up


A)) config/main.php

1. name your webapp

‘name’=’my webapp’

2.  enable gii

‘gii’=>array(
‘class’=>’system.gii.GiiModule’,
‘password’=>’password’,
// If removed, Gii defaults to localhost only. Edit carefully to taste.
‘ipFilters’=>array(‘127.0.0.1′,’::1′),
),

),

3. create your database scheme

4.  beautify url

‘urlManager’=>array(
‘urlFormat’=>’path’,
‘rules’=>array(
‘<controller:\w+>/<id:\d+>’=>'<controller>/view’,
‘<controller:\w+>/<action:\w+>/<id:\d+>’=>'<controller>/<action>’,
‘<controller:\w+>/<action:\w+>’=>'<controller>/<action>’,
),
),

5. enable mysql or point to sqldatabase

‘db’=>array(
‘connectionString’ => ‘mysql:host=localhost;dbname=mywebapp’,
’emulatePrepare’ => true,
‘username’ => ‘root’,
‘password’ => ‘password’,
‘charset’ => ‘utf8’,
),

6. set admin email

‘params’=>array(
// this is used in contact page
‘adminEmail’=>’xxxxx@gmail.com’,
),

 

7. show log messages in the webpage

/ uncomment the following to show log messages on web pages
//
array(
‘class’=>’CWebLogRoute’,
),

componenets/UserIdentity.php

7.  change default passwords

public function authenticate()
{
$users=array(
// username => password
‘demo’=>’demo’,
‘admin’=>’admin’,
);

BB) Download mbmenu plugi

views/layouts/main.php

1. change menus

<?php $this->widget(‘application.extensions.mbmenu.MbMenu’,array(
‘items’=>array(
array(‘label’=>’Home’, ‘url’=>array(‘/site/index’)),
array(‘label’=>’Menu 1’, ‘url’=>array(‘/menu1l’),
‘items’=>array(
array(‘label’=>’sub menu 1’, ‘url’=>array(‘/item11’)),
array(‘label’=>’sub menu 2’, ‘url’=>array(‘/item12)),
),
),

2. change footer

<div id=”footer”>
Copyright &copy; <?php echo date(‘Y’); ?> by my company – All Rights Reserved.<br/>
</div><!– footer –>

CC)  YII-booster plugin

config/main.php

Yii::setPathOfAlias(‘booster’, dirname(__FILE__) . DIRECTORY_SEPARATOR . ‘../extensions/yii-booster’);

// preloading ‘log’ component
‘preload’=>array(‘log’,’booster’),

‘components’=>array(

…………………..

‘booster’=> array(
‘class’ =>’booster.components.Booster’,
‘responsiveCss’=>true,
),

………………………….

DIY Light craft project inspiration from curbly


I have always liked lights and particularly crafted ones. I was not knowing it. I was supposed to  do this from throw away materials. Also i was liking everything that is transparent (I know what you are thinking but it is not that). Glass Bottles was an ideal light fitting for me. Guess what the shades are made from. I did not paint them, instead used an already tainted plastic. The inspiration came from two different projects at curbly

image

I will publish the instructions later.

Using Google Transliterate API with YII


Using Google Transliterate API is straight forward. However to meet the goals of the small project (Webapp for food Catering company) I need to overcome following challenges.

Want to change id of text box (Tablename_fieldname) at will

Google text box id defaults to transliterateTextarea. I was not able to figure out how to change the YII $form object which enforces id of format Tablename_fieldname. I figured out its far more easier to change in the javascript of google to the id which YII requires.

 

change from

control.makeTransliteratable(['transliterateTextarea']);

to

var ids = ["Dish_dish", "Dish_dish2"]

control.makeTransliteratable(ids);

This brings us to the next challenge. I have to add one line for every field attribute I want to transliterate in the main site template page.

Load Google Transliterate API only in the views and not in every page

Handling related models in YII forms


Many AWBs can be carried in one Trip. One AWB can be carried across Many Trips. We will use MySQL for the database. Below is the schema. tbl_tripAWB is the junction table.

CREATE TABLE tbl_trip(

id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,

truckId TINYINT UNSIGNED NOT NULL,

departureDate DATETIME NOT NULL,

tripOrigin MEDIUMINT UNSIGNED NOT NULL,

tripDestination MEDIUMINT UNSIGNED NOT NULL,

arrivalDate DATETIME NOT NULL,

tripFor BOOLEAN NOT NULL DEFAULT 0,

tripStatus VARCHAR(125),

trip TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,

INDEX (truckId),

INDEX (tripOrigin),

INDEX (tripDestination)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE tbl_awb(

id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,

awbPrefix VARCHAR(3) NOT NULL,

awbNumber VARCHAR(8) NOT NULL,

awbAirport MEDIUMINT UNSIGNED NOT NULL,

awbCarrier TINYINT UNSIGNED NOT NULL,

awbPieces TINYINT UNSIGNED NOT NULL,

awbWeight MEDIUMINT UNSIGNED NOT NULL,

awb TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,

INDEX (awbAirport),

INDEX (awbCarrier)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE tbl_tripAwb(

id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,

trip INTEGER UNSIGNED NOT NULL,

awb INTEGER UNSIGNED NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE tbl_tripAwb

ADD CONSTRAINT FOREIGN KEY (trip) REFERENCES tbl_trip (id) ON UPDATE CASCADE,

ADD CONSTRAINT FOREIGN KEY (awb) REFERENCES tbl_awb (id) ON UPDATE CASCADE;

Update Trip form to display the list box with multi select containing AWBs.

labelEx($model,’tripAwbs’); ?>
dropDownList($model, ‘tripAwbs’, CHtml::listData(Awb::model()->findAll(), ‘id’, ‘awbNumber’, ‘awbPrefix’),array(‘multiple’=>’multiple’, ‘size’=>5)
); ?>
error($model,’tripAwbs’); ?>

Yii automatically created the below relationship


'tripAwbs' => array(self::HAS_MANY, 'TripAwb', 'trip'),

In order for the creation of a new Trip to work, you’ll need to update the Controller to handle the tripAwbs. Within the actionCreate() method (of TripController), after the Trip has been saved, loop through each AWB and add that record to tbl_tripAwb. The beginning of actionCreate() would look like:

if(isset($_POST['Trip']))
{
$model->attributes=$_POST['Trip'];
if($model->save()) {
foreach ($_POST['Trip']['tripAwbs'] as $awb) {
$tripAwb = new TripAwb;
$tripAwb->trip = $model->id;
$tripAwb->awb = $awb;
if (!$tripAwb->save()) print_r($tripAwb->errors);
// $this->redirect(array('view','id'=>$model->id));
}}
}

The form has already been created and populated, but to get it to indicate existing selections, we need to pass along the tbl_tripAwb values. You might think that you can just fetch all the tbl_tripAwb records where id equals the Model’s id (in other words, perform a with(‘tripAwb’)-> retrieval), but you can’t. For the drop-down menu in the form to preselect the right values, the form needs to access an array of values, not an array of objects. To achieve that, add some code to the loadModel() method of the TripController. This method is called for the update, delete, and view actions and just returns a single Model. The Model is loaded using:


public function loadModel($id)
{

$model=Trip::model()->findByPk($id);

// added for update by karthick
$criteria=new CDbCriteria;
$criteria->condition=’trip=:trip’;
$criteria->select = ‘awb’;
$criteria->params=array(‘:trip’=>$_GET[‘id’]);
$tripAwbs = TripAwb::model()->findAll($criteria);

$Awbs = array();
foreach ($tripAwbs as $awb) {
$Awbs[] = $awb->awb;
}

$model->tripAwbs = $Awbs;

if($model===null)
throw new CHttpException(404,’The requested page does not exist.’);
return $model;
}

Then update the tbl_tripAwb when the form is submitted (and the post is updated). The easiest way to handle all possibilities is to clear out the existing values (for this trip) in tbl_tripAWb, and then add them new. To do that, in actionUpdate() of the TripController, you would have:


if(isset($_POST['Trip']))
{
$model->attributes=$_POST['Trip'];
if($model->save()) {
$criteria=new CDbCriteria;
$criteria->condition='trip=:trip';
$criteria->params=array(':trip'=>$model->id);
tripAwb::model()->deleteAll($criteria);

// repeat of for each loop found in actionCreate()

foreach ($_POST[‘Trip’][‘tripAwbs’] as $awb) {
$tripAwb = new TripAwb;
$tripAwb->trip = $model->id;
$tripAwb->awb = $awb;
if (!$tripAwb->save()) print_r($tripAwb->errors);
}

$this->redirect(array(‘view’,’id’=>$model->id));
}

}

First Indicator and Trading System for Meta Trader Platform


After checking lot of Indicators from Forum at www.http://forexfactory.com. I wanted to create one nice Indicator as a pre-cursor for my own EA.  It will also help me to do scalping on 1 Min chart, until such time.

Indicator helps me to pay less attention is price action and helps me to just look at the chart only when required. This reduces lot of strain.

//+——————————————————————+
//|                                                     Infinite.mq4 |
//|                                       Copyright © 2011, pannet1  |
//|                                                pannet1@yahoo.com |
//+——————————————————————+
#property  copyright “Copyright © 2011, pannet1”
#property  link      “https://pannet1.wordpress.com&#8221;

//—-
#property indicator_separate_window
#property indicator_buffers  8
#property indicator_minimum  0
#property indicator_maximum  2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 PaleGreen
#property indicator_color4 LightSalmon
//—-
extern int MA = 20;
extern int MA_Type = 1;
extern int StDev = 2;
extern int Shift = 0;

//—- indicator buffers
double CrossUp[];
double CrossDown[];
double MAUp[];
double MADown[];
double TrendUp[];
double TrendDown[];
double Up[];
double Down[];
//+——————————————————————+
//| Custom indicator initialization function                         |
//+——————————————————————+
int init()
{
//—- indicator line

SetIndexStyle (0, DRAW_ARROW, 0,1, indicator_color2);
SetIndexArrow (0, 163);
SetIndexBuffer(0, CrossUp);
SetIndexStyle (1, DRAW_ARROW, 0,1, indicator_color1);
SetIndexArrow (1, 163);
SetIndexBuffer(1, CrossDown);

SetIndexStyle (2, DRAW_ARROW,0,1, indicator_color1);
SetIndexArrow (2, 241);
SetIndexBuffer(2, MAUp);
SetIndexStyle (3, DRAW_ARROW,0,1, indicator_color2);
SetIndexArrow (3, 242);
SetIndexBuffer(3, MADown);

SetIndexStyle (4, DRAW_ARROW, 0,1, indicator_color3);
SetIndexArrow (4, 110);
SetIndexBuffer(4, TrendUp);
SetIndexStyle (5, DRAW_ARROW, 0,1, indicator_color4);
SetIndexArrow (5, 110);
SetIndexBuffer(5, TrendDown);

SetIndexStyle (6, DRAW_ARROW, 0,1, indicator_color1);
SetIndexArrow (6, 236);
SetIndexBuffer(6, Up);
SetIndexStyle (7, DRAW_ARROW, 0,1, indicator_color2);
SetIndexArrow (7, 238);
SetIndexBuffer(7, Down);

//—- name for DataWindow and indicator subwindow label
IndicatorShortName(“Infinite”);
return(0);
}
//+——————————————————————+
//|                                                                  |
//+——————————————————————+
int deinit()
{
//—-
return(0);
}
//+——————————————————————+
//|  Infinite V1                                               |
//+——————————————————————+
int start()
{
int counted_bars = IndicatorCounted();
// int i;
int limit;
//—- check for possible errors
if(counted_bars < 0)
return(-1);
//—- last counted bar will be recounted
if(counted_bars > 0)
counted_bars–;
limit = Bars – counted_bars;
//—-
if(limit <= MA)
limit=1;
//—–

// Begin Main Loop Function
for(int i=0; i<limit; i++)
{
double  MAnow = iMA(NULL, 0, MA, 0, MA_Type,
PRICE_CLOSE, i);
double  MAprevious = iMA(NULL, 0, MA, 0, MA_Type,
PRICE_CLOSE, i + 1);
double  MAafter = iMA(NULL, 0, MA, 0, MA_Type,
PRICE_CLOSE, i – 1);
double  MAswap = 0;

//—-
double  BB_Upper = iBands(NULL, 0, MA, StDev, Shift,
PRICE_CLOSE, MODE_UPPER,  i);

double  BB_Lower = iBands(NULL, 0, MA, StDev, Shift,
PRICE_CLOSE, MODE_LOWER,  i);

//- Correct error in MAafter if bar (0) is latest

if (i==0) { // if we are in present bar
MAswap = MAnow;
if (MAswap > 0)
{
MAafter    = MAnow;
MAnow      = MAprevious;
MAprevious = MAswap;
}
}

//—-   Determine Bar type
double LOB =  Low[i];
double HOB =  High[i];
double OOB =  Open[i];
double COB =  Close[i];

bool BULLISH = false;
bool BEARISH = false;
bool DOJI    = false;

if ( OOB<COB )
BULLISH = true;

if ( OOB>COB )
BEARISH = true;

if ( (OOB-COB) == 0 )
DOJI = true;
//— end determine Bar type

//—– Determine dynamic Take Profit or Stop Loss
if(
(OOB < MAnow && COB > MAnow)
)
CrossDown[i] = 0.25;

if(
(OOB > MAnow && COB < MAnow)
)
CrossUp[i] = 1.25;
//——–

//– Signal Trend Change
if(
(MAnow < MAprevious)
&&(MAnow < MAafter)
)
MAUp[i] = 0.75;
{
Print(“inside function MAUp, at Bar “, i);
Print(“Previous: “,  MAprevious, ” now: “, MAnow, ” after:”, MAafter);
}

if(
(MAnow > MAprevious)
&& (MAnow > MAafter)
)
MADown[i] = 0.75;
//– end Trend Change

//– Determine present trend
if(
(MAnow > MAprevious)
&&(MAnow < MAafter)
)
TrendUp[i] = 0.75;

if(
(MAnow < MAprevious)
&&(MAnow > MAafter)
)
TrendDown[i] = 0.75;
//– end Trend Change

//— Signal Overbought or Oversold with Bollinger Band
if ( (HOB > BB_Lower && LOB < BB_Lower && HOB < MAnow) &&
(BULLISH==true)
)
Up[i] = 0.25;

if ( (HOB > BB_Upper && LOB < BB_Upper && LOB > MAnow) &&
(BEARISH==true)
)
Down[i] = 1.25;
//———-

}
return(0);
}
//+——————————————————————+

How to Trade
Get Ready when the Slanting Arrows are up or down.

Buy (Enter from Bottom Row arrow pointing upwards)
When a Sell Stop is encountered or
When the trend is changed (Moving average is UP)
Exit when a Buy Stop is encountered.
Clue: After entering focus attention in the top row.

Sell (Enter from Top Row arrow pointing downwards)
When a Buy Stop is encountered or
When the trend is changed (Moving average is Down)
Exit when a Sell Stop is encountered
Clue: After entering focus attention in the Bottom row.

 

Edit:  I just shifted the MaAfter value and every other MAs to the left by ONE (1) and everything works fine.

Also made few changes to have Stops and “Take Profit to one Row (Top row for Buy and Bottom row for Sell).

Open Source and Freight Forwarding