zachattack05 70 Posting Pro in Training

Good points rproffitt! The typical disaster plan here is unwritten and typically goes like this:

"Oh crap! There's a problem! Quick! Restore a backup!" Amazingly it works more often than I would care to admit.

Reverend Jim -- You mean something like this:

columnIndexHell.png

I'm literally in column index hell with this! There's even an obsolete message associated with the method used! It's making me crazy.

rproffitt commented: If this is so, can't delete columns yet. +14
zachattack05 70 Posting Pro in Training

Oh, to clarify too...the connection would NOT be over a http or https. It would be through a protocol that we would create in-house (if we use WinForms that is)

zachattack05 70 Posting Pro in Training

Hiroshe,

What is the difference? If I use a CA and the hacker intercepts the data, couldn't they also just immitate the CA?

I guess I'm missing something here right? I mean, the encryption level is the same regardless of if a CA issues a certificate or I generate the same encryption, right?

Why would there be any difference? Couldn't a hacker still intercept the transaction and send their own data?

zachattack05 70 Posting Pro in Training

I'm still not sure I see the benefit.

Hiroshe: If your example is correct and my end users have private and public keys and our servers have the same, I fail to see (especially if we assign those keys to our clients) how a CA is useful at all. If our application is distributed to our clients and we include our server's public key with the software and the end user's private key is generated on their machine based on data we have (as in, we also know their private key ahead of time) why would we need to bother asking a CA to verify it if we already have it? We can just check it internally couldn't we? If our servers check our client's private key and it doesn't match, then it's fake. If the client's check our server's public key and it doesn't match, then it's fake.

Rotating keys wouldn't be too difficult if you ask me either. Our servers can have say, 5 active keys at one time. Each time a client connects, if the client meets certain criteria (say it rotates after every 50 logins or something) then our servers keep track of it and say "hey, this is login #50! use key #2 now instead of key #1, but encrypt key #2 with key #1 and send it to the client first, confirm the client has the key by having the client respond with a confirmation that can only be decoded with key #2. If …

zachattack05 70 Posting Pro in Training

Wondering what exactly? can you clarify...

I'm wondering if a Certificate is even necessary.

I do understand your examples of a drivers license. I understand the purpose of a certificate and the logistics of how they work, but I'm just wondering if I have an application that runs in a browser or a WinForms app, and the app itself encrypts the data on the client side, then sends it to our server where it is decrypted and used is there any real advantage in having a certificate?

I mean, I guess my application can't really use a certificate if it is a WinForms app (I don't think) but if a web app at say http://www.somerandomwebsite.com/myapp was doing the same thing as my WinForm app would do and it is obviously not hosted using a certificate, what would be the major drawback? The data is encrypted either way.

Granted there is always the chance of a MITM attack, and I'm sure it could happen and has happened, but the same could be said for a site hosted with a certificate. Hack into the site, change the code and now your encrypted, SSL certificate is encrypting data and sending it somewhere else instead of where it's supposed to go. I don't see how a certificate can deter that.

For example, if I have a login page at https://www.somerandomwebsite.com/login and it's secured with a certificate and when a user submits the form it posts the data to …

zachattack05 70 Posting Pro in Training

I'm sorry if this is the wrong place to put this, but since I normally code in C#, and my potential solution would involve using C# I figured this would be the best place to start.

I've been given a task at work to allow our customers the ability to transmit confidential record information from their office to our in-house, or possibly a new cloud-based, server.

I have been rather adamint that to transmit said data, a SSL certificate must be aquired by us through a third party. But I'm wondering if that really is true.

The more I researched SSL certificates the more I've come to realize that all they really are is one company vouching for another. The encryption (even on an expired certificate or on a self-signed certificate) works and the encryption is just as secure as one that isn't. Sure, the user is presented with nasty icons and red screens showing that "hey! this may not be safe!" But if the user doesn't visit a "https" prefixed website and only visits a "http" website, what would be wrong with encrypting data client-side, submitting it to our server, decrypting it server side and vice-versa?

Encryption is encryption right?

Or what if a WinForms app was created that did the same as above? Encrypt data, submit it to our servers and the servers decrypt it.

I just can't justify paying thousands of dollars a year to have Verisign, or whoever, issue us a certificate when 99% (I'm willing …

zachattack05 70 Posting Pro in Training

Thanks for the replies!

It's been busy and I haven't had a chance to reply. I think I'm going to just add columns to the table and after many years the old data in the current columns will no longer be kept and I can drop those columns.

At least that's the plan for now. Hopefully it works!

zachattack05 70 Posting Pro in Training

I must respectfully disagree with rubberman.

While it might take some effort to write a useful algorythm for licensing, you can do it, and you can do it effectively with some practice.

I agree that software which thinks I have an invalid license when I do not would be annoying (although I have never come across software like that, I'm sure it exists). But I do think that having licensing keys or files is a great way to protect your investment. I disagree that it only keeps the honest honest and that most people are happy to pay. Given a choice, I would'nt pay! I do, because I must. Having licensing keys and files keeps the honest honest, but also keeps the low-end, "newbie" tinkerers out as well. Someone thinking about "stealing" software might not if a key is required simply because they don't know a way around it.

This isn't a debate thread though, and I assume sundog1 doesn't care about our opinions on the topic.

I can suggest that you start with reading some books or online articles on these scenarios. A good one I read is here. Now before clicking on the link I must preface it by saying I do not, under any circumstances support software theft in any form. The site the article is hosted on is an anti-piracy site (http://www.licenturion.com/). The link shows an article on one person's investigation into the Windows activation process. Since I read it last there …

Mike Askew commented: Good response, +rep +5
zachattack05 70 Posting Pro in Training

Dunno if anyone knows about this comic but it is hillarious and highly recommend it for a good laugh. It's written by a former NASA employee. Here are a few of my favorates (it's licensed under the CCL so the images are cool) you can read it at XKCD.com :

sandwich
exploits_of_a_mom
ballmer_peak
compiling
real_programmers

zachattack05 70 Posting Pro in Training

The first thing I ever programmed was a magic 8 ball :)

I guess it depends, you could scour source forge for an open source project that needs help (though I think a lot of that is C++ not C#, and not usually .NET) or try Google Code for the same.

Have you tried client/server stuff? If you want a headache and lots of head scratching that will make you learn, socket programming can be fun (and frustrating) if you have a network to play on.

You could also try CRUD development, and create a program that stores data, analyses it and charts it etc...

Some other generic ideas:

* A journaling program that uses rich text, encryption to keep entries secure and multiple users.
* A program that analyses vehicle gasoline performance based on mileage, tire, oil and other maintenance.
* A program that plays Netflix movies (Netflix API and Developer Network)
* A MP3 player
* A video chat program
* A video player
* An image editor
* A web browser

Just some ideas :)

zachattack05 70 Posting Pro in Training

The label at the bottom is probably moving because the anchor for it is set to "Top, Left". Try changing it to "Bottom, Left, Right" or something along those lines to keep it in place.

The calendar is probably having the same problem. Maybe set it to "Top, Left, Right"

If you already have the anchor set correctly, the next question I would ask is, are you using any layout tables, panels or anything like that?

zachattack05 70 Posting Pro in Training

Oh, my bad. Like I said, I've never used Udp.

On a local/loopback connection you said it's working...the only thing I can think of is a router, either at the server end or the client end is dropping the data, or doesn't know where to route it so it drops it.

You said there are no firewalls blocking it, so maybe it's just a routing issue? I'm grasping here...no real idea, but throwing out suggestions.

Sorry I'm not much help, maybe someone else might be.

Have you tried using a program that you haven't written yourself that uses Udp to see if it works? Can the client and server "ping" each other with the command line console?

Good luck :)

zachattack05 70 Posting Pro in Training

I've never used Udp, but I still think you need to have your server "listen" for connections.

Maybe this will help: Socket.Listen Method (MSDN)

zachattack05 70 Posting Pro in Training

Are you using synchronous or asynchronous sockets?

Either way, if you have a socket and have no mechanism to loop (with a timer or something else) a read on the socket, the server and client will connect and basically sit there without listening to each other. You can talk all you want on one socket and send 10000 messages, but if the other end doesnt "read" the socket, it just sits there.

GPXtC02 commented: helpful +2
zachattack05 70 Posting Pro in Training

No, you can't make it inbetween, but what you can do is pad the key or truncate the key with data to make it fall into the required length.

That way if a user enters the key: "HelloWorld!" which is only 88 bits, you can have your application pad the data with say "0" until the length is 128 or 192. The user would still type "HelloWorld!" but the key is changed to: "HelloWorld!00000".

Same with a key that is too long, just drop characters from either the front or back of the string until you reach the right length.

Something else you might consider, taking the user's input, and hashing it with a provider that returns 128 bits. MD5 is one. I attached a table from Wiki that shows hash functions and their output size in bits.

zachattack05 70 Posting Pro in Training

jazerix is 56 bits, because each character in your string is 1 byte, or 8 bits. 7 * 8 = 56 :)

Just make your key longer or if the user can enter the key themselves, create a function to either pad the key with a value, or truncate the key to meet the length requirements.

Keep in mind though, not ALL characters are equal, UTF-8 encoding can take up to 4 bytes/character depending on the character.

I attached a little project I made that you can run that will calculate the size of your string as you type it. Dunno if it will be useful, but meh.

Jazerix commented: Awesome Help :) +2
zachattack05 70 Posting Pro in Training

I use e just because I think VS uses it by default, instead of confusing future viewers of my code, I keep the e. Chances are high that they will know what it is when reading an event triggered method.

Could just be me being naive though.

Diamonddrake commented: e for eventargs, everyone recognizes it. Just use it :) +8
zachattack05 70 Posting Pro in Training

To be honest I don't know if it's serializing and deserializing correctly. It appears that you are serializing to a file on the disk.

Clean your solution, delete the file at "K:\MiniSteam\ChessGame\Replays\Replays.dat" start the program in debug mode, do something to make the application serialize and see if the file is created. If so, it's serializing something.

How you use the data afterwards is up to your application's logic.

Since I really don't know what your ultimate goal is I can't really comment on if it "works" or not. The act of serializing "something" is working if the file is made and actually contains the data you need to use.

My suggestion would be to see if you can use the data in the file, if you can, it works, if not, it's not. :)

NewOrder commented: thanks for the help +0
zachattack05 70 Posting Pro in Training

Ahhh I see it now.

Because your class named ClassMoveToSerialize contains a field to hold another class instance called Class2, that means Class2 also needs the serializable flag.

Add the [Serializable] flag to Class2 as well.

NewOrder commented: Thanks for helping me with seriliazation +0
zachattack05 70 Posting Pro in Training

Add another "=" to your condition.

one = sign is assignment, you can't do that in the if () condition.
two = signs is used to compare.

You should use:

if (this.LblANDa.Text == "1")

instead.

:)

simagen commented: thank you +1
zachattack05 70 Posting Pro in Training

Might I suggest you use a MDI form? It would make getting that list very easy.

As for finding the last active form, try the Activated event instead of LostFocus and GotFocus.

From MSDN:

The Enter and Leave events are suppressed by the Form class. The equivalent events in the Form class are the Activated and Deactivate events. The Enter and Leave events are hierarchical and will cascade up and down the parent chain until the appropriate control is reached. For example, assume you have a Form with two GroupBox controls, and each GroupBox control has one TextBox control. When the caret is moved from one TextBox to the other, the Leave event is raised for the TextBox and GroupBox, and the Enter event is raised for the other GroupBox and TextBox.

For your reading pleasure:
Activated
Deactiveate

zachattack05 70 Posting Pro in Training

Not sure how to answer your question, but as a bit of info (only in case you didn't know) MSDN states that applications shouldn't be developed using this technology anymore and instead should be using WCF. MSDN Website.

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).

Just a FYI. :)

zachattack05 70 Posting Pro in Training

ddanbe,

I'm with you. WPF is odd to me. The whole thing is unfamiliar and every time I try working with it I get frustrated and end up deleting whatever I spent hours on with nothing to show for it (don't tell anyone...I still get paid for it) but I think I'm going to have to bite the bullet and figure it out eventually. I just wonder if it's a fad.

I've always been under the impression that a fancy, dramatic, colourful UI is just a cover for poor programming. Course that's not true, but it's been my perception for a long time. I'd rather spend more time making the application work, and work well and be intuitive than work on flair.

Just my opinion though.

ddanbe commented: Well said! +8
zachattack05 70 Posting Pro in Training

I tried asking this at the MSDN website and didn't get an answer at all...I was hoping someone here could help.

If I indicate that SQL Server Express is to be a pre-requisite for my application, how does the installer interpret this? For example:

If end user A already has SQL Server Express installed when they install my application, does my application create a new instance of a SQL Express Server or does it use the one that's already available? What about if there are multiple instances installed already or if the instance name I specified is already taken?

If end user B already has SQL Server Express installed and my application uses the installation they already have, what happens if there is a database name conflict? In other words, they already have a database with the same name that my application uses in that instance?

Finally, if end user C does not have SQL Server Express installed, but has a retail version of SQL Server installed, will my application use the retail version or install the express version along with it?

Sorry for the odd questions but I have yet to find an answer to these questions and I'd rather not spend hours developing an application and run into a surprise.

kvprajapati commented: Nice question. +12
zachattack05 70 Posting Pro in Training

I am working on a project that stores it's data in serialized files on the hard drive in a custom file format. The server end of the application accepts TCP connections from clients and returns data to the clients based on the query, it's kinda like a light weight, custom SQL server, but no where near as complex.

I have been asked to make the server available to outside applications, such as Microsoft Word for the purposes of mail merges.

The question I have is, instead of implementing a custom ODBC driver or something insanely complex and beyond my expertise, I was wondering if it was possible, easier, or even legal, for the server application I have to "pose" or present itself as a SQL server, or something, and actually accept connections from remote computers who setup the mail merge to retrieve data from a SQL Server? So if a client machine has a SQL ODBC driver already installed, they can select it, type in the connection information to the server running my server application and have my application accept the connection, process queries from the driver and return the data it requested? Kind of like a mini-SQL server?

The only other thing I could think of is to have an option in the server controls to periodically dump the data into a csv file or something and network users can connect to the csv file to get data...I just seem to see file permission errors amok …

zachattack05 70 Posting Pro in Training

I have an application that, on occasion, might need to perform certain tasks on files, or other things that are "in-use" while the application in running.

This is what I've tried to do, but I'm running into problems:

I created an interface:

interface IShutdownCommand
    {
        void OnShutdown();
    }

I wanted to create, on my main application window code the following:

//initialize shutdown Commands
        public List<IShutdownCommand> ShutdownCommandList;

        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
                foreach (IShutdownCommand Command in ShutdownCommandList)
                {
                    Command.OnShutdown();
                }
        }

But I'm getting this compiler error:

"Inconsistent accessibility: field type 'System.Collections.Generic.List<DATA.IShutdownCommand>' is less accessible than field 'DATA.Main.ShutdownCommandList'"

Any thoughts on how I could do this and actually get it to work?

zachattack05 70 Posting Pro in Training

I think I may have succeeded...and I really am starting to get this through my head. I never realized how structured and strict C# was...VBA is lazy...

Anyway, could you review my code and see if it is sloppy or marked-up incorrectly in some way? I would really appreciate it!

frmMain

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace WindowsFormsApplication1
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmEditor currentEditor = this.ActiveMdiChild as frmEditor;
            if (currentEditor != null)
                currentEditor.saveme();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmEditor Editor = new frmEditor();
            Editor.Show();
            Editor.MdiParent = this;
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                frmEditor Editor = new frmEditor();
                Editor.Show();
                Editor.MdiParent = this;
                frmEditor actEditor = this.ActiveMdiChild as frmEditor;
                FileStream fs = new FileStream("Test.bin", FileMode.Open);
                BinaryFormatter bf = new BinaryFormatter();
                actEditor.editortext.Text = (String)bf.Deserialize(fs);
            }
            catch (FileNotFoundException fnfe)
            {
                MessageBox.Show(fnfe.Message);
            }
            catch (Exception excep)
            {
                MessageBox.Show(excep.Message);
            }
        }
    }
}

frmEditor

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace WindowsFormsApplication1
{
    [Serializable]
    public partial class frmEditor : Form
    {
        public frmEditor()
        {
            InitializeComponent();
        }
        public void saveme()
        {
            FileStream fs = new FileStream("Test.bin", FileMode.Create);
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(fs, this.editortext.Text);
            fs.Close();
        }
    }
}

Right now I can have multiple instances of the editor, but when …

sknake commented: Indeed C# is structured and strict to make programs clear and concise +6
zachattack05 70 Posting Pro in Training

Hi! I'm new to the site! I've been searching for help on Google for a while and keep getting results that point to this site, so I figured I should jump on.

I'm new to C#. I've been programming in VBA in MS Access for a while now and have a solution that is running effectively where I work. (had to brag about that for a second :) ) But I just started with C# though. VBA is okay, but it is (to me) a little limiting.

I've decided as my first learning tutorial to teach myself how to create a custom file type, store user settings and data in it and then retrieve it later. The first problem I have run into is how to correctly save data and retrieve it.

I have a form that I created thus far, on that form is a menu bar and a text box. I have successfully exported (in binary) the data typed into the box, and then successfully retrieved it. My question is...what if I have two text boxes? What about 30?

I'd love to get some help and some suggestions on this. Code is nice if you feel up to it, but remember VB is my only real experience so comment any code up so I know what's going on...I'm not big on "ohhh! code! [copy/paste]" I like to know what every line does and why. I'll probably be learning C# for years because of that …

ddanbe commented: Nice question! +5