Jump to content
Xtreme .Net Talk

CryoEnix

Avatar/Signature
  • Posts

    93
  • Joined

  • Last visited

Everything posted by CryoEnix

  1. Guys, thanks for all your responses. It's all hypothetical at the moment, and I was thinking about how Azureus (a bit torrent client) initially builds an output file in zeros before writing to it. I'll take your points into consideration and let you know how it goes - cheers to all of you!
  2. Hey all! I'm currently working on a file downloading program, and am brainstorming on the best way to write the files to disk. Here's a hypothetical: I have a file to download, let's say for argument's sake it's exactly one gig in size. before I begin the download, I set a filestream to 'pad out' the target file with a gig's worth of zeros, to create the initial file. Now, say I run through the download and after every filestream.write() that amounts to 2 meg or so, I flush the file to actually write this data to disk. Will this flush simply replace the zeros in question with the new binary data (the GOOD scenario), or will the entire one gig file be rewritten in it's entirety (the BAD scenario)? Any further insight into efficient, potentially large file writing would help - cheers in advance!
  3. Hey guys, quick question - this one's been bugging me for some time, and google hasn't been my friend on it. I've set up a httphandler in my web.config to transfer a url. For example, typing the following into the address bar: http://mysite.com/Articles/Default.aspx will transfer the user to: http://mysite.com/content.aspx?type=articles However, the user must explicitly type: http://mysite.com/Articles/Default.aspx Is it possible to account for this so that the user can miss off the filename, and it will default to default.aspx? Cheers in advance!
  4. I'l be honest with you plausibly, I've never heard of it. I'll some quick research now - thanks!
  5. I have an application that connects to a local SQL server (2005) for all of it's data access. Now, when the completed application is installed on a new computer the SQL database needs to be installed too - the DB layout at least - all data to be blank but I need all of the tables & stored procs etc to be installed. Now would a full version of SQL server need to be installed on each machine for this, or is there an easier way to redistribute a database shell like this? I remember installing something a year or so ago that auto-installed a 'mini sql server' with it. Any ideas? Thanks in advance
  6. It's alright Paul, I've figured it out. Turns out that the double ampersand is just for boolean comparisons - a single is for binary, which is why it didn't work. It seems that the Basic 'And' statement does either, depending on the situation. Thanks anyway!
  7. Cheers paul, I have that in VB, but the C# port doesn't seem to like this - is disagrees with the double ampersand. Any ideas? if ((thisApp.AppType && Apps.AppA) == Apps.AppA ){//'Do your stuff... ... }
  8. Sorry for not clarifying, but I'm working in C# for this one - although the algorithm itself shouldn't be too difficult to translate should it be in any other language (just no PERL please ^^)
  9. Hey guys, long time no speak - I've got a bit of an issue here, but I'm sure one of you will be able to help... Lets say that I've got several applications with a number of permissions allowed for each, stored within a single long data type: App A is worth 1 App B is worth 2 App C is worth 4 App D is worth 8 App E is worth 16 App F is worth 32 And so on, ad infinitum. Now the problem is, say if I need to know if the user has an access code of 45, how can I calculate whether he has access to application C or not - I know there's an algorithm for it, I just can't put my finger on it...
  10. Hi all, I've got a class which, when called, will search through all of the files in a string array to process them. The problem is that the method should also take a pointer to a progressBar (for obvious reasons), but the UI doesn't even see the System.Windows part - I've tried implementing a 'Imports...' statement at the top of the class, but that won't even work. Any ideas? Public Function addTexts(ByRef filePaths() As String, ByRef pcMain As System.Windows.Forms.ProgressBar) As Integer
  11. Once again, you guys have proved that your .NET (ninja) skills know no bounds. Cheers again, I appreciate the help!
  12. FZelle - cheers for the code. It didn't work, but after a bit off playing with it it was fine like this: dataG.Tables[0].Rows[0]["Name"] The Tables[0] part was omitted - do you know what the Tables index actually refers to? I'd imagine there should only be two dimensions for a table...
  13. Never mind peeps, after perusing the net some more I've found the solution. I need to create DataRows to handle the data, row at a time. Thanks anyway!
  14. Hi there guys, I've managed to populate a dataset with a table (from a SQL query), and I'm trying to access the data in it directly instead of binding it to a dataGrid. How would I go about this? Say I had the following Table: ID Name Password 1 Bob BobsPassword 2 Colin ColinsPassword I want something like: dataG.Column["name"].Row[0] to equal "bob" dataG.Column["id"].Row[1] to equal "2" I can't seem to navigate my way through the web of properties myself - please help!
  15. Thanks very much guys, that was exactly what I was after - gonna go run to my app now and finish it off. Thanks again! ^^
  16. Is it possible in VB.NET to loop through a specific object within a form? Below is the pseudocode to what I want to achieve: for con = each Label in formMain con.backcolor=rgb(252,252,254) next Is this possible, and if so does anybody know the correct syntax?
  17. This is the solution I found on the net - sorry, I was eating before so didn't have the time to show my findings. Hope this helps others who shared my problem/apiffany! 1; Declare the collection Although Blitz3d does this automatically, you need to declare a virtual 'bucket' for all of the classes to be thrown into: Public collect As New Collection() 2; Creating a class within the collection Running on the same principle as creating a new instance of your class normally, you need to inform the system that the class is being made specifically for the 'collect' bucket: collect.Add(New clsTimer(),ClassID) The ClassID is a string, used as a primary key to locate that particular instance specifically instead of looping though all of the collection. It is optional, so no need to worry about it -but I found it necessary to delete the Class afterwards. 3; Looping through the collection For Each d As clsTimer In collect msgbox (d.StringPropertyOfSomeSort) next Simple as. each iteration through the loop will give 'd' the properties of another Class within the collection (I know, I know - more of a memory address than copying of properties, but I'm going layman here) 4; Deleting an item in the collection collect.Remove(ClassID) That optional String used as a key? You can use it to easily destroy one of the classes. I think that shows everything I needed, and although it looks a bit more daunting than using a dynamic Class Array, it's far easier in my opinion. On that note, do any of you guys have alternatives to these when it comes to accessing large groups of data? I figured since this post has been answered, we might as well play with some thread deviation!
  18. Hey Cags - yeah mate, you understood me perfectly. I've just been surfing the net, and I've found a solution to my problem - Cags nailed it - I needed to create my own collection for the classes. Cheers!
  19. Hey guys, long time no see! I've recently been away from VB.NET, playing with Blitz3D. It's an SDK designed to make simple directX powered games using the BASIC syntax, and since coming back to VB I've been thinking about how I can implement what I've learned from it in my applications. You see, ordinarily in VB when I need lots of the same class, I'll create an array of them - resizing the array when necessary. But in Blitz I can create classes like so: m.clsTimer=New clsTimer the 'm' designation can then be used with the scope of declaration to refer to the said class, and if I need to access it from outside the declaration I can loop through all instances of clsTimer with: for m.clsTimer=each clsTImer next ...and delete an instance (from within said loop) with: delete m this technique allows me to create and destroy classes at will, without needing to keep track of them within a public-scope array. I know you're just begging me to ask my question, so here it is: How do I implement this class technique within VB8.NET? Is it even possible? Even a link to a page that explains it would be greatly appreciated. Thanks!
  20. Hey all, once again I'm experimenting with new toys - this time directDraw. I'm creaing a game which - naturally - begins with a nice intro before hitting the title screen. Problem is, it currently just jumps from the last frame of the intro to the title. I'm thinking of implementing a 'fade to black' effect to smooth the transition, but I don't know how to adjust the brightness on the primary buffer. Any ideas how I could go about this? I know how I would go about the timing, it's just the command to darken the buffer that's unknown to me. Thanks!
  21. It's okay guys, I've solved the problem. The key enum in directinput is Key, not Keys as I had mistakenly used. Thanks anyway!
  22. Hey all, I've been dabbling with directdraw for a few weeks, and thought it was time to deal with keystrokes for my upcoming game. I created this class to simplify directinput, but for some reason it won't work. Any ideas? Public Class DirectInput Dim KBState As Microsoft.DirectX.DirectInput.KeyboardState Dim KB As New Microsoft.DirectX.DirectInput.Device(SystemGuid.Keyboard) Dim JoyState As JoystickState 'finish me! Sub New(ByRef theParentForm As Form) KB.SetCooperativeLevel(theParentForm, Background Or NonExclusive) KB.Acquire() End Sub Public Function isPressed(ByRef theKey As Keys, Optional ByRef acquireFirst As Boolean = False) As Boolean If acquireFirst Then KB.Acquire() KBState = KB.GetCurrentKeyboardState End If isPressed = KBState.Item(theKey) End Function Public Sub acquire() KB.Acquire() KBState = KB.GetCurrentKeyboardState 'one for joypad, too! End Sub End Class Please ignore the redundant joystick code, I'll get to that in time ^^
  23. Thanks marble, I'll look into it. I never knew about the integer expansion - after all these years on dot net, I'm embarrased!
  24. Hey all, I'm just getting to grips with Visual C++ from VS6 at the moment as it's the fastest language I've seen so far, and I'm attempting to create a 'test dll' with it before I write my application. The test dll contains a simple 'sum' function that returns two numbers added together, and it will link perfectly in VB6 with this code: Private Declare Function sum Lib "example1.dll" (ByVal x As Long, ByVal y As Long) As Long Private Sub Command1_Click() lblanswer.Caption = Str(sum(CInt(Text1.Text), CInt(Text2.Text))) End Sub However, when using VB 2005.NET: Public Class Form1 Private Declare Function sum Lib "example1.dll" (ByVal x As Long, ByVal y As Long) As Long Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox(sum(CInt(1), CInt(2))) End Sub End Class I get a BadImageFormatException error on the MsgBox line - is this a compatability issue, and how can it be overcome?
  25. Cheers Damp, I'll give it a try right away!
×
×
  • Create New...