I think the best advise one would have been able to give on this topic is calculate tax prior to issuing the cupon perhaps? Sound about right? Don't let the scripting API determine tax? Any closer? Non-inheritable method? Brain cells?

happygeek commented: You seem to be in a very bad mood with everyone -4

I think I have a better idea than you guys how to do this. I recently created a casino random numbers algorithim which would instead of emitting a random value, it would emit a random percentage. This random percentage would determine which value to emit. In case anyone needs the solution to the problem. If one needs to emit them at a certain frequency one simply specifies the percentage of the time you wish to emit that value. It is really quite simple. If one has a file of random numbers you wish to emit to casino slot machines via encrypted serivice, one simply creates a file download api, and creates emissions until the frequencies are past a certain number where the emissions would become uniform. You therefore have to emit for a certain duration in order for the emissions to become that frequency. One would also increase the emission time in case one would want a really good random file of that frequency.

Hello all, I was wondering if I could get some questions answered about how cupons work in the work place. I have an idea which involves creating a very flexible cupon service, but would require knowing the rudiments of how cupons work. The main question I have is how is tax calculated on a ware as it is sold under a cupon service. I believe that would be the only thing I would have to stringently mandate as far as the cupon goes, since the institution wishes to clear the merchendise from the floor. The service would involve some C# back end classes which would be passed to an IronPython sandbox such that the users could be very flexible with their cupons, and the domain specific-ness of it could be passed various aspects of the order, such as items, the order it's self, etc. I don't want code, this is a generic discussion on the best way to implement a cupon service using a python sandbox. The classes would be stored in the database as clobs, and I would probably have a seperate service for implementing the registration of said cupon.

The real susbstance of this question is (so make sure you answer this one question) what are the legalities as far as implementing cupons that I have to implement such that I am in good standing with the authorities? These would be implemented as sealed methods or objects.

This may sound wierd, or easy, I just don't have a statistics background. How do I alter the statistical value of an array of emmitted random numbers? I am completely capable of using ranges, or creating an algorithim, I just need pseudo code or a brief description to guide me through the process. This is not homework. This would mean I essentially generate randoms, and the final result has a statistical probability. Thanks!

At the very least you will need to research the technologies you will be utilizing for locational data. For sql server this will be the spatial functionality, for postgre sql you would use postgis, or perhaps something else, I have only heard about postgis, there could be other technologies. Oracle db also has some spatial stuff. If you have an ORM, (not likely since this is PHP) you will need to learn the techniques to interact with locational data. I believe bing maps has something to do with displaying your locational data for sql server. Postgre sql from what I understand is an open source database. I am currently reading "Pro Spatial with SQL Server 2012" by apress. I will probably have to learn about NHibernate Spatial since NHibernate is part of my keychain, but not yours (C# for me PHP for you). I would read a spatial book before endeavouring to do what you want to do.

You don't speak english that great, but what I think you want is to enable both sql server authentication and Windows Authentication, aka Mixed mode. I only have sql server developer 2014, so it is probably all different, so take this with a grain of salt. Open Micorosoft SQL server management studio, which you will need to search for. Right click your sql-workstation instance root, select properties, click security, and under server authentication select sql server and windows authentication mode. Be aware there is also a network mode and port number procedure you will also have to set up, I don't have that procedure with me however.

Since there are public and private keys on all three computers, of which private keys don't get transmitted, and we are talking about encryption which by it's nature protects data in some state or another from tampering, you can be fairly sure that the destination has recieved it's contents unfettered. The thing about encryption is that it essentially transmits a stream whereby if any single byte is removed, the entire transmission becomes corrupted, and is dropped, and then retransmitted. It's like playing music in the background when you presume that you are being audio recorded, so that people can't copy and paiste bytes where they choose them to be. The background music changes would be noticable. Now the key store question, sure somebody could probably make some sort of script which could access this, somebody else would know more about whether that was possible or not, but the question here is not how to protect it on the destination computer, it's how to potect it in transit.

Sorry, it's 3 way encryption, there are basically 3 parties involved, and the way the crypto works it requires that all 3 parties communicate. There are public and private keys, some that are and are not transmitted. Basically the way it works is through some magic mathematical crypto functions where a private key and a public key can decrypt the transmission. Some passwords are public, but some aren't. It's a little bit difficult to explain, but it basically hinges on the fact that you are communicating with a third trusted party, and the transmissions are enctypted.

There is such thing as an SSL strip hack, but the users or the web page should be coded in such a way that the web page fails to display something, or the user should notice that their browser is not communicating with a crypted site.

Yes, you should not assume that the user is a good guy either, I was just explaining that forensics should be able to tell if someone is definitively a bad guy. A few times my home net has been through the grinder, and articles of law that say "the user is responsible for the security of their own network" sometimes stick in my craw, especially where some of the techniques used would have been virtually impossible to defend against anyway. sorry. You're right though security should assume that everybody is the bad guy first, before they authenticate, law should assume that everybody is innocent until proven guilty. That's ...

They have some good points. You see, when you use ssh, or ssl, or some form of encryption you not only verify that no-one has modified the transmission in transit, you have what is called 'attribution' because you know that 'this transmission' has come from 'this address', and you know that it has not been tweaked in transit because you know that it is encrypted. You therefore have attribution because you know which device did what damage. Don't jump to the conclusion that the user is automatically the bad guy, take into account whether there has been malware planted on his compter, etc before you jump to conclusions, but you're forensic investigator and net admin if he they are competent and honest will be able to tell you more or less who's to blame. Many applications aren't life ending, therefore you can just block specific users.

There are also tools which can alert you to exactly what is being transmitted to your servers, network sniffers come to mind, but you have to learn all the tricks/filters associated with your specific protocol. Make sure you have permission to run one on your network.

Firewalls are good to have, and many can log suspicious activity on your network.

VLAN'ing users is also a good idea, it keeps users seperated from each other so they can't necessarily share malware if you know what I mean. It would probably play hell with whatever info sharing is supposed to occur however.

Above all, figure out ...

It seems you are missing a few tags... What you will find in software dev- is that things are often organized into toolchains, and you can mix'n match. For instance if you know python, you're going to pretty much work on a lot of OS/script specific stuff, you'll probably also know C, and C++. I am not sure what else a python dev will know, it is not as familiar to me.

If you know .NET, you'll probably work with either C#, or VB, possibly both. You'll learn SQL for sure, because that's the defacto for interfacing and querying with the database. There are a few options for databases, MySQL, Oracle, SQL Server (Microsoft) etc. Typically C#, and VB developers work with SQL Server, but I have seen VB jobs which use Oracle. The Database was originally the solution for enterprise islands of information. When you have more than one DB things tend to get messy, so if you ever have the option don't mix'n match the databases.

Most Web developers will need to know JavaScript, HTML, CSS, and probably some sort of server side scripting language like ASP.NET, or PHP, Server side JS, etc. If your languages are mostly Microsoft specific you'll probably need ASP.NET, although I am seeing lots of JS jobs out there too.

**So essentially what you need to know is that when you develop, you can't really choose only one language to develop in, you're developing infrastructure. Infrastructure requires quite a few tools to do ...

Really guys you don't need to hide your strings very often. Encryption is meant to hide data at rest, not something meant to run in a program on strings which are typically used for prompts. Ultimately if somebody is in a position to reverse your exe, then even if you do crypt the strings somebody with enough experience to do reversing will ultimately just step through your code until he finds the crypto functions, and the keys you used to crypt the strings. Any strings that should be crypted should be kept in a secure container like a database, or a cypered file. If you are intersted in crypting your exe, then you should probably look into finding something that obfuscates, or crypts the entire executable. Just understand that ultimately all executables are reversable with enough effort. The only things that are not reversable are operations which take place on a company server because they can be controlled.

Thanks everybody, I am really a beginner in the world of "production programming", so I have very few experiences with other peoples software, and unfortunately the few experiences I do have are not that great so far. I appreciate being able to hear from more seasoned developers than myself, using somebody else as a litmus test is useful to me. Also, anybody else who wants to comment go ahead and post I will keep revisiting this thread for a while.

That seems to be the way to go. Keep it simple stupid. Thanks for your answer, others feel free to answer too.

Hey I have a question, how many people actually use telerik? Does anybody have experience with it, and what are your opinions on it? To me it is just another third party library that nobody knows, but I want an opinion on it from actual seasoned developers. I have worked on a few projects before where people just started throwing in random libraries, and they became unmaintainable. This is one of the reasons I ask. Due to my past experiences whenever I see a company with Telerik on it's webpage I feel squeamish. Is this reaction from bad experiences justified, or what do you all think on Telerik?

Right, good point. The only reason I am using a config object here is that it is a fixed width file parser. I am probably not using the correct vocabulary in some of the program, but I am essentially passing in a config object which contains a file path, as-well as an array of classes which represent the characteristics of each field, widths, alignment, and field name in case somebody actually wants to print a column header in the file (usually you don't but I have seen some CSV's with this user friendly feature). The idea is I can serialize the configuration object, and reload, etc. The objective in my mind for this program was to make it so that it is useful to different companies/people who may not all have the same fixed width formats.

I could probably think of making a few overloads so I could pass streams to this object, but I would have to think about this to make sure the config object is still useful. Perhaps I should just remove the config object's path/name variable?

Say hypothetically you had a reader which did something like this...

//testing reader, automatically parses strings and converts to the custom type via attributes!
using ( FlatFileReader<MyCustomClass> reader = new FlatFileReader<MyCustomClass>(config) ) {
    MyCustomClass custom;
    while ( (custom = reader.ReadLine()) != null ) {
        Console.WriteLine(custom.ToString());
    }
}

Would this actually be useful in not just flat files, but CSV, etc, etc? I am just having some second thoughts about this program, as to whether it would actually be useful to people. There's not really any technical problems with this, I just want some opinions.

I don't know, I have been told by some developers that Entity Framework is one of the "new things" in database development only recently (looking up some info on google, it originally came out 7 years ago, but is still under active development). I got some books on the subject, still need to read them, are you sure removing it is a good idea? If it is in fact a troublesome technology I would like to hear some more opinions of experienced developers.

I am glad deceptikon touched on security through obscurity. While reading through a crypto book I heard about the concept as well. As it is described in the crypto book, no crypography should rely on the algorithim being secret, but instead it should rely on the keys being secret, and the algorithim being robust (no flaws). When it comes to source code, eventually the binary will be reversed, and the processes will become clearer to hackers who are analyzing the algorithim regaurdless of access to the source code. You can make it harder by not releasing source code, but it is really just an obscurity thing, where somebody really accomplished at reversing wouldn't be phased much at all. So my take on it is that the more people you have contributing to the bug fixes, the more secure your source code will be. Safety in numbers. On the other hand making money often requires souce code remain confidential. For me, whether software is proprietary or not is less about security, and more about other factors.

I remember this example! Frustrated the hell out of me too back in the day! Am thinking to myself would probably be easy now, to just make an array of chars, and a single for loop starting at the right side, the end of the array, switching values to asterisks as it goes, and printing the whole array each time through the loop. Probably not the textbook version, but now I can see all sorts of clever ways of doing it.

I can't find the code for Combinations, but you appear to have a lot of data coming out of that class. If I was you I would review the code, and see if perhaps I could convert combinations, or something else into an IEnumerable, aka a state machine. Use Yield Return, so you only have one of the lists or something in memory at any given time. I can't see the code though, so I don't know if it is feasible, especially if there are other dependencies. Could you explain what Combinations does, because the name honestly isn't that descriptive. You are providing it a dictionary, but when I think"combinations" intuitivily I would think of something like, hey we got one number, and another number, and I want all combinations between the two, but you are providing it a collection, so I have no idea what it does. Almost literally any place you can turn a collection or file or output into an IEnumerable is a good application of it due to the fact that typically you can keep your memory footprint small. Would a stream help? I don't know. Remember, computers still have limited memory, and even though you have oodles of it to play with these days, Microsoft will eventually smack you down if it thinks your process is too memory hungry.

I figured it out, sorry guys. My variable statement was casting it to something that I should have known not to cast it to, you see when you link together an orderbydecending it returns an IOrderedEnumerable, not an IEnumerable. So it was casting it to something that was essentially unordered. I admonish myself to always use var in linq queries from now on because the var statement fixes this particular problm.

        public static IEnumerable<int[]> OrderByMatrixRows(this int[][] jagged) {

            var query = jagged.OrderByDescending(row => row[0]);
            for (int i = 1; i < jagged.Length; i++) {
                query = query.ThenBy(row => row[i]);
            }//end loop

            return query;

        }//end method

Hello, I am thinking about doing a matrix RREF function, am still in the research stage, but I thought I should post a bug I have been having. The following code doesn't work. What I am trying to do is orderby the array index [0], and then by [i...] etc. Here is the code I have been having trouble with. I am trying to break the orderby decending, and thenby operations up onto multiple lines as I build the query so I can have a looping like action. I think it doesn't matter which rows you swap in RREF as long as the row with the 0 on the front is at the bottom, and the larger numbers are at the top, but I could be wrong, it has been a while since I had a math class, and I am going to have to sift through my books. I may be attempting to break some LINQ rules here, I don't know. Please enlighten me as I am new to LINQ.

        public static IEnumerable<int[]> OrderByMatrixRows(this int[][] jagged) {

            IEnumerable<int[]> query = jagged.OrderByDescending(row => row[0]);
            for (int i = 1; i < jagged.Length; i++) {

                //the following line errors out
                query = query.ThenBy(row => row[i]);
            }//end loop

            return query;

        }//end method

If I can't do this with LINQ I will have to figure out some other way of doing so. Also if you all have any good sources for re-learning RREF please post em.

I think it's an improvement, even with the slight overhead introduced. This could make other methods like an RREF function easier to code (it's been a while, I actually don't remember how to do row reduced echilon form, so I don't know). You could probably make this a little more interesting with addition and subtraction methods, RREF, as well as making it generic, and using dynamic casting where the generic inherits from struct to implement the addition and subtraction on the contents. You are talking about a mathematics matrix right?

T[] arr = new T[length];

arr[i] = (dynamic)arr[i] + (dynamic)otherarr[i];

Here is some code I wrote for a matrice program;

/*Author: overwraith*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Matrices {

    class Program {

        static void Main(string[] args) {

            Matrix<int> m1 = new Matrix<int>(new int[,] { { 0, 0, 1 }, { 0, 1, 1 } });
            Matrix<int> m2 = new Matrix<int>(new int[,] { { 0, 0, 1 }, { 0, 1, 1 } });
            Console.WriteLine(m1 + m2);

            Matrix<int> m3 = new Matrix<int>(new int[,] { { 0, 0, 1 } });
            Matrix<int> m4 = new Matrix<int>(new int[,] { { 0, 0, 1 } });
            Console.WriteLine(m3 + m4);
            Matrix<int> m = m3 + m4;
            m.To1DArray();

            Matrix<int> m5 = new Matrix<int>(new int[,] { { 0, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 } });
            Matrix<int> m6 = new Matrix<int>(new int[,] { { 0, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 ...
ddanbe commented: Again, nic code, thanks! +15

I am reading a book right now, called "C# in depth" (3rd ed.), the author mentions contravarience, and covarience in places, but I am not finished yet, so I don't know if the author addresses this problem directly. The author's name is John Skeet, I think he actually has a stack overflow account. The book also has references to his online blogs, but all the links have changed by now. You just have to do some creative googleing to find the blogs. The MSDN site would also probably have information about this topic.

That would be a good fix too. Thanks.

So I figured that a loop might be better than calling recursive methods or something, am not sure. But I wrote this program using 3 big integers to see how big a fibonacci number I can make. Is currently dumping to my screen, and when it runs out of memory it will dump to a binary file. There are probably better ways of figuring fibonacci numbers, I will have to look into it.

/*Author: overwraith*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using System.IO;

namespace Fibonacci {

    class Program {

        static void Main(string[] args) {

            const String ctFile = "Fibonacci_Current.dat";
            const String prevFile = "Fibonacci_Previous.dat";

            BigInteger previous = 1, current = 2, fibbonacci = 0;

            Console.WriteLine("Fibonacci Num: {0} ", previous);
            Console.WriteLine("Fibonacci Num: {0} ", current);

            try {
                if (File.Exists(prevFile) && File.Exists(ctFile)) {
                    //pick up where we left off
                    using (BinaryReader ctReader = new BinaryReader(
                        new BufferedStream(
                            new FileStream(ctFile, FileMode.Open,
                                FileAccess.Read, FileShare.ReadWrite)))) {
                        current = new BigInteger(ctReader.ReadAllBytes());
                    }//end using

                    using (BinaryReader prevReader = new BinaryReader(
                        new BufferedStream(
                            new FileStream(prevFile, FileMode.Open,
                                FileAccess.Read, FileShare.ReadWrite)))) {
                        previous = new BigInteger(prevReader.ReadAllBytes());
                    }//end using
                }//end if

                while (true) {
                    fibbonacci = previous + current;

                    Console.WriteLine("Fibonacci Num: {0} ", fibbonacci);

                    //swap
                    previous = current;
                    current = fibbonacci;
                }
            }
            catch (OutOfMemoryException) {
                //can't go any higher
            }
            finally {
                //write the resulting fibbonacci nums so other programs can pick 
                // up if more resources come available later
                using (BinaryWriter ctWriter = new BinaryWriter(
                    new BufferedStream(
                        new FileStream(ctFile, FileMode.Create,
                            FileAccess.ReadWrite, FileShare.ReadWrite)))) {
                    ctWriter.Write(current.ToByteArray());
                }//end using ...

Thanks for the help. I am really just messing around with this code now, I acutally am not very dumb.

Wait a sec, is the + operation returning a new big integer object? Oh. I shoulda seen that.

So the other day I was just experamenting with some code, just for fun, and I ran into some difficulties. So I suppose my question is why the following code does not write to the original bigints array. I am sure I am doing something dumb, but please bear with me. I made my own simple "state machine" thinking that I could return what is essentially a reference to the value in the array, and get away with only two BigIntegers being in memory at any given time. What seems to be happening though is that the value of the BigInteger is copied and then the copy is returned. I thought that whenever you did this "SomeObj obj = new SomeObj();" the left hand side was essentially a really safe pointer. Now this code is really convoluted, so as you can see I was just messing around, and wouldn't use this anywhere else. Perhaps when I access "array[current]" in the getCurrent() method the array copies the datatype instead? I know I am being too clever for my own good, be gentle. Are BigInts value types?

/*Author: overwraith*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace Fibonacci {

    class Program {

        static void Main(string[] args) {

            BigInteger[] bigints = new BigInteger[2] { new BigInteger(1), new BigInteger(2) };

            try{
                LoopingStateMachine<BigInteger> enumerable1 = new LoopingStateMachine<BigInteger>(bigints);

                //advance one on second state machine
                LoopingStateMachine<BigInteger> enumerable2 = new LoopingStateMachine<BigInteger>(bigints);
                enumerable2.MoveNext();

                while(enumerable1.MoveNext() && enumerable2.MoveNext()){
                    BigInteger current = enumerable1.getCurrent();

                    current += enumerable2.getCurrent();

                    Console.WriteLine("Fibonacci Number: " ...

Thank you.