J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Hi Jo 2,

I've just spotted this, and thought I'd point out a much simpler way of doing this

'Load your image file, essentially locking access to it
Dim BMP As Bitmap = Bitmap.FromFile("C:\Users\Jay\Desktop\test.jpg")

'When assigning to your picture box, create a new bitmap
PictureBox1.Image = New Bitmap(BMP)

'Dispose of the original bitmap, freeing up access to the file
BMP.Dispose()

'Speed up garbage collection, releasing your file.
GC.Collect()

I hope this helps.

Marcelo L. commented: You are like a Ninja. I passed days serching for that simple line: gc.colllect(). Magic! +0
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I'm just a kind of in awe. Just popping onto a site like DaniWeb, you seem to forget that there might have actually been some hard work involved, tears, frustration and all host of mixed emotions. You forget that Dani isn't just a binary baby born from the loins of a floppy drive but actually started out with an idea, a pretty hairy design and then worked her ass off, no doubt with the support of friends and the community to mature a grow the site to what it is today.

It's been a massive eye opener for myself, just a quick snapshot of Dani's work the historic screen dumps of DaniWeb has completely al;tered my perspective on a couple of things. 1. What can really be achieved through hard work and actually giving a shit about what you are doing, and 2. The individuals behind sites like this aren't just fat cats with dollar signs in their eyes, their real people, with real dreams, and real goals.

I keep talking about Dani in the third person, I know you're reading this Dani, I'm afraid I just don't know how to wriute this without talking about you and to you at the same time.

Regardless, I just want to say I'm respectfully proud of you, and what you've done, and I'm infinatly grateful to you for providing us with this pretty kick ass service.

...And no I'm not forgetting all the Mods, Admins and the community it's self, every one …

Dani commented: Thanks so much! +0
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Awwww looookkkk how cute it was... OMG what an incredible journey

1.png

2.png

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

doh...

[Whispers] I hope he's making a demo which physically moves the mouse pointer then clicks the button, which doesn't render my answering only the first half of the question entirely pointless [/Whispers]

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Oh No, not another LockBits demo. Well hopefully this demo may also give you a little in site into actually playing with, and calculating some simple effects as well as understanding the advantages of LockBits as apposed to GetPixel and SetPixel.

A Useful Note.

It is important to note that using LockBits is only effective beyond a certain point. Bench tests show that if you manipulate below roughly 60 to 70 pixels in one go, you are in fact better off using GetPixel and SetPixel. Why? Well basically the time allowed for locking bits and unlocking bits, as well as copying all the byte information needs to be considered when making these calculations. Much below 60 or 70 pixels, this time taken exceeds the time taken to simply use Get or Set Pixel.

This can be explained in more detail Here

So What Do We Have Here Then?
  1. Wrapping up Lockbits and associated methods into a more manageble class.
  2. Applying Filter effects to your images.
  3. Playing with the Alpha Channel.
  4. Mimicing Opacity.
  5. Overlaying Images (Layering).

Below you can see the interface which will allow you to manipulate the images, quickly in real time:
Demo1.png

** The left hand image, and sliders will allow you to manipulate the saturation of each colour channel in the image, essentially removing a colour from an image.

** The center image shows the left image combined with the right hand image. This image doesnt relay on the alpha …

ddanbe commented: Nice tutorial +15
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

=======Download The Full Solution Below========

This will be my last VB.Net soure as I've made the move to C#. For a recent job application I was given the technical test to create a horse race simulator which would calculate the odds of a runner winning a race of up to 16 runners, then ensure the runners were within a 2% winning margin of there expected win percentage after 1,000,000 races. I got the results between 0.10% and 0.02% but never got offered the position as my solution was "Beyond Requirements".

HRS.png

This solution is host to ll sorts of goodies including multithreading, basic user controls etc... further more, if you bet on the horses this may be great for you.

Jay.

=======Download The Full Solution Below========

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Bugger. That's beyond my knowledge I'm afraid. Maybe you could post that response in web development and ask about security within iFrames. I think the VB side is ok.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, this is going to hit every <a> tag in the iframe with invoke onclick, but give it a shot

 Dim theElementCollection3 As Windows.Forms.HtmlElementCollection

 'This line now includes access to the iFrame document.
 theElementCollection3 = WebBrowser1.Document.Window.Frames(0).Document.GetElementsByTagName("a")

 For Each Element As HtmlElement In theElementCollection3
     Element.InvokeMember("onClick")
 Next

if there's more than one frame try changing the Frames(0) to another index. if the index is wrong you will get an error.

I got this to work on a quick demo I made here.

http://software.solvoterra.com/example2.html

example2.html has an iframe whose source is sameURL/example.html

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

If this is your own HTML source you can give the <a> tag an id. in this case "Test" then use the following code.

Dim theElementCollection3 As Windows.Forms.HtmlElement

theElementCollection3 = WebBrowser1.Document.GetElementById("Test")

theElementCollection3.InvokeMember("onClick")

The <a> tag looks like this

<a id="Test" href="javascript:void(0)" onClick="removeOverlayHTML()">
<img style="position:absolute;top:97px;left:290px;border:0;z-index:101;width:10px;height:10px" src="http://www.castup.tv/images/close_button.png" alt="x"/></a>
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I'm not 100% but wouldn't you need to invoke the "onClick" member?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Hi guys,

I've just read this months Digest and want to offer my repects to Ancient Dragon, Melvin Stober. A sad loss to the community, and indeed to those who knew him personally.

Much love to his family.
See you on the other side Bro.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I'm really confused by this, by Short do you mean sort, and if you mean sort, can't you just do this

Dim iVals As Integer() = {1, 9, 3, 10, 6, 2, 8, 5, 7, 4}
Array.Sort(iVals)

If you wanted to reverse the sort order

Public Class ReverseComparer : Implements IComparer
    Function Compare(x As Object, y As Object) As Integer _
            Implements IComparer.Compare
        Return New CaseInsensitiveComparer().Compare(y, x)
    End Function
End Class

'Button Click Event

Dim RC As New ReverseComparer

Dim iVals As Integer() = {1, 9, 3, 6, 2, 10, 15}
Array.Sort(iVals, RC)

Display the results

For Each Val As Integer In iVals
    Console.WriteLine(Val)
Next
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

If you're going to point out the difference between VB6 and VB.Net, it may be useful to provide some useful methods provided by .Net. This simple function using Date,Time and TimeSpan will return the hours worked and minutes in 1\10 intervals.

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Console.WriteLine(CalculateDailyHours("29/10/2014 17:00", "30/10/2014 03:12"))

    End Sub

    'Make the returned value a double so it can easily be used for future calculations
    Private Function CalculateDailyHours(StartValue As String, EndValue As String) As Double

        Dim StartTime As DateTime = BuildDateTime(StartValue)
        Dim EndTime As DateTime = BuildDateTime(EndValue)

        Dim Diff As TimeSpan = EndTime - StartTime

        'Get The Hour Difference and The Minute Difference in intervals of 10%
        Return Diff.Hours & "." & CInt((10 / 60) * Diff.Minutes)

    End Function

    Private Function BuildDateTime(DTValue As String) As DateTime

        Dim vDate As Date = DTValue

        Return New DateTime(vDate.Year, vDate.Month, vDate.Day, vDate.Hour, vDate.Minute, 0)

    End Function

The returned value is 10.2 as a double

ddanbe commented: Good! +15
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

After trying to manipulate PNG files and failing miserably discovering that the standard GDI doesn't provide support for any PNG parameters decided to provide some basic image manipulation functions built into .Net that I came across on my investigations.

1. Adjust Image Quality
2. Flip Image Horizontally
3. Flip Image Vertically
4. Rotate Image (90 Degree Step)

This Source Uses 4 buttons, A HScrollBar and A PictureBox.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I've just gone through all this myself. It was great. Here were my steps for my particular approach. (Links Below) Note: This was just my recent research into MySQL, there are other alternatives.

First there are a few DBMS or RDBMS <--- Learned that too. MySQL Workbench, MS SQL Server, Oracle etc

I chose to Use MySQL, so I downloaded SQL Server which runs nicely as a service in the background. I also have MySQL Server running on my server (For remote testing) and installed MySQL Workbench for additional testing and development.

I then downloaded and installed SQL Connector for VB.Net, which lets me easily connect to MySQL databases.

After that I bought a SQL book which gave me all the commands I need to play with.

I then checked out Microsoft's Virtual Accadamy on database fundamentals

I'm Having great fun.

So in this order i did the following
  1. Watched and learned the fundamentals of databases on MSVA Click Here These guys are using MS SQL Server (T-SQL etc) which has some slight SQL variations

  2. Bought this book for SQL commands (Superb by the way) Click Here

  3. I then got my hannds on MySQL Server This page gives you links to MySQL, MySQL Workbench, and the VB.Net Connectors Click Here

It took a couple of days to figure everything out, but now it's all fine and dandy.

Note: if you don't want to have to install the MySQL Server then you need to …

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I love this stuff, brings back the good old days. It's not even a "Complete Game" still I spent a good five minutes pinging balls all over the place.

oussama_1 commented: awesome..10x for your comment +4
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

is your picturebox inside a panel?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

NOTE: The games GUI is not fully implemented, so changing it's image and difficulty is done manually in the Button.Click Event

NOTE: Whether you download the VS2013 source file or copy and paste the code, you need to download, and extract the two image files to the project's "Bin\Debug" directory.

If you copy and paste the source ensure your form has the following controls:

Button (Button1)
PictureBox (Name:pbGameBoard, Width:792, Height:792)

THE GAME

This is a fun example using graphics. It is a representation of the classic tile slide game, where you slide the tiles around to make the picture. This version is a little different. There are Tiles and Sub Tiles. The Tile Grid is 9 x 9. Each Tile has a 9 x 9 Sub Tile Grid.

If you set the game to Easy then only the main Tiles are scrambled. If it is set to Medium then not only are the Tiles scrambled but so are their sub tiles.

Instead of sliding the tiles around, this game is actually switching tiles\subtiles with the adjacent tile\subtile. Subtiles cannot be switched with subtiles from a different tile.

HOW TO PLAY

To Start A New Game:
Click your button

To Move Tiles:
Select the center SubTile of The Tile you want to move. The SubTile will be selected in Green. Move the mouse to the center SubTile of an adjacent tile and the cursor will turn yellow. If you click now, the two Tiles will be switched.

Image …

Begginnerdev commented: Very nice post! +9
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

It's greate site Dani, I guess I just forgot how to play nice with others.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Oh pant's, you up vote and it becomes featured? daaaaaaaaaaaaaang it.

"note to self... Keep out of it man"

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

@Santanu Das.

I have been on DaniWeb just over two weeks now, and what a roller coaster it has been. Honestly I was seconds away from giving a good ole down vote to this thread.... "oooo scary", but every day things get more and more clear. Though I hope I'm miss-understanding what Mr.M is saying and will not get too involved in the initial post, there is an element that can be extracted... Santanu Das... you help everybody and any body, but if we're going to teach people, make sure we provide a solution, well commented and documented that can teach them. If they decide to copy, paste and run, that's up to them, but if you've provided a solid base to learn from, comments, structure etc, I don't think anybody will be upset if help is provided.

I've never studied a day of any I.T. subject in my life. When I first saw MSDN after half an hour I was crying in the corner, rocking backward and forward. I've come a long way and can now use MSDN quite happily, but it was a combination of factors that got me to where I am 1. people prepared to provide good learning material and 2. My decision, once I'd got the code to learn and understand it.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

just to make sure I'm not getting the wrong end of the stick here. I'd like you to play part in the following scenario.

Post From :TheNoobestNoobEver
Rep:0
Increase Rep:0
Decrease Rep:0

Question: I'm brand new to VB.Net, and for my school project I have been asked to run a counter from 1 to 10 and show the increments in a label.

Answer 1:

    For X As Integer = 1 to 10
        Label1.Text=X
        Me.Refresh()
        Threading.Thread.Sleep(100)
    Next

Answer 2:

Start by placing a button and a label onto your form. In the Button's click event paste the following code.

    'You would be best off using a For-Next Loop
    'The Loops can either iterate through a collection
    'of objects or increment values.

    'This loop is going to increment the value of X
    'from 1 to 10. Each time we hit Next the loop 
    'goes back to the beginning and increments X
    'by 1 until it reaches 10, at which point the loop
    'is exited

    For X As Integer = 1 to 10
        'Here you can see your labels text property is set to
        'the value of X
        Label1.Text=X
        'BEcause this loop will run super fast, let's slow
        'it down so we can see the reults
        Me.Refresh()'Refresh the form and it's objects
        Threading.Thread.Sleep(100)'Pause the UI thread 1\10 of a second
    Next

Answer 3:

Have you tried MSDN Click Here

Just go ahead and answer which response you would provide to this day …

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Have you seen this?

Click Here

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

That's great to hear. My biggest piece of advice for you is remeber you have an undo button, many many undos. Don't be afraid to change and play with code and monitor the results... if you brake it, use undo.

I do get something from helping. Not only do I learn next time to be much clearer and accurate in my responses, I get satisfaction in knowing I've helped someone. Simple as that.

Reverend Jim commented: Right on. +12
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Yes dim will work.

OK. you need to remove the connection between the timer and the actual clock. try this.

Every time The ClockTick is called the routine is adding one minute onto the clock time.

The timer is only the frequency of "How Often Is The ClockTick Routine Called"

changing the timer interval only increases or decreases time between calls to the ClockTick routine.

The ClockTick routine counts in minutes not seconds.

So:

If we set the Timers interval to 10, every 10 milliseconds, one minute will be added to the clock.

If we set the timer interval to 1000, every second, one minute will be added to the clock.

If you wanted the clock to represent a realtime scenario you would set the Timer interval to 60000 (60 seconds). This means every minute the ClockTick routine is called and the clock minute is incremented by 1.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

ClockTimer.Stop()

error is: Object reference not set to an instance of an object.

Apologies, delete this line of code.

'This Value Is In MilliSeconds So If You Wanted
'1 Tick Every Second You Would Set This To 1000
ClockTimer.Interval = 10

If I make it to count seconds, result would be same, but it will be needed longer time to finish or?

Again correct. This is the delay mechanism between counts for method 2 used purely to slow the incrementing down so you can see what is happening. In Method 1 the delay mechanism is the Threading.Thread.Sleep(10) where 10 is also milliseconds. If you remove this from method 1 the routine would complete before you could blink

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

OK, here's the basic solution that you wanted. I have included 2 Methods. Each method provides the same results, but one is timed using a Timer (Method 2) and the other is a simple Do - Loop (Method 1).

I've included the Do-Loop so you have all the code you need in one place, however it will lock up your form.

To copy and paste this code directly you need to add a label and two buttons to your form.

Public Class Form1

    '#####################################Solution Objects
    'The Timer Object That Will Provide
    'You With A Tick
    Private ClockTimer As Timer

    'Your Clock Object That will hold the time
    Private Clock As DateTime

    'The End Time
    Private EndTime As DateTime

    'Hands Over Counter
    Private HandsOverCount As Int16
    '##################################END SOLUTION OBJECTS


    '###################THIS CODE NOT NEEDED FOR METHOD 1
    Private Sub Form1_Load(sender As Object, e As EventArgs) _
    Handles MyBase.Load

        'Initiate A New Timer
        ClockTimer = New Timer

        'Add A Handler For The Tick Event
        'Every Time The Timer Ticks It Calls the "ClockTick" Routine
        AddHandler ClockTimer.Tick, AddressOf ClockTick

    End Sub
    '###################END THIS CODE NOT NEEDED FOR METHOD 1

    '###################################METHOD 1
    'Start The Simple Do-Loop Example
    Private Sub Button2_Click(sender As Object, e As EventArgs) _
    Handles Button2.Click

        SelfContainedSample()

    End Sub

    'This is a standalone version in a loop. It will give you
    'the same results as the example above but all the elements you need
    'are in one place. Rmember though, running this directly will lock
    'up your windows form until completion.
    Private …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

oops, wrong thread

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok. Though thinking about it there is only 11. 12:00 is the start point 11:59 is the end point there are 60 minutes in an hour but they go from 0 to 59. 0 can't be the start and end of the same hour otherwise therd be 61 minutes in an hour.

I'll have the solution for yoy in a few hours.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Sorry its 12 if you count the the stary and end podition. Its only 11 if you dont count the start position.

Ignore previous post about it 13

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok so starting at 12 isn't being counted as hands over each other... i suppose if you start at 12 and end at 12 technically they're over each other 13 times. Im sorry but 11 just isnt right, you'd have to start at 12:01 and end at 11:59 for 11 counts.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Is this for a school project? If it is I'll provide you with the solution but make it into a kind of tutorial to help you understand exactly whats going on. I'll provide you with a much more basic graphical representation too if you like.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

... I've not taught myself yet hahahaaaa (not enough to teach). In addition, I'm pretty old school. Instead of using blends clever ui all the effects and storyboards are in code. I can send you a link to a great tutorial series i found on youtube. I'll post it when I get home

Deep Modi commented: Ok, Send me this type of links, i really enjoy to study this. if this is in simple english +4
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Make sure though, if you are using Now, you covert the 24hr hour to a 12hr hour.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok. Well if your not too fussed about the accuracy of the physical hands you could simply do

If Now.Minute = Now.Hour x 5 then OverCounter +=1

This is basically iterating every time the minute hand goes over the specific hour segment of the clock. This could be made even more accurate by only incrementing when the minute hand is on the same 60th segment as the hour hand or even more accurate over the same 360th segment.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I know this is an old thread Deep, but I started playing around with WPF a couple of months ago, within a day I'd managed to create a really nice navigation system. I strongly urge you to persue WPF in the future... Even if it's not WPF than XAML with a different UI

Here's a video I posted to give an example Click Here

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Note: this isn't the most effective way to draw on to the form, just a quick example.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

do you mean a clock that counts every time the minute hand is over the hour hand?

if so... your answer should actually be 12

Any way, just for a giggle. Here's some classic clock maths. Copy and paste this code into your form. The forms title will count the number of times the second hand goes over the minute hand. The minute hand and hour hand sweep. If you want the second hand to sweep you'll need to pass milliseconds. I've used variables instead of just equations so you can hopefully get an idea of whats going on.

Just to save even more time. to do what I think you want to do... All you need to do is increment your HandOverCounter every time the second = minute or minute = hour depending on which hand over hand you want to count.

Public Class Form1

    Dim tmr As Timer
    Dim B As Bitmap
    Dim TickOver As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) _
    Handles MyBase.Load

        tmr = New Timer
        tmr.Interval = 1000

        AddHandler tmr.Tick, AddressOf DrawClock

        tmr.Start()
    End Sub

    Private Sub DrawClock(sender As Object, e As EventArgs)

        DrawHands(Now.Hour, Now.Minute, Now.Second)

    End Sub

    Private Sub DrawHands(HourVal As Single, MinuteVal As Single, _
    SecondVal As Single)


        Dim Pi As Single
        Dim X As Single
        Dim Y As Single

        Dim SecondAngle As Long
        Dim MinuteAngle As Long
        Dim HourAngle As Long

        'This simply increments when the second hand is over _
        the minute hand
        If SecondVal = MinuteVal …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I have used several methods to save a program's settings in the past.

  • System Registry
  • INI files (Encrypted\Plain)
  • XML file as a resource or external file
  • XML app.config

etc.

I'm wondering either:

  1. What's your preferred method for saving your program's settings?
  2. Is there a preffered industry standard?
  3. Does .Net provide a namespace for reading writing a programs settings?
  4. As VS creates settings in XML in the app.config file should I sipmly take this as preferred.

In short... what's YOUR prefered method OR what's the PROPER method =0)

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I'm currently working on a collection of sub-projects, one of which was a backup manager. I needed to be able to allow the user to specify a backup time and a repeat interval. After thinking about the solution, decided it would be best for the user to provide an Initial DateTime of the first occurance and how frequent they would like to repeat the event. This class can be used to help determaine Alarms, Reminders or anything that requires an event to be triggered at a certain time.

Fun and Good for Beginners

It was good fun writing this wee class and thought it would be a great example for junior developers on using DateTime and TimeSpan to determine things like DateTime manipulation, and the difference between two Dates and Times.

Note: “Event” throughout this snippet is referring to something like an alarm, a calendar reminder or any other action to be performed at a certain date and time.

A Quick Introduction

User Input Required

The Date of the first occurrence
The Time of the First Occurrence
The Repeat Interval

0 = No Repeat
1 = Daily
2 = Weekly
3 = Monthly
4 = Yearly

The “NextEvent” method of the EventManager class then calculates the next occurrence of the event based on today’s date and time.

Returns

the next event date, time and a duration until the next event.

What's happening

Let’s say todays date …

Reverend Jim commented: Nicely done. +12
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ooops

@Warrens80
if "Everybody hates me...yet I stick around" was refering to yourself then ignore previous comment and stop trying so hard to upset people. If it was sarcasm directed at me then please go ahead and read away.

Damn reading misinterpretations...

Warrens80 commented: we're cool +0
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

@Reverend Jim
As you can imagine, very much apreciated. But please, this isn't just about getting Kudos or being recognized or 'Wanting everybody to be my friend'. It's about contributions being snubbed with no reason, need or explenation.

it's not about getting 'enough' of them... I'd be happy with 0.

@Warrens80
I'm pretty thick skinned ... I assure you of that, it wasn't a case of being offended that ticked me off, it was the etiquette that baffled me. And what would you suggest, that I don't make my observations known to the people who can explain or if need be resolve the situation. Yes, that's how things progress and evolve. Judging from your history I think I'll take your comment with a pinch of salt. Funny how that works isn't it, I know nothing about you, yet I'm judging the relevance of your comment by a 'meaningless' score provided by other people's interaction with you... Why on earth would I get annoyed about being down voted unnecessarily?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Note: I wish Chrome would fix my spell chek. Sorry everybody =0)

Here's a quick run down of the class.

The properties:

As most of the property names are self-descriptive I'm not going to go through each one, however an addition could be made to the setter methods of each property to prevent changes during compression.

If we add a private member say _Compressing as a boolean to the Zipper Class and set it to true when the compression method is called and false when the process is finished, doing the following to each setter method will prevent potential errors during the compression process due to a user changing a property.

    Private _Source As String
        Public Property SourceURL As String
            Get
                Return _Source
            End Get
            Set(value As String)

                'Add this code
                If _Compressing = True Then Exit Property

                _Source = value

            End Set
        End Property
The Methods

GetSessionLength

        Private Function GetSessionLength() As Int64
            Dim sLen As Int64 = 0
            For Each SessionFile As String In _SessionFiles
                sLen += New FileInfo(SessionFile).Length
                If Cancel = True Then Exit For
            Next
            Return sLen
        End Function

When the Compression method is called all the files\file paths are added to the List(Of String) _SessionFiles. This method simply iterates through each entry and tallys the total length in bytes of all the files to be read and compressed. This information can later be used to report the current progress of the compression process.

IsDir

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, so normally all these processes could be complete in one single loop, but for ease of reading I am performing each step seperatly. I also havent included things like ArrayName.Count'-1' I'm assuming you're cool with Array bounds, counts, lengths etc. I hope this helps.

Step 1. Create a 2 dimensional array to hold all the results eg

 ResultsArray(N,2)

N is the number of result sets

    N,0 Holds Team 1 Name
    N,1 Holds Team 2 Name
    N,2 Holds Win

Load the CSV data into this Array

Step 2. Create a 1 Dimensional array to hold all the team names eg TeamList (Do not allow duplicates and do not include the values of "team1" and "team2". Note, if you want to change the table index order e.g. you want them alphabetically, set the values in this array accordingly A-Z etc).

Populate the TeamList array whilst reading the results from the CSV or after by looping through the ResultsArray

Step 3. Once you've done that it's time to put the data in your required table\grid format so create a new 2 dimensional array eg ResultsTable(N,N) where N this time is the number of team names eg TeamList.Count

Time for the old switch-a-roo

Step 4. loop through the sets of data in the ResultsArray and return the Team Name index from the TeamList array and store them accordingly Team1 into X and Team2 into Y e.g

    'Not actual Code Just Visual Representation
    For N = …
happygeek commented: thanks for the effort you are putting in to helping folk +14
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

If you think it will help I can provide you with a textual step by step of my solution. Hopefully you could then translate into java or python... let me know if this will be of use.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

There are many examples of compressing files in VB.Net. So many of these examples are using third party libraries which is just not neccesarry. People were saying that files and archives exceeding 4Gb couldn't be used... I hate restrictions and decided to "Stick it to Microsoft"

To get a better understanding of Zip files and their contents I set about writing my own Zip file generator from the ground up (Still using Phil Katz's Zip algorythem). Eventually I successfully built my own Zip and ZIP64 archives byte by byte.

I then looked at my work and thought, now I have a grasp of the inner workings of a Zip file (With the PKZip algorythem) let's revist the compresion name space to make sure I wasn't simply wasting my time. It turns out that all I achieved from this project was to get a very solid working knowledge of Zip files, and how to build them internally as these romours about 4Gb limits etc were totally bogus, the Compression namespace converts large files (on the fly) to Zip64 as required. So...

Here is my Compression method, wrapped up nicely in an easy to use class. It uses the .Net4.5 Compression namespace and reads\writes files directly from\to your disk. If you observe your systems performance during compression, No additional memory is used.

I hope this helps a lot of people out in the future.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, I thought I'd play with this. I updated your CSV to check the program, My CSV is like this (Baring in mind, this isn't an effective CSV reader as CSV value may contain commas etc"

Heres My Version of the CSV

team1,team2,win
hawks,celtics,1
hawks,knicks,1
hawks,76ers,0
hawks,lakers,0
hawks,celtics,1
76ers,celtics,1
76ers,lakers,1

And Here's the results printed in the console

               hawks    celtics     knicks      76ers     lakers
     hawks         0         2         1         0         0
   celtics         2         0         0         1         0
    knicks         1         0         0         0         0
     76ers         0         1         0         0         1
    lakers         0         0         0         1         0

You will see a lot of

.PadLeft(10, " ")

This has nothing to do with the program, other then formatting the layout in the console window.

Remeber to import System.IO

Here's the Results Class

    Private Class Results
        Public TeamH As String
        Public TeamA As String
        Public Result As String
    End Class

Here's the main code. Pop it into a button, and you're good to go

        'Open A Stream
        Dim sr As StreamReader = New StreamReader("C:\Users\Jay\Documents\Results.txt")

        Dim ResultsList As List(Of Results) = New List(Of Results)
        Dim TeamList As List(Of String) = New List(Of String)

        Dim rParts(2) As String

        'Read the results
        Do While sr.Peek() >= 0
            rParts = Strings.Split(sr.ReadLine(), ",")
            ResultsList.Add(New Results() With {.TeamH = rParts(0).PadLeft(10, " "), .TeamA = rParts(1).PadLeft(10, " "), .Result = rParts(2)})

            If Not (TeamList.Contains(rParts(0).PadLeft(10, " "))) Then TeamList.Add(rParts(0).PadLeft(10, " "))
            If Not (TeamList.Contains(rParts(1).PadLeft(10, " "))) Then TeamList.Add(rParts(1).PadLeft(10, " "))
        Loop

        'Close The Stream
        sr.Close()

        TeamList.Remove("     team1") …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

One morning a woman gets up to find her clothes full of powder. "What's this?" she asks her husband.

"Slim Fast", he replies, "Maybe it could help you lose weight".

The next morning, as the husband is getting dressed, he notices a pile of powder in his underwear.

"What's this then?" he asks his wife.

"miracle grow" replies his wife

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Now tha't some damn fine news... I feel it necassary to quote the out here brothers.."Whoomp! there it is" lol

Please post an image of the in-game graphic at work.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, that was scary. Here is the correct version

Deep Modi commented: Amazing, You are the one that You are giving the great efforts on my projects, AMAZING Talent... GOOD JOB +4