Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

2015-02-12

Level Up - Web Dev: How to get started with Polymer

Polymer:

  • A wrapper with syntactic sugar for the new HTML WebComponents W3C spec.
  • Allows easy modularization and reuse of HTML/CSS/JS code.
  • Creates more readable source files.
  • Being actively developed by Google.

The purpose of this article is to provide the basic information needed for the easiest way to get started with Polymer, including downloading creating a custom Polymer element, and reusing other elements. This article probably could have been split into three separate smaller ones, but I'm opting for a single page that can be used as a "cheat sheet". Most of this information is from the official site, but the difference is that this is shorter guide with many deletions, a few additions, and different organization.


Getting Started For The First Time

This is a quick walkthrough for how to get started with Polymer from scratch.

1. There are a few different ways to get Polymer, but the easiest is with Bower, which is a package and dependency manager for many web libraries. So, install Bower if you don't already have it.
2. Create a new directory for your web project, then run `bower init` in it using a console. There will be a few questions, in which  you can just press Enter if you don't know what to do yet. This initialization just produces a `bower.json` file, which has settings that can easily be changed later.
3. Install Polymer for the project by running `bower install --save Polymer/polymer`. This will create and fill a new directory `bower_components` with Polymer and its dependencies. Using `--save` will update the `bower.json` file by listing Polymer as a dependency. (Sidenote: To update the components in bower_components, just run `bower update`.)

Now, you can use Polymer in your project. See the section on [How To Create A Polyment Element] for a quick walkthrough on getting a simple app working.


How To Create A Polymer Element

In this quick walkthrough, you'll create and implement a simple Polymer element called `my-element`.

1. Create a new file called `my-element.html` and add the following code. Make sure the import is pointing to the valid location within the bower_components directory that was created in the previous walkthrough.



2. Use your element in `index.html`. Here's a minimal example. Note: The above `my-elements.html` was put in an `elements` directory for some organization.



3. Run the app from a web server so that the [HTML Imports](https://www.polymer-project.org/platform/html-imports.html) work correctly. For example, to run on localhost instead of remote, if you have Python 2, then you can run `python -m SimpleHTTPServer`. If you have Python 3, then you can run `python -m http.server`.

Notes about Polymer elements:

  • The name of the element must have at least one dash `-` in it. (Reason: It's part of the web component spec as to not interfere with official HTML tags.)
  • The `noscript` attribute used in the above sample code indicates that it's a simple element with no script, which allows it to be registered automatically.



How To Reuse Other Polymer Elements

First, find some elements with Bower by running `bower search Polymer`. This will show most of the elements that the Polymer team as created. For a curated list of custom elements, check out customelements.io/. For a scrape of GitHub of all the projects that mention "web component", see Component Kitchen. These instructions work for both Polymer elements and regular web components as long as they are registered with Bower, otherwise they'll have to be installed manually.

1. Install the element for your web project, for example: `bower install --save Polymer/core-ajax`. The `--save` flag is used to add that element as a dependency to the `bower.json` file. After the optional `save`, the pattern is `/`. The element will be installed to the `bower_components` directory.
2. Use that element in your layout or custom element. An import statement must also be included, for example, to edit the custom `my-element` created in the last section:



3. Run the project and enjoy how easy it is to create modular web apps and site now. If you don't see anything on the page, then make sure that all your imports are pointing to the correct place.

The best way I've found to learn about using new elements is to see the demos and look at the source code for the ones that you like.

There's plenty more details that I haven't included in this article because they weren't vital to the setup process. So, if you have any questions, the official Polymer website is a great resource or I'll be happy to try to answer any questions.

:)
~ Danial Goodwin ~



2013-05-22

Simply Advanced Mobile App Development Website Updated

Hello,

Please check out my new design of Simply Advanced's home page. It's live now. Another surprising discovery is that my website shows first when searching for "Simply Advanced". You can access it by clicking the first result in: https://www.google.com/search?q=simply+advanced

Let me know what you think. =]
~ Simply Advanced ~



2013-05-18

Cross-Platform Tools For Mobile App Development

This summer I'll be experimenting with different cross-platform tools in order to be more efficient with my time. The development tools that I'm mainly looking at will create native code code for each platform that the app runs on. The biggest reason for this is performance and having a native UI that users are used to with their platform.

So, the collection that follows are my notes I took when researching many of different cross-platform tools.

In doing background research for the cross-platform tools, they are great for basic app creation. But, app can quickly become non-basic as soon as they start accessing native APIs that are only available for a specific platform. Some of the biggest pain points with the cross-platform tools may be integrating other open-source codes, using multi-touch, gestures, and native UI features/paradigms. But, there are cross-platform mobile development tools that help with those features.

A big note on using cross-platform tools to create native apps: It is not "write once, run anywhere" (WORA). The idea of creating these native apps is to maximize code reuse and/or provide a higher abstraction level for development. Up to 50-95% of the code you write can be reused depending on the type of app you are creating.

My Results:
These final choices I made are bias because I didn't want to spend over $1000 for Unity3D. I don't even want to spend $200 for MonoDroid/MonoTouch, but I will if I don't care for the free options as follows. I chose these options mainly because of their documentation, sample APIs, developer communities, and active development. Both of the following are free up to a certain point, but because I am in academia I get to go a little further with the tools.
1. MoSync
2. Titanium by Appcelerator

The following I'm not trying the following until at mid- to late- summer likely (because of cost, it can wait longer...)
1. MonoDroid/MonoTouch: ($99 academic rate per developer, per platform) The regular Mono library is free, but it is just an open source implementation of the .NET framework. It does not include tools for integrating with iOS or Android. Both of these tools integrate Mono into them.

More Specific Notes: (I take a lot of notes directly in Notepad++/Notepad)
/* Cross-platform SDK */

- Mono (native app, C#) (open source): This is just an open source version of the .NET framework to be used anywhere, like in Apple and Linux OS. http://www.mono-project.com
  - Mono for Android (proprietary): Free version only allows small apps and no access to 3rd-party libraries. Lowest paid version is $199 per platform/developer. Academic cost is $99 per platform, per developer (http://support.xamarin.com/customer/portal/articles/177042-do-you-have-any-student-or-academic-pricing-)
  - MonoTouch (for iOS) (proprietary): 
Conclusion: Good if already have much code in C#, or prefer the .NET framework.
- Unity3D - high costs
- Marmalade (native app, C++) ($15 per seat/month;$149 per seat/year): http://www.madewithmarmalade.com/
- Rhodes (HTML/Ruby): Says native app, but seems to be web app with just a native UI. http://www.motorolasolutions.com/US-EN/RhoMobile+Suite/Rhodes
- MoSync (native app, HTML/JS w/optional C/C++ extensions) (open source | Free): Seems promising. Needs Mac for iOS publishing.
- Titanium by Appcelerator (native app, JS) (Free): Uses JavaScript mainly, but it is not a web app. It is translated to native code (but, a web UI ‘could’ be made instead of a native UI). Android, iOS, and web only.
- PhoneGap (web app, HTML/JS): Very limited, though has basic access to camera, contacts, some sensors.

Conclusion: For free, use possibly MoSync or Titanium. For paid, use Xamarin’s MonoTouch/MonoDroid ($99 per developer, per platform)

Wikipedia also has a very long list of potential cross-platform tools to choose from. It may be helpful if you are trying to do more background research into the many different types of development tools that provide non-native code when compiling for different platforms.

Source: I originally put this on my developer blog.

~ Simply Advanced ~



2012-11-06

How to Disable VLC Plugin in Google Chrome

VLC is the best media player in the market that plays just about any type of media file. But, one big flaw is its browser plugin. When it is running, there are no extra options to do anything with the media file.

Sometime I just rather download the file instead of watching it online. Then, that way I may speed up the video to 2x speed and watch it more efficiently. (It takes a bit of training in order to understand videos at 2x, I'd recommend starting off at 1.4x speed)

So, to disable VLC's plugin for Google Chrome

  1. type "chrome://plugins/" into the address bar (or omni bar) located at the top of Google Chrome.
  2. Search and find "VLC Web Plugin."
  3. Click on the "Disable" link.

You are done. There are no options in the desktop part of VLC to disable the web plugin. But now, you know how.

Google Chrome will now try to use another media plugin you have, or it will try to download the file.

Share the knowledge,
~ Simply Advanced ~



2012-06-28

New Simply Advanced Logo!

You should take a look at the Simply Advanced website that I just finished updating. Sometimes I even surprise myself lol. The layout is really neat, fits all screen sizes (try changing the width of your browser) and the about page has an innovative style that I haven't seen anywhere else.

http://simplyadvanced.net/

Inspired by modern art


~ Simply Advanced ~