Search Results

Search found 12 results on 1 pages for 'malvolio'.

Page 1/1 | 1 

  • How do I publicize a cool bookmarklet?

    - by Malvolio
    I wrote a really cool bookmarklet and now I want to tell everyone. I have absolutely no idea where to go, is there some sort of exchange for these things? In case anyone is curious: I was tired of having to retype URLs from my desktop browser on to my phone browser, with its itsy-bitsy keyboard, so I wrote a bookmarklet that converts the current URL to a QR code, which I can scan in a few seconds. javascript:window.location="http://chart.apis.google.com/chart?chs=250x250&cht=qr&chl="+escape(window.location)

    Read the article

  • Is there an (open-source) ReST-based blogging/forum package out there?

    - by Malvolio
    The site I work on is almost entirely in Javascript, it just goes back (via Ajax) to the server for authentication, database access, things like that. My boss would like me to add blogging, forum, and commenting capabilities. I don't want to implement it from scratch and I certainly don't want to integrate some HTML-generating PHP atrocity. Ideal, I'm looking for a package that does all the backend work and offers ReST interface so I can write a Javascript-based UI that integrates nicely with the existing site. Does such a thing exist?

    Read the article

  • Deleting slow on X11 emacs

    - by Malvolio
    I'm running GNU Emacs 21.4.1 on a (remote) remote Linux ((CentOS) box, using my MacBook as the X-server. Works fine, unless I try to delete a word, line, or region. Then it locks up for 30 seconds or so. It sounds like a minor thing, but you realize how often you do a delete when you have to stop for 30 seconds every time. My theory is that Emacs is trying to put the text in the X-server cut-and-paste buffer, which is trying to put it in the OSX cut-and-paste buffer and somewhere along the way, the process is blocked until it times out. (My only evidence for this theory is (a) copy-region behaves the same way and (b) deleted text doesn't show up in the buffer.) Any suggestions appreciated. Edit: (setq interprogram-cut-function nil) fixed me right up. Which makes perfect sense. Thanks, Trey.

    Read the article

  • Urgent: how to deny read access to a ExecCGI directory

    - by Malvolio
    First, I can't believe that that isn't the default behavior. Second, yikes! I don't know how long my code's been hanging out there, with all sort of cool secret stuff, just waiting for some hacker who knows Apache better than I do. EDIT (and apology) Well, this is sort of embarrassing. Here's what happened: We had some Python scripts available to the web, at /aux/file.py, which were not surprisingly at /var/www/http/aux . Separately, we were running an app server and Apache proxies through at /servlets/. A contractor had constructed the WAR file by bundling up all the generated files including the Python files (which are in a directory also called aux, not surprisingly), so if you typed in /servlets/aux/file.py, the web-server would ask the app-server for it and the app-server would just supply the file. It was the latter URL that this morning I happened to type in by accident and lo, the source appeared. Until I realized the shear unlikelihood of what I had done, the situation was rating about 8.3 on the sphincter scale. After a tense half-hour or so I realized that it had nothing to do with the CGI (and that serving files that were also executable would be not only foolish but also impossible), and was able to address the real problems. So -- sorry, everybody. Let the scorn-fest commence.

    Read the article

  • Scala giving me "illegal start of definition"

    - by Malvolio
    I'm trying to get started with Scala and cannot get out of the starting gate. A file consisting of the line package x gives me error: illegal start of definition Regardless of what x is and regardless of where I put the file (I had a theory that I had to place the file in a directory hierarchy to match the package definition, but no). I get the same error with the example code from the web site and with the REPL.

    Read the article

  • How do I implement configurations and settings?

    - by Malvolio
    I'm writing a system that is deployed in several places and each site needs its own configurations and settings. A "configuration" is a named value that is necessary to a particular site (e.g., the database URL, S3 bucket name); every configuration is necessary, there is not usually a default, and it's typically string-valued. A setting is a named value but it just tweaks the behavior of the system; it's often numeric or Boolean, and there's usually some default. So far, I've been using property files or thing like them, but it's a terrible solution. Several times, a developer has added a requirement for a configuration but not added the value to file for the live configuration, so the new release passed all the tests, then failed when released to live. Better, of course, for every file to be compiled — so if there's a missing configuration, or one of the wrong type, it won't get past the compiler — and inject the site-specific class into the build for each site. As a bones, a Scala file can easy model more complex values, especially lists, but also maps and tuples. The downside is, the files are sometimes maintained by people who aren't developers, so it has to be pretty self-explanatory, which was the advantage of property files. (Someone explain XML configurations to me: all the complexity of a compilable file but the run-time risk of a property file.) What I'm looking for is an easy pattern for defining a group required names and allowable values. Any suggestions?

    Read the article

  • Should I use implicit conversions to enforce preconditions?

    - by Malvolio
    It occurs to me that I could use use implicit conversions to both announce and enforce preconditions. Consider this: object NonNegativeDouble { implicit def int2nnd(d : Double) : NonNegativeDouble = new NonNegativeDouble(d) implicit def nnd2int(d : NonNegativeDouble) : Double = d.v def sqrt(n : NonNegativeDouble) : NonNegativeDouble = scala.math.sqrt(n) } class NonNegativeDouble(val v : Double ) { if (v < 0) { throw new IllegalArgumentException("negative value") } } object Test { def t1 = { val d : Double = NonNegativeDouble.sqrt(3.0); printf("%f\n", d); val n : Double = NonNegativeDouble.sqrt(-3.0); } } Ignore for the moment the actual vacuity of the example: my point is, the subclass NonNegativeDouble expresses the notion that a function only takes a subset of the entire range of the class's values. First is this: A good idea, a bad idea, or an obvious idea everybody else already knows about Second, this would be most useful with basic types, like Int and String. Those classes are final, of course, so is there a good way to not only use the restricted type in functions (that's what the second implicit is for) but also delegate to all methods on the underlying value (short of hand-implementing every delegation)?

    Read the article

  • Simplest one-to-many Map case in Hibernate doesn't work in MySQL

    - by Malvolio
    I think this is pretty much the simplest case for mapping a Map (that is, an associative array) of entities. @Entity @AccessType("field") class Member { @Id protected long id; @OneToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY) @MapKey(name = "name") private Map<String, Preferences> preferences = new HashMap<String, Preferences>(); } @Entity @AccessType("field") class Preferences { @ManyToOne Member member; @Column String name; @Column String value; } This looks like it should work, and it does, in HSQL. In MySQL, there are two problems: First, it insists that there be a table called Members_Preferences, as if this were a many-to-many relationship. Second, it just doesn't work: since it never populates Members_Preferences, it never retrieves the Preferences. [My theory is, since I only use HSQL in memory-mode, it automatically creates Members_Preferences and never really has to retrieve the preferences map. In any case, either Hibernate has a huge bug in it or I'm doing something wrong.]

    Read the article

  • Doesn't (didn't) Scala have automatically generated setters?

    - by Malvolio
    Google and my failing memory are both giving me hints that it does, but every attempt is coming up dry. class Y { var y = 0 } var m = new Y() m.y_(3) error: value y_ is not a member of Y Please tell me I am doing something wrong. (Also: please tell me what it is I am doing wrong.) EDIT The thing I am not doing wrong, or at least not the only thing I am doing wrong, is the way I am invoking the setter. The following things also fail, all with the same error message: m.y_ // should be a function valued expression m.y_ = (3) // suggested by Google and by Mchl f(m.y_) // where f takes Int => Unit as an argument f(m.y) // complains that I am passing in Int not a function I am doing this all through SimplyScala, because I'm too lazy and impatient to set up Scala on my tiny home machine. Hope it isn't that... And the winner is ... Fabian, who pointed out that I can't have a space between the _ and the =. I thought out why this should be and then it occurred to me: The name of the setter for y is not y_, it is y_= ! Observe: class Y { var y = 0 } var m = new Y() m.y_=(3) m.y res1: Int = 3 m.y_= error: missing arguments for method y_= in class Y; follow this method with `_` if you want to treat it as a partially applied function m.y_= ^ m.y_=_ res2: (Int) => Unit = def four(f : Int => Unit) = f(4) four(m.y_=) m.y res3: Int = 4 Another successful day on StackExchange.

    Read the article

  • What's the *right* way to handle a POST in FP?

    - by Malvolio
    I'm just getting started with FP and I'm using Scala, which may not be the best way, since I can always fall back to an imperative style if the going gets tough. I'd just rather not. I've got a very specific question that points to a broader lacuna in my understanding of FP. When a web application is processing a GET request, the user wants information that already exists on the web-site. The application only has to process and format the data in some way. The FB way is clear. When a web application is processing a POST request, the user wants change the information held on the site. True, the information is not typically held in application variables, it's in a database or a flat-file, but still, I get the feeling I'm not grokking FP properly. Is there a pattern for handling updates to static data in an FP language? My vague picture of this is that the application is handed the request and the then-current site state. The application does its thing and returns the new site-state. If the current site-state hasn't changed since the application started, the new state becomes the current state and the reply is sent back to the browser (this is my dim image of Clojure's style); if the current state has been changed (by another thread, well, something else happens ...

    Read the article

  • Can I get a patch-compatible output from git-diff?

    - by Malvolio
    I am doing something very simple wrong. I'm trying to prepare an ordinary patch file, so I can reapply some changes: $ git diff > before $ git diff something_here > save.patch $ git checkout . $ patch < save.patch $ git diff > after $ diff before after $ With something_here blank it almost works, but the file names aren't right. I think I'm just I'm missing some option. In real life, I am going to do a merge after the checkout, so the patch might fail there, but you see what I'm getting at.

    Read the article

  • What's the difference between => , ()=>, and Unit=>

    - by Malvolio
    I'm trying to represent a function that takes no arguments and returns no value (I'm simulating the setTimeout function in JavaScript, if you must know.) case class Scheduled(time : Int, callback : => Unit) doesn't compile, saying " `val' parameters may not be call-by-name" case class Scheduled(time : Int, callback : () => Unit) compiles, but has to be invoked strangely, instead of Scheduled(40, { println("x") } ) I have to do this Scheduled(40, { () => println("x") } ) What also works is class Scheduled(time : Int, callback : Unit => Unit) but is invoked in an even-less-sensible way Scheduled(40, { x : Unit => println("x") } ) (What would a variable of type Unit be?) What I want of course is a constructor that can be invoke the way I would invoke it if it were an ordinary function: Scheduled(40, println("x") ) Give baby his bottle!

    Read the article

1