« first day (1655 days earlier)      last day (1698 days later) » 

3:41 AM
A: Why does modern Perl avoid UTF-8 by default?

tchrist  🌴 πŸͺ🐫πŸͺ🐫πŸͺΒ πŸŒžΒ π•²π–”Β Β π•Ώπ–π–”π–šΒ Β π–†π–“π–‰Β Β π•―π–”Β Β π•·π–Žπ–π–Šπ–œπ–Žπ–˜π–ŠΒ πŸŒžΒ πŸͺ🐫πŸͺ 🐁 𝓔𝓭𝓲𝓽 :Β  π™Žπ™žπ™’π™₯π™‘π™šπ™¨π™© β„ž:Β  πŸ• π˜Ώπ™žπ™¨π™˜π™§π™šπ™©π™šΒ Β π™π™šπ™˜π™€π™’π™’π™šπ™£π™™π™–π™©π™žπ™€π™£π™¨ Set your PERL_UNICODE envariable to AS. This makes all Perl scripts decode @ARGV as UTF‑8 strings, and sets the encoding of al...

^ someone interested in perl... might want to get coffee and read that
4:32 AM
Is there a list of default prompts by year and distro? I would like to know how long ago it was that the default prompt was just a $?
5:13 AM
as in, no path at all. Not even \W (the last directory)
4 hours later…
9:10 AM
@Braiam why on earth would anyone be interested in Perl?
/me feels like a little gratuitous offensiveness today...
3 hours later…
12:21 PM
I want to grep for a string in a whole bunch of specific files. grep -R "name" * works, but grep -R "name" *.sv doesn't. What am I doing wrong?
1:05 PM
@Stacey The -R is for recursion, when you use it, you tell grep to search through all files in a directory. You only want a subset of files in the current directory, so do grep "name" *.sv
no -R
@terdon I tried that and it didn't work
@Stacey Then you're not explaining your needs correctly. Are the files in the current directory or do you want to find all *.sv files in this and all subdirectories?
grep "ConfigPorts_Intf.sv" *.sv
grep: *.sv: No such file or directory
@Stacey OK, then you have no files who name ends in .sv in that directory. Were you trying to find files in subdirectories?
oh, okay, so it worked if I searched for file that I did have. And if I want to look through the whole tree?
I tried using *.tcl, which I had, and that worked
1:10 PM
If you want to look at subdirectories, you can either do find . -name '*.sv' -exec grep -H name {} +
Or, if you're using bash:
shopt globstar
grep name **/*.sv
If you're using zsh, I think that works out of the box with no need for globstar
ooh, I figured a grep only way
grep -R --include=*.sv "ConfigPorts_Intf.sv"
@Stacey Yes, GNU grep can do that, too.
Make sure you quote the "*.sv" though.
Else it will fail if you have any *.sv files in the current directory.
I didn't so that's why it worked
Yeah, but it's a good habit to get into. It can break in unexpected ways otherwise.
why does it make a difference in this case? I understand for spaces and special characters
1:19 PM
@Stacey Because the shell will expand the glob before it passes it to grep. So, if you have a foo.sv in the current dir, grep will see --include=foo.sv instead of *.sv.
oh, okay
oh, so that's the mechanism by which your globstar example up there works. the shell actually expands the **/*.sv into a list of files and then gives it to grep, is that right?
@Stacey Yup
It's the same with all commands. If you run ls *, the * is never seen by ls. It is expanded by the shell before it's passed to ls.
so if ls * works for me now, why is the shopt globstar command needed?
@Stacey It isn't. That just enables ** to match subdirectories.
                  If set, the pattern ** used in a pathname expansion con‐
                  text will match all files and zero or  more  directories
                  and  subdirectories.  If the pattern is followed by a /,
                  only directories and subdirectories match.
You don't need it if you use the -R --include= approach.
oh ok
so * is expanded by default but I need to turn on **
so that's why grep -R name * works too
it's just expanding what's in the current directory and giving it to grep
I mean grep name *
1:30 PM
@Stacey Yes, but with the -R, that will move into all subdirectories and search through them as well.
wait, so does this happen every time i use a * in console?
well, bash console
like grep add *.xml
which is what I just did
@Stacey Yes, and any shell as far as I know, not only bash
The *.xml was expanded to the list of matching files before being passed to grep.
You can check by running strace. For example:
$ ls
$ strace grep ha * 2> out
The first line of the strace output is:
execve("/bin/grep", ["grep", "ha", "file1.txt"], [/* 38 vars */]) = 0
It has already been expanded to file1.txt when grep is called.
ooh, I'm going to try this
what's the 2> out for?
I know about > and &>
I think that's it
1:35 PM
2> redirects standard error
lol I don't have strace installed
in C, file descriptor 2 is standard error, which is why that number is used
this is so cool
I tried it with my git command and it didn't expand it because I didn't have any xml files in my current dir
It is cool but it often comes and bites you. That's we we tend to be a little obsessive about always quoting stuff here.
what do you mean?
1:44 PM
@Stacey Just that, as I said before, you often get weird results when you don't quote because the pattern is expanded before being passed to the program being run.
I spent years running find -name *foo which sometimes worked and sometimes failed before realizing why I need to quote it.
oh ok
sorry, I misunderstood what you meant by "obsessive about always quoting stuff here".
2:31 PM
@terdon Yeah, I ended up doing that. Thanks!
(xargs I mean)
Turns out there are 9235783497543y6 ways to do that on Linux
@ThatBrazilianGuy You're welcome.
@ThatBrazilianGuy Most things :)
That's why Windows is soooooo much better ;P
2:42 PM
...there's a wiki page for it! O_o
There's more than one way to do it (TMTOWTDI or TIMTOWTDI, pronounced Tim Toady) is a Perl programming motto. The language was designed with this idea in mind, in that it β€œdoesn't try to tell the programmer how to program.” As proponents of this motto argue, this philosophy makes it easy to write concise statements like or the more traditional or even the more verbose: This motto has been very much discussed in the Perl community, and eventually extended to There’s more than one way to do it, but sometimes consistency is not a bad thing either (TIMTOWTDIBSCINABTE, pronounced Tim Toady Bicarbonate...
Yup. Perl idiom :)
3:21 PM
@terdon: It's Perl motto
@cuonglm I know.
@terdon: I mean motto, not idiom :)
Idiom means, among other things, "a language, dialect, or style of speaking peculiar to a people."
A word that is commonly used in a particular context can be called an idiom.
1 hour later…
4:24 PM
Q: Having trouble with basic if then statement

user3470987learning the basics of scripting and I have this line of code: #!/bin/sh if [ $# -ne 1] then echo "Please provide one directory to search" echo "Example usage: something.sh directory_name" exit 1 fi however when I run this I get the error if: Expression Syntax. what exactly am I m...

... did someone really install csh as /bin/sh? If so, we must find the M$ saboteur and expel him... Or at least subject him to tortures like the comfy chair.
@derobert why is a comfy chair torture?
@FaheemMitha (!)
@terdon Beat me to it.
I don't see why I should be expected to be familiar with all of Monty Python's ridiculous skits. Even if I am a Python user.
An object lesson in how to become rich and famous by acting like halfwits.
4:39 PM
@FaheemMitha halfwits? Them's fighting words right there.
They're bleedin' geniuses they are!
@terdon Hmm. Don't see a lot of blood. Maybe once they really got going with the soft cushions and the Comfy Chair.
Here, watch these (really quite interesting) videos of a debate they had over life of brian. They're not in character and you can see their very intelligent and erudite selves shine through:
@terdon Good for them.
He's not the Messiah, he's a very naughty boy.
Riddle: what do Monty Python and Shakespeare have in common?
4:59 PM
Besides being British?
(And men. And in theater. And...)
5:23 PM
@derobert Well, I had something else in mind.
So Tim is asking the hard questions today.
I don't know if that modules loaded question is so much hard as just tedious to find all the places they can be loaded.
@derobert Well he was asking about auto-loading mechanisms. Which includes stuff like hot-plugging.
There's actually a reasonable question there. I don't know exactly how those mechanisms work.
Yep. And also /etc/modules, and initramfs, and...
@derobert True. He should probably restrict it.
/etc/modules and /etc/modprobe.d hardwire stuff, I think.
Hmm, maybe the latter doesn't.
I wonder if Tim has figured out that it is also possible to answer questions.
Has anyone screwed with using a ram disk, but saving / loading the contents of it at unmount / mount time?
5:33 PM
@derobert Does initramfs load modules?
@SelflessPsychopath Not sure exactly what you are asking. Note that normally questions should go to the site.
It feels a bit opinion based, there are many solutions
@SelflessPsychopath What is your use case?
I have a machine with 20GB of ram and an SSD, built with the idea is to configure it like a Live CD and exploit the maximum block read and write speeds.
@FaheemMitha yes, otherwise it'd have a hard time mounting rootfs
@derobert I see. I thought grub was involved in mounting the initial filesystem.
@SelflessPsychopath Configure what exactly? Write your system to the ram disk and then use the ram disk?
5:37 PM
Not really. Grub loads the kernel and initramfs into memory and starts the kernel. Then it's done.
Well you can compile the modules into the kernel, and then I think you could say that grub is loading the driver technically.
@derobert Oh, I remember. It needs to be able to read the kernel. So it needs some filesystem support to do that.
@SelflessPsychopath Technically, if the module file is on the initramfs...
Technically :D
But I guess it isn't involved after that.
5:38 PM
@FaheemMitha Yes exactly, I've started with a debian live cd and tweaked it somewhat
I can't seem to figure out if there is a "right" way to have a physically backed ramdisk
It's looking like I have to write my own driver to get reasonably effective journaling
@SelflessPsychopath I guess that is possible. But it does not seem to be commonly done. For one thing, loading your system in would take a while. And I'm not sure how stable it would be. And it would use a lot of memory.
And you're throwing persistency away. Which people mostly don't want to do.
The last point is probably the most important of these. :-)
I am aware of some massive downfalls to the approach
I imagine loading a filesystem image into memory would be the most efficient thing.
5:40 PM
But the main purpose is a machine that will rarely be powercycled, and almost exclusively used for audio production and internet
@SelflessPsychopath sounds like a reasonable question to me. Try to write it intelligibly and don't make egregious spelling and grammatical mistakes, and you'll be ahead of the pack.
Ok :(
I'll give it a shot if I feel up to it soon
I don't think we've had that sort of question much here before.
Oh, and mention what distribution(s) you're using.
What is socially the best choice around here?
5:42 PM
@SelflessPsychopath ?
Which distro's user will be the most warmly accepted?
@SelflessPsychopath None. All are welcome.
@SelflessPsychopath This isn't 1984.
Use whatever you like.
And do post, this sounds like an interesting question.
But, again, it doesn't hurt to mention it, assuming it is relevant.
I mean, what distribution you are using.
5:44 PM
@SelflessPsychopath I think there is a device-mapper target that does caching. That sounds close to what you want...
6:01 PM
Well dm-cache is an awesome lead, thanks. I'll probably be back tomorrow, I have to motherfucking work right now.
8:57 PM
@SelflessPsychopath please leave the cursing at the door next time... we try to keep this room reasonably business-friendly.
2 hours later…
10:58 PM
@derobert Sorry about that, thanks for letting me know.
@SelflessPsychopath there aren't any official rules about this, as far as I know. Having said that, I'm no fan of expletives myself. Especially the sort of things you hear in gangster movies.
11:28 PM
@FaheemMitha How ironic! Of course, I take great pleasure in precisely that :)
@SelflessPsychopath precisely what?
@FaheemMitha Uttering tasteless expletives in an over-the-top way
@SelflessPsychopath Really? Why?
It's usually exciting and intense
Well, maybe you have a feature in Hollywood cinema. Tarentino could hire you as a scriptwriter.
11:33 PM
... I do like a hollywood type party
Many people, including myself, consider excessive use of expletives as signs of a poor vocabulary / linguistic poverty, poor education, and a certain aggressiveness. Not meaning you personally, of course.
I think I date my dislike to swear words to the nasty Bombay school I went to as a child. Swearing was popular there.
@SelflessPsychopath What is a hollywood type party?
I understand, and I have no aversion to refraining from the use of them.
@SelflessPsychopath That's just my personal preference, and there is no official rule, that I am aware of. That said, you won't make yourself more popular with most of the regulars here.
lol I know the difference between the words allude and allure -_-

« first day (1655 days earlier)      last day (1698 days later) »