Search found 1330 matches

by hotaru
Sun Dec 09, 2012 3:26 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

I mean, if you are going to write unreadable code, at least make it branch free. i would have thought gcc would be smart enough to turn my version of it into branch-free code, but i guess not... return fabs(a) -       fabs( (*((double(*[])(double)){ &floor, &ceil })[a > 0 ^ b > 0])(a /...
by hotaru
Sat Dec 08, 2012 11:59 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

What language is that? Doesn't compile in C or C++. hotaru@olorin$ cat test.c < ~ > #include <math.h> double modulus(double a, double b) { return abs(a) - abs( (*(a > 0 ^ b > 0 ? &ceil : &floor))(a / b) * b ); } hotaru@olorin$ gcc -std=c89 -Wall -w -pedantic -c test.c < ~ > hotaru@olorin$ l...
by hotaru
Sat Dec 08, 2012 6:53 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

I think the problem is that nested ternary operators are always to some degree messy, no matter how you indent them, so nobody wants to write an auto-indenter for them. To recycle the modulus code, no indentation scheme I can come up with looks nice. The last one is readable, but looks off. return ...
by hotaru
Thu Dec 06, 2012 1:42 am UTC
Forum: The Help Desk
Topic: /bin/sh vs. /bin/bash
Replies: 3
Views: 2235

Re: /bin/sh vs. /bin/bash

/bin/bash should only ever be used in scripts that are intended to run on one machine. and even then, you should think long and hard about whether you really need to be using bash for that script. on many systems, bash is in /usr/bin or /usr/local/bin, or not installed. bash-only features should gen...
by hotaru
Sat Nov 24, 2012 1:45 am UTC
Forum: The Help Desk
Topic: Windows 8 on a new computer.
Replies: 3
Views: 1260

Re: Windows 8 on a new computer.

Why not just buy Windows 8 and install it on the new computer?
by hotaru
Mon Nov 19, 2012 7:29 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

Like the poor guy who did this: string commenthtml = ""; for (int i = 0; i < commentcount; i++){ commenthtml += "Comment #"; commenthtml += i; commenthtml += getCommentAuthorByID(i); commenthtml += "<"; commenthtml += getCommentEmailByID(i); commenthtml += ">"...
by hotaru
Sun Nov 04, 2012 12:49 am UTC
Forum: Coding
Topic: Retrieving the First X Bytes of a Web page (in Python)
Replies: 9
Views: 3110

Re: Retrieving the First X Bytes of a Web page (in Python)

EvanED wrote:(Also every time I look at a HTTP request and am reminded that the "referer" field exists I suddenly get very depressed.)

But it's fun!
view source in chrome or firefox and try to figure out how it works...
by hotaru
Thu Nov 01, 2012 11:52 pm UTC
Forum: Coding
Topic: When program hits while loop, errors out... how to fix
Replies: 14
Views: 3054

Re: When program hits while loop, errors out... how to fix

ahammel wrote:

Code: Select all

getouptut

i don't think that'll work :P
by hotaru
Mon Oct 15, 2012 2:35 am UTC
Forum: Coding
Topic: delete last line with python
Replies: 6
Views: 9062

Re: delete last line with python

>-) wrote:but what if i want to print one, and then wait for something else to happen before replacing it with two?

Code: Select all

print 'one',
wait_for_something()
print '\rtwo'
by hotaru
Thu Oct 11, 2012 4:43 pm UTC
Forum: Religious Wars
Topic: Not Equals
Replies: 91
Views: 73469

Re: Not Equals

Ah, but the problem is I need the "expanded" form rewritten back to the "abbreviation" form when it saves... e.g. an abbreviation that will "expand" != to ≠ isn't helpful if it just leaves the ≠ in place when it saves. This is more like what I'm after, though I haven't...
by hotaru
Thu Sep 20, 2012 1:24 am UTC
Forum: The Help Desk
Topic: Third-party password system: Is my school's IT right?
Replies: 9
Views: 38625

Re: Is my school

there's an even bigger issue... they're sending the password over the internet in an (apparently) unencrypted email. it doesn't matter whether you encrypt the password in the database if you're sending it out over a public network in plaintext.
by hotaru
Wed Aug 29, 2012 11:11 am UTC
Forum: The Help Desk
Topic: Free Antivirus/Anti-malware
Replies: 25
Views: 21227

Re: Free Antivirus/Anti-malware

Jplus wrote:Does Windows have a built-in antivirus? When I switch on all security features (defender, firewall...) it still complains about a lack of antivirus.

not built-in, but microsoft security essentials is a free download, and pretty good.
by hotaru
Tue Aug 21, 2012 4:50 pm UTC
Forum: Religious Wars
Topic: Plural of "Octopus"
Replies: 89
Views: 64400

Re: Plural of "Octopus"

"octopuses" or "octopodes", never "octopi". "octopus" is an english word made of greek roots, so either english or greek pluralization makes sense.
by hotaru
Sat Aug 04, 2012 2:54 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1090: "Formal Languages"
Replies: 90
Views: 30631

Re: 1090: "Formal Languages"

And if you scale it by this : | 0.001 1 1 | | 1 0.001 1 | | 1 1 0.001 | It would then be much easier to climb. (Sorry, can't see how to do a table/matrix in this markup.) \begin{bmatrix} 0.001 & 1 & 1 \\ 1 & 0.001 & 1 \\ 1 & 1 & 0.001 \end{bmatrix}
by hotaru
Thu Aug 02, 2012 9:27 pm UTC
Forum: Religious Wars
Topic: Does anyone use the Vim HJKL cursor keys?
Replies: 77
Views: 110910

Re: Does anyone use the Vim HJKL cursor keys?

And more than once I've been on a screwed up terminal or connection where the arrow escape sequence is unreliable. i strongly prefer vi over vim, but sometimes i get stuck with a terminal that's too broken for vi to work, but not too broken for vim. in those rare cases, the arrow keys are usually c...
by hotaru
Tue Jul 31, 2012 12:09 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

I got lost there. Do you mean importing C++ code into C or is that supposed to be C source file? I don't know if I can use the standard library that liberally on our assignment. Well, I was talking about solving the problem, not solving your assignment. :) I was saying that a nice way to handle nee...
by hotaru
Mon Jul 30, 2012 3:37 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

Incidentally, if you want it to have all the integers and not just alternating ones, you can do it with 0 : ([id, negate] <*> [1..]) -- 0, 1, -1, 2, -2, ... really? Prelude Control.Applicative> take 10 $ 0 : ([id, negate] <*> [1..]) [0,1,2,3,4,5,6,7,8,9] now this, on the other hand, actually does w...
by hotaru
Tue Jul 24, 2012 3:24 am UTC
Forum: The Help Desk
Topic: the great firewall and irc
Replies: 4
Views: 2029

Re: the great firewall and irc

tor does work, if you use bridges.
by hotaru
Tue Jul 17, 2012 1:57 am UTC
Forum: The Help Desk
Topic: So My Keyboard is Messed Up....
Replies: 6
Views: 3368

Re: So My Keyboard is Messed Up....

I am pretty sure you can, and also pretty sure that it's ridiculously expensive (though less sure of the latter). Unless it's one of those fancy backlit ones, it'd probably only cost about $10 or $15. installing the new keyboard once you have it should take about fifteen minutes (assuming you know ...
by hotaru
Mon Jul 09, 2012 12:53 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

I can't speak definitively, but from what I've heard, Win7 tends to run faster on than XP on modern hardware, but requires more memory* (preferably >= 1 GB), and that much memory would have been very rare on a desktop machine 10 years ago. How much memory do your machines have? * The difference in ...
by hotaru
Sun Jul 08, 2012 11:33 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

troyp wrote:Plus, a 10-year old computer probably wouldn't run 7.

I doubt that. I've got a 7 year old laptop and an 8 year old desktop running windows 7, and they run better with 7 than they ever did with xp.
by hotaru
Thu Jun 28, 2012 12:43 am UTC
Forum: The Help Desk
Topic: Can we code in tablet?
Replies: 8
Views: 10500

Re: Can we code in tablet?

And can a tablet make any provisions for compiling codes written in Java and C and also run them? To avoid pointless waiting, probably not, no. You can search for it on the web; most apps have a website, and the android store is also online, I believe. Most full-time developers I know, however, use...
by hotaru
Mon Jun 25, 2012 4:53 pm UTC
Forum: Religious Wars
Topic: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime
Replies: 26
Views: 38646

Re: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime

iPod scratches: Yes, plastic scratches. People thinking a device is indestructible is the issue here, especially considering they continued to function as intended with some scratches. apple admitted it was a legitimate defect after the lawsuit, and fixed the problem in later ipods. iPhone antenna:...
by hotaru
Mon Jun 25, 2012 2:07 am UTC
Forum: Religious Wars
Topic: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime
Replies: 26
Views: 38646

Re: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime

No, Apple has excellent customer service. sure, telling customers that obvious defects don't exist, or that they're "holding it wrong", until someone goes to the trouble of suing them is "excellent customer service". just do a google search for "ipod scratches", or &qu...
by hotaru
Sat Jun 23, 2012 6:03 pm UTC
Forum: Coding
Topic: xkcd download script
Replies: 17
Views: 23760

Re: xkcd download script

karlandtanya wrote:

Code: Select all

there's gotta be a nice html parser to do this generically!

PM 2Ring wrote:Please use the JSON, it makes things a lot simpler. Eg,

n=123; wget -O - http://xkcd.com/$n/info.0.json | sed 's/", "/"\n"/g; s/\\n/\n/g'; echo

If you let n='', you get the data for the current comic.
by hotaru
Wed Jun 20, 2012 3:04 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

I have created an abomination! #include <cstdlib> #include <iostream> void *justwait(int filler1, int filler2, int filler3, int filler4, int filler5, int filler6, bool selector, long x, long y) { if(selector) { DEARGOD: std::cout << x+y << std::endl; exit(0); } else { void *pointy = &&DEARG...
by hotaru
Wed Jun 20, 2012 12:45 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

It doesn't compile in Clang, though: To be fair, g++ does warn, and calling justwait(true) does segfault (when it reaches print4(oops) , that is). all fixed (compiles with clang and g++, no warnings, calling justwait(true) doesn't segfault): #include <cstdlib>#include <iostream>void *justwait(bool ...
by hotaru
Tue Jun 19, 2012 9:37 pm UTC
Forum: Religious Wars
Topic: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime
Replies: 26
Views: 38646

Re: Tablets - iPad vs. MS Surface vs. Asus Transformer Prime

I voted Surface because ... I don't want something broken out of the box and with horrendous customer service what. horrendous customer service is the only kind of customer service you'll find for any tablet. the only alternative is no customer service, which is what you'll probably get from micros...
by hotaru
Sat Jun 09, 2012 11:00 pm UTC
Forum: The Help Desk
Topic: Can we code in tablet?
Replies: 8
Views: 10500

Re: Can we code in tablet?

on android, aide can be used to develop android apps. there are compilers available for c, c++, pascal, and several other languages. sl4a has interpreters for perl, python, scheme, ruby, lua, php, and a couple other languages. if you use a usb or bluetooth keyboard, it's about the same as writing co...
by hotaru
Wed May 16, 2012 9:16 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

Ben-oni wrote:Ask yourself: is another set of parens going to hurt?

yes.
by hotaru
Sat May 12, 2012 12:57 am UTC
Forum: Coding
Topic: Is there a Haskell combinator library for building PHP?
Replies: 5
Views: 1940

Re: Is there a Haskell combinator library for building PHP?

WarDaft wrote:It's failing quietly. No idea what it's doing. Thanks for the suggestion though.

did you check the server's error log?
by hotaru
Thu May 10, 2012 4:45 pm UTC
Forum: Coding
Topic: Is there a Haskell combinator library for building PHP?
Replies: 5
Views: 1940

Re: Is there a Haskell combinator library for building PHP?

maybe PHP-CGI-Wrapper and cgi would work? it won't give you php code, but it might let you run haskell code on a server that just has php...
by hotaru
Thu Apr 19, 2012 9:23 pm UTC
Forum: Coding
Topic: "Don't use comments"
Replies: 39
Views: 7755

Re: "Don't use comments"

What about this? It's not exactly coding as my example is css but i could see the same happening in code. background-color: #ffb300; /* orange */ it'd be better to just use "orange" (http://www.w3.org/TR/CSS21/syndata.html#value-def-color) unless you really need "#ffb300". if yo...
by hotaru
Wed Apr 18, 2012 4:54 pm UTC
Forum: The Help Desk
Topic: Video cards and recovering serial numbers
Replies: 2
Views: 1270

Re: Video cards and recovering serial numbers

http://en.wikipedia.org/wiki/Intel_GMA The Intel Graphics Media Accelerator , or GMA , is a series of Intel integrated graphics processors built into various motherboard chipsets. These integrated graphics products allow a computer to be built without a separate graphics card , which can reduce cost...
by hotaru
Tue Apr 17, 2012 1:10 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 10016
Views: 2036418

Re: Coding: Fleeting Thoughts

headprogrammingczar wrote:It's very common for generic functions in Haskell libraries everywhere. When dealing with less generic functions, you get less generic names (though typically still on the short side).

i do wish they would have followed that with things like genericLength, genericTake, etc.
by hotaru
Tue Apr 10, 2012 3:04 am UTC
Forum: Religious Wars
Topic: Malcom Reynolds vs Han solo
Replies: 85
Views: 34922

Re: Malcom Reynolds vs Han solo

With pistols, Han has a larger ammunition capacity, no recoil and faster projectiles. Even if we say that they're equal in skill, the superiority of Star Wars weapons will be a huge factor. Actually, the plasma bolts from star wars blasters would be much slower than a bullet, and have other issues ...
by hotaru
Thu Apr 05, 2012 4:54 pm UTC
Forum: Religious Wars
Topic: Open vs. Closed Source
Replies: 41
Views: 14484

Re: Open vs. Closed Source

⋅ for the customers, there is no added value in learning about a specific vulnerability after it's fixed; i don't know about you, but i would certainly like to know if someone might have accessed my personal data or made changes to my account. also, after seeing at least one bank's attitu...
by hotaru
Mon Apr 02, 2012 8:34 pm UTC
Forum: Religious Wars
Topic: Open vs. Closed Source
Replies: 41
Views: 14484

Re: Open vs. Closed Source

There are things that should be closed source (eg, your bank's website), even if they use open source components (eg, encryption/hashing algorithms or APIs). There are probably things that should never be open sourced, because being able to reverse engineer them would mean they would cease being ef...
by hotaru
Fri Mar 30, 2012 10:44 pm UTC
Forum: The Help Desk
Topic: Typing mathematical unicode characters on Windows 7
Replies: 26
Views: 5832

Re: Typing mathematical unicode characters on Windows 7

Jplus wrote:Wait. Are there more html tags to which one may add the contenteditable property?

http://www.w3schools.com/html5/html5_ref_globalattributes.asp wrote:The global attributes below can be used on any HTML5 element.
by hotaru
Fri Mar 30, 2012 1:58 am UTC
Forum: The Help Desk
Topic: Typing mathematical unicode characters on Windows 7
Replies: 26
Views: 5832

Re: Typing mathematical unicode characters on Windows 7

EvanED wrote:That's hilarious, but everyone knows that the simplest text editor is cat.

no, it isn't. echo is simpler.

Go to advanced search