Comment on: Learning the ultimate basics of Python, need help with one problem
0 23 Oct 2019 22:55 u/auto_turret in v/programmingComment on: Software Disenchantment
I especially appreciate this quote from the essay:
A DOS program can be made to run unmodified on pretty much any computer made since the 80s. A JavaScript app might break with tomorrow’s Chrome update
Comment on: WPF C#: Static classes, when to use them?
Scratch the last comment, got rid of the static from SerialPort too. I think I've pretty much got this concept down, now. Been banging my head for a month, then finally came to you guys for advice. Turns out that's exactly what I needed!
Comment on: WPF C#: Static classes, when to use them?
On top of that IoC, actually explodes the amount of code that you need exponentially to do the exact same job.
Exactly what I observe. Coming from firmware programming where sometimes your usable ram is measured in BYTES, I kept initially gravitating towards trying to make every bit and byte count. Well, it just don't work that way in Windows app coding..
I can see how it could be quite helpful in swapping modules down the road, and my small app so far seems it could be easily followed and understood without excessive commentary.
Comment on: WPF C#: Static classes, when to use them?
I've re-written the darn thing again, but this time using the dependency inversion principle. NOW things make more sense.. high level modules don't depend on lower level modules, but rather abstractions that don't rely on details.
Works for everything BUT the serialport functions. It appears it must be static or my port won't stay open.
Comment on: WPF C#: Static classes, when to use them?
Cool man, I did use something exactly like that to access my Receive() in my CaptureEngine class from my RS232Functions class. Something to the effect of
private RS232Functions _instance = new RS232Functions(); public RS232Functions Instance { get { return _instance; } }
and
// Create function call on data received serial.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(CaptureEngine.Instance.Recieve);
to use it.. so far that's been working out for me.
Comment on: WPF C#: Static classes, when to use them?
Thanks for the reply. I'm drawing out my program for the umpteenth time, it is slowly starting to click I think..
I believe my trouble is, I keep reverting to thinking like I'm coding a microcontroller which keeps me running into roadblocks.
Referencing your code: I see what you did there, didn't realize I could pass along the whole instance and it's current state.
I believe now, if I put an event listener in that ViewModel constructor instead, and stick _channelModel = channelModel in a method that will call, it should listen for a newdata available event and update itself accordingly, so long as I've created a new ViewModel instance in my main program.
I'll give it a shot. Thanks man, that was super helpful. Going to check out the links you've provided.
WPF C#: Static classes, when to use them?
1 0 comments 20 Jun 2018 22:03 u/auto_turret (self.programming) in v/programmingComment on: Coding Saves
That whore couldn't work the copy machine.
Comment on: What are you guys learning at the moment?
Building a platform to accept most forms of industrial sensors, inputs, modbus, the whole nine yards. My prototype version will have a real AY-3-8910 sound chip.. for fun. Also first time I'm playing around with an FT800 touchscreen display driver.. also for fun.
Comment on: My Boys Birthday Present.
I would have loved to be introduced to this type of shit when I was a young lad. I didn't discover it until I was in my mid-20's.
Use the raw_input() function if using python 2, or input() function if using python 3.
var = input("Prompt text")
Should wait for user input, and return typed string after user presses enter.
Then you can test the string against your passcode and print message