Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

05-24-2012 , 12:59 PM
Quote:
Originally Posted by ChazDazzle
The challenge with any venture is figuring
out when you have enough of an application to get it out the door
"If you are not embarrassed by the first version of your product, you’ve launched too late."
--Reid Hoffman
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 01:10 PM
Quote:
Originally Posted by tyler_cracker
"If you are not embarrassed by the first version of your product, you’ve launched too late."
--Reid Hoffman
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 01:20 PM
yeah, that's a good one tyler
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 02:10 PM
Got my acc back xD
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 02:25 PM
Quote:
Originally Posted by Ryanb9
Got my acc back xD
Awesome! Must a complete nightmare for the mods trying to verify each account individually.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 03:29 PM
Quote:
Originally Posted by tyler_cracker
given how new this subforum is i assume most of you have other home subfora and have seen this, but in case you haven't: you should definitely, definitely come to the 2+2 meetup in vegas on july 6th:

http://forumserver.twoplustwo.com/10...thread-1202646

this will be my 5th one and they are an amazingly good time if you enjoy poker at all. and if you don't enjoy poker, i'm good for at least one hike on mt. charleston that weekend!

(kerowo, i'm looking in your direction particularly. you're on the right-side-up part of the world now and everything.)
Crap, I'm not going to have the money this year and we're hiking up Grays the next weekend so I'll definitely be walking uphill somewhere that weekend.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 06:20 PM
Quote:
Originally Posted by gaming_mouse
Quote:
Don't worry, be appy.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-24-2012 , 09:08 PM
Quote:
Originally Posted by gaming_mouse
Quote:
It works in RubeGoldberg 2.2 but will not autocompile freeway buttmonkey merge svn commitshare javahunk.
This was a deal-breaker for me.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 01:22 AM
I wanted to use IE6 on my Blackberry Wi-Fi Commodore64 KitchenAid Caveman extended fingernails toejam 2.0 but was pissed to see it only supported IE6 mobile. WTF build a cross-platform framework you jerks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 01:43 AM
the great thing is how only slightly off it is from the real-world projects it parodies
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 02:01 AM
wait, that's a parody?

Last edited by tyler_cracker; 05-25-2012 at 02:03 AM. Reason: if it hits a major news site, someone will write code under this project's banner
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 02:18 AM
in fact, my pony was slow:

https://github.com/impressivewebs/HT...Boilerstrap-js

!

p.s. i'm too tired to sort this out and too scared to just run it and see what it does:

https://raw.github.com/impressiveweb...boilerstrap.js
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 07:18 AM
Quote:
Originally Posted by tyler_cracker
"If you are not embarrassed by the first version of your product, you’ve launched too late."
--Reid Hoffman
That's a pretty horrible mantra in many areas of business. No silver bullets in business strategy
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 12:38 PM
Quote:
Originally Posted by tyler_cracker
in fact, my pony was slow:

https://github.com/impressivewebs/HT...Boilerstrap-js

!

p.s. i'm too tired to sort this out and too scared to just run it and see what it does:

https://raw.github.com/impressiveweb...boilerstrap.js

he's just having some fun, it produces this image:

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 02:36 PM
I have a settings menu that lets you turn on or off different settings. I'm wondering how I should convey this information to the classes that need it. Should I have public static bools? I'm in c# right now, so maybe make turning a setting on or off fire an event that each relevant class would subscribe to? That seems more OOP but it also seems like a lot of code when 4 public static bools would do the job... ideas? err, instead of bools I guess I mean properties so that it can be readonlyish by other classes.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 02:58 PM
RyanB, here's how I might go about it:

Code:
public class UserSettings
{
    public bool emailMe { get; set; }
    public bool rememberMe { get; set; }
    public bool autoLogout { get; set; }
    public string profileBackgroundColour { get; set; }

    public UserSettings(int userID)
    {
        using (var db = new DataContext())
        {
            var q = (from c in db.tblUserSettings where c.UserID == userID select c).SingleOrDefault();
            if(q!=null)
                LoadByRec(q);
        }
    }
    public UserSettings(tblUserSettings rec)
    {
        LoadByRec(rec);
    }
    private void LoadByRec(tblUserSettings rec)
    {
        emailMe = rec.emailMe;
        rememberMe = rec.rememberMe;
        autoLogout = rec.autoLogout;
        profileBackgroundColour = rec.profileBGColour;
    }
}
Then you can do something along the lines of:

Code:
var usersSettings = new UserSettings(loggedInUser.ID);
if (usersSettings.emailMe)
    SendEmail();
If you want it to do something when the value is changed, look at how getters and setters work:

http://bytes.com/topic/c-sharp/answe...tter-methods-c

So for example, when a new value is set the setter can update the DB, or whatever you want it to do.

Last edited by Gullanian; 05-25-2012 at 03:03 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 03:45 PM
Doesn't C# have properties as part of classes? Granted I only read about an inch and half of the 2 feet of C# books I picked up over the years but I seem to remember that.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 08:52 PM
What Gullanian posted includes the short hand for properties. However, the C# convention is to use UpperCamelCase instead of lowerCamelCase.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-25-2012 , 11:23 PM
Thanks but what I mean is more along the lines of what do do inside of
Code:
if (usersSettings.emailMe)
For instance... this userSettings instance is going to be in a class, and other classes will need to know the value of it.
Say I have three classes that do three different things based on if a settings bool is true or false. When the user changes that setting from false to true, I'm wondering how I should convey that information to the classes that need the information. I was wondering about events or maybe just a public (i.e. globalish) property. Or what the "standard" or "good" thing to do in this situation is.

Also, is there such a thing as.... Say I want to pass two things to a function / method / whatever you call it that takes parameters. I kinda want to do something where the first thing passed is used in that function to do a check. If the check passes (is true), the second parameter is passed but if not dont bother passing it. So I guess I want to combine two functions (a "check" function and a "do" function) into one function. Is this possible? I am thinking that its not.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2012 , 12:04 AM
Quote:
Originally Posted by Ryanb9
Say I have three classes that do three different things based on if a settings bool is true or false. When the user changes that setting from false to true, I'm wondering how I should convey that information to the classes that need the information. I was wondering about events or maybe just a public (i.e. globalish) property.
it depends on what you're trying to do. if you need something to happen immediately -- user clicks "black and white mode" and expects everything in the workspace to change colors -- you'd use some kind of event listener. i don't know how c# works but generally your classes "subscribe" to some event. when that event happens, a method is called on each of your classes (this is an example of a "callback"). these methods are where you implement the behavior (set bg=black; set fg=white).

if it's a setting like sendEmail, you don't need all this. you just check it whenever the thing happens where you might send an email:

Code:
if badThingHappened:
  reportToUser(badThing)

def reportToUser:
  statusBar = "Error: " + badThing
  log(badThing)
  if self.sendEmail:
    emailUser(badThing)
btw this:

Quote:
Or what the "standard" or "good" thing to do in this situation is.
is exactly the right thing to be thinking about here.

Quote:
Also, is there such a thing as.... Say I want to pass two things to a function / method / whatever you call it that takes parameters. I kinda want to do something where the first thing passed is used in that function to do a check. If the check passes (is true), the second parameter is passed but if not dont bother passing it. So I guess I want to combine two functions (a "check" function and a "do" function) into one function. Is this possible? I am thinking that its not.
i don't understand why you would need to do this. can you give an example?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2012 , 12:29 AM
Okay thanks. And yeah my current program seems to be very heavy on events and subscribers. Coming from C++ this seems a little weird because you dont control the exact flow but at the same time it feels nice because you dont have to care. The main reason for asking my original question was the thought that 4 public static properties would take 4 lines of code, followed by if(CApp.Settings.Setting1)
do this()
in any class that needs it, where as with the events its like I have a bool in each class that is Setting1 (true or false) and I have a subscribing method that sets this individual method to true or false whenever the event fires, and then i do
if(CApp.Settings.Setting1)
do this()
Because I have a loop that happens in all my classes nonstop while the program is running, and what settings are on or off changes what happens in those loops, its not a one time done deal, they all would need their own "is setting1 on or off right now" during the loops.

So im kinda wondering if there is a cutoff line where the gain from events is outweighed by the limited amount of data or results that those events trigger (i.e setting one bool in the opposite status). I mean I made a Timer class that sends events to any subscribers when that timer has expired and I love it dont get me wrong events are cool but, wondering if public static properties are sometimes okay or if its always frowned upon.

Quote:
Originally Posted by tyler_cracker
i don't understand why you would need to do this. can you give an example?
I dont need it, I just thought it would be cool =P
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2012 , 04:36 PM
Quote:
Originally Posted by Ryanb9
I mean I made a Timer class that sends events to any subscribers when that timer has expired and I love it dont get me wrong events are cool
in general, don't write your own Timer class .

Quote:
but, wondering if public static properties are sometimes okay or if its always frowned upon.
ok i think i finally understand what you want to do: you basically want global state.

i guess for something small or for interface things it could make sense, but basically it's a slippery slope and you're better off without it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-26-2012 , 07:16 PM
Quote:
Originally Posted by tyler_cracker
in general, don't write your own Timer class .



ok i think i finally understand what you want to do: you basically want global state.

i guess for something small or for interface things it could make sense, but basically it's a slippery slope and you're better off without it.
thank you.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
05-27-2012 , 11:22 AM
I dont know if it deserves its own thread and I tried searching, because its probably been asked before, but nothing turned up.

Is there a way for me to get Matlab to use a poker odds calculator - e.g. Pokerstove or ProPokerTools?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m