Better HN
topnewbestaskshowjobs
Log inSign up

terminalcommand

1,673 karma · joined Sep 27, 2013 (13y ago) · 683 submissions

Corporate lawyer with a passion for computers.

Software design and implementation should be a joyous art, a kind of high-level play. If this attitude seems preposterous or vaguely embarrassing to you, stop and think; ask yourself what you've forgotten. Why do you design software instead of doing something else to make money or pass the time? You must have thought software was worthy of your passion once...

To do the Unix philosophy right, you need to recover that attitude. You need to care. You need to play. You need to be willing to explore.

Submissions

comment 9y ago · link · parent

I installed Linux Mint Debian for my mother, works just as you described. Once in a while I login as root and run "apt-get update && apt dist-upgrade" on the machine. That's about it. Even when her laptop broke and she needed to switch to a backup machine, I just plugged out the hard drive and put it in the new laptop. After installing wifi drivers, linux continued to run. And I'm at peace since she doesn't know the root password or even what root means :).

comment 9y ago · link · parent

On my first attempt of writing an IRC parser by following a specification at an RFC, I wrote the whole tokenizer in a single switch statement. But as I needed further branches I resorted to using nested switch statements. It quickly became a mess.

Then I switched to calling seperate functions within the switch statement for tokens. If the char is a colon and state is prefix, call parsePrefix. If the char is a whitespace, advance state etc.

I didn't know about jump tables back then, but relying on enums for states and branching proved to be a good idea. e.g If state is < 3, parseParameters(); if state is <2, parseMessage() etc.

Using nested conditionals and loops in the same function on the other hand proved to be a terrible idea.

comment 9y ago · link · parent

I stand corrected, thanks for the thorough answer.

My interest in ropes was arisen from the "data structures for text editors" post here on HN. Most resources were haskell implementations. IBM Developerworks had an article about ropes and a corresponding java library, the article stated ropes were immutable. https://www.ibm.com/developerworks/library/j-ropes/index.htm...

I admit being wrong on every node storing a single character, that misconception stems from a graph I saw representing ropes on yesterday's article.

Undoing with immutable ropes is very straightforward I think. You don't copy the whole file, but just the references. I admit it is heavier on the memory, but you could store an arbitrary amount of previous "states" or versions in ram. The benchmark on the Java library may prove this point.

I will try to read the original article to gain more insight. Thanks again for the resources.

comment 9y ago · link · parent

Ropes are inherently a binary tree. From what I can understand you can implement piece tables both as a double linked list and a b-tree. Furthermore in ropes every leaf spans one character, in piece tables, pieces have different lengths.

Furthermore with ropes, every operation returns a new rope data structure, that means ropes are immutable. If you want to implement undo, you only keep references to the former ropes. There is no inserting or adding via looking up the changes in an undo list.

I think maybe if you implemented a piece table, where every piece spans one character, used a binary tree and made it immutable, you'd get a ropes data structure.

For more information about persistence vs immutability this link might help: https://stackoverflow.com/questions/10034537/persistent-vs-i...

comment 9y ago · link · parent

Starting with the initial board and applying n-1 moves should be significantly slower than using immutable data structures. I don't have much experience in algorithms but I think O(1) trumps O(N-1) :).

comment 9y ago · link · parent

Thanks for the pointer. I guess I could also have written a small program or script to go through the file. Regular fopen and fread should work. However the vlf package does exactly what I looked for. Only prerequisite I can see is that one must compile Emacs with bignum support on 32bit systems to read files greater than 512M.

comment 9y ago · link · parent

I'm using an X201 with Win 10 right now. The driver support was significantly better on Linux. With TLP and a lightweight window manager like i3, the battery consumption was miles better than windows. Without Wifi I was able to reduce the consumption to 8-9 W an hour, with wifi it was around 11-12W.

When I first switched back to windows, I was shocked to see the battery consumption being around 22 W. Lenovo's own battery management driver helped a lot. If I'm using firefox nightly I can reduce it to 16-18W an hour.

From my observation it seems to me that windows draws a lot of power when the system under low load, even on battery saver mode. With linux you can tune the battery consumption far better.

Performance-wise, due to Windows background services I experience occasional lags. The anti-malware engine, indexes etc. consume a lot of CPU cycles. The real bottleneck on X201 is the CPU. Due to heavy CPU usage, my laptop sometimes overheats and closes itself. I have only experienced this on Chakra Linux with an unstable version of KDE. Other linux distros and FreeBSD were absolutely fine.

Wifi connectivity was also very problematic. First couple of weeks wifi adapter stopped working everytime after I woke the laptop from sleep.

Now I don't have much to complain besides lags and the mediocre power consumption. Firefox nightly has helped immensely for a fluid browsing experience.

The bottomline is, for x201, if you want stability and performance but a more conservative experience go for linux. If you want a hassle-free cohesive but slower system go for Windows.

PS: Bugs on Windows might stem from X201 being an old machine.

comment 9y ago · link · parent

Textual dumps of SQL databases also fall in this category. I remember having downloaded a huge sql dump. I couldn't open it in most editors because they all buffered into RAM. The file was about 13G in size and did not fit into the RAM of any machine I own. But in this case using ropes wouldn't have helped either, I guess.

Text editors should also take huge files into account and provide sequential reading from the disk to memory. Even on Emacs, I couldn't work with the file. I ended up fixing it and importing it to Postgresql. And then I spent hours on indexing the necessary fields :).

comment 9y ago · link · parent

I think being wise and being intelligent are different qualities. You might solve a puzzle in shorter time if you're intelligent, or remember more things. But if you're wise you will spend your energy to solve the right puzzle and remember the right things.

comment 9y ago · link · parent

I am a long-time emacs user, yet I am amazed by the simplicity of VS-Code. The only downside is that it is heavy on the CPU and some basic functionality like showing line breaks is not included.

Otherwise it is a wonderful peace of software.

comment 9y ago · link · parent

I was comparing paper to screen. IMHO for skipping around monitors win hands-down, but for learning and extracting information paper provides a much-more focused experience.

comment 9y ago · link · parent

Many people have upgraded to either Kaby Lake or Ryzen. There are rumors that Intel aims people who have not upgraded for more than 5+ years.

However the current generation will add two more extra cores with slightly better single-threaded performance for the same price. i7's and i5's will have 6 physical cores and i3's will have 4 physical cores. On multithreaded performance there is a huge capability increase resulting from the extra cores and threads compared to the latest generation.

Motherboards are yet to be released, and people are expecting higher prices in the beginning due to a potential increased demand. We'll see what happens.

comment 9y ago · link · parent

I've noticed also noticed this. Currently I'm thinking of buying a cheap refillable laser printer to print out books an articles. There is something else about reading something on paper and being able to work through it (highlighting, taking notes etc.). I've tried PDF annotation programs, but none of them worked quite well.

I think the solution to this problem might be either ultra high resolution monitors or e-ink monitors.

comment 9y ago · link · parent

Even if OpenVPN doesn't work, ssh tunneling could get you onto the free internet. I imagine that using Tor would certainly get you into trouble in China. There was a statement in a documentary from an ex Syrian Intelligence Officer that they found out and tortured people who used Tor or other encryption methods. Anonymity in the Internet at the age of surveillance states is really tricky. One slip-up and your identiy might get comprimised.

comment 9y ago · link · parent

IMHO it is not just the hierarchy of values. In Turkey Wikipedia has been blocked for months, without a court order. The government man-in-the-middle's its own citizens and makes wikipedia unreachable. Even if you use a dns, they spoof the dns and redirect you to their own IP. It seems to me that people do not care, when it is the internet.

The thoughts of Locke, Rousseau, Hobbes are taught nearly in every university and there is no culture of conformity. People seem to simply not care, or are afraid to speak their minds.

comment 9y ago · link · parent

I think alcohol consumption is tied with the social circle of teenagers. I was a shy, silent pupil at high school, but I knew how to play guitar. So I joined a band, and instantly started going out once a week to drink. None of us were old enough to drink, but we managed to find bars which allowed us a few drinks.

For the dating part, I think this is tied up with the insecurity of kids nowadays. There is a lot of competition, the TV/internet is bombarding us with beauty ideals and perfect relationships. It is easy to give up and convince yourself that you'll be "forever alone". There are even communities online, where kids with no relationships hang out. And the longer they wait, the harder it gets for them to start a relationship.

IMHO the kids need to find a way to bite the bullet and be social.

comment 9y ago · link · parent

What do you want to achieve? Do you want to write an interpreter for your language in Lisp, or write a transpiler, which converts your language into Lisp and than maybe to native code?

If you want to generate efficient machine code, I'd suggest looking at Clang's intermediate language IR.

PS: I may have misunderstood your question, if that's the case apologies.

comment 9y ago · link · parent

Same here. The only thing I apply from GTD is that if the task can be done under 5 minutes do it.

Making todo lists and sticking to them require too much discipline. In my professional life I keep todo lists, reminders etc. But in my personal life I'm a lazy lazy person.

I can't seem to find a solution to this.

comment 9y ago · link · parent

I'd like Excel to have built-in .net scripting support. Imagine being able to code excel macros in F#.

comment 9y ago · link · parent

I was also skeptical of apps, but they do deliver a better more cohesive experience. I actually like the reddit app and it saves me a lot of time.

As for security, you don't have to grant permissions. All apps are also put through a scanning process.

For portability the browser wins. For quality well crafted apps prevail.

comment 9y ago · link · parent

I'm still rocking an iPhone 5. I use it mainly for browsing, news apps and spotify. It has the latest OS, all new apps are usable (except games of course).

Recently the battery got swollen, I took it to an apple shop and got a replacement (a refurbished iPhone 5) for 100 dollars.

comment 9y ago · link · parent

For me the Tour of Go was a bit terse. I found out that typing out all examples in Gobyexample is really helpful. Visual studio code, with go extension and Gobyexample were the tools that enabled me to learn Golang.

comment 9y ago · link · parent

I've made further research into the latest news. During IFA fair (two days ago) Qualcomm stated that Windows 10 ARM devices are coming, it seems to me that they're not backing down from the fight. [1]

It is good news to hear that the vast majority of x86 ISA is no longer patent-encumbered.

[1][http://www.trustedreviews.com/news/qualcomm-snapdragon-835-w...]

comment 9y ago · link · parent

I haven't used PHP for CLI scripting, however I've used Python and Golang. I can say that Golang argument library (flag) feels more straightforward to me than Python's argparse.

  import "flag"
  var ip = flag.Int("flagname", 1234, "help message for flagname")
  ...
  // flag.Parse() once in the main function
vs

  import argparse
  parser = argparse.ArgumentParser()
  parser.add_argument("square", help="display a square of a   given number",
                    type=int)
  ...
  args = parser.parse_args()
In the Go example you get a pointer just like in C, in the python example you get a special object and can access its fields. Both are simple, but Golang is IMHO closer to C in this matter.

comment 9y ago · link · parent

Taxing wealth may be counter-productive. The way our economy should work is that you get rewarded for the wealth you generate. If you cannot store the value for the things you've done, there would be no incentive to produce.

A janitor working as a contractor may not have the chances the people in Kodak had back in the day. But at least he/she still gets to work a shift, gets paid for overtime. There is nothing stopping that person from pursuing their passion and create wealth. The reward of the wealth may be monetary or not.

On the other hand, let's think about the "privileged" workers. The more you get paid, the less life you have. In our current state of capitalism, if the employer pays you a lot, he/she wants to own you and use you until nothing of you is left. The current system doesn't care about long term, it's all about the short term. The people who break are replaced, and because people break, the workload gets heavier. But there is an unlimited demand of new workers fresh out of school willing to work under the same conditions. The work starts in the morning at 9 am, you can't be late, but you can't leave until the work is done. You go home, sleep for a few hours and start again. Sometimes you work on weekends and you definitely take a laptop to your holiday (if you have one).

If you work this hard, generate wealth and you know that if you stop working, all that you've endured would be for nothing, that would be inhumane.

506.

Here’s how much Qualcomm and Microsoft’s new Snapdragon 835 laptops will cost(trustedreviews.com ↗)

1 points · by terminalcommand · 9y ago · discuss

507.

Why Microsoft's Snapdragon Windows 10 Cellular PC Is Walking Dead(seekingalpha.com ↗)

3 points · by terminalcommand · 9y ago · 4 comments

508.

Golang tutorial series(golangbot.com ↗)

3 points · by terminalcommand · 9y ago · discuss

comment 9y ago · link · parent

I used to achieve this by using a tiling window manager (i3).

In i3, if you run firefox normally it opens up in a pane, if you choose full screen (f11) inside firefox, it fills up the entire pane. In the other panes you can still keep your other windows, such as emacs, file browser, terminal etc.

comment 9y ago · link · parent

I don't think Go targets the less experienced. Could you provide a resource, where the language creators have stated that Go targets interns?

Go is a safe programming language, but it is not simple. Go has very rigid rules.

I don't see any difference in complexity between programming in C and programming in Golang. Programming in Golang may even be harder than C.

If you format your code wrong, Golang screams at you.

If you import a package and never use it, Golang screams at you.

If you redefine a defined variable, Golang screams at you.

If you don't use a variable you defined, Golang screams at you.

C is much more forgiving :).

Golang makes dynamic memory management safe, but in nowhere easy. You still use the good old void* via an empty interface. For an intern, garbage collection doesn't matter, an intern is intelligent enough not to leak so much memory so that it will get noticed :).

I sometimes think Golang resembles the early versions of Java. Creating a safer C-like language, with great ideals. With Java the complexity kicked in after a while. Golang still resists the urge to please everyone.

1
161718
23