Search found 57 matches

by Pepve
Tue Jan 29, 2013 5:13 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

Though I don't really like the way python appears to let scope 'leak' in some cases, but not in others. If it was consistent (and I'd guess the 'nonlocal' keyword allows that consistency) I'd probably be less weary. In the absence of instructions otherwise: writes are local, reads walk up the stack...
by Pepve
Sun Dec 16, 2012 4:35 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

Scheme is teasing me:

Code: Select all

> (define-syntax s (syntax-rules () ((_ (a ... b) ...) '(a ... ... b ...))))
> (s (4 5) (6 7 8))
(4 6 7 5 8)

I'm trying to implement this...
by Pepve
Sun Oct 28, 2012 10:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

I am wanting to sync my staging db with the live one every night. I am running this command using cron mysqldump live --ignore_table=live.foo -uusername -ppassword | mysql -uusername -ppassword staging Is this the right way to do this? It seems to work but I don't want to be doing something that ma...
by Pepve
Fri Mar 23, 2012 11:03 am UTC
Forum: Coding
Topic: The Red Spider Project
Replies: 246
Views: 189655

Re: Idea for a fun joint effort: xkcd hacking project

⋅ If we want to maintain platform neutrality, we need a list of explicitly supported platforms. Also, a requirement for merging into the stable branch will have to be that a particular bit of code has been tested on all those platforms. Obviously, not everybody can test everything everywh...
by Pepve
Wed Mar 21, 2012 9:48 am UTC
Forum: Coding
Topic: The Red Spider Project
Replies: 246
Views: 189655

Re: Idea for a fun joint effort: xkcd hacking project

I like it. For the name, how about "XKCD unconstrained"? XKCD because that's where we're from. Unconstrained because it highlights an important aspect of this joint effort: to not constrain ourselves or each other too much. (And the fact that it is coding will be obvious from the context a...
by Pepve
Sun Mar 04, 2012 10:03 pm UTC
Forum: Coding
Topic: A nicer alternative to makefiles
Replies: 16
Views: 8079

Re: A nicer alternative to makefiles

So it is not just a new wheel you're inventing. It is a chariot.
by Pepve
Sun Mar 04, 2012 10:11 am UTC
Forum: Coding
Topic: Hex dump of symlink or directory?
Replies: 6
Views: 4699

Re: Hex dump of symlink or directory?

I doubt it's ASCII though, try symlinking to 文件名.
by Pepve
Sun Mar 04, 2012 10:00 am UTC
Forum: Coding
Topic: A nicer alternative to makefiles
Replies: 16
Views: 8079

Re: A nicer alternative to makefiles

Are you inventing a new wheel?
by Pepve
Thu Feb 23, 2012 9:38 pm UTC
Forum: Coding
Topic: Understanding Code Bases / Refactoring [Discussion,Research]
Replies: 8
Views: 3045

Re: Understanding Code Bases / Refactoring [Discussion,Resea

I'm very skeptical of our ability to read code in general. Let alone understanding sizeable code bases by reading code. Documentation is usually even worse (because it's lagging behind or not written at all). So I usually just go at it. I start some refactorings that I never finish (because you can ...
by Pepve
Wed Feb 22, 2012 8:21 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

The ideal situation I'd want is a compile-time enforced "you must handle the set of answers that this function can return". But that is rare outside of some relatively esoteric languages (like Haskell). I guess that is the idea behind Java's checked exceptions and I don't think that this ...
by Pepve
Fri Feb 10, 2012 7:42 pm UTC
Forum: Coding
Topic: Ethics and web programming question...
Replies: 12
Views: 3712

Re: Ethics and web programming question...

Stenography usually refers to hiding the message in the actual information content -- ie, you twerk the low bits of an image (that people can't really see, but are still displayed) into a message. Toss in some encryption, and it could be completely indistinguishable (even in theory) from random noi...
by Pepve
Wed Feb 08, 2012 11:17 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

Is it backwards? My OS calls them stdin and stdout..
by Pepve
Mon Jan 16, 2012 10:34 pm UTC
Forum: Coding
Topic: Object.create in javascript
Replies: 13
Views: 2669

Re: Object.create in javascript

The memory may be worth it, of course. Any idea how we could test/benchmark the different approaches? Extension is indeed not really a feature of the idiom, but then again, I don't need it that often. Here it is in code (to show it's not really that awful): function makeBetterList() { var list = mak...
by Pepve
Sun Jan 15, 2012 3:36 pm UTC
Forum: Coding
Topic: Object.create in javascript
Replies: 13
Views: 2669

Re: Object.create in javascript

Maybe I just do not really understand prototypes (I've never written anything that used them), maybe I was too impressed when Crockford said "power constructor". But I much prefer this code to the above: function makeList() { var items = []; return { add: function add(item) { items.push(it...
by Pepve
Fri Jan 13, 2012 7:36 pm UTC
Forum: Coding
Topic: Object.create in javascript
Replies: 13
Views: 2669

Re: Object.create in javascript

Zamfir wrote:D. Separating templates from instances is good, even if javsascript doesn't enforce that separation

I don't follow, care to elaborate?
by Pepve
Sat Dec 24, 2011 12:15 pm UTC
Forum: Coding
Topic: Something to laugh about
Replies: 9
Views: 3121

Re: Something to laugh about

Having written one or two poker AIs, I think it's funny.

And I can't stand the other commenters moralistic behaviour, I suggest you get off your high horse and enjoy life a little.
by Pepve
Fri Nov 11, 2011 7:45 pm UTC
Forum: Coding
Topic: Database structure problem with tags, categories
Replies: 19
Views: 4604

Re: Database structure problem with tags, categories

Or go with a document database, and documents like this:

Code: Select all

{
  type: "picture",
  title: "Crazy beach photo",
  size: {
    width: 1000,
    height: 800
  },
  tags: ["funny", "bikini", "fail"]
}
by Pepve
Mon Nov 07, 2011 10:21 pm UTC
Forum: Coding
Topic: Eclipse does weird things with CRLF; Can it be fix'd?
Replies: 7
Views: 3807

Re: Eclipse does weird things with CRLF; Can it be fix'd?

(note: bash has nothing to do with it, it's your xterm or whatever that's handling the CR and LF). So bash is basically just a shell around the actual terminal... I feel stupid now. It's the other way around, bash is a program in your terminal. You can run any console program in a terminal. (Try `x...
by Pepve
Sun Oct 23, 2011 8:51 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

Thank you for the explanation. What about the "multi-salted" bit?
by Pepve
Sun Oct 23, 2011 5:36 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

Steax wrote:[...] multi-salted, 1000-times hashed password mechanism [...]

I don't understand this, can you elaborate?
by Pepve
Wed Oct 19, 2011 8:12 pm UTC
Forum: Coding
Topic: Selective-recursive SCP
Replies: 4
Views: 2560

Re: Selective-recursive SCP

Code: Select all

scp `sed 's/.*/user@fileserver:\0/' files` ~/data

Although i'm not sure if you'll exceed some command line length limit if files is very big. If that happens, just split the files file.
by Pepve
Wed Sep 07, 2011 6:12 pm UTC
Forum: Coding
Topic: IRC WolfBot
Replies: 2
Views: 1855

Re: IRC WolfBot

Maybe provide some links?
by Pepve
Tue Aug 09, 2011 7:50 pm UTC
Forum: Coding
Topic: Renaming a large number of files in linux
Replies: 8
Views: 1907

Re: Renaming a large number of files in linux

There are many ways to do that. Here's one i like for bash:

Code: Select all

for i in *; do mv "$i" "${i:0:1}5${i:1}"; done

It inserts a 5 in the second position in each filename in the current directory. To run it: open a terminal, cd to the directory with the files, run the command.
by Pepve
Sun Aug 07, 2011 10:38 am UTC
Forum: Coding
Topic: Feedback on my programming tutorial
Replies: 13
Views: 2711

Re: Feedback on my programming tutorial

Your first post ("Welcome") made me chuckle, that's an important box to tick. I like the premise of using simple tools to solve difficult problems. It also keeps you far away from the 'unsmoothness' of design patterns, which is cool. I think bc is a nice choice, its limits shouldn't matter...
by Pepve
Tue Jun 21, 2011 10:00 pm UTC
Forum: Coding
Topic: Python IDLE Icon
Replies: 2
Views: 1197

Re: Python IDLE Icon

If you're using Linux, your window manager can likely be configured to substitute your own icon.
by Pepve
Tue Jun 21, 2011 9:55 pm UTC
Forum: Coding
Topic: Command line challenges
Replies: 37
Views: 6332

Re: Command line challenges

I've got two solutions for #2, the prime thing. One with common code factored out (who does that in shell programming?): r="| factor | sed -rn '/^([^:]*): \1/"; sh <<< "seq 2000 3000 ${r}s/(.)(.)(.)(.).*/expr \1 + \2 + \3 + \4/p' | sh ${...
by Pepve
Tue Jun 21, 2011 8:18 pm UTC
Forum: Coding
Topic: Command line challenges
Replies: 37
Views: 6332

Re: Command line challenges

My solution for #1. It uses date which i think is acceptable (not a fan of strict rules, just a fan of the shell). It's also about 10 times faster than Cosmologicon's. :-P seq 2000 3000 | sed 's/.*/[ `date -d \0-7-1 +%a` = Fri ] \&\& echo \0/' | sh I like this game. edit: spelling
by Pepve
Wed Jun 15, 2011 9:01 pm UTC
Forum: Coding
Topic: (Java) Rotate a sprite manually, or in the code?
Replies: 7
Views: 2232

Re: (Java) Rotate a sprite manually, or in the code?

Let's make that shell snippet work:

Code: Select all

for i in `seq -w 0 15 359`; do echo Rotating $i degrees...; convert source.png -matte +clone -background none -rotate $i -gravity center -compose Src -composite dest_$i.png; done
by Pepve
Thu Jun 09, 2011 6:00 pm UTC
Forum: Coding
Topic: Interact with a Java applet on a website
Replies: 6
Views: 1593

Re: Interact with a Java applet on a website

Thought of another option, it requires some Java-fu. Download the applet and unpack it. Decompile the classes. Figure out how everything works. Write your own program to get the data you want, using the applet as a library. The last step has variations, depending on your findings in the figuring-eve...
by Pepve
Thu Jun 09, 2011 4:00 pm UTC
Forum: Coding
Topic: Interact with a Java applet on a website
Replies: 6
Views: 1593

Re: Interact with a Java applet on a website

The applet gets its data from some place. You could try to reverse engineer the protocol it uses to get the data and implement it yourself.

Otherwise maybe look into an OS-level automation tool, but i have no experience with that.
by Pepve
Thu Jun 09, 2011 9:46 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

May I point out Node.js . It is a JavaScript environment designed to run on a server or other non-browser based systems. It has support for interacting with the filesystem, with low level network protocols, the operating system and its processes. It provides a very simple module system for loading ...
by Pepve
Sun May 29, 2011 12:17 pm UTC
Forum: Coding
Topic: Adobe Air?
Replies: 10
Views: 1634

Re: Adobe Air?

Ha, you're building a LIMS.

Did you ask your users about their data concerns? Why not put it on the web and sell accounts?
by Pepve
Sat May 28, 2011 7:51 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

I'm presuming you're using a Debian-based distro. I tested it and got the same result. Then i looked at /etc/bash_completion (which is... 1700 lines). I don't really understand what's going on there, but they are doing something special to sudo completion. I think this may be a bug in the sudo handl...
by Pepve
Thu May 26, 2011 9:09 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

I think you're looking for dependency injection. Google link.
by Pepve
Mon May 23, 2011 7:52 pm UTC
Forum: Coding
Topic: Perl: pattern match can't substitute
Replies: 13
Views: 1937

Re: Perl: pattern match can't substitute

That was more an aside than a real solution (i just wanted to show my shell-fu). I think you're better off using the Perl snippet i posted above. You also might want to read up on Perl and XML.

Xanthir, sorry, didn't see it.
by Pepve
Sun May 22, 2011 1:36 pm UTC
Forum: Coding
Topic: Perl: pattern match can't substitute
Replies: 13
Views: 1937

Re: Perl: pattern match can't substitute

I followed the link, read it, agreed with it, and failed to spot the introduction to XML processing with Perl (or any other language). Now i don't know Perl either, but this seems to work ( mostly copy pasted ): use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file('file.xm...
by Pepve
Fri May 20, 2011 9:45 pm UTC
Forum: Coding
Topic: Perl: pattern match can't substitute
Replies: 13
Views: 1937

Re: Perl: pattern match can't substitute

This is what i would do, using XMLStarlet:

Code: Select all

xmlstarlet edit --pf --rename '//strong/a/.. | //a/strong' -v emph file.xml
by Pepve
Thu May 12, 2011 6:06 pm UTC
Forum: Coding
Topic: A Question About Coding NINT
Replies: 8
Views: 1620

Re: A Question About Coding NINT

Burgerman wrote:(also, just out of curiosity, Python 2 or 3?)

Python 3, it's better.
by Pepve
Mon May 09, 2011 9:31 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

First of all, check out the trunk, not the project root: svn co http://server/svn/project/trunk Instead of: svn co http://server/svn/project Yeah... it would be nice if it had one ... Which is probably the cause of the 2 n -ness, too... each time they tag a version, they're tagging the whole thing,...
by Pepve
Sun May 08, 2011 3:43 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9990
Views: 2003584

Re: Coding: Fleeting Thoughts

First of all, check out the trunk, not the project root: svn co http://server/svn/project/trunk Instead of: svn co http://server/svn/project And the same goes for tagging: svn copy http://server/svn/project/trunk http://server/svn/project/tags/v1.0 Instead of: svn copy http://server/svn/project http...

Go to advanced search