Better HN
topnewbestaskshowjobs
Log inSign up

makecheck

12,740 karma · joined Feb 17, 2008 (18y ago) · 2,917 submissions

Submissions

comment 15y ago · link · parent

Note that my own terminal MacTerm (http://www.macterm.net/) also supports most of the iTerm2 features from this post. Though I feel my Full Screen support is nicer: I provide options such as a scroll bar when full-screen, and I do not use Lion's widget so the switch is instantaneous and has proper multi-display support (i.e. you can have a full-screen terminal on two displays if you want to).

I don't have split-panes, though they're on my list. There are a handful of other features I don't have, but also vice-versa. In the end I won't say either app is better, but I definitely think there isn't one terminal everyone will like.

comment 15y ago · link · parent

I would expect the rule is there to cover a lot more than the signals disabled by "airplane mode". For one thing, a tilting plane exerts major force and it moves in ways that passengers may not anticipate; if someone is holding a phone and lets go, the phone becomes a heavy object that can hurt somebody else.

comment 15y ago · link · parent

I think the better question is, why specify fonts at all?

I set fonts in my browser. When browsing any site that simply leaves fonts alone, everything looks the way I want it to! When sites tinker with the font used by most text, it is unnecessarily hard to fix (e.g. my style sheet has to list all kinds of HTML tags where text may appear and include lots of "!important" flags).

I can understand setting a fancy font for the odd title or something, but all the text on the page? Why?

For what it's worth, this is my entire override stylesheet for HN, including some tweaks to the home page that I think make it substantially more readable. I recommend trying it. :)

  html {
      overflow-y: scroll;
  }
  
  body, p, table, th, td, a, .comment {
      font-family: "Helvetica Neue" !important;
      font-size: normal;
      padding: 0.2em;
  }
  
  .subtext {
      width: 100%;
  
      padding-left: 40%;
  
      padding-bottom: 0.6em;
      border-bottom: solid #ccc 0.1em !important;
  }

comment 15y ago · link · parent

It's really more effective to have a very regular backup (e.g. ".snapshot" directories are really nice), because you can't control all the ways a file may be deleted.

Just because you protect one "rm" command doesn't mean there isn't another. Someone might have used unlink() in a Perl script or a C program. Maybe "mv" was used to write one file over another, or "cat >! filename", or a dozen other things.

In the end, if a file needs to be safe then it needs a backup (and the sooner it can be restored, the better). And then given a good backup the file still needs an appropriate Unix group, owner, file access control list, etc. to minimize the chance that you'll ever need the backup.

comment 15y ago · link · parent

Sounds a little like this: "people could choke, better ban eating".

comment 15y ago · link · parent

First of all, the whole point of the "-f" option is to disable confirmation, which really means "I know exactly what I'm doing". The easiest fix is to stop using that option all the damned time.

When you have strong permissions (e.g. running as "root"), you should never use patterns in destructive commands, period.

At best, you should perform a nondestructive pattern command such as a "find" and generate a precise list of target files that can be audited. For example, here is one way to produce a script of commands that deletes an exact list of matching files:

    find * | awk '{print "rm \047"$0"\047"}' > delete.sh && chmod +x delete.sh

comment 15y ago · link · parent

The location matters; cost of living can make $100K look either really good or really bad.

comment 15y ago · link · parent

It's possible to make Doxygen look at a source file instead of a header...at least in C++ it is.

As for the name, this is Apple's method name from UIView so ask them. :)

1959.

Objective-C Parameter Names Unneeded in Headers

3 points · by makecheck · 15y ago · 3 comments

comment 15y ago · link · parent

Neat!

I tried to "cd images" and "cd video" and it changed to those kinds of search results. Even "clear" works to blank out the page. :)

comment 15y ago · link · parent

I think the idea of superimposing fact-check results on pages that contain checked phrases is pretty cool. It would certainly be more welcome than the "mouse-over ads" that some sites currently employ!

Spoofing could be a problem. Right now there are misspelled domains registered, pages that look almost identical to real pages from banks, and plenty of other scams. Something would have to ensure that the authentic browser add-ons and fact-check results would be very difficult to fabricate (otherwise a disreputable site could simply make itself look reputable).

comment 15y ago · link · parent

There are software developers who have this kind of attention to detail and who have some design aesthetic. I consider myself one of them.

I think the easiest place to catch mistakes like misaligned pixels is in the development environment. In fact, there are ways to programmatically make designs look "nice" (e.g. mathematical expressions to align things, algorithms that achieve smooth animations, or applications of the Golden Ratio).

It is sensible to have at least one engineer who is as comfortable with design as he or she is with text editors, makefiles and programming languages. It seems extremely inefficient to only have a design team at the top of a mountain periodically sending in requests to fix every little thing.

comment 15y ago · link · parent

Actually has a really good example (a calculator) to show how HyperCard could be used.

HyperCard was a big part of my junior high years. It could even be extended, e.g. there was one add-on that allowed color graphics to be displayed and I learned to make some simple games that way.

comment 15y ago · link · parent

They didn't need Find My Friends, all they needed was a dead-simple way to send a description of the phone's current location as a text message or iMessage. Then you can just ask somebody his or her location, and if that person wants to respond it's possible with one tap of a finger.

comment 15y ago · link · parent

Both have the same inconveniences, but the iPad keys are bigger so it will always be better.

I find the iOS' problems with text editing don't really have much to do with its keyboard though. For instance, the "press, hold, move awkward magnifying bubble to relocate cursor" sequence is utterly boneheaded and they need something better; I don't mind occasionally typing the wrong key as long as I can quickly move the insertion point to make a correction and I can't.

comment 15y ago · link · parent

I tried using this for just a few minutes, since my friend has one.

The slowness is quite staggering. For example, there was a copy of a dictionary on it; I tried to use Search to find a word (since paging through from "A" would be ridiculous) and it took like 20 seconds to show ANY results. This kind of functionality isn't just unacceptable, it's so bad that the Search function might as well not exist.

The ability to hold it in one hand (albeit with stretched fingers) was nicer than the iPad; but since there's no practical way to use that same hand to operate the device it doesn't really matter. When I have to stop and use both hands to operate a smaller device or a larger one, I would prefer to just have the larger one.

comment 15y ago · link · parent

There's a rule that applies to pretty much anyone in any organization in any industry: if you don't really know what you're talking about, you shouldn't do much of the talking. This applies to both sides of any conversation.

If IT will listen to and understand customers, and if customers do the same when looking at IT, then things go well.

But IT is the type of job where "the same" job description can exist at companies that do radically different things. You may hire IT people that have no background whatsoever in your company's specific area. It is imperative that IT new hires be people who are willing and able to learn a lot.

In my experience the "hate" for IT comes only when dealing with people that have no interest in what you actually need: people who are convinced their policy or "solution" is brilliant.

comment 15y ago · link · parent

The notation "38;5;[whatever]" or "48;5;[whatever]" is specific to an 88-color or 256-color xterm terminal. Make sure that mode is enabled. This works with the Mac OS X 10.7 (Lion) version of Terminal and with MacTerm in 256-color mode.

By itself, a "5m" means "blink", so maybe older Terminal versions are just dropping the parts that they don't understand.

Here's a modified version that tries to adapt when xterm colors don't work:

  #!/usr/bin/env perl
  # by Kevin Grant (kmg@mac.com)
  my $term = (exists $ENV{'TERM'} && defined $ENV{'TERM'}) ? $ENV{'TERM'} : 'vt100';
  my $is_xterm = ($term =~ /xterm/);
  print "\033#3BEGIN DIFF\n";
  print "\033#4BEGIN DIFF\n\033#5";
  while (<>) {
    if (/^\+/ && !/^\+\+/) {
      if ($is_xterm) {
        print "\033[48;5;149m", "\033[2K", "\033[38;5;235m", "\033[1m";
      } else {
        print "\033[42m", "\033[2K", "\033[30m", "\033[1m";
      }
    } elsif (/^\-/ && !/^\-\-/) {
      if ($is_xterm) {
        print "\033[48;5;52m", "\033[2K", "\033[38;5;124m";
      } else {
        print "\033[41m", "\033[2K", "\033[37m";
      }
    } else {
      print "\033[3m";
    }
    chomp;
    print;
    print "\033[0m\n";
  }
  print "\033#3END DIFF\n";
  print "\033#4END DIFF\n\033#5";
The colors aren't quite as nice that way, but it's something.

comment 15y ago · link · parent

If you upvote something, it shows up in the "saved stories" link on your profile page.

1970.

Colorized 'svn diff' filter for terminals

3 points · by makecheck · 15y ago · 2 comments

comment 15y ago · link · parent

I didn't have that right, it seems the result certainly can be a class. And that would avoid the units problem. Though in the examples I've seen it wasn't clear if they were returning a class.

With raw numerical values the results are definitely unpredictable. For example maybe the program considers numerical values to be measured in ounces, in which case "2.2_lb" becomes the number "35.2"; or maybe it thinks everything is metric, measured in grams. There is not just one reasonable way to pick a number to represent an expression.

I am fairly sure that a leading zero cannot be a problem with custom literals; I'd expect the compiler to parse the whole thing and see the suffix before deciding what type of literal it is (i.e. the "_b" handler would get to read everything raw, including the leading zero).

comment 15y ago · link · parent

If it's a Unix-like environment, learn as much as you can about at least one Unix shell (try "zsh" or "bash"; just stay away from "csh" or "tcsh"). You should understand things like process management, e.g. "&&", "||" and subshells. You should also understand file management, e.g. ">", ">>", ">|", and the program "tee". These help with testing because you frequently have to write scripts and organize output files, and you have to understand how the system handles things like failed programs.

When testing it's quite common to have to deal with lots of files and do filtering. Think of how you'd organize data. Reuse things like scripts for driving tests. Learn tools like "grep" and "diff" and "sdiff" and a scripting language like "perl" or "python". For example, it's very common to need to automate test audits by filtering out volatile data such as time stamp lines and comparing the remainder against a set of golden results.

Learn at least one widely-used testing environment, such as the "unittest" and "doctest" modules of the Python standard library. It doesn't matter if your company will use something else, it's useful to pick up on some terminology (e.g. the concepts of setting assertions and creating standalone testcases) and to see how at least one framework does things.

Practice being pessimistic. For any given system, don't let yourself only test the "easy" stuff; try to think about weird things that could happen. Boundary cases are often very useful, e.g. what happens when -1 or 0 are given as values, or very large numbers.

Practice editing. Tests should be extremely focused because when they fail you want to know exactly what went wrong. This kind of focus also helps outside the world of testing.

comment 15y ago · link · parent

Like many language features, it can and will be abused; and like overloaded operators it may be very difficult to determine where a custom suffix is even defined.

It will definitely be nice in a few places. For instance I can imagine that writing 01011011_b (after defining "_b") would be very handy.

I think examples that attach units instead of just metric prefixes are missing the point because the result is always a number (or a string), not a particular kind of object. If you say "assert(1_kg == 2.2_lb)" that is completely misguided because you haven't specified the context; again, these are just numbers so what do you end up with, kilograms or pounds or something else? Far better to name suffixes only in terms of scaling factors, e.g. "_kilo" or "_K" defined as 1000x would be applicable in more situations.

comment 15y ago · link · parent

Some examples of what you mean would help.

Anything can be overused; I've seen "object models" that almost make me cry from their unnecessary complexity. Maybe you've just seen too many examples that took OO to an extreme, and those soured your taste for the whole style of programming.

Objects can be used judiciously and combined with other programming styles to do very powerful things. Even in 2011 it's not shameful to fall back on a plain C function or data structure in cases where objects don't really add anything of value (not that many programmers seem to, but I digress).

It also depends on the language and what the code does. In C++ for instance, if you happen to be working in code that relies on the C++ exceptions model (ignoring for the moment that some argue quite correctly to avoid C++ exceptions), you must use objects in order for cleanup code to be executed in every possible case. So although object-oriented programming is often just a matter of convenience or clean design or whatever, it can also be a requirement for correct behavior.

comment 15y ago · link · parent

I think a far better action than saying "oh no, swear words" would be to ask: what code is apparently causing developers to swear and how can it be fixed?

And for what it's worth, when people are offended by mere words I counter with "I'm offended by censorship", because I am. What is it about certain commonly-censored materials that makes them so special? Why can't a person just change the channel or read something else to avoid uncomfortable material? Also, why are people so much more likely to be angry about swear words (which cause no demonstrable harm), when things that do cause harm (like wars) are more-or-less tolerated silently? Makes you wonder.

comment 15y ago · link · parent

I'm not sure how people deal with the disappearing scroll bars if they don't have a scroll-wheel mouse. For me the missing bars are fine because I can make them reappear at any time by lightly touching the scroll wheel.

They are also surprisingly nice for the column views on Mac OS X (an interface that basically consisted of a horizontal scroll bar over a range of several vertical-scrolling lists). Now, without scroll bars, the column views look so much more sensible; before they seemed to be littered with chrome.

I don't think scroll bars should disappear completely though. It seems that muting them (e.g. becoming light gray and translucent, or thinner like they are on Linux) would be enough to keep them out of the way.

It would also help if there were some additional cue, e.g. a "fade-out" effect at the edges where more content is available offscreen.

comment 15y ago · link · parent

I think you misunderstood what I said about degrees. I wasn't comparing degrees from different countries, I was only comparing degrees acquired in the U.S. by U.S. citizens.

Your original point was that there shouldn't be a shortage of talent in the U.S.: that companies should be able to find enough U.S. workers for things like engineering jobs. And I'm saying that there may not actually be enough local talent; it depends on how many U.S. citizens choose the "hard" degree programs that companies want.

There's lots of money to be made by U.S. citizens in certain sectors such as finance. It's conceivable that some U.S. students would opt for an "easier" degree if that still leads to a high-paying job; they may see no point in the extra work of a "hard" program like science or engineering.

Clearly not all U.S. citizens do that, and those that do choose engineering are just as employable, or more so, than immigrant engineers; I never said they weren't.

comment 15y ago · link · parent

A talent shortage among U.S. citizens is actually quite feasible in high-tech industries.

Consider the discussions on HN and Slashdot alone recently about salaries and the value of degrees. If people really have been able to pick degrees that are "simpler" than science or engineering and find jobs making six figures in the U.S., it's not hard to imagine that companies might find it hard to hire enough qualified workers for the "harder" disciplines. In a job like software, the difference between an outstanding developer and an average one is orders of magnitude, so it's very unlikely someone else can be trained properly.

Also consider, if there were no visas, companies might not have U.S. offices at all. If you have an office of 500 people, 300 of whom are from other countries, the cost of the U.S. office may be justifiable. But suppose you weren't allowed to have foreign workers live here. The company isn't going to say "okay, looks like we need a big office overseas to hold local talent and a small office in the U.S."; they're more likely to say "screw that, let's put our one and only office overseas", and then you've just lost 200 U.S. jobs completely.

It is a common misconception that the presence of non-U.S. workers will definitely kill U.S. jobs. I can imagine that some companies in some industries may have this issue on a small scale, but they do so illegally.

comment 15y ago · link · parent

I don't know if companies are allowed to let immigration affect their firing decisions. But, in terms of how other human beings are treated, there is a difference for the holder of a temporary visa...

If an H-1B visa holder is laid off or quits, the visa immediately expires. That leaves two main options: almost immediately find another job (at a company willing to spring for a new visa, no less), or leave the United States within a very short period of time. And when the economy is bad, good luck with that first "option"; the replacement job has to be visa-class, it can't just be flipping hamburgers.

A temporary visa doesn't last long (1-3 years), but it's a rotten status to be in if there's a layoff. Imagine: you're living somewhere new, you've made friends, you have possessions, and suddenly in addition to having been fired your life is turned upside down; and if you don't sort it out quickly you'll be given a plane ticket and told never to return.

So while companies probably aren't allowed to consider any of this when choosing who to fire, I wish they would.

comment 15y ago · link · parent

That's a very good question.

I use Python a lot and I combine it with C++ and Objective-C to build a very complex application. While it looks like a regular app and behaves like one, underneath it starts out as a Python interpreter that runs a script and loads compiled libraries. It's a model that works extremely well and I hope it continues to "just work". Sure, it's unconventional and I'd understand if Apple didn't expect most things to work this way, but I hope they don't just break it completely for me.

1
656667
98