Hacker Newsnew | past | comments | ask | show | jobs | submit | mshanu's commentslogin

I am pleasantly surprised when it is able to figure out the root cause of some bugs which at times require a lot of mental energy


Exactly


i suppose if llm is doing most of the coding going forward, IDEs become less relevant i suppose


Remote only to US and Canada?


would you even consider remote from Asia?


There is a difference between you writing code for library and general purpose app. When you write code for an app, you are bound to change the code frequently than you are writing code for library, so while I think there could be merit in putting comments for library, i dont think it will counter productive to write comment for your app code, as it is pain in the wrong side to keep both code and comment consistent


> When you write code for an app, you are bound to change the code frequently than you are writing code for library, so while I think there could be merit in putting comments for library, i dont think it will counter productive to write comment for your app code, as it is pain in the wrong side to keep both code and comment consistent

So? Good comments are valuable, even if they aren't always kept absolutely consistent with the code. Comments shouldn't restate what the code says, they should either say things the code can't say (like why), or (sometimes) summarize what the code does at a different level detail to make it easier to understand.

The trick is to read code and comments together, and dig into source history when something seems off.


Trying to put my head around, why is this log.debug("user-agent=" + userAgent); bad?


Because the string concatenation requires allocation of a new string, which will need to be garbage collected, regardless of whether or not the log.debug actually needs it.

Using a format and args lets you call the method with only references to existing objects, no additional string needs to be allocated unless the log method actually needs to generate the string to log (and it might even be able to use streaming to output the log and never even allocate the string)

When you’re doing things like putting trace logs with all your parameters in at the top of every method call, the memory and GC pressure of generating unnecessary strings can be significant.


ok, so its only gc overhead, and no security issue with it?


The first argument is code and the rest of the arguments are data, much like an SQL statement and its parameters. You could try to prove that whatever interprets the code in the first argument will never do anything dangerous no matter what it's supplied with, but then someone might add that dangerous feature later, as happened in this case.

To make it always work correctly, don't pass the data values as code. Although apparently[1] Log4j complicates this by mixing code with data even if you separate them, unless you tell it not to by saying "$m{nolookups}" instead of "%m".

[1] https://www.tasktop.com/blog-under-construction/log4j-2-the-...


No. I don’t think anybody generally expects log message parameterization to do anything like escaping or white space normalization or anything to the parameters that wouldn’t also be done to the message string.

If you are using a logger to output a message which you want to be able to parse based on delimiters, say, it would be up to you to escape any parameters you were incorporating into it to ensure they don’t confuse your parser.


Generally, most logging frameworks have two parts, the format string, and the parameters. A good logging library will also avoid calling str()/toString() if the log isn't emitted (for example, if it's a debug log but minimum level is info).

You have something similar when building database queries, generally you should have a base template into which you insert arguments. The library generally should take care of escaping things and also preventing things like SQL injections.


Most of the organisations expects their employee to demand than being offered. Take promotion for that matter, how many organisation have the culture of offering without demanding


I think this is the challenge with all decentralised systems, its not as easy as you click some buttons and you get served like in web 2. Hope more focus will come on experience part of this, for such approaches to become popular


R2 means “Really Requestable” from their website, really..


literally


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: