is is a random number generator between 1 - 10 ?
dualzNZ 18 Newbie Poster
dualzNZ 18 Newbie Poster
is is a random number generator between 1 - 10 ?
never mind i solved it :d
i replaced
writer.WriteElementString("Admin", match.Value.ToString());
with
writer.WriteElementString("Admin", match.Groups.[1].Value);
thanks
to add on the whole methos looks like this
private void ConvertText(string dataIn)
{
string rawdata = dataIn;
const string pattern = @"Admin:\s*(?<Admin>.*)\r\nPlayer\sName:\s*(?<PlayerName>.*)\r\nPlayer\sIp:\s*(?<PlayerIP>.*)\r\nPlayer\sGuid:\s*(?<PlayerGuid>.*)\r\nAction:\s*(?<Action>.*)\r\nServer:\s*(?<Server>.*)\r\nDate\s-\sTime:\s(?<DateTime>.*)\r\n";
StringBuilder sb = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = Convert.ToString((char) Keys.Tab);
settings.OmitXmlDeclaration = true;
writer = XmlWriter.Create(sb, settings);
writer.WriteStartElement("Players");
Int16 countme;
foreach (Match match in Regex.Matches(rawdata, pattern))
{
writer.WriteElementString("Admin", match.Value.ToString());
//writer.WriteElementString("PlayerName", match.Item("PlayerName"));
//writer.WriteElementString("PlayerIP", match.Groups.Item("PlayerIP").Value);
//writer.WriteElementString("PlayerGuid", match.Groups.Item("PlayerGuid").Value);
//writer.WriteElementString("Action", match.Groups.Item("Action").Value);
//writer.WriteElementString("Server", match.Groups.Item("Server").Value);
//writer.WriteElementString("DateTime", match.Groups.Item("DateTime").Value);
}
writer.WriteEndElement();
writer.Flush();
writer.Close();
richTextBox1.Text = sb.ToString();
}
which then will be outputted like this
<Players>
<Admin>adminbob </Admin>
<PlayerName>ilikecabbage </PlayerName>
<PlayerIP>NA </PlayerIP>
<PlayerGuid>EA_70001212414521154521 </PlayerGuid>
<Action>kick </Action>
<Server>gameserver01 </Server>
<DateTime>01/02/2013 - 23:24:19 </DateTime>
</Players>
hi all
i am developing a small application that will allow the user to paste in admin logs which will then be converted into xml data.
The code works fine in VB.net but i am trying to convert it into C# as the application is written in c#
i am having issues with my writer.WriteElementString();
here is the clock of code of what i am trying to do.
StringBuilder sb = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = Convert.ToString((char) Keys.Tab);
settings.OmitXmlDeclaration = true;
writer = XmlWriter.Create(sb, settings);
writer.WriteStartElement("Players");
Int16 countme;
foreach (Match match in Regex.Matches(rawdata, pattern))
{
writer.WriteElementString("Admin", match.Groups.Item("Admin"));
writer.WriteElementString("PlayerName", match.Groups.Item("PlayerName").Value);
writer.WriteElementString("PlayerIP", match.Groups.Item("PlayerIP").Value);
writer.WriteElementString("PlayerGuid", match.Groups.Item("PlayerGuid").Value);
writer.WriteElementString("Action", match.Groups.Item("Action").Value);
writer.WriteElementString("Server", match.Groups.Item("Server").Value);
writer.WriteElementString("DateTime", match.Groups.Item("DateTime").Value);
}
The error seems to ly with match.Groups.Item("{VALUE}");
"cannot resolve symbol ITEM"
any help would be gratefull
cheers
thanks for that yes, i dont want to display extact html, just grab the data i need and display it within my own grid.
i see there is not much docuemtation on this package. if using this how would i just grab the region i would like?
cheers
thanks for the reply, i have gone iwth just splitting the data into 3 tables to lower the insert / update size and time.
and just creating small query to gather information i need to gather the cheater analysis formula.
thanks for your reply.
Good Afternoon everyone.
I am currently working on a little side project that aquires player statitical data from a website / XML Feed
getting the data is fine and using item.substring(item.indexOf("ABC"))
but what i would like to do is call a series of information and show them with in a datagrid view or a listbox of current players online in that server
the layout of the data i would be getting from the website source is the following:
<table class="table_lst table_lst_stp">
<tr>
<td class="col_h c01">
Rank
</td>
<td class="col_h c02">
Name
</td>
<td class="col_h c03">
Score
</td>
<td class="col_h c04">
Time Played
</td>
</tr>
<tr>
<td class="c01">
1.
</td>
<td class="c02">
<a href="/player/Peachy/70.42.74.86:28930/">
Peachy
</a>
</td>
<td class="c03">
40
</td>
<td class="c04">
14:58
</td>
</tr>
<tr>
<td class="c01">
2.
</td>
<td class="c02">
<a href="/player/Chubby/70.42.74.86:28930/">
Chubby
</a>
</td>
<td class="c03">
0
</td>
<td class="c04">
11:26
</td>
</tr>
</table>
I am not sure how i can split this into their own data for Playername, score and time online.
would i use an array ?
some help on how i could go about this would be really helpful.
I am writing this application in C# windows Application Enviroment
Hi all
I am currently working on a Battlefield player / server statistics application that i have written in C#.
I am storing RAW player / server data in a table at the moment.
My question is what is a recommended maximum columns per table as this statistical data which will be used in a formula to check players against the database for probible cheater analisys.
at this stage my table is looking at around 400 columns.
Would it be wise for me to use joins and just add them to specific tables and just call on them when setting up my forumla array?
thanks
create a class called class1.cs
inside your public partial on both form1 and form 2 add the following
class1 myclass = new class1();
then you can pass information to your class by doing
class1.size = textbox1.text;
inside you class add the following
public static string size { get; set; }
then all you need to call on the passed variable on form2 is
label1.text = class1.size;
hope this helps
i think i may have solved it
using the following method
progressLevel.Minimum = 620000;
progressLevel.Maximum = 720000;
progressLevel.Value = 623412;
any opinions to make this function better or alternatives would be a great help
Hi all i am obtaining game stats data through c# using HttpWebRequest and am returning chunks of data which is passing through class variabled held in dll files.
my question is which i am unsure of is i would like to add a progress bas to show the players current rank between sets of numbers:
example:
START LEVEL: 620000
CURRENT LEVEL: 623412
TO NEXT LEVEL: 720000
i would like to somehow using a progress bare workout the above numbers and be displayed.
some help would be greatful.
kind regards
until we know what the database structure is like, we really cannot help as "Reverend Jim" has been trying to say, if you have more that 1 client accessing a certain region of the database (Example: teacher - edit student 1 & student views student 1) at the same time the data will not be the same or equal as changes are being made to thus row in a table.
i personally use MS Sql Server 2012 with MS Sql Server Manager 2012, really helpful on joins and relationshipping tables.
as for speed i have a database with around 30 tables 24 ralationships and a ton of information stored and it returns almost instantly, no noticable delay
if your using Microsoft SQL server, to connect to it remotly you will need add the hostip pr pcname:port, collection = database.
if you would like to access the server directly you will have to install sql server manager and create alt login account and bind to the database collection you are using.
you could set a unique enum field or int field as a default of 0, if the room is in use set as 1 that way if any new data is entered and if room_inuse is equal to 1 then messagebox.show("Im Sorry" + "\r\n" + "Room: " + roomID + " is in use","Warning!");
are you showing room information inside a datagrid view?
you could display active room cycle inside a datagrid view using a foreach loop
this question is still unanswered, i have looked on the net for more information but didnt help much.
cheers
Hi all i have a tiny question
I have 5 IBM Blade servers running at my home using 1 external Static IP Address, is there any way i can forward certain ports to the different servers and people outside the network can access that Server instead of using DMZ on a router.
so say GAME Server = blade 1
Web server = blade 2
and so forth.
is this possible to do or should i invest in expanding my external services to use 5 internet connections
cheers
thats pretty easy stuff, its just the basics of C# there should be no problem with you doing this exercise.
most assignments are made based of your current learning status in the course that you are attending.
more information would be helpful.
assuming that you are returning the ID primary key from the table and displaying it either visable or hidden you can do a click event on the selected row in the datagridview (assuming you are using datagridview for population).
double click on the datagridview to diaplay
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
// reset variable that will hold the id number
int rowid = 0;
// obtain row id from cell 0 in datagridview selected item
rowid = Convert.ToInt16(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
// pass the id into the DELETE FROM tablename WHERE id='" + rowid + "'
}
im sorry but this is all i can give as you have supplied no information on what is required.
so when the button is clicked it sends the results to MSSQL table in your database, assuming its ADO.
pass the combobox data to a method
public method methodname()
{
// run your population for your combobox here
}
on your button_click event add after your SQL INSERT STATEMENT, methodname();
this will first insert the data into the table then popluate the combox with your SELECT query dataset
i had this problem also so i reconfigured xampp to run on port 8080 so there is no mix up with skype and varous applications that use 80.
localhost:8080/
hi all im having a issue with non selected checkboxes
when i select checkboxes and hit submit they go into the database ok but the checkboxes that have not been selected are adding 0 to the database
code below:
<form action="addeventusers.php?evid=<?php echo $evid; ?>&u=<?php echo $u; ?>" method="post">
user 1 <input type="checkbox" name="user[]" id="user[]" value="'.$userid.'" />
user 2 <input type="checkbox" name="user[]" id="user[]" value="'.$userid.'" />
<input type="submit" name="submit" id="submit" value="submit" />
</form>
php submission:
<?php
if(isset($_POST['submit'])){
$checkbox = $_POST['user'];
$submit = $_POST['submit'];
if($submit){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "INSERT INTO ev_invites (event_id, userid) VALUES ('$evid', '$del_id')";
$result = mysql_query($sql);
}
if ($result) {
echo "done";
}
mysql_close();
}
}
?>
basically what i am looking for is a way to stop the non selected checkbox from inserting into the database
i found in this sort of situation is to create a session timeout script in a include file that way if even a guest comes onto my site it will run the script to see if any logged in members / visiting guests unix timestamp has expired.
example
<?php
// check active members / guests
$guest = time() - 2 * 60; // 2 minutes
$member = time() - 5 * 60; // 5 minutes
$sql = mysql_query("DELETE FROM active_guests WHERE time_visited < ".$gues);
$sql1 = mysql_query("DELETE FROM active_members WHERE time_visited < ".$member);
// this will check the current UNIX timestamp and compare with the values in each table to see if the session has expired, if so this will delete the rows in the tables
?>
then you can run a function to see if the user is online or offline
example
<?php
// get user online status
function getonlinestatus($uid) {
$sql = "SELECT username FROM users WHERE id='".$uid."' LIMIT 1";
$res = mysql_query($sql) or die(mysql_error());
$rowSEC = mysql_fetch_assoc($res);
$user = $rowSEC['username'];
$sql1 = "SELECT username FROM active_members WHERE username='".$rowSEC['username']."' LIMIT 1";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_assoc($res1);
if ($row1['username'] == "") { return "IM OFFLINE"; } else { return "IM ONLINE RIGHT NOW"; }
}
?>
// then call this php function anywhere on your site IE profile
<?php echo getonlinestatus($row['id']); ?>
Hi all
i am creating a web application and i would like to generate a md5 checksum on an uploaded file while uploading
can i just add
md5($file);
or is there another way to add a checksum
thanks
you my frend are a bloody legend, it works prefectly now.
thanks for all ya help
ok so if any of the rows in the tabel expired the others still showed?
that got rid of the error, but no images who on the screen now, i still have 1 of the rows as a expired unix timestamp.
ok
i have added the unix to the count query where do i add the if ?
$ads_query = mysql_query("SELECT `advert_id`, `image` FROM `ads` WHERE UNIX_TIMESTAMP() < `expires` AND `shown` = 0 ORDER BY `advert_id` ASC LIMIT 1") or die(mysql_error());
list($advert_id,$image) = mysql_fetch_row($ads_query);
// do i add if here ??
echo '<a href="go.php?advert_id='.$advert_id.'" target="_blank"><img src="'.$image.'" /></a>';
mysql_query("UPDATE `ads` SET `shown` = 1,`impressions` = `impressions` + 1 WHERE `advert_id` = {$advert_id}") or die(mysql_error());
$shown = mysql_query("SELECT COUNT(`advert_id`) FROM `ads` WHERE UNIX_TIMESTAMP < `expires` AND `shown` = 0") or die(mysql_error());
list($count) = mysql_fetch_row($shown);
if ((int)$count === 0) {
mysql_query("UPDATE `ads` SET `shown` = 0") or die(mysql_error());
}
ok fixed that, just testing it now.
ok once one of the rows have expired the error of
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
comes up.
but when both rows have not expired they appear as normal per refresh
i also think that the count has something to do with it becase when each refrsh happens the shown goes from 0 to 1
1 = been shown on the page so it moves to the next 0 in the table
go.php
<?php
include "adverts/db.inc.php";
if (isset($_GET['advert_id'])) {
$advert_id = (int)$_GET['advert_id'];
mysql_query("UPDATE ads SET clicks=clicks+1 WHERE advert_id='$advert_id'");
$url_query = mysql_query("SELECT url FROM ads WHERE advert_id='$advert_id'");
$url = mysql_result($url_query, 0, 'url');
header('Location: '.$url);
die();
}
?>
then at the end of all rows being 1 on shown it resets them to 0 then stats the proceess again!
i copied your code and i get
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
but i cant see any error that would cause that effect
i also tried splitting each id into a key, but this did not fix the issue either
yes i did, its on the top query, for some reason it just stops when any of the adverts expires from UNIX_TIMESTAMP()
ahh yes i found that, na its still doing it
Hi all
I have recently watched a tutorial series from PHPACADEMY called the advert rotation script series.
I have found a small problem, the problem is that if any of the adverts have expired then the rest will not show.
does anyone have any solutions for this issue, that if 1 or more have expired the active adverts will still run.
Code:
ADS main code
<?php
include 'db.inc.php';
$ads = mysql_query("Select `advert_id`, `image` FROM `ads` WHERE UNIX_TIMESTAMP() < `expires` AND `shown`=0 ORDER BY `advert_id` ASC LIMIT 1");
while ($ads_row = mysql_fetch_assoc($ads)) {
$advert_id = $ads_row['advert_id'];
$image = $ads_row['image'];
echo '<a href="go.php?advert_id='.$advert_id.'" target="_blank"><img src="'.$image.'" /></a>';
mysql_query("UPDATE `adverts` SET `shown`=1, `imprssions`=`impressions`+1 WHERE `advert_id`=$advert_id");
$shown = mysql_query("SELECT COUNT(`advert_id`) FROM `ads` WHERE `shown`=0");
if (mysql_result($shown, 0) == 0) {
mysql_query("UPDATE `adverts` SET `shown`=0");
}
}
?>
the db.inc.php is just the database connection file.
DB Structure:
advert_id int(11) primary auto incrament
image varchar 255
url varchar 255
impressions int(11)
clicks int(11)
expires int(11)
shown int(1)
thanks
ahh thanks that worked the trick
Hi all
i am a bit stuck lol
I am trying to get the file extention from a url say
yoursite.com/file.zip
in the data base the full link will be there, i am looking for a function that will take the full url
take ".zip" and then will output "(file type = ZIP )"
some help would be great
cheers
Hi all
I have been developing a Dynamic signature generator on my server and i have selected options that can be dragged and dropped onto a uploaded image using jQuery,
I would like my dynamic generator to take a screenshot or somewhow save the designed layout of the sig to php, i have coded X x Y cords onto my app window but the w x h is always not correct.
any help would be greatful.
post your code here and we can have a look to see what is not working correctly
if you are using likes of XAMPP on your local machine sendig emails will not work unless you have a mail server or setup a php mail server query
Thanks for the reply.
I ended up writing my own class to handle the resizing and displaying multiple outputs.
Hi all
I have created a dynamic signatre system for my site and i would like to add the members avatar based off sig.php?username=USERNAME
but when i output the file the avatar is massive
how can i resize the image from say 100 x 80 to likes of 24 x 24 without havingto resize the images on upload?
help would be appreciated
login button / jQuery not loading on Google chrome 17.0.936.79 im having to use opera to login here & avatars dont show on chrome unless logged in
also navigation dropdown not working on chrome, was working the other day :d
Hi all
I am writing a points system for a event that is coming up and the client would like results for each member printed on 1 page for each account
the results will fit on 1 page for the user
how would i go about doing this.
i dont want to have to goto each account then print the report.
just click on a button and it will print all the accounts on seperate pages
thanks
i think the best and most simplest system would be barcode reader into a php textfield.
create a simple card printed on a4, laminate it bind it to each id then just scan the barcode and its done.
this is by far the easiest way to do this, and it does not require a pin or any painful way of updating records.
as i have developed a Invoicing website based application thats fully done in php, ajax using barcode scanners.
personally if it was me i would just have a ajax based search box, the person starts typing their name and it will return their information and auto submit on click event!
the simplest way is to pull the users current points from say TABLE users
so a row in USERS will be mypoints
return mypoints on the submission
and do the following
$oldpoints = $row;
$newpoints = 2;
$totalpoints = $oldpoints + $newpoints;
this will add 2 points on top of the users oldpoints / currentpoints
this can also be used when you want to subtract points for a action
also you can go
session_start();
$s_username = $_SESSION;
hello <?php echo $s_username; ?>
you can only install lampp on su (admin root)
the username is root at http://localhost
no password
proFTP username is: nobody password is lampp
at ftp://localhost:21
once in lampp control panel you can setup the sql security and apache security
ensure that you are running
/opt/lampp/lampp start
fixed thanks for your input i had to do the following
$outer = "../images/ranks/1.png";
$src = imagecreatefrompng($outer);
imagesavealpha($src, true);
imagealphablending($src, true);
then to display it
imagecopy($im, $src, 0, 0, 0, 0, 75, 71);
instead of
imagecopymerge($im, $src, 287, 20, 0, 0, 75, 71, 100);
thanks for your reply
but this did not work it still shows a black background on the png image
i have changed the $png into $im being the refrence of the signature.
supplied screenshot of problem
screenshot of issue