Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

06-23-2011 , 03:32 PM
doesn't it depend if there are elses to go with some of the ifs? If there are, it has to be 1, or a load of repetition. I usually go for 1 anyway for the purposes of easily adding elses to a step.

IF there's no elses going to be needed I go for 2 always, even if it means a long line.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 04:30 PM
linked from the anti pattern link
http://thedailywtf.com/Articles/Codi...de-France.aspx

i must say some of my code is looking like that
haha
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 04:37 PM
Reminds me of this (HTML source showing Mt. Fuji)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 04:41 PM
Quote:
Originally Posted by _dave_
doesn't it depend if there are elses to go with some of the ifs? If there are, it has to be 1, or a load of repetition. I usually go for 1 anyway for the purposes of easily adding elses to a step.

IF there's no elses going to be needed I go for 2 always, even if it means a long line.
Of course it's all heavily context dependent, e.g. many nested if/else-statements inside a class method are not only a target for refactoring but often also hint at other code flaws, whereas nested conditionals in bash scripts not necessarily mean bad code.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 05:02 PM
Quote:
Originally Posted by iggster
namely the Arrow Anti Pattern.
Is it just me or this site really difficult to read?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 05:04 PM
Nope, I thought that too.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 06:32 PM
It's The Wiki.

So it's the product of community editing and discussion.

So it's not just you.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-23-2011 , 07:12 PM
Quote:
Originally Posted by iggster
Reminds me of this (HTML source showing Mt. Fuji)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 05:12 PM
for all you web guys out there, I had to steal an IP address from our webserver all but the primary one were used for some sort of SSL stuff, so i used that.

However, my dns records all point to x.x.x.118 which is now nothing, and needs to be changed to x.x.x.119. Is there a quick way to get this to progate after i change them in the dns?

My website is currently offline because of this to some people until they /flushdns.

Is there a better way to change the ip address even?


I am guessing the correct solution would be to update the dns TTL to be very short on all the records before changing the IP and then waiting until the longer TTL has passed then switching the IP? That way the interruption time is less than a very small TTL...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 06:58 PM
Quote:
Originally Posted by Jeff_B
the only solution would be to update the dns TTL to be very short on all the records before changing the IP and then waiting until the longer TTL has passed then switching the IP? That way the interruption time is less than a very small TTL...
afaik. and don't forget that then the change has to propagate through all the dns servers in the universe, which will take some time.

in the short term, you'll have to just tell people to flush their dns cache.

or you could set up something on the old IP that forwards to the new IP, although if you've got ssl stuff going on that will probably not work well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 07:24 PM
DNS propogation the last few times I've tried has been < 1 hour. I say less than one hour, when it was actually < 10 mins, but I'm being safe by saying 1 hour. <10 mins was tested from a USA proxy and here in the UK.

When I first started developing years and years ago the recommended time was ~1 week, realistically it would usually do it within 5 days. So nice now it's that much quicker!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 07:45 PM
ISP DNS is so evil.

But iOS 5 Beta 2 should be good fun. Especially given that one particular feature is now enabled...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 09:08 PM
Downloading for my iPad now, hopefully I can get the 3G to work before I go to Australia next month...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 09:16 PM
Ugly linq query of the day:

Code:
    var q = (
        from c in db.tblTags
        where
            !(from o in db.tblTagSynonyms
                select o.SynonymTagID)
            .Contains(c.ID)
            &&
            c.Name.CompareTo(AnchorTagName) < 1
        orderby c.Name descending
        select new
            {
                c.ID,
                c.Name,
                c.Priority,
                TotalResources = (from a in db.tblTagAnchors where a.TagID == c.ID select new { a.ID }).Count()
            }
        ).Take(8).ToArray().Reverse().Union(
        from c in db.tblTags
        where
            !(from o in db.tblTagSynonyms
                select o.SynonymTagID)
            .Contains(c.ID)
            &&
            c.Name.CompareTo(AnchorTagName) >= 1
        orderby c.Name ascending
        select new
        {
            c.ID,
            c.Name,
            c.Priority,
            TotalResources = (from a in db.tblTagAnchors where a.TagID == c.ID select new { a.ID }).Count()
        }
    ).Skip(1).Take(13).ToArray();
Given an alphabetical list of tags, given a tag "Tutorial", how do you return the 5 tags before it and the 5 after? Turns out to be a bit of a problem query lol. Took me a while to figure out, it looks gross but it works 100% fine, if anyone knows a better way of doing this in LINQ or SQL let me know I'd be interested!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 09:50 PM
Quote:
Originally Posted by kerowo
Downloading for my iPad now, hopefully I can get the 3G to work before I go to Australia next month...
Looks like there is an issue restoring the beta 2 software from xcode, restoring it from iTunes is the way to make the device work again. It appeared a little bricked when I did it from xcode but iTunes saw it and I'm restoring from there...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 10:40 PM
Yeah you just back up under beta 1 iTunes... then restore under beta 2. I can imagine it's annoying if you didn't back up first though...

Just like it's annoying that I read again and found you need Lion beta to use wireless sync... blah.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 10:58 PM
Quote:
Originally Posted by Gullanian
Ugly linq query of the day:

//snip

Given an alphabetical list of tags, given a tag "Tutorial", how do you return the 5 tags before it and the 5 after? Turns out to be a bit of a problem query lol. Took me a while to figure out, it looks gross but it works 100% fine, if anyone knows a better way of doing this in LINQ or SQL let me know I'd be interested!
Dear god man! Step 1, don't make it all one big statement. Step 2, comment the **** out of it. Step 3, ask people that are smarter than you how to do it better.

I have never used LINQ, so I can't actually give you a better way to do it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 11:06 PM
Random thought experiment about licensing.

I write a class (as part of a larger project) that performs a simple task. The project is released GPL.

I now start a new project that also requires the same simple task. However, I want this new project to remain close source. Since I have deep understanding of GPL-ed code that performs this simple task, can I write a closed source implementation of the same task? For the sake of argument, we'll ignore the fact that I am the sole license holder and would not file charges against myself.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 11:32 PM
If you wrote the original yourself, you can go as far as copy/paste it and release it closed-source.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-24-2011 , 11:49 PM
Quote:
The GPL is the first copyleft license for general use, which means that derived works can only be distributed under the same license terms. Under this philosophy, the GPL grants the recipients of a computer program the rights of the free software definition and uses copyleft to ensure the freedoms are preserved, even when the work is changed or added to. source
Wouldn't that make the new project a derived work? Derived works must be released under the same license.

Or are we playing of the fact that I am not really a recipient of the code and thus, have different rights?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-25-2011 , 12:00 AM
exactly. if you write something, you can release it multiple times under as many licenses as you wish with no problem. If you find someone else's GPL class to perform the simple task and use it, now your project is a derivative work.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-25-2011 , 12:00 AM
Quote:
Originally Posted by Neil S

Just like it's annoying that I read again and found you need Lion beta to use wireless sync... blah.
It works with the new 10.6.8 update, probably need the new beta iTunes. There is a check box for it on the Summary screen. I'm not sure how you get the iPad back in iTunes but will worry about that later.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-25-2011 , 12:40 AM
Quote:
Originally Posted by kerowo
It works with the new 10.6.8 update, probably need the new beta iTunes. There is a check box for it on the Summary screen. I'm not sure how you get the iPad back in iTunes but will worry about that later.
INteresting. Will have to break down and update then I guess.

Was about to say I only like to reboot once a month, and my uptime is 30 days, 6:21, so I guess I'm due anyway.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-25-2011 , 12:57 AM
Quote:
# Helper code
# (you don't need to understand this helper code)
would only be better if it was written:


Quote:
# Write your code
# (you don't need to understand this code)
Working on problem set 5 to 6, which is creating a word game. I almost feel like a real programmer with this one.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-25-2011 , 01:44 AM
Dangit, it still won't sync. I'd already installed the new iTunes beta. No go. Then I updated to the new Snow Leopard. No go.

It just does what it did in the last beta, say that it's waiting for my system before it will sync. Definitely on the same network.

Oh well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m