|
Hi
could any one show me the best way to extract the info i need from the file below. Basicly the files are hand historys from a poker site and i would like to keep track of how often a player calls checks folds and so on. The file is in html (hoping it posts ok) , or if any one could tell me if it would be better to convert the file to xml (if possible) and extract the data that way?
well here is a short part of the file .....
Real Money Ring Game | Table Name | Hand ID | Game | Stakes | Casanova | 10474702-12327 | Holdem Limit | $0.25/$0.50 | [Jul 31 16:03:20] : Hand Start. | [Jul 31 16:03:20] : Seat 1 : davebass has $31.99 | [Jul 31 16:03:20] : Seat 2 : PoKaBoT has $15.21 | [Jul 31 16:03:20] : Seat 4 : WC2006 has $9.82 | [Jul 31 16:03:20] : Seat 6 : xbambamx has $8.02 | [Jul 31 16:03:20] : Seat 8 : drurylane has $23.05 | [Jul 31 16:03:20] : Seat 9 : modeselect has $3.34 | [Jul 31 16:03:20] : xbambamx is the dealer. | [Jul 31 16:03:21] : drurylane posted small blind. | [Jul 31 16:03:21] : modeselect posted big blind. | [Jul 31 16:03:21] : Game [12327] started with 6 players. | [Jul 31 16:03:21] : Dealing Hole Cards. | [Jul 31 16:03:21] : Seat 2 : PoKaBoT has 5s Ts | [Jul 31 16:03:25] : davebass folded. | [Jul 31 16:03:26] : PoKaBoT folded. | [Jul 31 16:03:29] : WC2006 called $0.25 | [Jul 31 16:03:32] : xbambamx folded. | [Jul 31 16:03:34] : drurylane called $0.13 | [Jul 31 16:03:35] : modeselect checked. | [Jul 31 16:03:36] : Dealing flop. | [Jul 31 16:03:36] : Board cards [As Kc 4d] | [Jul 31 16:03:38] : drurylane checked. | [Jul 31 16:03:38] : modeselect checked. | [Jul 31 16:03:42] : WC2006 checked. | [Jul 31 16:03:42] : Dealing turn. | [Jul 31 16:03:42] : Board cards [As Kc 4d 8s] | [Jul 31 16:03:45] : drurylane bet $0.50 | [Jul 31 16:03:45] : modeselect folded. | [Jul 31 16:03:52] : WC2006 called $0.50 and raised $0.50 | [Jul 31 16:03:53] : drurylane called $0.50 | [Jul 31 16:03:53] : Dealing river. | [Jul 31 16:03:53] : Board cards [As Kc 4d 8s Js] | [Jul 31 16:03:56] : drurylane checked. | [Jul 31 16:03:57] : WC2006 bet $0.50 | [Jul 31 16:03:58] : drurylane called $0.50 | [Jul 31 16:03:58] : Showdown! | [Jul 31 16:04:00] : Seat 4 : WC2006 has 8d Ac | [Jul 31 16:04:00] : WC2006 has Two Pair: Aces and 8s | [Jul 31 16:04:01] : WC2006 wins $3.57 with Two Pair: Aces and 8s | [Jul 31 16:04:10] : Hand is over. |
Table of contents |
if i havent been very clear or this file has posted terribly and you would like to help i could always email a file to you to take a look @ ... many thanx
The top part of the file which looks extreemly messy in the post is not all that important its just the hand numbers , the main part is where you can see "Hand Start" .
|
|
|
|
|
Have you tried opening this up with an XML parser? It looks well-formed enough that you could do that. In this case, you could use an XmlDocument object and start grabbing data out of it.
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi,
Use Regex to search for specific patterns.
<br />
"(\\w+)\\s*=\\s*"<br />
"\"\\s*(.*?)\\s*\""
These will match all the attributes in the html like name = "value"
Try forming the proper regex for your situation.
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hi
When I'm trying to Add something to my ListvView (multiple columns), I receive this strange error in debug mode:
A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
The code (*):
lstProps.Items.Add(new ListViewItem(new string[] {"one", "two" }));
Which resides in private void receivedIt(RemovableStorage r, EventArgs e) .
The strange thing is that the same code (*) does work in the Form_Load method, or some Botton_Click method! Am I doing something totally wrong?
I am searching for 2 days now and all the online samples are doing the same - and I'm getting a bit of dissapointed in the ListView control Hopefully someone can help me?
Thanks a lot!
|
|
|
|
|
You are probably trying to access the ListView control from a non-UI thread. You can use the InvokeRequired property to determine whether you are on the UI thread, and the Invoke method to transfer execution to the UI thread.
For example:
private delegate void ReceivedItDelegate(RemovableStorage e, EventArgs e);
private void receivedIt(RemovableStorage r, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(
new ReceivedItDelegate(receivedIt),
new object[2] { r, e });
}
else
{
lstProps.Items.Add(...);
...
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi Richard
Indeed! It works! Jiha!
Thanks a lot!
Something I never should found on my own!
Greetings
|
|
|
|
|
Hi there:
As you know we can compile a C Sharp program at DOS prompt like
csc MyProgram.cs
Where MyProgram.cs is the source code file.
Now i want to perform the same compilation through another C Sharp Program. Like i made a program named ShellExecution, which tries to compile another C Sharp Source Code File called "First.cs" lying in my c directory. The program runs fine without any exceptions; it opens the dos window and runs csc, but nothing happens and seems like the file name "First.cs" is not being passed to the csc.exe as a parameter. I have used the following code for executing the compilation process:
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CSC.exe";
process.StartInfo.Arguments = "C:\\First.cs";
process.StartInfo.UseShellExecute = true;
process.StartInfo.RedirectStandardOutput = false;
process.StartInfo.CreateNoWindow = false;
process.Start();
process.WaitForExit();
Please help me out!!!!
|
|
|
|
|
Check out the CSharpCodeProvider. It can compile from a CodeDom model, from files, or from strings.
Link[^]
Logifusion[^]
If not entertaining, write your Congressman.
|
|
|
|
|
i'm working with MenuItem that i attached to a notifyIconTray... i want 2 add to on of the Menuitem meber new members "on the fly" from combobox, so when i add 2 combobox, i want it 2 be added to the member in the menuitem.the problem is .. that it works only once,,, after i maximize and minimize it back, it wont show me the other members of the Member of the menuitem....
any ideas y it happens ?
it looks like that:
private void Form1_Resize(object sender, System.EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
{
menuItemEntireCat.MenuItems.Clear();
MenuItem[] CatMenuItems= new MenuItem[catcombobox2.Items.Count];
for(int i=0;i
|
|
|
|
|
It seems like you have some error here :
vedmack wrote: MenuItem[] CatMenuItems= new MenuItem[catcombobox2.Items.Count];
for(int i=0;i{
CatMenuItems[i]=new MenuItem();
And why would you do somethinglike this in the resize event ?
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
ok solved it....
altho its nothing 2 do with the resize event...
its just i need 2 re-add it to the root menuitem...
|
|
|
|
|
Hi, I need to work with windows system process(e.g closing IE explorer). so how shall I go about doing it.
|
|
|
|
|
|
You can also use WMI (Windows Management Interface) and query for processes.
|
|
|
|
|
hi,
I have a class association generated from an xsd file. There is a one to many relationship that exists between the classes Order and Product.
I can set the properties for order like this: Order.Number = 1;
I can create a new instance of Products like this:
Products x = new Products();
x.name="blabla";
x.type="blabla";
now the problem is that I cannot add a Product to my order class.
I'm not sure how. plus I should be able to add multiple products to this class. The syntax is like this in my Order class:
*******************************************
private Product[] product Field;
/// <remarks>
[System.Xml.Serialization.XmlElementAttribute("Product")]
public Product[] Product {
get {
return this.productField;
}
set {
this.productField = value;
}
}
***********************************
Does anyone know the syntax to do this? or is it even possible?
I'm losing it. I've been trying to get this forever....
Please write back if you know the answer? Thanks if you do.
ChaciMulch
|
|
|
|
|
hi,
You can add a method to your Order class called AddProduct as follows:
<br />
class Order<br />
{<br />
.<br />
.<br />
.<br />
public void AddProduct(Product product)<br />
{<br />
ArrayList products=new ArrayList(this.productField);<br />
products.Add(product);<br />
this.productField=(Product[])products.ToArray(typeof(Product));<br />
}<br />
}<br />
Since you are storing products in an array you can not add an item to it, therefor you should use an ArrayList to add an item to the array and to cast it to the array again
Regards
|
|
|
|
|
Thanks so much.. Its almost working now but I needed one change.
In the first line I just had to take out the 'this.productField'
in order to get it to work. (not sure why)
it will add one object, but if i try to add another one, it just overwrites
the first one. i need to add multiple products per order. am i doing something wrong?
Thanks Again.
Mulch
-- modified at 15:54 Thursday 24th August, 2006
|
|
|
|
|
Hi
If you take out the first line you will lose other products that have been added to your array.You should add those items too.
Instead of
<br />
ArrayList products=new ArrayList(this.productField);<br />
write:
<br />
ArrayList products=new ArrayList();<br />
products.AddRange(this.productField);<br />
Although both methods should result the same thing ( added products so far,should be added to the ArrayList).
There's another way that I don't like and that's
<br />
ArrayList products=new ArrayList();<br />
foreach(Product item in this.productField)<br />
products.Add(item);<br />
please let me know if it's not working again
Regards
|
|
|
|
|
I still can't get it to work. I may be adding these lines in the wrong order.
this is how I tried implementing it:
ArrayList products = new ArrayList();
products.AddRange(this.productField);
products.Add(code);
this.productField = (Product[])products.ToArray(typeof(Product));
At least now I'm getting some sort of error in my browser. It is below. It seems like 'this.productField' is set to null at this point or something like that. I'm just confused. I'm not really following exactly what is happening here. I didn't think it would be this hard when I started. I created this class from an xsd and I thought that i would be able to add multiple sub class items automatically.
Any other ideas to what I'm doing wrong?
someone else said to try using a collection but I've never done that either and I just need to get this working as fast as possible. Thanks.
System.ArgumentNullException: Collection cannot be null.
Parameter name: c
at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c)
at System.Collections.ArrayList.AddRange(ICollection c)
at RepairRequests.AddOpCode(OperationCode code) in c:\Inetpub\wwwroot\ASIAPI\App_Code\RepairOrder.cs:line 515
at Service.GetRepReq() in c:\Inetpub\wwwroot\ASIAPI\App_Code\Service.cs:line 134
at Service.GetRO() in c:\Inetpub\wwwroot\ASIAPI\App_Code\Service.cs:line 62
at Service.GetROData(String RO_ID) in c:\Inetpub\wwwroot\ASIAPI\App_Code\Service.cs:line 30
|
|
|
|
|
I see
That's because productsField is null for the first time that you want to add a product
then wrtie:
<br />
....<br />
if(productField!=null) products.AddRange(productField);<br />
....<br />
or you can make it empty (instead of null):
<br />
...<br />
private Product[] productField=new Product[]{};<br />
...<br />
and there would be no need to check if productField is null in AddProduct routine.
I Prefer the second approach.
Regards
|
|
|
|
|
Holy crap it's working. Thanks so much for your help and you SPEEDY responses.
I've never worked with classes in this fasion before and I'm still trying to understand what is going on here because I want to learn. Maybe you could explain this for me? Also since I don't really understand this, is there going to be multiple array lists created and cause memory issues. It seems to me like it will create a new list every time i really just want to add an object to the same list????
so this is decaling product as an empty array of type products?
private Product[] productField=new Product[]{};
new array list?
ArrayList repReqs = new ArrayList();
confusion here: to me this seems like it's creating a range of arrays?
shouldn't it be a collection of class objects?
repReqs.AddRange(this.repairRequestsField);
confusion here: now your adding an object to your array list, but how does it
know to use the new range?
repReqs.Add(rr);
confusion here: basically no clue.
this.repairRequestsField = (RepairRequests[])repReqs.ToArray(typeof(RepairRequests));
I really want to get a better grasp on some more complex c# aspects like this. Do you have any suggestions for good books?
thanks.
-- modified at 9:54 Friday 25th August, 2006
|
|
|
|
|
Hi
Yse you can declare an empty array using this syntax:
<br />
object[] arr=new object[]{};<br />
Well an arraylist is a collection object that you can add other obejcts to it(using its Add method) and it has a lot of use,you can enumurate it using its enumurator and C# foreach keyword like this:
<br />
foreach(object obj in myArrayList)<br />
{<br />
do somthing with obj;<br />
}<br />
When you use AddRange method all the members of the passing array will be added to your arraylist it's something like:
<br />
foreach(object item in myArray)<br />
{<br />
myArrayList.Add(item);<br />
}<br />
We did this here because we wanted to save the current state of our object and then add a new item to our arraylist.
Finally we convert our arraylist into a Product array again.
First we make an array from out arraylist using its ToArray() method telling it that the type of stored items is Product (typeof(Product)) then we cast our array (that so far is an object array) to a product array using (Product[]);
So we've done two tasks at one line.We could write it like this:
<br />
object[] array=myArrayList.ToArray(typeof(myClass));<br />
myClass[] convertedArray=(myClass[])array;<br />
There are a lot of good books about C# and .Net programming but what I found really useful are MSDN and this site(Code Project) you can learn a lot of things about C# and programming here.
Wrox Programming C# is a good book.
There's another book that I like "Teach yourself object oriented programming in 21 days" It's written in java though.
Anyway I'm glad that you could solve your problem and If there's anything else just I will be glad if I can help.
Regards
|
|
|
|
|
Hello
If you use .Net 2.0 then instead of using arrays, you should use List<product> Generic colection.
If you use .Net 1.1, then use System.ArrayList instead, as you want your array to be dynamic and grows as you add to it.
I prefered List<product> as it's type specific generic collection. Yet ArrayList will do fine.
Regards
|
|
|
|
|
Session("dt").rows(i)("trans_no").ToString by vb
after conver to c#
Session("dt").rows(i)("trans_no").ToString();
not working
how it don ?
m_attiea
|
|
|
|
|
if dt is a datatable then...
DataTable dt = (datatable) session["dt"];
dt.rows[i].["trans_no"].ToString();
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|