Search found 76 matches

by Maelstrom.
Thu Mar 23, 2017 8:44 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

This even covers the rather narrow use-case of times when I want one of my 'anonymous' positionals to have a default value: def foo(*args, **kwargs): try: a, b = args except ValueError: try: a, b = args[0], None except IndexError as e: raise TypeError(e) This misbehaves when there are >2 args: >>> ...
by Maelstrom.
Sun Mar 27, 2016 7:34 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQA Thread - Queer Support!

A nice story appeared on the front page of the ABC (Australian) News website the other day, about gender fluid kids. I thought it was a nice story :)

http://www.abc.net.au/news/2016-03-23/g ... ry/7270260
by Maelstrom.
Mon Dec 21, 2015 11:49 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I've made some changes to the snake scrolling demo: the columns are now 100vh, automatically stretch to fill the width correctly, and all but the right-most scroll bar is hidden. Additionally, I've changed up the JS so the number of columns is automatically adapted to, as well as stopping a weird ja...
by Maelstrom.
Mon Mar 09, 2015 11:08 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

HTML question, since my HTML/CSS knowledge is relatively weak. Suppose I want to display a character in a box with a specific width in pixels. Can I do that, and how? (For more context, I have a list. Each line in the list starts with a short sequence of what are currently small, characterish-sized...
by Maelstrom.
Thu Dec 11, 2014 1:14 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQA Thread - Queer Support!

Is xkcd-q still around on IRC? I can't remember how to get on IRC anymore and I'm not even sure if that channel is still active. I have some personal questions I think would be easier to ask and get advice on in "real time". The IRC channel is still around. You can easily get online using...
by Maelstrom.
Sun Jul 20, 2014 8:52 pm UTC
Forum: Coding
Topic: Coding: Hacks and Snippets
Replies: 434
Views: 774573

Re: Coding: Hacks and Snippets

Btw, I just noticed this part: #Check that dd is still running if kill -0 $pid 2>/dev/null A null signal to check if a process is running and receiving signals. That's really cool. I didn't know about that. Yeah, I just noticed that myself yesterday. An earlier version of my script didn't do that, ...
by Maelstrom.
Wed Mar 26, 2014 8:54 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Diadem wrote:A solution to this problem is to put the comma in front:

Code: Select all

a = [ 1
    , 2
    , 3
    ]

This just moves the problem from the last element to the first element. Extra commas are the only safe way that avoids the most issues
by Maelstrom.
Mon Feb 10, 2014 8:57 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Does anyone have any great suggestions for lightweight Python web frameworks? I don't have a lot experience with Python webdev, but I know that Django is fairly nice. Django is very nice, but it is by no means lightweight. Django tries to do everything for you. It does most of it well, and this is ...
by Maelstrom.
Thu Sep 19, 2013 6:10 am UTC
Forum: Coding
Topic: Why Python is the best programming language in the world
Replies: 116
Views: 26107

Re: Why Python is the best programming language in the world

When I started using pep8, I was fairly new to Python. I had used multiple other languages before then, but nothing like Python. I figured that if there actually was a blessed style in Python then who was I to question it? I already had to adapt to no braces, and significant whitespace, so adopting ...
by Maelstrom.
Thu Sep 19, 2013 2:56 am UTC
Forum: Coding
Topic: Why Python is the best programming language in the world
Replies: 116
Views: 26107

Re: Why Python is the best programming language in the world

But yeah, don't be shy about ignoring/silencing lint warnings you disagree with. Oh, God yes. I love Python, and I think it's a great language, but PEP 8 can go die in a hole somewhere. I actually quite like the pep8 linter. I turn off warnings about line length (but try to keep lines <80 anyway), ...
by Maelstrom.
Wed Sep 18, 2013 9:45 pm UTC
Forum: Coding
Topic: Why Python is the best programming language in the world
Replies: 116
Views: 26107

Re: Why Python is the best programming language in the world

Passing a tuple to list creates a list with the same contents, and list is a callable like any other. Combine this with map, and you can get: m = [[1,2,3], [4,5,6]] def transpose(m): return map(list, zip(*m)) transpose(m) # [[1, 4], [2, 5], [3, 6]]
by Maelstrom.
Wed Sep 18, 2013 6:34 am UTC
Forum: Coding
Topic: Why Python is the best programming language in the world
Replies: 116
Views: 26107

Re: Why Python is the best programming language in the world

This code is buggy if more than one node is initialized without the children parameter. The default values for parameters are initialzed once, on function declaration. This means all Nodes share the same instance of the list, and this will cause problems. The correct way to do it is: class Node(nam...
by Maelstrom.
Tue Sep 03, 2013 12:31 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

'very magic' \v metacharacter (..) There is also 'magic' and 'nomagic' Surely that's 'more magic' and not 'very magic'? Sadly, no. The vim developers missed a golden opportunity there! From the vim help : Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, ignoring...
by Maelstrom.
Tue Sep 03, 2013 6:07 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I've ranted about this before , but I disagree strongly on the claim that grep/sed/et al "make sense". The fact that "*" and "\+" are metacharacters, while "\*" and "+" are a literal star and plus, respectively, is just ridiculous. And, indeed, I ri...
by Maelstrom.
Thu Aug 29, 2013 9:53 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

CFT: since Conway's Game of Life is Turing-complete, it should be possible to create some implementation of Game of Life in Game of Life , at least theoretically. I wonder if anyone's ever tried that, and whether such an implementation would be even remotely possible to store and run on any modern ...
by Maelstrom.
Thu Jul 25, 2013 4:57 am UTC
Forum: General
Topic: Galilean:x' with respect to S'? AND SPECIAL BONUS x' = x-d?
Replies: 908
Views: 147808

Re: Galilean:x' with respect to S'? AND SPECIAL BONUS x' = x

I dont know if it will help, but I made a small visualisation of some different coordinate systems mapping on to a manifold, and then graphed the result using a Cartesian coordinate system: http://timheap.github.io/coord-vis/ I've not done this kind of manifold/coordinate system math before, so bear...
by Maelstrom.
Thu Jun 13, 2013 9:04 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I hate Paypal. Their documentation is a mess; it's confusing, incomplete and spread over several websites (some of which no longer exist). Every time I think I've got a handle on the situation, something rears its head and blocks my way again. Oh, and the testing suite is shit too, so I'm never goi...
by Maelstrom.
Wed May 22, 2013 3:54 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Well, if you only need to work with datetime objects and not dates, times, or tzinfos, you can do "from datetime import datetime" and then now() comes along for free. Having it as a class method is pretty reasonable, since it is sort of a constructor. From someone who works professionally...
by Maelstrom.
Wed May 22, 2013 12:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

There is also Learn You A Haskell . I can't comment on good/badness of it. I tried it, and I found it meh. The explanations aren't bad, plus it has nice cartoon figures, however, I found it lacked a common theme. It just progressed from issue to issue, sometimes going into ridiculous detail (like l...
by Maelstrom.
Sun May 19, 2013 11:45 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Python has a datetime module, that provides four classes: datetime , time (an idealized time, independent of any particular day), timedelta and tzinfo . OK. What I don't understand is why the now() method, that returns the current datetime, is inside the datetime class. Wouldn't it make more sense ...
by Maelstrom.
Sat Apr 27, 2013 9:01 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

What makes JavaScript a good language is that semicolons and variable declaration are optional. Where good == bad. :) Allowing the interpreter to decide where statements end can be dangerous, and putting all your variables in the global scope is just messy. I make my editor run JSHint over my JS fi...
by Maelstrom.
Sat Apr 27, 2013 5:21 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I used to love JavaScript, and I still have a soft spot for it, but I find that everything I can do in JavaScript I can also do in Python, and Python has some features that JavaScript just does not support. Of course, if I am doing anything in a browser, JavaScript is the only way to go, but I find ...
by Maelstrom.
Fri Apr 26, 2013 9:17 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Now you can do my_site = new ASite("http://mysite.com/") your_site = new ASite("http://yoursite.com/") Except this is Python, so we don't have a new keyword. Damn, you are right. I've been doing too much JavaScript and PHP lately, my Python is suffering :(
by Maelstrom.
Fri Apr 26, 2013 12:31 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I still can't manage to find object-oriented (or "class-oriented") languages completely intuitive. Getters and setters and instantiators and the whole lot. ... Ignoring the fact that I had to type "self" once per line, now I have to do mysite_object = Mysite() once before I can ...
by Maelstrom.
Fri Apr 20, 2012 5:45 am UTC
Forum: Coding
Topic: "Don't use comments"
Replies: 39
Views: 7102

Re: "Don't use comments"

I wrote some code today that exported a list of Orders from one third-party application to a CSV file in a strict, third-party format. There were three different formats each line could conform to (Consignment, Article, and Goods lines), which had to be ordered in a specific manner. A Consignment wa...
by Maelstrom.
Sun Apr 15, 2012 11:38 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

HASKELL IS SO COOL :mrgreen: (Most languages don't have you redefining the entire standard library in the first tutorial) I just read an introduction to Lisp that got you to write your own Lisp interpreter in Python, and then write a Lisp interpreter in the Lisp interpreter that you just wrote. Som...
by Maelstrom.
Sun Apr 15, 2012 11:24 pm UTC
Forum: Coding
Topic: First project ideas?
Replies: 9
Views: 2066

Re: First project ideas?

Try implementing Conway's Game of Life. It's great fun. http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life I second Conway's Game of Life. I try to implement it in every new language I learn, as it is a fun and interesting (but not too hard) way of learning how to use data structures, arrays, and...
by Maelstrom.
Fri Apr 13, 2012 7:22 am UTC
Forum: Coding
Topic: Javascript Help, interaction with HTML
Replies: 5
Views: 2180

Re: Javascript Help, interaction with HTML

Try something along the lines of this: http://jsfiddle.net/sfdHM/ The description of your problem was a little ambiguous, so I probably have not done exactly what you want. What I have done though is change various things when ever the <li> elements are clicked, which seemed to be the core of your p...
by Maelstrom.
Mon Mar 26, 2012 11:59 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I honestly want to know though - what makes you think Perl is better than Ruby or Python? Perl is the only one that can do arithmetic right: $ python Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "licens...
by Maelstrom.
Sat Jan 21, 2012 5:36 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQA Thread - Queer Support!

After playing with it for a bit, I'm not sure I understand the appeal of OSX. It's just like any other *nix system, complete with all the idiosyncrasies, but with like 15 pounds of makeup caked on. Its pretty, everything works excellently out of the box*, it works amazingly with your devices^, and ...
by Maelstrom.
Fri Oct 28, 2011 1:24 am UTC
Forum: Coding
Topic: Mathematics parsing
Replies: 7
Views: 2111

Re: Mathematics parsing

Depending upon your language of choice, look in to the Bison/Yacc family of parsers. Some of them come with example arithmetic parsers already coded for you. They have been translated to many different languages. Otherwise, parser-generators are the family of programs you will want to research.
by Maelstrom.
Thu Oct 20, 2011 11:27 pm UTC
Forum: Coding
Topic: Selective-recursive SCP
Replies: 4
Views: 2398

Re: Selective-recursive SCP

Also try investigating rsync. rsync can be used as an advanced scp (amongst other things). It has various filtering options, including an --include-from=FILE flag. Alternately, you can mount remote file systems using FUSE. If you mounted the remote file system as ~/remote, you could then use cp --pa...
by Maelstrom.
Thu Oct 06, 2011 6:08 am UTC
Forum: Coding
Topic: Starting out with Fractals (direction needed)
Replies: 15
Views: 3847

Re: Starting out with Fractals (direction needed)

Ill try to explain things with out using too much mathematical notation. Fractals are a very mathematical construct, but it is possible to play around with them without understanding too much of the maths behind them. I highly encourage you to learn more of the maths behind them, but you may find th...
by Maelstrom.
Wed Sep 21, 2011 7:12 am UTC
Forum: Coding
Topic: Node.js
Replies: 8
Views: 3901

Re: Node.js

Nonetheless, it is impressive to put Node.js on the list of servers that can accomplish c10k, but it doesn't seem to have much benefits as a general web server. Can it run Ruby? Can it run PHP? Or is it only Javascript? Does it do URL-Rewriting? Etc. etc. Server-side Javascript might be useful in m...
by Maelstrom.
Thu Jun 09, 2011 1:37 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

I certainly hope not. This is the plan Microsoft has for Windows 8 and frankly, I have no idea why you would use Javascript if you had a choice. Javascript is a horrifyingly bad language - the only reason it's gained popularity on the web is because you have no other choice . The whole HTML5+JS mov...
by Maelstrom.
Wed Jan 19, 2011 4:29 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQ Thread - Queer Support!

Could have sworn they refer to R2 as "he" at various points in the canon. Nevertheless, what doogly said. Bby the looks of it - from this ridiculously in-depth article - R4 being female was probably retcon'd in at a later date. She is referred to as a he multiple times in the literature. ...
by Maelstrom.
Wed Jan 19, 2011 3:16 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQ Thread - Queer Support!

TheGrammarBolshevik wrote:Could have sworn they refer to R2 as "he" at various points in the canon. Nevertheless, what doogly said.

Bby the looks of it - from this ridiculously in-depth article - R4 being female was probably retcon'd in at a later date. She is referred to as a he multiple times in the literature.
by Maelstrom.
Tue Jan 18, 2011 10:25 pm UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8197
Views: 1206803

Re: [SAFESPACE] LGBTIQQ Thread - Queer Support!

I've always enjoyed the way that Utahraptor from Dinosaur comics just happens to be gay. It is never brought up as a topic in itself, there was no dramatic reveal, he is just gay, just as T-Rex is gigantic and green.

Also: the comics are awesome.
by Maelstrom.
Fri Dec 10, 2010 9:23 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

Considering Wings 3D was written in Erlang, I'd say it's a pretty cool language. I know very little about it, and I haven't seen many people using it, but if Wings is anything to go by, Erlang should definitely be versatile enough for general-purpose use. I used Wings back when I did some 3D modell...
by Maelstrom.
Thu Dec 02, 2010 1:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9848
Views: 1709402

Re: Coding: Fleeting Thoughts

@Xanthir: If you had actually checked out the examples and source on the page I linked, it would perhaps clear things up. By using the Enum constructor, values 'extend' the base Enum that you create, so that values can inherit behaviour, which your example does not cover. Additionally, the Enum that...

Go to advanced search