Better HN
topnewbestaskshowjobs
Log inSign up

timeattack

345 karma · joined Oct 31, 2018 (8y ago) · 63 submissions

Submissions

comment 6y ago · link · parent

> Are you joining my side?

No.

As a user of many programs I always find it very frustrating when some program does not work and produce no log information whatsoever.

As an engineer, I always write detailed and human-readable log entries with as much context as possible which is split into trace, debug, warning and info levels.

With trace level enabled it's typically possible to reconstruct program execution step-to-step, which is _invaluable_ when you need to debug some rare problem.

Even if logs are ephemeral and not persisted it's better to have logs for a run than not having logs at all.

Logging as a side effect is irrelevant if you look at your code from the pragmatic standpoint, from which program execution transparency matters more than some abstract elegancy.

comment 6y ago · link · parent

Whenever I read, see or, especially, visit such enormous abandoned man-made objects I have very specific feeling which is hard to put in words. Some wild yet soothing blend of awe and fear.

Does anyone else experience it? Is there a name for such feeling?

comment 6y ago · link · parent

Well, there is still no panic and hospitals are not overrun with patients. Russia is not China and far from being able to hide such things from public.

comment 6y ago · link · parent

Another one, which creates backups on locally connected backup pool — https://github.com/reconquest/zeus

35.

First Case of 2019 Novel Coronavirus in the United States(nejm.org ↗)

5 points · by timeattack · 6y ago · discuss

comment 6y ago · link · parent

I can agree if there are not so many abbreviations, but when almost every single line is full of them, that is what makes code incomprehensible.

comment 6y ago · link · parent

This is an example of what is making ML so hard for uninitiated.

160 characters per line, avoidance of using spaces, abbreviations everywhere which are not explained anywhere, lack of autoformatter.

This looks like a recipe for write-only code for me.

My pet theory is that people which invent such styles are actually not a apt touchtypers, so they avoid typing many characters because it's kind of pain for them.

comment 6y ago · link · parent

I'm wondering about how common this knowledge nowadays? What is the chance that if you take average Joe and put him into forest without any specific tools, what is the chance that he will be able to start fire?

That's what feels inherently wrong to me about our knowledge system is our common knowledge is so superficial and we're constantly loosing touch with very basics about nature of things.

comment 6y ago · link · parent

Interestingly, my cat started to bring pieces of her food to me so I can throw it and she can pretend it's live pray she is catching. This behavior emerged suddenly out of nowhere without prior training.

I bet many pet owners can share same anecdotal evidence of certain level of social intelligence which, I think, is not widely accepted in scientific community.

comment 6y ago · link · parent

Hey Anders, there's vulnerability in your code. I've sent an email to you describing it.

comment 6y ago · link · parent

For the last years I was working on several startups as a contractor.

I always put my very soul to the success of the project, tried to be friend for everyone on the team, committed for 40-50 hours per week. When projects demanded non-profile skills from me, I was open-minded, trying to learn new skillset in no-time to help as quickly as possible.

All the times I was dissapointed on being really no-one in the end for the project.

Despite I was trying to be guiding voice to help project to stay away from bad decisions, project owners were not really listening.

I said, many-many times things like "let's stop delivering new features until we will have at least 1 paying customer and focus on getting customer flow", CEOs just kept pushing in obviously wrong direction which ultimately meant end for the project.

Now I'm fed with all of this and decided to put my limited time to my own projects.

comment 6y ago · link · parent

Kind of obvious one, but I wish more people knew that — critical thinking.

On the one side it helps to avoid bad/stupid things in life: quackery medicine, scammers, bad investments, etc.

On the other side it allows to peep deeper into things and see more choices even in ordinary life. After some practice you gain nearly magical ability to peel couple of additional layers from reality and to see non-obvious things everywhere.

comment 6y ago · link · parent

May you reconsider changing your title screenshot [1]?

Now it contains chat references to porn & other 18+ channel with obscene language (in Russian).

Not exactly thing that you want to send to your colleagues.

[1]: https://github.com/zevlg/telega.el#screenshots

comment 6y ago · link · parent

Reminds me an accident which was caused in Hawaii by bad UI and following rather funny examples of how can bad UI screw things up: https://gfycat.com/blog/hawaii-missile-gifs-alert-terrible-u...

comment 6y ago · link · parent

I don't quite get those arguments [1]:

> The single-file restriction is an effective save-guard against feature creep. [...] We are able reject pull requests simply because they would add too many lines or add too much complexity, and that's nice.

bottle.py is already 4425 lines of code [2].

So, despite they say they reject pull requests because they add too many lines, it's also can be said that they reject pull requests because file is too big already and merging PR makes it even harder to maintain.

> A single file is easier to debug and understand. [...] You can read the entirety of bottle.py in an hour or so. Most of it is pretty easy to understand. Try that with flask/pyramid/django [...]

Why not at least to just split it to 1 section per 1 file, which they emulate right now by using section-delimiting comments [3]? Will it make code much harder to understand? Or will it make code easier to understand?

Also, from a developer perspective, what about navigation to the correct section quickly. E.g. if developer wants to add a new Exception, how he can efficiently go to the specific section? If it wouldn't be single file, developer could jump to required file by typing couple of letters in fuzzy file opener it his editor of choice.

No one forces developers plunge into a feature creep apart from their own, and it actually doesn't matter is there a single file or not. Some prefer to write as many code as they can in one single line. I doubt that they do it to ease maintenance and to avoid feature creep.

[1]: https://github.com/bottlepy/bottle/issues/1158#issuecomment-... [2]: https://github.com/bottlepy/bottle/blob/master/bottle.py [3]: https://github.com/bottlepy/bottle/blob/332215b2b1b3de5a321b...

comment 6y ago · link · parent

I'm using similar versioning for pre-build packages, but it's extended with commit information to 1:1 mapping to the source tree:

  local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
  local count=$(git rev-list --count HEAD)
  local commit=$(git rev-parse --short HEAD)
  echo "$date.${count}_$commit"
Example result:

  20191121.68_84f90ff
It provides user about general information about when program was updated along with specific information for developer for bug reporting. Also, it allows intraday releases.

comment 6y ago · link · parent

  echo '3A2DD5E0D2C04F13A3E2F600C9530793' \
      | sed -r \
          -e 's/-//g' \
          -e 's/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/\1-\2-\3-\4-\5/' \
      | tr '[A-F]' '[a-f]'

comment 6y ago · link · parent

IMO shell which require developers to write code like this [1] to implement mere syntax highlighting for command you're entering has bad design.

I don't know which level of intellect is required here for a newcomer to fix a bug.

[1]: https://github.com/zdharma/fast-syntax-highlighting/blob/mas...

comment 6y ago · link · parent

Sorry, but I find this to be very bad design.

Check this out [1]: kak script evaluating sh script which in turn call perl which constructs kak script commands and output them to stdout to be evaluated by kak.

Or this one [2]: same, as before, but now it's calling awk, which calls `date` binary (so it's kak → shell → awk → date → kak).

It seems that it's done this way because sh is not good programming language to use for manipulating text. Moreover, sh is not good programming language to write complicated programs, which later can be successfully maintained & tested.

For me, kak approach is past the border of unmaintainability.

Also, it raises question of why not to use embedded language like python or lua instead of creating such a limited editor-specific language.

[1]: https://github.com/mawww/kakoune/blob/25429a905b717d29bdf92c... [2]: https://github.com/mawww/kakoune/blob/25429a905b717d29bdf92c...

comment 6y ago · link · parent

I think that Chess is still interesting for many people because of a) rules are easy to understand but game is hard to master; b) there is a social aspect of playing against human being face to face.

comment 7y ago · link · parent

Because of this we've implemented a tool called `mark` [1], which allows to write articles in markdown and render them as native Confluence pages.

If you're interested in having self-hosted service for that, just drop us an e-mail here [2].

[1]: https://github.com/kovetskiy/mark/ [2]: https://mark.reconquest.io/

comment 7y ago · link · parent

Looks like you're talking about https://en.wikipedia.org/wiki/Icyball

comment 7y ago · link · parent

I have exactly the same problem as you. I'm looking for a solution too and it seems that deep sleep length/continuity might be linked with serotonin levels. Did you take a blood test on serotonin?

comment 7y ago · link · parent

I think that downplaying the achievement is more like defensive mechanism which exists to protect illusion of human brain superiority.

comment 7y ago · link · parent

Most often case is when you forget to type sudo before command. This implementation propose to re-type executable name in all-caps (or type it in all-caps beforehand).

More efficient approach is to use keybinding like Ctrl+T to prepend sudo to the current command (or to the previous command if current is empty).

56.

Ask HN: Do you have problems with Bluetooth on Linux?

3 points · by timeattack · 7y ago · 1 comment

comment 7y ago · link · parent

Twitter-driven economy.

comment 7y ago · link · parent

This is perfect example of a insight which leads to a rabbit hole of intertwined complexity of our concepts when you try to understand why regexp for validating regexp is actually much simpler than regexp for validating email address.

comment 7y ago · link · parent

Nothing really interesting. It just following python script encoded in binary mapped to utf-8 characters:

    song=b'<truncated>'

    class PlaysoundException(Exception):
     pass
    def _playsoundWin(sound, block = True):
     from ctypes import c_buffer, windll
     from random import random
     from time   import sleep
     from sys import getfilesystemencoding
     def winCommand(*command):
      buf = c_buffer(255)
      command = ' '.join(command).encode(getfilesystemencoding())
      errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
      if errorCode:
       errorBuffer = c_buffer(255)
       windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
       exceptionMessage = (' Error ' + str(errorCode) + ' for command:' + '  ' + command.decode() + ' ' + errorBuffer.value.decode())
       raise PlaysoundException(exceptionMessage)
      return buf.value
     alias = 'playsound_' + str(random())
     winCommand('open "' + sound + '" alias', alias)
     winCommand('set', alias, 'time format milliseconds')
     durationInMS = winCommand('status', alias, 'length')
     winCommand('play', alias, 'from 0 to', durationInMS.decode())
     if block:
      sleep(float(durationInMS) / 1000.0)
    def _playsoundOSX(sound, block = True):
     from AppKit  import NSSound
     from Foundation import NSURL
     from time    import sleep

     if '://' not in sound:
      if not sound.startswith('/'):
       from os import getcwd
       sound = getcwd() + '/' + sound
      sound = 'file://' + sound
     url   = NSURL.URLWithString_(sound)
     nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, True)
     if not nssound:
      raise IOError('Unable to load sound named: ' + sound)
     nssound.play()

     if block:
      sleep(nssound.duration())
    def _playsoundNix(sound, block=True):
     if not block:
      raise NotImplementedError(
       "block=False cannot be used on this platform yet")
     import os
     try:
      from urllib.request import pathname2url
     except ImportError:
      from urllib import pathname2url
     import gi
     gi.require_version('Gst', '1.0')
     from gi.repository import Gst
     Gst.init(None)
     playbin = Gst.ElementFactory.make('playbin', 'playbin')
     if sound.startswith(('http://', 'https://')):
      playbin.props.uri = sound
     else:
      playbin.props.uri = 'file://' + pathname2url(os.path.abspath(sound))
     set_result = playbin.set_state(Gst.State.PLAYING)
     if set_result != Gst.StateChangeReturn.ASYNC:
      raise PlaysoundException(
       "playbin.set_state returned " + repr(set_result))
     bus = playbin.get_bus()
     bus.poll(Gst.MessageType.EOS, Gst.CLOCK_TIME_NONE)
     playbin.set_state(Gst.State.NULL)
    from platform import system
    system = system()
    if system == 'Windows':
     playsound = _playsoundWin
    elif system == 'Darwin':
     playsound = _playsoundOSX
    else:
     playsound = _playsoundNix
    del system

    try:
     import base64, os, threading
     def play():
      try:
       fname='./rickroll018377.mp3'
       with open(fname,'wb') as f: f.write(base64.b64decode(song))
       playsound(fname)
       os.remove(fname)
      except:pass
     threading.Thread(target=play).start()
    except: pass

    a,t,m="ALERT!! : ","You've been RickRolled",'''Never gonna give you up,
    Never gonna let you down,
    Never gonna run around
    and desert you.'''
    try: from tkinter import Tk, messagebox;Tk().withdraw();messagebox.showwarning(a+t,m)
    except:
     try: import Tkinter,tkMessageBox;Tkinter.Tk().withdraw();tkMessageBox.showwarning(a+t,m)
     except: print(m,t)

comment 7y ago · link · parent

https://github.com/seletskiy/carcosa
123