Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
JawnV6
Jul 4, 2004

So hot ...

yaoi prophet posted:

Why are we talking about this anyway? We don't even know how accurate Sylink needs the count to be.

He said "billions of times a second." That puts you on the ns scale.

JawnV6 fucked around with this message at 16:54 on Nov 1, 2012

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

JawnV6 posted:

He said "billions of times a second." That means puts you on the ns scale.

I think he was assuming that if they didn't put in a timer and just ran everything as fast as possible they'd run it billions of times a second (which they obviously won't unless they have some kind of terahertz processor).

False Toaster
Dec 29, 2006

Stupidity, its both physically and mentally painful.
Not seeing anything for PHP in the sub so I guess I'd toss it here. Trying to sample a database to show text A, B, and C. We can't set it up to pull the dada correctly in order to show the proper text, in correspondence to the grabbed data. I know nothing about PHP. Hoping someone could point me in the right direction?

code:


{php}
$jinuser =& JFactory::getUser();
if($jinuser->id != 0)
{
$jindb =& JFactory::getDBO();
$jinquery = 'SELECT * FROM #__comprofiler where user_id='.$jinuser->id.' ';
$jindb->setQuery( $jinquery );
$jinrows = $jindb->loadObjectList();
if($jinrows[0]->cb_corporateshipstatus!="A")
{
echo "<strong><a href=index.php?option=com_content&view=article&id=228>";
    echo "Type A Texts";
}
  elseif($jinrows[0]->cb_corporateshipstatus="B")
  {
  echo "<strong><a href=index.php?option=com_content&view=article&id=226>";
      echo "Type B Texts";
}
  elseif($jinrows[0]->cb_corporateshipstatus!="C")
{
  echo "<strong><a href=index.php?option=com_content&view=article&id=227>";
      echo "Type C Texts";
}
}
{/php}

<table _mce_new="1" style="width: 98%;" border="0" align="center">
<tbody>
<tr>
<td>{rsform 32}</td>
</tr>
<tr>
<td style="text-align: right;"><span style="font-size: 8pt;">RS032_225</span></td>
</tr>
</tbody>
</table>
</a></strong></strong></strong></p>
<p><strong><strong><strong><a href="index.php?option=com_content&view=article&id=227"> </a></strong></strong></strong></p>
<p> </p>

ToxicFrog
Apr 26, 2008


Ryvannis posted:

Not seeing anything for PHP in the sub so I guess I'd toss it here.

The FAQ has a link to the PHP megathread.

False Toaster
Dec 29, 2006

Stupidity, its both physically and mentally painful.

ToxicFrog posted:

The FAQ has a link to the PHP megathread.

Thanks. Should have looked a little more. :shobon:

JawnV6
Jul 4, 2004

So hot ...

yaoi prophet posted:

I think he was assuming that if they didn't put in a timer and just ran everything as fast as possible they'd run it billions of times a second (which they obviously won't unless they have some kind of terahertz processor).

:confused: Do programmers really lack this kind of intuition? What the heck do they think a gigahertz is? Or is the confusion on IPC? The units are right there in the question.

On the last page you clearly have the kind of intuition I'm talking about and know that billions/sec implies a limit of a few instructions. I guess I thought that was more common.

Nippashish
Nov 2, 2005

Let me see you dance!

JawnV6 posted:

:confused: Do programmers really lack this kind of intuition? What the heck do they think a gigahertz is? Or is the confusion on IPC? The units are right there in the question.

On the last page you clearly have the kind of intuition I'm talking about and know that billions/sec implies a limit of a few instructions. I guess I thought that was more common.

To me he sounds like a noob who just wants a way to limit the iterations/second in his while loop and didn't think too hard about the billions/second figure. He's probably been thoroughly scared off at this point.

nielsm
Jun 1, 2009



To get back to the original question...

Sylink posted:

This is a weird question so I hope I can phrase it right. Ideally this would be in Python.

I want to mess around with making a simulation. I want this simulation to be able to run and provide feedback in real time (or according to some time multiplier of my choosing).

So say I want to model a tree's height and I have a program that calculates the trees height based on the growth rate.

How do I add a tick rate into a program? I know game libraries often include these to limit the framerate and that is essentially what I need for command line output or something similar. This is because I imagine trying to calculate the time billions of times a second will add in all kinds of crazy errors.

So say I wanted my program my loop to at most calculate something 100 times a second. What is the ideal way to do this ?

I'm working with Python but a pseudo code/concept answer is probably what I need.

Assuming your target simulation speed isn't actually thousands or millions of iterations a second (it's pretty unlikely you could actually achieve that anyway) a pretty simple way is to take the time at the start of each frame/simulation step, take the time when you're done with the calculations, and if there is time left over from your allotted time per frame, call a sleep function for the approximate time left.
That will accumulate some error over time, meaning your average frame rate will certainly be somewhat above or below the target (depending on how you pick the intervals to sleep). You can do better by keeping a history of recent frame start times and compare the total real time elapsed to the expected real time elapsed for that sequence of frames, and if it's off by more than some margin, sleep more or less.

For up to about 50-100 frames a second you can probably do with millisecond precision, if you want to target higher framerates you should use a function that gets you microsecond or nanosecond precision. Make sure you also have a sleep function available that lets you sleep with the required precision.

Zhentar
Sep 28, 2003

Brilliant Master Genius

JawnV6 posted:

:confused: Do programmers really lack this kind of intuition?

"I'm getting an 'Out Of Memory' error, does that mean I need to upgrade my RAM? I thought I already had plenty!". The considerable majority of programmers, even among the good ones, have very little understanding of the systems behind making their high level language code work.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
That could actually be a solution to the problem though :P

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Hard NOP Life posted:

That could actually be a solution to the problem though :P

If you're building a desktop application on anything, that isn't a decade old shitbox, no, it isn't.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Jabor posted:

that isn't a decade old shitbox, no, it isn't.

Virtual memory was added to Windows 3.0, in 1990, so you get a fair bit more than just one decade.

edit: giving him the benefit of the doubt, adding more physical RAM is one way to increase the total amount of virtual memory that can be mapped, but if that's your problem, you get the OS nuking your process, not an "Out Of Memory" error.

Zhentar fucked around with this message at 23:37 on Nov 2, 2012

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Zhentar posted:

Virtual memory was added to Windows 3.0, in 1990, so you get a fair bit more than just one decade.
A decade ago you could still run out of virtual memory before running out of address space, though.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
Maybe this is more of a math and sciences question than a programming one, but I'll ask here first.

I have a mostly gray scale image with certain regions of interest highlighted in different RGB colors (like this). I don't know what the colors will be ahead of time and there will be gradients involved, they won't just change from one color to the next smoothly. I'm trying to create an image mask for each of the major color bands. The goal is that, when the mask is overlayed on the image, only the region with in specific color band will be shown.

My idea is to represent the image as a 3 dimensional array, with the first two dimensions being the coordinates and the third being the RGB values. Then to run a PCA over the array. My thinking is that this should help me identify the major color bands in the image.

Is this the correct assumption? If not, what is a better approach?

Secondly, is there any good libraries to do this? I've been working in Python; I would like to continue to do so, but if there isn't a library to do this, then I am willing to using something else. The libraries I've tried so far are MDP and pca_module, both of which are recommendations from Stack Exchange. But both libraries only support PCA on two dimensional data.

Edit: I think I may just be misunderstanding how to format the data for PCA. I guess I could put red values in the first row, green in the second, and blue on the third. Is this correct?

oRenj9 fucked around with this message at 01:51 on Nov 3, 2012

Nippashish
Nov 2, 2005

Let me see you dance!

oRenj9 posted:

Secondly, is there any good libraries to do this? I've been working in Python; I would like to continue to do so, but if there isn't a library to do this, then I am willing to using something else. The libraries I've tried so far are MDP and pca_module, both of which are recommendations from Stack Exchange. But both libraries only support PCA on two dimensional data.

PCA on 2d matrices is an SVD, so numpy can do that for you.

The reason you're not finding anything on PCA for higher rank tensors is that it goes by a different name. It's also a very complicated topic. "Tensor Decompositions and Applications" by Kolda and Bader is a reasonable thing to read for an overview. Finding implementations of these algorithms is not easy (but iirc it's not too hard to roll your own as long as you have access to an SVD, which you do if you're working in python). Even so, the situation is still tricky because none of the PCA-like decompositions are unique for high rank tensors.

I think overall you'll have better luck with something like thresholding a pixel's distance from greyscale.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
This is less a programming question and more of a question about how to manage programming.

I'm the senior developer in my group and up until now we've been 9 people, most of whom are project managers or "technologists" (folks with a grasp of new tech but not necessarily developers.) We're getting a lot more work now and as such we're bringing on new developers. Previously, development practices have been done cowboy coding style.

My question is, what are the best way to begin implementing development best practices in this environment?

I've already started the push towards implementing a system of shared git repos rather than individual ones and a local->staging->production development and deployment cycle, but my biggest concern is that some of the "technologists" have enough experience writing code that they're a danger to the process, especially since they're more senior than I am. Has anyone run into this before? Does anyone have any suggestions for handling this issue from a development and an organizational perspective?

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost

Zhentar posted:

"I'm getting an 'Out Of Memory' error, does that mean I need to upgrade my RAM? I thought I already had plenty!". The considerable majority of programmers, even among the good ones, have very little understanding of the systems behind making their high level language code work.
I've been having to tell senior software engineers with 12+ years of experience in Java about why running out of PermGen doesn't mean that there's something wrong with your memory mappings under VMware. But these types of folks also tend to have deficiencies somewhere in their general professional knowledge area because they do not have the instinct to look beyond their own domain. The best will not be comfortable knowing just their own piece, ever.

Blinkz0rz posted:

My question is, what are the best way to begin implementing development best practices in this environment?
Kinda tough if you're doing it on your own more or less, but you'll need to be able to demonstrate one or more of the following with various "best practices":

1. superior performance / output (profilers caught that we were spending 30% of our time writing log files)
2. successful risk management (this test caught x, y, z before it went into production, knowing the build broke identified Bob breaks builds literally every commit)
3. easier manageability (one command to build something, stamp a release, and know it'll work = immense power and a sigh of relief for managers)

You can't really implement change without the right culture for accepting it though. You don't want to be the dude at RIAA insisting that they have to work with digital media.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





OK so I made a temporary commit on a local branch about a week ago, since then I've been pulling changes in from the remote branch. I now want to rebase this change at the top of the current git history instead of being where it was committed and constantly being "merged" back into the remote branch. How do I do this?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Have you tried git checkout topic-branch; git rebase master?

raminasi
Jan 25, 2005

a last drink with no ice

Strong Sauce posted:

OK so I made a temporary commit on a local branch about a week ago, since then I've been pulling changes in from the remote branch. I now want to rebase this change at the top of the current git history instead of being where it was committed and constantly being "merged" back into the remote branch. How do I do this?

They can probably help you over in the version control megathread.

Physical
Sep 26, 2007

by T. Finninho

Zhentar posted:

"I'm getting an 'Out Of Memory' error, does that mean I need to upgrade my RAM? I thought I already had plenty!". The considerable majority of programmers, even among the good ones, have very little understanding of the systems behind making their high level language code work.
Not the programmers I've seen. It is actually counter intuitive, unless you are talking about programmers just starting out. "Oh I just infinite looped my RAM to death in a couple cycles" is a rookie mistake that all of us make.

nielsm posted:

To get back to the original question...


Assuming your target simulation speed isn't actually thousands or millions of iterations a second (it's pretty unlikely you could actually achieve that anyway) a pretty simple way is to take the time at the start of each frame/simulation step, take the time when you're done with the calculations, and if there is time left over from your allotted time per frame, call a sleep function for the approximate time left.
That will accumulate some error over time, meaning your average frame rate will certainly be somewhat above or below the target (depending on how you pick the intervals to sleep). You can do better by keeping a history of recent frame start times and compare the total real time elapsed to the expected real time elapsed for that sequence of frames, and if it's off by more than some margin, sleep more or less.

For up to about 50-100 frames a second you can probably do with millisecond precision, if you want to target higher framerates you should use a function that gets you microsecond or nanosecond precision. Make sure you also have a sleep function available that lets you sleep with the required precision.
Any game engine does this. To do it on your own, do a while(true) loop and check the time between last frame, and if it is too soon then sleep. XNA, AS3, JS HTML5 canvas etc have systems already built in.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Are there any free WMS (Web Map Service) client libraries in C or similar? I've tried looking around, but it seems everybody is rolling their own partial implementations as far as I can tell.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

MySQL database: I need to do a REPLACE on a string column like so:

code:
UPDATE PATH SET strPath = REPLACE(strPath, 'smb://PathA', 'smb://PathB');
The problem is that out of thousands of records I've got just a handful that will, if I do that replacement, end up with duplicating strPath for another record. I do not want that. I need to go in and do some manual labor on those records, but first I need to find them.

I need a SELECT that for each record shows me if the column strPath matches any other records if I did a REPLACE on it. Anyone?

Strong Sauce
Jul 2, 2003

You know I am not really your father.





GrumpyDoctor posted:

They can probably help you over in the version control megathread.

Didn't know this existed. Thanks! I'll keep this in mind in the future

epswing
Nov 4, 2003

Soiled Meat

Thermopyle posted:

I need a SELECT that for each record shows me if the column strPath matches any other records if I did a REPLACE on it. Anyone?

You could create a new column strPath2, run
code:
UPDATE PATH SET strPath2 = REPLACE(strPath, 'smb://PathA', 'smb://PathB');
and then examine strPath2 for duplicates.

Edit: I guess you don't even need the new column. Something like
code:
SELECT REPLACE(strPath, 'smb://PathA', 'smb://PathB') as newStrPath,
       count(*) as occurrences
GROUP BY newStrPath
might do it.

epswing fucked around with this message at 01:00 on Nov 7, 2012

a cat
Aug 8, 2003

meow.
I needed to install a mail server for a site I'm making where each user gets their own email address. I followed this guide:

http://flurdy.com/docs/postfix/

and it basically got it working after a lot of pain. My question is why is it such a huge bitch to setup a mail server? Is there some sort of alternative that doesn't take like 2 hours+. I really just need a way for people to receive mail. Is there any sort of cloud thing that takes care of just this for cheap (ie nowhere near google apps prices)?

Edit: I don't need the web interface stuff

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

jjttjj posted:

I needed to install a mail server for a site I'm making where each user gets their own email address. I followed this guide:

http://flurdy.com/docs/postfix/

and it basically got it working after a lot of pain. My question is why is it such a huge bitch to setup a mail server? Is there some sort of alternative that doesn't take like 2 hours+. I really just need a way for people to receive mail. Is there any sort of cloud thing that takes care of just this for cheap (ie nowhere near google apps prices)?

Edit: I don't need the web interface stuff

1) That's not a programming question
2) iRedMail is a nice little package that handles configuration of Dovecot, Postfix, etc. Or if you have the hardware resources, Zimbra is cool too.

a cat
Aug 8, 2003

meow.

i barely GNU her! posted:

1) That's not a programming question
2) iRedMail is a nice little package that handles configuration of Dovecot, Postfix, etc. Or if you have the hardware resources, Zimbra is cool too.

Yeah I knew this was slightly out of place and somehow stupidly forgot that SHSC existed. Thanks though, iRedMail looks like it might be exactly what I need.

raminasi
Jan 25, 2005

a last drink with no ice
I have a general question about unit testing. I've basically had to self-teach myself testing methodology, and the little bits of it that I've implemented so far have been absolutely fantastic for my productivity and the success of this project, but I have concerns about a number of functions I need to test that effectively transform collections of complex objects into other collections of other complex objects.

I've got two separate problems which are manifesting here. The first is that I have had a tendency to write complex classes with the bare minimum interface needed for the class to do its job, but "its job" doesn't include being tested, so I'll have classes that can only be constructed in the aggregate by a class factory function. Testing these is, as far as I can tell, essentially impossible without changing the interface, because I can't separate the factory function that creates the aggregate from the function I'm trying to test that actually operates on the aggregate. From what I've gleaned, this just means my design is bad and I need to give my classes simple constructors that are useful to a unit test. This is actually fine with me, but I want to confirm that I'm on the right track.

The second problem I'm having is figuring out how to check that a returned collection is correct. Straight-up comparing the collections with equality or something doesn't work because the objects don't have an ordering. Is there a non-awkward way to do this kind of thing or is it just "check the size and then search the collection for an element you're not expecting and just kind of figure it out?" It's not even really a technical question I have - it's more "What's the best mental model for this check and what's the best way to express this in my test code so that when there's a problem (an extra element, a missing element, a wrong element) it's clear to me what it is?"

I hope this was clear-ish. The project is in C++ using google test but I think the questions are general.

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe
Learner here: What is the point of interfaces? [C#]. I understand how they work, just now why you would use them. Since you have to implement them manually, doesn't that sort of defeat the purpose of inheritance? Or is it basically just a sort of check/restraint that ensures your class implements certain members?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

DarthJeebus posted:

Or is it basically just a sort of check/restraint that ensures your class implements certain members?
That's the whole point of having a type system.

The problem with inheritance is that it also forces you to inherit the members of the parent class when your new object might not fit into the model (In Java and C# at least, not sure if other languages let you pick and choose what you inherit).

Interfaces offer more flexibility in that regard but as you brought up sometimes the functionality you want is already provided by another class and you don't want to duplicate the code. In those cases you can use a delegate.

Between the two options no one is better than the other. They each have their uses and you need to learn when to apply one vs the other. You can even combine them for the best of both worlds using a Skeletal Implementation :2bong:.

As an aside, schools do a poor job of teaching that distinction and inheritance is badly over used. Starcraft had problems because they overused inheritance.

Doctor w-rw-rw-
Jun 24, 2008

DarthJeebus posted:

Learner here: What is the point of interfaces? [C#]. I understand how they work, just now why you would use them. Since you have to implement them manually, doesn't that sort of defeat the purpose of inheritance? Or is it basically just a sort of check/restraint that ensures your class implements certain members?

:stare: Inheritance isn't the end result of good code reuse, at least not by itself.

Interfaces are basically an assurance that a subset (or all) of your class's implementation supports certain operations. You probably know this, but I repeat it to contrast it to inheritance, which ensures you must support all operations, even if only a couple are relevant. Additionally, interfaces lend themselves better to composition, where you have modular bits and pieces of functionality rather than having to dig yourself deeper in your inheritance tree when it might sometimes be the case that you need only a couple of things offered by your superclasses.

Put another way, classes are implementations fused to a single interface, and subclasses tweak that implementation. The end result of tweaking or extending classes for different behaviors is typically a tree hierarchy. Interfaces, on the other hand, lend themselves to a fairly flat class structure, because really, you don't care about the ancestry of some functionality, merely that it will conform to the things you want to ask it to do. Code reuse - in this case, sharing code between other implementations of the interface - can be accomplished through composition, which is, broadly speaking, the practice of holding an object that does some of your work for you, and using that to accomplish some desired behavior.

(this is basically what Hard NOP Life said only colored by my own biases and opinions)

Doctor w-rw-rw- fucked around with this message at 22:35 on Nov 8, 2012

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe
Thanks to both of you, I better understand the whole concept behind them now.

epswing
Nov 4, 2003

Soiled Meat

DarthJeebus posted:

Learner here: What is the point of interfaces? [C#]. I understand how they work, just now why you would use them. Since you have to implement them manually, doesn't that sort of defeat the purpose of inheritance? Or is it basically just a sort of check/restraint that ensures your class implements certain members?

Say we have this program to create bottles of liquid, and people to drink them:

code:
class Program
{
    static void Main(string[] args)
    {
        WaterBottle water = new WaterBottle();
        CokeBottle coke = new CokeBottle();

        Console.WriteLine(string.Format("Volume in water bottle: {0}", water.Volume)); // 750
        Console.WriteLine(string.Format("Volume in coke bottle: {0}", coke.Volume));   // 355

        Person me = new Person();
        Person you = new Person();

        me.Drink(water);
        you.Drink(coke);

        Console.WriteLine(string.Format("Volume in water bottle: {0}", water.Volume)); // 710
        Console.WriteLine(string.Format("Volume in coke bottle: {0}", coke.Volume));   // 315

        Console.ReadLine();
    }
}
Here are a few solutions.

Interfaces. Both CokeBottle and WaterBottle implement the IGulpable interface, so we can pass either one to the Person.Drink method because it accepts any class which implements the IGulpable interface.

Inheritance. Both CokeBottle and WaterBottle subclass the Bottle class (which is abstract and meant to be subclassed). We can still pass either one to the Person.Drink method because it accepts any class which "is a" Bottle.

Interfaces AND Inheritance. Both CokeBottle and WaterBottle implement the IGulpable interface AND subclass the Bottle class. The idea here is, solve the problem with interfaces and then notice that both CokeBottle and WaterBottle have things in common that we can push up to a superclass. We can pass both to the Person.Drink method because it accepts any class which implements the IGulpable interface, and each of them do via their Bottle superclass.

No Interfaces, no Inheritance. This probably seems like the simplest way to do it, and the above solutions seem needlessly complicated. You're not wrong, given this small example. Look at the Person class though, notice that I now need two methods, Person.DrinkWater which only accepts WaterBottles, and Person.DrinkCoke which only accepts CokeBottles. Now what if you had PepsiBottle, GingerAleBottle, RootBeerBottle, SevenUpBottle? You'd have to add 4 more methods (DrinkPepsi, DrinkGinglerAle, ...) to Person that all look distubringly similar (they're all going to do beverage.Gulp()).

Kibbles n Shits
Apr 8, 2006

burgerpug.png


Fun Shoe

epalm posted:

Good examples

Thanks for that, it's starting to make a lot more sense now. I wish they had touched on this more in class, but we only got the basics.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It's also unfortunate. I wish you could add method bodies directly on to interfaces:

code:
public interface IGulpable {
    public decimal Volume { get; set; }

    public void Gulp()
    {
        Volume = Volume - 40;
    }
}
The idea here is that you can define a sane base method that would take any IGulpable, so you wouldn't need to reimplement the same method in a base class, or in each class individually. You can already do this using extension methods on interfaces; I just wish there was a sugar for it directly on the interface itself.

raminasi
Jan 25, 2005

a last drink with no ice
Do you really run into a lot of situations like that where abstract classes won't do the job?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It's happened to me before.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
So, I just finished writing a "file system" as part of my Operating Systems class. This was actually the funnest project I've had in school. I enjoyed working with the bits and bytes so much that I completed it in two days, rather than the allotted two weeks.

It was really trivial; our disk was a 64k file split into 1kb blocks, with the first five blocks being allocated for overhead and the last 59 for data. We then had to write versions of ls, cat, cp, mv and rm.

Anyway, it has inspired me to move onto something more ambitious, but I'm not sure where to go next. Should I continue with the file-as-a-file-system approach? I'm leaning towards it because I don't want to get caught up writing drivers. After I have the basic crud options done, what should I implement?

Some ideas:
FUSE
Permissions (this seems difficult/impossible in the context of FUSE)
Searching/indexing files
History/logging of operations
Memory buffering

My ultimate goal is to learn a lot and have something that is potentially usable, even if it is little more than a novelty.

Adbot
ADBOT LOVES YOU

1337JiveTurkey
Feb 17, 2005

Deduplication: Basically the idea is that you index blocks by their cryptographic hashes. If a block already exists with the same hash, the chances that it's different than the data you want to write is incomprehensibly small. The Venti archival filesystem also stores the filesystem structure as a tree of these hashes and every change to a directory updates the tree above it all the way to the root. You can then keep different versions of the filesystem at any point in time by just using the right hash for the root.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply