ViggyNash posted:Ok, I did that and now it compiles, but when I run the program it can't find the dll. I tried registering it, but it just reports a problem about the dllregisterserver. What reason would cause a problem with registering a dll? "Registering" a libraries on Windows is only a COM thing, which is rather specific. If the library isn't a COM thing it doesn't make any sense to attempt to register it. Instead, place the DLL file somewhere the executable loader can actually find it: 1. Best location, same directory as the EXE file 2. Bad location, the Windows System directory 3. Poor location, the current directory 4. Bad location, some other directory listed on the PATH environment var 2 is bad because you shouldn't be placing things inside the Windows System directory, that's only for internal use. 3 is poor, because if you're going to distribute your program you can't necessarily control what the current directory will be very well. (And it's easier to just place it in the same dir as the EXE file anyway.) It can be acceptable for your own testing while developing, if you don't want to have multiple copies of the DLL around. 4 is bad because either you have to assume something about what directories are on PATH, or you have to modify PATH.
|
|
# ? Jun 29, 2015 18:01 |
|
|
# ? May 15, 2024 08:20 |
|
I had put the dll where I thought the exe was, but I guess it wasn't the right place and I assumed that wouldn't work. I dumped a copy into each folder and subfolder I could find within the project and it seems one of them was right because the program works now. Thanks for the help.
|
# ? Jun 29, 2015 20:56 |
|
You can use Process Monitor to watch a program as it searches for DLLs it needs. I've used it several times to solve this kind of problem in the past.
|
# ? Jun 30, 2015 05:14 |
|
Is there any way to plop a single push or pop into a 64 bit program with Visual Studio? As far as I know there's no way to do 64 bit inline assembly or specify naked calling. I know there's no good reason to do this, but I wanna do it anyways.
|
# ? Jun 30, 2015 06:20 |
|
hooah posted:Why do most command-line utilities use either a dash or slash to precede switch arguments? Is that just to differentiate switches from other kinds of arguments? The existence of the prefix in general is to differentiate switches from other kinds of arguments, yes. The exact character used depends on historical convention; DOS and windows use / and *nix uses - and --. From a programming perspective, it's easier to parse, and from an end user perspective, it makes it obvious on reading which arguments have special meaning to the program. On Linux, at least, the conventions are actually fairly well nailed down these days: - single-character switches use a single dash, such as "-r" or "-a" - you can (usually) combine these, if they don't take arguments: "-ra" is the same as "-r -a" - longer switches use a double dash, such as "--recurse" or "--archive" - "--output filename" and "--output=filename" are synonymous, as are "-o filename" and "-ofilename" - "--" on its own means "stop looking for switches and process everything after this as a plain argument, even if it looks like a switch" There are still plenty of programs around that don't follow these conventions, though. "find" uses single-dash exclusively, so "find -name" instead of "find --name"; "dd" doesn't use prefixes at all, instead going with a key=value system ("dd if=/dev/zero of=/dev/sda") for everything.
|
# ? Jun 30, 2015 20:45 |
|
ToxicFrog posted:The existence of the prefix in general is to differentiate switches from other kinds of arguments, yes. The exact character used depends on historical convention; DOS and windows use / and *nix uses - and --. From a programming perspective, it's easier to parse, and from an end user perspective, it makes it obvious on reading which arguments have special meaning to the program. Thank you (ahd hooah) - that's something I've been wondering about lately, but haven't bothered to research.
|
# ? Jun 30, 2015 22:04 |
|
ToxicFrog posted:The existence of the prefix in general is to differentiate switches from other kinds of arguments, yes. The exact character used depends on historical convention; DOS and windows use / and *nix uses - and --. From a programming perspective, it's easier to parse, and from an end user perspective, it makes it obvious on reading which arguments have special meaning to the program. It's worth pointing out that there is nothing enforcing any of this except convention, which is why you do get those differences from time to time. Every C program (other languages are similar) starts with C++ code:
|
# ? Jun 30, 2015 22:25 |
|
carry on then posted:It's worth pointing out that there is nothing enforcing any of this except convention,
|
# ? Jun 30, 2015 22:39 |
|
ToxicFrog posted:The existence of the prefix in general is to differentiate switches from other kinds of arguments, yes. The exact character used depends on historical convention; DOS and windows use / and *nix uses - and --. From a programming perspective, it's easier to parse, and from an end user perspective, it makes it obvious on reading which arguments have special meaning to the program. Wait so does "-ofile" become "-o file" or "-o -f -i -l -e"?
|
# ? Jul 1, 2015 11:50 |
|
qntm posted:Wait so does "-ofile" become "-o file" or "-o -f -i -l -e"? depends whether '-o' takes an argument
|
# ? Jul 1, 2015 13:19 |
|
GrumpyDoctor posted:You can use Process Monitor to watch a program as it searches for DLLs it needs. I've used it several times to solve this kind of problem in the past. Or use GFlags and enable "Show loader snaps" flag for the executable. Then you can use a debugger or DebugView to see loader's diagnostic output. This can also help understand why some DLLs fail to load. code:
omeg fucked around with this message at 15:06 on Jul 1, 2015 |
# ? Jul 1, 2015 14:59 |
|
Not very programming related but since I don't know where else to post computer science questions -- Does anyone have recommendations for books on logic? I found these, not sure which one is best though. http://www.amazon.com/Mathematical-Logic-exercises-Propositional-Completeness/dp/0198500483 http://www.amazon.com/Logic-Computer-Science-Modelling-Reasoning/dp/052154310X http://www.amazon.com/Mathematical-Computer-Science-Mordechai-Ben-Ari/dp/1447141288
|
# ? Jul 1, 2015 22:02 |
|
The only thing I can tell you is that I like the organization and physical size of the Springer books I've read, but the cover of that second one is too funny to not mention.
|
# ? Jul 2, 2015 02:19 |
|
dougdrums posted:The only thing I can tell you is that I like the organization and physical size of the Springer books I've read, but the cover of that second one is too funny to not mention. The only word for that is Preposterous.
|
# ? Jul 2, 2015 03:10 |
|
Pie Colony posted:Not very programming related but since I don't know where else to post computer science questions -- Why are you trying to learn logic and what's your math background look like?
|
# ? Jul 2, 2015 03:47 |
|
I don't know, just seems like a cool field and like it has some interesting applications to computer science. I liked the math classes I took as pre-reqs for CS but didn't take any classes outside of those. Now that I'm out of school I occasionally work through textbooks when I have time.
|
# ? Jul 2, 2015 22:14 |
|
When you guys write something new from scratch, do you just hammer out some giant awful mess of one or two original files + some helper libraries until it's working, and then refactor about half the code in to a bunch of separate maintainable files, or; do you know better to use all of the correct programming practices from the start? I've gotten better knowing how I want to structure a series of functions and methods but I still end up refactoring big chunks of it for efficiency later on I've noticed. I haven't written anything over about 3000 lines of code though.
|
# ? Jul 4, 2015 06:31 |
|
Hadlock posted:When you guys write something new from scratch, do you just hammer out some giant awful mess of one or two original files + some helper libraries until it's working, and then refactor about half the code in to a bunch of separate maintainable files, or; do you know better to use all of the correct programming practices from the start? I've gotten better knowing how I want to structure a series of functions and methods but I still end up refactoring big chunks of it for efficiency later on I've noticed. I haven't written anything over about 3000 lines of code though. Any time I need to do something that could be described discretely and requires more than 3 lines of code, I'm at the very least spinning it into its own function. Sometimes you don't realize something fits that bill until you realize you've coded it three different ways in the same program though.
|
# ? Jul 4, 2015 07:24 |
|
Does it add any value to compare file size along with hashes for determining if multiple files are the same using a relatively strong hash? Seems like it would be faster to compare size first and if that even passes then compare the hashes. No reason to even bother computing the hash if the size is different.
|
# ? Jul 4, 2015 21:01 |
|
Shaocaholica posted:Does it add any value to compare file size along with hashes for determining if multiple files are the same using a relatively strong hash? Seems like it would be faster to compare size first and if that even passes then compare the hashes. No reason to even bother computing the hash if the size is different. Yes, that's definitely an optimization. The file system has precomputed the size for you, so you have a very small constant look up time.
|
# ? Jul 4, 2015 21:11 |
|
LeftistMuslimObama posted:Any time I need to do something that could be described discretely and requires more than 3 lines of code, I'm at the very least spinning it into its own function. What I sometimes observe is that if I do split things out and try to organize everything early, it turns out to be suboptimal later anyway Shaocaholica posted:Does it add any value to compare file size along with hashes for determining if multiple files are the same using a relatively strong hash? Seems like it would be faster to compare size first and if that even passes then compare the hashes. No reason to even bother computing the hash if the size is different. Yeah I see no reason for always doing both unless you are deliberately hashing similar documents identically somehow, which you say you aren't.
|
# ? Jul 4, 2015 21:16 |
|
Hadlock posted:When you guys write something new from scratch, do you just hammer out some giant awful mess of one or two original files + some helper libraries until it's working, and then refactor about half the code in to a bunch of separate maintainable files, or; do you know better to use all of the correct programming practices from the start? I've gotten better knowing how I want to structure a series of functions and methods but I still end up refactoring big chunks of it for efficiency later on I've noticed. I haven't written anything over about 3000 lines of code though. If the right thing to do is easy, I'll do that, and if I'm doing something haram I'll try to do it in a way that I won't hate myself too much for next week.
|
# ? Jul 4, 2015 21:29 |
|
So my object "Jet" has many properties, but a couple of them are going to be queried frequently; in particular these three: -arrival -departure -hold Is it better to create a single property as a string or int ( [string] Jet.status = "arrival"/"departure"/"hold" -- or -- [int] Jet.status = 0 / 1 / 2 ) Or should I set each property as a bool ( [bool] Jet.arrival = 0, [bool] Jet.departure = 1, [bool] Jet.hold = 0 ) Orrr since arrival/departure are standard and "hold" is kind of the exception state, two Bools, [bool] Jet.status = 0 / 1, [bool] Jet.hold = 0 / 1 The problem I have with the last setup is that I have to remember if arrival = 1 or 0 and vice versa, and trying to keep track of that definition when debugging this sounds like nightmare fuel as there's no obvious 0 or 1 analog. Hadlock fucked around with this message at 09:29 on Jul 5, 2015 |
# ? Jul 5, 2015 09:27 |
|
Hadlock posted:So my object "Jet" has many properties, but a couple of them are going to be queried frequently; in particular these three: Are these states exclusive, in that the jet can only live in one of these states at a point in time? If yes, I'd suggest using enums. If your language lacks them, I'd do something like this: code:
|
# ? Jul 5, 2015 09:52 |
|
Yes, enums is exactly what I was looking for, thanks! Since I only had three elements I started googling for qubits and trinary variables which led me down the wrong path I think. Thanks for understanding, translating and answering the question I didn't know how to ask
|
# ? Jul 5, 2015 10:32 |
|
ToxicFrog posted:The existence of the prefix in general is to differentiate switches from other kinds of arguments, yes. The exact character used depends on historical convention; DOS and windows use / and *nix uses - and --. Caveat ; -- and long arguments are specifically a GNU extension (and GNU is, of course, not UNIX). Old-school commercial UNIX utilities only have the single-letter options with one dash. Generally GNU versions of standard utilities will support both a single-letter version of each option (for compatibility with UNIX) and a more readable -- version; e.g. -v and --verbose tend to mean the same thing.
|
# ? Jul 5, 2015 19:59 |
|
More of a WP question but can anyone help me find the pagination and next link selector from my theme's CSS code? http://urlgone.com/b263a6/
|
# ? Jul 6, 2015 03:01 |
|
I've got a bunch of data structure classes in one project, and a deleter class in another project. All these classes should be deleted in different ways, and right now the deleter class has an ugly method where it tests the type of the class given, and calls another delete function in the deleter class. I can't implement a delete method on the data structure class, so how should I do this in a neat way?
|
# ? Jul 6, 2015 11:51 |
|
Boz0r posted:I've got a bunch of data structure classes in one project, and a deleter class in another project. All these classes should be deleted in different ways, and right now the deleter class has an ugly method where it tests the type of the class given, and calls another delete function in the deleter class. I can't implement a delete method on the data structure class, so how should I do this in a neat way? What does "delete" mean in this context? What language are you using? There's a bit of a difference if you're talking about freeing memory in C++ or implementing your own ORM in Python.
|
# ? Jul 6, 2015 13:27 |
|
This is in C#, but the delete functions do a lot of stuff. I'm looking for a sort of design pattern or something.
|
# ? Jul 6, 2015 13:47 |
Why does an object not know how to delete itself? Why is it a separated out responsibility? Is there ever a case where two different classes need the same deleter? If you really want a pattern I think what you're aiming for is some sort of Strategy Pattern, where you'd have a Deletion Strategy for each object. That becomes Extremely Enterprise and massive overkill, and most likely misuse. To me it sounds like "separation of responsibilities" taken several steps too far. Maybe look up the role of IDisposable in .NET land.
|
|
# ? Jul 6, 2015 13:59 |
|
When the objects are deleted, they delete some appropriate files and directories. I didn't design this mess, I'm just trying to clean it up a bit, but I've been told that I can't implement delete methods on the data structure classes because they can't access file functionality.
|
# ? Jul 6, 2015 14:16 |
|
qntm posted:Wait so does "-ofile" become "-o file" or "-o -f -i -l -e"? Depends on whether -o takes an argument! If it does, it's "-o file". If it doesn't, it's "-o -f -i -l -e". If -o doesn't take an argument but -f does, it becomes "-o -f ile". This is why I pretty much always include the space when writing my scripts.
|
# ? Jul 6, 2015 14:23 |
Eh okay. Some kind of Strategy Pattern is probably the best way to handle it. The Deleter code might be able to be restructured in a nicer way using the dynamic dispatch features introduced in C# 4.0.
|
|
# ? Jul 6, 2015 14:25 |
|
Boz0r posted:When the objects are deleted, they delete some appropriate files and directories. I didn't design this mess, I'm just trying to clean it up a bit, but I've been told that I can't implement delete methods on the data structure classes because they can't access file functionality. Can't access file functionality for actual technical reasons, or because the person who told you to do this is an idiot? If an object's responsibility, on deletion, is to delete some files, it should absolutely be that object's responsibility to delete files. If for some reason they know the filenames but aren't allowed to touch the file system, have them pass a list of files to be deleted to a method or class that is allowed to delete files.
|
# ? Jul 6, 2015 15:15 |
|
Boz0r posted:I've got a bunch of data structure classes in one project, and a deleter class in another project. All these classes should be deleted in different ways, and right now the deleter class has an ugly method where it tests the type of the class given, and calls another delete function in the deleter class. I can't implement a delete method on the data structure class, so how should I do this in a neat way? You can use dynamic for this. Instead of manually introspecting types, cast objects to dynamic so that dynamic dispatch can send them to an appropriate overload in the deleter. C# code:
|
# ? Jul 6, 2015 17:12 |
GrumpyDoctor posted:You can use dynamic for this. Instead of manually introspecting types, cast objects to dynamic so that dynamic dispatch can send them to an appropriate overload in the deleter. Perhaps use different names for the public wrapper and the private implementations, just to avoid an infinite recursion if you manage to call Delete with an unhandled subclass.
|
|
# ? Jul 6, 2015 21:34 |
|
LeftistMuslimObama posted:Can't access file functionality for actual technical reasons, or because the person who told you to do this is an idiot? If an object's responsibility, on deletion, is to delete some files, it should absolutely be that object's responsibility to delete files. If for some reason they know the filenames but aren't allowed to touch the file system, have them pass a list of files to be deleted to a method or class that is allowed to delete files. I was going to say this .... The classes delete themselves but if they have to call FileManager.deleteFiles(List<File>) Then so be it. of course if you have a collection of objects you want to clear then you iterate calling delete() on each entry. The current way sounds like coding i did when i was 11 years old TheresaJayne fucked around with this message at 10:22 on Jul 7, 2015 |
# ? Jul 7, 2015 10:20 |
|
Does anyone have any hot tips for cache invalidation. I'm currently using redis to cache some json, it works like this:pre:request -> is the key there -> yes -> serve key | V no -> hit database -> serialize and put json in redis -> serve key update -> delete key Maybe it would be better to use a document store or something for the serialized data?
|
# ? Jul 8, 2015 02:21 |
|
|
# ? May 15, 2024 08:20 |
|
It sounds like you're describing a situation where you update object X, object X's update also changes "other things" behind the scenes, and then object X is left holding the bag for those other things' key deletion. Instead of doing updates behind the scenes you should go through your own API for updates. Your API for updating an object already has logic to delete the relevant key xo problem solved. If going through your API is complicated when you're already "in" your API then it's probably time to factor out some business logic so it can be called in multiple ways.
|
# ? Jul 8, 2015 13:45 |