Sunday, 1 September 2013

typeof (Array, null) returns object and typeof(null, Array) returns function

typeof (Array, null) returns object and typeof(null, Array) returns function

As the title says it all, typeof (Array, null) returns object and
typeof(null, Array) returns function. Why? Interview question.
It returns the type of second parameter.

spool out put to particular file from command prompt

spool out put to particular file from command prompt

i want to spool my out put to particular file .my database in sql server.i
given code in command prompt like this: first i am connecting to my data
base like this: sqlcmd -S SUPPORT2/SUPPORT2 -U sa -P solutions
SUPPORT2/SUPPORT2 is a my server name then i am giving my databse
name(vallett)
then i am taking Ename from EmployeeMaster_tbl i want to spool this out
put to particular word file how i can do this?

Saturday, 31 August 2013

Unwanted background showing in html

Unwanted background showing in html

I am trying to intimate 4 images together. But unfortunately the images
are padding few pixels in the bottom.
You can see the problem here:

I just want to close all the images without any border or any padding.
CSS:
#play {
padding: 0px;
margin: 0px;
}
.ui-grid-b img {
width : 100%;
height : auto;
}
#play ul {
border: 0px solid black;
margin: 0 auto;
width: 50%;
height: 450px;
float: left;
padding: 0;
}
#play ul li {
background-image: none;
list-style-type: none;
}
#play ul li.list1 {
background-color: #ff0000;
}
#play ul li.list2 {
background-color: #00ff00;
}
HTML:
<div id="play" class="ui-grid-b">
<ul id="list1">
<li class="list1"><img src="images/img1.jpg" alt="Smiley face" ></li>
<li class="list1"><img src="images/img3.jpg" alt="Smiley face" ></li>
</ul>
<ul id="list2">
<li class="list2"><img src="images/img2.jpg" alt="Smiley face" ></li>
<li class="list2"><img src="images/img4.jpg" alt="Smiley face" ></li>
</ul>
</div>

Bash Script If null evaluating as false when true

Bash Script If null evaluating as false when true

I've run into my second hurdle in my journey into shell scripting. I
cannot seem to get my if statement to evaluate as true for a null value. I
am trying to pass an argument to the script and have the script let me
know if I am missing the required variable. Unfortunately it keeps falling
through to the else statement, even though it should be evaluating the
variable as a null one. Here is the script:
if [ "$1" == "d" ]; then
if [ -n "$2" ]; then
echo "Please enter the local location of the files"
else
LOCAL=$2
scp -r -i ~/Dropbox/Business/aws/first.pem $LOCAL
ubuntu@54.XXX.194.202:~/test/
fi
else
scp -r -i ~/Dropbox/Business/aws/first.pem
~/Dropbox/Business/aws/files/binaryhustle/
ubuntu@54.XXX.194.202:~/test/
fi
Here is the command I am running to execute the script:` bash copyfile.sh d
The response I get is:
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ...
[[user@]host2:]file2 `

Create own ORM in java using factory method

Create own ORM in java using factory method

I just want to ensure if the factory method fits within object relational
mapping (ORM) implementation or it has nothing to do with that.
Thank you

Replace UITableViewController MasterView in UISplitViewController with UITabBarViewController

Replace UITableViewController MasterView in UISplitViewController with
UITabBarViewController

I'm working on a project that requires UIsplitViewController, but I need
the rootViewController to be UITabViewController not UITableViewController
I'm using storyboard which allows me to display the UITabViewController
but when I'm trying to send data to DetailViewControler using delegate
DetailViewController not responding, is there any solution for that I've
been trying for over 1 month to find a way I can't find anything.

Calling a function from inside another function?

Calling a function from inside another function?

I have 3 short functions that I've written inside 3 separate m files in
Matlab.
The main function is called F_ and accepts one input argument and returns
a vector with 3 elements.
Element 1 and 2 of the output from F_ are (supposed to be) calculated
using the functions in the other 2 m files, lets call them theta0_ and
theta1_ for now.
Here's the code:
function Output = F_(t)
global RhoRF SigmaRF
Output = zeros(3,1);
Output(1) = theta0(t);
Output(2) = theta1(t) - RhoRF(2,3)*sqrt(SigmaRF(2,2))*sqrt(SigmaRF(3,3));
Output(3) = -0.5*SigmaRF(3,3);
end
and
function Output = theta0_(t)
global df0dt a0 f0 SigmaRF
Output = df0dt(t) + a0 + f0(t) + SigmaRF(1,1)/(2*a0)*(1-exp(-2*a0*t));
end
and
function Output = theta1_(t)
global df1dt a1 f1 SigmaRF
Output = df1dt(t) + a1 + f1(t) + SigmaRF(2,2)/(2*a1)*(1-exp(-2*a1*t));
end
I've created handles to these functions as follows:
F = @F_;
theta0 = @theta0_;
theta1 = @theta1_;
When I run F_ via it's handle with any value of t I get the following error:
F_(1)
Undefined function 'theta0' for input arguments of type 'double'.
Error in F_ (line 9)
Output(1) = theta0(t);
Please assist. What am I doing wrong here?
I only want to be able to call one function from within another.