|
ulmont posted:I don't disagree with your general breakdown, but when I learned OOP (also ~20 years ago), the emphasis was more about message passing between the objects than the imperative style (which is how I see structured programming). Were you taught using Smalltalk? (genuinely curious). At least in my experience the message passing description/model/terminology was mostly confined to Smalltalk circles. BigRedDot fucked around with this message at 18:39 on Nov 1, 2016 |
# ? Nov 1, 2016 18:37 |
|
|
# ? May 28, 2024 03:13 |
|
I'm relatively new to WPF and I'm developing a small WPF application for my team. How do I style my UI elements without scaring my coworkers who are all familiar with Windows Forms land? There's so many ways to do it! UserControls, Templates, Styles, Theme.xaml(s), etc. The closest thing to it that I've ever used is CSS with HTML and over time it has become apparent to me that it is nothing like CSS.
|
# ? Nov 1, 2016 18:40 |
|
BigRedDot posted:Were you taught using Smalltalk? (genuinely curious). At least in my experience the message passing description/model/terminology was mostly confined to Smalltalk circles. Yup. Structured Programming: C. OOP: Smalltalk. Functional Programming: Lisp. Declarative: Prolog.
|
# ? Nov 1, 2016 19:07 |
|
Star War Sex Parrot posted:It survived probably for a bit longer than it should have as a teaching language, and I had one class not too long ago where the ancient instructor's pseudocode resembled Pascal. As far as I know, it's relatively dead these days. I think Delphi might live on in some weird use cases. DoomRL and other roguelikes written using libvalkyrie are all Pascal.
|
# ? Nov 1, 2016 19:11 |
|
Star War Sex Parrot posted:It survived probably for a bit longer than it should have as a teaching language, and I had one class not too long ago where the ancient instructor's pseudocode resembled Pascal. As far as I know, it's relatively dead these days. I think Delphi might live on in some weird use cases. I guess it's not all that recent, but I had to work on some legacy code in Borland Pascal at a job I held from 2000 to late 2006. I think we had migrated away from the Pascal code pretty completely the last couple of years I was there. One of my first tasks at that job was fixing an error that was showing up on the newer machines trying to run the application. It turns out there was some built-in library that would try to divide by zero if it were run on any machine with a clock speed over 200 MHz. Fortunately, some sad soul had written a replacement for it, so I was able to swap in the replacement library and extend our research app's life by a few more years. I also had to replace a fixed array of structs with a linked list of the same structs in that program, to give it a bit more flexibility. That made use of more memory resources, and we could store up to 88 structs worth of info instead of the 80 the array was limited to. It's kind of a shame that it faded away, really - I liked Pascal's syntax well enough*, but I guess it never became fashionable enough to really keep around. I think Borland extended their Pascal to include classes and objects by the end of its run, but then they discontinued that and put their full efforts into Delphi. My understanding was that Delphi was sort of a Pascal version of Visual Basic, and that people who used it loved it, but again, it never really caught on in a big way. Last I remember, Microsoft hired away the main designer of Delphi to work on C# for them. I imagine Delphi still exists, but I don't even know who owns the rights for it any more. I think Borland was sold/renamed/dissolved multiple times, so there's no telling where the legal rights ended up. * Of course, I haven't used it in over 10 years, and might not like it so much today. Still, it doesn't seem any crazier to think of using Pascal these days than BASIC. I guess BASIC looks a little less intimidating. Peristalsis fucked around with this message at 19:56 on Nov 1, 2016 |
# ? Nov 1, 2016 19:52 |
|
Star War Sex Parrot posted:It survived probably for a bit longer than it should have as a teaching language, and I had one class not too long ago where the ancient instructor's pseudocode resembled Pascal. As far as I know, it's relatively dead these days. I think Delphi might live on in some weird use cases. At my place we bought a smaller company and some of their several-years-old stuff used Delphi. We've not touched it or made any attempt to build it. Due to boneheaded choices and development practices by the previous management of the company, there's a hardcoded IP address in one piece of software to a server that costs an arm and a leg to keep where it is. Thankfully there is only one customer using this software, and although they are a very important customer, we reckon we can just binary-edit the installer (which we have) to substitute a different address of our choice...
|
# ? Nov 1, 2016 20:00 |
|
BigRedDot posted:
I feel like structured programming won so decisively that it's hard to say what it is anymore.
|
# ? Nov 1, 2016 21:05 |
|
BigRedDot posted:Were you taught using Smalltalk? (genuinely curious). At least in my experience the message passing description/model/terminology was mostly confined to Smalltalk circles. Doesn't that describe Erlang now too?
|
# ? Nov 1, 2016 21:11 |
Delphi still exists as a product, but it is largely a specialty thing and I think its main use case is maintaining legacy software by now. Licenses go into the "stupid expensive" range, presumably they have to gouge the few remaining customers to keep Delphi as a product in business. One of the interesting things about Delphi is actually that it goes a very long way to make COM programming easy and much less painful than most other languages will make it. However I never got the fundamental grasp of COM back when I did use Delphi (up until 13 years ago) so I didn't get to reap the benefits of that. But looking back at it, it seems it might be more suitable than C++ for implementing COM servers. Today C# may be a better choice for the most part, but unlike Delphi, C# COM servers will naturally force the client to have the .NET framework loaded in, or the server will have to be out-of-process. Honestly it's not a bad language, it's verbose but the type system is quite expressive.
|
|
# ? Nov 1, 2016 21:20 |
|
Uhh Nope posted:I'm relatively new to WPF and I'm developing a small WPF application for my team. Ask the .NET thread! The short answer to your question is, as usual, "it depends," but if it's a small, internal app then you probably don't need to worry about anything fancy like theming or rolling your own controls.
|
# ? Nov 1, 2016 22:18 |
|
Does anybody know if there's any places online which provide practical SQL challenges? Like they provide you with tables and then ask you to write statements that will return data specified by them. Is this a thing you can find anywhere?
|
# ? Nov 1, 2016 23:59 |
|
I realized I was just kind of asking about non-OO imperative approaches but too tired to figure out how to phrase it, but this all gave me a whole lot of new leads so thank you all so very much!
|
# ? Nov 2, 2016 00:20 |
|
Hammerite posted:I picked up C# "on the job" at my current place, having been comfortable using Python before. These days I have to say I prefer using C#, though I still happily use Python for small stuff. When I have an issue with something in C# it's invariably to do with its nature as a statically typed language (which also is limited occasionally by having to conform to aspects of the .NET environment) - but being statically typed also allows confidence in places you wouldn't necessarily have it if you built a large, complex system in Python. Thanks for this.
|
# ? Nov 2, 2016 01:55 |
|
Peristalsis posted:One of my first tasks at that job was fixing an error that was showing up on the newer machines trying to run the application. It turns out there was some built-in library that would try to divide by zero if it were run on any machine with a clock speed over 200 MHz.
|
# ? Nov 2, 2016 02:19 |
|
everythingWasBees posted:I realized I was just kind of asking about non-OO imperative approaches but too tired to figure out how to phrase it, but this all gave me a whole lot of new leads so thank you all so very much! Note that OO isn't necessarily just an imperative thing. The primary tenet of OOP is "make abstract data types", i.e. you should organize your data into meaningful classes/types/whatever that encapsulate the representation and provide an abstract interface of high-level operations. Mutability makes that really critically important, but even without mutability it's still really important if you have any interest in writing good, maintainable code. Most functional languages do provide some tools for abstract data types, and some (notably OCaml) even support organizing operations into classically OO-style class-namespaced methods, all without pushing you inevitably into the world of mutability. Features like dynamic method dispatch and inheritance are really secondary, but they, too, are not at all incompatible with functional programming.
|
# ? Nov 2, 2016 05:26 |
|
I'm having a hell of a time getting a stupid date-based Regex to work properly for a simple Java assignment. It's just a generic test for yyyy-mm-dd that matches correct total days of the month, but for whatever reason the pattern is just ignoring the last digit in any date I feed in. The frustrating part is the Debuggex site shows the logic is correct in its flow chart, but the result is wrong. There's a ton of example dates in the link below for examples. Debuggex chart: https://www.debuggex.com/r/rBt7UDZNphWSPifs Regex: code:
|
# ? Nov 4, 2016 15:34 |
|
PierreTheMime posted:I'm having a hell of a time getting a stupid date-based Regex to work properly for a simple Java assignment. It's just a generic test for yyyy-mm-dd that matches correct total days of the month, but for whatever reason the pattern is just ignoring the last digit in any date I feed in. The frustrating part is the Debuggex site shows the logic is correct in its flow chart, but the result is wrong. There's a ton of example dates in the link below for examples. The main learning point you should take away from this is that regular expressions are not the answer to every problem. Still... - why is the year part repeated for each month-length part of the regex? Put that once at the start and stick everything else in a bracketed subpattern after it. Doing this I get: (line breaks and leading whitespace are added for readability) code:
code:
code:
However, as to the problem you originally complained about, I haven't identified the problem. Post your test cases?
|
# ? Nov 4, 2016 15:51 |
|
Looking at the linked web page... Your problem is that you're not requiring the match to be the entire string, so the regex engine opportunistically matches e.g. up to the "3" in "30" which is treated as the units digit in the first alternative group; then it ignores the rest. Try adding ^...$ to the pattern.
|
# ? Nov 4, 2016 15:55 |
|
Hammerite posted:- you're not checking that I haven't entered something like 2005-02-29 (2005 is not a leap year) (have fun with that!) Thanks for the input! The leap year check is actually being handled outside of Regex in my assignment by checking the Group month/date and then doing a simple modulus check of the year if they match 0?2 and 29. I assume the professor just doesn't want to get into the weeds of coding that into Regex since this is just meant as an assignment to briefly acknowledge their use. Hammerite posted:Looking at the linked web page... Your problem is that you're not requiring the match to be the entire string, so the regex engine opportunistically matches e.g. up to the "3" in "30" which is treated as the units digit in the first alternative group; then it ignores the rest. Try adding ^...$ to the pattern. Hmm. Would you mind using an example of this? I tried code:
|
# ? Nov 4, 2016 17:02 |
|
PierreTheMime posted:The leap year check is actually being handled outside of Regex in my assignment by checking the Group month/date and then doing a simple modulus check of the year if they match 0?2 and 29. I assume the professor just doesn't want to get into the weeds of coding that into Regex since this is just meant as an assignment to briefly acknowledge their use. If you're going to have to do semantic validation of the date after parsing it anyways, why not just do: code:
|
# ? Nov 4, 2016 17:37 |
|
ToxicFrog posted:If you're going to have to do semantic validation of the date after parsing it anyways, why not just do: Because the instructions of the assignment are to exclusively use the regex pattern with the exception of dealing with leap years, unfortunately. If I could use code this would have been done hours ago.
|
# ? Nov 4, 2016 17:47 |
|
Star War Sex Parrot posted:It survived probably for a bit longer than it should have as a teaching language, and I had one class not too long ago where the ancient instructor's pseudocode resembled Pascal. As far as I know, it's relatively dead these days. I think Delphi might live on in some weird use cases. Pascal was pretty popular in AI research back when I was studying it about a decade ago. I haven't encountered it since.
|
# ? Nov 4, 2016 17:49 |
|
Pattern completed with a little help from a coworker. I hope to never touch more than basic regex again for a long time.code:
code:
|
# ? Nov 4, 2016 18:07 |
|
PierreTheMime posted:Thanks for the input! You might need to make it ^(...)$ rather than ^...$ Also, it seemed to me like that site was trying to treat the entire contents of the text box as the string to be matched, rather than substrings in quotes.
|
# ? Nov 4, 2016 19:32 |
Does anybody have any experience creating/importing new tasks into windows Task Scheduler using .xml files? My problem: I've written a script in python and compiled to .exe so I can share it with people who don't have Python installed. However, this program needs to be run 1x every hour, ad infinitum. If I automatically create a task using batch, such as: code:
One solution is to export the task you want to a .xml file, then reimport that using a .bat file. Great, only there are several variables which need to be configured for each person's computer and I have no idea how to do that. I could import the .xml into Python, generate the values, then import it in via .bat, but I have no idea how to get the values for: <RegistrationInfo><Author> (which looks like: PC-Desktop\Tom) <Principals> <Principal id="Author"> <UserId> (which looks like: S-1-5-21-2071512246-1631738662-3274286287-1001 -- I don't know what this value actually signifies so I changed a few digits) Does anybody know a relatively easy way to overcome this problem? I guess I could bundle it with a 3rd party scheduling daemon and automatically copy a shortcut to that into the startup folder somehow.. but there's got to be some way of automatically configuring a task scheduler .xml file to the current user.
|
|
# ? Nov 6, 2016 14:52 |
Sulla-Marius 88 posted:Does anybody have any experience creating/importing new tasks into windows Task Scheduler using .xml files? Rewrite your tool in PowerShell and use the New-ScheduledTask and family cmdlets to set it up. If you're careful and only use PowerShell 2.0 syntax and features, you're guaranteed anyone with Windows 7 and up can run it, although you'd have to add a digital signature to the script to let them run it without first changing execution policy. (Or you can work around that by launching the script via a batch file that temporarily uses another execution policy.)
|
|
# ? Nov 6, 2016 15:12 |
|
I have a really basic question about *-devel packages (at least on CentOS/RHEL): basically what are they? For example if I look at BLAS I see the following:code:
The second question is, if I do a yum/dnf install blas-devel, do I also need to install blas as well? Third question is something I just noticed when writing this. What is the static library? I've seen other packages have a static package too.
|
# ? Nov 7, 2016 08:09 |
The "blas" package contains the dynamically linked runtime libraries. You need this to run a program that links dynamically against BLAS. The "blas-devel" package contains the headers required to compile a program against the BLAS library. Only required to compile programs, not to run them. The "blas-static" package contains libraries for linking statically to, when compiling programs. Only required to compile programs, not to run them. If you don't know the difference between static and dynamic linking, you should read up on that. The simplified version is, static linking includes the complete code of the library into the main executable for the program. The static library is only required during build. Dynamic linking only inserts a reference to the library files and function names during build, and the OS loader then builds an in-memory image combining the main binary and the dynamic libraries. The dynamic libraries are required both during build and during runtime.
|
|
# ? Nov 7, 2016 08:42 |
|
It depends to some degree on the exact build environment. A lot of C or C++ programs/libraries tend to require headers naming the BLAS functions they're linking to and need devel. You could specify or package in your own BLAS headers, of course, when distributing your library's source. This is also kind of how Python's C FFI bindings work, where you have to manually specify the functions signatures in Python, meaning you only need the .dll/.so/.dylib/.a file because you're essentially providing your own header and it's simply searching for the functions in the library at link time (when you call cdll.LoadLibrary generally). Rust's FFI works similarly. In most cases, anything you find in yum/pacman/apt-get will be linked dynamically, but there are exceptions, hence why the static variant often gets a special listing. Also, for BLAS specifically probably build OpenBLAS yourself. The one on apt-get tends to have iffy performance. nielsm posted:Dynamic linking only inserts a reference to the library files and function names during build, and the OS loader then builds an in-memory image combining the main binary and the dynamic libraries. The dynamic libraries are required both during build and during runtime. Depends on the environment I think. I've certainly had programs succeed at building when I had a malformed or misplaced dll/so, but then die at runtime. Linear Zoetrope fucked around with this message at 13:07 on Nov 7, 2016 |
# ? Nov 7, 2016 09:33 |
|
rjmccall posted:Note that OO isn't necessarily just an imperative thing. The primary tenet of OOP is "make abstract data types", i.e. you should organize your data into meaningful classes/types/whatever that encapsulate the representation and provide an abstract interface of high-level operations. Mutability makes that really critically important, but even without mutability it's still really important if you have any interest in writing good, maintainable code. Most functional languages do provide some tools for abstract data types, and some (notably OCaml) even support organizing operations into classically OO-style class-namespaced methods, all without pushing you inevitably into the world of mutability. Features like dynamic method dispatch and inheritance are really secondary, but they, too, are not at all incompatible with functional programming. This is why I think the taxonomy I learned is still the most useful. OOP can be done in imperative or functional languages. Similarly structured programming is about flow control (i.e. no writing your own while loops by hand with gotos) and that's perfectly fine for imperative or functional too. In fact, I think I'd refine my earlier descriptions:
BigRedDot fucked around with this message at 05:39 on Nov 8, 2016 |
# ? Nov 8, 2016 05:22 |
|
Is there language agnostic terminology for "indirectly inheriting a value from an upstream variable still does not imply z = x" in the case of:code:
Is this just an issue of semantics and useless desire for an inherent rationality of a language architecture? edit: Or is this a stupid thing to ask for of a variable, and instead using classes? Computer Serf fucked around with this message at 07:02 on Nov 8, 2016 |
# ? Nov 8, 2016 06:59 |
|
Computer Serf posted:Is there language agnostic terminology for "indirectly inheriting a value from an upstream variable still does not imply z = x" in the case of: Can you ask your question with respect to a specific language? Your attempt to extract an abstract concept was overzealous, and as a result, you've kind of invented your own definitions for things that make answering you basically impossible.
|
# ? Nov 8, 2016 08:37 |
|
I am going to invent the term nontransitive assignment (©, ™, pat. pend.) for this concept. I'm sure it's a totally original idea, please do not steal.
|
# ? Nov 8, 2016 09:07 |
|
Computer Serf posted:Is there language agnostic terminology for "indirectly inheriting a value from an upstream variable still does not imply z = x" in the case of: It's not the most logical thing to ask for because transitivity is definitely what anyone reading your code expects of the equals sign. Also, classes are not an alternative to variables, they are concepts that are used together. A variable might have a type that is a class. I think what you want to do is distinguish two variables which have equivalent values. In some languages, you can do this by checking if the variables are in fact references to the same object/location in memory. So in C: C++ code:
|
# ? Nov 8, 2016 15:43 |
|
Fergus Mac Roich posted:It's not the most logical thing to ask for because transitivity is definitely what anyone reading your code expects of the equals sign. Also, classes are not an alternative to variables, they are concepts that are used together. A variable might have a type that is a class. Ah thanks! Object/location memory allocation would effectively confine the thingies. Hopefully raminasi posted:Can you ask your question with respect to a specific language? Your attempt to extract an abstract concept was overzealous, and as a result, you've kind of invented your own definitions for things that make answering you basically impossible. How to define a variable z that may sometimes equal x, while distinguishing that x is not z. It's somewhat a silly exercise maybe, but it struck my curiosity because I had recently gone through a book on language and faulty logic where logical assumptions were mentioned and I was wondering if this was common or thought of already in any sort of programming language architecture. Explicit memory allocation would be effective, it seems. Computer Serf fucked around with this message at 19:56 on Nov 8, 2016 |
# ? Nov 8, 2016 19:42 |
|
Yeah, Fergus Mac Roich said what I would've said -- compare the memory used by the variables. The code you described has the variables containing copies of the same data, but those copies will be in different locations in memory. If they were in the same location in memory, then the two variables would be aliases of each other. I...can't think of any languages that let you make a variable that's a straight alias of another variable. There has to be some kind of explicit memory shenanigans going on. That is, you can say "I have variable X stored at location Y, and I can write to Y to change the value of X", but you can't say "I have variable X stored at Y, and I have variable Z also stored at Y". You can easily have X and Z whose values are both Y, but those values aren't both stored at Y. I think I'm doing a bad job of explaining this.
|
# ? Nov 8, 2016 19:45 |
|
TooMuchAbstraction posted:Yeah, Fergus Mac Roich said what I would've said -- compare the memory used by the variables. The code you described has the variables containing copies of the same data, but those copies will be in different locations in memory. If they were in the same location in memory, then the two variables would be aliases of each other. C++ references? code:
|
# ? Nov 8, 2016 19:56 |
Computer Serf posted:Ah thanks! Object/location memory allocation would effectively confine the thingies. Python separates is and equals, and allows true aliasing. x = [2] y = x z = [2] x == y #true x == z #true x is y # true x is z #false
|
|
# ? Nov 8, 2016 20:04 |
|
To clarify syntax and terms,code:
read the line above it as "the value at address x is equal to y" and then we can have code:
Stinky_Pete fucked around with this message at 20:23 on Nov 8, 2016 |
# ? Nov 8, 2016 20:20 |
|
|
# ? May 28, 2024 03:13 |
|
Computer Serf posted:Ah thanks! Object/location memory allocation would effectively confine the thingies.
|
# ? Nov 8, 2016 22:40 |