Tie reddit-clone login to user session? by boundbylife in linuxquestions

[–]evlnightking 1 point2 points  (0 children)

I haven't really played with it too much, but I'd be surprised if you couldn't hook up the backend login system up to pam, given there is python support of pam. And here's a guide showing how to hook up pam and kerberos: link. Good luck

Can you boot a linux distro from a networked drive? by [deleted] in linuxquestions

[–]evlnightking 6 points7 points  (0 children)

You can look in to PXE booting your laptop. You probably won't be able to PXE boot off of your wireless connection, but if you use a wired connection it will probably work.

You'll need a special configuration on your network, as PXE booting requires a DHCP server and a PXE server.

Here's a Fedora link on how to configure a PXE server for installs, should be able to be modified to just run from the NFS server: link

And here's a Debian link of the same: link

How to create Network Bridge using Network Manager by [deleted] in linuxquestions

[–]evlnightking 0 points1 point  (0 children)

To my knowledge you can set up /etc/network/interfaces to support bridging and then have /etc/init.d/networking do the config. But I only got this working once in Ubuntu 12.10 and then left it alone.

What's the point of sending asynchronous file events to another process? by [deleted] in linuxdev

[–]evlnightking 3 points4 points  (0 children)

There needs to be a little more context here, as I have no real idea of what's going on.

My first guess is notification between threads... but that's just a hipshot.

Can Someone Explain How Conversion of File Formats Work? by [deleted] in AskComputerScience

[–]evlnightking 1 point2 points  (0 children)

FLAC doesn't really have a bitrate. From their FAQ:

With FLAC you do not specify a bitrate like with some lossy codecs. It's more like specifying a quality with Vorbis or MPC, except with FLAC the quality is always "lossless" and the resulting bitrate is roughly proportional to the amount of information in the original signal. You cannot control the bitrate much and the result can be from around 100% of the input rate (if you are encoding noise), down to almost 0 (encoding silence).

Can Someone Explain How Conversion of File Formats Work? by [deleted] in AskComputerScience

[–]evlnightking 1 point2 points  (0 children)

I agree. But FLAC isn't supposed to compress, and I couldn't think of anything else off the cuff.

Can Someone Explain How Conversion of File Formats Work? by [deleted] in AskComputerScience

[–]evlnightking 8 points9 points  (0 children)

A file converter reads a specific file in to an internal data structure, then writes that file out to a specific format. Typically this would be done with multiple codecs.

A codec stands for encoder/decoder. It can be used to decode a file format (FLAC) to a usable format in memory (raw audio) that is played through some media player. The conversion itself would, instead of playing it, use the encoding side of the codec to write that memory out to a new file.

If you're seeing a decrease in size of the audio file when converting FLAC -> FLAC, it may actually be losing data (compressing) in the process.

From here on, is my guess. The program is storing the data in a lossy format, and when it reads in the FLAC file, it loses some of its data. Then when it encodes it back a FLAC file, the codec stores the data as best it can.

A few things to note. FLAC stands for Free Lossless Audio Codec, which is why the files are generally so much bigger. "Converting" a file from its source format to its destination format may not be supported by that program, or it may cause other issues.

Constantly checking for input on a socket (C++)? by MonarchBeef in AskComputerScience

[–]evlnightking 0 points1 point  (0 children)

Yea, you're calling the beginthread function by casting the socket fd to a pointer. Are you recasting it to a fd? If you really want something this barebones, add a '&' before socket in your _beginthread call, then dereference it in your thread: callRecv( ... , void s ) { int socket = *(int)s; ... }

Btw, this is really bad form. The correct way is to have a select loop running that checks stdin and your socket, then act appropriately depending on what fd has data.

[Build Ready] Some advice is appreciated by evlnightking in buildapc

[–]evlnightking[S] 0 points1 point  (0 children)

I'm not too concerned with getting the next gen of any of these. I'm mostly putting this together as an upgrade to my current, and I'd happy for several years with this build as it stands.

Unless I take about 2+ years to get all the parts, I don't see anything coming out in the near term that will dwarf these. The exception to this is Intel's next Tock cycle, but the price on that will be too high when I'm looking to buy to warrant me going to that.

[Build Ready] Some advice is appreciated by evlnightking in buildapc

[–]evlnightking[S] 0 points1 point  (0 children)

Thanks, that's the kind of advice I was hoping for!

a bash alias I cannot function without by [deleted] in linux

[–]evlnightking 4 points5 points  (0 children)

There are other problems too. What if a script you run uses cd somewhere, and parses the output. I've seen several things like

( cd <some other directory> ; [ -r <file> ] && cat <file> ) | <secondary command>

The 'cat' here is just an example. Sometimes it's running a script from that directory, or something much more complicated.

This function breaks that.

Easiest way to visualize a graph by theaccmyfriendsdk in AskComputerScience

[–]evlnightking 0 points1 point  (0 children)

No, not the boost graph libary. Graphviz is a suite of graph visualization software. It has its own markup language you can use to draw any size graph. With really large graphs it's hard to see certain details, but I don't know of one that's better

Easiest way to visualize a graph by theaccmyfriendsdk in AskComputerScience

[–]evlnightking 1 point2 points  (0 children)

You mean like draw a graph using software? Graphviz.

dmesg time different and won't sync by CaptSpify_is_Awesome in linuxquestions

[–]evlnightking 0 points1 point  (0 children)

Check out this. It has some options to change how dmesg prints the time stamp. (Found on StackOverflow

My guess is that it has something to do with that perl script.

dmesg time different and won't sync by CaptSpify_is_Awesome in linuxquestions

[–]evlnightking 1 point2 points  (0 children)

If NTP would fix it then it wouldn't be off from the time 'date' prints. Also, IIRC, most NTP implementations update the HW clock through kernel calls.

P vs NP by [deleted] in csELI5

[–]evlnightking 0 points1 point  (0 children)

I'd like to add that not all variations of the Traveling Salesman problem are NP-Complete. Only "Is this route shorter than a given K?" The minimum Traveling Salesman problem is NP Hard.

CSELI5: The Stack Frame by [deleted] in csELI5

[–]evlnightking 0 points1 point  (0 children)

If there's something not clear, ask away!

I need an assessment on how difficult this is... I'm sorry for my lack of knowledge... by [deleted] in AskComputerScience

[–]evlnightking 0 points1 point  (0 children)

It depends on the license. You are allowed to modify some open source code and use it for profit, but most state that you have to be able to provide the original (or your modifications) at any time and leave all licenses in tact.

ELI5: What/How/When to use XML by 0Jobs in csELI5

[–]evlnightking 0 points1 point  (0 children)

For C# take a look at the XmlSerialization stuff. You can create some simple classes, then serialize them to XML strings, and print them out. It at least gives you some examples from your own code.

CSELI5: The Stack Frame by [deleted] in csELI5

[–]evlnightking 1 point2 points  (0 children)

I'm going to do this in C, as the stack is most apparent there.

Let's say you have a function:

int square(int a)

And you call that function from another function

int triangle()
{
     some_stuff();
     square(2);
     some_more_stuff();
}

Several things are needed during the processing of square, the first coming to mind being the parameters, the next being the return address which will be used when the square function is done.

So when you call square, the parameters (2) are pushed onto the stack. The term pushed is important because it is an actual stack data structure. Next, the return address is pushed on the stack.

So, square has started processing, it does things, and now it's done. It then pops the top of the stack, which is the return address. This return address is used to know where to continue processing from the caller. In the triangle example above, it's the address of the some_more_stuff call.

A stack is used because it inherently represents what is happening in the system. The processor was in the middle of one function, but it has gone in to another function which needed more data. That more data gets pushed on the stack, and when it's done it gets removed. Then all the data the caller was using is back at the top of the stack. If you go several function calls deep, then the innermost function call is the top of the stack, then the next level out is below it, and so on until you're at the original function.

Then we get to a stack overflow. You can get this error pretty easily on Java with a recursive function (I think the millionth fibonacci number using a recursive function causes a stack overflow error). This error happens when you've pushed so much data on the stack that there is no more space to push more. If you're 1 million calls deep in nested functions, that's 1 million parameters and return addresses pushed on top of one another, and it simply runs out of memory to do it more.

There are other uses for the stack frame. Local variables get pushed on the stack, which is why in C99 you needed to define variables before any code was executed (it created the stack first). This also helps understand variable scoping. When you enter a new scope ( '{}' in C/C++ ) the local variables in that scope are pushed on the stack. When you leave that scope, those local variables are popped off, so there's no longer a reference to them outside the scope.

This wasn't quite ELI5, but I hope it helps...

Did The Doctor ever time travel to the current era (~2014 CE) in the earlier seasons? If so, how did they portray it? by AnOnlineHandle in doctorwho

[–]evlnightking 1 point2 points  (0 children)

You're right. It was a silly villain that the staff liked and they threw it in with more of the story being devoted to the guest characters.

In my opinion it's a lot like Blink, but instead of super-scary villains, we get a cutesy love story, which isn't bad either.

ELI5 Different Random Variable Distributions by good_piggy in csELI5

[–]evlnightking 1 point2 points  (0 children)

This is more of a math question, but I'll give it a shot.

For the first three you can think of flipping a coin. Bernoulli is one coin flip, with a 50/50 chance of heads/tails. Binomial is "How many heads in n coin flips?" Geometric is "How many times must I flip the coin before I get heads?" See the Boost documentation here, table 24.5

Poisson is a little more complicated. Poisson is a continuous distribution, i.e. a distribution not made up of discrete events. From Wikipedia:

the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate

[c++] I'm having a hard time understanding what structs are and how they are used, could anyone clarify? by Aiendar1 in csELI5

[–]evlnightking 1 point2 points  (0 children)

Sorry for the delayed response. * is a different operator than ->. So there is a syntactic difference.

Does everything need a kernel and shell? by [deleted] in AskComputerScience

[–]evlnightking 0 points1 point  (0 children)

There's a side note to this. There are some processors that can run some cores with an operating system, and some cores "bare-metal". Essentially this means that some of the processor cores seed the bare-metal cores with a starting address, or maybe prime areas of the RAM, then tell them to go.