Categories
Uncategorized

How to share data between components in Angular: A shopping cart example

If you have developed modern web applications in Angular, you have inevitably run into a situation in which you need to share data among components (from parent to child, child to parent, child to grandparent, or *gasp* sibling to sibling).

In this article, originally posted on Medium, we’ll create a basic shopping cart application to explore best practices for sharing data and business logic between components using Services powered by RxJS Observables and BehaviorSubjects.

https://vidalquevedo.medium.com/how-to-share-data-between-components-in-angular-a-shopping-cart-example-b86ce8254965

Categories
Development Wordpress

How to create page breadcrumbs in WordPress

Someone at the WordPress StackExchange site was wondering how you could display a list of a page’s ancestors. Pretty much that is the idea of breadcrumbs, so I answered his question using the handy get_ancestors() function.

Below is the code of the function I created to solve the problem. I called it “print_page_parents,” but it might as well be called “page_breadcumbs” =)

Hope you find it useful!

<?php
/**
 * Print list of ancestors in breadcrum fashion, from lowest to highest hierarchy or viceversa.
 *
*/
function print_page_parents($reverse = false){
  global $post;

  //create array of pages (i.e. current, parent, grandparent)
  $page = array($post->ID);
  $page_ancestors = get_ancestors($post->ID, 'page');
  $pages = array_merge($page, $page_ancestors);

  if($reverse) {
    //reverse array (i.e. grandparent, parent, current)
    $pages = array_reverse($pages);
  }

  for($i=0; $i<count($pages); $i++) {
    $output.= get_the_title($pages[$i]);
    if($i != count($pages) - 1){
      $output.= " » ";
    }
  }
    echo $output;
}

//print lowest to highest
print_page_parents();

//print highest to lowest
print_page_parents($reverse = true);

?>

 

Categories
Uncategorized

Hadoop, MapReduce and processing large Twitter datasets for fun and profit

This fall I just enrolled back to complete my PhD at the School of Journalism and Mass Communications (SJMC) at the University of Wisconsin-Madison. As part of my activities, I’ve been attending the sessions of the Social Media and Democracy research group at SJMC, a great collaborative effort to further research in Social Media and how it’s used in political communications.

As part of a series of upcoming research projects on a HUGE Twitter dataset collected SMAD  during the US 2012 presidential election, we’ve been brushing up on Python, Hadoop and MapReduce. I’m very excited about this opportunity, as big data analysis seems to be coming of age and gaining traction on in several areas of communication research.

Getting started with Hadoop and MapReduce

As part of our training, Alex Hanna, a sociology PhD student at UW-Madison, put together an excellent series of workshops on Twitter (or, as he’s aptly named them,  “Tworkshops“) to get the whole SMAD team started in the art of big data analysis. It’s an excellent reference for beginners, so if you are interested in analyzing Twitter data, this is definitely for you:

Thanks to Alex for all his time and effort. This is all incredibly cool, and I’m looking forward to continue exploring our dataset and learning more about Hadoop and MapReduce!

Categories
Uncategorized

Essential Responsive Web Design Testing Tools

Not much to say here other than the guys at  Designwoop.com put together this GREAT source for online (paid and free) testing tools for responsive web design. Check it out:

http://designwoop.com/2012/04/tools-for-testing-responsive-web-design/

Categories
Uncategorized

[Slideshow] – Responsive Web Design: How the mobile web has changed the way we think and work.

On April 16th, Nick Weaver (@nickweaver) and I gave a presentation at the Madison Web Design & Dev Meetup titled “Responsive Web Design:  How the mobile web has changed the way we think and work.” We were pleased to bring such a cool topic to this meetup led by Ben Siegel, Principal at VersaStudio, LLC.

The presentation was an introduction to Responsive Web Design (RWD), a new approach to web development brought forward and popularized by Ethan Marcotte. We covered the benefits and challenges of RWD and the pros and cons of native vs web-based applications for mobile.

Below is a link to the presentation’s slideshow. Enjoy!

Categories
Development Uncategorized

WordPress: How to display posts within a page

We have all been there: for some reason, you really need to display a list of posts within a page in WordPress. And the list needs to be paginated, of course…

Fortunately, there is a way to do it. The WordPress Codex Page reference has a nice (though pretty much buried) example of a page template to get you started:

How to display posts within a page:
http://codex.wordpress.org/Pages#A_Page_of_Posts

As a great addition, it also has an example of a how to display custom post types within a page as well:

How to display a custom post type within a page:
http://codex.wordpress.org/Pages#Using_Custom_Post_Types

I found this definitely helpful, and hopefully you will too!

Happy coding!

Categories
Uncategorized

Optimizing your web application: Mobile UI performance considerations

In her article Mobile UI performance considerations, Estelle Weyl addresses memory and battery considerations when developing web applications for mobile devices. From embedding CSS and JavaScript into your HTML file (GASP!!!) on first load (and storing the code using localStorage), to minding the DOM and what you CAN’T see in the viewport of a mobile phone, this article is full of great ideas on how to reduce loading and processing times on our beloved tiny devices. A must read.

Get it here -> http://calendar.perfplanet.com/2011/mobile-ui-performance-considerations/

 

Categories
Uncategorized

“When can I use…”: a CSS compatibility reference

Ever wonder when you can use the CSS rule inline-block, or PNG transparency, and what browsers support them? Search no more: http://caniuse.com/ has a cool list of these and other rules. Happy to have found it!