Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Graviton v2
Mar 2, 2007

by angerbeet

TasteMyHouse posted:

If you mean the .NET class Mutex then I'd need more explanation.
I do but im not confident enough in it to give you solid advice/example. Pretty well documented everywhere though.

Adbot
ADBOT LOVES YOU

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

TasteMyHouse posted:

I don't quite get what you're saying here. The main thread is calling WaitFor(). How is it waiting for a result? How does it get notified?

You have to split the flow of your main program between something that starts listening to the port and something that gets called when the data from the port meets whatever condition you require. In the (very sloppy untested quickie) example code below, WaitFor begins listening to the SerialPort and ProcessInput gets called back to when the regex hits a match.

The nice thing about this setup is that the main thread isn't blocked at any time and everything is driven by the serialPort's DataReceived event. The bad thing is that the logic is split between the caller and callback methods which makes for hard to read code. The new Async system does all this crap under the hood and gives you a much nicer fall-through from one line of code to the next.

code:
delegate void CallbackDelegate(string data);

    class Program
    {
        static void Main(string[] args)
        {
            PortListener portListener = new PortListener(new SerialPort());

            // call ProcessInput when the regex hits a match
            portListener.WaitFor(new Regex("my pattern"), ProcessInput);

            Console.ReadLine();
        }

        public static void ProcessInput(string data)
        {
            Console.WriteLine("New data: " + data);
        }
    }

    class PortListener
    {
        SerialPort serialPort;
        string dataBuffer = "";
        Regex regex;
        CallbackDelegate callback;

        public PortListener(SerialPort serialPort)
        {
            this.serialPort = serialPort;
        }

        public void WaitFor(Regex regex, CallbackDelegate callback)
        {
            // start listening to data port
            this.regex = regex;
            this.callback = callback;
            dataBuffer = "";
            serialPort.DiscardInBuffer();
            serialPort.DataReceived+=new SerialDataReceivedEventHandler(serialPort_DataReceived);
        }

        void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            // add new data to buffer
            dataBuffer += serialPort.ReadExisting();

            // check for a valid new line
            if (regex.IsMatch(dataBuffer) && callback != null)
            {
                //stop listening to port and return result
                serialPort.DataReceived -= serialPort_DataReceived;
                callback(dataBuffer);
            }
        }
    }

PDP-1 fucked around with this message at 16:35 on Aug 18, 2011

thecopsarehere
Jul 25, 2008

I'm pretty new at this stuff so bear with me.

I'm revamping my school's website and I'm at the point where I've got a good template for the whole site. This mainly entails a change to the first 150 or so lines of html for each page. What I'm looking for is a way to replace those lines with the code I've come up with in some kind of batch format so I don't have to go through every page and do it manually. HTML-Kit has a plug-in that does this but seemingly only for one word at a time. Does anything like this exist? Preferably for free.

E: Nevermind, figured out that I could use a program called "Replace Text" and do about 4 smaller changes rather than changing the whole block of code.

thecopsarehere fucked around with this message at 19:45 on Aug 18, 2011

TasteMyHouse
Dec 21, 2006

PDP-1 posted:

You have to split the flow of your main program between something that starts listening to the port and something that gets called when the data from the port meets whatever condition you require. In the (very sloppy untested quickie) example code below, WaitFor begins listening to the SerialPort and ProcessInput gets called back to when the regex hits a match.

The nice thing about this setup is that the main thread isn't blocked at any time and everything is driven by the serialPort's DataReceived event. The bad thing is that the logic is split between the caller and callback methods which makes for hard to read code. The new Async system does all this crap under the hood and gives you a much nicer fall-through from one line of code to the next.

code:
delegate void CallbackDelegate(string data);

    class Program
    {
        static void Main(string[] args)
        {
            PortListener portListener = new PortListener(new SerialPort());

            // call ProcessInput when the regex hits a match
            portListener.WaitFor(new Regex("my pattern"), ProcessInput);

            Console.ReadLine();
        }

        public static void ProcessInput(string data)
        {
            Console.WriteLine("New data: " + data);
        }
    }

    class PortListener
    {
        SerialPort serialPort;
        string dataBuffer = "";
        Regex regex;
        CallbackDelegate callback;

        public PortListener(SerialPort serialPort)
        {
            this.serialPort = serialPort;
        }

        public void WaitFor(Regex regex, CallbackDelegate callback)
        {
            // start listening to data port
            this.regex = regex;
            this.callback = callback;
            dataBuffer = "";
            serialPort.DiscardInBuffer();
            serialPort.DataReceived+=new SerialDataReceivedEventHandler(serialPort_DataReceived);
        }

        void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            // add new data to buffer
            dataBuffer += serialPort.ReadExisting();

            // check for a valid new line
            if (regex.IsMatch(dataBuffer) && callback != null)
            {
                //stop listening to port and return result
                serialPort.DataReceived -= serialPort_DataReceived;
                callback(dataBuffer);
            }
        }
    }

I'm sorry if I wasn't clear, but I WANT the main thread to block. There might be tons of different things that I want to do sequentially, calling WaitFor each time.
Like the following pseudocode...
code:
...initialization code...
...code that commands the device test chamber to go to a certain temperature...
WaitFor(command_prompt);
Write(query_processor_temperature_loop_command);
WaitFor(desired_processor_temperature);
...some code that runs various tests on the processor at that temperature...
...some code that sets a different temperature...
Write(ctrl+c);
WaitFor(command_prompt);
Write(query_processor_temperature_loop_command);
WaitFor(desired_process_temperature);
etc etc. I need to completely halt execution of the script while it is waiting for that particular match.

nielsm
Jun 1, 2009



TasteMyHouse posted:

I'm sorry if I wasn't clear, but I WANT the main thread to block. There might be tons of different things that I want to do sequentially, calling WaitFor each time.
Like the following pseudocode...
code:
...initialization code...
...code that commands the device test chamber to go to a certain temperature...
WaitFor(command_prompt);
Write(query_processor_temperature_loop_command);
WaitFor(desired_processor_temperature);
...some code that runs various tests on the processor at that temperature...
...some code that sets a different temperature...
Write(ctrl+c);
WaitFor(command_prompt);
Write(query_processor_temperature_loop_command);
WaitFor(desired_process_temperature);
etc etc. I need to completely halt execution of the script while it is waiting for that particular match.

I would suggest writing it as an explicit state machine, taking the input asynchronously. That way you should be able to better deal with the device doing something unexpected.

Basically, enumerate all steps in the ideal process. Every time you need to wait for anything from the device, you enter a new state. Give each state a number and, ideally, also a name.
Draw a state diagram of the basic flow.
Now, enumerate all the kinds of inputs you can receive from the device. For each transition in your current state diagram, label the actual input required to complete the transition.
Then, for each state, figure out what would be sensible to do if any other possible input is received from that state. You may need to create new states for this. (Most of these would probably be error states.)
You should now have a state diagram where you will be able to handle any situation that can occur. Now you can start writing code.

Make sure to include your state diagram with your code in one way or another, as documentation. Otherwise, it will be really hard to follow! (That's the downside of this approach.)

TasteMyHouse
Dec 21, 2006

nielsm posted:

I would suggest writing it as an explicit state machine, taking the input asynchronously. That way you should be able to better deal with the device doing something unexpected.

Basically, enumerate all steps in the ideal process. Every time you need to wait for anything from the device, you enter a new state. Give each state a number and, ideally, also a name.
Draw a state diagram of the basic flow.
Now, enumerate all the kinds of inputs you can receive from the device. For each transition in your current state diagram, label the actual input required to complete the transition.
Then, for each state, figure out what would be sensible to do if any other possible input is received from that state. You may need to create new states for this. (Most of these would probably be error states.)
You should now have a state diagram where you will be able to handle any situation that can occur. Now you can start writing code.

Make sure to include your state diagram with your code in one way or another, as documentation. Otherwise, it will be really hard to follow! (That's the downside of this approach.)
I wanted to avoid doing things entirely synchronously so that I could have the ability to send ^C -- I need the read to happen on a different thread from the writing so that reading doesn't block writing.

nielsm
Jun 1, 2009



TasteMyHouse posted:

I wanted to avoid doing things entirely synchronously so that I could have the ability to send ^C -- I need the read to happen on a different thread from the writing so that reading doesn't block writing.

That's exactly what I'm suggesting!

Your state transitions would happen when an input from the device is matched, and while waiting for that to happen you'd be sitting in, well, whatever you want.
However, the way I read your post above (which I quoted before) you were suggesting turning the asynchronous processing into a synchronous process.

TasteMyHouse
Dec 21, 2006

nielsm posted:

That's exactly what I'm suggesting!

Your state transitions would happen when an input from the device is matched, and while waiting for that to happen you'd be sitting in, well, whatever you want.
However, the way I read your post above (which I quoted before) you were suggesting turning the asynchronous processing into a synchronous process.

Oh pfft I misread your "asynchronous" as "synchronous".

The crux of what I'm looking for here is the "sitting in, well, whatever you want." -- right now I'm doing this:
code:
//! halts execution until the serial port spits out something that matches "regex_"
public void WaitFor(string regex_)
{
    if(Monitor.TryEnter(regex_lock,LockTimeout))
    {
        try
        {
            regex=regex_;
        }
        finally
        {
            Monitor.Exit(regex_lock);
        }
    }
    else
    {
        throw new RegexLockException("update",LockTimeout);
    }

    while (!m_success)
    {
        Thread.Sleep(50);
    }
    m_success = false;
    if (Monitor.TryEnter(regex_lock, LockTimeout))
    {
        try
        {
            regex = MatchNone;
        }
        finally
        {
            Monitor.Exit(regex_lock);
        }
    }
    else
    {
        throw new RegexLockException("nullify",LockTimeout);
    }
    Thread.Sleep(50);
}
and I don't really like it at all. I would rather replace that while loop with something like

code:
lock(regex_success)
{
    do_a_thing();
}
where regex_success is an object that remains locked by another thread until a match is found. I don't know how to do this, so my while loop there is just spinning, checking every 50ms to see if the other thread has set m_success.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I think this design doesn't make a whole lot of sense, but I'll leave that up to you and just tell you how to accomplish the synchronization correctly.

The waiting thread should do this:

code:
lock (regex_lock) {
  assert(regex == MatchNone);
  regex = regex_;
  Monitor.Wait(regex_lock);
  assert(regex == MatchNone);
}
And the matching thread should do this:

code:
lock (regex_lock) {
  while (true) {
    if (regex == MatchNone) Monitor.wait(regex_lock);
    assert(regex != MatchNone);
    // There's now a thread waiting on the lock.

    // read input until a match is found

    // Clear out the regex we were matching and wake up the other thread.
    regex = MatchNone;
    Monitor.Pulse(regex_lock);
  }
}
This assumes that there's exactly one waiting thread and one matching thread. It also relies on the fact that C# condition variables don't allow spurious wake-up; in Java you'd need to handle that possibility after wait().

1337JiveTurkey
Feb 17, 2005

With all this talk about mutexes and manual synchronization, why not just use some sort of blocking queue for data in and one for data out and/or instructions like "shut down". You're going to have to solve the same problems a blocking queue does regardless so it'd be easier to use one from the start.

TasteMyHouse
Dec 21, 2006

rjmccall posted:

I think this design doesn't make a whole lot of sense

By all means, please tell me what you think would be better!

quote:

code:
lock (regex_lock) {
  while (true) {
    if (regex == MatchNone) Monitor.wait(regex_lock);
    assert(regex != MatchNone);
    // There's now a thread waiting on the lock.

    // read input until a match is found

    // Clear out the regex we were matching and wake up the other thread.
    regex = MatchNone;
    Monitor.Pulse(regex_lock);
  }
}


I'd love to do that -- the problem is that I have no way of knowing if the serial port is done getting data. The partial lines I receive from the port can either be line-chunks that need to be concatenated with the next chunk that comes down the line, OR they could be the end of data, because shell prompts don't end in newlines. Therefore, I can't just match on known complete lines -- I have to match on partial lines as they come in, too. The simplest way to handle this was to have the data received callback perform the matching -- this means that there isn't a persistent thread performing the matching to retain a lock like you suggested.

I could have a persistent thread performing matching, that waits on the data received callback to shove unprocessed data into a queue, but then I'd just have to solve the problem of THAT thread waiting.

TasteMyHouse fucked around with this message at 22:55 on Aug 18, 2011

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

TasteMyHouse posted:

The simplest way to handle this was to have the data received callback perform the matching -- this means that there isn't a persistent thread performing the matching to retain a lock like you suggested.

This is really a very minor problem; it means your callback basically does:

code:
lock (regex_lock) {
  if (regex && /* matches */) {
    regex = MatchNone;
    Monitor.Pulse(regex_lock);
  }
}
But this just exposes an already-latent problem in your design where the data-received callback can get notified while the next regex hasn't been set yet, and then that data presumably just gets tossed and maybe the regex never matches.

TasteMyHouse posted:

By all means, please tell me what you think would be better!

You really need the "here's what comes next" logic to be fully synchronized with the input stream. Either you write a state machine that's directly advanced by the receive callback, and the main thread just blocks until that finishes (using a simple Wait/Pulse setup), or you make the receive callback queue all the input up to be processed by a different thread (probably the main thread, and WaitFor would just pull chunks of input off a blocking queue like 1337JiveTurkey suggested).

ETA: The queuing approach is much cleaner, but if it requires copying the input stream, then it might be an unacceptable bottleneck on performance.

rjmccall fucked around with this message at 23:35 on Aug 18, 2011

TasteMyHouse
Dec 21, 2006

rjmccall posted:

This is really a very minor problem; it means your callback basically does:

code:
lock (regex_lock) {
  if (regex && /* matches */) {
    regex = MatchNone;
    Monitor.Pulse(regex_lock);
  }
}

AHH pff Okay, I get it now. When I read the documentation for Monitor.Wait, and it said "Releases the lock on an object and blocks the current thread until it reacquires the lock," I didn't realize that only a call to "Pulse" would allow it to reacquire the lock. This is the critical piece of understanding I was missing and now everything is simple.

quote:

But this just exposes an already-latent problem in your design where the data-received callback can get notified while the next regex hasn't been set yet, and then that data presumably just gets tossed and maybe the regex never matches.

Good point. For now I'll change it from WaitFor(regex) to AskFor(string_to_write,regex).

TasteMyHouse fucked around with this message at 00:15 on Aug 19, 2011

The Gloaming
Apr 2, 2008

by Ralp
Sorry for posting this here as I know people can care less about the whole Lulzsec The Jester hacker fight. I am just curious and have been unable to figure out exactly what this is. I am assuming it is a type of encryption. But, I only have had Basic 1 so far, heh.

This is what the code looks like copy and pasted, on twitter, and in HTML. Any Ideas on what it is or how to make my own or read it?

c̘͕͈̩͈2̼͔̺͚d̬̟͖c̱͈͈̜37̪͖a͍7̺̥d9̮̲̝̖d̞͕̣3̙̫̙̣2̤3̬8̠7̥̠͙7̗͇̞̼a1̩̼̜͙͓̣2͙̮̤̙̥7̥͓͔̠̩f2̰̜̰ḓ̙̤ͅ51̗͈̱͖7̻͇̦͖1̦͕͇c̫͈̲9͚d̯͓





Thanks!

Graviton v2
Mar 2, 2007

by angerbeet

The Gloaming posted:

Any Ideas on what it is or how to make my own or read it?
Read it? gently caress no there are many different methods. High bit encrpytion could take a supercomputer 1000's of years to crack. This isnt WW2 in the UK anymore. (enigma machine etc)

Make your own? Freeware modules out there everywhere. Whats your language of choice?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

The Gloaming posted:

I am just curious and have been unable to figure out exactly what this is.

http://www.eeemo.net/

tef
May 30, 2004

-> some l-system crap ->
an md5sum ?

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?
I refuse to get involved in cryptic messages when the author can't even manage to spell 'potato'.

edit:
If you're asking about building your own encryption scheme, you should use an existing one if it's for use with anything you value. Many, many people with much better qualifications and experience than you, me and I'm betting anyone in this thread have spent years building and attempting to break the algorithms we have today, such as RSA and AES.

That said if you don't want to use it for anything critical then it's a decent project to learn a few things. Back when I used IRC a lot (and was still in school) I made a very simplistic mIRC channel encryption script which relied on a pre-shared one time pad and, since the OTP was used over and over again (hence fairly easy to break) an algorithm which shuffled the word order of sentences to defeat basic sentence analysis. It wouldn't keep GCHQ busy for more than 5 minutes but was fine for discussing raiding strategies for browser-based MMORPGs.

rolleyes fucked around with this message at 20:36 on Aug 21, 2011

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

rolleyes posted:

I refuse to get involved in cryptic messages when the author can't even manage to spell 'potato'.

it looks like it is a cropped screenshot in which case the word may have been "potatoes"?

The Gloaming
Apr 2, 2008

by Ralp
Thanks wound up learning a lot more than I set out to. I am assuming it is some code using that eeemo.net app or a new type of "1337 speak" from what I have Googled about it. Just a more complicated version of the scrambler apps that people use to make MMO names with weird characters.

As for building my own; I brought up the idea at the programmers club at school and everyone seems to be fine with what is already out there. Probably for the best as from what you all have said this is WAY above my level.

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

The Gloaming posted:

Thanks wound up learning a lot more than I set out to. I am assuming it is some code using that eeemo.net app or a new type of "1337 speak" from what I have Googled about it. Just a more complicated version of the scrambler apps that people use to make MMO names with weird characters.

As for building my own; I brought up the idea at the programmers club at school and everyone seems to be fine with what is already out there. Probably for the best as from what you all have said this is WAY above my level.

Well as I said if you're not securing anything of value then it can be a good project to learn a few things. As you've mentioned a club you could all come up with your own schemes then try to break each other's, there's plenty of info on basic cryptanalysis out there.

rikatix
Aug 24, 2010
Hello all!

I've been wanting to learn some programming so I decided I would download the newest version of VB from Microsoft and start messing around with it. It is what I used when I was a junior in high school 8 years ago so I figured it would be easier to step into vs. other languages.

That being said I'm trying to come up with what I imagine to be a very simple program that, when you click a button, displays a MsgBox that contains a random list of 14 names that are entered into the code.

I have to admit I have not taken baby steps at all so what I've come up with is a hodge podge of code that I don't necessarily understand but here is what I've got. As you can see this code randomizes the names and selects one, I want a list of all names randomized.

code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim name As New ArrayList
        name.Add("Philip Heath")
        name.Add("Matthew Frazier")
        name.Add("Michael Day")
        name.Add("Justin Dixon")
        name.Add("Ryan Doyle")
        Dim random1 As New Random
        Dim namelist As String = name.Item(random1.Next(0, name.Count))
        MsgBox(namelist)
    End Sub
End Class
And yes I want 14 names eventually, the ones I've entered here are just to make sure the program is working.

I thank you all for your help.

p.s. can anyone recommend a VB tutorial website? C# would be cool too.

TasteMyHouse
Dec 21, 2006
MsgBox takes a single string as input, right? and you want to display all of your names, in random order, right? So what you're going to have to do is concatenate those strings into one big string, and do that in random order, then feed that big string to the messagebox.

Graviton v2
Mar 2, 2007

by angerbeet
Use a local collection class instead of that array list stuff. The built in methods on it are much easier to use.

thepedestrian
Dec 13, 2004
hey lady, you call him dr. jones!
I am hoping to design a site for people looking to share pictogram illustrations used for communication by children with intellectual disabilities. I am trying to find the right CMS for what I am looking to accomplish. I want people to be able to get accounts and upload their own pictograms. Being able to choose a license and the ability to tag pictograms and put them into user defined lists would be great. Secondly, I want anyone to be able to download pictograms in various printable formats (jpg/png/pdf) with predefined or custom captions without an account.

I've looked at a bunch of image gallery CMSes and plugins for Wordpress, Drupal, etc. but I haven't been able to find something that will accomplish what I am trying to do. Does anyone know a CMS or plug-in that can do this?

Graviton v2
Mar 2, 2007

by angerbeet

rikatix posted:

p.s. can anyone recommend a VB tutorial website? C# would be cool too.
Id recommend going straight to c#, its the same thing, but quicker to use with a little more control. Have a look at these:

http://en.wikipedia.org/wiki/Bytecode

http://en.wikipedia.org/wiki/Common_Intermediate_Language

As for tutorials, there are no stand out examples in my mind. Plenty out there, hit up google :)

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

rikatix posted:

p.s. can anyone recommend a VB tutorial website? C# would be cool too.

As it sounds like you're new to software development, if you do go with C# as Graviton suggested and have a little money to spare I would recommend this book. It will start you from absolute basics (or show you where to skip to if you already know certain concepts) and so might seem like slow going, but you'll get a good understanding of the language concepts before diving into GUI applications and such.

I'm not saying it's perfect because it isn't* but it's a very good starting point for someone new to the game, and all of the examples and techniques it teaches work with the Express edition of Visual Studio so you don't need to lay out for software.



*Probably its main failing is that the chapter on LINQ tries to do too much by going beyond the syntax and attempting to explain the underpinnings and makes a bad job of it, but then LINQ is an entire book all by itself so can be investigated afterwards if you really want to get into things like expression trees.

pathetic little tramp
Dec 12, 2005

by Hillary Clinton's assassins
Fallen Rib
I'm a webdesigner with a good deal of experience in javascript and I vaguely vaguely touched on Perl ages ago, but am cracking open my Llama book this weekend.

Anyway, the company I work for has some really really outofdate junk doing really important things on the backend and as a way to prove myself more useful (and hopefully help myself get my neck back into the programming way of things for a perl/javascript dev job opening up soon), I've been checking out some of the backend stuff to make a list of "poo poo that needs fixed."

And I came across this odd chunk of programming code. I don't know what language this syntax belongs to. Anyone with better knowledge wanna school me or is this some proprietary programming language for some godforsaken reason:

<<FOR::BEGIN(DOW)::>> <<FOR::END(DOW)::>> <-- This runs a for loop with DOW being a variable meaning Day of Week.... which is a variable declared as a range of dates...

and if statements are made like this:

<<::VAR::<<var_name>>:print:somethingthatgetsprintedifthevarexists::ENDVAR>>

I've never seen anything like it, anyone want to help?

pathetic little tramp fucked around with this message at 04:25 on Aug 24, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

pathetic little tramp posted:

<<::VAR::<<var_name>>:print:somethingthatgetsprintedifthevarexists::ENDVAR>>

I can't tell you what language it is but it looks suspiciously like a (n ugly) hand-rolled templatey language.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
which has been extended far beyond its original capabilities by people who had no idea what they were doing

so basically php but even worse

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?
Thirding that, if you value your sanity try not to get involved with maintaining things written with it and certainly don't volunteer to build new stuff with it. Even if there's documentation (which as you're asking the question I'm guessing there isn't) it's going to be a whole can-o-worms.

If people are looking to you to get fixes done then I'd suggest moving to something else - even if you go with PHP then at least it's a standard language so someone else can look at the code later and be able to maintain it.

rolleyes fucked around with this message at 08:48 on Aug 24, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I guess I could be more helpful.

Better template languages: jinja, liquid, mustache (all have ports for many languages so poke around).

raminasi
Jan 25, 2005

a last drink with no ice
We have a thrown-together C# application that basically invokes a bunch of little applications, in sequence, on a whole bunch of input files. The problem is that sometimes the little applications crash, and the entire program then sits there waiting for a user to click "ok go away" in the unhandled exception popup. We want it to just skip those cases and continue. I'm sure there's a trivial way to deal with this but I just don't know it.

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?
Wait, is the exception occurring in your application or in one of the little applications?

raminasi
Jan 25, 2005

a last drink with no ice
One of the little ones.

TasteMyHouse
Dec 21, 2006
Are the Little applications .NET? if they are, just add them to the master program as assemblies and use them internally instead of as subprocesses; then you can catch whatever exceptions happen however you want.

If they're not, all I can think of is a time-out that kills the process if it doesn't return after n milliseconds

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

If you have programmatic access to the little applications you can also improve the exception handling so it reports success/failure state instead of out and out throwing an exception, but I'm guessing you don't.

raminasi
Jan 25, 2005

a last drink with no ice
The little programs are ours, and while the ideal solution is "just don't make them crash" I don't know why I didn't just think to wrap each of them (internally) with a try/swallow as a stopgap solution.

Superhaus
Jun 9, 2003

I'm probably wasting time right now.
I am not sure if this is the right thread, but it seems like a good catch-all.

I graduated with a CS degree 6 years ago and I have been doing user support ever since. I have not programmed a thing since college. Things are looking bleak at work, and I really want to get back into programming anyway, so I would really like to scrape the rust off, but I am not sure where to start. As bad as it sounds (I know, do it because you love it...) I want to start where I can make the quickest transition out of user support and into something else.

The only languages that I studies in school were C and C++. I have heard good things about Java marketability, and I am interested in mobile app development, so those are a couple of places that I was thinking about starting. Am I better off getting a book to pick up the fundamentals? Are there good iTunes U courses out there that I can download and follow?

I would love a kick in the right direction.

Adbot
ADBOT LOVES YOU

TasteMyHouse
Dec 21, 2006
Mobile app development will be primarily in Java (for Android) and Objective C (for iOS).

As for trying to get a programming job -- check out the "How do I linked list?" thread

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply