There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

null , in Touch a file in Linux

Is there a command that’s actually just for creating a new file?

ezchili ,

I guess printf “” > file

48954246 ,

Feels dangerous to run. What happens if the file already exists and has something important in it?

touch -a is probably better

gaterush ,

The other command could just be printf ‘’ >> file to not overwrite it. Or even simpler >>file and then interrupt

owsei ,

or :>>file then you don’t need to interrupt

4am ,

.“:>>” is “append null” right? Do you get a file with a single ASCII NUL or is it truly empty?

al177 ,

$ :|wc -c 0 $ touch /tmp/f; :>>/tmp/f; wc -c /tmp/f 0 /tmp/f

0x0 ,

Not really. I believe : is the “true” builtin. So it’s like running a program that exits with zero and writes nothing to stdout. The >> streams the empty stdout into the named file.

gaterush ,

that’s awesome, did not know about that handy operator!

owsei ,

Yeah!

it’s basically a noop, I use it as a placeholder when I’m writing a script, since bash doesn’t accept code blocks with no commands

Midnitte ,

I mean, nano filename will work, but there’s no mkfile that I can find…

$>filename would also work, but it’s not explicitly for creating a new file

gamma ,
@gamma@programming.dev avatar

Nope. If you open a nonexistent path and you have permissions to write to that directory, then that file is created.

tranzystorek_io ,
@tranzystorek_io@beehaw.org avatar

most shells will accept outputting from a silent command to a file, e.g. :> foo.txt (where : is the posix synonym to the true command)

dan ,
@dan@upvote.au avatar

How often do you actually need a blank file though? Usually you’d be writing something in the file.

null ,

I’m betting that’s why none ever materialized. Most tools that can manipulate a file, can also create that file first, so there’s just never been a usecase.

Right-clicking the desktop to create a new txt file in Windows feels so natural, but I can’t really think of any time you’d want to create a new file and do nothing with it in a CLI.

schnurrito ,

You might if some other program checks whether that file exists and behaves differently depending on that.

null ,

But even still, what’s a realistic usecase that would that involve needing a blank, unmodified file in that instance?

indepndnt ,

One use case is if you’re running a web server that is configured to return a “maintenance” page instead of the live site if a particular file exists. Which is actually pretty cool because then you don’t have to update the config when you need to do something or let your users get a bunch of 502 errors, you just touch maintenance and you’re good.

null ,

That’s a good one!

Redkey , in And don't forget RTFM

“If you wish to be a writer, write.”

Epictetus delivered this burn over 1900 years ago.

VirtualOdour ,

Yeah but I feel like there’s a million books been written since that time which point out how vapid this quote is. To write one must know what you want to say and how to convey it, do you really think it’s better to just dive into a task unprepared and muddle through rather than learn first the structure and ideals behind such work?

Kratzkopf ,

I would say both. You need to learn by trying things out, making your own mistakes and finding a style. Then you get input from the outside world on why some peculiar structure make sense or just giving helpful tips. Then you try out more, apply those tips and see what works for you. But you can read as much helpful input as you want, it won’t be any good without you trying to apply it and practice.

Ookami38 ,

At the end of the day, both are required. You need to study to be effective at what you’re doing, but at the end of the day the only way words get on paper is writing. You’ll also get more out of learning these structures and ideals trying to apply them after you have a bit of time just floundering, getting a feel for the actual task.

zarkanian ,
@zarkanian@sh.itjust.works avatar

Is that actually a burn? It depends on the context.

It’s the same thing whenever I hear somebody say “I wish I could draw like that.” You probably can, but it would take hundreds of hours of practice. Of course, people wish that there was some shortcut, so that they could get the skill without all the work.

orphiebaby ,

Yeah, came here to compare. Both are wrong. If you wish to be a writer, write. If you wish to be a good writer, learn something. Same with programming, except programming requires something to function so it’s even worse in that regard.

Malix , in I see.... finally vim has other purpose than being text editor
@Malix@sopuli.xyz avatar

Vim commandline goes :BRRRRRRRRRRRRRRRRRRRRRRRRRRRR

InstallGentoo , in Hey, I'm new to GitHub!

Why do they feel so entitled for everything?

jdeath ,

because they aren’t a smelly nerd ig

rimjob_rainer , in ifn't

Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.

KmlSlmk64 ,
@KmlSlmk64@lemmy.world avatar

If someone really wanted to add it, probably the best would be to use unless

JoshuaEN ,

I really liked having unless in Ruby; a ! can be easy to miss, while unless made it clear without needing to write out != true.

HexAndSquare ,

It’s also cool when you do unless(!condition). I particularly like this.

Ferk , (edited )
@Ferk@kbin.social avatar

Yes... how is "reducing exclamation marks" a good thing when you do it by adding a ' (not to be confused with , ´,or’` ..which are all different characters).

Does this rely on the assumption that everyone uses a US QWERTY keyboard where ! happens to be slightly more inconvenient than typing '?

Ookami38 ,

I think it’s just capitalizing on a trend to add n’t to otherwise noy contractions, to make them into contractions. Contractionn’ts, if you will

kromem , in The Perfect Solution

Inefficient solution.

You should simplify it to just ask the model if the last bit of the binary representation of the integer is a 1 or a 0.

Natanael ,

They don’t process inputs as binary (they use clusters of symbols, i.e. letter groups) so that’s not guaranteed to work

kromem ,

r/woosh

Natanael ,

I did realize that too was a joke, still wanted to point that out

kromem ,

Well, in the sake of pointing things out, GPT-4 can actually correctly answer the prompt, because it arrives at it in the opposite direction. It can tell the integer is even or odd and knows that even or odd integers in binary end in 0 or 1 respectively.

AeonFelis ,

You can ask it if the last digit is odd or even, then.

MonkderZweite , in You can have anything you wan...

Wish granted, goes on to create yet another “better” programming language.

btw, OP forgot “understanding”, which is the harder part.

coloredgrayscale ,

Good point. Maybe that’s why they clarified “all knowledge in data structures and ml and ai” in the end.

Then again, just because you have all puzzle pieces (and a few extra) it does not mean you can solve it.

KingThrillgore , in “It’s not that hard”
@KingThrillgore@lemmy.ml avatar

Jesse, what the hell are you talking about?

HiddenLayer5 , in Need a rust version too.

You have Rust.

Forget rescuing the princess, that’s unsafe. Lock her down even more!

victorz , in Not mocking cobol devs but yall are severely underpaid for keeping fintech alive

Honestly not the right format for that meme template lol. The monkey should represent one person doing both looks.

CurlyMoustache , in Programmer tries to explain binary search to the police
@CurlyMoustache@lemmy.world avatar

This is how I look for the best bits in porn

cRazi_man ,

Fast forward half way and see if the woman is still there?

xaxl ,

I fast forward half way and pray she still isn’t slobbering on some knob at that point and they’ve gotten down to businesses already.

doctorcrimson ,

It’s got huge amounts of applicability in many lifestyles and situations that most people never realize until the moment arrives. I once played a fun game that had you guess a number between 1 and 1 Billion with them telling you higher or lower to earn your freedom. Takes a couple of minutes at most.

yum13241 ,

Your first guess should always be 500,000.

doctorcrimson ,

500,000,000*

yum13241 ,

Thanks.

reddig33 , in Microsoft Edge could use a win

Edge was a win when it first came out. It had its own rendering engine, was fast and svelte.

Now it’s just another bloated Chrome clone overstuffed with privacy-invading marketing features.

1984 ,
@1984@lemmy.today avatar

Same story every time. Something good turns into shit because they need to add marketing.

I’m shocked Microsoft hasnt fucked up VS Code yet. Someone much smarter than average is running that team at Microsoft.

SpeakinTelnet ,
@SpeakinTelnet@sh.itjust.works avatar

Oh now you’ve gone and jinxed it.

Toast ,

Nah the future for VS Code looks dark imo. They own VS Code, Github, NPM and Copilot and everything they touch turns into shit.

ricecake ,

It’s because they make their devtool money off of enterprise licensing costs, and they get those costs by getting developers to be okay using their devtools.
The tool is the advertisement for building software for Windows. If it gets too miserable to use the tools or build for the ecosystem, then some companies won’t prioritize windows software, and developers will prefer jobs doing something else. It’s got to be good enough so that decision makers at software companies don’t start hearing that windows software takes three quarters longer to develop.
Web developers are already targeting their browser as an afterthought, and mobile developers are pretty pulled into to apple ecosystem, since you can develop android apps on a Mac, but you can only use a Mac to make iPhone apps.

Without developers, applications lag, and they lose business and consumer market share, which costs them more developers.
Hence: visual studio is fine, and they keep adding azure features to GitHub and tying it all to visual studio.

ILikeBoobies ,

It turned bad because a bunch of users refused to use it because they remembered never updating past IE8 and made jokes about it lagging behind the competition

VS Code is the fucked up version of Code OSS

glad_cat , in They tried

So far I’ve only seen small US newspaper who did this. Is anyone angry about this?

Oddbin ,

There’s a medical website that appears in top searches (forget the name) that does it too but yeah, mostly seems to be news websites but not the big ones. In most cases Unlock Origin or the like can hide the panel they throw up to choose if you really need the info or archive or 12ft ladder can get you the info.

Pigeon ,

deleted_by_author

  • Loading...
  • Oddbin ,

    That’s the one!

    I love how my description of basically “it’s a website in searches” was enough for someone to figure it out 😄

    lemann ,

    I dns blocked them after constantly clicking on the first result and it being their site. The “please enable cookies” wall started to get old fast

    ChlorineAddict ,

    If only there was a way to store state of that decision…

    MDFL OP ,

    I just happened to run into a few recently. Just venting some frustration.

    BuddyTheBeefalo ,

    www.tagesspiegel.de has no option to disable cookies without a subscription from contentpass. I think it’s contentpass’s business model.

    sj_zero , in Zero to Hero in 1 hour

    Unrelated, I love those stairs. They seem like a disaster waiting to happen but I love them.

    lightnsfw ,

    Break grandma’s hip in 10 easy steps!

    KIM_JONG ,

    My grandma is so hip, she uses kubernetes.

    milkjug ,
    @milkjug@lemmy.world avatar

    Yo she alright but does she even know how to exit vim

    KIM_JONG ,

    Bitch, my g-ma :wq yo ass :1,$s/Twice on Sunday//g

    PersnickityPenguin ,

    Lol 1 easy step

    TheBat ,
    @TheBat@lemmy.world avatar

    Your grandma sounds kinky ngl

    my_blackest_day ,

    Children injury in 5 easy steps! Available now!

    LegionEris ,

    Yeah, I am, without sarcasm, super agile and coordinated. I would love to have these steps. It would be fun for me every time. And I’d feel so safe at the top of my tricky stairs. Unfortunately my wife would never. She’d just be trapped downstairs.

    sj_zero ,

    "My wife" aka the lady you brought down before the drugs wore off who can never leave your basement.

    :P

    LegionEris ,

    Psh. The drugs never wear off. She smokes weed all day every day.

    ChickenLadyLovesLife ,

    I run 6 miles every other day. A local rails-to-trails path near me is exactly 2.5 miles long, so I have to find some way of getting in an extra mile on my runs. The trail ends at a real railroad track, so for a while I tried running a half mile on the track and back, between the rails landing on every other tie as I ran since the distance perfectly matched my stride. This went on for a couple of years until one day I was doing it and actually started thinking “wow, this is pretty amazing that I can do this and not fall”. Not five seconds later I tripped and fell, landing both elbows and both knees on tie.

    Somehow I was only bruised and didn’t break anything, and after ten minutes of groaning I was able to drag myself up and even complete my run. That was my last time running on railroad ties though.

    LegionEris ,

    Yeah, never take it for granted. You gotta do it on purpose with your feet every time. Learning to purposely activate intuitive motion is the goal. In a way, they’re extraordinarily zen stairs. You have to be right there on the stairs every time.

    PersnickityPenguin ,

    You should try the Oahu Diamond Head hike then. Its like a half mile of hiking up a funicular track.

    GbyBE ,

    Perfect stairs to your man cave 🙂

    LegionEris ,

    Except I’m not a man, and I don’t have a cave. I’m a woman, and I have a cage. But it has to be accessible to my wife so she can let me out eventually o_o So again, no agility stairs allowed.

    GbyBE ,

    Sorry, I somehow failed to notice the [she/her]. Didn’t mean to offend.

    LegionEris ,

    Oh you’re good. I actually put it in there after seeing your post. You and the Hexbears inspired me.

    PersnickityPenguin ,

    “Seem?”

    As an architect this is honestly insane. First rule is to do no harm, but someone obviously is a psychopath, and thats the designer.

    There is no way that thin metal can even structurally support a person.

    GbyBE ,

    Of course the metal can support a person. It’s not like one side is floating in thin air. The way this is constructed, both sides of each step are supported and the metal seems thick enough to support quite a bit of weight.

    The only thing that bothers me is that forward/backward motion of the steps would put a lot of strain on the connection to the wall or floor. With normal use, that motion is quite limited though.

    I’m quite confident the designer of those stairs used the right thickness for the material used, which you can’t judge from a picture.

    discostjohn ,

    My concern would be if someone slipped and got their leg wedged between two of the steps

    GbyBE ,

    I guess that would also be a legitimate concern, as the steps are rather short. It would look a bit less sleek with longer steps, but making the steps longer while keeping the supports narrow would still look good in my opinion.

    18107 , in This one goes out to the sysadmins in the crowd.

    I really hope those aren’t factorials.

    ptz OP ,
    @ptz@dubvee.org avatar

    Depends on which crappy software vendor I’m dealing with in any given week. lol

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines