Slash after script name in URL
My own site has one weird bug: I can put anything with slash in the end of
URL and it doesn't show 404 error, it working fine. For example:
That is normal URL: http://site.com/path/index.php
I put "/aaa.php" in the end: http://site.com/path/index.php/aaa.php - and
it show me normal URL (like in 1).
What is it? How to remove this behaviour? I want to see 404 error in
second case.
Apache/2.2.24 (FreeBSD) PHP 5.4.10
Saturday, 14 September 2013
Displaying prime numbers between two inputs using recursion
Displaying prime numbers between two inputs using recursion
I HAVE THIS CODE HERE BUT IT DOESNT WORK. SOMEONE HELP
void display(int x, int y);
int divider=2, z, remainder;
void main()
{
int igit, tobol;
clrscr();
printf("Input first number: ");
scanf("%i", igit);
printf("Input second number: ");
scanf("%i", tobol);
display(igit, tobol);
getch();
}
void display(int x, int y)
{
if(x<y)
{
z=x+1;
remainder=z%divider;
if(remainder==0&&z!=divider)
{
divider=divider+1;
display(x,y);
}
if(z==divider)
{
printf("%i", z);
x++;
divider=2;
display(x,y);
}
else
{
divider++;
display(x,y);
}
}
}
display(x,y) is to call the program again. i've set the divider to 2 so
that it starts at two when looking for the modulo
I HAVE THIS CODE HERE BUT IT DOESNT WORK. SOMEONE HELP
void display(int x, int y);
int divider=2, z, remainder;
void main()
{
int igit, tobol;
clrscr();
printf("Input first number: ");
scanf("%i", igit);
printf("Input second number: ");
scanf("%i", tobol);
display(igit, tobol);
getch();
}
void display(int x, int y)
{
if(x<y)
{
z=x+1;
remainder=z%divider;
if(remainder==0&&z!=divider)
{
divider=divider+1;
display(x,y);
}
if(z==divider)
{
printf("%i", z);
x++;
divider=2;
display(x,y);
}
else
{
divider++;
display(x,y);
}
}
}
display(x,y) is to call the program again. i've set the divider to 2 so
that it starts at two when looking for the modulo
Coffeescript to javascript transpiling Inaccuracy
Coffeescript to javascript transpiling Inaccuracy
I don't know if this is IDE related, or purely about the transpiling
process. I use Webstorm on a mac, and have node,npm and coffeescript
installed. The IDE is using that to make the transpiling to javascript:
//Coffeescript code, simple variable declaration
myamount = 56
//Traspiled javascript code
(function() {
var myamount;
myamount = 5;
}).call(this);
Any clue why it puts the variable in anonymous function ? This is not
correct transpiling.
I don't know if this is IDE related, or purely about the transpiling
process. I use Webstorm on a mac, and have node,npm and coffeescript
installed. The IDE is using that to make the transpiling to javascript:
//Coffeescript code, simple variable declaration
myamount = 56
//Traspiled javascript code
(function() {
var myamount;
myamount = 5;
}).call(this);
Any clue why it puts the variable in anonymous function ? This is not
correct transpiling.
Dispay icons and text on the same line
Dispay icons and text on the same line
I'm trying to get the text (Home, About Us, Cheese) etc to display to the
right of the social medias icons, so that they base of the text is aligned
with the base of the icons and they appear on the same line.
How do I do this?
My code is in fiddle here http://jsfiddle.net/pnX3d/
<div class="grid_5" id="social_icons">
<a href="http://www.facebook.com/print3dexpert"
target="blank"><img src="img/facebook.png" alt="Click to visit us
on Facebook"></a>
<a href="http://www.twitter.com/print3dexpert" target="blank"><img
src="img/twitter.png" alt="Click to visit us on Twitter"></a>
<a href="http://pinterest.com/print3dexpert" target="blank"><img
src="img/pinterest.png" alt="Click to visit us on
Pininterest"></a>
<a href="#"><img src="img/email.png" title="Click to contact us"
alt="Contact us"></a>
</div>
<nav class="topmenu omega">
<ul>
<li><a href="#">Home</a> |</li>
<li><a href="#">About Us</a> |</li>
<li><a href="#">Cheeses</a></li>
</ul>
</nav>
I'm trying to get the text (Home, About Us, Cheese) etc to display to the
right of the social medias icons, so that they base of the text is aligned
with the base of the icons and they appear on the same line.
How do I do this?
My code is in fiddle here http://jsfiddle.net/pnX3d/
<div class="grid_5" id="social_icons">
<a href="http://www.facebook.com/print3dexpert"
target="blank"><img src="img/facebook.png" alt="Click to visit us
on Facebook"></a>
<a href="http://www.twitter.com/print3dexpert" target="blank"><img
src="img/twitter.png" alt="Click to visit us on Twitter"></a>
<a href="http://pinterest.com/print3dexpert" target="blank"><img
src="img/pinterest.png" alt="Click to visit us on
Pininterest"></a>
<a href="#"><img src="img/email.png" title="Click to contact us"
alt="Contact us"></a>
</div>
<nav class="topmenu omega">
<ul>
<li><a href="#">Home</a> |</li>
<li><a href="#">About Us</a> |</li>
<li><a href="#">Cheeses</a></li>
</ul>
</nav>
Friday, 13 September 2013
C++ unique_ptr compiler error because of importing codes from VS2013 preview to VS2012
C++ unique_ptr compiler error because of importing codes from VS2013
preview to VS2012
I have used the std::unique_ptr in my previous codes in Visual studio 2013
preview, and I don't have the problems there. For my recent project case,
it is compiler error less in debugging in visual studio 2012. So now I
only got the following errors
This is the line that having the issue:
std::unique_ptr<MyClass> classHolder;
The following are what the compiler says
'unique_ptr' : is not a member of 'std'
syntax error : missing ';' before '<'
missing type specifier - int assumed. Note: C++ does not support
default-int
unexpected token(s) preceding ';'
Any thought on how can I resolve this issue?
preview to VS2012
I have used the std::unique_ptr in my previous codes in Visual studio 2013
preview, and I don't have the problems there. For my recent project case,
it is compiler error less in debugging in visual studio 2012. So now I
only got the following errors
This is the line that having the issue:
std::unique_ptr<MyClass> classHolder;
The following are what the compiler says
'unique_ptr' : is not a member of 'std'
syntax error : missing ';' before '<'
missing type specifier - int assumed. Note: C++ does not support
default-int
unexpected token(s) preceding ';'
Any thought on how can I resolve this issue?
Merging dataframes by columns where some columns exist in both dataset but some do not
Merging dataframes by columns where some columns exist in both dataset but
some do not
Suppose you have two datasets, x and y:
x=matrix(c(1,2,55,3,2,1,0,NA,NA,3,NA,333,NA,9,NA),5,3)
colnames(x)=c(1133131,12442141,20100063)
rownames(x)=c(1,2,3,4,5)
y=matrix(c(8,1,3,41,131,NA,4141,NA,124,NA,213,NA,128,NA,2,NA,1241,2),3,6)
colnames(y)=c(1133131,2422342,555555,33323242,20100063,23325600009)
rownames(y)=c(6,7,8)
I want to merge them so that all columns are present in the final dataset,
and the data is filled in where it exists, and NA where it is not. So if
one is not present in the other dataset, I want all its values to be NA
for that part.
So basically I want the final output to be:
merged: upc
days 1133131,12442141,2422342,555555,33323242,20100063,23325600009
1 1 1 NA
2 2 0 NA
3 55 NA NA
4 3 NA NA ...etc
5 2 3 NA
6 8 NA 41
7 1 NA 131
8 3 NA NA
Thank you for your input.
some do not
Suppose you have two datasets, x and y:
x=matrix(c(1,2,55,3,2,1,0,NA,NA,3,NA,333,NA,9,NA),5,3)
colnames(x)=c(1133131,12442141,20100063)
rownames(x)=c(1,2,3,4,5)
y=matrix(c(8,1,3,41,131,NA,4141,NA,124,NA,213,NA,128,NA,2,NA,1241,2),3,6)
colnames(y)=c(1133131,2422342,555555,33323242,20100063,23325600009)
rownames(y)=c(6,7,8)
I want to merge them so that all columns are present in the final dataset,
and the data is filled in where it exists, and NA where it is not. So if
one is not present in the other dataset, I want all its values to be NA
for that part.
So basically I want the final output to be:
merged: upc
days 1133131,12442141,2422342,555555,33323242,20100063,23325600009
1 1 1 NA
2 2 0 NA
3 55 NA NA
4 3 NA NA ...etc
5 2 3 NA
6 8 NA 41
7 1 NA 131
8 3 NA NA
Thank you for your input.
why my scanner can only take two numbers? Java
why my scanner can only take two numbers? Java
I am trying to use a Scanner object to read keyboard input (double type
numbers). The program compiles, but it can only take two numbers. Below is
my code, please help me find the reason. Thank you!
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
ArrayList<String> container = new ArrayList<String>();
double number = 0;
System.out.println("Type in the polynomials in increasing powers:");
while (!keyboard.nextLine().isEmpty())
{
// number = keyboard.nextDouble();
try {
number = keyboard.nextDouble();
} catch(Exception e) // throw exception if the
user input is not of double type
{
System.out.println("Invalid input");
}
container.add("-" + number);
}
I am trying to use a Scanner object to read keyboard input (double type
numbers). The program compiles, but it can only take two numbers. Below is
my code, please help me find the reason. Thank you!
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
ArrayList<String> container = new ArrayList<String>();
double number = 0;
System.out.println("Type in the polynomials in increasing powers:");
while (!keyboard.nextLine().isEmpty())
{
// number = keyboard.nextDouble();
try {
number = keyboard.nextDouble();
} catch(Exception e) // throw exception if the
user input is not of double type
{
System.out.println("Invalid input");
}
container.add("-" + number);
}
Subscribe to:
Posts (Atom)