--- Log opened Tue Apr 28 00:00:44 2009 |
01:04 | | You're now known as TheWatcher[T-2] |
01:06 | | You're now known as TheWatcher[zZzZ] |
01:49 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?] |
01:56 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
01:57 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
01:57 | | mode/#code [+o Attilla] by ChanServ |
02:10 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
02:10 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
02:11 | | mode/#code [+o Attilla] by ChanServ |
02:19 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
02:19 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
02:20 | | mode/#code [+o Attilla] by ChanServ |
02:22 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
03:00 | <@Derakon> | "Only in Fred Code could one find such monstrosities as a function with an 86-character name and 57 characters of C code within the function. Which, as it happened, led to a rather strange bug caused by two such functions with similar names and the compiler's 32-character length limit for function names." --The Daily WTF |
03:01 | <@Consul> | You know, even at my most novice, I have never done the vast majority of the stupid things I see on TDWTF. |
03:02 | <@Derakon> | That is much of why they are WTFs. There's a clear difference between a newbie mistake and mass stupidity. |
03:02 | <@Consul> | Then again, I'm not arrogant enough to call myself a good enough coder to attempt what really needs to be done in many of those stories. |
03:03 | <@Consul> | Still, I know not to run one database query per record as a page listing the output displays. |
03:03 | <@Derakon> | Heh. |
03:04 | <@Consul> | And I can't help but think that BLOBs, useful as they may be, are a disaster waiting to happen in the wrong hands. |
03:04 | <@Derakon> | A lot of TDWTF articles consist of coders who don't understand how to code and don't want to understand how to code. |
03:04 | <@McMartin> | I stopped reading DWTF when half of them were not merely not WTFs but actually correct |
03:04 | <@McMartin> | Derakon's comment also applies to the commenters. -_- |
03:04 | <@Derakon> | Oh, the comments are shit. |
03:04 | <@Derakon> | Don't read them, ever. |
03:04 | <@Consul> | I found their forums to be useless, personally. |
03:05 | <@Consul> | DaniWEB's forums are better. |
03:05 | <@Derakon> | Mind, for a while there was a hilarious troll posting comments. The number of people he managed to string along was quite impressive. |
03:05 | <@Consul> | McMartin: There was a recent supposed WTF where an error message came up saying that "precision has been lost, and accuracy may follow." |
03:06 | <@Consul> | The guy, supposedly an engineer, didn't appear to know the difference between accuracy and precision. |
03:06 | <@Consul> | That kinda scared me. |
03:06 | <@Consul> | My chem professor spent two weeks drilling that one into me. |
03:09 | <@Consul> | Blargh. |
03:10 | <@Consul> | Little in my music collection I want to hear. Brubeck it is, I guess. |
03:11 | <@Derakon> | Hit up Pandora. |
03:12 | <@Consul> | My connection is kinda hit-and-miss with streaming. AT&T is toying with bandwidth caps, too. |
03:36 | <@ToxicFrog> | ..."invalid capture index" my ass |
03:38 | <@ToxicFrog> | Oh wait, looking at the wrong line ?? |
04:11 | | Reiv [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #Code |
05:10 | | Chi [~omegaboot@Nightstar-5734.dsl.emhril.sbcglobal.net] has joined #code |
05:10 | | Alek [~omegaboot@Nightstar-5734.dsl.emhril.sbcglobal.net] has quit [Ping Timeout] |
05:21 | | Bob_Work [c6b3e33a@Nightstar-14595.mibbit.com] has joined #code |
05:22 | < Bob_Work> | One of my fellow C++ students to the instructor today: "Can you give us any real world examples for actually using C, or C++?" |
05:23 | < Bob_Work> | Instructor: "Um....ahh...hmmm.....Not right now." |
05:23 | <@ToxicFrog> | ... |
05:23 | | * Derakon facepalms. |
05:23 | <@Derakon> | Way to reinforce the stereotype that teachers don't have real-world experience there. |
05:23 | | * Bob_Work nods. |
05:23 | <@ToxicFrog> | The trivial one is "systems programming" - kernels, drivers, embedded firmware, etc. |
05:23 | <@Derakon> | You forgot videogames. |
05:24 | <@Derakon> | Almost all blockbuster games are made in C/C++. |
05:24 | < Bob_Work> | I proceeded to explain firmware for things such as video cards, sound card, anything that might be needing direct memory access |
05:24 | <@ToxicFrog> | Slightly-less-trivial-but-still-not-hard is "performance critical inner code" - video game engines, physics engines, and whatnot. |
05:24 | < Bob_Work> | And then proceeded to explain that the reason you can get linux to boot in under 20 seconds is because of C and c++. |
05:24 | <@ToxicFrog> | The fact that the prof can't come up with even one of those is pretty ;.; |
05:25 | < Bob_Work> | Ah, also excellent examples. |
05:25 | | * Bob_Work nods. |
05:25 | < Bob_Work> | It also got worse. |
05:25 | <@ToxicFrog> | Ooo, also language implementation. |
05:25 | < Bob_Work> | He spent the next hour and a half going through C# in Visual Studios to show us how cool it is. |
05:25 | <@ToxicFrog> | C is tasty for that because it's fast and it's portable (cf Lua, Python) |
05:28 | < Bob_Work> | So video games are really done mostly in C or C++? I actually didn't know that. |
05:28 | <@Derakon> | The blockbusters, yeah. |
05:28 | <@Derakon> | Mainly because a) they're more likely to push the envelope of what's computationally possible, and b) they're made by companies with a large history of (and therefore tools for) writing games in C/C++. |
05:28 | | * Bob_Work nods. |
05:29 | <@ToxicFrog> | The APIs they use (OpenGL, DirectX) are C/++ oriented; C and C++ give them the raw speed to be playable, too; and there's lots of library and tool infrastructure and lots of optimization research there, too. |
05:30 | < Bob_Work> | I thought console games were written in very specific languages for the consoles. |
05:30 | <@Derakon> | No. |
05:30 | <@ToxicFrog> | "C/++ combined with something else" is also popular, because there's lots of stuff you really don't want to do in C if you can avoid it; +Lua is pretty common (as that's what it's for), I've seen +Python in a few places too, Unreal uses a custom language, and Chrome uses C++ and Java of all things. |
05:30 | <@ToxicFrog> | Nope. C/++ and a cross-compiler. |
05:30 | < Bob_Work> | Well, at least I've learned SOMETHING new today. |
05:30 | <@Derakon> | Maybe a couple of special API calls. |
05:30 | <@Derakon> | But mostly it's just a fixed hardware platform and a special compiler. |
05:31 | <@Derakon> | The PS3 is so hard to make games for largely because it doesn't work as much like a normal computer as the other consoles do. |
05:31 | <@ToxicFrog> | You'll probably have console-specific libraries, and perhaps a console-specific compiler if it's a weird processor, but apart from that... |
05:31 | < Bob_Work> | Makes sense. |
05:32 | <@ToxicFrog> | (exceptions: the PS3's Cell processor is odd; older consoles may request or require the use of hand-optimized assembler due to size or speed constraints; and of course any other compiled language that can target that system, and any interpreted one where you can build a VM targeting it, are also valid choices) |
05:33 | <@Derakon> | Some of the stuff game developers did for the NES/Genesis/SNES was downright scary. |
05:33 | < Bob_Work> | Really? |
05:33 | <@Derakon> | Modifying the framebuffer in the middle of drawing to the screen, for example. |
05:48 | < Rhamphoryncus> | ugh, fucking git! |
05:48 | < Bob_Work> | Wasn't me. |
05:49 | < Rhamphoryncus> | *git*, not a git :P |
05:50 | <@McMartin> | I love how basically every version control system is named after personality defects. |
05:51 | <@McMartin> | 21:34 <@Derakon> Modifying the framebuffer in the middle of drawing to the screen, for example. |
05:51 | <@McMartin> | The Atari 2600's "frame buffer" was a third of a scanline wide. |
05:51 | <@McMartin> | You had to do frame counting to do X location, and you needed to manually throw the HSYNC. |
05:51 | <@McMartin> | On the plus side, sprites had no height limit, since you were changing the sprite data every scan line *anyway* |
05:52 | <@McMartin> | (Oh yes. It was also one scanline tall.) |
05:52 | < Rhamphoryncus> | heh |
05:52 | < Rhamphoryncus> | I'm seriously tempted to resolve my conflicts by way of rm -rf, then grabbing upstream again |
05:53 | <@ToxicFrog> | What's happened? |
05:54 | <@ToxicFrog> | If you're in a conflicted merge, it should be a simple matter of resolving the conflicts (git mergetool helps here, if your preferred 3WM tool is one it knows how to invoke), git add <formerly conflicted files>, git commit. |
05:54 | < Rhamphoryncus> | Well, this is a git mirror of a svn repository. I made some changes, committed them, produced a patch, and sent it upstream. I later made more changes (not committed), and upstream applied my patch with tweaked formatting |
05:55 | <@ToxicFrog> | Aah, and now git svn rebase is losing its shit? |
05:55 | < Rhamphoryncus> | So first git choked on being "not up to date", which I guessed meant uncommitted changes |
05:55 | < Rhamphoryncus> | I've not touched rebase. I don't know what it does |
05:56 | <@ToxicFrog> | How are you fetching updates from svn, then? |
05:56 | < Rhamphoryncus> | git pull |
05:56 | <@ToxicFrog> | AUGH |
05:56 | | Reiv [~82d94c4d@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC (EOF)] |
05:57 | < Rhamphoryncus> | I deny any responsibility :P |
05:57 | <@ToxicFrog> | git pull in svn mirrors is discouraged because it leads to nonlinear history, which is not cool when interfacing with SVN, which assumes linear history in all things |
05:58 | < Rhamphoryncus> | uhuh |
05:58 | < Rhamphoryncus> | How does that affect me? All I'm doing is producing patches vs "mainline" |
05:58 | <@ToxicFrog> | git svn rebase (note: not plain git rebase) is recommended here - basically, what it does is: saves all your commits made since the last commit you fetched from SVN; fetches new commits from SVN; and then reapplies your local commits on top of those. |
05:59 | <@ToxicFrog> | ...wait, so |
05:59 | <@ToxicFrog> | I think I'm confused about your workflow, then |
05:59 | < Bob_Work> | Nowhere near as much as I am. :P |
05:59 | <@ToxicFrog> | AIUI, the sequence of steps here is: |
05:59 | <@ToxicFrog> | - git svn clone |
05:59 | < Rhamphoryncus> | no svn |
05:59 | < Rhamphoryncus> | I do not maintain the mirror |
05:59 | <@ToxicFrog> | Ok, now I'm really confused. |
06:00 | < Rhamphoryncus> | I just did git clone <whatever> |
06:00 | <@ToxicFrog> | So what we have here then is: |
06:00 | <@ToxicFrog> | (third party SVN repo) => presumable git svn clone => (third party git mirror of this repo) => your git clone => (your local git repo)? |
06:00 | < Rhamphoryncus> | yup |
06:00 | <@ToxicFrog> | Ok, in that case git pull is what you should be using, disregard my earlier comments :P |
06:01 | < Rhamphoryncus> | But one more step at the end :) |
06:01 | < Rhamphoryncus> | I cloned my mainline dir into another dir, and did work on that |
06:01 | <@ToxicFrog> | As in, cp -a mainline newdir? |
06:01 | <@ToxicFrog> | You didn't branch? |
06:01 | < Rhamphoryncus> | nope, git clone |
06:01 | <@ToxicFrog> | @.@ |
06:01 | <@ToxicFrog> | Ok |
06:01 | < Rhamphoryncus> | it seemed to work *shrug* |
06:02 | <@ToxicFrog> | FYI, this is what branches are for |
06:02 | < Rhamphoryncus> | afaik that IS a branch. They're all branches :P |
06:02 | <@ToxicFrog> | No. |
06:02 | <@ToxicFrog> | A branch is not a seperate repo. |
06:02 | <@ToxicFrog> | Try 'git branch -a" |
06:02 | | Syloqs-AFH [Syloq@ServicesAdmin.Nightstar.Net] has quit [Connection reset by peer] |
06:02 | < Rhamphoryncus> | Oh hey, that's some interesting magic |
06:03 | <@ToxicFrog> | It should list two branches (probably 'master' and 'origin/master'); the former is "your local stuff, based on the repo you cloned from" and the latter is "the repo you cloned from as of the last fetch or pull, without any of your local commits" |
06:03 | < Rhamphoryncus> | * master |
06:03 | < Rhamphoryncus> | origin/HEAD |
06:03 | < Rhamphoryncus> | origin/master |
06:03 | <@ToxicFrog> | You can use 'git checkout <branch>' to examine one (don't commit on top of origin/*, though!) |
06:03 | < Rhamphoryncus> | and that creates a new dir? Or overwrites my current dir? |
06:04 | <@ToxicFrog> | The latter (and for this reason it won't do it if you have uncommitted changes that would be destroyed) |
06:04 | <@ToxicFrog> | (unless you force it to) |
06:04 | < Rhamphoryncus> | rhamph@tetromino:~/src/warzone/prediction$ git checkout -f master |
06:04 | < Rhamphoryncus> | Already on "master" |
06:04 | < Rhamphoryncus> | Your branch and the tracked remote branch 'origin/master' have diverged, |
06:04 | < Rhamphoryncus> | and respectively have 1 and 37 different commit(s) each. |
06:04 | <@ToxicFrog> | In general, 'git checkout <commit>' is 'replace my working tree with the contents of this commit'; and if commit is a branch it uses the branch head. |
06:04 | <@ToxicFrog> | Ok. So what this means is: |
06:05 | <@ToxicFrog> | - your working copy reflects 'master' |
06:05 | <@ToxicFrog> | - since you branched it from the original, they've made another 37 commits |
06:05 | <@ToxicFrog> | - and you've made 1 |
06:06 | < Rhamphoryncus> | Which is intentional.. the whole point of DVCS |
06:06 | <@ToxicFrog> | Yep |
06:06 | <@ToxicFrog> | So 'git pull' will attempt to do a merge between those two branches |
06:06 | < Rhamphoryncus> | ah, I've gone back to the conflict! |
06:07 | <@ToxicFrog> | In this case, I imagine what has happened is you made those changes, and the remote has also made those changes (with minor adjustments) since they incorporated your patch |
06:07 | <@ToxicFrog> | Bam, conflict |
06:07 | < Rhamphoryncus> | Yup, exactly |
06:08 | | KBot [~karma.bot@Nightstar-29236.neoplus.adsl.tpnet.pl] has joined #Code |
06:08 | < Rhamphoryncus> | I'm familiar with resolving conflicts in svn or bzr, so it's easy to edit the file and pick one.. but I couldn't find the command for "I'm done, now fuckoff" :P |
06:08 | <@ToxicFrog> | Oh, you've already resolved all the conflicts? |
06:08 | | KarmaBot [~karma.bot@Nightstar-29697.neoplus.adsl.tpnet.pl] has quit [Ping Timeout] |
06:08 | < Rhamphoryncus> | Before, then hooped it trying to fix it |
06:09 | < Rhamphoryncus> | But in this case I'm just as happy abandoning them |
06:09 | < Rhamphoryncus> | My patch was sent upstream and committed, I don't need my own variant |
06:09 | <@ToxicFrog> | Ok. |
06:09 | <@ToxicFrog> | Here's the easiest and safest way I know to do this, provided you haven't pushed your changes/had anyone else pull from you (which you haven't) |
06:10 | <@ToxicFrog> | ...actually, there's two ways |
06:10 | <@ToxicFrog> | If that one commit is the one you want to discard, and you don't have other uncomitted changes you're attached to: |
06:11 | | KBot is now known as KarmaBot |
06:11 | <@ToxicFrog> | git reset --hard <ID of the commit before that one, ie, the commit to roll back to> |
06:11 | <@ToxicFrog> | git pull |
06:11 | <@ToxicFrog> | reset --hard resets the branch head, index and working tree, so it permanently throws away anything after the point you reset to; for this reason it cannot be safely used if you have pushed or been cloned/fetched/pulled from. |
06:11 | <@ToxicFrog> | if you haven't, though, it's fast and easy. |
06:11 | < Rhamphoryncus> | Knowing the ID isn't easy ;) |
06:12 | <@ToxicFrog> | git log |
06:12 | <@ToxicFrog> | or gitk if you prefer a graphical interface |
06:12 | <@ToxicFrog> | Also, if you need to avoid rewriting history (for example, you've cloned this repo): |
06:12 | < Rhamphoryncus> | giggle's better |
06:12 | <@ToxicFrog> | git revert <commit> will generate a new commit that exactly undoes the changes of the named commit |
06:13 | <@Derakon> | Is it true that log_n(x^a) == a*log_n(x) for any values of x, n, and a? |
06:13 | <@ToxicFrog> | This is also handy if you, say, pull, make commits A B C D, now A conflicts with its upstream version but you want to keep B C D - you revert A, then pull. |
06:13 | < Rhamphoryncus> | so git reset --hard to change what I've branched/cloned/whateverthefuck, and git revert to cherry pick things to undo |
06:13 | <@Derakon> | Or does that only work when a == n? |
06:13 | <@ToxicFrog> | Yeah. reset --hard is 'roll back to this commit and nuke anything after that' |
06:14 | <@ToxicFrog> | revert is 'undo this commit without changing history' |
06:14 | < Rhamphoryncus> | hrm, giggle doesn't seem sane. So much prettier though :P |
06:15 | <@ToxicFrog> | ...all this said, didn't you have some local uncommitted changes you wanted to keep? Or did you stash those? |
06:15 | < Rhamphoryncus> | Nope, I wanted to scrap them |
06:15 | < Rhamphoryncus> | gitk's right-click menu seems to have worked |
06:15 | < Rhamphoryncus> | So thankies :) |
06:16 | <@ToxicFrog> | You're welcome |
06:16 | <@ToxicFrog> | I can burble some more about how cool branches are now, if you like :P |
06:16 | < Rhamphoryncus> | Wanna give me a quick rundown of the clone vs branch crack? |
06:17 | <@ToxicFrog> | Sure |
06:18 | <@ToxicFrog> | A repo is basically a set of commits, organized into branches. A branch is a line of development - a linear sequence of commits. New branches can be spawned at any time with 'git branch', and 'git checkout' can be used to switch between branches. |
06:18 | <@ToxicFrog> | By default you have 'master', the original branch of the repo. |
06:18 | < Rhamphoryncus> | I've been getting the impression they have some hidden magical list of branch names |
06:19 | <@ToxicFrog> | It's .git/refs/heads, I think |
06:19 | < Rhamphoryncus> | aha, nice to be right :) |
06:19 | <@ToxicFrog> | (for local branches, and .git/refs/remotes/<remote-name>/ for tracking branches, which I'll get to shortly) |
06:20 | < Rhamphoryncus> | Wait, that's in each branch I have? Not in ${HOME}? |
06:20 | <@ToxicFrog> | Each repo. |
06:20 | <@ToxicFrog> | Each repo has a .git directory. |
06:20 | <@ToxicFrog> | $HOME has .gitconfig, the global configuration settings. |
06:21 | < Rhamphoryncus> | hrm |
06:21 | <@ToxicFrog> | Try it: mkdir /tmp/git-test; cd /tmp/git-test; git init; ls -a |
06:21 | < Rhamphoryncus> | I'm thinking what I want is a warzone/.mainline as my clone, then creates branches off of it |
06:21 | <@ToxicFrog> | Aah, WZ2100? |
06:21 | < Rhamphoryncus> | yup |
06:21 | <@ToxicFrog> | Nifty. |
06:22 | <@ToxicFrog> | (why ".mainline"?) |
06:22 | < Rhamphoryncus> | Unless there's some other magic way to reference the remote mainline |
06:22 | <@ToxicFrog> | There is. |
06:22 | <@ToxicFrog> | Like I said, I'll get to that in a moment. |
06:22 | < Rhamphoryncus> | they call it mainline and that's the dir I ended up with. I also used it for my working copy though, so I have uncommitted changes in it, which are causing issues |
06:22 | <@ToxicFrog> | First, the typical use case for local branches: |
06:22 | <@ToxicFrog> | hack hack hack on master |
06:23 | <@ToxicFrog> | Hmm, I want to add newfeature, but this may take a while, don't want to break master |
06:23 | <@ToxicFrog> | git branch newfeature |
06:23 | <@ToxicFrog> | git checkout newfeature |
06:23 | <@ToxicFrog> | hack hack hack on newfeature |
06:23 | <@ToxicFrog> | Hmm, want to work on master again |
06:23 | <@ToxicFrog> | git checkout master |
06:23 | <@ToxicFrog> | ...etc |
06:23 | < Rhamphoryncus> | that can't work. Am I supposed to do that as a subdir of master? |
06:23 | <@ToxicFrog> | And when you're done, you checkout master and git merge newfeature into it. |
06:23 | <@ToxicFrog> | No. |
06:24 | <@ToxicFrog> | Seriously, try it |
06:24 | < Rhamphoryncus> | Wait, branch creates a name, not a new working dir.. and checkout swaps which name is in use in my working dir? |
06:24 | <@ToxicFrog> | Basically, yes. |
06:24 | <@ToxicFrog> | git checkout |
06:25 | <@ToxicFrog> | git checkout <branch> says 'replace my working copy with the most recent commit on <branch>; append further commits to <branch>, too" |
06:25 | < Rhamphoryncus> | What about uncommitted changes? |
06:25 | <@ToxicFrog> | It won't checkout until you deal with them. |
06:25 | < Rhamphoryncus> | Okay |
06:25 | <@ToxicFrog> | Either by commiting them, stashing them, or resetting them. |
06:25 | < Rhamphoryncus> | .. stash? |
06:25 | <@ToxicFrog> | stash saves your changes without committing them |
06:25 | <@ToxicFrog> | You can then unstash them later |
06:26 | < Rhamphoryncus> | So a fake commit |
06:26 | <@ToxicFrog> | Kind of, except it's not on any branch |
06:26 | <@ToxicFrog> | So you can, say: |
06:26 | <@ToxicFrog> | - hack on master |
06:26 | <@ToxicFrog> | (but not commit) |
06:26 | <@ToxicFrog> | - git stash |
06:26 | <@ToxicFrog> | - git checkout newfeature |
06:27 | <@ToxicFrog> | - git stash apply - now those uncommited changes are ready to be committed to newfeature instead of master |
06:27 | <@ToxicFrog> | Or, say, you leave them in stash until you switch back to master - they were changes for master, but that you didn't want to commit just yet |
06:27 | < Rhamphoryncus> | *nod* can you have multiple stashes? |
06:27 | <@ToxicFrog> | Yes. |
06:27 | <@ToxicFrog> | git help stash for the gory details |
06:28 | < Rhamphoryncus> | yeah, I see.. a description rather than a name. Makes sense |
06:28 | < Rhamphoryncus> | And my other remaining question, how do I have multiple dirs? |
06:28 | <@ToxicFrog> | I don't understand the question. |
06:29 | < Rhamphoryncus> | Traditionally, branches are subdirs |
06:29 | <@ToxicFrog> | In SVN's brain-damaged branching convention, yes. |
06:29 | < Rhamphoryncus> | and bzr :P |
06:29 | <@ToxicFrog> | Haven't used bzr but I dislike it already~ |
06:30 | < Rhamphoryncus> | But the comparison with svn is wrong |
06:30 | < Rhamphoryncus> | I simply want to access the same repository in two directories |
06:30 | <@ToxicFrog> | Anyways, git doesn't have provision for subdirs-as-branches, because it has branches as branches; if you want two working copies with different branches checked out in each one, clone twice to two different directories and do different checkouts in each one |
06:30 | <@Derakon> | I really wish this page were better-organized. http://docs.python.org/library/stdtypes.html |
06:31 | < Rhamphoryncus> | ToxicFrog: That's exactly what I did before, when I used clone.. but I didn't use git branch to relabel them in a way git understood |
06:31 | <@ToxicFrog> | Oh right, and that brings us back to "mainline" |
06:31 | <@ToxicFrog> | You don't use branch to relabel repos, it doesn't work like that |
06:32 | < Rhamphoryncus> | I don't want multiple repos. I want multiple working copies, each with a different branch |
06:32 | <@ToxicFrog> | Each repo has at most one working copy. |
06:32 | <@ToxicFrog> | What's the use case here? |
06:33 | < Rhamphoryncus> | hum essentially the same as stash. I'm not sure I can justify a difference |
06:33 | <@ToxicFrog> | Also, mainline, because this unfinished line of conversation is bugging me - |
06:34 | <@ToxicFrog> | When you clone, a set of 'tracking branches' are created. These are all named origin/<branch> and contain a copy of that branch in the repo you cloned from. |
06:34 | < Rhamphoryncus> | I do get the feeling that, to get anything done with git, I should delete my dirs and create a new repository |
06:34 | <@ToxicFrog> | 'git fetch' will update the tracking branches; 'git pull' will do a fetch, then try to merge any updates into your local branches. |
06:35 | <@ToxicFrog> | So if you want to retain an 'exactly as it is in the upstream repo' branch, that happens automatically, and you can check out that branch (or individual commits thereof) just like any other. |
06:35 | | * Rhamphoryncus nods |
06:35 | <@ToxicFrog> | It does sound like, between the two clones and the merge conflicts on changes you don't want anyways, that might be easiest. |
06:36 | < Rhamphoryncus> | Well, git will continue to despise me having multiple working copies, so I'd have to abandon the extras eventually |
06:37 | <@ToxicFrog> | I think part of the problem here may be that you think of "working copy" and "repo" as having a many-to-one relationship; in git it's one-to-one. |
06:37 | < Rhamphoryncus> | Yes. Git only supports one working copy |
06:37 | < Rhamphoryncus> | I can fake it by having a remote repository, hosted locally, but that's just more work |
06:37 | <@ToxicFrog> | A repo has a digraph of commits, a set of tags and branches, and optionally an index and working copy. |
06:38 | <@ToxicFrog> | How do you mean? |
06:38 | < Rhamphoryncus> | I mean multiple repositories all pulling off a common local mirror |
06:38 | <@ToxicFrog> | A valid approach, but I'm not sure it's useful for what you're doing. |
06:38 | < Rhamphoryncus> | Yeah |
06:39 | <@ToxicFrog> | If all you want multiple working copies for is the same thing you'd use stashes or svn branches for, that's what stash and branch exist for. |
06:39 | < Rhamphoryncus> | I've no desire for multiple repositories. I want to easily produce diffs between them |
06:39 | <@ToxicFrog> | git diff commit1 commit2 |
06:39 | <@ToxicFrog> | Eg, git diff origin/master master |
06:39 | < Rhamphoryncus> | You say that so seriously, but the two seem totally different to me :P |
06:40 | <@ToxicFrog> | How so? |
06:40 | <@ToxicFrog> | You mean, 'commit' and 'branchname'? |
06:40 | < Rhamphoryncus> | yes |
06:40 | <@ToxicFrog> | Well, the idea here, a branch is just a named sequence of commits |
06:41 | < Rhamphoryncus> | Not a tag on the last commit in that sequence? |
06:41 | <@ToxicFrog> | So, anywhere you could put a commit ID, you can put a branch name, and this is understood to mean the most recent commit in that branch |
06:41 | <@ToxicFrog> | Actually, that's what branches truly are - tags that move automatically when you commit a child of the commit they name |
06:41 | | * Rhamphoryncus nods |
06:41 | <@ToxicFrog> | Conceptually, I find it easiest to think of them as lines of development, but if thinking of them as tags works better for you that's an entirely correct way of thinking |
06:42 | | * Rhamphoryncus nods |
06:42 | <@ToxicFrog> | (git also supports immobile tags via 'git tag', and you can use tag names anywhere you could use commit IDs to) |
06:42 | <@ToxicFrog> | (so, for example, 'git checkout v1.1' or 'git diff v1.0 master' are totally meaningful) |
06:42 | < Rhamphoryncus> | Okay, I think all I need right now is a name for this new repository.. all that comes to mind is "gitshit" :P |
06:42 | <@ToxicFrog> | Pfft |
06:42 | < Rhamphoryncus> | Just rolls off the tongue.. gitshit.. |
06:42 | <@ToxicFrog> | It'll default to the name of the repo cloned from |
06:43 | < Rhamphoryncus> | That'd be mainline I assume :) |
06:43 | <@ToxicFrog> | Yeah - |
06:43 | < Rhamphoryncus> | Which not only already exists, it's misleading when it'll contain my own branches |
06:43 | <@ToxicFrog> | I'm guessing the clone URL is something like ssh://user@host/path/to/mainline.git? |
06:43 | <@ToxicFrog> | It won't clone into an existing directory anyways, so it won't get confused by the contents already there :) |
06:44 | < Rhamphoryncus> | umm.. well it wasn't ssh, but I can't remember the command to list it |
06:44 | <@ToxicFrog> | git remote show origin |
06:44 | <@ToxicFrog> | (git remote with no args for a list of all remotes) |
06:44 | < Rhamphoryncus> | hehehe, first I gotta change into my mainline dir, as all my other dirs are just clones of that.. |
06:45 | <@ToxicFrog> | Anyways, the precise details of where you cloned from are unimportant. |
06:45 | < Rhamphoryncus> | git://gitorious.org/warzone2100/mainline.git |
06:45 | <@ToxicFrog> | ...wait...you'd clone it to a dir inside your clone of the mainline repo? |
06:45 | < Rhamphoryncus> | No :) |
06:45 | | AnnoDomini [AnnoDomini@Nightstar-29236.neoplus.adsl.tpnet.pl] has joined #Code |
06:45 | | mode/#code [+o AnnoDomini] by ChanServ |
06:45 | < Rhamphoryncus> | I have my own ~/src/warzone dir that I put all my junk into. I originally cloned to ~/src/warzone/mainline, then cloned that to ~/src/warzone/prediction |
06:46 | <@ToxicFrog> | Ok |
06:46 | < Rhamphoryncus> | I was in ~/src/warzone/prediction when I ran git remote show origin |
06:46 | <@ToxicFrog> | Aaah |
06:46 | < Rhamphoryncus> | /home/rhamph/src/warzone/mainline//.git |
06:46 | <@ToxicFrog> | Incidentally, I think the intended flow there is: clone to ~/src/warzone/mainline; cd mainline; git branch prediction; now you can do all your work on the prediction feature without disturbing master. |
06:47 | <@ToxicFrog> | When you're done, checkout master, pull to get the most recent changes, then diff or format-patch between master and prediction. |
06:48 | <@ToxicFrog> | This also means that when upstream incorporates your patch and you pull, it doesn't conflict because those changes aren't in master, just in prediction. |
06:48 | < Rhamphoryncus> | ... huh, git branch -a in mainline shows some branches.. master and a bunch of origin/*. What's the naming convention? |
06:49 | < Rhamphoryncus> | And fortunately I never committed to mainline, so I can just keep going with it |
06:50 | < Rhamphoryncus> | ... o.O and somehow "git branch prediction; git checkout prediction" found some modifications |
06:50 | <@ToxicFrog> | origin/* will be all the branches on the repo you cloned from, and will use whatever the project naming convention is :) |
06:50 | <@ToxicFrog> | Sure you didn't have uncommitted changes? |
06:50 | < Rhamphoryncus> | I did git status first |
06:50 | <@ToxicFrog> | In that case (since you're spawning a new branch, not checking out an existing one) it doesn't risk destroying them |
06:50 | <@ToxicFrog> | Huh |
06:50 | < Rhamphoryncus> | I had some *before*, but I deleted them by hand |
06:50 | <@ToxicFrog> | What's the before/after on git status? |
06:51 | < Rhamphoryncus> | hrm. Apparently I need to read git status more thoroughly :P |
06:51 | <@ToxicFrog> | Heh |
06:52 | < Rhamphoryncus> | "no changes" is what I read. "no changes added to commit" is what it said |
06:52 | < Rhamphoryncus> | Did it simply transplant my working copy? |
06:53 | <@ToxicFrog> | Yep |
06:53 | < Rhamphoryncus> | okay |
06:53 | <@ToxicFrog> | Basically, checkout goes "ok, at the moment master and prediction point to the same commit, so I don't need to touch working copy at all, just update the record of which branch I'm on" |
06:54 | < Rhamphoryncus> | Bluh, do I need to run git add before running commit? |
06:54 | <@ToxicFrog> | Yes, or use commit -a |
06:54 | | Doctor_Nick [~nick@Nightstar-7517.tampfl.dsl-w.verizon.net] has quit [Quit: leaving] |
06:54 | <@ToxicFrog> | add is not 'add these files to version control' |
06:54 | <@ToxicFrog> | It's 'add these changes to the next commit' |
06:54 | < Rhamphoryncus> | ah |
06:54 | < Rhamphoryncus> | add Add file contents to the index |
06:55 | < Rhamphoryncus> | that just clears everything right up :P |
06:55 | <@ToxicFrog> | Advantages: it means you can make a bunch of changes and commit only some of them (including staging individual diffs from a file rather than the entire file) |
06:55 | <@ToxicFrog> | Disadvantages: need to re-add every time you commit, or use commit -a ("add all files you know about, then commit") |
06:55 | <@ToxicFrog> | It does assume you've read the tutorials and know what the index is :) |
06:56 | < Rhamphoryncus> | The docs I found never pointed to a tutorial. *shrug* |
06:56 | <@ToxicFrog> | Simply, the index is the staging area; when you git commit, it solidifies the index into a recorded commit. |
06:56 | < Rhamphoryncus> | So how do you add to the repository, out of curiosity? |
06:56 | <@ToxicFrog> | 'add' takes changes in the working copy and copies them into the index, so they will be included in the next commit. |
06:56 | <@ToxicFrog> | "add to the repository"? |
06:56 | < Rhamphoryncus> | add to version control |
06:57 | <@ToxicFrog> | (tutorial: http://git-scm.com/documentation upper left, in bold |
06:57 | | mode/#code [-o ToxicFrog] by ToxicFrog |
06:57 | | mode/#code [+o ToxicFrog] by ToxicFrog |
06:57 | <@ToxicFrog> | (tutorial: http://git-scm.com/documentation upper left, in bold |
06:57 | <@Derakon> | The funny thing being, half the time I see someone re-op themselves I also see both URLs. |
06:58 | <@Derakon> | Yay server desync. |
06:58 | <@ToxicFrog> | Git doesn't really have that concept in the same sense as, say, SVN; the common phrase is "git tracks content, not files" |
06:58 | < Rhamphoryncus> | Derakon: there wasn't supposed to be two copies of that? |
06:59 | <@ToxicFrog> | That said, if you add something, git will remember that path; it'll show up as 'changed' rather than 'new' and 'commit -a' will add it. |
06:59 | <@ToxicFrog> | Er, will stage and commit it, sorry. |
06:59 | < Rhamphoryncus> | ToxicFrog: so you just add it and it'll save it as a diff vs a non-existent file? |
06:59 | <@ToxicFrog> | Rhamphoryncus: --- #code :Cannot send to channel (You need voice to send urls (channel is +U)) |
06:59 | <@ToxicFrog> | Is what I got. |
06:59 | <@ToxicFrog> | So someone didn't get it. |
06:59 | < Rhamphoryncus> | Ahh. |
06:59 | <@ToxicFrog> | Yes. |
06:59 | < Rhamphoryncus> | bloody IRC :) |
06:59 | <@ToxicFrog> | Similarly, git does copy/rename detection in the same way. |
07:00 | <@ToxicFrog> | There is no 'git mv' or 'git cp'; you move it in the filesystem, then git add/git rm normally and when you commit, it looks at the file contents and goes 'oh, these are the same file, I'll mark it as a copy/rename in the commit log' |
07:01 | < Rhamphoryncus> | That's cool |
07:01 | <@ToxicFrog> | (this also means that if you have, say, a thousand identical files, it stores the file content once and a thousand references to it from different paths) |
07:02 | | Doctor_Nick [~nick@Nightstar-7517.tampfl.dsl-w.verizon.net] has joined #code |
07:02 | | mode/#code [+o Doctor_Nick] by ChanServ |
07:04 | <@ToxicFrog> | Any other questions? |
07:04 | < Rhamphoryncus> | nope, I think I've got it |
07:04 | < Rhamphoryncus> | Much appreciated. I doubt I'd have figured this out on my own |
07:05 | <@ToxicFrog> | Missing the tutorial probably didn't help either; the man pages/git help are pretty complete for what they cover, but you have to have some idea of where to look and they aren't good at overviews. |
07:06 | <@ToxicFrog> | I found that the official tutorial and "Git for Computer Scientists" probably helped the most. |
07:06 | < Rhamphoryncus> | I'm already glossing over the tutorial >.> |
07:06 | < Rhamphoryncus> | Heh, the words "stash" and "unstash" each occur once, but in a sentence, not a command :) |
07:07 | <@ToxicFrog> | Yeah, I don't think the basic tutorial covers stashing |
07:07 | < Rhamphoryncus> | branch+stash are really critical to my understanding |
07:07 | <@ToxicFrog> | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html is the main document |
07:07 | < Rhamphoryncus> | Without both of them, together, the single working dir thing is non-sensical |
07:08 | <@ToxicFrog> | Yeah |
07:08 | <@ToxicFrog> | Without branch+checkout, you can't do branching with a single working copy; and without stash, uncomitted changes + checkout are a recipe for pain |
07:08 | < Rhamphoryncus> | This'd really suck for projects that didn't let you have multiple build dirs |
07:08 | <@ToxicFrog> | How do you mean? |
07:09 | <@ToxicFrog> | Oh, as in: switch branches, oh shit, now make wants to rebuild everything from scratch? |
07:09 | < Rhamphoryncus> | Well if I want debug and release builds I assume I can make mainline/debug and mainline/release, then build in each.. that's orthogonal to branching |
07:09 | | * ToxicFrog nods |
07:09 | < Rhamphoryncus> | If I was using subversion I could create multiple working copies as a workaround |
07:10 | <@ToxicFrog> | I've been using a build system that does that automatically for me for long enough that I tend to forget it's an issue |
07:10 | < Rhamphoryncus> | Most do :) |
07:10 | < Rhamphoryncus> | Python mostly does, only has some slight issues ;) |
07:10 | <@ToxicFrog> | Without that, what I'd probably do is just create build-only repos - clone locally (uses hardlinks, so no space worries), and make is cd buildrepo && git pull && make |
07:11 | <@ToxicFrog> | But I must confess it's not something I've really thought about |
07:11 | < Rhamphoryncus> | *nod* |
07:11 | <@Reiver> | I don't suppose anyone here knows Oracle, by chance? |
07:12 | <@ToxicFrog> | I don't, sorry. |
07:13 | < Rhamphoryncus> | All I know about oracle is that it uses CESU-8 }:> |
07:13 | < Rhamphoryncus> | (but you can also use UTF-8 these days) |
07:14 | | * Reiver cries. He's in a database course that is teaching us that Writing SQL Is Bad. |
07:14 | <@ToxicFrog> | Anyways, manual-wise, you'd probably benefit most from "understanding history" in chapter 1, and all of chapter 3 |
07:14 | <@Reiver> | (They're right. But it's a pain.) |
07:15 | <@ToxicFrog> | Reading the whole thing is unlikely to hurt, though :) |
07:15 | < Rhamphoryncus> | atm I'd rather get something done than spend hours reading docs ;) |
07:15 | <@ToxicFrog> | That's why |
07:15 | <@ToxicFrog> | I pointed you to specific sections, no? |
07:15 | <@ToxicFrog> | But I think you have the general idea now |
07:15 | < Rhamphoryncus> | You've already explained what I need |
07:16 | <@ToxicFrog> | Good good |
07:16 | <@ToxicFrog> | And now,I'm going to bed |
07:17 | < Rhamphoryncus> | G'night :) |
07:17 | <@ToxicFrog> | Further questions can be directed to future-me, or #git on freenode :) |
07:17 | <@ToxicFrog> | 'night! |
07:17 | < Rhamphoryncus> | Heh, somehow I can't imagine getting the same quality of help out of a real help channel |
07:18 | < Rhamphoryncus> | If only because my vocabulary was quite limited when I started ;) |
07:18 | <@Reiver> | ToxicFrog is an awesome tutor. |
07:33 | <@Derakon> | Mental note: "for i in range(0, 999999999)" is a bad idea. |
07:36 | <@Derakon> | Hm. Are there any square numbers whose last digit is 0 but whose second to last digit is not? |
07:38 | <@Derakon> | I'm not finding any below a million. I don't think it's possible. |
07:39 | <@Derakon> | Because in order to git a last digit of 0, you'd need the base number to end in 0, which means a multiple of 10, which, when squared, would give a multiple of 100. |
07:40 | <@Reiver> | That's logical enough to work out. |
07:41 | <@Reiver> | Is there any number other than 10 which, when squared, ends in a 0 to start with? |
07:41 | <@Derakon> | 20, 30, 40, etc. |
07:41 | <@Reiver> | They're 10s. :) |
07:41 | <@Derakon> | ...okay, then state your question more clearly. :p |
07:41 | <@Reiver> | Sorry. |
07:42 | <@Reiver> | Is there any number other than multiples of 10 which, when squared, ends in a 0 at all to start with? |
07:42 | <@Derakon> | That was my point. I don't think there are. |
07:45 | < EvilDarkLord> | Protip: Look at the last number and do manual multiplication. |
07:45 | < EvilDarkLord> | Only the last number matters if you square it and want to look at the last number of the result. |
07:47 | < EvilDarkLord> | 1*1=1, 2*2=4, 3*3=9, 4*4=6, 5*5=5, 6*6=6, 7*7=9, 8*8=4, 9*9=1, 0*0=0 mod 10. |
07:48 | < EvilDarkLord> | Also no squares at all with last number 2,3,7,8. |
08:04 | | Derakon is now known as Derakon[AFK] |
09:37 | | Chi is now known as Alek |
09:59 | | You're now known as TheWatcher |
10:16 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
10:16 | | mode/#code [+o Attilla] by ChanServ |
10:25 | | crem [~moo@Nightstar-28703.adsl.mgts.by] has joined #code |
10:25 | | crem_ [~moo@Nightstar-28703.adsl.mgts.by] has quit [Connection reset by peer] |
10:38 | | Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has quit [Quit: Rhamphoryncus] |
10:41 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code |
10:41 | | mode/#code [+o gnolam] by ChanServ |
11:42 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
11:42 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
11:42 | | mode/#code [+o Attilla] by ChanServ |
11:50 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
11:50 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
11:50 | | mode/#code [+o Attilla] by ChanServ |
11:52 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Reboot] |
11:54 | | gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code |
11:54 | | mode/#code [+o gnolam] by ChanServ |
11:58 | | Bob_Work [c6b3e33a@Nightstar-14595.mibbit.com] has quit [Quit: http://www.mibbit.com ajax IRC Client] |
12:13 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
12:13 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
12:13 | | mode/#code [+o Attilla] by ChanServ |
12:15 | | Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
12:16 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
12:17 | | Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
12:18 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
12:18 | | mode/#code [+o Attilla] by ChanServ |
12:23 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
12:24 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
12:24 | | mode/#code [+o Attilla] by ChanServ |
14:18 | | crem_ [~moo@Nightstar-28703.adsl.mgts.by] has joined #code |
14:20 | | crem [~moo@Nightstar-28703.adsl.mgts.by] has quit [Connection reset by peer] |
15:12 | | McMartin [~mcmartin@Nightstar-19418.dsl.pltn13.sbcglobal.net] has quit [Ping Timeout] |
15:13 | | McMartin [~mcmartin@Nightstar-19418.dsl.pltn13.sbcglobal.net] has joined #code |
15:13 | | mode/#code [+o McMartin] by ChanServ |
15:47 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
15:48 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
15:48 | | mode/#code [+o Attilla] by ChanServ |
16:01 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
16:01 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
16:01 | | mode/#code [+o Attilla] by ChanServ |
16:04 | | Syloqs_AFH [Syloq@Admin.Nightstar.Net] has joined #code |
16:05 | | Syloqs_AFH is now known as Syloqs-AFH |
16:08 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
16:08 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
16:08 | | mode/#code [+o Attilla] by ChanServ |
16:22 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
16:24 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
16:24 | | mode/#code [+o Attilla] by ChanServ |
16:38 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
16:38 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
16:38 | | mode/#code [+o Attilla] by ChanServ |
16:57 | | You're now known as TheWatcher[afk] |
17:40 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
17:40 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
17:41 | | mode/#code [+o Attilla] by ChanServ |
17:51 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
17:58 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
17:58 | | mode/#code [+o Attilla] by ChanServ |
18:11 | | Derakon[AFK] is now known as Derakon |
18:34 | | You're now known as TheWatcher |
18:35 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
18:35 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
18:35 | | mode/#code [+o Attilla] by ChanServ |
18:42 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
18:43 | <@Derakon> | Hm. I really need to speed up my relative-primality tester, which is stupid and very slow right now. |
18:44 | <@Derakon> | I guess the proper way to do this is to get the factors of n, then return the set of all numbers between 1 and n minus the set of numbers that can be created by those factors which are less than n. |
18:44 | <@Derakon> | (As opposed to my current method, which gets the factors of each number less than n, and then does a isDisjoint() check on them) |
18:44 | <@ToxicFrog> | "relative primality"? |
18:44 | <@Derakon> | Two numbers are relatively prime if they share no common factors besides 1. |
18:44 | <@ToxicFrog> | Aah. |
18:44 | <@Derakon> | E.g. 4 and 9 are relatively prime. |
18:45 | <@Derakon> | (In fact, 2, 4, 5, 7, and 8 are all relatively prime to 9) |
18:46 | <@Derakon> | I'm working on PE #70, which asks me to find the n for which n <= 10**7, the number of numbers relatively prime to n is a permutation of n, and the ratio of n to the number of relative primes is minimized. |
18:46 | <@Derakon> | This requires a fast relative prime finder. |
18:48 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
18:48 | | mode/#code [+o Attilla] by ChanServ |
18:49 | < EvilDarkLord> | Derakon: I suggest starting from WP. |
18:49 | < EvilDarkLord> | I seem to recall it having some algorithms for it. |
18:50 | <@Derakon> | WP has some ways to determine if two numbers are relatively prime. But that would still require checking every number in [1, n). |
18:51 | <@Derakon> | Given the factors of n, it should be trivial to generate all numbers which are not coprimes (i.e. not relatively prime to n). |
18:53 | < EvilDarkLord> | Hmm. Well, given a fast prime finder, I think you can find relative prime counts in about O(n) for the lot of them. |
18:54 | < EvilDarkLord> | Just generate numbers from primes and lo, you shall know their factors, and from this you shall know their relative prime counts. |
18:55 | <@Derakon> | That's more or less what I was proposing to do, yeah. |
18:56 | < EvilDarkLord> | I think the most time-consuming part of this might be checking for permutativity. |
18:57 | <@Derakon> | Nah. sorted([c for c in str(n)]) == sorted([c for c in str(phi)]) |
18:57 | < EvilDarkLord> | Yes, do that ten million times and it does take a bit of time. |
18:57 | <@Derakon> | And you only need to do that when n and phi have the same order of magnitude. |
18:57 | < EvilDarkLord> | (With Python, anyway) |
18:57 | < EvilDarkLord> | That's true. Maybe it actually cuts it down noticeably. |
18:58 | | * EvilDarkLord is just a fan of solutions that run in 5 seconds or less. |
18:58 | <@TheWatcher> | So, you write in assembler a lot?~ |
18:58 | <@TheWatcher> | ¬¬ |
18:59 | < EvilDarkLord> | No, I write sensible algorithms. |
18:59 | | * Derakon adds profiling, determines that most of his time is being spent factoring numbers, despite the existence of a cache. Odd. |
18:59 | < EvilDarkLord> | Don't factor numbers. :) |
19:00 | <@Derakon> | Oh, wait, that's because the cache is invalid. Whoops. |
19:00 | < EvilDarkLord> | Make numbers from factors. Though if your cache works, it's pretty much... oh. |
19:00 | <@Derakon> | Yeah, that's a lot faster...still pretty slow, though. |
19:01 | <@Derakon> | Yeah, now I'm spending ~75% of my time in the stupid version of getRelativePrimes. |
19:01 | <@Derakon> | Which is doing an is-disjoint set check on the factors of each m < n. |
19:01 | < EvilDarkLord> | Hmm. I'm pretty sure you could add some kind of sorting here to speed it up more. I'll have to experiment when I would feel less guilty re:schoolwork for doing it. :) |
19:03 | < EvilDarkLord> | (i.e. generate just enough numbers to find the maximal one that is a permutation and ignore all others. Just a hunch, though, it might not work.) |
19:03 | <@Derakon> | Heh. |
19:06 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
19:06 | | Syloqs-AFH [Syloq@ServicesAdmin.Nightstar.Net] has quit [Ping Timeout] |
19:07 | | Syloqs_AFH [Syloq@Admin.Nightstar.Net] has joined #code |
19:08 | | Syloqs_AFH is now known as Syloqs-AFH |
19:09 | <@gnolam> | Blergh. Does SDL have any platform defines available? |
19:09 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
19:09 | | mode/#code [+o Attilla] by ChanServ |
19:09 | <@gnolam> | I.e. something that allows me to do #ifdef WINDOWS #include <foo> #endif etc. |
19:12 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
19:12 | | Attilla_ [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
19:13 | | Attilla_ is now known as Attilla |
19:14 | <@ToxicFrog> | ifdef WIN32? |
19:27 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Ping Timeout] |
19:27 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
19:27 | | mode/#code [+o Attilla] by ChanServ |
19:37 | | * TheWatcher eyes this |
19:38 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
19:39 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
19:39 | | mode/#code [+o Attilla] by ChanServ |
19:40 | <@TheWatcher> | Sometimes I vaguely wish perl's syntax for invoking functions via references in hashes wasn't quite so... meh |
19:40 | < Namegduf> | s/for invoking functions via references in hashes// |
19:41 | <@TheWatcher> | Bah |
19:49 | <@gnolam> | ToxicFrog: can one really rely on that being present though? |
19:49 | <@gnolam> | And what about other platforms? |
19:50 | | Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has joined #code |
19:50 | | * gnolam hates on C++. |
20:03 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
20:04 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
20:04 | | mode/#code [+o Attilla] by ChanServ |
20:06 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
20:06 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
20:54 | | Netsplit DeepThought.NY.US.Nightstar.Net <-> Blargh.CA.US.Nightstar.Net quits: KarmaBot, Rhamphoryncus, @GeekSoldier, SmithKurosaki |
21:30 | | Rhamphoryncus [~rhamph@Nightstar-7184.ed.shawcable.net] has joined #Code |
21:30 | | KarmaBot [~karma.bot@Nightstar-29236.neoplus.adsl.tpnet.pl] has joined #Code |
21:30 | | SmithKurosaki [~jess@Nightstar-24858.acanac.net] has joined #Code |
22:39 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
22:39 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
22:39 | | mode/#code [+o Attilla] by ChanServ |
22:53 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has quit [Connection reset by peer] |
22:54 | | Attilla [~The.Attil@Nightstar-9147.cdif.cable.ntl.com] has joined #code |
22:54 | | mode/#code [+o Attilla] by ChanServ |
23:19 | | Consul [~consul@Nightstar-1864.dsl.sfldmi.ameritech.net] has quit [Connection reset by peer] |
23:19 | | Consul [~consul@Nightstar-1864.dsl.sfldmi.ameritech.net] has joined #code |
23:19 | | mode/#code [+o Consul] by ChanServ |
23:30 | <@Derakon> | You know it's a bad sign when estimates show your algorithm needing over two hours to terminate. |
23:35 | <@Derakon> | Cutting it down to 57% of its original runtime may be an improvement, but not enough of one... |
23:37 | <@TheWatcher> | :/ |
23:37 | <@TheWatcher> | Can you parallelize it? ¬¬ |
23:38 | <@Derakon> | Trivially. But as this is a PE problem, there should be an algorithm that gets my results in a fraction of the time. |
23:39 | <@Derakon> | (The question is to find the number of numbers n < 10^9 where n + reverse(n) is composed only of odd digits) |
23:46 | <@ToxicFrog> | Is 1 considered to be 1 or 0000000001? |
23:46 | <@Derakon> | No leading or trailing zeros allowed, but reverse(1) = 1. |
23:46 | <@Derakon> | In other words, if n % 10 == 0, skip it. |
23:50 | | You're now known as TheWatcher[T-2] |
23:50 | <@ToxicFrog> | Ok. |
23:54 | | You're now known as TheWatcher[zZzZ] |
23:57 | <@Derakon> | I suspect what I need to do is have smarter culling in place. For example, when I get to checking 54x, I should know that for x < 5, I've already checked the number, and thus need not do the full test. |
--- Log closed Wed Apr 29 00:00:28 2009 |