I noticed this too. I also noticed that some people think it's just straignt C, which is incorrect, due to the implementation of the common language runtime, JIT compiler, and MISTLE code. It is a high level language like Java, in fact java has copied some C# functionality recently, the streams api which is based on linq. Most of my coding is in C#.

The sql server does have a table with the user's object inside it. It's just the user is already authenticated once they pass through my page, so the other applications need to know that the user has been authenticated, hence session state. Idk is there something i am missing?

rproffitt commented: I'll answer nope. But it's your design. Here we opt for the SQL has the security (job?) +15

JSON is a markup language, like XML, but vastly different in appearance. It is meant to be read into an object where you can actually use and manipulate the data. Javascript as a convenient method for turning it into a javascript object JSON.parse(jsonObj);. Bear in mind that the actual case of the command is necessary. JSON can be sent to the client, or sent to the backend. It is a serialization format. In fact it is just one representation of the data, where the backend could be relational and could represent the data equally as well with an ORM(not necesary for you). Or the backend could simply store JSON using a specialized database (mongo db). Storing the actual markup as a clob is a bit wierd, but I suppose it has probably been done before.

The object would be a direct represenation of your json with the fields as its own fields or properties, and the database table would persist these fields or properties. Backend languages require other libraries to parse json. I believe PHP uses json_decode.

This is surprisingly difficult. Consider it a snippet. Deletes all tables from a sql server schema. Useful for those times on your dev machine where you need to tear down all the cruft that has built up on your server due to refactoring of object relationally mapped tables.

--Author: Cameron Block

    select referenced_object_id "REF_ID", T.name "TABLE", S.name "SCHEMA"
    from sys.foreign_keys FK
    JOIN SYS.TABLES T ON T.object_id = FK.referenced_object_id
    JOIN sys.schemas s
        ON t.[schema_id] = s.[schema_id]
        ON i.TABLE_NAME = t.name
        AND i.TABLE_SCHEMA = s.name
    WHERE s.name = @SCHEMA
    GROUP BY referenced_object_id, T.name, S.name;

        select referenced_object_id "REF_ID", T.name "TABLE", S.name "SCHEMA"
        from sys.foreign_keys FK
        JOIN SYS.TABLES T ON T.object_id = FK.referenced_object_id
        JOIN sys.schemas s
            ON t.[schema_id] = s.[schema_id]
            ON i.TABLE_NAME = t.name
            AND i.TABLE_SCHEMA = s.name
        WHERE s.name = @SCHEMA
        GROUP BY referenced_object_id, T.name, S.name
        SELECT T.object_id "REF_ID", T.NAME "TABLE", S.name "SCHEMA"
        FROM   sys.tables t
        JOIN sys.schemas s
            ON t.[schema_id] = s.[schema_id]
            ON i.TABLE_NAME = t.name
            AND i.TABLE_SCHEMA = s.name
        left join sys.foreign_key_columns as fc
            on t.object_id = fc.constraint_object_id
        left join sys.foreign_keys as f
            on f.object_id = fc.constraint_object_id
        WHERE  t.type = 'U' 
            AND i.TABLE_TYPE = 'BASE TABLE'
            AND s.name = @SCHEMA

rproffitt commented: Thank you Johnny Droptables. +15

I believe i first saw this FTP stuff in a business application, perhaps there will be an SFTP replacement class at some point. If you have some good code shoot. The symmetric crypto could just as easily be used on a clob of text, but i have found that you typically have to create the table by hand instead of auto generating it. Blob i believe. NHibernate by default makes such table entries RAW, so you have to make the table manually.

Well, congrats you picked all the hard ones to learn. JK. I think OOP is a much better way to go most of the time. It seems easier to think of things as objects. Also be aware that the PI doesn't have much bandwidth. Which should be fine for a file server application. If you wanted to throw together an ftp server, that would probably require a lot of code, I haven't been exposed to that myself. If you want to make a web upload, that would probably be easier, but would require a site. A socket connection of some kind would actually probably do the trick a little bit better for your purposes. But I don't know.

Perhaps there's some pre-baked software somewhere?

Do you know much programming? Reason I ask is that if you intend to code your own 'server' software, you could implement a journaling type setup for your hard drive. You could do this with application code, doing so just requires some interesting interfaces etc. First found out about the template from mongo db, acutally had a nice little diagram. Basically you keep a journal of transactions as a temp file. It is a 3 way write. source -> jounal -> dest. If not, I don't necessarily know how you would do it. If you get a hard drive, you should probably check the operating voltages, since the raspberry pi's are notorious for not providing enough voltage for power hungry peripherals.

P.S. sounds a little like a drop box to me... jk.

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 ...

No! do not let the vampires take over the world! JK

Dude, Bit-torrent isn't illegal. Just use wisely. What you download could be illegal, but lots of sites use it to conserve their server's bandwidth. It could be illegal in your country, but I doubt it.

Never done it before, but could bayesian filtering do something like this for you? Basically you count the occurrences of tokens in a sentence and based on that you have a strong probability that two questions are or are not the same, or similar. You would probably need to make a hash map of some kind to get it working right.

sasankasekhar2003 commented: Thanks overwraith, but that did not solve my problem either. But like Diafol, you lead me a step further. Thank youme a +0

I don't know exactly what's wrong without viewing MORE CODE, but it should be fairly straight-forward to point you in the right direction regaurdless. Here is an example that should be more or less correct and should steer you twoard building a tostring method that fits your needs. This looks like java, or C#, so there is an example of each.

@Override public String toString(){

    return "Your string";
    //Here's a better idea of what you will have to do, you have to 
    //  return the string representations of all member variables. 
    //  most programming languages coerce member variables to strings provided
    //  one of the variables in the chain is actually a string, '+' concatenates strings
    //  If you have integers or something consecutive, cast to string and enclose in parenthasees
    //return memberOne.toString() + memberTwo.toString() + memberThree.toString();

public override string ToString(){
    return "your string";

//you can also use StringBuilder's/StringBuffer's if you are accumulating
//  a lot of different strings, and you are concerned about the concatenation
//  overhead. (depends on language)

Also, remember to put spaces in the correct places otherwise the printout will not look legible at all.

I was referring to a programatical interface however, it is a little bit important, and like I said it was a higher level programming class.

public interface ISomething{
    void IDoSomething();

I think you would probably agree with me that this is a fairly important concept.

rproffitt commented: Nod. Member should ask much better questions. +0

Perhaps there should be a feature where you can't downvote someone when your account is only n days/months old?

rproffitt commented: Social Media (SM) thinking there. Not bad. +0

Program calls declaration_list(), declaration_list() calls declaration(), which prints something and returns, then declaration_list() calls declaration_list(), it's self again, which proceeds to call declaration(), then we go back to execute the last line of declaration_list() again...

Trace through it a line at a time, essentially declaration_list() calls it's self once an execution, so it is in fact infinite. There is no breaking out of this loop. Since there is no way of breaking out, the stack gets too large, and an exception is thrown/executable dies, or the runtime detects a certain number of recurses, and chokes. This is C right?

Stop refering to it as the same cell, you're confusing everybody! A 'cell' is one box. A 'row' is one line of boxes left to right. A 'column' is all the cells in a vertical line (up/down).

So what you seem to want is to take the repeating rows, and put them all on one row, one after the other?

These terms matter when you start dealing with the Excel interop stuff.

ddanbe commented: Quite right. +15

Yes, don't create multiple threads on the same topic. What I would do is look into a packet sniffing library like libnet, or pcap, etc. The wireshark one would be best probably. You may need to learn how to do C-calls from C# in order to get stuff working, but if I remember correctly there should be some sort of port or wrapper online which is open source, you just have to google the right stuff. I always had problems doing packet sniffing in C#/higher level languages, because of getting the darn old stuff to compile correctly, and then getting the C-calls working correctly. I eventually gave up the process. The way I see it, the higher level languages like C#/Java have abstracted themselves away from their users being able to do low level things. It is a real battle to be able to do low level operations in highly abstracted languages. We have built ourselves a tower of abstraction, so now the low level things are not easy to accomplish any more. I believe that one of the libraries I tried to use was actually some kind of static library or something, I don't think C# even supports that anymore. If anybody has actually done this, I could learn a lot too if the road was paved a little bit first...

Essentially anything that you provide to customers will essentially be prone to reverse engineering, if this is what you are asking. There are techniques for making the reverse engineering process more difficult, like obfuscation, encryption, etc. These techniques make it more difficult, but not impossible to reverse engineer. You should not think that it is a waste of time, it is possible to make your binaries so complicated to reverse that virtually no one will want to partake in it. One technique for actually preventing the majority of people from being able to reverse engineer your code is to put in a call to a service on a server. If you put your proprietary code on the server then people can't reverse it unless they have access to the server.

This is kinda what we did, not exactly what we did, but it should give you some ideas. As far as logging, and having all projects inherit, I am unsure of that. You could have them all inherit from heading I suppose, or make something completely different.

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

namespace Heading {

    class Program {

        static void Main(string[] args) {
            Heading heading = new Heading();


            Console.Write("Press any key to continue... ");
        }//end main

    }//end class

    public class Heading {
        private const String firstName = "Joe";
        private const char MI = 'J';//middle initial
        private const String LastName = "Schmoe";

        public String getAssemblyName(){
            return System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
        }//end method

        public override string ToString() {
            StringBuilder str = new StringBuilder();

            //append name info
            str.AppendFormat("Programmer: {0,6} {1}. {2}\n", firstName, MI, LastName);
            str.AppendFormat("Assembly Name: {0,5}\n", this.getAssemblyName());
            str.AppendFormat("Date: {0, 28}", DateTime.Now);

            return str.ToString();
        }//end method

    }//end class

}//end namespace

I took a class once where we wrote our own personal heading class for our assignments, it included information such as the developer name, the date the program was run, etc. Information included the following;

First name,
last name,
assignment, //could probably just use a creative naming convention and reflection for this part
Current date,

Apparenty it has to print everything in a useful format. I am not going to include the java code associated with it, it has my real name associated with it in multiple places, and the instructor made a lot of arbitrary and rediculous coding conventions that quite frankly made the code ugly. We had to code around these rediculous conventions lest we loose points. We even had to cite our textbook in our computer programs, and put the teachers name in the program, and only after we cite the teacher as the "main" useless coder could we put "modified by" and our name. So even though the teacher did absolutely nothing, and was more a hinderance to our getting our coding exercises done, we had to "pretend" that he was the main coder of our assignment. I didn't realize how much I despised him until my rant just now. sorry.

Anyway your name, the program name, and the current date seem the most logical fields for something like this, and if it is a console application you may need a seperate program for a GUI application, or you could just make a ToString for ...

So I was recently working on a string program where the strings were easily megabytes long, and I ran into problems with there being out of memory exceptions etc. So I said to myself, this would be a perfect problem which lazy execution solves. Here is a split function that essentially makes it so that only one of the string tokens is in memory at any given time, making it much more efficient in terms of memory. It might be a bit slower in terms of CPU cycles, but I wouldn't bet it would be that much slower. My program also had to split strings according to search threads, and one of the functions preforms that as well. I am happy with it, if you notice any problems with the implementation don't hesitate to point them out and suggest alterations. State machines are really cool this way.

castajiz_2 commented: that's really good +4
AleMonteiro commented: nice to share ^^ +8

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;

            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

So when reading my code, take into account that I am essentially using delegates (callback functions) to make one loop act like two. I have a bachelor's degree. I am inherently more trustworthy.

Ok, so I figured out that in my code I had to take into account the fact that when you go half way through the numbers, the logic for the start value flips from even nums to odd nums. The code I wrote to solve this problem is deplorable, I would probably go a different route if I had to do so again. My code also takes into account start and end values for the table. The fudge operations I coded, especially the second one is really messy. I anticipate this code breaking when you plug in different values (possibly, I am not sure). I did get it to display the original table though;

1 2
2 3
2 3 4
3 4 5
3 4 5 6
4 5 6 7
4 5 6 7 8
4 5 6 7
3 4 5 6
3 4 5
2 3 4
2 3
1 2

And here is what the table looks like for 1 through 9, am not sure if is correct;

1 2
2 3
2 3 4
3 4 5
3 4 5 6
4 5 6 7
4 5 6 7 8
5 6 7 8 9
4 5 6 7 8
4 5 6 7
3 4 5 6
3 4 5
2 3 4
2 3
1 2

As you can see the 8's and 9's are all in essentially the same column, so I am not sure if this ...

ddanbe commented: Nice code. +15

You would essentially need a deep copy clone of the array. Array only has a shallow copy though, so you would need to find some code that allows for deep copying. This would cause overhead if you were doing it a lot though. Arrays are pass by reference to prevent the overhead of copying a whole array over and over again into local variables. Usually programmers make a concious effort not to modify the array or make changes in a method which should have no side effects. Essentially a deep copy would get you the same effect as pass by value. You should also know that arrays in C# "pass a reference by value". This is somewhat confusing because it is not what typical languages do. So basically if I wanted to change the contents of the array, that would propagate back to the calling method, but if I wanted to get rid of the reference entireley, setting the array to null, then the operation would not propagate back to the calling method because the reference is passed by value.

Here is a discussion where somebody brought up deep copying an array, I like the GenericCopier solution;

I hope nobody takes offence to me linking to stack overflow, I use you guys pretty much interchangably, I try not to limit myself when it comes to resources.

I wrote this bit of code while I was in the class. If I ever did it over, there are a few things that I would change, but there is a lot of potential in the code. Basically this "batch" master record/transaction record processor uses this passing of pointers to heap allocated structs to preform it's work. Combines two files, the transaction file, and the old master file into the new master file. It really reads the file almost like the file it's slef is the list. One of the things that should probably be fixed is that it does not write to a binary file, it writes to a text file (that just happens to have a .dat extension, I know I was younger when I wrote it, I didn't know). The loop in main may also need some work.

Author: Cameron Block
Assignment: 11.7, 11.8
File: FileMatching.c
Purpose: Develop a program that does various operations on a file. 
#include <stdio.h>//standard input/output
#include <assert.h>
#include <stdlib.h>//malloc cmd for allocating structs
#include <string.h>//memset cmd for clearing memory

char *removeNewLine(char input[]);

typedef struct{//struct for old master file
int accountNum;
float currentBalance;
char name[32];

typedef struct{//struct for transfer file
int accountNum;
float dollarAmmt;

MasterRecord *readMasterFileRecord();//pointers are really awesome
TransRecord *readTransactionRecord();
void writeNewMasterRecord(MasterRecord *record);
MasterRecord *createMasterRecord(TransRecord *input, char *name);//creates a new initialized master file record
char *strStrip(char input[]);

void main()
    //both transactions file, and master file must be in order
    MasterRecord *currentMaster=readMasterFileRecord();
    TransRecord *currentTransaction=readTransactionRecord();
        { ...

C doesn't have objects silly! But basically yes, if you choose to allocate your struct without the malloc method, on the stack (I'm not saying that's what I did in my code), and then return the address of that stack allocated struct, would you still be able to access it, would it move it's slef to the heap, or what.

From what you are saying, it would be popped off the stack and unavailable to the coder.

From what I learned here, allocating to the heap is a really good idea, and can be very benificial to efficiency.

Thanks everybody for bearing with me.

I see what you mean now, a class shouldnt be extended unless there is a reason for extending it. I fixed the code as follows.

import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.Component;
import java.awt.GridLayout;

public class JOptionPaneArrayInputExample{

    public static void main(String[] args) {
           String messages[] = {"str1", "str2", "str3", "str4", "str5"};

           showInputDialog(null, messages);
    }//end main

   public static String[] showInputDialog(Component parentComponent, String messages[]){
       JTextField textFields[] = new JTextField[messages.length];
       JPanel panel = new JPanel();
       String input[] = new String[messages.length];

       panel.setLayout(new GridLayout(messages.length, 2, 0, 0));

       for(int i = 0 ; i < messages.length ; i++){
           panel.add(new JLabel(messages[i]));
           textFields[i] = new JTextField();

       JOptionPane.showConfirmDialog(parentComponent, panel, 
               "Input", JOptionPane.OK_CANCEL_OPTION);

       for(int i = 0 ; i < messages.length ; i++)
           input[i] = textFields[i].getText();

       return input;
   }//end method

}//end class