Actually I've realised there isn't even a problem here, because the range of the second value doesn't matter. If the normalised value > 1 then we know it's larger, and the original calculations still churn out the same result!
James_43 15 Junior Poster
Cereal was right, missed that mistake. Thanks!
James_43 15 Junior Poster
Hi all, I'm working with a function that only accepts values between 0 and 1, so I need to scale my data first.
The first part involved in this is calculating the high/low values of my inputs. I pass this into a function that churns out X and Y values for the intersectionX => aX + b
between the line X => highX + low
and X => 0X + 1
I then iterate through every input value, applying the following formula:$data = (($x_y['x'] * $rawData) + $x_y['y']);
Now, my problem is that the function I pass the scaled value to changes the value by applying certain algorithm , and I am left with a value such as 0.38292. How do I descale this value?
Because I cannot be sure that the resultant value is higher or lower that the range I used for the initial scaling, I cannot simply reverse the same formula I used.
Does anyone have any ideas??
James_43 15 Junior Poster
For some bizzare reason, if I set $i < 1
as an example, suddenly the array goes from -5 to 360.... Can you even have negative array indexes?!
James_43 15 Junior Poster
Hi all,
I have an array $pTimeseries with 365 items inside it. I use a simple for statement, as below:
//Add TimeStamp to Historic Data
for($i = 0; $i < (count($pTimeseries)); $i++) {
$pTimeseries[$i][1] = $rawData[$i + $backdate][0];
}
In my Apache error logs I get "Undefined offset: 366" all the way up to 'Undefined offset: 327480' after which I get a memory error...
Why/how is the for statement not following the limit??
James_43 15 Junior Poster
Thought there may have been an obvious mistake, and there was! It was a container isssue, simply forgot to close a <div>
James_43 15 Junior Poster
Hi all,
For some reason, a white edge has appeared down the side of my website. It was never there before. The web suggested I should make sure to reset margins etc to 0 at the top of my stylesheet, which I already do. The edge is not due to a margin or padding, since I can't select it in the Chrome developer console.
The strange this is that this sometimes removes itself when viewed through Chrome, but is always there when viewed via a mobile. (In widescreen there is white space either side so you only notice this on a small screen).
Can someone help?
James_43 15 Junior Poster
Ah, silly mistake. No problem with the code, the issue was to do with StackView. Another object was obstructing it, so it wasn't registering the touch action!
James_43 15 Junior Poster
Hi all,
I've been trying to follow the basic Apple developer tutorial, where you create a food tracker app.
I can not get one part of the code to work, and I can't see why. Not only is it exactly the same as in the example, but searches online also seem to enforce that I've done this right...
I create 5 UIButton objects with this code:
// MARK: Initilisation
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
for _ in 0..<5 {
let button = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44))
button.backgroundColor = UIColor.redColor()
button.addTarget(self, action: "ratingButtonTapped:", forControlEvents: .TouchDown)
ratingButtons += [button]
addSubview(button)
}
}
As per the button.addTarget, I then have the function below:
// MARK: Button Action
func ratingButtonTapped(button: UIButton) {
print("Button pressed
James_43 15 Junior Poster
Ah cool, that makes a lot of sense. Cheers :)
James_43 15 Junior Poster
All good, appreciate it :)
James_43 15 Junior Poster
Hi all,
I have a multidimensional array [0]:[0], [1], [2], [3] and I want to try and find the min and max values of each index of that array over the whole array. I am using:
for ($i = 0; $i < count($input); $i++)
{
$string1[] = $input[$i][1];
$string2[] = $input[$i][2];
$string3[] = $input[$i][3];
$string4[] = $input[$i][4];
}
This gives me a linear array of all the values that I then pass into:
$string1_max = max($string1);
$string1_min = min($string1);
$x_ys1 = nValues($string1_min, $string1_max, 0, 1);
$string2_max = max($string2);
$string2_min = min($string2);
$x_ys2 = nValues($string2_min, $string2_max, 0, 1);
$string3_max = max($string3);
$string3_min = min($string3);
$x_ys3 = nValues($string3_min, $string3_max, 0, 1);
$string4_max = max($string4);
$string4_min = min($string4);
$x_ys4 = nValues($string4_min, $string4_max, 0, 1);
My question is: is there a way to code this formular when the indexes within the multidimensional array are unknown? At the moment they are hard coded from 1-4... but I want to be able to code them 1-x (0 is missed on purpose).
I tried playing around with multiple for statements, but just got confused. Is there a way to do this?
James_43 15 Junior Poster
Thanks, I'd appreciate it if you could take a look at the code :) Just a note that it search for pics from your my pictures folder, so there has to be something there
James_43 15 Junior Poster
Nice. I like that new approach to dealing with it!
One semi-related question though: what happens when x or y is a irrational number and you want to use it in a new calculation - can you store numbers in PHP as frations, or would you simply have to make do with a margin of error? e.g. scale = 1000 or something.
James_43 15 Junior Poster
Wow. I really didn't expect a response like that, it's amazing!
The only problem now is I don't actually understand the code! A bit more advanced than I'm used to, but the math is sound and it does indeed yield the correct result.
I'll spend a bit of time studying this. You've annoted it nicely so I should get through it alright. However, could you explain further the $scale variable and how that works with the PHP math functions to alter precisions?
Thanks again for this amazing contribution!!
James_43 15 Junior Poster
Here's a fun one... How would you solve a basic simultanous equation with PHP?
I have an array with a range [high,low] of [378,395] and I want to normalise the data in that array between the values of [-1, 1].
From that, using x => ax + b
you get the two equations:
378a + b = -1
395a + b = 1
Obviously this is quite easy to solve on paper...But I wouldn't have a clue how to go about it in PHP. A quick google search reveals a scary lack of information :/
James_43 15 Junior Poster
Solved!
for ($c=0; $c < $num; $c++)
{
echo '<pre>';
$data[$c] = (str_getcsv($data[$c], ' '));
$finalData[] = $data[$c];
echo '</pre>';
}
James_43 15 Junior Poster
Update:
code now reads:
for ($c=0; $c < $num; $c++)
{
echo '<pre>';
$finalData[] = $data[$c];
print_r(str_getcsv($data[$c], ' '));
echo '</pre>';
}
And below that I've added another for statement:
for ($i = 0; $i < $num; $i++)
{
$finalData[$i] = str_getcsv($finalData[$i]);
}
The result is:
Array
(
[0] => Array
(
[0] => 1 390.49 0.01
)
.....
Which is closer to what I want... I imagined that the second for statement would seperate the extra data and add them as sub-arrays.
James_43 15 Junior Poster
Haha. Whoops. Yea, that works - thanks for your help with this!!
James_43 15 Junior Poster
Hmmm. This actually thows up the same problem. Any index greater than the number of columns through an error. It only seems to work for one row.
When I simply write Console.WriteLine(fields);
I just get System.Double[]
show up.
James_43 15 Junior Poster
Hi all,
I am using a for statement to generate lots of arrays, example:
Array
(
[0] => 2
[1] => 395.0
[2] => 0.33
)
Array
(
[0] => 3
[1] => 394.0
[2] => 0.81
)
But, I want to have them all within 1 array, example:
Array
(
[0]
(
[0] => 2
[1] => 395.0
[2] => 0.33
)
[1]
(
[0] => 3
[1] => 394.0
[2] => 0.81
)
)
Am I able to do this within my for statement, which is currently:
for ($c=0; $c < $num; $c++)
{
echo '<pre>';
print_r(str_getcsv($data[$c], ' '));
echo '</pre>';
}
My research online has just turned up merging or adding to arrays, not adding arrays as a seperate level like I want to here... Can anyone help?
James_43 15 Junior Poster
I've taken another look at this and now have the following code:
static void ReadCSV(string filename)
{
using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(filename))
{
string[] fields = null;
parser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited;
parser.SetDelimiters(",");
while (!parser.EndOfData)
{
//Processing Row
fields = parser.ReadFields();
foreach (string field in fields)
{
fields = AddItemToArray(fields, field);
}
}
Console.WriteLine(fields[17]);
}
}
The AddItemToArray code is:
public static string[] AddItemToArray (string[] original, string itemToAdd)
{
string[] finalArray = new string[original.Length + 1];
for (int i = 0; i < original.Length; i++)
{
finalArray[i] = original[i];
}
finalArray[finalArray.Length - 1] = itemToAdd;
return finalArray;
}
This should ensure that the final fields variable contains an array for every item in the CSV file. However, as you can see in the code I first posted, when I write Console.WriteLine(fields[17]);
I get an index out of bounds error... The index only goes up to 4, which is the width of my columns... Why doesn't this store the complete data?
James_43 15 Junior Poster
That's really helpful thanks. I was hoping for something I can apply to the whole array, but I guess I have to convert each entry under a loop.
James_43 15 Junior Poster
Hi all,
I am able to pull data from a CSV file into a string array using the following code.
public static string[,] ReadCSV(string filename)
{
//Read Text
string whole_file = System.IO.File.ReadAllText(filename);
//Split into Lines
whole_file = whole_file.Replace('\n', '\r');
string[] lines = whole_file.Split(new char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries);
//Calucluate Rows and Columns
int num_rows = lines.Length;
int num_cols = lines[0].Split(',').Length;
//Allocate Array
string[,] values = new string[num_rows, num_cols];
//Load Array
for (int r = 0; r < num_rows; r++)
{
string[] line_r = lines[r].Split(',');
for (int c = 0; c < num_cols; c++)
{
values[r, c] = line_r[c];
}
}
//Return Values
return values;
}
This was based off an online example, so I'm not entirely sure what's happening here. I'm assuming that the data is stored as a string array with two required indexes [row, column]... Though I've never seen that, so it causing a bit of confusion.
Anyway, all the data in the CSV is a double, and I need the array to contain only doubles. How would I go about either converting the entire array, or populating it as a double in the first place?
James_43 15 Junior Poster
Here, I've published my source code. Hopefully someone may be able to see what's going on now.
https://drive.google.com/file/d/0B_DxF4ssjiwaM3FqR2RlUHdVY1k/view?usp=sharing
James_43 15 Junior Poster
No, the data.DefineSingleOutputOthersInput(columnSSN); is defining a column to make predictions from (I should have mentioned this is a time series prediction walkthrough).
But yeah, I thought it was a long shot someone would know the anwer here. The Encog documentation is pretty substandard. I'm looking at the FANN library and it appears a lot more succinct, so I might try move the programme to that instead. Thanks anyway
James_43 15 Junior Poster
Hi all,
I am doing some basic experimenting with ENCOG ANN, but am having issue following a simple walthough. At this stage I am simply trying to grab data from a CSV and normalise it. My code is:
string filename = "spots.csv";
var format = new CSVFormat(',', ' ');
IVersatileDataSource source = new CSVDataSource(filename, true, format);
var data = new VersatileMLDataSet(source);
data.NormHelper.Format = format;
Encog.ML.Data.Versatile.Columns.ColumnDefinition columnSSN = data.DefineSourceColumn("SSN", Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
Encog.ML.Data.Versatile.Columns.ColumnDefinition columnDEV = data.DefineSourceColumn("DEV", Encog.ML.Data.Versatile.Columns.ColumnType.Continuous);
data.DefineSingleOutputOthersInput(columnSSN);
EncogModel model = new EncogModel(data);
model.SelectMethod(data, MLMethodFactory.TypeFeedforward);
model.Report = new ConsoleStatusReportable();
data.Normalize();
I am getting the error "Can't find columns". Which doesn't make sense to me! They are definitely there, and contain the headers SSN and DEV. Does it matter what order they are in?
James_43 15 Junior Poster
You're right that I am just using one double animation, a true cross fade would dip in the middle, but I like having the previous background visible on the fade up.
Can you elaborate on the WPF User Control? I am using a C# WPF form (but I'm really new to all this, I don't really understand what that means!) Do you just mean that you used a timer? I started using that, but then moved to the Task.Delay, which I feel is a much better solution under the While() than having something continuously counting.
Specifically, I think the problem is with my loop. Even if there is high memory usage with the BitmapImage, I can't see how that would force the loop to lose count of its variables, which seems to be what's happening. I think it's more plausible that I've got the coding wrong.
James_43 15 Junior Poster
Actually.. Ignore this. I was adding the ORDER BY to the wrong $query!
James_43 15 Junior Poster
I am using a mySQL query in PHP to pull content from rows into an array. A simple for statement is then displaying this data:
for ($i = 0; $i < ($num_rows); $i++):
//Find Author Name
$query = 'SELECT firstname, lastname FROM vd_users WHERE id = ?';
$statement = $mySQL_con->prepare($query);
//Attempt Query
try {
$statement->execute(array($results[0][$i]['author_id']));
}
//Catch Errors
catch (PDOException $error) {
$info = $error->getMessage();
echo 'Sorry, we failed to load this page'; if ($_SESSION['debug'] = 1) { echo ': ' . $info; }
}
//Fetch Results to Array
$row = $statement->fetch(PDO::FETCH_ASSOC);
endfor;
This works well. However, since new rows are added with an id++, the newer ones are displayed at the bottom, and I would like them at the top.
Is it possible to order the mySQL rows by date using a column, or will I have to look at some other way? On a hunch I tried inverting the for statement to for ($i = $row_count; $i = 0; $i--
) thinking that that would do it, but nope!
I tried adding ORDER BY date
to my query, but that didn't work. Note that 'date' is a column name in the database.
James_43 15 Junior Poster
How does your transition code compare to mine? As you can see I use two image elements to simulate the cross fade - do you do something different?
I might try host the source code somewhere for you all to look at, since I can't attach it here.
James_43 15 Junior Poster
Oh right, yeah those are always annoying haha.
James_43 15 Junior Poster
I've actually just made a small modification. I realised using a for statement was silly because when the while() returns false it would still cycle through each iteration before finishing. So now I just make use of while:
if (App.index < AllImages.Count)
{
DoubleAnimation fadeoutAnimation = new DoubleAnimation();
fadeoutAnimation.Duration = TimeSpan.FromSeconds(1.0);
fadeoutAnimation.From = 0;
fadeoutAnimation.To = 1;
PreviewImages.BeginAnimation(Image.OpacityProperty, fadeoutAnimation);
await Task.Delay(2000);
PreviewImages.Source = new BitmapImage(new Uri(Convert.ToString(AllImages[App.index]._image)));
if (App.index < (AllImages.Count) && App.index > 0)
{
App.index2 = (App.index - 1);
}
else if (App.index < 1)
{
App.index2 = (AllImages.Count);
}
Background.Source = new BitmapImage(new Uri(Convert.ToString(AllImages[App.index2]._image)));
}
else { App.index = 0; }
App.index++;
}
The interesting thing is, I think this shows what's wrong with the code - but I cannot figure out exactly what. Everything works fine except when the first image in the list, so my two if statements
if (App.index < (AllImages.Count) && App.index > 0)
{
App.index2 = (App.index - 1);
}
else if (App.index < 1)
{
App.index2 = (AllImages.Count - 1);
}
are somehow incorrect.
At the moment, when the first image gets shown in the loop, it only shows it for a very small time, and then jumps to the next item in the fade very quickly.
At this point I imagine Background.Source = first image and App.index = first image + 1... What it SHOULD be is Background.Source = (AllImages.Count - 1) and App.Index = 0.... Which is exactly what happens in the if statement.
James_43 15 Junior Poster
Which window are you talking about?
Window 2 with the linear slideshow has no fade transitions using DoubleAnimation, it simply snaps to the next one. Window 1 should stop the transitions when Window 2 launches and the While() statement returns false.
James_43 15 Junior Poster
Thanks guys for your awesome responses! That makes a lot of sense.
Though what is a modal window, is it different from a form?
James_43 15 Junior Poster
Okay, so I've taken another look at this.
I was wrong about the CPU usage, I was only able to clock it up to about 3% of total use. The biggest drain was the RAM at approx. 300mb.
However, I was able to replicate the error - so there is definitely something wrong! My process was:
Launch the second screen (the linear slide show, where PageUp and PageDown navigate through slides). I mashes the keyboard with those two keys for a few seconds, the programe was fully able to keep up with those transitions. I then went to the last image, which triggers the this.close(); and sets app.timer = true; again.
It was then that the error happend! The counts for the image sources were completely off. Could it be because I cancel and then resume the while() statement?
James_43 15 Junior Poster
Hi there,
I'm still fairly new to programming. Would someone be able to explain exactly how different windows should be used in MS Visual Studio?
It seems that variable sharing between different windows is problematic. So does that mean that if you are trying to do multiple things on one window, you should construct each thing dynamically?
An example. I have a window with a listbox containing a list of images. When I click, the selected image populates a larger image box. I want this image to go full screen when I click F5.
At the moment I telling the current window to launch a different window at fullscreen. But would a better way involve dynamically reconstructing the current window to display fullscreen?
James_43 15 Junior Poster
30% did seem to jump out at me as quite a high load for some relatively minor code.
I'll run the programme through on its own and connected via HDMI output to see what the load is like and get back to you.
James_43 15 Junior Poster
Oh awesome, that works great! Thanks so much for your help!
James_43 15 Junior Poster
Here is the full array:
Array
(
[0] => Array
(
[0] => Array
(
[blog_id] => 1
[0] => 1
[title] => hello world
[1] => hello world
[post] => Test
[2] => Test
[date] => 2015-09-22 17:21:33
[3] => 2015-09-22 17:21:33
[modified] => 2015-09-22 17:31:33
[4] => 2015-09-22 17:31:33
[author_id] => 4
[5] => 4
)
[1] => Array
(
[blog_id] => 2
[0] => 2
[title] => hello world
[1] => hello world
[post] => Test
[2] => Test
[date] => 2015-09-22 17:21:33
[3] => 2015-09-22 17:21:33
[modified] => 2015-09-22 17:31:33
[4] => 2015-09-22 17:31:33
[author_id] => 4
[5] => 4
)
[2] => Array
(
[blog_id] => 3
[0] => 3
[title] => hello world
[1] => hello world
[post] => Test
[2] => Test
[date] => 2015-09-22 17:21:33
[3] => 2015-09-22 17:21:33
[modified] => 2015-09-22 17:31:33
[4] => 2015-09-22 17:31:33
[author_id] => 4
[5] => 4
)
[3] => Array
(
[blog_id] => 4
[0] => 4
[title] => hello world
[1] => hello world
[post] => Test
[2] => Test
[date] => 2015-09-22 17:21:33
[3] => 2015-09-22 17:21:33
[modified] => 2015-09-22 17:31:33
[4] => 2015-09-22 17:31:33
[author_id] => 4
[5] => 4
)
)
)
I had wondered about the numeric vs associative array. I'm guessing the mySQL query pulls both into the array, how do I specifiy one or the other?
James_43 15 Junior Poster
Thanks. It is referring to the other thread I just posted. But actually I've just realised what I want to do hasn't worked.
My mistake in pulling the mySQL data (in my previous post) was I was using $statement->fetch(); instead of $statement->fetchAll();
Now I have an array: $results. Below is the first row of data so you can see what the array looks like:
Array
(
[0] => Array
(
[0] => Array
(
[blog_id] => 1
[0] => 1
[title] => hello world
[1] => hello world
[post] => test
[2] => test
[date] => 2015-09-22 17:21:33
[3] => 2015-09-22 17:21:33
[modified] => 2015-09-22 17:31:33
[4] => 2015-09-22 17:31:33
[author_id] => 4
[5] => 4
)
Now, I simply want to echo some of that data. My code for that is:
for ($i = 0; $i < 5; $i++)
{
echo $results[$i]['title'];
echo '<br>';
}
I am then getting 2 error messages. One is Undefined index: title
(which is incorrect since you can see above that there IS an index called title.
Secondly, I get: Notice: Undefined offset: 1
, which I get for each item in the array.
Any ideas?
James_43 15 Junior Poster
Hi all,
I have a multi-dimensional array. Using a for function, I would like to display the information inside the array. This means using a variable $i for the first index of the array, which I think is causing the problem.
I am getting the error message:Undefined offset: 2
Note, that the number changes depending on the value of $i.
The code I am using is:
$created = $results[$i]['data'];
But I get the above error when I echo that information inside the for loop.
Is this because you can't use variables as indexes for arrays?
James_43 15 Junior Poster
Hey Jkon,
Thanks for that - that was my mistake, I forgot to put the quotations round the string. Sorted now.
You're right about the for loop. At the time, I was thinking that was the only way to grab multiple rows of data from mySQL, because when I tried with a query that returned multiple rows for some reason the array was only storing the information from the first row.
I realise now it was because I needed to push the data from each row into the array. So I can ditch the for loop and instead use $results[] = $row;
Thanks for your advice!
James_43 15 Junior Poster
I have created the connection through PHP:
//mySQL Credentials
$mySQL_username = 'username';
$mySQL_password = 'password';
$mySQL_host = 'localhost';
$mySQL_database = 'database';
//Attempt mySQL Connection
try {
$mySQL_con = new PDO('mysql:host='.$mySQL_host.'; dbname='.$mySQL_database.'', $mySQL_username, $mySQL_password);
}
catch (PDOException $error)
{
echo "Unable to connect: " . $error->getMessage();
}
The query itself works, since the data from the array is complete when displayed with the print_r function.
James_43 15 Junior Poster
Hi there,
I am trying to populate a page with multiple rows from a mySQL database.
To grab the data, I am using:
for ($i=1; $i < 5; $i++) {
$query = 'SELECT * FROM table WHERE column = ?';
$statement = $mySQL_con->prepare($query);
try {
$statement->execute(array($i));
}
catch (PDOException $error) {
echo 'Sorry, we failed to load this page: ' . $error->getMessage();
}
$row = $statement->fetch();
$results[] = $row;
}
That creates a mutil-dimensional array. However, when I try to access that data things go a bit weird.
For example,print_r($results[2][name]);
should output the name from the third row I grabbed using the mySQL query (third because PRIMARY KEY > 0). Instead, I get the error message: "Use of undefined constant blog_id - assumed 'blog_id'"
The strange thing is that directly underneath that error message, I get the name value from the array I wanted.
James_43 15 Junior Poster
You may have a point. I am coding on a i5 Quad Core PC, but running the programme off a laptop (there are two I have tried it on). Both are dual core.
However, I have used Windows Task Manager to track the performance, and the application (when looping) only uses about 30% of the processor power. The largest draw was actually Hard Disk access, but I think that was because the images I provided where too large, so I scaled them down and it seems fine.
So I don't think it is the CPU. Also, when the error occurs, it definitely looks like something is wrong in the code. By that I mean that the program actually behaves exactly as it should, it's just for some reason Background.Source and PreviewImage.Source take on images that they shouldn't do.
Since I'm a beginner to programming in general, I'm not familiar with utilising multiple CPU threads. I am aware that using Task.Delay with an async method allows the programming to continue running by generating an additional thread to run Task.Delay. Can you elabroate or provide resources on what you mean by using multiple threads?
Same goes for Thread.Sleep. Are you suggesting that I use this to create a pause between each foreach statement (which loops under the while() statement) to see if that makes a difference?
Thanks for your input!
James_43 15 Junior Poster
Okay, I've added the brackets in. The problem is that I can never seem to replicate the issue.
Like I said, when I start it up everything works fine. I've experimented with decreasing the Task.Delay to simulate a lot of transitions in a short amount of time, but even when I do that everything still works.
Having said that, the error is still there. If I connect the laptop the programme is running on to a TV via HDMI (which is what I've designed this to do), then the error always happens.
I would attach the source code, but Daniweb is saying I can't attach RARs, so not sure how to share it with you.
It may be relevant to add that on a different window, I use a different list of images that you can navigate through by clicking manually. When the user launches this screen from the slideshow, it sets App.timer = false;
to stop the image transitions in the background at the next foreach
statement. When the user exits the manual slideshow screen, App.timer = true;
void MainWindow_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
int count = Slides.Count;
if(e.Key == System.Windows.Input.Key.PageDown)
{
if (program.count < (Slides.Count - 1))
{
program.count = program.count + 1;
PreviewImages.Source = new BitmapImage(new Uri(Convert.ToString(Slides[program.count]._image)));
}
else
{
program.count = 0;
App.timer = true;
this.Close();
}
}
And when the user exits:
else if (e.Key == System.Windows.Input.Key.OemPeriod)
{
App.timer = true;
this.Close();
}
](null)
James_43 15 Junior Poster
Hey there,
Over the past few weeks as an excerise I've been trying to create a C# image viewer. At the moment I have one window, with a list of images displayed in a ListBox.
When I the F5 button, a second window pops up at fullscreen, and I want it to cycle through all the images shown in the previous screen. At the moment, the picture folder is simply My Pictures.
In order to simulate a cross-fade effect, I have two image objects on my canvas, PreviewImages and Background. The idea is that Image 1 = Background.Source
whilst PreviewImages.Source = Image 2
. Because I have a DoubleAnimation fade in effect, it will appear like image 1 and 2 are crossfading. The script then leads onto the next image in the series after a Task.Delay.
HOWEVER, my issue is that for some reason I cannot explain, after a while operating the code (say 10 minutes) instead of showing a ncie cross fade, the code plays up and starts skipping images and the cross fade completely breaks, instead it appears like Background.Source becomes some random image, so the result is an instant snap to an unrelated image, followed by an instantaneous the fade in of the "correct" image.
The code I am using for this is:
public async void transition()
{
while (App.timer = true)
{
for (App.index = 0; App.index < AllImages.Count; App.index++)
{
DoubleAnimation fadeoutAnimation = new DoubleAnimation();
fadeoutAnimation.Duration = TimeSpan.FromSeconds(1.0);
fadeoutAnimation.From = 0;
fadeoutAnimation.To = 1;
PreviewImages.BeginAnimation(Image.OpacityProperty, …
James_43 15 Junior Poster
Thanks for that. I took what you said to Google and quickly found some further reading on this topic.
The key seems to be passing the data through an HTML query in order to dynamically generate the page content. I didn't think about this before since I only ever use POST not GET, but it makes a lot of sense here.
Seems quite straightforward now, the pretty urls can be an added extra. My understanding is that they simply redirect to the HTML GET query link.
James_43 15 Junior Poster
Hi there,
As an excerise I am trying to create a basic PHP blog.
Creating the user login system was pretty straightforward, and I've 2 mySQL tables, one with user information, and one with the blog information (and with a foreign key referencing the user id).
However, I'm stuck for what to do next. Searches online don't seem to walk me through what I am after. Would somebody be able to point me vaguely in the right direction, such as what I should be looking into?
Basically, one method to populate a page with content that looked promising was using forms. User clicks a button (desguised with CSS as a link), which passes along the blog id to. BUT, I don't see how that method would work if I wanted a permalink to a particular blog post, since accessing the form action php would return invalid since the form hasn't been submitted yet.
Most blog sites seem to have url's without filenames at the end. I.e., blog.com/page ... How do they do this? Does that 'link' somehow submit data to the action form php, which is then used to display the content?
As you can see I'm a bit confused and a beginner with PHP, but hoping someone can help. Daniweb hasn't let me down yet!
Thanks in advance.