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

Thanks for that little insite kplcjl... I shall bear that in mind for next time....

Did you like what I did there... bear... grrrrrrrr lol

Surrounded by people who are quite technically minded yet a person's nationality is determined by the colour of their profile picture as opposed to actually checking out a profile.

I wonder where I'd be from if I set it to a green hue... Ireland maybe.

If only so much thought and attention had been put into constructively criticising the source provided. It's kind of handy though because the TEFAL website I'm enrolled in keeps giving coding advice... weird?

Alas... I'm being rude...

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

Oops

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

I thought about LINQ, but if I needed to use a loop to copy the results of everyNth I may aswell just copy the values between the arrays in the loop it's self.

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

I was wondering if there was an existing method within the .Net frame work which will copy every nth element of an array to a differant array with an initial offset e.g.

Original Source Array (Bytes)
11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30

Original Target Array
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

Source Offset 1
Source Step 3

Target Offset 3

Updated Target Array
00,00,00,12,00,00,00,16,00,00,00,20,00,00,00,24,00,00,00,28

I can quite easily do this with a loop, however it would be handy if a method existed which performed this operation. Primerily the array is a single dimensioned byte array.

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

Planet of The Apes

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

Hey, I was just wondering, If you have any old screen dumps of DaniWeb roughly around the time when it kicked off. I'd love to see what now and then looks like in comparison.

Do you think you have anything Dani?

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

Their the badgers... thanks guys.

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

Is there any way I can delete these Drafts myself, or is this a request to the MODs?

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

Oh my god... I must be smoking crack... Somehow I always thought this was the bottom of the page

1.png

But look, there's even more BWahahahaha...

2.png

I swear to god I've never seen that bit what the hell man... look there's a little JC badge too whoop... I must of just assumed the dim gray box was the footer and stopped scrolling automatically. GOSH DARN IT.

Re-Write blowfish for .Net:1
Navigate Web Browser:0

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

Hi Dani, thanks, I managed to get help understanding that. What I am really trying to find is the following. Once I've clicked on "publish" i Get this screen with the link at the top "View Article Workshop"

T1.png

Then when I click on the link I get the list of pending and draft articles:

T2.png

as you designed and built the website you'll be all to familiar with this =0) however, my question really is, once I've left this page, how do I get back to this Article Workshop View list, If I save a draft I can't seem to figure out how to get back to it at a later date... also, like here I've created a bunch of tests... which would be kind of cool if I could just click on a littel trashcan or something to delete them.

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

First of all I'd like to say great work on the addition of drafting articles before commiting to editorial however one question. The last two samples I published (Removed tick from "This is a working draft") seems to make the pending article unaccessible, I recently found out that the articles had been submitted for checking which is cool, however I couldn't find them any where, to get access to these articles I had to create a new article, then save as draft wich gave me access to a list of draft and pending publishing articles.

Is there a way to access this Draft\Pending list to re-edit at a later date, if so where it it. I think the link i saw was something like "upcoming articles"

Thanks.

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

Assuming you are passing the same instance of stream to each of your Addxxx methods then yes it should work. However I think you need to do this using (CryptoStream crStream = new CryptoStream(stream, cryptic.CreateEncryptor(), CryptoStreamMode.Write)) only once at the start of the entire write process for all of your methods, not in each method.

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

Also, GoTo exits the loop meaning the conditions within that particular loop will only ever be true once. I can see that this is in another loop but it's not clear from here what for.

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

The File.OpenRead, is as you have pointed out locking the file access mode to read only, you should probaly just use Open, which is read\write.

When writing your stream, the position within the stream doesn't seem to have changed position, so any writing will occour from the first byte, overwriting exiting data.

However, looking at this it doesn't look like your file will have any pointer references each time you append data to your file. A new crypto stream will be written each time you write to the file, or indeed append the file however you will end up with a whole bunch of encrypted data chunks, with no reference in length for each one.

I would assume you would have to read all the data of the file, decode it, append the new data, encode it again then rewrite the files contents as a whole.

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

Wow, I didn't know GoTo was still valid, please stop that.

Well first of all, the flow of this entire operation is a little shaky, however looking at this:

                If LVProduct.Items(w).SubItems(4).Text = LVProduct.Items(w).SubItems(5).Text Then
                    GoTo Here
                End If
                If LVProduct.Items(w).SubItems(4).Text = LVProduct.Items(w).SubItems(5).Text Then
                    GoTo there
                End If

Both conditions are exactly the same so if the conditions are correct it will always goto Here, and never there.

in fact GoTo there will never be called, Here seems to be where your Whole sale stuff is... Wholesale is always going to be called if the above conditions are correct.

Also not understanding what your check boxes are doing and when, there is a chance when you GoTo Here, there's code will be executed afterwards.

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

When you found GetCursorPos in ther User32.dll, did a little bell not tinkle to the sound of maybe SetCursorPos? =0)

I'm a cheeky chap

Public Declare Auto Function SetCursorPos Lib "User32.dll" 
    (X As Integer, Y As Integer) As Boolean

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

    SetCursorPos(50, 50)

End Sub

There you go, so close my friend.

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

Have you figured this out yet? You seem to have quite a few things to research but if you still need some help just say.

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

dataGridView1.Rows[i].Cells[0].Value

Should be

Convert.ToDateTime(dataGridView1.Rows[i].Cells[0].Value).ToString("yyyy-MM-dd HH:mm:ss.fff")

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

Darn it VB....

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

Oh shucks... I just saw MySQL... Sorry. Ok, so you can ignore the data acquisition part, however the binding between your DGV and DTP will still be the same.

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

Ok, Let's assume the following table:

Demo1.png

And the following code in your Form1 class:

        SqlConnection sqlCon;
        SqlCommand sqlCmd;
        String conString = "Server=SOLVOTERRA-HP;Database=Birthdays;
            Integrated Security=true";

        DataTable dTable;

        //DGV Cell Content Clicked Event
        private void dataGridView1_CellContentClick(object sender, 
            DataGridViewCellEventArgs e)
        {

            //Clear Previous Binding
            dateTimePicker1.DataBindings.Clear();

            //Reset New Binding
            dateTimePicker1.DataBindings.Add("text", 
                dataGridView1.DataSource, "Birthday");

        }


        public Form1()
        {
            InitializeComponent();

            //Create New Connection
            sqlCon = new SqlConnection(conString);

            //Create New Command
            sqlCmd = new SqlCommand("SELECT * FROM Person", sqlCon);

            //Create New Data Adapter
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCmd);

            dTable = new DataTable();
            dTable.TableName = "Results";

            //Fill The Table With Your Data
            sqlDataAdapter.Fill(dTable);

            //Close The Connection
            sqlCon.Close();

            //Set The DGV's Data Source To The Table
            dataGridView1.DataSource = dTable;

        }

Even though the date time stap formats don't match this wont raise an exception, in fact clicking on the row will update the DTP's value:

Demo2.png

As the DTV is bound to the DGV, updating the DTP's value will also update the DGV. Though this wont effect your database directly.

Demo3.png

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

Without going too far in to this have you tried serializing your data response into an object structure, or using LINQ?

If serializing or LINQ doesn't make any sense then don't worry too much about it, I may be missunderstanding your requirement.

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

How on earth have I not come across ReadOnlyCollection<> before?

Every day's a school day.

ReadOnly... Always made me laugh, you can't assign a new X to it, but you can manipulate all the content of X... Wow!

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

I also just noticed this: public List<TyrePressure> Wheels { get; private set; }

Does that do what I think it does, allows the local member to be set internally but not externally... so as it suggests, readonly externally, read\write internally?

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

Great Deceptikon, as per usual (How have you been btw).

I am going to spend much more time discecting your detailed response for future referance when designing a structure.

The important part, which I didn't make too clear is that the general implementation of objects (which are properties, thanks) and interfaces is acceptable... though in this scenario, very unnessasary and too complex, as you quite rightly point out and actually incorrectly structured lol.

I think my primary goal, well I say think... My primary goal was to try and ensure properties could be accessed MyCar.Wheels.TyrePressure.FrontWheel like so. I hate huge lists of properties (itellisense) and really enjoy trying to categorize properties in a much more structured way.

That being said, since the move to C#, I have noticed that attention to the finer details has a much more defined point than in VB. As with your answer, I need to pay special attention to various things like over complicating scenarios, the correct location of data within a structure etc.

Thank you, your response has certainly given me more pointers and diretion.

final note (So I don't seem like a complete melon), indeed some\most of the interfaces purely exist to be implemented, there is no actual requirement for them to be used other then to "just use them" and practice using them. The Whole structure of interfaces is more... How to describe it... representing data what you might find in a cars manual regarding what a tyres pressure should be, what …

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

Hello Dear DaniWeber's. I've been away for some time, and have recently made the transition from VB to C# (Finally). Using C# has opened my eyes to many things that I had either not fully understood, or had a lazy attitude towards. I find myself visiting the core of OOP and indeed polymorhism. Previousley I had used inheriting and implementing very loosley, maybe not even fully understanding their concepts and am now visiting each area and making sure I can implement things such as Interfaces and Abstract classes properly. In short, I'm trying to adopt a more professional approach to my development.

Below is (What I think) is a fair useage of interfaces, however, I am looking for advice for the community to guide me further. Is the code below acceptable, or even correct. My main focus of this question is the use of objects within Interfaces, is this common practice, or even acceptable? I have used the classic Vehicle example in order to try and depict what i have been doing.

I can create a new "Car" like so, and set some of it's properties:

Car MyCar = new Car();

MyCar.Wheels.WheelDiameter = 100;
MyCar.Wheels.WheelCount = 4;
MyCar.Wheels.NutsPerWheel = 1;

MyCar.Wheels.TyrePressure.FrontWheel = 36;
MyCar.Wheels.TyrePressure.RearWheel = 34;

The Interfaces and structure are as follows:

    /// <summary>Tyre Pressure Interface</summary>
    interface ITyrePressure
    {
        int FrontWheel { get; set; }

        int RearWheel { get; set; }
    }

    /// <summary>Tyre Pressure Object Implements ITyrePressure</summary>
    public class TyrePressure : ITyrePressure
    {
        int …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

It's ok, I was probing for a SQL function or routine that may have provided the solution to this problem. Ok, plan B then.

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

Please don't worry about the formatting of the numbers as these images are just for display purposes

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

Firstly, Hi Guys, sorry I've been away so long, I've taken on quite a large project and just haven't had the time for anything.

I am having difficulty completing my query. I initially have two tables

UserWallet
b4eb49cf9784417d61d6a5d56c089da9

and Captures
40061e6629b7d4577f1cf2405e54ab01

So far my query creates a new table which displays a users total wallet value, what funds have already been captured from a users wallet, and what value remains in the users wallet. (In this table SearchID 1 would normally be omitted because no funds are remaining)

Search-Part1
a43481228bcb75f2be9cd00a1e7f12ff

I'm hoping in the same query I can do the following. Let's say someone has search for £200. The query is to start from the top row (Search-Part1) and work down until the value required is matched by the sum of the selected rows. e.g.

Search-Part2
a2912922c2b5cfe718d8fde131b7054f

So I'd like to be able to achieve the above. Search-Part2 has itterated down each row in Search-Part1 and added up the remaining value until the £200 has been filled. As you can see the last row of Search-Part2 is only using £25 of UserID 1005 because that is all that iss needed from the UEsers Wallet. I would be happy If I had to use (initially) all of UserID 1005 balance (£150) in the table as I'm happy requerying this at a later date to correct the value.

The final part of the Query which I can figure …

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

Hopefully you should be able to see a tall blue header with two buttons (with splash effect). When you scroll down, the header should shrink down and the text is aligned accordingly. What I think is cool is that for this the only actual markup is this

<core-header-panel flex mode="waterfall-tall">
    <core-toolbar class="tall">
    <paper-icon-button icon="menu"></paper-icon-button>
      <div class="middle indent">MySnippets</div>
      <span flex></span>
      <paper-icon-button icon="search"></paper-icon-button>
      <paper-progress class="bottom fit" value="30"></paper-progress>
    </core-toolbar>

<div class="MyClass">Scroll Down To Enable Header-Panel</div>  
</core-header-panel>

No JavaScript... nothing.

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

Sorry guys, I'm just really excited about this. My very first use of Polymer Tags (Need Chrome)

Live Core-Header-Panel

Looking forward to developing with this.

What are your thought's on the fast aproaching Polymer Tags?

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

BASIC VERSION:
for example, if your area was a rectangle (RX,RY,RW,RH) and the box is 10,10,10,10 then If Mouse.X > RX and Mouse.X < RX + RW And Mouse.Y > RY And Mouse.Y < RY + RH then OverRectangle = True.

in this scenario the HitTest is If Mouse.X > RX and Mouse.X < RX + RW And Mouse.Y > RY And Mouse.Y < RY + RH then OverRectangle = True.

You would need to adjust the code for testing the area of a circle and an arc.

Alternatively once the mouse is within the designated area you may want to raise an event.

GREAT EXAMPLE
[Click Here](Click Here)

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

Did you know that the only data stored on a bank card is the information that is actually printed in plain view on the card. PIN, Address etc aren't in the magnetic data.

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

Can this be moved onto the correct thread diafol?

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

I wonder if it has something to with the whole 10, X, ONE trend that seems to be upon us. 9... just doesnt shout NEXT GENERATION like 10... though i imagine it wont be long after when there's a 10.1 10.2 10.n...

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

Wiki Seems to provide useful information, more specifically

"Each track can either contain 7-bit alphanumeric characters, or 5-bit numeric characters."

It also provides information to each byte depending on the card. Baring in mind, depending on the card, and what is written to it, the values can be any alpha-numeric combination.

I don't think "as a standard" the data is encryptred at all.

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

Apart from third party controls. I think must of the work here would need to be done, either as a collection of controls built into a user control (Not recommecnded as it will become clunky and unreponsive pretty fast) or actually build your own version using GDI+. Basically, what you could be dooing is drawing everything onto a canvas (including text etc) After that you will need to measure mouse locations and progmatically introduce Mouse-Hit areas for clickable items.

It would be a lot of effort, but a wonderful and respectable excercise.

here is a very basic intro to using GDI+, but there are thousands of other examples

Click Here

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

Just out of interest Xuexue. How did you end up doing this?