Search

Sunday, July 31, 2011

Java 7 now available, 5 years after the last update. Here are the new features and facts

Java 7 now available, 5 years after the last update. Here are the new features and facts: "submitted by geeklove3r
[link] [15 comments]"

Apache and Oracle warn of serious Java 7 compiler bugs

Apache and Oracle warn of serious Java 7 compiler bugs: "submitted by UyenIFW
[link] [6 comments]"

iPhone 5 will be thinner, wider, and longer than the iPhone 4

iPhone 5 will be thinner, wider, and longer than the iPhone 4: "Recent photos suggest that the iPhone 5 will sport a completely redesigned form factor and will be thinner, longer, and wider than the iPhone 4."

5 reasons Google+ is here to stay

5 reasons Google+ is here to stay: "A few weeks in, the honeymoon period is over for Google+ and it seems like some people are already losing interest. Yes, the backlash has already begun. But is Google+ going to fail? In a word: No+."

Martin Owens: Python List Inheritance Post Creation Pattern

Martin Owens: Python List Inheritance Post Creation Pattern: "

One of the fun things to do with python is to use the language to bend the rules of programming. One neat way of using your resources wisely with objects is to create objects in the right places, but not generate or call costly data gathering operations until you absolutely need to.


So called ‘late data initialisation’ is useful in certain kinds of programs. I document here the best pattern I’ve found to turn a python list into a late data class:



class newList(list):
@property
def data(self):
if self.populate:
self.populate()
return self

def populate(self):
print 'Generating Now'
for x in range(42):
self.append( x )
self.populate = None

def __getitem__(self, key):
return super(newList, self.data).__getitem__(key)

def __len__(self):
return super(newList, self.data).__len__()

def __iter__(self):
return super(newList, self.data).__iter__()

Basically populate can be any piece of code which calls what ever it needs in order to gather the data. It’ll only be called once and to prevent having to use an __init__ variable we just clobber the method attribute. Sneaky!


When the list is used for an iteration (for loop), or if you delve into it directly for a specific item, or need to know it’s length, then we can get the data behind our object and have it contained within the list object we’re inheriting. No need for secondary list object variables dangling off of self. Ugly! Although this pattern does require that every use you want to put the object to (i.e. string, representation, slicing, dicing, mincing or conditionalising) you’ll have to make a new super method to wrap around to make sure that the data is generated if that’s the first way the list will be used.


What are your thoughts about this pattern? Do you know how to fix the init issue with a better pattern?

"

Monday, July 4, 2011

Bericht: Facebook bringt Skype-Integration - heise online

Bericht: Facebook bringt Skype-Integration - heise online: "Verschiedenen Berichten zufolge will Facebook in der kommenden Woche die Integration von Videochats per Skype präsentieren."

USA: LTE-Datenfunk stört GPS-Empfang - heise online

USA: LTE-Datenfunk stört GPS-Empfang - heise online: "US-Bürger und Navi-Hersteller protestieren gegen das im Aufbau befindliche Funknetz der Firma LightSquared, dessen Frequenzen manche GPS-Geräte stören."