Save the last dance for me: Being cute not enough for this spider when choosing a mate

SYDNEY A Sydney scientist has discovered seven new species of the tiny Australian peacock spider - a spectacularly colored, three-millimetre arachnid that dances to attract a female mate.Jurgen Otto, with the help of colleague David Knowles, made the two latest discoveries of the miniature creatures while looking for other spiders in Western Australia in November and had all seven named in the scientific journal Peckhamia last month. "They are very, very colorful, they often have iridescent scales and they do something quite remarkable. They perform a courtship dance for females, to impress them," Otto told Reuters TV on Monday.While footage of the dances is proving popular online, some female peacock spiders end up eating the colorful males if they are not impressed by the courtship. The discovery of the new spiders means there are now 48 known species, found mostly in southern Australia and which range in size from three to five millimeters. Juveniles measure just half-a-millimetre.The Sydney scientist, who studies mites during the day, developed a passion for the tiny spiders in 2005 after discovering an arachnid on a photograph he took following a bushwalk in Ku-ring-gai Chase National Park, New South Wales. Otto said the dancing spiders, who offer no threat to humans, were even proving popular with arachnophobes."They are harmless, they are cute, they are colorful, they remind people of their own cat. I often compare them with kittens with too many legs, so really people get excited when they see them," he said. "People who hate spiders confess that they actually can't help loving these ones and in time this will just change the opinions people have of spiders, I hope." (Reporting by Stefica Nicol Bikes. Writing by Patrick Johnston in Singapore. Editing by Nick Macfie)

Read more

Securely Connect to Cloudant Service From Node.JS With IBM Bluemix

IBM Cloudant is a NoSQL JSON document store that’s optimized for handling heavy workloads of concurrent reads and writes in the cloud—a workload that is typical of large, fast-growing web and mobile apps. You can use Cloudant as a fully-managed DBaaS running on public cloud platforms like IBM SoftLayer or via an on-premise version called Cloudant Local, that you can run yourself on any private, public, or hybrid cloud platform you choose.Securely connecting to your Cloudant DB is the first and most important thing for any CRUD (Create, Read, Update, Delete) operation to take place. Securely?! Yes, there's always a chance that one of us may store our DB credentials in a file like .env and push it to a public repo. To avoid this credential exposure which may cause unwanted consequences, VCAP_SERVICES environment variable, a JSON Object is introduced to safeguard the information which includes service instance name, credential, and connection URL to the service instance.Node.JS + Cloudant Boilerplate AppLet's create a Node.js boilerplate application which talks to Cloudant DB for data. If you don't own a Bluemix account yet, Create one at https://bluemix.netClick on CATALOG from the top bar (Classic Experience)Navigate to "Boilerplates" under Starters on the left pane.Select "Node.JS Cloudant DB Web starter".Now, you should see a page with an option on the right pane to enter a name for your application.Enter a name of your choice and click create.Congratulations! You have successfully created a Node.JS application with Cloudant service running at: HTTP://.bluemix.netStarter CodeOn the success page, scroll down a bit  and click on the "DOWNLOAD STARTER CODE" button to download your starter code.Open the code in any IDE of your choice. I will be using brackets as an IDE here.Navigate to the heart of the application which is app.js file and as you walk through the code you should see this:The starter code provides you a sample Favorites Organizer application with Cloudant CRUD code snippets.To see the VCAP_SERVICES Cloudant JSON, navigate to your application under DASHBOARD and click on Environment Variables on the left pane. You should see the below JSON with your credentials and URL,{ "cloudantNoSQLDB": [ { "name": "CloudantNodeJSApp-cloudantNoSQLDB", "label": "cloudantNoSQLDB", "plan": "Shared", "credentials": { "username": "", "password": "", "host": "", "port": 443, "url": "" } } ] }Quick video showing you what we've achieved so far:Connect to your Cloudant service from NodeJS. Securely on IBM Bluemix from Vidyasagar MSC on Vimeo.Using Node.JS RuntimeIf you don't want to use a boilerplate starter code and are looking to start from scratch, you can achieve the above scenario using Node.JS runtime.Navigate to CATALOG and on the left pane click on Runtimes under Compute.Select "SDK for Node.JS" and give it a name.Once the runtime is successfully created, click on Overview in the left pane and you should see an option to add a new service or bind an existing service.Click on "Add a new service or API" and select Cloudant service under Data & Analytics on the left pane.Quick video showing you how to create a Node.JS runtime with Cloudant service:Node.JS Runtime with Cloudant Service on IBM Bluemix from Vidyasagar MSC on Vimeo.If you observe, you won't find VCAP_Services in the app.js file. Add the below code snippet just before the last closing brace of app.js.if (process.env.VCAP_SERVICES) { // Running on Bluemix. Parse the port and host that we've been assigned. var env = JSON.parse(process.env.VCAP_SERVICES); var host = process.env.VCAP_APP_HOST; var port = process.env.VCAP_APP_PORT; // Also parse Cloudant settings. var credentials = env['cloudantNoSQLDB'][0]['credentials']; username = credentials.username; password = credentials.password; }There are two key things to be aware of  while using VCAP_SERVICES at this point...When running or testing locally, VCAP_SERVICES won't be available so your Node.JS app will return an error. One way to resolve this is to push your code to GIT and deploy the code as and when there are critical updates or changes to the code.The value of the VCAP_SERVICES environment variable is available only when you bind a service instance to your application.This means that it's not available when you create a Cloudant service alone. It should be bound to an application.My next blog post will be on how to run your Node.JS Cloudant app locally for testing. Stay Tuned!

Read more

Solar plane lands in Dayton, Ohio on latest leg of round-the-world flight

An experimental airplane powered solely by energy from the sun landed in Ohio on Saturday night on the latest leg of its historic bid by pilots and developers to fly around the globe without a drop of fuel. The single-seat Solar Impulse 2 aircraft arrived in Dayton shortly before 10 p.m. local time, some 17 hours after leaving Phoenix Goodyear Airport, the project team said on its official Twitter page."People told the Wright Brothers & us what we wanted to achieve was impossible," said Bertrand Piccard after landing. "They were wrong!" The locale was of special significance to the pilots, as the home base to aviation pioneers Orville and Wilbur Wright. Amanda Wright Lane, a descendant of the brothers, neither of whom ever married, was on hand to welcome the flight. With a wingspan exceeding that of a Boeing 747 but an ultra-light carbon-fiber skin and overall weight of a car, the Solar Impulse cruises at speeds ranging from only 34 to 62 miles per hour (55 to 100 kph). The four engines of the propeller-driven aircraft are powered exclusively by energy collected from more than 17,000 solar cells built into its wings. Excess energy is stored in four batteries during daylight hours to keep the plane flying after dark.The plane can climb to 28,000 feet (8,500 meters), but generally flies at lower altitudes at night to conserve energy. Piccard and Andre Borschberg have been taking turns piloting the plane on each leg of the journey. Both have trained to stay alert for long stretches of time by practicing meditation and hypnosis.Borschberg set a new endurance record for the longest non-stop solo flight last July during a 118-hour trans-Pacific crossing, over five days and five nights, from Japan to Hawaii. He also set new duration and distance records for solar-powered flight. Battery damage sustained during the crossing kept the aircraft grounded for nine months. The Swiss team's ultimate goal is to achieve the first round-the-world solar-powered flight, part of its campaign to bolster support for clean-energy technologies.The team hopes eventually to complete its circumnavigation in Abu Dhabi, the starting point for the journey in March 2015.The two men completed an earlier multi-flight crossing of the United States in a prototype of the solar plane in 2013 as a precursor to their globe-circling quest. (Reporting by Chris Michaud and Steve Gorman)

Read more

Corvex discloses large Pandora stake, pushes for sale-letter

Corvex Management LP disclosed on Monday that it owns 9.9 percent of Pandora Media Inc and urged the internet music streaming company to explore a sale instead of pursuing a "costly and uncertain business plan." Corvex, a hedge fund run by Keith Meister, a protégé of billionaire activist investor Carl Icahn, said it had met with the company's management and had withdrawn a plan to replace some of its board members. However, it now believes Pandora should hire an investment bank to help the company explore its strategic options including a sale."We believe there is likely to be significant strategic interest in the company at a substantial premium to the company's recent stock price," Corvex said, adding that large internet companies, handset makers and media companies could be potential buyers.Pandora's shares are down more than 25 percent in 2016 and more than 45 percent year-over-year. Corvex owns about 22.7 million shares in the company, making the hedge fund Pandora's largest shareholder. Pandora said in response that it is in constant dialogue with shareholders and committed to achieving long-term value for them. "Pandora has a profitable core business, combined with a strong balance sheet. We are confidently investing to fully capture the massive opportunity ahead of us," the company said in a statement. Oakland, California-based Pandora has faced tough competition from music-streaming rivals such as Spotify, Apple Inc , Alphabet Inc's Google and Amazon.com and has failed to turn an annual profit as a public company. Analysts have said Pandora, which had a market capitalization of $2.29 billion on Monday, could be an acquisition target for larger media or internet companies looking to beef up their online music offerings. Pandora co-founder Tim Westergren, a former musician who spearheaded Pandora's music algorithm technology, returned to the company March 28 to become CEO, squashing some investors' hopes the company could be sold.Westergren told Reuters on April 15, "If you want to sell a company, you don't do that by spending half a billion on acquisitions and hiring a new CEO." Unlike other streaming services, which have negotiated deals with record labels to allow listeners to pick songs, Pandora has acted more like a radio station, playing songs that match a genre but not allowing customers to make selections. Pandora is now playing catch-up and negotiating with record labels for the licenses it needs to offer more on-demand music services. (additional reporting by Julia Love in San Francisco; Editing by Cynthia Osterman and Andrew Hay)

Read more

Singletons Are Fine

This one’s gonna be short. Honestly, I don’t know how last week’s article about static methods went so long.Singletons get a bad rap, being called Anti-patterns, and for good reason. The biggest reason given against Singletons is that they’re global state, which is bad. If you want a stateful “Singleton”, there are ways to restrict the application to only having a single instance, even if the class can have multiple instances. While this still largely equates to global state, at least it opens up the possibility of test doubles and makes the “Singleton” itself that much easier to test.But I’m not here to nag about stateful Singletons; there’s already plenty of that on the interwebz. No, I’m here to tell that there can be an okay usage for Singletons: as Strategies. Singletons don’t have to be stateful. If you have a stateless Strategy type, making it into a singleton can actually be helpful, reducing the memory overhead of potentially extra instances of the class. Often, you’ll want to lazily load it.Python actually had an interesting way of doing Singletons that I’ve never actually even heard anyone talk about. What’s interesting about classes in Python is that they can be used just like any other instance, so you can just put static methods on a class and use it like an instance.For an example, say we have a Strategy interface/protocol with the methods strat1() andstrat2(), you can make a Strategy class like this:class AStrategy: @staticmethod def strat1(): ... @staticmethod def strat2(): ...This class can be used as an instance of a Strategy:AStrategy.strat1() AStrategy.strat2()You can do that with static methods in other languages too, but the classes in those languages can’t be passed in as instances of a Strategy type. In Python, you can just pass in AStrategy as an instance:func_that_uses_strategy(AStrategy)You barely have to do anything special to get a class to be a Singleton in Python; it’s pretty neat. It even works with stateful Singletons, but that’s bad, remember?

Read more
Older PostNewer Post