| Cheah Wei's profileCheah WeiBlogNetwork | Help |
Cheah WeiI'm as happy as i want to be |
||||
|
June 24 fish tank now is healthyThe fish needs water change every 2 to 3 weeks. Else, it will starts to become not as clear. 1 week after water change it will becomes very clear.
June 22 nibong tebal jamboree trip, lots of hills Yesterday was Nibong Tebal MTB jamboree. The trail is full of hills, lots of stones and very jumpy. I had my legs cramp towards the last 10km of the trail. I finished 225th in about 4 hour. June 17 c# open a text file, search for some text and write those in new text file the c# code below open a text file which is named xxx_Log.txt, search for some 20 sets of string data contains right after the line "Uncorrected ZeroSet, ErrorStd". it demonstrates simple technique of replacing text in string, text pattern matching, reading and writing text file using .net StreamReader and StreamWriter class. below is example of one of the line in the text file and i want to store the 9.881E-08 into a file name xxx.csv Uncorrected ZeroSet, ErrorStd 9.881E-08, 12.12869246463207E-08 ******************************code below is extracted from a simple windows form project with a text box , a button and a label*******************************************************************************StreamReader myStreamReader; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "txt files (*.txt)|*.txt" ; openFileDialog1.FilterIndex = 2 ; openFileDialog1.RestoreDirectory = true ; if(openFileDialog1.ShowDialog() == DialogResult.OK) { try { string line=""; using(myStreamReader = new StreamReader(openFileDialog1.FileName)) { string outputName=openFileDialog1.FileName; outputName=outputName.Replace("_Log.txt",".csv"); StreamWriter writer=File.CreateText(outputName); this.txtFileName.Text=openFileDialog1.FileName; for(int i=0;i<20;i++) { while(line!="Uncorrected ZeroSet, ErrorStd") { line=myStreamReader.ReadLine(); } line=myStreamReader.ReadLine(); string zeroSet=(line.Split(','))[0]; writer.WriteLine(zeroSet); } this.lblCreatedFileName.Text=outputName; writer.Close(); } } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); this.lblCreatedFileName.Text="File creation error"; } } June 12 Talking about Haadyai 116km
Quote Haadyai 116km Haadyai 116km 5 June. After 26 years visiting Haadyai, i returned, this time using my MTB. It is a 116km return trip. We were cruising at around 32km/h whole way. This time i put my phone in my bag, worry that i might spoilt as my last Samsung smartphone if i put it in my saddle bag. Althought the journey is just a straight road, there are some junctions that lead to places i not know of, which i'm eager to know. i wish my Samsung smartphone GPS was with me so that i can where those road are. I not sure when i will have a smartphone again. Although i love them, my experience of having so many of them spoilt within short time span left me no choice but to stick with simple phone. |
||||
|
|