Jump to content

David Schwartz

Members
  • Content Count

    1223
  • Joined

  • Last visited

  • Days Won

    25

Everything posted by David Schwartz

  1. David Schwartz

    parsing Google search results

    I've reposted this from a different perspective because people seem more fixated on the fact that I'm trying to parse a Google page or get search results than what the actual problem is. Please respond to my new question instead.
  2. David Schwartz

    parsing Google search results

    Yes, I'm specifically looking at Google. I'm wanting to automate a specific process that is currently being done manually that looks at several things that show up on the first page of a Google search result. A lot of folks wanting this info currently outsource it to people in Asia.
  3. I have a general question that has nothing to do with ordering pizzas, per se. It's about designing a mobile app that could have a range of adaptability to current inventory states on the back-end. Think about an app you might build to order a pizza. There might be some combos that consist of a predefined set of toppings, and an option for a "made-to-order" selections. So you've probably got one tab with a list of different combo pizzas, that's likely a bunch of radio buttons (ie., pick a combo) on it. Then you probably have a separate tab with a bunch of check-boxes on it so you can pick whatever toppings you want individually. The crust will always have a few radio buttons (thin crust, thick crust, deep dish, stuffed crust), and the base topping might as well (tomato sauce vs. a white sauce, say). Now let's say you're designing a JSON/REST-based service to handle these orders on the back-end. I have a few questions about how folks here would approach this. First, would you define a class to represent all of the possible options in an order (ie, TPizzaOrder)? If so, how would you define it? Second, generally speaking, how would you structure the data being sent to the server? (It would seem that a class could have its own JSON I/O methods, making this really easy.) Finally, individual ingredients might come and go, depending on availability and popularity. Would you design the app's interface to load or update a list of currently available ingredients from the server each time it ran? New ingredients would need to have more data downloaded; otherwise, availability would be indicated by a bunch of booleans. The first time the app is run, someone would register, and then it might need to initialize with all of the current ingredients. (If you didn't do this, then the app would need to be updated every time the list of available options changes.) Oh, and there's current pricing data... I know a lot of this might sound pretty obvious, but I've seen apps with far fewer options that make very little effort to accomodate the variations, and I think the vendors are limiting themselves because the programmers aren't thinking about the problem clearly. (Or they're just afraid of the apparent complexity of the problem?)
  4. David Schwartz

    parsing Google search results

    Continued searching uncovered this: https://stackoverflow.com/questions/4082966/what-are-the-alternatives-now-that-the-google-web-search-api-has-been-deprecated Note: The Google Web Search API has been officially deprecated as of November 1, 2010. It will continue to work as per our deprecation policy, but the number of requests you may make per day will be limited. Therefore, we encourage you to move to the new Custom Search API. This seems to addresses the bigger question and tells me I'm not the only person stumped by this issue. This post says at the bottom: The search quality is much lower than normal Google search (no synonyms, "intelligence" etc.) It seems that Google is even planning to shut down this service completely. And some comments include these warnings: This is why Google claims that the search results are different support.google.com/customsearch/answer/141877?hl=en Mainly: Using specified sites (does not apply here), no social or personalized or real time results – MFARID Apr 27 '14 at 17:41 I tried it but it doesn't work now. I asked to look in the entire web for suunto ambit watch, but I got no results (I searched in the public URL that I got) – Dejell Feb 11 '15 at 20:0 WARNING: we did development using the free version, but to upgrade to the paid version (to do more than 100 searches), google forces you to turn off the "search the entire web but emphasize included sites" – Bryan Larsen Aug 11 '15 at 14:50 "On April 1, 2017, Google will discontinue sales of the Google Site Search. All new purchases and renewals must take place before this date. The product will be completely shut down by April 1, 2018." – Gajus Mar 7 '17 at 15:52 Also, it looks like a bunch of 3rd-party vendors have sprouted up who offer APIs for regular web searches. SerpWow looks interesting. Methinks if it's as simple as hooking into a standard Google API, there wouldn't be a lively 3rd-party market offering the same thing, or info on hacking the only existing API that seems to come close.
  5. David Schwartz

    parsing Google search results

    I'm not so sure ... this is a structural change. It was the same for a decade before it changed, and then nearly another decade. A REST API would be better, but only as long as it has sufficient info on it that would allow one to effectively create the same result that a normal query produces. I don't need to interact with anything, just pull off a few bits of data from each entry. And if there's a map at the top then I need to read the links that show up below it. The only API I found was for scanning URLs, not running general queries. But they've got so damn many APIs that it can be hard to find things if you don't know what they're probably called.
  6. I'd like to have a check-list, but I want the user to be able to edit its contents easily, mostly by adding new entries and maybe reordering them. (I'm using checkboxes to avoid deleting things that may be used sometimes but not always. It's not going to be common to delete things in this case.) The way I've done this in the past, and how I've usually seen it done, is to somehow overlay a memo and a checklistbox of some sort, maybe using a page control. If you want to edit it, the data is loaded into a memo and the memo is displayed. When you want to go back to select items, the data is loaded into the checklistbox and it is displayed instead. Most line-oriented controls like TListBox and TListView aren't easy to edit. Memos are what people are most used to. I'm curious if anybody has any other approach that's worth trying?
  7. David Schwartz

    looking for design ideas for an easily editable list

    I guess that would work. It also makes me think of accordion controls. No, that seems backwards. But I think I get your idea. 🙂
  8. What's the easiest way you know of to test predicate conditions of input parameters on methods and display a meaningful error message when one fails and skipping the rest, without using exceptions? Common situations include: * an input value is NIL or not * an input string is empty or not * an input numeric is < 0, = 0, or > 0 * an input object has a property like the above that includes that the object's reference pointer is valid I'm curious if there's a way to have a list of one-liners that are easy to read and aren't part of a huge nested if..then statement filled with and's or or's and terminated with a begin ShowMessage(...); Exit; end;
  9. David Schwartz

    handling predicate conditions

    I was looking for examples.
  10. David Schwartz

    parsing Google search results

    The only thing I could find was not what I was looking for. Do you happen to know which API returns the same results as running a query, and isn't limited to 100 queries per day?
  11. David Schwartz

    looking for design ideas for an easily editable list

    I appreciate these suggestions. Right now I'm just building a prototype of something and I don't want to get distracted learning to use a control for a something that might not even end up being used. I'm just curious what other solutions might be available ... how others may have solved this problem.
  12. David Schwartz

    handling predicate conditions

    You guys are all really great theoreticians. I'd really much rather see a variety of examples than debate theory. That's because I see very little written about this topic anywhere.
  13. David Schwartz

    handling predicate conditions

    Ahh, and example! Thanks! So how do you bail out of the procedure if a check fails? Does this throw an exception? Or is another test needed? @David Heffernan I'm actually fairly agnostic about Exceptions, It's just that they can be a PITA at times.
  14. David Schwartz

    looking for design ideas for an easily editable list

    Yeah, I've suffered through using that sucker a few times. I think it's more work than I want to put in. Any other ideas?
  15. David Schwartz

    handling predicate conditions

    No, I'm thinking about run-time errors here. Like, you cannot proceed without entering something in a Name field. You could say it's "required field" handling, but the form follows one set of rules, the back-end might follow one or two others, and they're all independent of each other. If you decide to change a field from required to options, or vice versa, you have to implement that logic in several different places, and it's not always obvious where they are. And it's hard to test for.
  16. David Schwartz

    handling predicate conditions

    Ahh, well ... I'm working on a form-based app, and the code I'm staring at isn't of the nature you're describing. But I see your point, for sure. Again, I'm looking for some examples, because the few I've seen don't take things like this into consideration. Historically speaking, these things get lumped into "error logging" mechanisms. If you're working with a server that has no display, then that's a valid perspective. But not so much in a form-based app -- you want to tell the user to fix the problem so processing can continue. Even in situations where the client-side code ends up passing improperly filtered data to the back-end, there needs to be a way to a message from the back-end that the front-end can then use to alert the user so the problem can be corrected. I don't see this much in desktop apps, even using DB servers. But boy do I see it a lot in web-based scenarios where a simple data entry error in one field causes the entire form to be reset and all of the previous data to be lost. (I was trying to enter some data into a site that asks for some work history, starting with the most recent / current thing. I added a couple then realized I forgot my "current" status. There's no way to enter something anywhere but at the end. After several attempts at moving things down, I just deleted everything and started over. Apparently there's a bug where if you check the box that says you're "currently employed" there, the back-end won't accept that, and it deletes the entire (first) entry, which is why i couldn't move things down. After deleting everything, it just left me with an empty list and no error message.) I see this same kind of problem repeatedly in web-based scenarios, and no consistent way of handling it. All these fancy frameworks and nobody seems to have a well thought-out way of handing these kinds of exceptions.
  17. David Schwartz

    handling predicate conditions

    Well, aside from a general sense that exceptions shouldn't be used for flow control ... Anyway, I'm looking for some examples as well. This is not a topic that is very widely discussed, although for lots of projects I've worked on, they've devised some kind of consistent approach, usually NOT based on exceptions. But many haven't, so you can see personality differences in the code depending whose favorite method for vetting incoming parameters was used. This isn't very Delphi-specific, so discussions about it in other languages would be fun to read, too.
  18. David Schwartz

    registering D6

    I'm trying to load up an old project that has dates on the files from 2004. I probably used D6, and I have it installed in a VM, but it keeps telling me to register it. I go through the registration and it has valid keys, but it says the registration fails. What the heck are we supposed to do to load up old projects like this? I also have D2007, but it has none of these components in it. So when I open the main form in this version, it's virtually empty because the panels and notebook I used are ancient. I'm not even sure they can be loaded into D2007. But I can change most of them to newer components.
  19. David Schwartz

    registering D6

    That worked! Thanks!
  20. David Schwartz

    registering D6

    The IDE doesn't run because the registration fails.
  21. David Schwartz

    Playing multiple wave files simultaneously

    WARNING: Mitov's library installs both debug and release libs for every possible platform on your version of Delphi. It does take up quite a bit of disk space! But you can safely go through and delete the platform libs you won't need.
  22. David Schwartz

    Request help from kbm/Component4Developers

    Not sure what you mean "ability to copy an existing TDataSet" But if you want to cache a TDataSet to an in-memory table, then TClientDataSet comes with Delphi and is all you need.
  23. David Schwartz

    Lots of errors when trying to compile an old project

    How much experience do you have working with Delphi? Do you even know how to locate files on the hard drive? Sorry, but I'd probably fire someone who came to me with this question. If you don't know how to find files on the disk or set up Delphi's search paths properly, there's no way you're going to make any sense at all of the crap you're going to see as a result of rebuilding this D7 app with Unicode strings!
  24. David Schwartz

    Playing multiple wave files simultaneously

    What library is this from? It looks like the built-in API for the old original Windows audio services. This was inherited from DOS. I wouldn't go near it with a 10' pole! You mentioned "bloat"... What percentage of your xxGB of memory is the footprint of your EXE taking up with whatever audio library you're referring to? BTW, there's a reason that audio devices all need custom drivers to work flawlessly in WIndows but not MacOS. The audio support built into Windows SUCKS! If you're really worried about "bloat" ... you'd avoid Windows for audio stuff. And I can attest that Mitov's libs work VERY WELL for multi-channel audio (and video, too) on both Windows and Mac.
  25. David Schwartz

    Playing multiple wave files simultaneously

    I've done this with Mitov's audio libraries.
×