using MyGeneration doodads in C# .NET
I have added a new control to my .NET form and I want to save its value in
a table.I have added a new column in my table.How do you use MyGeneration
Doodads to create a data access object for this table?I have looked at
http://www.mygenerationsoftware.com/portal/doodads/cusage/tabid/53/default.aspx
but I can't understand what it means by "template".What is the procedure
to regenerate doodads for a table?
Wednesday, 11 September 2013
How do I add the distances in a while loop?
How do I add the distances in a while loop?
I am supposed to add the distance of a walker's position after N steps. I
run the while T times and need to add all of the N steps after T trails
and divide by the amount of trials to get an average. This is my code so
far. Iv tried doing a different integer like distance/T but it says that
distance isn't found. Is that because it is defined in the while loop. I
am using processing.
import javax.swing.JOptionPane;
String input=JOptionPane.showInputDialog("Steps");
int x=Integer.parseInt(input);
if (x<0)
{
System.out.println("Error. Invalid Entry.");
}
int T=1;
int N=0;
while (T<10)
{
while (N<x)
{
int stepsX=Math.round(random(1,10));
int stepsY=Math.round(random(1,10));
System.out.println(stepsX+","+stepsY);
N=N+1;
if (N==x)
{
int distance=(stepsX*stepsX)+(stepsY*stepsY);
System.out.println(distance);
}
}
T=T+1;
N=0;
}
System.out.println("mean sq. dist = ");
I am supposed to add the distance of a walker's position after N steps. I
run the while T times and need to add all of the N steps after T trails
and divide by the amount of trials to get an average. This is my code so
far. Iv tried doing a different integer like distance/T but it says that
distance isn't found. Is that because it is defined in the while loop. I
am using processing.
import javax.swing.JOptionPane;
String input=JOptionPane.showInputDialog("Steps");
int x=Integer.parseInt(input);
if (x<0)
{
System.out.println("Error. Invalid Entry.");
}
int T=1;
int N=0;
while (T<10)
{
while (N<x)
{
int stepsX=Math.round(random(1,10));
int stepsY=Math.round(random(1,10));
System.out.println(stepsX+","+stepsY);
N=N+1;
if (N==x)
{
int distance=(stepsX*stepsX)+(stepsY*stepsY);
System.out.println(distance);
}
}
T=T+1;
N=0;
}
System.out.println("mean sq. dist = ");
Notice: Undefined index: image - unable to find the error
Notice: Undefined index: image - unable to find the error
here is my error.i dont know why it is not working.i checked all the parts
but i was unable to find the error.
Notice: Undefined index: image in C:\xampp\htdocs\Final\places\Ressave.php
on line 27
here is my html code that pass the name of input:
<form class="form-horizontal" action="Ressave.php" method="POST"
autocomplete="on">
<div class="well">
<legend>Photos</legend>
<div class="control-group">
<label class="control-label">Upload Photo: </label>
<div class="controls">
<input name="image" type="file" />
</div>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="button" class="btn">Cancel</button>
</div>
</form>
Ressave.php is here and can not recieve the name here,so the error
occure.....
<?php
{ // Secure Connection Script
include('../Secure/dbConfig.php');
$dbSuccess = false;
$dbConnected =
mysql_connect($db['hostname'],$db['username'],$db['password']);
if ($dbConnected) {
$dbSelected = mysql_select_db($db['database'],$dbConnected);
if ($dbSelected) {
$dbSuccess = true;
} else {
echo "DB Selection FAILed";
}
} else {
echo "MySQL Connection FAILed";
}
// END Secure Connection Script
}
if(! $dbConnected )
{
die('Could not connect: ' . mysql_error());
}
{ // File Properties
$file = $_FILES['image']['tmp_name']; //Error comes from here(here is
the prob!)
if(!isset($file))
echo "Please Choose an Image.";
else {
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_size = getimagesize($_FILES['image']['tmp_name']);
if($image_size == FALSE)
echo "That is not an image.";
else
{
$lastid = mysql_insert_id();
echo "Image Uploaded.";
}
}
}
{ //join the post values into comma separated
$features = mysql_real_escape_string(implode(',', $_POST['features']));
$parking = mysql_real_escape_string(implode(',', $_POST['parking']));
$noise = mysql_real_escape_string(implode(',', $_POST['noise']));
$good_for = mysql_real_escape_string(implode(',', $_POST['good_for']));
$ambience = mysql_real_escape_string(implode(',', $_POST['ambience']));
$alcohol = mysql_real_escape_string(implode(',', $_POST['alcohol']));
}
$sql = "INSERT INTO prestaurant ( ResName, Rating, Food_serve, Features,
Parking, noise, Good_For, Ambience, Alcohol, Addition_info, Name,
Address1, Zipcode1, Address2, Zipcode2, Address3, Zipcode3, City, Mobile,
phone1, phone2, phone3, phone4, Email1, Email2, Fax, Website, image)".
"VALUES
('$_POST[restaurant_name]','$_POST[star_rating]','$_POST[food_served]','$features','$parking','$noise','$good_for','$ambience','$alcohol','$_POST[description]','$_POST[name]','$_POST[address1]','$_POST[zipcode1]','$_POST[address2]','$_POST[zipcode2]','$_POST[address3]','$_POST[zipcode3]','$_POST[city]','$_POST[mobile]','$_POST[phone1]','$_POST[phone2]','$_POST[phone3]','$_POST[phone4]','$_POST[email1]','$_POST[email2]','$_POST[fax]','$_POST[url]','$image')";
mysql_select_db('place');
$retval = mysql_query( $sql );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($dbConnected);
?>
here is my error.i dont know why it is not working.i checked all the parts
but i was unable to find the error.
Notice: Undefined index: image in C:\xampp\htdocs\Final\places\Ressave.php
on line 27
here is my html code that pass the name of input:
<form class="form-horizontal" action="Ressave.php" method="POST"
autocomplete="on">
<div class="well">
<legend>Photos</legend>
<div class="control-group">
<label class="control-label">Upload Photo: </label>
<div class="controls">
<input name="image" type="file" />
</div>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="button" class="btn">Cancel</button>
</div>
</form>
Ressave.php is here and can not recieve the name here,so the error
occure.....
<?php
{ // Secure Connection Script
include('../Secure/dbConfig.php');
$dbSuccess = false;
$dbConnected =
mysql_connect($db['hostname'],$db['username'],$db['password']);
if ($dbConnected) {
$dbSelected = mysql_select_db($db['database'],$dbConnected);
if ($dbSelected) {
$dbSuccess = true;
} else {
echo "DB Selection FAILed";
}
} else {
echo "MySQL Connection FAILed";
}
// END Secure Connection Script
}
if(! $dbConnected )
{
die('Could not connect: ' . mysql_error());
}
{ // File Properties
$file = $_FILES['image']['tmp_name']; //Error comes from here(here is
the prob!)
if(!isset($file))
echo "Please Choose an Image.";
else {
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_size = getimagesize($_FILES['image']['tmp_name']);
if($image_size == FALSE)
echo "That is not an image.";
else
{
$lastid = mysql_insert_id();
echo "Image Uploaded.";
}
}
}
{ //join the post values into comma separated
$features = mysql_real_escape_string(implode(',', $_POST['features']));
$parking = mysql_real_escape_string(implode(',', $_POST['parking']));
$noise = mysql_real_escape_string(implode(',', $_POST['noise']));
$good_for = mysql_real_escape_string(implode(',', $_POST['good_for']));
$ambience = mysql_real_escape_string(implode(',', $_POST['ambience']));
$alcohol = mysql_real_escape_string(implode(',', $_POST['alcohol']));
}
$sql = "INSERT INTO prestaurant ( ResName, Rating, Food_serve, Features,
Parking, noise, Good_For, Ambience, Alcohol, Addition_info, Name,
Address1, Zipcode1, Address2, Zipcode2, Address3, Zipcode3, City, Mobile,
phone1, phone2, phone3, phone4, Email1, Email2, Fax, Website, image)".
"VALUES
('$_POST[restaurant_name]','$_POST[star_rating]','$_POST[food_served]','$features','$parking','$noise','$good_for','$ambience','$alcohol','$_POST[description]','$_POST[name]','$_POST[address1]','$_POST[zipcode1]','$_POST[address2]','$_POST[zipcode2]','$_POST[address3]','$_POST[zipcode3]','$_POST[city]','$_POST[mobile]','$_POST[phone1]','$_POST[phone2]','$_POST[phone3]','$_POST[phone4]','$_POST[email1]','$_POST[email2]','$_POST[fax]','$_POST[url]','$image')";
mysql_select_db('place');
$retval = mysql_query( $sql );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($dbConnected);
?>
Displaying text from a file in an Inno installer with new lines
Displaying text from a file in an Inno installer with new lines
I'm trying to embed some text read from a file into an Inno installer.
Ideally this will happen in the pre-processor (ISPP) so the text cannot be
modified. I am able to read the text but cannot get any newlines to
display:
#define FileHandle
#define FileLine
#define ReadmeText ""
#for {FileHandle = FileOpen("README.txt"); FileHandle &&
!FileEof(FileHandle); FileLine = FileRead(FileHandle)} ReadmeText =
ReadmeText + FileLine
#if FileHandle
#expr FileClose(FileHandle)
I'm trying to embed some text read from a file into an Inno installer.
Ideally this will happen in the pre-processor (ISPP) so the text cannot be
modified. I am able to read the text but cannot get any newlines to
display:
#define FileHandle
#define FileLine
#define ReadmeText ""
#for {FileHandle = FileOpen("README.txt"); FileHandle &&
!FileEof(FileHandle); FileLine = FileRead(FileHandle)} ReadmeText =
ReadmeText + FileLine
#if FileHandle
#expr FileClose(FileHandle)
NumberFormat API clarification
NumberFormat API clarification
Directly from this API:
NumberFormat helps you to format and parse numbers for any locale. Your
code can be completely independent of the locale conventions for decimal
points, thousands-separators, or even the particular decimal digits used,
or whether the number format is even decimal.
What do they mean with or even the particular decimal digits used, or
whether the number format is even decimal.?
Directly from this API:
NumberFormat helps you to format and parse numbers for any locale. Your
code can be completely independent of the locale conventions for decimal
points, thousands-separators, or even the particular decimal digits used,
or whether the number format is even decimal.
What do they mean with or even the particular decimal digits used, or
whether the number format is even decimal.?
Unity3d Show count operations in Shader
Unity3d Show count operations in Shader
I am using Unity3d. I am writing shader. How to show count operations in
shader?
I am using Unity3d. I am writing shader. How to show count operations in
shader?
Tuesday, 10 September 2013
Calculating a future date
Calculating a future date
I have created a program to calculate days and in my program i want add 7
more days to the current date.
Which means if today's date is 9/11/2013, i want to make it 9/18/2013 by
getting the current date and adding 7 more days to it. How do i implement
this.
I know how to get today's date by using the date class but i don't know to
add another 7 days to the current date.
This is the method i used to get the current date :
public void dateCalculator(){
Date date;
date=new Date();
}
Thank you for your time.
I have created a program to calculate days and in my program i want add 7
more days to the current date.
Which means if today's date is 9/11/2013, i want to make it 9/18/2013 by
getting the current date and adding 7 more days to it. How do i implement
this.
I know how to get today's date by using the date class but i don't know to
add another 7 days to the current date.
This is the method i used to get the current date :
public void dateCalculator(){
Date date;
date=new Date();
}
Thank you for your time.
Subscribe to:
Posts (Atom)