Jump to content
Xtreme .Net Talk

neodammer

Avatar/Signature
  • Posts

    198
  • Joined

  • Last visited

Everything posted by neodammer

  1. You could use RegEx but thats at least for me alittle on the hardside. About the only thing I can think of at the moment unless there is a way to search for a # and a letter in the same string and just use a bunch of if statements etc..
  2. vb.sux rofl :p I am tempted to try it as I want to learn Delphi and ASP.Net. Complete source code is nice I seem to learn more from source code study than tutorials anyway.
  3. I started programming when I was about 7 when my older cousin introduced me to the wonderful world of BASIC.
  4. You can create programs that integrate IE into them and have the tab ability. I'll try to see if i cant find one i created awhile back. Its not the best in the world but gives you a easy tab abililty.
  5. ahh.. C# is good ill try to port it over to vb.net thanks man you rock. :cool: Just curious wouldnt that take every link on the page? I guess that works I will figure out how to include just links with .jpg endings shouldnt be too hard.
  6. Is that a crime? mwuahahah :p Not only that :rolleyes: but other stuff to..educational you know..that sort of thing..you know..stuff like that..pr0n? nah not I.
  7. Well still kinda learning this Regex. Trying searing msdn for the a syntax code or some beginner examples on Regex for VB.net but havent found any. Could you just give me a small example of how id use that with a string? just curious not asking you to write the whole code (id never do that) just a small example that i could work with.
  8. Anybody know of a good regex function for extracting links from html code? Im finding it hard with the various ways to display links.
  9. ok..guess i need to research RegEx and what they are and how to use one lol any examples on a syntax code?
  10. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '-------------------------------------------------------------------------------- ' this will create a large string and save it to var s htmlstr = "http://mysite.com/pictures/index.html" sr = New IO.StreamReader(wc.OpenRead(htmlstr)) s = sr.ReadToEnd sr.DiscardBufferedData() sr.Close() wc.Dispose() TextBox1.Text = s 's now contains all the html and displays it in a textbox '--------------------------------------------------------------------------------- 'this next step will extract all the links to any .jpg' Dim linkstr As String Dim quotee As String = Chr(34) Dim searchingstr As String = "<a href=" Dim slashstr As String = ".jpg" + quotee + ">" Dim firstinstance As Integer = s.IndexOf(searchingstr, 0) 'get the index of where the link should begin Dim endinstance As Integer = s.IndexOf(slashstr, 0) 'get the index of where the link should end Dim differ As Integer = endinstance - firstinstance 'calculate the difference in index's to determine how many spaces between the start of link and end of link linkstr = s.Substring(firstinstance, differ) MsgBox(linkstr) End Sub Hrm..having some troubles but you can see what im trying to do so far.
  11. Lets say I have a web pages html code right? with 100's of jpg links saved to a variable. I was wondering how would one program (vb.net) to extract the links. If you think about (most) links to jpg's are ...../picture.jpg right? so then i guess if one could maybe loop a search function into pulling out everything from the "/" to the "g" it wouldnt be so hard then you could just add on that /picture.jpg to the entire path and just use a simple download control. Any suggestions as to how to write this? ive tried searching on this forum and MSDN on how to do this but cant find exactly what im looking for.
  12. You can monitor any port easily with any .net language but the problem in this case is I am recieving errors with port 80 because its already being used by another program (apache) in this case. Which is why i have already started a program monitoring the .log files of apache (see general section) for monitoring the inc connections on that port. I have ideas but none solid about doing this; i have thought about making a virtual gateway program for port 80 that the webserver had to go through but thats insanely difficult, I have though about a php page that would just log everybody's ip etc for me but thats not true monitoring but close and is the method ill use should these others fail.
  13. I was wondering if its possible to monitor port 80 connections via vb.net? I know its possible to monitor them normally but I have apache running on the computer im wanting to run the program on and therefore port 80 will be in use. Any suggestions on how or how its impossible to do this? I was making a access program (you can view the progress on the general section) just by accessing the log file but i wonder if i can just do it this way and monitor port 80 or whatever port i put apache on thanks.
  14. You can use a webclient with streamreader to save the html code which of course has the text with it somewhere. Here is a sample code of how to import a webpages html code to a textbox. All you have to do from here is do a search through that string and pull out whatever you need. Im sure there is probably a better way to do this but this just came to my head :p Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dim htmlstr as string dim sr as io.streamreader dim wc as new net.webclient dim s as string '-------------------------------------------------------------------------------- ' this will create a large string and save it to var s htmlstr = "http://mysite.com" sr = New IO.StreamReader(wc.OpenRead(htmlstr)) s = sr.ReadToEnd sr.DiscardBufferedData() sr.Close() wc.Dispose() TextBox1.Text = s 's now contains all the html and displays it in a textbox
  15. Most programs that I obtain now days includes the bootstrapper so me thinks this is a good idea. I dont know why anybody would try to fake the directory though, im not sure if you uninstall the .net does it leave the directory ? some programs do in that case you would want to use bootstrapper.
  16. Here is the project in zip file. You can see what im trying to do better this way and hopefully help me come up with a solution lol i can get it to work just it keeps reloading a huge text file sometimes and all i need it to is update the new data. eeek sorry bout the binaries forgot to remove them thanks ;) APACHEREADER.zip
  17. You do not need IIS on all the client computers because IIS is server software not client software. I would figure out how to do via asp and SQL. I have done this before for a client but with php/mysql. If your just wanting to access a directory from anywhere there are my programs that can let you do that and xp has remote access (not recommended personally) that can do something similar. You can actually make an ftp server for a directory if thats indeed your goal and make your program just access the directory via ftp. There are many ways :cool: Actually after re-reading your post your wanting database access not directory lol so i would go with a asp program or php thats what id do though you can still do it through other means.
  18. Could you give a sample code on how I would append a .txt file with readtoend followed by appending? I know how to use readtoend just to import a file etc. not sure exactly how to tell it to append the difference between the files. It is Apache's access file im trying to create a simple monitor for :D Hmmm what about if I find the # of lines in the file and then compare it and then if different just goto the last line of the old file and write whatever is new to a stored variable and display that? seems then it wouldnt have to to load the entire .txt file everytime.
  19. Ive figured out a way to read a text file while in use and read each line when two files are not the same (the one being used by another process and duplicate one i made for vb access.) The problem lies in this text file being somewhat large >1MB and you know when my timer keeps checking for changes and loading the text file all over again it MAJORLY hogs up cycles. My question is: Is there a way to keep it so the text file in question is loaded into the ram or something? Maybe buffering if i understand what that means correctly. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'check to see if file exists if so delete and recopy Dim checkfile As String checkfile = Dir$("C:\access2.log") If checkfile = "C:\access2.log" Then Kill("C:\access2.log") End If System.IO.File.Copy("C:\access.log", "C:\access2.log") 'copy file because its in use 'end check Timer1.Enabled = False End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim fileDetails_new As System.IO.FileInfo = New System.IO.FileInfo("C:\access2.log") Dim fileDetails_reg As System.IO.FileInfo = New System.IO.FileInfo("C:\access.log") If fileDetails_new.Length.ToString() <> fileDetails_reg.Length.ToString() Then Dim sr As StreamReader = New StreamReader("C:\access2.log") Dim line As String Do 'looping reading each line at a time line = sr.ReadLine() If TextBox1.Text = "" Then 'make sure you dont have a blank line at start TextBox1.Text = Mid(line, 1, 13) Else TextBox1.Text = TextBox1.Text & vbCrLf & Mid(line, 1, 13) End If Loop Until line = Nothing 'loop until the end Me.Show() 'set the caret and redraw to scroll to bottom TextBox1.SelectionStart = TextBox1.Text.Length TextBox1.ScrollToCaret() sr.Close() 'close the streamreader End If Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Kill("C:\access2.log") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = True End Sub As you can see the access file is constantly being changed so the program is completely copying and reloading the text file into the textbox which again is chewing cycles. anyway to stop it from such a huge lag and just write
  20. Dim sr As StreamReader = New StreamReader("C:\me.txt") Dim line As String Do Until line = Nothing line = sr.ReadLine() TextBox1.Text = TextBox1.Text & vbCrLf & line Loop textbox shows nothing. It is set to multiline etc..any suggestions? ***update*** nevermind figured it out 2min's after posting :rolleyes: Dim sr As StreamReader = New StreamReader("C:\me.txt") Dim line As String Do line = sr.ReadLine() TextBox1.Text = TextBox1.Text & vbCrLf & line Loop Until line = Nothing sr.Close() Now my problem comes with getting a file that open to be read only cause i only want to read it and in this particular program the file will be in use by another program and it gives me an error stating its in use. I just need to read it and update the textbox in the program. Nevermind I got it..geeze lol i need to think deeply before posting @_@
  21. I havent done vb.net in awhile been doing php but anyways now im back for more ! :p anyway im trying to take the first lets say 15 letters per line of a .txt file and display each in a text box. Its a part of a larger program im developing. Thanks any suggestions as to what syntax i should be reviewing/learning? lol
  22. nevermind figured it out using msdn library ..thats a good resource..i might start using it rofl
  23. framework should come with any version of studio. otherwise its a free download at MS.
  24. Synopsis: I have successfully gotten a .txt file from my site and displayed in a text box. Now i need to print that .txt file in my default printer. Code: Dim printFont As System.Drawing.Font Dim sr As System.IO.StreamReader Dim wc As New System.Net.WebClient Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage readmeh = New System.IO.StreamReader(wc.OpenRead ("http://mysite/text.txt")) printFont = New System.Drawing.Font("Arial", 10) e.Graphics.DrawString(SR, printFont, Brushes.Maroon, 1, 1) End Sub Question: Everything is ok except it seems only strings can be printed this way with e.graphics etc.. anyway of storing that streamreader to a string? :cool:
  25. I can see where not assigning all the arrays at once would be handy. Think of games for example that use up incredible amounts of memory. Think of games/applications that use 1000's of variables. perhaps its smart in a way and dumb in another if that is indeed the case. Im not really sure if that would slow a program down..or just cause it to use less resources. Kind of a catch-22 in a way. Point is if you use 10000 and it only allocates what you are using out of that 10k then its good for memory but i would think that wouldnt speed up the program any infact may be a hinderance to some developers.
×
×
  • Create New...