Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Tech Guides

851 Articles
article-image-top-10-it-certifications-for-cloud-and-networking-professionals-in-2018
Vijin Boricha
05 Jul 2018
7 min read
Save for later

Top 10 IT certifications for cloud and networking professionals in 2018

Vijin Boricha
05 Jul 2018
7 min read
Certifications have always proven to be one of the best ways to boost one’s IT career. Irrespective of the domain you choose, you will always have an upperhand if your resume showcases some valuable IT certifications. Certified professionals attract employers as certifications are an external validation that an individual is competent in that said technical skill. Certifications enable individuals to start thinking out of the box, become more efficient in what they do, and execute goals with minimum errors. If you are looking at enhancing your skills and increasing your salary, this is a tried and tested method. Here are the top 10 IT certifications that will help you in uprising your IT career. AWS Certified Solution Architect - Associate: AWS is currently the market leader in the public cloud. Packt Skill Up Survey 2018 confirms this too. Source: Packt Skill Up Survey 2018 AWS Cloud from Amazon offers a cutting-edge platform for architecting, building, and deploying web-scale cloud applications. With rapid adaptation of cloud platform the need for cloud certifications has also increased. IT professionals with some experience of AWS Cloud, interested in designing effective Cloud solutions opt for this certification. This exam promises to scale your ability of architecting and deploying secure and robust applications on AWS technologies. Individuals who fail to pass an exam must wait 14 days before they are eligible to retake the exam. There isn’t any attempt limit for this exam. AWS Certification passing scores depend on statistical analysis and are subject to change. Exam Fee: $150 Average Salary: $119,233 per annum Number of Questions: 65 Types of Question: MCQ Available Languages: English, Japanese AWS Certified Developer - Associate: This is another role-based AWS certification that has gained enough traction for industries to keep it as a job validator. This exam helps individuals validate their software development knowledge which helps them develop cloud applications on AWS. IT professionals with hands-on experience in designing and maintaining AWS-based applications should definitely go for this certification to stand-out. Individuals who fail to pass an exam must wait 14 days before they are eligible to retake the exam. There isn’t any attempt limit for this exam. AWS Certification passing scores depend on statistical analysis and are subject to change. Exam Fee: $150 Average Salary: $116,456 per annum Number of Questions: 65 Types of Question: MCQ Available Languages: English, Simplified Chinese, and Japanese Project Management Professional (PMP) Project management Professional is one of the most valuable certifications for project managers. The beauty of this certification is that it not only teaches individuals creative methodologies but makes them proficient in any industry domain they look forward to pursuing. The techniques and knowledge one gets from this certification is applicable in any industry globally. This certification promises that PMP certified project managers are capable of completing projects on time, in a desired budget and ensure meeting the original project goal. Exam Fee: Non-PMI Members: $555/ PMI Members: $405 Average Salary: $113,000 per annum Number of Questions: 200 Type of Question: A combination of Multiple Choice and Open-end Passing Threshold: 80.6% Certified Information Systems Security Professional (CISSP) CISSP is one of the globally recognized security certifications. This cybersecurity certification is a great way to demonstrate your expertise and build industry-level security skills. On achieving this certification users will be well-versed in designing, engineering, implementing, and running an information security program. Users need at least 5 years of minimum working experience in order to be eligible for this certification. This certification will help you measure your competence in designing and maintaining a robust environment. Exam Fee: $699 Average Salary: $111,638 per annum Number of Questions: 250 (each question carries 4 marks) Type of Question: Multiple Choice Passing Threshold: 700 marks CompTIA Security+ CompTIA Security+ certification is a vendor neutral certification used to kick-start one’s career as a security professional. It helps users get acquainted to all the aspects related to IT security. If you are inclined towards systems administration, network administration, and security administration, this is something that you should definitely go for. With this certification users learn the latest trends and techniques in risk management, risk mitigation, threat management and intrusion detection. Exam Fee: $330 Average Salary: $95,829 per annum Number of Questions: 90 Type of Question: Multiple Choice Available Languages: English (Japanese, Portuguese and Simplified Chinese estimated Q2 2018) Passing Threshold: 750/900 CompTIA Network+ Another CompTIA certification! Why? CompTIA Network+ is a certification that helps individuals in developing their career and validating their skills to troubleshoot, configure, and manage both wired and wireless networks. So, if you are an entry-level IT professional interested in managing, maintaining, troubleshooting and configuring complex network infrastructures then, this one is for you. Exam Fee: $302 Average Salary: $90,280 per annum Number of Questions: 90 Type of Question: Multiple Choice Available Languages: English (In Development: Japanese, German, Spanish, Portuguese) Passing Threshold: 720 (on a scale of 100-900) VMware Certified Professional 6.5 – Data Center Virtualization (VCP6.5-DCV) Yes, even today virtualization is highly valued in a lot of industries. Data Center Virtualization Certification helps individuals develop skills and abilities to install, configure, and manage a vSphere 6.5 infrastructure. This industry-recognized certification validates users’ knowledge on implementing, managing, and troubleshooting a vSphere V6.5 infrastructure. It also helps IT professionals build a  foundation for business agility that can accelerate the transformation to cloud computing. Exam Fee: $250 Average Salary: $82,342 per annum Number of Questions: 46 Available language: English Type of Question: Single and Multiple Choice Passing Threshold: 300 (on a scale of 100-500) CompTIA A+ Yet another CompTIA certification that helps entry level IT professionals have an upper hand. This certification is specially for individuals interested in building their career in technical support or IT operational roles. If you are thinking more than just PC repair then, this one is for you. By entry level certification I mean this is a certification that one can pursue simultaneously while in college or secondary school. CompTIA A+ is a basic version of Network+ as it only touches basic network infrastructure issues while making you proficient as per industry standards. Exam Fee: $211 Average Salary:$79,390 per annum Number of Questions: 90 Type of Question: Multiple Choice Available Languages: English, German, Japanese, Portuguese, French and Spanish Passing Threshold: 72% for 220-801 exam and 75% for 220-802 exam Cisco Certified Networking Associate (CCNA) Cisco Certified Network Associate (CCNA) Routing and Switching is one of the most important IT certifications to stay up-to date with your networking skills. It is a foundational certification for individuals interested in a high level networking profession. The exam helps candidates validate their knowledge and skills in networking, LAN switching, IPv4 and IPv6 routing, WAN, infrastructure security, and infrastructure management. This certification not only validates users networking fundamentals but also helps them stay relevant with skills needed to adopt next generation technologies. Exam Fee: $325 Average Salary:$55,166-$90,642 Number of Questions: 60-70 Available Languages: English, Japanese Type of Question: Multiple Choice Passing Threshold: 825/1000 CISM (Certified Information Security Manager) Lastly, we have Certified Information Security Manager (CISM), a nonprofit certification offered by ISACA that caters to security professionals involved in information security, risk management and governance. This is an advanced-level certification for experienced individuals who develop and manage enterprise information security programs. Only users who hold five years of verified experience, out of which 3 year of experience in infosec management, are eligible for this exam. Exam Fee: $415- $595 (Cheaper for members) Average Salary: $52,402 to $243,610 Number of Questions: 200 Passing Threshold: 450  (on a scale of 200-800) Type of Question: Multiple Choice Are you confused as to which certification you should take-up? Well, leave your noisy thoughts aside and choose wisely. Pick-up an exam that is inclined to your interest. If you want to pursue IT security don’t end-up going for Cloud certifications. No career option is fun unless you want to pursue it wholeheartedly. Take a right step and make it count. Why AWS is the prefered cloud platform for developers working with big data? 5 reasons why your business should adopt cloud computing Top 5 penetration testing tools for ethical hackers  
Read more
  • 0
  • 0
  • 2515

article-image-internet-things-or-internet-thieves
Oli Huggins
07 Jan 2014
3 min read
Save for later

Internet of Things or Internet of Thieves

Oli Huggins
07 Jan 2014
3 min read
While the Internet of Things(IoT) sounds like some hipster start-up from the valley, it is in actual fact sweeping the technology world as the next big thing and is the topic of conversation (and perhaps development) through the majority of the major league tech titans. Simply, the IoT is the umbrella term for IP-enabled every day devices with the ability to communicate over the Internet. Whether that is your fridge transmitting temperature readings to your smartphone, or your doorbell texting you once it has been rung, anything with power (and even some without) can be hooked up to the World Wide Web and be accessed anywhere, anytime. This will of course have a huge impact on consumer tech, with every device under the sun being designed to work with your smartphone or PC, but whatäó_s worryingis how all this is going to be kept secure. While there are a large number of industry leading brands we can all trust (sometimes), there are an even bigger number of companies shipping devices out of China at extremely low production (and quality) costs. This prompts the questionäóñif the companyäó_s mantra is low cost products and mass sales, do they have the time, money (or care) to have an experienced security team and infrastructure to ensure these devices are secure? Iäó_m sure you know the answer to that question. Unconvinced? How about TrendNetcams back in 2012äó_ The basic gist was that a flaw in the latest firmware enabled you to add /anony/mjpg.cgi to the end of one of the camsäó_ IP addresses and you would be left with a live stream of the IP camera. Scary stuff (and some funny stuff) but this was a huge mistake made by what seems to be a fairly legitimate company. Imagine this on a much larger scale, with many more devices, being developed by much more dubious companies. Want a more up-to-date incident? How about a hacker gaining access to a Foscom IP camera that a couple was using to watch over their child, and the hacker screaming "Wake up, baby! Wake up, baby!äó_ Iäó_ll leave you to read more about that. With the suggestion that by 2020 anywhere between 26 and 212 billion devices will be connected to the Internet, this opens up an unimaginable amount of attack vectors, which will be abused by the black hats among us. Luckily, chip developers such as Broadcom have seen the payoff here by developing chips with a security infrastructure designed for wearable tech and the IoT. The newBCM20737 SoC provides äó_ Bluetooth, RSA encryption and decryption capabilities, and Appleäó_s iBeacon device detection technologyäó_ adding another layer of security that will be of interest to most tech developers. Whether the cost of such technology will appeal to all though is another thing altogetheräóîlow cost tech developers will just not bother. Now, I see the threat of someone hacking your toaster and burning your toast is not something you would worry about, but imagine healthcare implants or house security being given the IoT treatment. Not sure Iäó_d want someone taking control of my pacemaker or having a skeleton key to my house! Security is one of the major barriers to total adoption of the IoT, but is also the only barrier that can be jumped over and forgotten about by less law abiding companies. If I were to give anyone any advice before äó_connectingäó_, it would be to spend your money wisely, donäó_t go cheap, and avoid putting yourself in compromising situations around your IoT tech.
Read more
  • 0
  • 0
  • 2515

article-image-beyond-the-bitcoin
Packt
09 Oct 2017
2 min read
Save for later

Beyond the Bitcoin: How cryptocurrency can make a difference in hurricane disaster relief

Packt
09 Oct 2017
2 min read
More than $350 worth of cryptocurrency guides offered in support of globalgiving.com During Cybersecurity Month, Packt is partnering with Humble Bundle and three other technology publishers – Apress, John Wiley & Sons, No Starch Press - for the Humble Book Bundle: Bitcoin & Cryptocurrency, a starter eBook library of blockchain programming guides offered for as little as $1, with each purchase supporting hurricane disaster relief efforts through the nonprofit, GlobalGiving.org. Packed with over $350 worth of valuable developer information, the bundle offers coding instruction and business insights at every level – from beginner to advanced. Readers can learn how to code with Ethereum while at the same time learning about the latest developments in cryptocurrency and emerging business uses of blockchain programming. As with all Humble Bundles, customers can choose how their purchase dollars are allocated, between the publishers and charity, and can even “gift” a bundle purchase to others as their donation. Donations for as little as $1USD can support hurricane relief. The online magazine retailer, Zinio, will be offering a limited time promotion of some of their best tech magazines as well. You can find the special cryptocurrency package here. "It's very unusual for tech publishers who normally would compete to come together to do good work for a good cause," said Kelley Allen, Director of Books at Humble Bundle. "Humble Books is really pleased to be able to support their efforts by offering this collection of eBooks about such a timely and cutting-edge subject of Cryptocurrency". The package of 15 eBooks includes recent titles Bitcoin for Dummies, The Bitcoin Big Bang, BlockChain Basics, Bitcoin for the Befuddled, Mastering Blockchain, and the eBook bestseller, Introducing Ethereum and Solidity. The promotional bundles are being released globally in English, and are available in PDF, .ePub and .Mobi formats. The offer runs October 9 through October 23, 2017.
Read more
  • 0
  • 0
  • 2513

article-image-nwjs-app-and-shortcut-apis
Adam Lynch
18 Dec 2015
5 min read
Save for later

NW.js: The App and Shortcut APIs

Adam Lynch
18 Dec 2015
5 min read
The NW.js GUI library provides an "App" API, which contains a variety of methods and properties, some of which are essential to pretty much any app, and some have more obscure use cases. You can access the API as follows: var gui = require('nw.gui'); gui.App.quit(); As you can see from the example, the App API contains a quit method, which will kill your application. gui.App.argv, gui.App.dataPath, and gui.App.manifest are properties containing an array of arguments passed to your application when it was executed, an object representing your app's JSON manifest, and the application's data path in user's directory. gui.App.dataPath is typically a directory with the name you gave as the name property in your app manifest, located in the current user's "AppData/Local/" directory on Windows, ~/Library/Application Support/ on Mac OS X, or in ~/.config/ on Linux. vargui. = require('nw.gui'); gui.App.on('open', function(command){ gui.App.closeAllWindows(); }); The App API gives us two events we can listen for: open and reopen. The open event is fired when someone opens a file with your application, i.e. from the command line like: myapp a.txt. The function passed will receive the entire command (myapp a.txt) as the only argument. The reopen is exclusive to Mac OS X and is fired when the user clicks the dock icon for your app while it is already running. Also used in the example is the gui.App.closeAllWindows method which could come in handy if your app contains multiple windows. Other methods out of scope for this post include ones for getting and setting proxy configuration, editing cross-origin policies, setting where crash dumps get written to when NW.js itself crashes, and forcing a crash in the browser or renderer. Keyboard shortcuts This is also where you'll find methods to add or remove "global hot keys", i.e. keyboard shortcuts. To add a shortcut, you could do like this: var gui = require('nw.gui'); var shortcut = newgui.Shortcut({ key : "V", active : function() { console.log("Shortcut: " + this.key + " pressed."); }, failed : function(msg) { // Error adding / parsing the key console.log(msg); } }); gui.App.registerGlobalHotKey(shortcut); With the above code, any time the user presses the A key, the active callback is called. We create a new Shortcut instance (another piece of the the NW.js' GUI library) and pass it to gui.App.registerGlobalHotKey. The failed callback is called if there was a problem adding or parsing the key option. This is useful for development because there are some peculiar restrictions on what can be passed as the key option. The key option has to contain exactly one "key" (no more, no less) and can contain zero or more "modifiers". A "key" is one of the following: A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Insert, Delete, Arrow keys (Up, Down, Left, Right) and the Media Keys (MediaNextTrack, MediaPlayPause, MediaPrevTrack, MediaStop). The supported "modifiers" are: Ctrl, Alt, and Shift. Strangely, it was decided that on Mac OS X Ctrl would bind to Command instead, intentionally. I find this very strange as it seems you cannot bind any shortcuts which use the ctrl key on a Mac because of this. Hopefully in a future version Ctrl will map to Ctrl, Command will be supported, and it would be up to the user to check the current platform and bind to the correct keys accordingly. For clarity, here are a few example key bindings: - A: Valid. - A+B: Fails; you're not allowed to have multiple "keys". - Alt+Shift+T: Valid. - Ctrl+B: Valid but maps to Command+B on Mac OS X. It's not recommended to bind a shortcut to just one "key" like the A key as it'll block usage of that key for other applications while your app is running or until your app "unregisters" it. Unbinding a shortcut The API is pretty symmetric in that you can call gui.App.unregisterGlobalHotKey to remove or unbind a shortcut. You do have to pass the Shortcut instance again though which is a bit awkward. Thankfully, you can also pass a new Shortcut instance with just the key option as a workaround. So either of the last two lines here would work: var gui = require('nw.gui'); var shortcut = newgui.Shortcut({ key : 'V', active : function() { console.log('Shortcut: ' + this.key + ' pressed.'); }, failed : function(msg) { console.log(msg); } }); gui.App.registerGlobalHotKey(shortcut); gui.App.unregisterGlobalHotKey(shortcut); // option 1 gui.App.unregisterGlobalHotKey({key: 'V'}); // option 2 Events The Shortcut instance emits active and failed events as well as accepting them as options. You could either or both if you'd like. Here's an unrealistic example: var gui = require('nw.gui'); var shortcut = newgui.Shortcut({ key : 'V', active : function() { console.log('ACTIVE: Constructor option'); }, failed : function(msg) { console.log('FAILED (Constructor option): ' + msg); } }); shortcut.on('active', function(){ console.log('ACTIVE: Event listener'); }); shortcut.on('failed', function(msg){ console.log('FAILED (Event listener): ' + msg); }); gui.App.registerGlobalHotKey(shortcut); System-wide These shortcuts are system-wide and will be called even if your app isn't focused. If you'd like to have shortcuts which do something when your app is focused, then you could check if the app is focused in the active callback using the Window API we'll cover later. Summary and Alternative This article provides a quick look at the App API, but if you really need to bind to keys, which aren't supported by this API, or if you can't use this API because your app will be used in both NW.js and on the Web, then you could use a JavaScript library to bind your shortcuts. These will not be "global" or "system-wide" though. About The Author Adam Lynch is a TeamworkChat Product Lead & Senior Software Engineer at Teamwork. He can be found on Twitter @lynchy010.
Read more
  • 0
  • 0
  • 2506

article-image-apple-usb-restricted-mode-everything-you-need-to-know
Amarabha Banerjee
15 Jun 2018
4 min read
Save for later

Apple USB Restricted Mode: Here's Everything You Need to Know

Amarabha Banerjee
15 Jun 2018
4 min read
You must have heard about the incident where the FBI was looking to unlock the iPhone of a mass shooting suspect (one of the attackers in the San Bernardino shooting in 2015). The feds could not unlock the phone, as Apple didn’t budge from their stand of protecting user data. After a few days, police said that they have found a private agency to open the phone. The seed of that feud between the feds and Apple has evolved into a fully grown tree now. This month, Apple announced a new security feature called restricted USB mode. This disables the device’s lightning port after one hour of being locked. Quite expectedly, the law enforcement agencies are not at ease with this particular development. This feature was first introduced in the iOS 11.3 release and then retracted in the next release. But now Apple plans to introduce this feature in the upcoming iOS 12 beta release. The reason as stated by Apple is to protect user data from third party hackers and malwares which have the potential to access iPhone data remotely. You must be wondering, to what extent are these threats genuine. Whether this will mean you locking yourself out of your phone unwittingly with nothing to get you out of the situation. Well, the answer is multilayered. Firstly, if you are not an avid supporter of data privacy and feel you have nothing to hide, then this move might just annoy you for a while. You might wonder about times  when your phone is locked and suddenly forget your unlocking/ passkey. Pretty simple, write it somewhere safe and remember where you have kept it. But in case you are like me, you keep seeing the recent news of user data being hacked, and that worries you. Users are being profiled by different companies for varying end objectives from selling products to shaping up your opinion about politics and other aspects of your life. As such this news might make you a bit comfortable about your next iOS update. Private agencies coming up with solutions to open locked iPhones worried Apple. Companies like Cellebrite and Grayshift are selling devices that can hack any locked Apple device (iPhone and iPad) by using the lightning port. The apparent price of one such device is around 15k USD. What prompted Apple to introduce this security feature into their devices was that government agencies were buying these devices on a regular basis to hack into devices. Hence the threat was real, and the only way to address over 700 million iPhone users’ fears seemed to be introducing the USB restricted mode. The war is however just beginning. Third party companies are already claiming that they have devised a way to overcome this new security feature, which is yet unconfirmed. But Apple is sure to take cognizance of this fact and press their developers more to stay ahead in this cat and mouse game. This has not gone well with the law enforcement agencies as well, they see it as an attempt by Apple to create more hurdles in preventing serious and heinous crimes such as paedophilia. Their side of the argument states that now with the one hour timer since the user locks his or her phone, it becomes much more difficult for them to indict the guilty because they have more room to escape. What do you think this means? Does this give you more faith on your Apple product and will it really compel you to buy that $1200 iPhone with the confidence that your banking data, personal messages, pictures and your other sensitive data are safe at the hands of Apple? Or will it empower the perpetrators of crime to have more confidence that now their activities are not just protected by a passkey, but by an hour of time since they lock it, after which it becomes a black box? No matter what your thoughts are, the war is on, between hackers and Apple. If you belong to either of these communities, these are exciting times. If you are one of the 700 million Apple users, you can feel a bit more secure after the iOS 12 update rolls out. Apple changes app store guidelines on cryptocurrency mining Apple introduces macOS Mojave with UX enhancements like voice memos, redesigned App Store Apple releases iOS 11.4 update with features including AirPlay 2, and HomePod among others
Read more
  • 0
  • 0
  • 2500

article-image-reactive-programming-rxswift
Darren Sapalo
13 May 2016
7 min read
Save for later

Reactive Programming with RxSwift

Darren Sapalo
13 May 2016
7 min read
In a previous article, Building an iPhone app Using Swift, Ryan Loomba showed us how to build iOS apps using Swift, starting from a new project (Building an iPhone app Using Swift Part 1), and how to create lists using a table view and present a map using map view (Building an iPhone app Using Swift Part 2). In this article, we’ll discuss what RxSwift is and how it can be used to improve our Swift code. The Github repository for Rx.NET defines Reactive Extensions (Rx) as “a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.” Initially, Netflix developed this library to improve the way their API backend handles streams of data, but there were uses for the library even on the frontend to achieve a responsive user interface. The above links provide a better explanation of what the library is and the rationale for why they developed it. This article will focus on staying as simple as possible and explain how Rx can help Swift developers with the problems that they might encounter with regards to mobile development. Mobile Development and Background Threads If you’ve worked on mobile apps requiring Internet access, you’ll realize that there are things that should be done on the main thread (UI manipulation and accessing context-related resources) and things that should be done on a background thread (network queries and code that takes some time to perform). This is because you shouldn’t block the main thread with long-running code, such as performing a network query to get some JSON data from a server, or else your user interface will appear to be hanging! The Non-Rx Approach For our example, let’s say you need to query some JSON data from a server and display it on the screen. On your AppDelegate class, you could possibly have some queue setup for network requests. AppDelegate.swift static var networkQueue = dispatch_queue_create("com.appName.networkQueue", DISPATCH_QUEUE_CONCURRENT) We normally dispatch code to be run on a different thread by writing the code below: dispatch_async(AppDelegate.networkQueue) { // Query some server to get some json data } Let’s say that the best-case scenario will always happen and your network call will be successful. You have Internet access, the server was alive and responded, you have proper authorization to access the data you are requesting, and you successfully retrieve the data. I have enumerated these because I want to emphasize that there are so many things that can go wrong and prevent you from a successful network query. With the best-case scenario, you have your parsed data and you’re ready to display it on your UILabel. However, you’re currently on a background thread, which means that you should switch back to the main thread to manipulate the UI. This means your code will look something like this: dispatch_async(AppDelegate.networkQueue) { let url = "http://myapi.myserver.com/users" let request = NSMutableURLRequest(URL: NSURL(string: url)!) let task = session.dataTaskWithRequest(request, completionHandler: { data, response, error -> Void in let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableLeaves) as? NSDictionary dispatch_async(dispatch_get_main_queue()) { self.label.text = json.valueForKey("result") // Query some server to get some json data } } task.resume() } There are two things I want to point out here. Firstly, there are two calls to a global method called “dispatch_async” to run code on a specified queue, and they are nested inside each other. Another thing is that we’re expecting this code to run perfectly at all times; there are no error checking of whether the request was successful, whether data or response was nil, or whether error has some value or not. As mentioned above, there are many things that can go wrong when performing network queries, and your code needs to handle it elegantly. The RxSwift Approach With RxSwift, network queries and code that takes some time to perform are converted into Observables, which emit some data with its type specified. Views and controllers subscribe to them as Observers. Observables The network query can have three possible states: Currently emitting a new value (onNext), which can occur repeatedly or not at all An has error occurred and the stream has stopped completely (onError) The stream has ended (onComplete) For instance, the above example of a network query returning a JSON value could be defined as an observable that emits an NSDictionary, because that’s exactly the type of result we’re expecting: func rxGetUsers() -> Observable<NSDictionary> { return Observable.create { observer in let url = "http://myapi.myserver.com/users" let request = NSMutableURLRequest(URL: NSURL(string: url)!) let task = session.dataTaskWithRequest(request, completionHandler: { data, response, error -> Void in if (error != nil) { // an error occured observer.onError(NSError(domain: "Getting user data", code: 1, userInfo: nil)) } else if (data == nil){ // No data response observer.onError(NSError(domain: "Getting user data", code: 2, userInfo: nil)) } // other error checking let json = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableLeaves) as? NSDictionary if (json == nil) { // No json data found observer.onError(NSError(domain: "Getting user data", code: 3, userInfo: nil)) return } observer.onNext(json) observer.onComplete() } task.resume() return NopDisposable.instance } } With the rxGetUsers function defined above, it is easier to see what the code does: when an error occurs, observer.onError is called and the management of the error is deferred to the observer (a ViewController, for example) instead of the observable (the network query). Only when the error checking for the network is done is the observer.onNext method called, and the stream is finished with the observer.onComplete method call. Observers With the network query encapsulated in a single function and returned as an Observable instance, we can proceed to use this query by subscribing an observer (see the subscribe method). The Rx library provides options on what threads the code will run on (observeOn and subscribeOn), a way for you to handle the result or errors with direct access to the ViewController’s properties such as UI references (onNext and onError), a way for you to be informed when the observable stream is finished (onComplete), and a way for you to disregard the results of a network query (via disposing of the subscription variable). The relationship between an Observer that observes an Observable is called a subscription. You might need to do the last one I mentioned if your user suddenly chooses to press home and leaves your app, and you lose access to your context and resources to interact with. let subscription = rxGetUsers() // When finished, return to main thread to update UI .observeOn(MainScheduler.instance) // Perform parallel work on separate thread .subscribeOn(ConcurrentDispatchQueueScheduler.init(queue: AppDelegate.networkQueue)) .subscribe { // What to do on each emission onNext: (dict: NSDictionary) in { self.label.text = dict.valueForKey(“result”) as? String }, // What to do when an error occurs onError: (error) in { print(error) // or you could display an alert! }, // What to do when the stream is finished onCompleted: { print(“Done with the network request!”) // or perform another network query here! } } Summary Once you understand the basics of Rx, I am sure that you will come to appreciate its great use of the Observer pattern and move past the annoyance and difficulty in handling network requests that respect the life cycle of a mobile app, or the confusing callback-ception/hell required when multiple queries need to be put together. In the next article, we’ll show the simple usage of operators and data binding provided by Rx. About the author Darren Sapalo is a software developer, an advocate for UX, and a student taking up his Master's degree in Computer Science. He enjoyed developing games on his free time when he was twelve. Finally finished with his undergraduate thesis on computer vision, he took up some industry work with Apollo Technologies Inc. developing for both the Android and iOS platforms.
Read more
  • 0
  • 0
  • 2491
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at £15.99/month. Cancel anytime
article-image-why-do-so-many-companies-fail-take-cyber-security-seriously
Hari Vignesh
11 Jul 2017
5 min read
Save for later

Why do so many companies fail to take cyber security seriously?

Hari Vignesh
11 Jul 2017
5 min read
Consider this: in the past year cyber thieves have stolen $81m from the central bank of Bangladesh, derailed Verizon's $4.8 billion takeover of Yahoo, and even allegedly interfered in the U.S. presidential election. Away from the headlines, a black market in computerized extortion, hacking-for-hire and stolen digital goods is booming. The problem is about to get worse, especially as computers become increasingly entwined with physical objects and vulnerable human bodies thanks to the Internet of Things and the innovations of embedded systems. A recent survey has once again highlighted the urgent need for UK business to take cyber security more seriously. The survey found that 65% of companies don’t have any security solutions deployed onto their mobile devices, and 68% of companies do not have an awareness program aimed at employees of all levels to ensure they are cyber aware. In addition to this, the survey found that 76% of companies still don’t have controls in place to detect and prevent zero-day/unknown malware entering their organizations, and 74% don’t have an incident management process established to respond to cyber incidents and prevent reoccurrences. What are the most common types of data breaches? The most common attack is still a structured query language (SQL) injection. SQL injections feature heavily in breaches of entire systems because when there is a SQL injection vulnerability, it provides the attacker with access to the entire database. Why is it common for large companies to have these types of errors?  There are a number of factors. One is that companies are always very cost conscious, so they’re always trying to do things on a budget in terms of the development cost. What that often means is that they’re getting under-skilled people. It doesn’t really cost anything more to build code that’s resilient to SQL injection. The developers building it have got to know how it works. For example, if you’re offshoring to the cheapest possible rates in another country, you’re probably going to get inexperienced people of very minimal security prowess.  Companies generally don’t tend to take it seriously until after they’ve had a bad incident. You can’t miss it. It’s all over the news every single day about different security incidents, but until it actually happens to an organization, the penny just doesn’t seem to drop. Leaving the windows open  This is not a counsel of despair. The risk from fraud, car accidents, and the weather can never be eliminated completely either. But societies have developed ways of managing such risk — from government regulation to the use of legal liability and insurance to create incentives for safer behavior.  Start with regulation. Government’s first priority is to refrain from making the situation worse. Terrorist attacks, like the ones in St Petersburg and London, often spark calls for encryption to be weakened so that the security services can better monitor what individuals are up to. But it is impossible to weaken encryption for terrorists alone. The same protection that guards messaging programs like WhatsApp also guard bank transactions and online identities. Computer security is best served by encryption that is strong for everyone.  The next priority is setting basic product regulations. A lack of expertise will always hamper the ability of users of computers to protect themselves. So governments should promote “public health” for computing. They could insist that Internet-connected gizmos be updated with fixes when flaws are found. They could force users to change default usernames and passwords. Reporting laws, already in force in some American states, can oblige companies to disclose when they or their products are hacked. That encourages them to fix a problem instead of burying it. What are the best ways for businesses to prevent cyber attacks?  There are a number of different ways of looking at it. Arguably, the most fundamental thing that makes a big difference for security is the training of technology professionals. If you’re a business owner, ensuring that and you’ve got people working for you who are building these systems, making sure they’re adequately trained and equipped is essential.  Data breaches are often related to coding errors. A perfect example is an Indian pathology lab, which had 43,000 pathology reports on individuals leaked publically. The individual who built the lab’s security system was entirely unequipped. Though it may not be the only solution, a good start in improving cyber security is ensuring that there is investment in the development of the people creating the code.Let us know where you’d start!  About the Author  Hari Vignesh Jayapalan is a Google Certified Android app developer, IDF Certified UI & UX Professional, street magician, fitness freak, technology enthusiast, and wannabe entrepreneur. He can be found on Twitter @HariofSpades.
Read more
  • 0
  • 0
  • 2483

article-image-ethereum-programming-update
Packt Publishing
17 Sep 2017
1 min read
Save for later

Ethereum Programming Update

Packt Publishing
17 Sep 2017
1 min read
18th September 2017 A book entitled, “Ethereum Programming” purporting to be by Alex Leverington was erroneously advertised for pre-order on several websites (including Amazon and our own website). This was our mistake. The book does not exist, and we take full responsibility for our mistake in suggesting that the book does exist and would be launched on 4 August 2017. We sincerely apologise for any disappointment and inconvenience caused by this unintentional oversight. Followers of Alex Leverington are directed to https://nessence.net/about/, where they can find information about his work, including any forthcoming titles. Sincerely, Packt Publishing Ltd
Read more
  • 0
  • 0
  • 2461

article-image-material-design-best-practices
HariVigneshJayapalan
04 Apr 2017
5 min read
Save for later

Material Design Best Practices

HariVigneshJayapalan
04 Apr 2017
5 min read
If you’re an Android/hybrid app developer, you’ll probably be using Material UI components in your app. However, for every design pattern, there are a few basic UX concepts. Coupled with the UX concepts, the usability of the app and the user’s experience will bloom and flourish. This article will be showcasing a handful of best UX practices for Material Design components. What is “Material”? A material metaphor is the unifying theory of a rationalized space and a system of motion. The material is grounded in tactile reality, inspired by the study of paper and ink, yet technologically advanced and open to imagination and magic. Learn more about Material at Material.io. Derivation of best practices All of the best practices showcased here are derived by assuming that the user is a beginner with the smartphone. The core ideology is not to make the user think even for a moment. Components to focus There are 25+ components under Material Design. We’ll be focusing our best practices with respect to the below components: RecyclerView Tab Layouts Best practices for RecyclerView RecyclerView is a flexible view for providing a limited window into a large data set. RecyclerView supports representing homogenous and heterogenous data in two ways Linear style (vertical and horizontal) Grid style (fixed and staggered) Peek-A-Boo problem A Peek-a-boo problem will mostly occur for listing things horizontally. When we’re representing data in the form of list, a typical question to the user is: how will the user know that the content can be scrolled (right to left)? Or how will you tell the user that there is more content down the line? For example, please consider the following image. All the list items are arranged within the viewport, and for a moment, the user will think about what to do next. So how do we solve this problem? The solution is very simple. We need to display a half or quarter content of the last item next to the viewport. In short, the next item by the end of the viewport should be half visible. This visual representation will automatically trigger the brain to notice the half visible content and it will automatically drag the list to reveal it. In order to maintain responsiveness in all devices and tackle this problem, we need to consider a few calculations. We need to calculate the viewport width and dynamically set the width of each ViewHolder. This is just a one way of solving this problem. The good news is that we have an alternate approach as well. Alternate approach tothe “Peek-A-Boo” problem In our alternate approach, we need to switch our RecyclerView from Linear style to Grid style. The solution is simple. Let’s make the user scroll only in one direction. If the user is scrolling vertically, let him do that alone, and vice versa. This might sound brutal, but trust me; this will benefit the user a lot. Consider the image below. This type of visual representation will allow him to scroll only vertically. When you switch things to GridView, the visibility of items are clear and the user will not be thinking further. Consider the image below. Apart from switching to grid view, I’ve also tweaked the last grid item to notify the user that they still have more items to see. Data overload problem This problem is usually seen in news feeds, image listings, and chat interfaces. When we have so much data to view and process, the user will get confused. Though each item in the list will have a timestamp saying when this post or message is created or delivered, the problem is that the user has to notice the timestampand each item when he is scrolling. To solve this problem, almost all top-notch apps are using headers for identifying and sorting things out. Headers are indeed a beautiful solution for the data overload problem. Headers will speak to a user like “Hey user! You’re now entering my cave. Till the next guy speaks, all of the things below belong to me” — that’s good. Let’s take Google’s Inbox app. Inbox has used headers effectively, but using just the header alone has got some problems as well. Imagine the items under a particular header are long and the user has gone away from the app. Now when he comes back, he will not be remembering the section he was in. To solve this problem, we have sticky headers. These headers will hold the context throughout the section and the user will haveno trouble identifying the section. TabLayout best practices Tabs make it easy to explore and switch between different views. Tabs enable content organization at a high level, such as switching between views, data sets, or functional aspects of an app. Present tabs as a single row above their associated content. Tab labels should succinctly describe the content within because swipe gestures are used for navigating between tabs;they don’t pair tabs with content that also support swiping. Nested tab problem Even in a few best selling apps, I was able to spot the nested tabs issue. The images below will show what nesting of tabs is. Initially, by seeing the nested tabs, a majority of users get confused withthe navigation. But they get used to it in a while. Even an old version of one of the Google apps had this issue. Later they changed their way of classifying things.The best way to solve this nested tab problem is to find an alternative way to categorize things and you can also couple TabLayout with Bottom Navigation. Hopefully you’ve gained a few best practices for designing better apps. If you’ve liked this article please share. About the Author  HariVigneshJayapalan is a Google Certified Android App developer, IDF Certified UI &UX Professional, street magician, fitness freak, technology enthusiast, and wanna-be entrepreneur.
Read more
  • 0
  • 0
  • 2453

article-image-beginner-bitcoin-project-network-visualizer
Alex Leishman
12 Dec 2014
9 min read
Save for later

Beginner Bitcoin Project - Network Visualizer

Alex Leishman
12 Dec 2014
9 min read
This post will give you a basic introduction to the bitcoin protocol by guiding you through how to create a simple, real-time visualization of transactions in the bitcoin network. Bitcoin is easy to understand on the surface, but very complex when you get into the details. The explanations in this guide are simplified to make the content accessible to people unfamiliar with bitcoins. In-depth documentation can be found at https://bitcoin.org. Overview of the bitcoin network Bitcoin is a public P2P payment network and ledger enabling people or machines to securely transfer value over the Internet without trusting a third party. The tokens used for this value exchange are called bitcoins (lowercase “b”). A bitcoin is divisible to eight decimal places. Currently one bitcoin has a market value of about $350. Bitcoins “sit” at a bitcoin address, just like money “sits” in a bank account. A bitcoin address is a public identifier like a bank account number. In order to send bitcoins from one address to another you must prove ownership of the sending address by signing a transaction with the private key of the sending address. This private key is like the PIN or password to your bank account. Every bitcoin address has a unique corresponding private key. The amount of bitcoins in each of the existing addresses is stored in a public ledger called the blockchain. The blockchain holds the history of all valid/accepted transactions sent through the bitcoin network. These transactions are what we will be visualizing. To create a live visualization of the network we must connect to a bitcoin node or set of nodes. Nodes are servers in the bitcoin network responsible for propagating and relaying transactions. It's important to note that not all transactions sent into the bitcoin network are valid, and most nodes will not relay an invalid transaction. Therefore, although a single node will eventually see any transaction accepted by the network, it will not see many of the spam or malicious transactions because most other nodes will not propagate them. There are some very well connected nodes (super nodes) or clusters of nodes that can provide a more comprehensive view of the live state of the network. [Blockchain.info](https://blockchain.info) operates a super node and allows developers free access to its data through both REST and WebSockets APIs. We will be using their WebSockets API for this project. Let's get coding. You can see the finished project code here: https://github.com/leishman/btc_network_visualizer. First we will create a basic index.html file with jQuery and our main.js file required. The only HTML element we need is a <div> container: <!DOCTYPE html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/main.css"> </head> <body> <h1>Bitcoin Network Visualizer</h1> <!-- Visualization Container --> <div class="vizContainer js-visualize"></div> <!-- Load jQuery --> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.1.min.js"></script>')</script> <!-- Link main.js, where our visualization code is located --> <script src="js/main.js"></script> </body> </html> Let's throw some styling in there: /* gray container for visualization */ .vizContainer { width: 100%; height: 500px; background: #EEE; } /* outer element for bubble */ .txBubble { position: absolute; } /* inner element for bubble */ .txBubbleInner { width: 100%; height: 100%; position: relative; background: green; border-radius: 50%; -webkit-animation: expand 1s ease-in-out; } /* box displaying information about a transaction on click */ .toolTip { width: auto; height: 40px; padding: 0 5px; background: #AAA; border-radius: 4px; color: white; position: absolute; } /* words in tooltip */ .toolTip p { margin: 0; line-height: 40px; } /* Animations */ @-webkit-keyframes expand { 0% { width: 0; height: 0; left: 50%; top: 50%; } 100% { width: 100%; height: 100%; left: 0; top: 0; } } To get started, we must establish a WebSocket connection with blockchain.info. You can view their documentation [here](https://blockchain.info/api/api_websocket). The following code illustrates how to set up the WebSockets connection, subscribe to all unconfirmed (new) transactions in the network, and log the data to the console: /////////////////////////////////////////// /// Connect with Blockchain Websockets API //////////////////////////////////////////// // create new websocket object using a secure connection (wss) var blkchainSocket = new WebSocket('wss://ws.blockchain.info/inv'); // once the socket connection is established blkchainSocket.onopen = function(event) { var subMessage; // message to subscribe to all unconfirmed transactions subMessage = '{"op":"unconfirmed_sub"}'; // send message to subscribe blkchainSocket.send(subMessage); } // callback to execute when a message is displayed blkchainSocket.onmessage = function(event) { // Parse the data returned to convert to JSON var txData = JSON.parse(event.data); // log data to console console.log(txData); } If you run this code, you should see a live stream of transactions in your console. Let's take a look at the data we receive: { "op":"utx", "x":{ "hash":"427937e561d2ab6236014d92509a1a872eec327de2b9f6d84cfcbce8af2db935", "vin_sz":1, "vout_sz":2, "lock_time":"Unavailable", "size":259, "relayed_by":"127.0.0.1", "tx_index":68494254, "time":1415169009, "inputs":[ { "prev_out":{ "value":29970360, "addr":"17L4qAEjVbKZ99iXJFhWMzRWv3c8LHrUeq", "type":0 } } ], "out":[ { "value":3020235, // output 1, 3020235 Satoshis going to address 1DTnd.... "addr":"1DTnd8vwpJT3yo64xZST5Srm9Z5JEWQ6nA", "type":0 }, { "value":26940125, // output 2, 26940125 Satoshis going to address 17L4.... "addr":"17L4qAEjVbKZ99iXJFhWMzRWv3c8LHrUeq", "type":0 } ] } } There is a lot of information here. The only thing we will concern ourselves with is the output, which specifies the amount and destination of the coins being sent in the transaction. It is important to note that a single transaction can send various bitcoin amounts to multiple addresses. The output specifies the destinations and amounts of bitcoin sent by a transaction. Often a transaction has at least two outputs, where one of them sends bitcoins to a receiver and the other sends bitcoins as change back to the sender. The details of this are beyond the scope of this guide, but you can read more about it here. Now that we have the data, we can visualize it. Let's make a function called visualize that can be passed data sent from the API and display it on the screen: ///////////////////////// /// Visualize the data ///////////////////////// // Input: JSON data object representing a new Bitcoin transaction from Blockchain.info API // Result: Append a circle (bubble) to the DOM with a size proportional to the transaction value function visualize(data) { // declare variables var r, outputs, txDot, vizHeight, vizWidth, vizContainter, dot, txVal = 0, valNorm = 10000000; // query DOM for viz Container vizContainter = $('.js-visualize'); // get height and width of viz container vizHeight = vizContainter.height(); vizWidth = vizContainter.width(); // get value of first tx ouput (for test only) outputs = data.x.out; // sum all unspent outputs to calculate total value of Tx for(var i = 0; i < outputs.length; i++){ txVal += outputs[i].value; } // calculate radius of circle to display based on Tx value r = (txVal / valNorm) / 2; // generate random position randTop = randomInt(vizHeight) + 88; randLeft = randomInt(vizWidth) - r; // set min and max sizes for radius (r) if(r < 5) { r = 5; } else if(r > 100) { r = 100; } // create HTML elements to use as bubble txBubble = $('<div class="txBubble"><div class="txBubbleInner"></div></div>') .css({'top': randTop, 'left': randLeft, 'width': r, 'height': r}) .attr('data-txvalue', txVal); // add bubble element to DOM dot = vizContainter.append(txBubble); } This code creates a new element styled as a circle for each new transaction received. The size of the circle is represented by the total amount of bitcoins moved in a transaction. We set a max and min bound size of the circle to prevent invisible or over-sized circles from appearing. We can then add a tooltip to each bubble to display the total value of the transaction. The values returned by blockchain.info are expressed in Satoshis (named after the mysterious creator of bitcoin - Satoshi Nakamoto). One bitcoin is equal to 100 million Satoshis, so we have a function called satoshi2btc  do the conversion for us: ///////////////////////////////////////// /// Create a tooltip to display Tx data ////////////////////////////////////////// // Input: event, passed by calling function. showTooltip() acts as a callback function when a bubble is clicked // see $(document).on('click', '.txBubble', showTooltip); // Result: Display tooltip with the transaction value (in BTC) represented by the bubble function showTooltip(event) { // declare variables var addrs, value, tooltip; // get value of tx stored as data attribute value = $(this).data('txvalue'); // get coordinates of user's click xCoord = event.clientX; yCoord = event.clientY; // remove other tooltips to ensure only 1 is displayed at a time $('.toolTip').remove(); // create a tooltip and position it at user's click tooltip = $('<div class="toolTip"></div>') .css({'top': yCoord, 'left': xCoord}) .html('<p>' + satoshi2btc(value) + ' BTC</p>'); // add tooltip to DOM $('.js-visualize').append(tooltip); } // define random integer function // radomInt(5) will return a number from 0 to 4 function randomInt(range) { return Math.floor(Math.random() * range); } // convert Satoshis to BTC // There are 100,000,000 Satoshis in 1 Bitcoin function satoshi2btc(val) { return val / 100000000; } ///////////////////////////////////////// /// Bind Tooltip event on document load ////////////////////////////////////////// // bind showTooltip function on DOM load $(function() { $(document).on('click', '.txBubble', showTooltip); }); In summary, we used the blockchain.info WebSockets API to create a live JavaScript visualization of the transactions in the bitcoin network. We used our new understanding of the bitcoin protocol to visually represent the value of each transaction. This is just the tip of the iceberg and a great way to get your feet wet with bitcoin development. About the Author Alex Leishman is a software engineer who is passionate about bitcoin and other digital currencies. He works at MaiCoin.com where he is helping to build the future of money.
Read more
  • 0
  • 0
  • 2448
article-image-elm-and-typescript-static-typing-frontend
Eduard Kyvenko
16 Nov 2016
5 min read
Save for later

Elm and TypeScript – Static typing on the Frontend

Eduard Kyvenko
16 Nov 2016
5 min read
This post explores the functional aspect of both Elm and TypeScript, providing a better understanding of both programming languages. Elm and TypeScript both use JavaScript as a compile target, but they do have major differences, which we’ll examine here. Elm Elm is a functional language with a static type analysis and strong inferred type system. In other words, the Elm compiler only runs type checks during compilation and can predict types for all expressions without having explicit type annotations. This guarantees the absence of runtime exceptions due to type mismatch. Elm supports generic types and structural type definitions. TypeScript TypeScript is a superset of JavaScript, but unlike Elm it is a multi-paradigm language with a strong imperative part and a significantly weaker functional part. It also has static type checker and supports generic types and structural typing. TypeScript also has type inference, and although it is not as reliable as Elm’s, it’s still quite useful. Functions Let’s see how both languages handle functions. Elm Functions is where Elm shines. Function declarations and lambda expressions are supported. Type definitions are simple and robust. It is worth mentioning that lambda expressions can only have a type definition when used as a return value from a function declaration. -- Function declaration add : Int -> Int -> Int add x y = x + y -- Function expression x y -> x + y -- Type definition for lambda expression add : Int -> Int -> Int add = x y -> x + y TypeScript TypeScript can offer the standard set from JavaScript: function declaration, lambda expression and arrow functions. // Function declaration function add(x: number, y: number): number { return x + y; } // Function expression const add = function (x: number, y: number): number { return x + y; } // Arrow function expresion const add = (x: number, y: number): number => { return x + y; } Structural typings Let’s see how they both stack up. Elm The structural type annotation definition is available for Tuples and Records. Records are primarily used for modelling abstract data types. Type aliases can be used as value constructors of the said data type. type alias User = { name: String , surname: Maybe String } displayName : User -> String displayName { name, surname } = case surname of Just value -> name ++ " " ++ value Nothing -> name displayName (User "John" (Just "Doe")) -- John Doe TypeScript Structural typing is done with interfaces, so it is possible to deconstruct values. It is also worth mentioning that classes can extend interfaces. interface User { name: string; surname?: string; } function displayName ({ name, surname="" }:User ):string { return name + ' ' + surname } console.log(displayName({ name: 'John', surname: 'Doe' })) Union Types Elm and TypeScript both handle union types. Elm Union Types in Elm are the essential tool for defining abstract data structures with dynamic nature. Let’s have a look at the Maybe type. The union describes two possible states—the closest you can get to this in TypeScript is an optional value.  Type variable a points out that a stored value might belong to any data type. type Maybe a = Just a | Nothing This might be useful and make a lot of sense in a functional language. Here is an example of how you might use it. If you want to crash the program explicitly, then there is a logical error in the state of the application. displayName userName = case userName of Just name -> String.toUpper name Nothing -> Debug.crash "Name is missing" displayName (Just "Bond") -- BOND displayName Nothing -- Cause run-time error explicitly TypeScript Union types in TypeScript are currently referred to as Discriminated Union. Here is an example of using union todefine a list of available actions for a dispatcher. interface ActionSendId { name: "ID", data: number } interface ActionSendName { name: "NAME", data: string } function dispatch(action:ActionSendId | ActionSendName):void { switch (action.name) { case "ID": sendId(action.data) break; case "NAME": sendName(action.data) break; default: break; } } Interoperation with JavaScript I will only focus on aspects that are affected by the implementation of a type system. Elm You can pass values once from JavaScript to Elm during the initialization process. There is a special type of program for that called programWithFlags. The Elm application can inter-operate with JavaScript directly using special interfaces, called ports. It implementsa Signal pattern. Sending a value of an unexpected type will cause an error. During HTTP communication, you have to decode and encode values using Json.Decode and Json.Encode. During DOM Events, you can use Json.Decode to retrieve values from an Event object. TypeScript Using JavaScript with TypeScript is quite possible, but you will have to specify type definitions for the code. As an option, you can use a special type: any. The any type is a powerful way to work with existing JavaScript, allowing you to gradually optin and optout of typechecking during compilation. As an alternative, you might have to provide typing files. Conclusion Both Elm and TypeScript have their strengths and weaknesses, but despite all of the differences, both type systems give you similar benefits. Elm has the upper hand with type inference, thanks to the purely functional nature of the language and strict inter-operation with the outside world. TypeScript does not guarantee type-error-free runtime, but it’s easier pickup and very intuitive if you have JavaScript or a C# background. About the author Eduard Kyvenko is a frontend lead at Dinero. He has been working with Elm for over half a year and has built a tax return and financial statements app for Dinero. You can find him on GitHub at @halfzebra.
Read more
  • 0
  • 0
  • 2442

article-image-machine-learningweb-deeplearn-js
Savia Lobo
02 Jan 2018
4 min read
Save for later

Machine Learning slings its web: Deeplearn.js is here!

Savia Lobo
02 Jan 2018
4 min read
Machine learning has been the talk of the town! With implementations in large number of organizations to carry out prediction and classification tasks. Machine learning is cutting edge in  identifying data and processing it to generate meaningful insights based on predictive analytics. But to leverage machine learning, huge computational resources are required. While many may think of it as rocket science, Google has simplified machine learning access to everyone through Deeplearn.js - an initiative that allows ML to run entirely on a web browser. Deeplearn.js is an open source WebGL- accelerated JS library. This Google PAIR’s initiative (to study and redesign human interactions with ML) aims to make ML available for everyone. This implies that it will not be restricted to specific groups of people such as developers or any businesses implementing it. Deeplearn.js + browser: A perfect match? We can say browsers such as Chrome, Internet explorer, Safari, etc are an integral part of our life as it connects us with the world. Their accessibility feature is visible in PWAs’(Progressive Web Apps) wherein applications can run on browsers without the need to download them. In a similar way, machine learning can be carried out within browsers without the fuss of downloading or installing any computational resources. Wonder how? With Deeplearn.js! Deeplearn.js specifically written in Javascript, is exclusively tailored for machine learning to function on web browsers. It offers an interactive client-side platform which helps them carry out rapid prototyping and visualizations. Machine learning involves rapid computations with huge CPU requirements and is a complete  mismatch for Javascript because of its speed limit. Deeplearn.js is a work-around that allows ML to be implemented using Javascript via the WebGL Javascript API. Additionally, you can use hardware accelerators such as GPUs via the webGL to perform faster and excellent computations with 2D and 3D graphics. Basic Mechanism - The structure of Deeplearn.js is a blend of Tensorflow and NumPy, which are Python-based packages for scientific computing. The NumPy acts as a quick execution model and the TensorFlow API provides a delayed execution model. Though TensorFlow is a fast and scalable framework widely used by researchers and developers. However, creating web applications on the browser with TensorFlow is difficult as it lacks runtime support to create web applications. Deeplearn.js allows TensorFlow model capabilities to be imported on the browser. By using the tools within Deeplearn.js, weights from the TensorFlow model can be exported. Opportunities for business - Traditional businesses shy away from using latest ML tools as computational resources are expensive and complicated. Also, due to the complexities in ML, there is a need to hire a technical expert. Through Deeplearn.js, firms can now easily access advanced ML tools and resources. It can not only help them solve data centric business problems but also additionally provide them with innovative strategies, increased competition and improved advantages to stay ahead of their competitors. Differentiating factor - Deeplearn.js is not the only inbrowser ML library. There are other competing frameworks such as ConvNetJS and Tensorfire, a much recent and almost identical framework to deeplearn.js. A unique feature that differentiates deeplearn.js is its capability to perform faster inference, along with full back propagation. Implementations with Deeplearn.js Performance RNN aids in generating music with expressive timing and dynamics. It has been successfully ported into the browser using the Deeplearn.js environment after being trained in TensorFlow. The training data used was the Yamaha e-Piano Competition dataset, which includes MIDI captures of ~1400 performances by skilled pianists. Teachable Machine is built using Deeplearn.js library. It allows users to teach a machine via a camera with live teaching and without any requirement to code.    Faster Neural Style Transfer algorithm allows in-browser image style transfer. It transfers the style of an image into the content of another image. To explore other practical projects on Deeplearn.js, you may visit the GitHub repository here. Deeplearn.js, with the fusion of Machine learning has opened new opportunities and focus areas for businesses and non-developers. SME’s (Subject Matter Expertise) within a business can now grasp deeper insights on how to achieve desired results with Machine learning. The browser is home for many developments which are yet to be revealed in the future. Deeplearn.js truly is a milestone in bringing the web and ML a step closer. However being at the early stage, it would be exciting to see how it unfolds ML for anyone on the planet.      
Read more
  • 0
  • 0
  • 2441

article-image-5-habits-successful-developers
Hari Vignesh
10 May 2017
5 min read
Save for later

5 habits of successful developers

Hari Vignesh
10 May 2017
5 min read
There are about 18.2 million software developers worldwide, and that number is expected to rise to 26.4 million by 2019 – a 45% increase, says Evans Data Corp, in its latest Global Developer Population and Demographic Study.That means that the number ofpeople with your skill setis going to increase, by a lot. Start developing successful habits now so you’ll stand out from the crowd later. 1. Staying up to date Successful developers know that this is mandatory. Keep learning new things or work on something – even if it’s just a small side project – every day. Staying updated in the IT industry is critical.Let me give you a simple example: the evolution of mobile phones.Initially,mobile phones took five years to reach the masses but when smartphones were introduced they reached billions in two years. So, with respect to the technology from the year 2000 - 2010, every technology or framework took five years to mature. But now, technology is becoming outdated in less than two years. To withstand this heat, you need to be awake and keep your eyes and ears open for new emerging technology and frameworks.So, how do you stay up to date? Medium is a great platform to start. Also, engage in other developer communities and tech forums. 2. Lucid understanding and ownership Understanding is the foundation for every developer, and this should be your strength. Your peers or leaders will prefer to explain things to you only once, and you should be in a position to grasp and perform tasks without raising any flags. Time is a crucial factor for everyone in the organization so the organization will expect you to understand processes quickly. How do you understand quickly? You need to upgrade your domain knowledge constantly. For example, if you’re working in a health care sector, you need to be half doctor — you need to understand things better so you can deliver a high quality product. Successful developers produce quality products and, in order to think about quality, you need to be an expert in your domain. 3. Crafting with best practices If we have two developers with the same experiences, what metrics can you use todetermine which one isbetter? Well, it’s based on best practices. A task can be achieved in multiple ways but whoever provides the best, easiest, and most scalable solution is obviously more sellable than the other person.Qualities like providing multiple solutions, scalable solutions, optimal solutions — all these will manifest when you gain more experience. You can gain this experience quickly if you spend more time with developer documentation and community, as well as by asking the right questions.  Writing clean, scalable, and optimal code is one of the most valued skills of all time in the software industry. Nobody can reach the ultimate level, but you should keep a check on this all the time.There are multiple paths you can take to learn best practices. The best path is to grab a mentor. Find experts in your field, discuss the problems with them, and their experience will definitely show you the best practices. 4. Avoiding your comfort zone Almost 90% of developers just want to hang out in their comfort zones. They opt for big corporate jobs where they’ll have scheduled work every day, party on the weekends, etc. Well, even if you’re employed with a big tech giant organization, you should be doing something outside of that work like   freelancing, open source contributions, core and library creation, and much more. This will obviously take up some of your free time and be less comfortable but the end result will be beautiful.You need to do something different to get something different.  If you prefer being in your comfort zone then trust me, you will lose your job after five years. You need to constantly prove your presence in this industry to keep being successful. Engage yourself in conferences, tech meet-ups, make hobby projects, present white papers, improve your skillsets, and much more. 5. Community interaction Most developers in the world are self-taught (including myself). We learn everything from the developer community for free. What have we done in return for the community? Well, successful developers play a vital role in contributing to open source or to the developer community. They write articles, present things in meet-ups, organize meet-ups, and share knowledge. This will in-turn help the others who are dependent on free education and that’s how the fraternity will grow. So, how can you help the community? Here are some suggestions to get your started: You can start writing your tips, tricks, and experiences in a blog. You can start making “how to” videos. You can contribute to open source projects. You can start writing free libraries. You can start presenting in meet-ups. You can participate in developer community programs. Mentor a few projects. If you couldn’t manage time for making new habits, here’s a simple trick: If you need to inject any habit in your life, all you need to do is to practice it strictly for 21 days. If you you're able to do that, your brain and body will pick it up automatically for the rest of your life. About the Author  Hari VigneshJayapalan is a Google Certified Android app developer, IDF Certified UI & UX Professional, street magician, fitness freak, technology enthusiast, and wannabe entrepreneur. He can be found on Twitter @HariofSpades.
Read more
  • 0
  • 0
  • 2439
article-image-swift-2016
Owen Roberts
16 Mar 2016
4 min read
Save for later

Swift in 2016

Owen Roberts
16 Mar 2016
4 min read
It’s only been 2 years since Swift was first released to the public and it’s amazing how quickly it has been adopted by iOS developers all over. Seen as a great jumping point for many people and a perfect alternative to Objective-C with some of the best modern language features built in, like tuples and generics; being Open Source is the icing on the cake for tinker-happy devs looking to make the language their own. Swift is in an interesting position though; despite it being one of the fastest languages being picked up right now, do you know how many apps made by Apple actually use it in iOS 9.2? Only 1. Calculator. It’s not a huge surprise when you think about it – the language is new and constantly evolving, and we can safely assume that Calculator’s use of Swift is to test the water as the features and workings of the language settle down. Maybe in the next 2-3 years Apple will have finally moved to a pure Swift world, but other developers? They’re really jumping into the language. IBM, for example, uses Swift for all its iOS apps. What does this mean for you? It means that, as a developer, you have the ability to help shape a young language that rarely happens on today’s web. So here are a few reasons you should take the plunge and get deeper into Swift in 2016, and if you haven’t started yet, then there’s no better time! Swift 3 is coming What better time to get even deeper into the language when it’s about to add a host of great new features? Swift 3.0 is currently scheduled to launch around the tail end of 2016 and Apple aren’t keeping what they want to include close to their chest. The biggest additions are looking to be stabilizing the ABI, refining the language even more with added resilience to changes, and further increasing portability. All these changes have been on the wishlists of Swift devs for ages and now that we’re finally going to get them there’s sure to be more professional projects made purely in Swift. 3.0 looks to be the edition of Swift that you can use for your customers without worry, so if you haven’t gotten into the language yet, this is the version you should be prepping for! It’s no longer an iOS only language Probably the biggest change to happen to Swift since it became Open Source is that the language is now available on Ubuntu officially, while dedicated fans are also currently creating an Android port of all things. What does this mean for you as a developer? Well, the potential for a greater number of platforms your apps can be deployed on has grown; and one of Swift’s main complaints, that it’s an iOS only language, is rendered moot. It’s getting easier to learn and use In the last 2 years we’ve seen a variety of different tools and package managers for those looking to get more out of Swift. If you’re already using Swift it’s most likely you’re using Xcode to write apps. However, if you’re looking to try something new or just don’t like Xcode then there’s now a host of options for you. Testing frameworks like Quick are starting to appear on the market and alternatives such as AppCode look to build on the feedback the community gives to Xcode and fill in the gaps with what it’s missing. Suggestions as you type and decent project monitoring are becoming more commonplace with these new environments, and there are more environments around if you look, so why not jump on them and see which one suits your style of development? The Swift job market is expanding Last year the Swift job market expanded by an incredible 600%, and that was in its first year alone. With Apple giving Swift its full support and the community having grown so quickly, companies are beginning to take notice. Many companies who produce iOS apps are looking for the benefits that Swift offers over Objective-C and having that language as part of your skillset is something that is beginning to set iOS developers apart from one another… With everything happening with Spring this year it looks to be one of the best times to jump on board or dig deeper into the language. If you’re looking to get started building your Swift skills then be sure to check out our iOS tech page, it has all our most popular iOS books for you to explore along with the list of upcoming titles for you to preorder, Swift included.
Read more
  • 0
  • 0
  • 2438

article-image-arduino-yun-welcome-to-the-internet-things
Michael Ang
26 Sep 2014
6 min read
Save for later

Arduino Yún - Welcome to the Internet of Things

Michael Ang
26 Sep 2014
6 min read
Arduino is an open source electronics platform that makes it easy to interface with sensors, lights, motors, and much more with a small standalone board. Arduino Yún combines a standard Arduino micro-controller with a tiny Linux computer, all on the same board! The Arduino micro-controller is perfectly suited to interfacing with hardware like sensors and motors, and the Linux computer makes it easy to get online to the Internet and perform more intensive tasks. The combination really is the best of both worlds. This post will introduce Arduino Yún and give you some ideas of the possibilities that it opens up. The key to the Yún is that it has two separate processors on the board. The first provides the normal Arduino functions using an ATmega32u4 micro-controller. This processor is perfect for running "low-level" operations like driving timing-sensitive LED light strips or interfacing with sensors. The second processor is an Atheros AR9331 "system on a chip" that is typically used in WiFi access points and routers. The Atheros processor runs a version of Linux derived from OpenWRT and has built-in WiFi that lets it connect to a WiFi network or act as an access point. The Atheros is pretty wimpy by desktop standards (400MHz processor and 64MB RAM) but it has no problem downloading webpages or accessing an SD card, for example—two tasks that would otherwise require extra hardware and be challenging for a standard Arduino board. One selling point for the Arduino Yún is that the integration between the two processors is quite good and you program the Yún using the standard Arduino IDE (currently you need the latest beta version). You can program the Yún by connecting it by a USB cable to your computer, but much more exciting is to program it over the air, via WiFi! When you plug the Yún into a USB power supply it will create a WiFi network with a name like "Arduino Yun-90A2DAF3022E". Connect to this network with your computer and you will be connected to the Yún! You'll be able to access the Yún's configuration page by going to http://arduino.local in your web browser and you should be able to reprogram the Yún from the Arduino IDE by selecting the network connection in Tools-> Port. There's a new access point in town Being able to reprogram the board over WiFi is already worth the price of admission for certain projects. I made a sound-reactive hanging light sculpture and it was invaluable to adjust and "dial in" the program inside the sculpture while it was hanging in the air. Look ma, no wires! Programming over the air The Bridge library for Arduino Yún is used to communicate between the processors. A number of examples using Bridge are provided with the Arduino IDE. With Bridge you can do things like controlling the pins on the Arduino from a webpage. For example, loading http://myArduinoYun.local/arduino/digital/13/1 in your browser could turn on the built-in LED. You can also use Bridge to download web pages, or run custom scripts on the Linux processor. Since the Linux processor is a full-blown computer with an SD card reader and USB, this can be really powerful. For example, you can write a Python script that runs on the Linux processor, and trigger that script from your Arduino sketch. The Yún is ideally suited for the "Internet of Things". Want to receive an e-mail when your cat comes home? Attach a switch to your pet door and have your Yún e-mail you when it sees the door open. Want to change the color of an LED based on the current weather? Just have the Linux processor download the current weather from Yahoo! Weather and the ATMega micro-controller can handle driving the LEDs. Temboo provides library code and examples for connecting to a large variety of web services. The Yún doesn't include audio hardware, but because the Linux processor supports USB peripherals, it's easy to attach a low-cost USB sound card. This tutorial has the details on adding a sound card and playing an mp3 file in response to a button press. I used this technique for my piece Forward Thinking Sound at the Art Hack Day in Paris that used a Yún to play modem sounds while controlling an LED strip. With only 48 hours to complete a new work from scratch, being able to get an mp3 playing from the Yún in less than an hour was amazing! Yún with USB sound card, speakers and LED strip. Forward Thinking Sound at Art Hack Day Paris. The Arduino Yún is a different beast than the Raspberry Pi and BeagleBone Black. Where the other boards are best thought of as small computers (with video output, built-in audio, and so on) the Arduino Yún is best thought of as the combination of an Arduino board and WiFi router than can run some basic scripts. The Yún is unfortunately quite a bit more expensive than a standard Arduino board, so you may not want to dedicate one to each project. The experience of programming the Yún is generally quite good—the Arduino IDE and Bridge library make it easy to use the Yún as a "regular" Arduino and ease into the network/Linux features as you need them. Once you can program your Arduino over WiFi and connect to the Internet, it's a little hard to go back! About the author: Michael Ang is a Berlin-based artist and engineer working at the intersection of art, engineering, and the natural world. His latest project is the Polygon Construction Kit, a toolkit for bridging the virtual and physical realms by constructing real-world objects from simple 3D models. He is one of the organizers of Art Hack Day, an event for hackers whose medium is tech and artists whose medium is technology.
Read more
  • 0
  • 0
  • 2437