|
I fixed the problem. I reorganized how the binary/logical expressions were handled in my grammar and everything is good now. Thanks for the help guys!
|
# ? Oct 3, 2011 07:41 |
|
|
# ? May 15, 2024 03:59 |
|
Is there an SQL for files? I mean, something like, SELECT linenum, line FROM file 'whatever.txt' WHERE line LIKE %foo% AND so on SORT BY line ASC LIMIT 10. This isn't something that I need, I'm just curious whether anything like it might exist.
|
# ? Oct 3, 2011 13:03 |
|
grep?
|
# ? Oct 3, 2011 13:16 |
|
qntm posted:Is there an SQL for files? I mean, something like, SELECT linenum, line FROM file 'whatever.txt' WHERE line LIKE %foo% AND so on SORT BY line ASC LIMIT 10. awk + grep + sort
|
# ? Oct 3, 2011 14:37 |
|
Perl, Python, or Ruby will also do the job nicely
|
# ? Oct 3, 2011 14:46 |
|
If you really wanted to, you could even write a script to dump the file into an in-memory SQLite database and then run a query on that
|
# ? Oct 3, 2011 15:22 |
|
pseudorandom name posted:The ones that aren't listed as "microcoded" in AMD's optimization manual. So by "everybody" you mean AMD. Gotcha.
|
# ? Oct 3, 2011 17:31 |
|
JawnV6 posted:So by "everybody" you mean AMD. Gotcha. I think he was having an Inigo Montoya moment wrt. microcode
|
# ? Oct 3, 2011 19:42 |
|
Well, they're defining it this way:
|
# ? Oct 3, 2011 19:50 |
|
PS I know this is kind of inside baseball, but do you know how life for AMD guys is? Luther Forest might be in my future due to location
|
# ? Oct 3, 2011 23:30 |
|
Hit me up on IRC
|
# ? Oct 4, 2011 18:51 |
|
I haven't had time to look through the thread, so sorry if this has been asked before. What is the best language to learn for the sake of having programming knowledge? Is there one language that is more extensively used, or perhaps one that will help you better understand programming in general? I've taken a course in C and one in C++; should I learn more about them or try something different?
|
# ? Oct 4, 2011 19:45 |
|
EF: Do you intend to do anything practical, or are you more interested in programming from a theoretical/puzzle solving perspective? In my highly opinionated... opinion: Lisp weenies would probably suggest Scheme is a great language for learning about programming from a high-level, abstract standpoint. Java and C# are great general-purpose languages with libraries for drat near anything, but you often have to type a lot, and there are tons of awful examples online. Python, Ruby, Perl and PHP are all more generally of the philosophy that common tasks should have short, cryptic solutions, to varying degrees of insanity. Forth is fun if you like the idea of coding in assembly but making loops out of branches gets old too quickly. C and C++ are useful if you see yourself going into the industry, but probably more trouble than they're worth if you just want to have fun.
|
# ? Oct 4, 2011 20:32 |
|
Yeah at this point I wouldn't learn C/C++ unless there is an intrinsic career reason to do so (e.g. a job) or a specific academic one. I learned both long ago and haven't used them in... ten years? ANSI C especially was helpful from a structure/discipline standpoint, but you can get that from other interpretation-light languages. If you just want to screw around I'd suggest something in .NET if you don't have a problem with Microsoft. If you want to go deeper Java is a good choice, though with many frustrating/ineffable compromises. If you want a job quickly, sadly, PHP/ruby/etc. might be a good way to go.
|
# ? Oct 4, 2011 21:06 |
|
Internet Janitor posted:Python, Ruby, Perl and PHP are all more generally of the philosophy that common tasks should have short, cryptic solutions, to varying degrees of insanity. I'm far from a professional and don't have the background to make any assertions about this, so I'm curious about what you mean here WRT Python? When I was first "learning programming" a few years ago, I stopped and started with a few different languages, but finally stuck with it once I tried Python because I found it amazingly un-cryptic.
|
# ? Oct 4, 2011 22:34 |
|
Electrical Fire posted:I haven't had time to look through the thread, so sorry if this has been asked before. What is the best language to learn for the sake of having programming knowledge? Is there one language that is more extensively used, or perhaps one that will help you better understand programming in general? I've taken a course in C and one in C++; should I learn more about them or try something different? If you're willing to sink a shitload of time into it, I would really recommend working your way through SICP. It's going to be awhile until you get far enough into it that you'll be able to talk to people about programming "in general," though. That being said, Python is regularly touted as a "good beginning language," although I don't know it myself.
|
# ? Oct 4, 2011 22:49 |
|
Python owns. Don't believe that guy who said it was cryptic -- at the core of the Python philosophy is making things clear, explicit, and obvious. IMO, you shouldn't learn just one language. Learn a whole bunch at the same time! Pick two really different languages (for me, this was C++ and Python), and work through Project Euler or something -- when you figure out how to do something in one language, figure out how to do it in the other one. Try to understand what makes the two implementations different, try to think about what kind of design choices the language designers faced, etc. To be a good programmer you have to be able to think of things from several different angles at once, and working with multiple languages and trying to understand the WHY of them is good practice for that.
|
# ? Oct 5, 2011 00:08 |
|
Thanks for all the advice. I'm actually an electrical engineering student, which is one reason why I want to have some programming knowledge. I was already thinking about playing around with Python, and since it seems like it's thought highly of, for the most part, maybe I'll look into it when I find some free time. Hopefully I haven't forgotten everything I learned in C/C++.
|
# ? Oct 5, 2011 01:37 |
|
If you're EE, you're going to have to learn Matlab eventually anyway, so why not start now? The student edition is only about $100, and that'll be good enough for a while.
|
# ? Oct 5, 2011 01:58 |
|
ultrafilter posted:If you're EE, you're going to have to learn Matlab eventually anyway, so why not start now? Because MATLAB is a giant pile of poo poo and should be avoided at all costs
|
# ? Oct 5, 2011 05:06 |
|
I don't "get" Agda. I'm doing exercise 2.2 of Dependently Typed Programming in Agda and I'm completely stuck.quote:Remember tabulate and _!_ from Section 2.4. Prove that they are indeed each other's inverses. (Here are the definitions of tabulate and Fin and _!_) code:
|
# ? Oct 5, 2011 12:21 |
|
shrughes posted:I don't "get" Agda. I'm doing exercise 2.2 of Dependently Typed Programming in Agda and I'm completely stuck. I can't promise you the exact Agda syntax right now as I don't have a compiler handy, but I'll walk you through the proof skeleton I'd use. You have a function to tabulate, and a bounded index. Pattern match on the index. If the index is zero, you're asking if tabulate f ! fzero == f fzero. This is a trivial consequence of the definitions of tabulate and !, and the unifier should handle it. For that case, simply provide the proof refl. If the index is nonzero, you're asking if tabulate f ! (fsuc i) == f (fsuc i). This is nontrivial. If you walk the definitions of ! and tabulate slightly, you are asking if tabulate (f o fsuc) ! i == f (fsuc i). Consider g = f o fsuc. You can recurse using lem-!-tab g i to show that tabulate g ! i == g i. You need to show that g i can replace f (fsuc i), but because that's a trivial proof the unifier can handle it. So your final proof should look something like this: code:
ShoulderDaemon fucked around with this message at 20:22 on Oct 5, 2011 |
# ? Oct 5, 2011 19:08 |
|
GrumpyDoctor posted:That being said, Python is regularly touted as a "good beginning language," although I don't know it myself. I'm seeing listed in quite a few jobs these days, from Quants to HPC. BofA has some developer/architect positions in Python too: http://careers.bankofamerica.com/Jo...y=&LocationID=0
|
# ? Oct 5, 2011 20:13 |
|
Electrical Fire posted:Thanks for all the advice. I'm actually an electrical engineering student, which is one reason why I want to have some programming knowledge. Yeah if you're EE you're probably going to be stuck with ANSI C for life if you're doing programming/design, just so many embedded systems. For a laugh check out the Coding Horrors thread, where the recent mantra is 'EEs are the world's second worst programmers (after dedicated academics)'. Python is pretty neat, and relatively low investment to learn. I think what Internet Janitor meant about 'insanity' is that like all of those scripty languages there's the 'right' way, the 'easy' way, and the way you don't understand because you copied and pasted it off the internet. People using the latter two often ends up in code that's worthy.
|
# ? Oct 5, 2011 20:24 |
|
I am on OS 10.7.1 I spent a few hours last week setting up a bunch of network aliases. I was dumb and smb'ed to the ip address rather than the host name before creating the aliases. Is there a way I can effect all of these in bulk and change smb://xxx.xxx.xxx.xxx/porn to smb://host.name/porn ?
|
# ? Oct 6, 2011 00:03 |
|
MrMoo posted:I'm seeing listed in quite a few jobs these days, from Quants to HPC. BofA has some developer/architect positions in Python too: Oh sure, I didn't mean to imply it wasn't good for anything else. My own question: I've got a collection of flat surfaces in 3-dimensional space that form the facets of some arbitrary polyhedral solid with nothing "weird" about it (although it's not necessarily convex). Now, my geometry library can assemble them into a representation of the solid that I can then perform boolean set operations on, which is what I eventually need. The problem is that it can only do this if they're all oriented the same, i.e. applying the right-hand rule to each of their vertex series yields vectors that all point the same way relative to the interior of the solid. (Alternatively, it will only work if there are no duplicate directed edges.) Unfortunately, I'm going to have to enforce this myself, but I can't think of an elegant way to do it. All I can think of is manually examining the set of directed edges and flipping the order of a surface if I encounter any duplicates, but that feels kind of brute-forcey. (Fortunately, I can get away with that - I won't encounter more than about twenty surfaces so performance isn't a huge issue.)
|
# ? Oct 6, 2011 05:03 |
|
ShoulderDaemon posted:So your final proof should look something like this: That's how I was trying to prove it. It turned out my problem was that tabulate f ! i == f i should be (tabulate f ! i) == f i.
|
# ? Oct 6, 2011 05:18 |
|
Visual Basic question, I'm using Visual Basic 2008 express edition. I am trying to figure out how to see when a mouse button is clicked anywhere on the screen but I'm running into a brick wall I guess. I see there are nice functions like SetCursorPos and GetCursorPos that can set/get xy coords easily. I see the mouse_event function that can let me send clicking events. How do I receive buttondown/buttonup events even if my form isn't visible or under the mouse cursor? I've been trying to make sense of the SetWindowsHookEx but then I see documentation that says it doesn't work globally? Thanks for any help you can give.
|
# ? Oct 7, 2011 05:21 |
|
Use SetWindowsHookEx to inject a low-level mouse hook (WH_MOUSE_LL).
|
# ? Oct 7, 2011 05:37 |
|
Sedro posted:Use SetWindowsHookEx to inject a low-level mouse hook (WH_MOUSE_LL). Thanks, I was thrown off by things saying global hooks weren't supported in .net This worked perfectly, I just had to shut off the Close button and put my own exit button in.. the code I found for a low level mouse hook did override the finalize function to insert a command to shut down the hook.. but for some reason when I hit the close button it would freeze my mouse and the program for a few seconds. Doing it myself in my own exit button works perfectly though. Weird as hell. All well, I can count mouse clicks now which makes me happy.
|
# ? Oct 9, 2011 05:34 |
|
My guess is closing the window kills the message loop, so your callback is no longer accessible by Windows. The finalizer runs eventually and your hook gets released. That is one of the dangers of hooks- if your process stops responding, input stops working. You should have some event like OnClosed where you can stick your cleanup code. Generally you want to use the finalizer as a last resort, especially for critical cleanup. Check out the disposable pattern.
|
# ? Oct 9, 2011 06:42 |
|
It merits further experimentation. I think at one point I followed someone's code to make a "are you sure you want to exit" box show up when you close the form.. but before it did show up, the finalize code ran to unhook the low level mouse hook and caused the program and my mouse to hang for a few seconds. Might just be stuck with having my own exit button unless I can figure out how to have the regular close "X" button setup to work like my exit button. It's not a big deal either way.
|
# ? Oct 9, 2011 18:02 |
|
SQL Question: I have a google maps API (v3) query dumped to an XML. I have two tables. I'm calling a query to select all elements of one table and a few of the second. The second table contains a "rating" field. There are multiple entries and I have the two tables linked by ID. The two tables correspond, everything is fetching correctly, but it outputs the field "rating" as multiple entries. This causes me to have duplicates with (potentially) different output. AVG will be the solution! So, I implemented the AVG(rating) AS ratingavg. It is giving me the average of the entire table, as opposed to the results from the above search. I do not need the entire table to be averaged, just the ratings that apply to the query. How can I accomplish this? I'm assuming that I'll have to use a case... but I'm clueless as to how to work it out. Google has failed me. In short: I need the AVG(rating) of the resulting query, not the entire table. code:
|
# ? Oct 10, 2011 03:27 |
Ration posted:SQL Question: Ration posted:I have two tables. I'm calling a query to select all elements of one table and a few of the second. AVG() is called an aggregate function. Aggregates run over the entire dataset, unless you tell the database system how to the rows in the intermediate result set are related in groups. (Other aggregate functions are COUNT, MIN and MAX.) You need to add a GROUP BY clause to your query: code:
You may also want to read up on joins, what you probably want to do here is not an inner join (as you are getting now) but more likely a left join, where even markers without comments are included in the result set.
|
|
# ? Oct 10, 2011 03:53 |
|
To develop and publish an app for Blackberry, do I have to pay for anything? I found posts talking about 200$ for 10 tokens, whatever that means, from about a year ago but I can't find anything about that on the Blackberry Developer Zone website.
|
# ? Oct 10, 2011 15:01 |
|
I've been learning Ruby- both for Rails and other frameworks like it, and as a general scripting language. It's my first language period, and I've been enjoying it. But one thing I can't seem to find is any sign that people actually use the language for something -other- than Rails. Is Ruby just overshadowed by its best-known framework, and I'm not seeing the people using it otherwise? Or is it legitimately a one-trick pony, only otherwise useful for quick scripts?
|
# ? Oct 12, 2011 12:49 |
|
Ruby is known almost exclusively to the general programming-language-aware public as the language Rails is implemented in. But there's plenty more. For example, looking on GitHub (https://github.com/search?type=Repositories&q=language%3Aruby), I see: homebrew, a package manager for Mac OS X blueprint, a CSS framework jekyll, a static site generator chef, a systems integration thinger In that search you'll undoubtedly notice that the proportion of Rails-related projects vastly exceeds any other group, but don't let that discourage you on Ruby. And (while it's in early stages) there are Ruby apps in the Mac App Store.
|
# ? Oct 12, 2011 14:31 |
|
homebrew owns. It's the kind of thing that makes me want to learn Ruby better... but I feel like I'm betraying Python
|
# ? Oct 12, 2011 14:46 |
|
Really dumb question from a really amateur programmer: In C# (or in general, I suppose- but I'm most comfortable with C#), where exactly is the "best" place to put stuff that you'll end up using through out all of the application? Specifically: http://pastebin.com/7YvPRhUC This is the first assignment we had to do for my XML class this semester, and I feel like I really shouldn't be creating a new XPathNav/Doc/NodeIterator in each function, but I'm not sure where the best/proper place to put it is. edit; Hmm. When I first typed out that application, I typed everything out so that it'd all be executed in the button click handler, and it works fine. When I seperated it out into 3 different functions, the popItems function doesn't work properly. There are 3 items in the XML file, and when the popItems functions runs it only prints out the first of the three. Not really important- I can just ask my professor next class, but this struck me as really strange. Sab669 fucked around with this message at 15:41 on Oct 12, 2011 |
# ? Oct 12, 2011 15:35 |
|
|
# ? May 15, 2024 03:59 |
|
Sab669 posted:Really dumb question from a really amateur programmer: All those items that you're recreating over and over should be made instance variables.
|
# ? Oct 12, 2011 15:55 |