|
There is always something like xslt
|
# ¿ Dec 11, 2008 10:29 |
|
|
# ¿ May 14, 2024 01:09 |
|
Munkeymon posted:Yes, but median-of-three implementation of QuickSort should protect it against degenerating into N2 time when it is passed a sorted list of any kind (pre-sorted, reverse sorted, 'almost' sorted). If you're interested in this sort of thing, 'Engineering a Sort Function' by Mcilroy and Bentley is a good read: http://www.enseignement.polytechnique.fr/informatique/profs/Luc.Maranget/421/09/bentley93engineering.pdf
|
# ¿ Dec 16, 2008 02:41 |
|
launchpad ?
|
# ¿ Dec 23, 2008 03:37 |
|
Use a web app, and output simple html, and use css to make it less ugly?
|
# ¿ Jan 6, 2009 17:34 |
|
It is less about the language and more about the libraries - it depends what level you will have to be parsing the html (text only/html only/ with javascript?). Most dynamic languages make excellent choices - Perl has LWP::Simple and a few html parsing modules. Python has beautifulsoup (slow) or lxml to parse html, and urllib2 or pycurl to grab pages. I'm not sure about ruby, but I'm pretty sure it has similar libraries. Really, Perl, Ruby or Python are perfectly capable of web crawling.
|
# ¿ Jan 8, 2009 02:02 |
|
hexadecimal posted:Depending on how complex your parsing needs to be for the webpage, you may or may not need Yacc, but lexer is a pretty nice tool. Also fast as gently caress. Althugh everyone else has already called you out for this, the reason why I recommended things like beautifulsoup or lxml is that although parsing well formed htm lis easy, html is never well formed. An HTML parser that supports xpath is a fantastic invention, I think some even support css selectors too.
|
# ¿ Jan 8, 2009 09:37 |
|
Please don't rely on hexadecimal for help. If you want accurate answers, you're better off posting in the relevant threads. Hexadecimal is frequently corrected by people who can program in c++. If you are new to programming, I would learn something like Python, Ruby or Perl. They're a lot easier to pick up than java, and often easier to use straight away. If you're hardcore - learn scheme, you will learn a lot more but I would say one of the more mainstream dynamic languges might be more approachable. OO is best learned once you have programs to structure. Java and C# are mutually intelligable dialects, so don't worry too much about picking one or the other. Overall, you will spend more time learning libraries than you will languages.
|
# ¿ Jan 14, 2009 12:08 |
|
Liquid Silk posted:Hi guys, I have a PROLOG program to do, quote:a stupid Eliza type program, and I have various standard replies to keywords, such as animals; Traditionally, this would look something like this: code:
quote:I now have to have a specific, distinct response if the input contains happy feelings AND animals. Anyone have any tips? Tia. code:
quote:Edit: I'm sure this is going to be really easy an answer, but I've been racking my brains and trying all sorts of complications, that I'm going crazy. Don't try and write an optimal solution, write a simple one first. I would probably do something* like this: code:
code:
tef fucked around with this message at 17:41 on Jan 14, 2009 |
# ¿ Jan 14, 2009 17:37 |
|
I wrote http://logo.twentygototen.org, and I've been asked to kludge it to make it work with speech recognition. Right now we're using a hack - a fixed vocabulary in osx' speakable items, that sends the right keys to firefox. I've been pointed at the following, and it looks like a start: http://www.w3.org/TR/wai-aria/ , but I would be thankful at any other information out there. The plan is to change from a text-box to an almost command-line like interaction, a bit like working in a shell. We might have to change the syntax slightly to support this. I'm also looking at proprietary sr software, or a series of convoluted hacks to take it forward. Does anyone have any experience in speech driven environments ? or how to hook into osx's speech recognition a little deeper ? or in general any ideas about how to essentially write a speech driven code editor ? edit: http://web.archive.org/web/20080213071927/voicecode.iit.nrc.ca/VoiceCode/public/ywiki.cgi tef fucked around with this message at 06:48 on Jan 27, 2009 |
# ¿ Jan 27, 2009 04:45 |
|
I'm pretty sure CLC intercal allows you to redefine integer literals http://intercal.freeshell.org/ http://esolangs.org/wiki/CLC-INTERCAL code:
quote:What happens here? The first assignment introduces overloading of .2, so the second assignment assigns #3 to #1. In other words, from now on every time you say 1 you really mean 3. We have changed the value of a constant, but not just that. Consider the third assignment: this assigns #3 to .3, not #1 to .1, for obvious reasons. This can be a great obfuscation tool. tef fucked around with this message at 01:50 on Feb 10, 2009 |
# ¿ Feb 10, 2009 01:47 |
|
a warning: regardless of what question you ask, if it mentions 'text editing' and 'linux' you will get a few responses saying "vim" or "emacs" these are probably not what you want. (for example the thread asking for nano syntax highlighting is about 3 pages of vim people and then it breaks into vi vs emacs)
|
# ¿ Feb 11, 2009 16:45 |
|
tef posted:I wrote http://logo.twentygototen.org, and I've been asked to kludge it to make it work with speech recognition. I didn't see any help with this so I'll try again but be a little bit more specific. Currently the logo interpreter works on a 'file at a time' mentality. You pass it a lump of text and it runs it. I want to change this into a more shell-like interaction, i.e. a read, eval, print loop. How do you write parsers/tokenizers to facilitate REPL's ? Logo has a few issues that make this a little more awkward, specifically lack of terminators. "fw 100 rt 90" is a valid command. I've cooked up a little hack here that just checks for things like balanced parenthesis before evaling them. http://logo.twentygototen.org/static/speech.html But, I don't get to check the syntax of anything with [] or function definitions with this approach. What parser designs support this approach?
|
# ¿ Feb 14, 2009 21:18 |
|
Hopping on the pythagorean train:code:
tef fucked around with this message at 09:50 on Mar 21, 2009 |
# ¿ Mar 21, 2009 09:45 |
|
ShoulderDaemon posted:Please don't write your own encryption software, you'll do it wrong. Find some library that complies with RFC 3852. This may help: http://www.google.com/search?q=php+gpg
|
# ¿ Mar 26, 2009 02:57 |
|
Dijkstracula posted:If you don't mind getting your hands dirty with a backtracking logic language like Prolog, this sounds like a good constraint programming problem. (refresher: Variables start with a capital, and atoms (string constants) start with a lowercase letter, and statements end with a period). in foo.pl: code:
code:
You can add new rules like can_pair(foo,Y) :- member(Y, [abacus, zebra, foxtrot]). to say goo can pair with abacus, zebra or foxtrot. Edit: This is a simple generate and test program. It is possible to optimize this significantly. tef fucked around with this message at 16:22 on Mar 30, 2009 |
# ¿ Mar 30, 2009 15:14 |
|
Fruit Smoothies posted:So this simply tells if a set of boxes is allowed or not, based on the constraints of the allowed pairs? No. It's *generate* and test. By passing a variable in, it will search for a value that is a valid set of pairs from the given elements: code:
The trick with prolog is that you simply state what you want, and then prolog finds it for you. You can also call it with a set and a list of pairs to see if it is a valid combination. Or call it with a list of pairs and find out the set of elements. Or call it with two variables to enumerate all possible sets of elements and pairs. Edit: To give a simpler example: Every prolog expression is really a question: code:
I wrote rules to say that a list of elements and a list of pairs is valid if it could make one pair, and the rest of the elements could be made into pairs. The prolog interpreter searches for a possible case where the rule is true. By supplying variables, I can enumerate cases where the rule is true. The program itself is very trivial and basic prolog, if you can write up the rules in a pastebin or link to them, I can try to add it to the example I wrote above. tef fucked around with this message at 16:24 on Mar 30, 2009 |
# ¿ Mar 30, 2009 16:11 |
|
Fruit Smoothies posted:I guess what I don't get about any of these bits of code, is when the program stops, and where it starts. In mine it starts by taking two items, trying to pair them, and then moves onto the rest of them. It stops when it runs out of items to pair, or if it can't pair the remaining items. In the latter case, it will not produce a solution.
|
# ¿ Mar 30, 2009 18:08 |
|
What is IsAllowed defined as?
|
# ¿ Apr 4, 2009 21:57 |
|
Fruit Smoothies posted:It returns true if the pair is allowed, and false if the pair is forbidden. You really have a knack for answering a question without any substance. This is I think the third time I've asked for your constraints and either you present a different set to the one you want to implement (primes), or in this case you manage to tell me "isallowed" is whether a pair is allowed. When someone asks for the definition, the mean the code.
|
# ¿ Apr 5, 2009 15:29 |
|
Fruit Smoothies posted:That problem also involves tree-structures, and backtracking too. For a problem that involves abstract tree structures and backtracking, you really ought to take a closer look at prolog. (I don't get to say this often, prolog is useless at nearly everything else) What you're trying to do sounds like an Expert System, and people have been writing them in prolog for years. Constrained search is what prolog excels at, and what compilers optimize for. There is also a strongly typed variant if you want excellent performance. If you've done a little programming before, "The Art of Prolog" is an excellent guide to the language.
|
# ¿ Apr 7, 2009 01:26 |
|
kaschei posted:Is there a good tool for replacing accented characters with their closest western equivalent? In python here is a function unicodedata.normalize(form, unistr) I can't recall the right argument off hand though.
|
# ¿ Apr 23, 2009 16:26 |
|
L:ordSilent posted:stupid question: I've done this for a living, it isn't fun. One of the web unit testing frameworks will allow you to simulate user input, but it isn't good for heavy loads or fast requests.
|
# ¿ Apr 24, 2009 00:58 |
|
If you can't decide which language to learn, flip a coin. I would suggest using something not too astray from what you are used to (i.e a dynamicly typed functional language, before having fun with type inference). SICP is a good text if you want to learn scheme, although large and dense. I am sure there are shorter texts. DrScheme is also a great IDE/Environment to learn in (so I am told). Scheme is really geared towards learning to program and the documentation and tools available are mostly to that end. Haskell, although useful is still the experimental stomping ground of new functional features. Monads can be understood, but that doesn't mean it will be straight forward using them well. (Haskell is also lazy). ML or some of its dialects are eagerly evaluated, so it is a little more straight forward to reason about what the code is doing when, but it can make some things awkward. If you're going to look at ml - ocaml or f# if you're on windows might be worth looking at too. On the whole, I would say if you want to learn the most, read as much sicp as you can, and do exercises in scheme.
|
# ¿ Apr 26, 2009 20:02 |
|
Who knows anything about constraint handling rules (CHR)? I've been looking to do some type inference and program analysis and it looks to be a simple way to write one. I've found some work on embedding CHR into HM, but I was wondering if anyone had any pointers?
|
# ¿ Apr 26, 2009 20:04 |
|
rjmccall posted:AFAIK Martin is the one really pushing type-analysis through CHRs, or at least he was before he became Gainfully Employed. Thanks - it seems that constraint programming is mostly ignored for type systems, although they seem perfectly suited for them quote:The thing to remember about CHRs is that they're basically a full computation engine, so you quickly become bound by the restrictions of the solver you use. I'm planning on implementing success typing using chr in swi/prolog. I don't think it's as limited as the chameleon prototype, or as academic. But if you know any more I would be grateful.
|
# ¿ Apr 27, 2009 01:09 |
|
the bash built in echo works, /bin/echo doesn't (on osx) sh -c 'echo -e "\033]0;title prefix\007"' tef fucked around with this message at 02:32 on Apr 28, 2009 |
# ¿ Apr 28, 2009 02:28 |
|
I edited my post, but code:
this also works.
|
# ¿ Apr 28, 2009 02:34 |
|
I've been asked to set up a cruise control installation. It's been fun so far. Unfortunately I've now managed to get it so that after scheduling a build, it is successful but ignored. [cc]Apr-30 12:25:36 jectController- build-cdm-trunk Controller: build result event: build successful This appears in the cc logs, but the dashboard remains ignorant. I'm struggling to find documentation on what feels like an awful, awful, awful product. Any ideas, or good sources about kicking cruisecontrol until it bleeds? Alternatively, if there are similar pieces of software for ci that suck a lot less I'd be interested too
|
# ¿ Apr 30, 2009 12:28 |
|
Otto Skorzeny posted:http://www.xach.com/lisp/taste-for-the-web.html This is a much better satire of paul graham: http://www.paulgraham.com/hijack.html
|
# ¿ May 1, 2009 20:18 |
|
L:ordSilent posted:Ah. I guess that would be a browser. Scratch my pervious question then. What can i do to strip the html away from the information i want? I found libxml2 to be quite good*, since I assume you're using c with libcurl. * powerful, but I used the python wrapper lxml.
|
# ¿ May 6, 2009 14:45 |
|
You can transform it into an iterative form with an explict stack:code:
|
# ¿ May 8, 2009 14:13 |
|
We can transform your first function into one that does not call itself: It takes a low, high pair, and returns a list of new pairs that need to be sorted. code:
We could then do code:
|
# ¿ May 8, 2009 14:32 |
|
This also means you can test quicksort partial to see if it is partitioning the lists. edit: because I haven't tested anything.
|
# ¿ May 8, 2009 14:33 |
|
For too many reports. And yes, hexadecimal (perma'd user enenthogen) got banned after posting in yospos.
|
# ¿ May 18, 2009 12:49 |
|
SH/SC almost certianly.
|
# ¿ May 18, 2009 16:43 |
|
Dijkstracula posted:Oh really? I missed that memo. http://forums.somethingawful.com/showthread.php?threadid=3057002&pagenumber=1#post355159936 Where is Unabomber, I always enjoyed his C arguments. csammis posted:If you're talking about teapot's permaban, it was in CoC I must have been confusing it with one of his many bans in sh/sc.
|
# ¿ May 18, 2009 21:01 |
|
Prolog solution code:
|
# ¿ May 23, 2009 12:32 |
|
Actually I only saw the thread now. Factor would be good too as it has reversible arithmetic.
|
# ¿ Jun 4, 2009 19:05 |
|
Dijkstracula posted:Wait, wait, what? What the hell are you talking about? Prolog is a logic language and has nothing to do with databases. Datalog is an example to the contrary - logical programming makes it very easy to express the relationship between things.
|
# ¿ Jun 4, 2009 19:07 |
|
|
# ¿ May 14, 2024 01:09 |
|
Evil Home Stereo posted:I need some ideas for a good way to go about solving this problem: Declaratively - you need to find a language in which you can express your constraints easily, and then use library code to solve it. quote:This is basically what I'm working with: You could do this in prolog but it would involve a lot of leg work, as although it is quite easy to write the solver, I'm not aware of any off the top of my head that will do enough for you. Admittedly you could write a tiny constraint solver which would be fun. Alternatively you could use a computer algebra system, which tend to cater to these sorts of programs. Wikipedia is kinda useful here and it would be worth having a poke around: http://en.wikipedia.org/wiki/Category:Computer_algebra_systems http://en.wikipedia.org/wiki/SymPy
|
# ¿ Jun 4, 2009 19:14 |