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

Yes you could, but then you'd have to have both the declaration and the implementation of the interface in the same package. That would mean that if either of them is in a separate file, you'd have to import it. That in return, could easily call hellish compiler errors due to circular dependencies. In Go any circular dependency is an immediate compile error.

Looking at the link, the second advice is that you could require users to implement special functions such as ImplementsFooer() to explicitly declare which interface they're implementing. This could help, but this practice is not present in the codebases I've seen including the Go standard library (to the best of my knowledge).

comment 9y ago · link · parent

IMO interfaces are the Achilles' heel of Golang. Another thing that has been bugging me about them is that you cannot specify which interface you're implementing in the code (beside from comments). I think that is so because Go hates circular imports. If you had to import a file to be able to use an interface, you'd soon run into compile errors due to circular dependencies.

And as there is no way to immediately see where some interface is declared and if/which interface is implemented, you have to rely on comments and resort to manual search to find out more. That may be easy in smaller codebases or worthy of effort in important codebases such as Go standard library. But all an all this ambiguity does not fit with Go's discipline to prevent human errors by making everything uniform and explicit as possible.

Just for the sake of providing an example, let's look at time.go under https://golang.org/src/time/time.go, we can see in the comments of several functions that the programmer states a particular interface is implemented. Line 1112 of the aforementioned file is as follows:

  // MarshalBinary implements the encoding.BinaryMarshaler   interface.
  func (t Time) MarshalBinary() ([]byte, error) {
Now where is encoding.BinaryMarshaler declared? There is a package called encoding, maybe there? But the package has many many files, where would I find where BinaryMarshaler is defined? I'd have to resort to manual search. Now imagine that this is not an interface in the standard library, but rather an interface in some mediocre codebase that you're handed for the first time...

Tl;dr All I'm saying is that runtime errors due to empty interfaces are not the only flaw of Golang. Interfaces as implemented in Go could in some cases present a serious threat to code structure.

comment 9y ago · link · parent

Did you try firefox quantum? I am also using an "old" machine, first gen i7 mobile processor. Firefox (pre-quantum) was slow for me on windows so I switched to Chrome. But firefox quantum was equally fast if not faster.

Now, I am using firefox 56 on OpenBSD, and it is really really smooth.

comment 9y ago · link · parent

Actually having 50 tabs should not be an issue RAM-wise. The problem is that chrome (and firefox quantum) open many many processes and therefore consume a lot of ram. Quantum is expected to be much better than current Chrome in Ram consumption. Because chromium allegedly opens seperate processes for each tab(?), quantum uses the same process for a couple of tabs and thus allows resource sharing.

In a single processed browser, ram is not an issue. I've been using 25+ tabs for many years, only recently in Chrome I experienced a low ram warning (i have 8GB). I switched back to firefox 56.

455.

10 things you (probably) don't know about Go (2012)(talks.golang.org ↗)

1 points · by terminalcommand · 9y ago · discuss

comment 9y ago · link · parent

The easiest time I had writing GUIs was when I used PyQT. I designed the UI in Qt Designer, loaded it in the python code, set the bindings and voila, it was working.

Btw Visual Basic continues to exist under Visual Basic.NET and if you stick to the basics you could learn to write C# GUI programs pretty quickly.

I agree writing GUIs by hand is very counter-productive.

comment 9y ago · link · parent

Have you tried disabling SMT? And have you tried installing the latest microcode update? AMD has been having problems for a while, but I think they ought to have been fixed by now.

I, myself was thinking to acquire a Ryzen 5 1600 for a high performance programming desktop. I was thinking of running FreeBSD, it's sad to hear that it's glitchy.

comment 9y ago · link · parent

Actually KDE has had a similar feature for a while now. You can define "Activities" in KDE, when you switch between them all your settings and opened windows change.

For example you can define an Activity for each project, arrange your windows and settings (ie. desktop shortcuts, widgets, etc.), work on you project, then switch to a different activity. When you come back to your project, you'll continue from where you've left.

comment 9y ago · link · parent

That's very true. Especially the karma system makes you want to check HN obsessively. However, HN could very well be one of the best feeds available. The Information/Junk ratio is very good. The comments are insightful.

HN also helps meto forget about my surroundings and make the time fly away. For example I usually don't recall anything about my commute, when I'm on HN. I can shut everything off if I want to.

All the crowds make me extremely stressed to the point where my hands shake. HN really helps me to get through the day. Without distractions I don't think I would be able to stay somewhat functioning.

comment 9y ago · link · parent

Another solution to this problem could be opening seperate users on the computer. One for serious work, one for leisure.

One could probably block facebook, hn, news sites, etc. on the work user, and only have files and programs related to work.

comment 9y ago · link · parent

I think Python would be better to start with. It is interpreted so you will get sane error messages. The community is omnipresent. If you'd like instant answers, you could just pop in to #python on irc.freenode.net.

Most of the times all your questions will be answered by a simple google search, as there are mountains of good questions and answers on stackoverflow.

IMHO for you, getting back into programming will be as simple as opening the interpreter and starting to type.

I don't think programming has changed, the basic mentality is still the same. And nothing beats good old experience.

The new niche "trends" such as asyncronous programming, actor-based programming etc. could be easily learned by lingering on HN for a while :).

Best of luck getting back on the keyboard!

comment 9y ago · link · parent

Is it possible that you're working yourself to the bone to avoid thinking about your life.

I used to work crazy hours in workdays, on weekends I felt sick and sad. I actually wished for the stress of working at a high tempo. The downside was that I knew deep inside that the constant stress was detrimental to my health.

For years I've aimed for a work/life balance. But I am yet to achieve it. Either I work super hard, or I spend all my days procrastinating.

comment 9y ago · link · parent

My experience is exactly the opposite. I also made the choice to study something else other than CS and got into law school. Now, I'm in my final year, and I don't know what to do.

I feel sad that I didn't have the opportunity to study CS. Outside of school/internships all I think about is still computers. I've been struggling with this throughout my entire college life.

My advice would be that if you're genuinely interested about something, think real hard before choosing another field of study.

comment 9y ago · link · parent

I'd suggest trying more popular flavors of BSD first. Especially if you're installing on physical hardware, dragonflyBSD may be hard to begin with.

FreeBSD on the laptop has decent support, and in a couple of weeks you will learn about initrd etc. to be able to work with DragonflyBSD.

If you want to learn more about system internals, you might want to learn how to use bhyve (FreeBSD's awesome hypervisor) on FreeBSD. By trying to use bhyve you will learn how to extract the kernel from an img build, load it etc.

Have fun and good luck on your studies!

comment 9y ago · link · parent

I've looked into it a bit. Visualworks smalltalk documentation gave me an idea[1].

In Smalltalk everything is an object, that is including numbers, characters etc. The standar method-lookup searches from the innermost class methods to the outermost class methods.

The method finder could simply iteratively go through all applicable methods that return the class requested and match results.

[1]: http://esug.org/data/Old/vw-tutorials/vw25/vw25ug.pdf (page 42 method-lookup)

466.

Self-referential functions and the design of options (2014)(commandcenter.blogspot.com ↗)

1 points · by terminalcommand · 9y ago · discuss

467.

Windows Assembly Programming Tutorial [pdf](www-s.acm.illinois.edu ↗)

3 points · by terminalcommand · 9y ago · discuss

comment 9y ago · link · parent

I think anything goes really, I am on my way of becoming a lawyer.

Seperating hacking from your real life may be beneficial in terms of work life balance.

Although I must admit it is sad not to be able to work on your talents in your day job.

comment 9y ago · link · parent

Spotify's daily mixes seperate the genres/moods. I occasionaly switch to listening electronic music, but I mostly listen to rock. Spotify has one daily mix of rock, one daily mix of heavy rock and one daily mix of electronic. It doesn't mix the genres.

But discover weekly only gives recomendations for the dominant genre.

comment 9y ago · link · parent

vi, how to exit vi part made me laugh.

Joke aside, the basics of SQL can be learned in a very short time. Before fancy ORMs all novice programmers managed to get by using SQL in big-ridden PHP projects ;). I for example, got my introduction from querying a national database leak and than writing a simple blog with tricks I've learned from sqlzoo.

comment 9y ago · link · parent

The Moon is a harsh mistress, covers the invention of an AI by a computer technician to free the colony on the moon. If you're interested in Anarchy and AI, it's a good book.

comment 9y ago · link · parent

I use KeePass as my password manager, it doesn't sync automatically across all my devices, I occasionaly transfer my keys database to my phone.

You could always upload your encrypted key database to dropbox, and keep your private key on your phone, on your computer, or on a USB stick, if you want automatic sync.

comment 9y ago · link · parent

I've used FreeBSD on my laptop (lenovo x201) for a long time, I've also installed OpenBSD from time to time. The rumors on the internet was that OpenBSD had better hardware support. I remember someone claiming that whereas FreeBSD developers use VMs to develop, OpenBSD devs used native machines (mostly laptops). I faintly remember that installing OpenBSD was harder than FreeBSD. FreeBSD came with a terminal graphical installer, partioning etc. happened automatically.

The problem I had with BSDs was that they were slower than Linux. Especially when it came to boot times, Linux booted up in seconds due to parallel starting of system services. On FreeBSD the same machine with an SSD took nearly half a minute to boot. Some people here on HN had advised me to use a parallel system initializer, or never completely shutdown my laptop. Always keeping the laptop at sleep did not work for me, because I was (and am) very paranoid when it comes to computers, I can't sleep if my computer is not shutdown and has an ethernet cable plugged into it. Using a parallel system initializer did not work, because I was too lazy to set one up.

Battery consumption was another issue. Although FreeBSD provided decent battery life, utilities like powertop did not exist for BSD platforms.

What I liked about FreeBSD was that it was a pure OS. When I opened htop, I could see only a handful of processes running, and I knew what each process did.

On the other hand, everything required manual configuration. I basically lived in the terminal to operate my laptop. But that is probably due to my lazyness to automate and write scripts.

I'd also be interested in the differences in day-to-day life between FreeBSD and OpenBSD.

comment 9y ago · link · parent

Programming to interfaces help in this matter. e.g. if I have a data interface, I could use the same type on any format I liked. If it is the same interface, methods are the same too.

For encapsulation and message passing, coroutines work wonders. You could use a generator in Python, or a goroutine in Golang. And then you could treat different modules of your program, as if they were a standalone independent part.

comment 9y ago · link · parent

Github and Google services were once blocked in Turkey for political reasons. Even ATMs couldn't fetch updates because they relied on Github. When people started to realize the situation, github and google services were unblocked in a day.

comment 9y ago · link · parent

I think Golang is very suitable for network programming tasks. It gives you wonderful libraries to work with sockets, strict rules to structure your code, automatic memory management, goroutines for concurrent programming etc.

Most network related small apps were written in C, now you can write them in Go. With the added benefit of simple libraries, memory management and goroutines. You don't have to mess arround with platform specific sockets, threading libraries etc. Plus every piece of code you open is written in understandable Go. With C, there is years of baggage, multiple standards, pre-compiled headers, undefined behaviour etc.

And lastly, new is always more exciting than old :)

comment 9y ago · link · parent

Full disclosure: I have not dabbled with data science, nor I'm an experienced programmer.

But many of the CS pioneers dealt with the issue of reading input, processing it, and giving a meaningful output. Recently I've stumbled upon Jackson's Principles of Program Design and it has really helped me in writing a parser. IMHO general understanding of structuring a program goes a long way than arbitrary design patterns. I now am a propenent of modular programming. For me it resembles functional programming and TDD. Basically it states your program should be made up of numerous self-contained modules that can be independently tested.

For data science workflow it could be an import package, further divided in modules such as general helpers and implementations for different file types; a computation package etc.

comment 9y ago · link · parent

I installed linux mint debian, with Cinnamon. There is the start menu, there is a file explorer, there is firefox and an email client. There isn't any difference to Windows for a casual user.

I admit, setting up the system can be a little time-consuming. But once everything is working, it is real easy to operate.

If there are any problems, I help.

comment 9y ago · link · parent

Nowadays browsers use relatively a lot of resources. I don't know how ChromeOS handles tabs, but I imagine running everything in a browser takes a toll on performance.

I remember the agony I experienced when I needed to use Word365 online for a project. The javascript implementation was so slow and resource heavy that I was almost going to go crazy. Google Docs on the other hand worked fine most of the time. But none of them could replace a native MS Office or Libreoffice. Maybe with webassembly things are going to get different, but adding abstraction layers come at a cost.

Also these machines need to run videos and process pictures and maybe movies. With those requirements performance doesn't hurt.

1
151617
23