basic

Basic Steps to Playing Blackjack

Learn about the basic steps to playing blackjack so that you can start playing the game to win.




basic

The basics of drugged driving charges in Texas

Texas DWI/DUI charges can be against those under the influence of either alcohol or another intoxicant, like a drug.




basic

G Suite Promo Code for Basic and Business Plan

Cloudsdeal.com is offering exclusive G Suite promo code for Basic, Business & Enterprise Plans. Apply our G Suite coupon codes & get huge discount.




basic

Basic Competence Can Be a Strategy

Raffaella Sadun, a professor at Harvard Business School, explains why seemingly common-sensical management practices are so hard to implement. After surveying thousands of organizations across the world, she found that only 6% of firms qualified as highly well-managed — and that managers mistakenly assumed they were all above average. She is a co-author of “Why Do We Undervalue Competent Management?” in the September–October 2017 issue of Harvard Business Review.




basic

Pattern Making Basics: Printing & Selling

I’m a little late getting this post up, it’s been quarantine mood swing central around here. There are some days where I feel crazy productive and in a good mood like “hey I got this!” and then those days where I’m asking myself how much time is too much to spend on the couch because




basic

Back to Basics

The tax and revenue department in Washington DC has added a 5.75% sales tax on all clubs, centres or gyms run for the purpose of physical exercise.




basic

UPDATE:Grand Canyon National Park Back to Level 1 Basic Water Conservation Measures

Water restrictions at Grand Canyon National Park have been scaled back to basic conservation measures. https://www.nps.gov/grca/learn/news/level-1-water-update.htm




basic

Grand Canyon South Rim to Scale Back to Level 1 Basic Water Conservation Measures

Crews repaired one of the pumps at Indian Garden and park managers feel confident that enough water is in storage to scale back to Level 1 basic water conservation measures. https://www.nps.gov/grca/learn/news/level-1-water-conservation.htm




basic

A basic anywidth flyout menu

Back to basics to show how to use the latest techniques to produce a flyout menu with the widths of the sub levels automatically sized to fit the longest text.




basic

CSSplay - Basic Flexbox Layout

Back to the very basic code and style to produce a 'sticky holy grail' layout.




basic

CSSplay - CSS basic auto play slideshow

A basic responsive auto play slideshow using the latest CSS selectors.




basic

Learning the Basics of Photo Editing

Whether you’re into photography, there are so many basic skills that you can learn when it comes to photo editing that can make a huge difference in your photos and selfies. Between brightening up a photo, changing the size, or cutting something out, there’s always a small thing you wish you could change. In order to do that, you should learn these basic photo editing tools so that you can adjust your photos in the simplest manner. Adobe photoshop If you were to use only one software for photo editing, then it should be none other than Adobe Photoshop. With

The post Learning the Basics of Photo Editing appeared first on Photoshop Lady.




basic

Why universal basic health care is both a moral and economic imperative

Several hundred cars were parked outside a food bank in San Antonio on Good Friday — the food bank fed 10,000 people that day. Such scenes, increasingly common across the nation and evocative...




basic

Why universal basic health care is both a moral and economic imperative

Several hundred cars were parked outside a food bank in San Antonio on Good Friday — the food bank fed 10,000 people that day. Such scenes, increasingly common across the nation and evocative of loaves and fish, reflect the cruel facts about the wealthiest nation in the world: 80 percent of Americans live paycheck to paycheck, and 100 percent of Americans were unprepared for the COVID-19 pandemic. People are hungry due to macroeconomic and environmental factors, not because they did something wrong. Although everyone is at risk in this pandemic, the risk is not shared equally across socioeconomic classes. Universal basic health care could resolve this disparity and many of the moral and economic aspects associated with the pandemic.

Increases in the total output of the economy, or the gross domestic product (GDP), disproportionately benefit the wealthy. From 1980 to 2020, the GDP increased by 79 percent. Over that same time, the after-tax income of the top 0.01 percent of earners increased by 420 percent, while the after-tax income of the middle 40 percent of earners increased by only 50 percent, and by a measly 20 percent for the bottom 50 percent of earners. At present, the top 0.1 percent of earners have the same total net worth as the bottom 85 percent. Such income inequality produces poverty, which is much more common in the U.S. than in other developed countries. Currently 43 million Americans, or 12.7 percent of the population, live in poverty.

At the same time, 30 million Americans are uninsured and many more are underinsured with poorly designed insurance plans. The estimated total of uninsured and underinsured Americans exceeds 80 million. In addition, most of the 600,000 homeless people and 11 million immigrants in the U.S. lack health care coverage. Immigrants represent an especially vulnerable population, since many do not speak English and cannot report hazardous or unsafe work conditions. Furthermore, many immigrants avoid care due to fear of deportation even if they entered the country through legal channels.

Most people in poverty and many in the middle class obtain coverage from federal programs. On a national level, Medicaid is effectively a middle-class program and covers those living in poverty, 30 percent of adults and 60 percent of children with disabilities as well as about 67 percent of people in nursing homes. In Iowa, 37 percent of children and 48 percent of nursing home residents use Medicaid. Medicaid also finances up to 20 percent of the care provided in rural hospitals. Medicare, Medicaid and the Children’s Hospital Insurance Program (CHIP) together cover over 40 percent of Americans.

In addition to facilitating care, health care policy must also address the “social determinants of health,” since the conditions in which people live, work, and play dictate up to 80 percent of their health risks and outcomes. This means that health care reform requires programs in all facets of society. Winston Churchill first conceptualized such an idea in the early 20th century as a tool to prevent the expansion of socialism, arguing that inequality could persist indefinitely without social safety nets. Since that time most developed countries have implemented such social programs, but not the US.

All developed countries except the U.S. provide some type of universal basic health care for their residents. Universal basic health care refers to a system that provides all people with certain essential benefits, such as emergency services (including maternity), inpatient hospital and physician care, outpatient services, laboratory and radiology services, treatment of mental illness and substance abuse, preventive health services (including vaccinations), rehabilitation, and medications. Providing access to these benefits, along with primary care, dramatically improves the health of the community without imposing concerns regarding payment. Perhaps not coincidentally, the U.S. reports a lower life expectancy and higher rates of infant mortality, suicide and homicide compared to other developed countries.

Countries such as Canada, Great Britain, Denmark, Germany, Switzerland, Australia, and Japan all produce better health care outcomes than the U.S. at a much lower cost. In fact the U.S. spends about twice the percentage of its GDP on health care compared to these countries. With that being said, the Affordable Care Act of 2010 (ACA), which facilitated a decrease in the rate of the uninsured in the U.S. from 20 percent to 12 percent, also decreased the percentage of the GDP spent on health care from 20.2 percent to 17.9 percent in just 10 years. For this reason, most economists agree that universal basic health care would not cost more than the current system, and many would also argue that the total costs of the health care system cannot be further reduced unless everyone has access to basic care.

Achieving successful universal basic health care requires a serious long-term commitment from the federal government — contributing to Medicaid and financing its expansion are not enough. It requires courage from our elected leaders. The ACA took several important steps toward this goal by guaranteeing coverage for preexisting conditions, banishing lifetime maximums for essential services, and mandating individual coverage for everyone, though Congress repealed this final provision in 2017. At present, the ACA requires refinement and a public option, thereby preserving private and employer-based plans for those who want them.

Without universal basic health care the people living at the margins of society have no assurances that they will have access to basic health care services, especially during times of pandemic. Access to food and medications is less reliable, large families live together in small spaces, and public transportation facilitates frequent exposure to others. Childhood diseases such as asthma, chronic diseases such as diabetes, and diseases related to smoking such as COPD and cancer are all likely to worsen. Quarantine protocols also exacerbate the mental health crisis, further increasing rates of domestic violence, child abuse, substance abuse, depression, and suicide. In the last six weeks over 30 million Americans have applied for unemployment benefits, and as people become unemployed, many will lose health insurance.

Access to basic health care without economic or legal consequences would greatly enhance all aspects of pandemic management and response, from tracing contacts and quarantining carriers to administering tests and reinforcing supply chains. The COVID-19 pandemic has disproportionately affected minorities and the impoverished in both mortality and livelihood. Universal basic health care helps these vulnerable populations the most, and by reducing their risk it reduces the risk for everyone. In this way, universal basic health care supports the best interests of all Americans.

Like a living wage, universal basic health care aligns with the Christian tradition of social justice and is a moral and economic imperative for all Americans. Nurses, doctors, and other health care providers often observe a sharp contrast between the haves and have-nots when seeing patients. The homeless, the hungry, the unemployed, the working poor, the uninsured; people without families, patients with no visitors, those who live alone or lack support systems; refugees and immigrants — all of these people deserve the fairness and dignity provided by universal basic health care and programs which improve the social determinants of their health. The ACA moved U.S. toward this goal, but now it requires refinement and a public option. The COVID-19 pandemic highlights the urgency of this imperative by demonstrating how universal basic health care could decrease the risks to those less fortunate, thus significantly decreasing the risks to everyone.

James M. Levett, MD, serves on the board of Linn County Public Health and is a practicing cardiothoracic surgeon with Physicians’ Clinic of Iowa. Pramod Dwivedi, MS, DrPH (c), is the health director of Linn County Public Health.




basic

Markdown Comes Alive! Part 1, Basic Editor

In my last post, I covered what LiveView is at a high level. In this series, we’re going to dive deeper and implement a LiveView powered Markdown editor called Frampton. This series assumes you have some familiarity with Phoenix and Elixir, including having them set up locally. Check out Elizabeth’s three-part series on getting started with Phoenix for a refresher.

This series has a companion repository published on GitHub. Get started by cloning it down and switching to the starter branch. You can see the completed application on master. Our goal today is to make a Markdown editor, which allows a user to enter Markdown text on a page and see it rendered as HTML next to it in real-time. We’ll make use of LiveView for the interaction and the Earmark package for rendering Markdown. The starter branch provides some styles and installs LiveView.

Rendering Markdown

Let’s set aside the LiveView portion and start with our data structures and the functions that operate on them. To begin, a Post will have a body, which holds the rendered HTML string, and title. A string of markdown can be turned into HTML by calling Post.render(post, markdown). I think that just about covers it!

First, let’s define our struct in lib/frampton/post.ex:

defmodule Frampton.Post do
  defstruct body: "", title: ""

  def render(%__MODULE{} = post, markdown) do
    # Fill me in!
  end
end

Now the failing test (in test/frampton/post_test.exs):

describe "render/2" do
  test "returns our post with the body set" do
    markdown = "# Hello world!"                                                                                                                 
    assert Post.render(%Post{}, markdown) == {:ok, %Post{body: "<h1>Hello World</h1>
"}}
  end
end

Our render method will just be a wrapper around Earmark.as_html!/2 that puts the result into the body of the post. Add {:earmark, "~> 1.4.3"} to your deps in mix.exs, run mix deps.get and fill out render function:

def render(%__MODULE{} = post, markdown) do
  html = Earmark.as_html!(markdown)
  {:ok, Map.put(post, :body, html)}
end

Our test should now pass, and we can render posts! [Note: we’re using the as_html! method, which prints error messages instead of passing them back to the user. A smarter version of this would handle any errors and show them to the user. I leave that as an exercise for the reader…] Time to play around with this in an IEx prompt (run iex -S mix in your terminal):

iex(1)> alias Frampton.Post
Frampton.Post
iex(2)> post = %Post{}
%Frampton.Post{body: "", title: ""}
iex(3)> {:ok, updated_post} = Post.render(post, "# Hello world!")
{:ok, %Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}}
iex(4)> updated_post
%Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}

Great! That’s exactly what we’d expect. You can find the final code for this in the render_post branch.

LiveView Editor

Now for the fun part: Editing this live!

First, we’ll need a route for the editor to live at: /editor sounds good to me. LiveViews can be rendered from a controller, or directly in the router. We don’t have any initial state, so let's go straight from a router.

First, let's put up a minimal test. In test/frampton_web/live/editor_live_test.exs:

defmodule FramptonWeb.EditorLiveTest do
  use FramptonWeb.ConnCase
  import Phoenix.LiveViewTest

  test "the editor renders" do
    conn = get(build_conn(), "/editor")
    assert html_response(conn, 200) =~ "data-test="editor""
  end
end

This test doesn’t do much yet, but notice that it isn’t live view specific. Our first render is just the same as any other controller test we’d write. The page’s content is there right from the beginning, without the need to parse JavaScript or make API calls back to the server. Nice.

To make that test pass, add a route to lib/frampton_web/router.ex. First, we import the LiveView code, then we render our Editor:

import Phoenix.LiveView.Router
# … Code skipped ...
# Inside of `scope "/"`:
live "/editor", EditorLive

Now place a minimal EditorLive module, in lib/frampton_web/live/editor_live.ex:

defmodule FramptonWeb.EditorLive do
  use Phoenix.LiveView

  def render(assigns) do
    ~L"""
      <div data-test=”editor”>
        <h1>Hello world!</h1>
      </div>
      """
  end

  def mount(_params, _session, socket) do
    {:ok, socket}
  end
end

And we have a passing test suite! The ~L sigil designates that LiveView should track changes to the content inside. We could keep all of our markup in this render/1 method, but let’s break it out into its own template for demonstration purposes.

Move the contents of render into lib/frampton_web/templates/editor/show.html.leex, and replace EditorLive.render/1 with this one liner: def render(assigns), do: FramptonWeb.EditorView.render("show.html", assigns). And finally, make an EditorView module in lib/frampton_web/views/editor_view.ex:

defmodule FramptonWeb.EditorView do
  use FramptonWeb, :view
  import Phoenix.LiveView
end

Our test should now be passing, and we’ve got a nicely separated out template, view and “live” server. We can keep markup in the template, helper functions in the view, and reactive code on the server. Now let’s move forward to actually render some posts!

Handling User Input

We’ve got four tasks to accomplish before we are done:

  1. Take markdown input from the textarea
  2. Send that input to the LiveServer
  3. Turn that raw markdown into HTML
  4. Return the rendered HTML to the page.

Event binding

To start with, we need to annotate our textarea with an event binding. This tells the liveview.js framework to forward DOM events to the server, using our liveview channel. Open up lib/frampton_web/templates/editor/show.html.leex and annotate our textarea:

<textarea phx-keyup="render_post"></textarea>

This names the event (render_post) and sends it on each keyup. Let’s crack open our web inspector and look at the web socket traffic. Using Chrome, open the developer tools, navigate to the network tab and click WS. In development you’ll see two socket connections: one is Phoenix LiveReload, which polls your filesystem and reloads pages appropriately. The second one is our LiveView connection. If you let it sit for a while, you’ll see that it's emitting a “heartbeat” call. If your server is running, you’ll see that it responds with an “ok” message. This lets LiveView clients know when they've lost connection to the server and respond appropriately.

Now, type some text and watch as it sends down each keystroke. However, you’ll also notice that the server responds with a “phx_error” message and wipes out our entered text. That's because our server doesn’t know how to handle the event yet and is throwing an error. Let's fix that next.

Event handling

We’ll catch the event in our EditorLive module. The LiveView behavior defines a handle_event/3 callback that we need to implement. Open up lib/frampton_web/live/editor_live.ex and key in a basic implementation that lets us catch events:

def handle_event("render_post", params, socket) do
  IO.inspect(params)

  {:noreply, socket}
end

The first argument is the name we gave to our event in the template, the second is the data from that event, and finally the socket we’re currently talking through. Give it a try, typing in a few characters. Look at your running server and you should see a stream of events that look something like this:

There’s our keystrokes! Next, let’s pull out that value and use it to render HTML.

Rendering Markdown

Lets adjust our handle_event to pattern match out the value of the textarea:

def handle_event("render_post", %{"value" => raw}, socket) do

Now that we’ve got the raw markdown string, turning it into HTML is easy thanks to the work we did earlier in our Post module. Fill out the body of the function like this:

{:ok, post} = Post.render(%Post{}, raw)
IO.inspect(post)

If you type into the textarea you should see output that looks something like this:

Perfect! Lastly, it’s time to send that rendered html back to the page.

Returning HTML to the page

In a LiveView template, we can identify bits of dynamic data that will change over time. When they change, LiveView will compare what has changed and send over a diff. In our case, the dynamic content is the post body.

Open up show.html.leex again and modify it like so:

<div class="rendered-output">
  <%= @post.body %>
</div>

Refresh the page and see:

Whoops!

The @post variable will only be available after we put it into the socket’s assigns. Let’s initialize it with a blank post. Open editor_live.ex and modify our mount/3 function:

def mount(_params, _session, socket) do
  post = %Post{}
  {:ok, assign(socket, post: post)}
end

In the future, we could retrieve this from some kind of storage, but for now, let's just create a new one each time the page refreshes. Finally, we need to update the Post struct with user input. Update our event handler like this:

def handle_event("render_post", %{"value" => raw}, %{assigns: %{post: post}} = socket) do
  {:ok, post} = Post.render(post, raw)
  {:noreply, assign(socket, post: post)
end

Let's load up http://localhost:4000/editor and see it in action.

Nope, that's not quite right! Phoenix won’t render this as HTML because it’s unsafe user input. We can get around this (very good and useful) security feature by wrapping our content in a raw/1 call. We don’t have a database and user processes are isolated from each other by Elixir. The worst thing a malicious user could do would be crash their own session, which doesn’t bother me one bit.

Check the edit_posts branch for the final version.

Conclusion

That’s a good place to stop for today. We’ve accomplished a lot! We’ve got a dynamically rendering editor that takes user input, processes it and updates the page. And we haven’t written any JavaScript, which means we don’t have to maintain or update any JavaScript. Our server code is built on the rock-solid foundation of the BEAM virtual machine, giving us a great deal of confidence in its reliability and resilience.

In the next post, we’ll tackle making a shared editor, allowing multiple users to edit the same post. This project will highlight Elixir’s concurrency capabilities and demonstrate how LiveView builds on them to enable some incredible user experiences.



  • Code
  • Back-end Engineering

basic

Markdown Comes Alive! Part 1, Basic Editor

In my last post, I covered what LiveView is at a high level. In this series, we’re going to dive deeper and implement a LiveView powered Markdown editor called Frampton. This series assumes you have some familiarity with Phoenix and Elixir, including having them set up locally. Check out Elizabeth’s three-part series on getting started with Phoenix for a refresher.

This series has a companion repository published on GitHub. Get started by cloning it down and switching to the starter branch. You can see the completed application on master. Our goal today is to make a Markdown editor, which allows a user to enter Markdown text on a page and see it rendered as HTML next to it in real-time. We’ll make use of LiveView for the interaction and the Earmark package for rendering Markdown. The starter branch provides some styles and installs LiveView.

Rendering Markdown

Let’s set aside the LiveView portion and start with our data structures and the functions that operate on them. To begin, a Post will have a body, which holds the rendered HTML string, and title. A string of markdown can be turned into HTML by calling Post.render(post, markdown). I think that just about covers it!

First, let’s define our struct in lib/frampton/post.ex:

defmodule Frampton.Post do
  defstruct body: "", title: ""

  def render(%__MODULE{} = post, markdown) do
    # Fill me in!
  end
end

Now the failing test (in test/frampton/post_test.exs):

describe "render/2" do
  test "returns our post with the body set" do
    markdown = "# Hello world!"                                                                                                                 
    assert Post.render(%Post{}, markdown) == {:ok, %Post{body: "<h1>Hello World</h1>
"}}
  end
end

Our render method will just be a wrapper around Earmark.as_html!/2 that puts the result into the body of the post. Add {:earmark, "~> 1.4.3"} to your deps in mix.exs, run mix deps.get and fill out render function:

def render(%__MODULE{} = post, markdown) do
  html = Earmark.as_html!(markdown)
  {:ok, Map.put(post, :body, html)}
end

Our test should now pass, and we can render posts! [Note: we’re using the as_html! method, which prints error messages instead of passing them back to the user. A smarter version of this would handle any errors and show them to the user. I leave that as an exercise for the reader…] Time to play around with this in an IEx prompt (run iex -S mix in your terminal):

iex(1)> alias Frampton.Post
Frampton.Post
iex(2)> post = %Post{}
%Frampton.Post{body: "", title: ""}
iex(3)> {:ok, updated_post} = Post.render(post, "# Hello world!")
{:ok, %Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}}
iex(4)> updated_post
%Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}

Great! That’s exactly what we’d expect. You can find the final code for this in the render_post branch.

LiveView Editor

Now for the fun part: Editing this live!

First, we’ll need a route for the editor to live at: /editor sounds good to me. LiveViews can be rendered from a controller, or directly in the router. We don’t have any initial state, so let's go straight from a router.

First, let's put up a minimal test. In test/frampton_web/live/editor_live_test.exs:

defmodule FramptonWeb.EditorLiveTest do
  use FramptonWeb.ConnCase
  import Phoenix.LiveViewTest

  test "the editor renders" do
    conn = get(build_conn(), "/editor")
    assert html_response(conn, 200) =~ "data-test="editor""
  end
end

This test doesn’t do much yet, but notice that it isn’t live view specific. Our first render is just the same as any other controller test we’d write. The page’s content is there right from the beginning, without the need to parse JavaScript or make API calls back to the server. Nice.

To make that test pass, add a route to lib/frampton_web/router.ex. First, we import the LiveView code, then we render our Editor:

import Phoenix.LiveView.Router
# … Code skipped ...
# Inside of `scope "/"`:
live "/editor", EditorLive

Now place a minimal EditorLive module, in lib/frampton_web/live/editor_live.ex:

defmodule FramptonWeb.EditorLive do
  use Phoenix.LiveView

  def render(assigns) do
    ~L"""
      <div data-test=”editor”>
        <h1>Hello world!</h1>
      </div>
      """
  end

  def mount(_params, _session, socket) do
    {:ok, socket}
  end
end

And we have a passing test suite! The ~L sigil designates that LiveView should track changes to the content inside. We could keep all of our markup in this render/1 method, but let’s break it out into its own template for demonstration purposes.

Move the contents of render into lib/frampton_web/templates/editor/show.html.leex, and replace EditorLive.render/1 with this one liner: def render(assigns), do: FramptonWeb.EditorView.render("show.html", assigns). And finally, make an EditorView module in lib/frampton_web/views/editor_view.ex:

defmodule FramptonWeb.EditorView do
  use FramptonWeb, :view
  import Phoenix.LiveView
end

Our test should now be passing, and we’ve got a nicely separated out template, view and “live” server. We can keep markup in the template, helper functions in the view, and reactive code on the server. Now let’s move forward to actually render some posts!

Handling User Input

We’ve got four tasks to accomplish before we are done:

  1. Take markdown input from the textarea
  2. Send that input to the LiveServer
  3. Turn that raw markdown into HTML
  4. Return the rendered HTML to the page.

Event binding

To start with, we need to annotate our textarea with an event binding. This tells the liveview.js framework to forward DOM events to the server, using our liveview channel. Open up lib/frampton_web/templates/editor/show.html.leex and annotate our textarea:

<textarea phx-keyup="render_post"></textarea>

This names the event (render_post) and sends it on each keyup. Let’s crack open our web inspector and look at the web socket traffic. Using Chrome, open the developer tools, navigate to the network tab and click WS. In development you’ll see two socket connections: one is Phoenix LiveReload, which polls your filesystem and reloads pages appropriately. The second one is our LiveView connection. If you let it sit for a while, you’ll see that it's emitting a “heartbeat” call. If your server is running, you’ll see that it responds with an “ok” message. This lets LiveView clients know when they've lost connection to the server and respond appropriately.

Now, type some text and watch as it sends down each keystroke. However, you’ll also notice that the server responds with a “phx_error” message and wipes out our entered text. That's because our server doesn’t know how to handle the event yet and is throwing an error. Let's fix that next.

Event handling

We’ll catch the event in our EditorLive module. The LiveView behavior defines a handle_event/3 callback that we need to implement. Open up lib/frampton_web/live/editor_live.ex and key in a basic implementation that lets us catch events:

def handle_event("render_post", params, socket) do
  IO.inspect(params)

  {:noreply, socket}
end

The first argument is the name we gave to our event in the template, the second is the data from that event, and finally the socket we’re currently talking through. Give it a try, typing in a few characters. Look at your running server and you should see a stream of events that look something like this:

There’s our keystrokes! Next, let’s pull out that value and use it to render HTML.

Rendering Markdown

Lets adjust our handle_event to pattern match out the value of the textarea:

def handle_event("render_post", %{"value" => raw}, socket) do

Now that we’ve got the raw markdown string, turning it into HTML is easy thanks to the work we did earlier in our Post module. Fill out the body of the function like this:

{:ok, post} = Post.render(%Post{}, raw)
IO.inspect(post)

If you type into the textarea you should see output that looks something like this:

Perfect! Lastly, it’s time to send that rendered html back to the page.

Returning HTML to the page

In a LiveView template, we can identify bits of dynamic data that will change over time. When they change, LiveView will compare what has changed and send over a diff. In our case, the dynamic content is the post body.

Open up show.html.leex again and modify it like so:

<div class="rendered-output">
  <%= @post.body %>
</div>

Refresh the page and see:

Whoops!

The @post variable will only be available after we put it into the socket’s assigns. Let’s initialize it with a blank post. Open editor_live.ex and modify our mount/3 function:

def mount(_params, _session, socket) do
  post = %Post{}
  {:ok, assign(socket, post: post)}
end

In the future, we could retrieve this from some kind of storage, but for now, let's just create a new one each time the page refreshes. Finally, we need to update the Post struct with user input. Update our event handler like this:

def handle_event("render_post", %{"value" => raw}, %{assigns: %{post: post}} = socket) do
  {:ok, post} = Post.render(post, raw)
  {:noreply, assign(socket, post: post)
end

Let's load up http://localhost:4000/editor and see it in action.

Nope, that's not quite right! Phoenix won’t render this as HTML because it’s unsafe user input. We can get around this (very good and useful) security feature by wrapping our content in a raw/1 call. We don’t have a database and user processes are isolated from each other by Elixir. The worst thing a malicious user could do would be crash their own session, which doesn’t bother me one bit.

Check the edit_posts branch for the final version.

Conclusion

That’s a good place to stop for today. We’ve accomplished a lot! We’ve got a dynamically rendering editor that takes user input, processes it and updates the page. And we haven’t written any JavaScript, which means we don’t have to maintain or update any JavaScript. Our server code is built on the rock-solid foundation of the BEAM virtual machine, giving us a great deal of confidence in its reliability and resilience.

In the next post, we’ll tackle making a shared editor, allowing multiple users to edit the same post. This project will highlight Elixir’s concurrency capabilities and demonstrate how LiveView builds on them to enable some incredible user experiences.



  • Code
  • Back-end Engineering

basic

Markdown Comes Alive! Part 1, Basic Editor

In my last post, I covered what LiveView is at a high level. In this series, we’re going to dive deeper and implement a LiveView powered Markdown editor called Frampton. This series assumes you have some familiarity with Phoenix and Elixir, including having them set up locally. Check out Elizabeth’s three-part series on getting started with Phoenix for a refresher.

This series has a companion repository published on GitHub. Get started by cloning it down and switching to the starter branch. You can see the completed application on master. Our goal today is to make a Markdown editor, which allows a user to enter Markdown text on a page and see it rendered as HTML next to it in real-time. We’ll make use of LiveView for the interaction and the Earmark package for rendering Markdown. The starter branch provides some styles and installs LiveView.

Rendering Markdown

Let’s set aside the LiveView portion and start with our data structures and the functions that operate on them. To begin, a Post will have a body, which holds the rendered HTML string, and title. A string of markdown can be turned into HTML by calling Post.render(post, markdown). I think that just about covers it!

First, let’s define our struct in lib/frampton/post.ex:

defmodule Frampton.Post do
  defstruct body: "", title: ""

  def render(%__MODULE{} = post, markdown) do
    # Fill me in!
  end
end

Now the failing test (in test/frampton/post_test.exs):

describe "render/2" do
  test "returns our post with the body set" do
    markdown = "# Hello world!"                                                                                                                 
    assert Post.render(%Post{}, markdown) == {:ok, %Post{body: "<h1>Hello World</h1>
"}}
  end
end

Our render method will just be a wrapper around Earmark.as_html!/2 that puts the result into the body of the post. Add {:earmark, "~> 1.4.3"} to your deps in mix.exs, run mix deps.get and fill out render function:

def render(%__MODULE{} = post, markdown) do
  html = Earmark.as_html!(markdown)
  {:ok, Map.put(post, :body, html)}
end

Our test should now pass, and we can render posts! [Note: we’re using the as_html! method, which prints error messages instead of passing them back to the user. A smarter version of this would handle any errors and show them to the user. I leave that as an exercise for the reader…] Time to play around with this in an IEx prompt (run iex -S mix in your terminal):

iex(1)> alias Frampton.Post
Frampton.Post
iex(2)> post = %Post{}
%Frampton.Post{body: "", title: ""}
iex(3)> {:ok, updated_post} = Post.render(post, "# Hello world!")
{:ok, %Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}}
iex(4)> updated_post
%Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}

Great! That’s exactly what we’d expect. You can find the final code for this in the render_post branch.

LiveView Editor

Now for the fun part: Editing this live!

First, we’ll need a route for the editor to live at: /editor sounds good to me. LiveViews can be rendered from a controller, or directly in the router. We don’t have any initial state, so let's go straight from a router.

First, let's put up a minimal test. In test/frampton_web/live/editor_live_test.exs:

defmodule FramptonWeb.EditorLiveTest do
  use FramptonWeb.ConnCase
  import Phoenix.LiveViewTest

  test "the editor renders" do
    conn = get(build_conn(), "/editor")
    assert html_response(conn, 200) =~ "data-test="editor""
  end
end

This test doesn’t do much yet, but notice that it isn’t live view specific. Our first render is just the same as any other controller test we’d write. The page’s content is there right from the beginning, without the need to parse JavaScript or make API calls back to the server. Nice.

To make that test pass, add a route to lib/frampton_web/router.ex. First, we import the LiveView code, then we render our Editor:

import Phoenix.LiveView.Router
# … Code skipped ...
# Inside of `scope "/"`:
live "/editor", EditorLive

Now place a minimal EditorLive module, in lib/frampton_web/live/editor_live.ex:

defmodule FramptonWeb.EditorLive do
  use Phoenix.LiveView

  def render(assigns) do
    ~L"""
      <div data-test=”editor”>
        <h1>Hello world!</h1>
      </div>
      """
  end

  def mount(_params, _session, socket) do
    {:ok, socket}
  end
end

And we have a passing test suite! The ~L sigil designates that LiveView should track changes to the content inside. We could keep all of our markup in this render/1 method, but let’s break it out into its own template for demonstration purposes.

Move the contents of render into lib/frampton_web/templates/editor/show.html.leex, and replace EditorLive.render/1 with this one liner: def render(assigns), do: FramptonWeb.EditorView.render("show.html", assigns). And finally, make an EditorView module in lib/frampton_web/views/editor_view.ex:

defmodule FramptonWeb.EditorView do
  use FramptonWeb, :view
  import Phoenix.LiveView
end

Our test should now be passing, and we’ve got a nicely separated out template, view and “live” server. We can keep markup in the template, helper functions in the view, and reactive code on the server. Now let’s move forward to actually render some posts!

Handling User Input

We’ve got four tasks to accomplish before we are done:

  1. Take markdown input from the textarea
  2. Send that input to the LiveServer
  3. Turn that raw markdown into HTML
  4. Return the rendered HTML to the page.

Event binding

To start with, we need to annotate our textarea with an event binding. This tells the liveview.js framework to forward DOM events to the server, using our liveview channel. Open up lib/frampton_web/templates/editor/show.html.leex and annotate our textarea:

<textarea phx-keyup="render_post"></textarea>

This names the event (render_post) and sends it on each keyup. Let’s crack open our web inspector and look at the web socket traffic. Using Chrome, open the developer tools, navigate to the network tab and click WS. In development you’ll see two socket connections: one is Phoenix LiveReload, which polls your filesystem and reloads pages appropriately. The second one is our LiveView connection. If you let it sit for a while, you’ll see that it's emitting a “heartbeat” call. If your server is running, you’ll see that it responds with an “ok” message. This lets LiveView clients know when they've lost connection to the server and respond appropriately.

Now, type some text and watch as it sends down each keystroke. However, you’ll also notice that the server responds with a “phx_error” message and wipes out our entered text. That's because our server doesn’t know how to handle the event yet and is throwing an error. Let's fix that next.

Event handling

We’ll catch the event in our EditorLive module. The LiveView behavior defines a handle_event/3 callback that we need to implement. Open up lib/frampton_web/live/editor_live.ex and key in a basic implementation that lets us catch events:

def handle_event("render_post", params, socket) do
  IO.inspect(params)

  {:noreply, socket}
end

The first argument is the name we gave to our event in the template, the second is the data from that event, and finally the socket we’re currently talking through. Give it a try, typing in a few characters. Look at your running server and you should see a stream of events that look something like this:

There’s our keystrokes! Next, let’s pull out that value and use it to render HTML.

Rendering Markdown

Lets adjust our handle_event to pattern match out the value of the textarea:

def handle_event("render_post", %{"value" => raw}, socket) do

Now that we’ve got the raw markdown string, turning it into HTML is easy thanks to the work we did earlier in our Post module. Fill out the body of the function like this:

{:ok, post} = Post.render(%Post{}, raw)
IO.inspect(post)

If you type into the textarea you should see output that looks something like this:

Perfect! Lastly, it’s time to send that rendered html back to the page.

Returning HTML to the page

In a LiveView template, we can identify bits of dynamic data that will change over time. When they change, LiveView will compare what has changed and send over a diff. In our case, the dynamic content is the post body.

Open up show.html.leex again and modify it like so:

<div class="rendered-output">
  <%= @post.body %>
</div>

Refresh the page and see:

Whoops!

The @post variable will only be available after we put it into the socket’s assigns. Let’s initialize it with a blank post. Open editor_live.ex and modify our mount/3 function:

def mount(_params, _session, socket) do
  post = %Post{}
  {:ok, assign(socket, post: post)}
end

In the future, we could retrieve this from some kind of storage, but for now, let's just create a new one each time the page refreshes. Finally, we need to update the Post struct with user input. Update our event handler like this:

def handle_event("render_post", %{"value" => raw}, %{assigns: %{post: post}} = socket) do
  {:ok, post} = Post.render(post, raw)
  {:noreply, assign(socket, post: post)
end

Let's load up http://localhost:4000/editor and see it in action.

Nope, that's not quite right! Phoenix won’t render this as HTML because it’s unsafe user input. We can get around this (very good and useful) security feature by wrapping our content in a raw/1 call. We don’t have a database and user processes are isolated from each other by Elixir. The worst thing a malicious user could do would be crash their own session, which doesn’t bother me one bit.

Check the edit_posts branch for the final version.

Conclusion

That’s a good place to stop for today. We’ve accomplished a lot! We’ve got a dynamically rendering editor that takes user input, processes it and updates the page. And we haven’t written any JavaScript, which means we don’t have to maintain or update any JavaScript. Our server code is built on the rock-solid foundation of the BEAM virtual machine, giving us a great deal of confidence in its reliability and resilience.

In the next post, we’ll tackle making a shared editor, allowing multiple users to edit the same post. This project will highlight Elixir’s concurrency capabilities and demonstrate how LiveView builds on them to enable some incredible user experiences.



  • Code
  • Back-end Engineering

basic

What Does Big Tech Know About You? Basically Everything

Big tech companies have been spying on us for years. This knowledge isn’t new information, but what could be surprising is exactly to what extent each company does it. Security Baron categories what data six of the biggest tech companies collect from you in The Data Big Companies Have On You infographic, and these are just the ones they admit to collecting on their own privacy pages!

The seemingly endless stream of Facebook privacy scandals of late—including the latest involving users as young as 13 years old—may have you questioning how much the social network and other tech giants actually know about you.

The folks at Security Baron examined the privacy policies of Facebook, Google, Apple, Twitter, Amazon, and Microsoft and put together a handy infographic showing the types of data each company admits to collecting. For Facebook and others, data is money. But just how much these tech giants actually know about you might be surprising.

As you can see in the infographic below, Facebook is particularly data-hungry, even gathering information about your work, income level, race, religion, political views, and the ads you click in addition to more commonly collected data points such as your phone number, email address, location, and the type of devices you use.

"Facebook is unusually aggressive," Security Baron pointed out. "This data can be exploited by advertisers and (hopefully not nefarious) others."

Twitter, in comparison, is "comparatively hands-off," the site notes. The microblogging service, for instance, doesn't collect your name, gender, or birthday (Facebook, Google, and Microsoft all do), but Twitter does know your phone number, email address, time zone, what videos you watch, and more.

Google and Microsoft, meanwhile, are the other big players when it comes to collecting data.

"With Cortana listening in and Gmail seeing all of your emails, the ubiquitous nature of Google and Microsoft gives them access to an uncomfortably large amount of your information," Security Baron wrote.

Check out the full infographic below to see what Facebook, Google, Apple, Twitter, Amazon, and Microsoft may know about you. For tips on securing your digital privacy, check our story, "Online Data Protection 101: Don't Let Big Tech Get Rich Off Your Info.

This is a fairly simple infographic design using a comparison table. I think the use of the icons is particularly effective showing which of Google’s or Microsoft’s apps are collecting the data.

Although the types of data are identified down the left side, I wish there was a way to identify the more sensitive types of data.

Original article can be found at https://www.pcmag.com/




basic

Markdown Comes Alive! Part 1, Basic Editor

In my last post, I covered what LiveView is at a high level. In this series, we’re going to dive deeper and implement a LiveView powered Markdown editor called Frampton. This series assumes you have some familiarity with Phoenix and Elixir, including having them set up locally. Check out Elizabeth’s three-part series on getting started with Phoenix for a refresher.

This series has a companion repository published on GitHub. Get started by cloning it down and switching to the starter branch. You can see the completed application on master. Our goal today is to make a Markdown editor, which allows a user to enter Markdown text on a page and see it rendered as HTML next to it in real-time. We’ll make use of LiveView for the interaction and the Earmark package for rendering Markdown. The starter branch provides some styles and installs LiveView.

Rendering Markdown

Let’s set aside the LiveView portion and start with our data structures and the functions that operate on them. To begin, a Post will have a body, which holds the rendered HTML string, and title. A string of markdown can be turned into HTML by calling Post.render(post, markdown). I think that just about covers it!

First, let’s define our struct in lib/frampton/post.ex:

defmodule Frampton.Post do
  defstruct body: "", title: ""

  def render(%__MODULE{} = post, markdown) do
    # Fill me in!
  end
end

Now the failing test (in test/frampton/post_test.exs):

describe "render/2" do
  test "returns our post with the body set" do
    markdown = "# Hello world!"                                                                                                                 
    assert Post.render(%Post{}, markdown) == {:ok, %Post{body: "<h1>Hello World</h1>
"}}
  end
end

Our render method will just be a wrapper around Earmark.as_html!/2 that puts the result into the body of the post. Add {:earmark, "~> 1.4.3"} to your deps in mix.exs, run mix deps.get and fill out render function:

def render(%__MODULE{} = post, markdown) do
  html = Earmark.as_html!(markdown)
  {:ok, Map.put(post, :body, html)}
end

Our test should now pass, and we can render posts! [Note: we’re using the as_html! method, which prints error messages instead of passing them back to the user. A smarter version of this would handle any errors and show them to the user. I leave that as an exercise for the reader…] Time to play around with this in an IEx prompt (run iex -S mix in your terminal):

iex(1)> alias Frampton.Post
Frampton.Post
iex(2)> post = %Post{}
%Frampton.Post{body: "", title: ""}
iex(3)> {:ok, updated_post} = Post.render(post, "# Hello world!")
{:ok, %Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}}
iex(4)> updated_post
%Frampton.Post{body: "<h1>Hello world!</h1>
", title: ""}

Great! That’s exactly what we’d expect. You can find the final code for this in the render_post branch.

LiveView Editor

Now for the fun part: Editing this live!

First, we’ll need a route for the editor to live at: /editor sounds good to me. LiveViews can be rendered from a controller, or directly in the router. We don’t have any initial state, so let's go straight from a router.

First, let's put up a minimal test. In test/frampton_web/live/editor_live_test.exs:

defmodule FramptonWeb.EditorLiveTest do
  use FramptonWeb.ConnCase
  import Phoenix.LiveViewTest

  test "the editor renders" do
    conn = get(build_conn(), "/editor")
    assert html_response(conn, 200) =~ "data-test="editor""
  end
end

This test doesn’t do much yet, but notice that it isn’t live view specific. Our first render is just the same as any other controller test we’d write. The page’s content is there right from the beginning, without the need to parse JavaScript or make API calls back to the server. Nice.

To make that test pass, add a route to lib/frampton_web/router.ex. First, we import the LiveView code, then we render our Editor:

import Phoenix.LiveView.Router
# … Code skipped ...
# Inside of `scope "/"`:
live "/editor", EditorLive

Now place a minimal EditorLive module, in lib/frampton_web/live/editor_live.ex:

defmodule FramptonWeb.EditorLive do
  use Phoenix.LiveView

  def render(assigns) do
    ~L"""
      <div data-test=”editor”>
        <h1>Hello world!</h1>
      </div>
      """
  end

  def mount(_params, _session, socket) do
    {:ok, socket}
  end
end

And we have a passing test suite! The ~L sigil designates that LiveView should track changes to the content inside. We could keep all of our markup in this render/1 method, but let’s break it out into its own template for demonstration purposes.

Move the contents of render into lib/frampton_web/templates/editor/show.html.leex, and replace EditorLive.render/1 with this one liner: def render(assigns), do: FramptonWeb.EditorView.render("show.html", assigns). And finally, make an EditorView module in lib/frampton_web/views/editor_view.ex:

defmodule FramptonWeb.EditorView do
  use FramptonWeb, :view
  import Phoenix.LiveView
end

Our test should now be passing, and we’ve got a nicely separated out template, view and “live” server. We can keep markup in the template, helper functions in the view, and reactive code on the server. Now let’s move forward to actually render some posts!

Handling User Input

We’ve got four tasks to accomplish before we are done:

  1. Take markdown input from the textarea
  2. Send that input to the LiveServer
  3. Turn that raw markdown into HTML
  4. Return the rendered HTML to the page.

Event binding

To start with, we need to annotate our textarea with an event binding. This tells the liveview.js framework to forward DOM events to the server, using our liveview channel. Open up lib/frampton_web/templates/editor/show.html.leex and annotate our textarea:

<textarea phx-keyup="render_post"></textarea>

This names the event (render_post) and sends it on each keyup. Let’s crack open our web inspector and look at the web socket traffic. Using Chrome, open the developer tools, navigate to the network tab and click WS. In development you’ll see two socket connections: one is Phoenix LiveReload, which polls your filesystem and reloads pages appropriately. The second one is our LiveView connection. If you let it sit for a while, you’ll see that it's emitting a “heartbeat” call. If your server is running, you’ll see that it responds with an “ok” message. This lets LiveView clients know when they've lost connection to the server and respond appropriately.

Now, type some text and watch as it sends down each keystroke. However, you’ll also notice that the server responds with a “phx_error” message and wipes out our entered text. That's because our server doesn’t know how to handle the event yet and is throwing an error. Let's fix that next.

Event handling

We’ll catch the event in our EditorLive module. The LiveView behavior defines a handle_event/3 callback that we need to implement. Open up lib/frampton_web/live/editor_live.ex and key in a basic implementation that lets us catch events:

def handle_event("render_post", params, socket) do
  IO.inspect(params)

  {:noreply, socket}
end

The first argument is the name we gave to our event in the template, the second is the data from that event, and finally the socket we’re currently talking through. Give it a try, typing in a few characters. Look at your running server and you should see a stream of events that look something like this:

There’s our keystrokes! Next, let’s pull out that value and use it to render HTML.

Rendering Markdown

Lets adjust our handle_event to pattern match out the value of the textarea:

def handle_event("render_post", %{"value" => raw}, socket) do

Now that we’ve got the raw markdown string, turning it into HTML is easy thanks to the work we did earlier in our Post module. Fill out the body of the function like this:

{:ok, post} = Post.render(%Post{}, raw)
IO.inspect(post)

If you type into the textarea you should see output that looks something like this:

Perfect! Lastly, it’s time to send that rendered html back to the page.

Returning HTML to the page

In a LiveView template, we can identify bits of dynamic data that will change over time. When they change, LiveView will compare what has changed and send over a diff. In our case, the dynamic content is the post body.

Open up show.html.leex again and modify it like so:

<div class="rendered-output">
  <%= @post.body %>
</div>

Refresh the page and see:

Whoops!

The @post variable will only be available after we put it into the socket’s assigns. Let’s initialize it with a blank post. Open editor_live.ex and modify our mount/3 function:

def mount(_params, _session, socket) do
  post = %Post{}
  {:ok, assign(socket, post: post)}
end

In the future, we could retrieve this from some kind of storage, but for now, let's just create a new one each time the page refreshes. Finally, we need to update the Post struct with user input. Update our event handler like this:

def handle_event("render_post", %{"value" => raw}, %{assigns: %{post: post}} = socket) do
  {:ok, post} = Post.render(post, raw)
  {:noreply, assign(socket, post: post)
end

Let's load up http://localhost:4000/editor and see it in action.

Nope, that's not quite right! Phoenix won’t render this as HTML because it’s unsafe user input. We can get around this (very good and useful) security feature by wrapping our content in a raw/1 call. We don’t have a database and user processes are isolated from each other by Elixir. The worst thing a malicious user could do would be crash their own session, which doesn’t bother me one bit.

Check the edit_posts branch for the final version.

Conclusion

That’s a good place to stop for today. We’ve accomplished a lot! We’ve got a dynamically rendering editor that takes user input, processes it and updates the page. And we haven’t written any JavaScript, which means we don’t have to maintain or update any JavaScript. Our server code is built on the rock-solid foundation of the BEAM virtual machine, giving us a great deal of confidence in its reliability and resilience.

In the next post, we’ll tackle making a shared editor, allowing multiple users to edit the same post. This project will highlight Elixir’s concurrency capabilities and demonstrate how LiveView builds on them to enable some incredible user experiences.



  • Code
  • Back-end Engineering

basic

240 Basic Icons Vector Freebie

Flat design is everywhere. Nowadays aesthetics is a lot more simple. No more glossy buttons or gradients background, or what a about the shiny table effect every client asked for?.It is all gone now. In favor of a more “undesigned” look a back to basics trend. Following that idea the guys at your favorite resources …

240 Basic Icons Vector Freebie Read More »




basic

Methods of refining and producing dibasic esters and acids from natural oil feedstocks

Methods are provided for refining natural oil feedstocks and producing dibasic esters and/or dibasic acids. The methods comprise reacting a terminal olefin with an internal olefin in the presence of a metathesis catalyst to form a dibasic ester and/or dibasic acid. In certain embodiments, the olefin esters are formed by reacting the feedstock in the presence of a metathesis catalyst under conditions sufficient to form a metathesized product comprising olefins and esters, separating the olefins from the esters in the metathesized product, and transesterifying the esters in the presence of an alcohol to form a transesterified product having olefin esters.




basic

Methods for removing weakly basic nitrogen compounds from a hydrocarbon stream using basic molecular sieves

Disclosed is a method for removing weakly basic nitrogen compounds from a hydrocarbon feed stream by contacting the hydrocarbon feed stream with a basic catalyst to convert a portion of the weakly basic nitrogen compounds to basic nitrogen compounds. The method also includes contacting the hydrocarbon feed stream with an acidic adsorbent to adsorb the basic nitrogen compounds from the stream. The hydrocarbon feed stream comprises an aromatic compound and a weakly basic nitrogen compound.




basic

Methods for removing weakly basic nitrogen compounds from a hydrocarbon stream using acidic clay

Disclosed is a method for removing weakly basic nitrogen compounds from a hydrocarbon feed stream by contacting the hydrocarbon feed stream with acidic clay to produce a hydrocarbon effluent stream having a lower weakly basic nitrogen compound content relative to the hydrocarbon feed stream. The hydrocarbon feed stream comprises an aromatic compound and a weakly basic nitrogen compound.




basic

Basic bisazo compounds

The invention relates to basic bisazo compounds according to formula (I) wherein all substituents are defined as in Claim 1, their production, their use as dyestuffs as well as material dyed with these dyestuffs.




basic

Basic zinc cyanurate fine particles, and method for producing same

Basic zinc cyanurate fine particles are produced by subjecting a mixed slurry to wet dispersion using a dispersion medium at a temperature in the range of 5 to 55° C., the mixed slurry being formed by blending water, cyanuric acid, and at least one component selected from zinc oxide and basic zinc carbonate such that the cyanuric acid concentration is 0.1 to 10.0 mass % with respect to water.




basic

Multi-strand cord in which the basic strands are dual layer cords, rubberized in situ

Metal cord of K×(L+M) construction. K elementary strands assembled in a helix, with pitch PK, each having a cord with L wire inner layer of diameter d1, and M wire outer layer of diameter d2, in a helix with pitch p2 around the inner layer; with (in mm): 0.10




basic

Multi-strand cord in which the basic strands are dual layer cords, rubberized in situ

J strands form a core. K outer strands are wound around it in a helix with pitch PK, each having a cord with an L wire inner layer of diameter d1, and an M wire outer layer of diameter d2, wound around the inner layer in a helix with pitch p2; with (in mm): 0.10




basic

Berkeley Police Basically MIA At Saturday's Violent Pro-Trump Vs. AntiFa Brawl

Including a photo slideshow. Even at 10 a.m. this past Saturday morning, hours before a throng of anti-fascists and Trump-supporting white nationalists overtook downtown Berkeley’s streets, it was clear that most of the attendees were less interested in speeches, protesting, and free speech — and were mostly there just to tee-off on each other. Before the brawling began, officers stationed themselves at the entrances to downtown's "Peace Park."…



  • News & Opinion/News

basic

New Forest Basics Bank steps in to help pupils at Arnewood and Eaglewood schools in New Milton

A HAMPSHIRE charity has provided food for pupils entitled to free lunches during the school shutdown.




basic

How to use Voice Control on iOS: The Basics

In this podcast, Thomas Domville introduces us to Voice Control, a brand-new accessibility feature in iOS 13 that lets you control every single aspect of your iOS device using only your voice.




basic

Episode 0x09: Copyleft, -or-later, and Basics of Compatibility

Bradley and Karen discuss types of copyleft generally and introduce the basics of license compatibility and -or-later clauses.

Show Notes:

Segment 0 (00:38)

  • This show discusses copyleft and basic issues of license compatibility (04:09)
  • Karen mentioned an episode of the old Software Freedom Law Show, Episode 0x08, where Bradley and Karen discussed selecting a FLOSS license and what the various options are. (04:45)
  • license compatibility 06:28
  • Bradley incorrectly said that the original Emacs license didn't have the word General in it. However, the other explanations appear to be correct. There's a useful history page that someone wrote about the history of GPL. It appears the non-general GNU copylefts existed from 1984-1988. (06:57)
  • Karen noted that the Library GPL was renamed to the Lesser GPL which happened in 1999. (09:30)
  • Bradley mentioned that when he and RMS worked on the GNU Classpath Exception, Bradley suggested it be called the Least GPL. (10:38)
  • GPL doesn't have a choice of law clause. If another copyleft does, it surely is incompatible with the GPL. (14:17)
  • AGPLv3 § 13 and GPLv3 § 13 explicitly make themselves compatibility with each other, which Bradley calls compatibility by fiat. (15:40)
  • Karen mentioned that the Mozilla Public License § 13 has a section about multiple licensed code (16:50).
  • Bradley mentioned that Mozilla Firefox uses a combinatorial license: (GPL|LGPL|MPL), which is a disjunctive tri-license. (19:00).
  • Bradley mentioned that the old Software Freedom Law Show Episode 0x17 discussed compatibility of permissively licensed software and copylefted software. (20:22)
  • Apache Software License 2.0 was likely the first FLOSS license to have an explicit patent licensing provision (23:40)
  • Bradley and Karen discussed the fact that -only vs. -or-later are options with the GPL, while they are not with other copylefts, such as CC-By-SA. (30:11)

Send feedback and comments on the cast to <oggcast@faif.us>. You can keep in touch with Free as in Freedom on our IRC channel, #faif on irc.freenode.net, and by following Conservancy on on Twitter and and FaiF on Twitter.

Free as in Freedom is produced by Dan Lynch of danlynch.org. Theme music written and performed by Mike Tarantino with Charlie Paxson on drums.

The content of this audcast, and the accompanying show notes and music are licensed under the Creative Commons Attribution-Share-Alike 4.0 license (CC BY-SA 4.0).




basic

Episode 0x16: Legal Basics for Developers

Bradley and Karen play and comment on a talk recording of Aaron Williamson's and Karen's presentation at OSCON 2011, entitled Legal Basics for Developers.

Show Notes:

Segment 0 (00:33)

Segment 1 (05:53)

Segment 2 (49:36)

  • Richard Fontana gave at a talk at OSCON as well, which was recorded, and Karen and Bradley have asked for his permission to play it. (50:45)
  • Bradley asked folks to ping Richard on identi.ca to ask him to allow us to use his audio on the oggcast. (51:05)

Send feedback and comments on the cast to <oggcast@faif.us>. You can keep in touch with Free as in Freedom on our IRC channel, #faif on irc.freenode.net, and by following Conservancy on on Twitter and and FaiF on Twitter.

Free as in Freedom is produced by Dan Lynch of danlynch.org. Theme music written and performed by Mike Tarantino with Charlie Paxson on drums.

The content of this audcast, and the accompanying show notes and music are licensed under the Creative Commons Attribution-Share-Alike 4.0 license (CC BY-SA 4.0).




basic

0x5C: Basic FLOSS Concepts: Licensing 101

Bradley and Karen give a basic introduction of copyright licensing of Open Source and Free Software.

Show Notes:

Segment 0 (00:35)


Send feedback and comments on the cast to <oggcast@faif.us>. You can keep in touch with Free as in Freedom on our IRC channel, #faif on irc.freenode.net, and by following Conservancy on on Twitter and and FaiF on Twitter.

Free as in Freedom is produced by Dan Lynch of danlynch.org. Theme music written and performed by Mike Tarantino with Charlie Paxson on drums.

The content of this audcast, and the accompanying show notes and music are licensed under the Creative Commons Attribution-Share-Alike 4.0 license (CC BY-SA 4.0).




basic

How to stay in touch with our basic senses in isolation

Working and studying from home mean much more time spent in front of screens, which we counterbalance with hands-on activities. Dr. Christine Law offers tips for managing eye strain from extra screen time; and neuroscientist Victoria Abraira explains why touch is so important to us as social beings.




basic

Universal basic income seems to improve employment and well-being | New Scientist

When surveyed, people who received universal basic income instead of regular unemployment benefits reported better financial well-being, mental health and cognitive functioning, as well as higher levels of confidence in the future.




basic

Universal basic income seems to improve employment and wellbeing | New Scientist

Finland’s two-year test of universal basic income has concluded that it doesn't seem to disincentivise working, and benefits recipients’ mental and financial wellbeing




basic

BCUA To Offer Basic Cricket Umpire Course

The Bermuda Cricket Umpire’s Association [BCUA] will be offering an eight week Basic Cricket Umpires Course from March 10 to April 28 at Charities House on Point Finger Road in Paget. A spokesperson said, “Please be advised that the BCUA will be having a Basic Cricket Umpires Course commencing 10th March to 28th April 2020. […]

(Click to read the full article)




basic

Job Automation And Universal Basic Income

Elon Musk thinks a universal basic income is inevitable. Musk doesn't see plausible alternatives. I hope not. So here's the optimistic scenario: On the one hand, manual and low skilled work will mostly get automated out of existence. So one could imagine why demand for people at lower skill levels and lower levels of cognitive ability could just evaporate. On the other hand, automation will cut costs and boost the wealth of those still employed. Even if the pay of manual laborers is low the goods a manual laborer will need to survive should become very cheap. So any upper class people who can find a use for them might pay them enough to survive. But I see a stronger...





basic

Back to Basics

There is happy news and sad news here in Brown Dog Land. The happy news is that everyone is doing great and things are going really well. The sad news is that Addy is doing great in a new home! Last night she left to move in with her dad (my ex) and will be living with him full time now. I was sad to see her go, but when I saw how happy she was to see him walk in the door to pick her up, I knew it was definitely the right decision! She is going to be a happy and spoiled only pup and I know it's going to work out great.


So, over here, it's back to all brown dogs all the time and I get to stop the crate/rotate routine. In the end, I still couldn't be happier.




basic

A basic understanding of youtube copyright

Posting videos on YouTube can be a great way to show off your video editing skills, post video blogs, or even your own mini series. Because YouTube is the largest video sharing site it’s also a great way to promote products, or your website to thousands new potential viewers. But what happens when you post a video and it’s either slapped with a copyright infringement or banned all together, and what are the consequences to your account?




basic

Here’s Why Americans Need a Basic Income During the Coronavirus Outbreak

Dramatic action is needed now to blunt the immediate pain of vulnerable workers.




basic

This perfect pound cake goes back to basics

This easy pound cake recipe relies on the classic formula of equal weight ratios of butter, sugar, eggs and flour for a fine-crumbed cake that keeps and packs well.




basic

The histone H4 basic patch regulates SAGA-mediated H2B deubiquitination and histone acetylation [DNA and Chromosomes]

Histone H2B monoubiquitylation (H2Bub1) has central functions in multiple DNA-templated processes, including gene transcription, DNA repair, and replication. H2Bub1 also is required for the trans-histone regulation of H3K4 and H3K79 methylation. Although previous studies have elucidated the basic mechanisms that establish and remove H2Bub1, we have only an incomplete understanding of how H2Bub1 is regulated. We report here that the histone H4 basic patch regulates H2Bub1. Yeast cells with arginine-to-alanine mutations in the H4 basic patch (H42RA) exhibited a significant loss of global H2Bub1. H42RA mutant yeast strains also displayed chemotoxin sensitivities similar to, but less severe than, strains containing a complete loss of H2Bub1. We found that the H4 basic patch regulates H2Bub1 levels independently of interactions with chromatin remodelers and separately from its regulation of H3K79 methylation. To measure H2B ubiquitylation and deubiquitination kinetics in vivo, we used a rapid and reversible optogenetic tool, the light-inducible nuclear exporter, to control the subcellular location of the H2Bub1 E3 ligase, Bre1. The ability of Bre1 to ubiquitylate H2B was unaffected in the H42RA mutant. In contrast, H2Bub1 deubiquitination by SAGA-associated Ubp8, but not by Ubp10, increased in the H42RA mutant. Consistent with a function for the H4 basic patch in regulating SAGA deubiquitinase activity, we also detected increased SAGA-mediated histone acetylation in H4 basic patch mutants. Our findings uncover that the H4 basic patch has a regulatory function in SAGA-mediated histone modifications.




basic

Should the Super-Rich Pay for a Universal Basic Income?




basic

CBD News: Biodiversity - the diversity of life on Earth - underpins the natural resources that provide food and livelihoods throughout the world. For many women, biodiversity serves as the cornerstone of their work, their belief systems and their basic s




basic

Basic Law underpins HK’s success

On April 4, 1990, the Basic Law of the Hong Kong Special Administrative Region of the People’s Republic of China was adopted by the Seventh National People’s Congress (NPC) of the People’s Republic of China (PRC). The Basic Law enshrines the basic policies of the PRC regarding the Hong Kong Special Administrative Region (HKSAR) and provides a solid constitutional basis for the implementation of “one country, two systems”. Looking back, we must not forget the purpose and mission of the Basic Law.

 

The Basic Law clearly states that Hong Kong has been part of the territory of China since ancient times and is an inalienable part of the PRC. It is a Special Administrative Region enjoying a high degree of autonomy under the Central People’s Government. Upholding national unity and territorial integrity, maintaining the prosperity and stability of Hong Kong, and taking account of history and realities, the “one country, two systems” principle was put forth by Mr Deng Xiaoping as a way to preserve the characteristics and strengths of Hong Kong as much as possible and to enable Hong Kong citizens to maintain their way of life.

 

In the 22 years since her return to the motherland, Hong Kong has weathered different challenges and, on the whole, the implementation of “one country, two systems” has been successful. Leveraging on our strengths in free market economy, rule of law, independent judiciary and the free flow of information and with our country’s strong support, Hong Kong has developed into an international financial, trade and transportation centre and attracted more than 9,000 overseas and Mainland companies to establish offices here, with many of them making Hong Kong as their regional headquarters in Asia-Pacific.

 

International financial centre

Article 109 of the Basic Law confirms Hong Kong’s status as an international financial centre and stipulates that the Government of the Hong Kong Special Administrative Region shall provide an appropriate economic and legal environment for the maintenance of such status. Specifically, under the Basic Law:

 

- The Hong Kong dollar is the legal tender of the HKSAR and the linked exchange rate system has been maintained. With the strong support of the Central Government, Hong Kong has been able to maintain financial stability even during turbulent times. Riding on our country’s reform and opening up, Hong Kong has also developed into the world’s largest offshore renminbi centre.

 

 - The free flow of capital is protected and has attracted a large number of foreign direct investment and companies using Hong Kong as an ideal platform for initial public offerings and fundraising. Over the past 10 years, Hong Kong has topped the annual global IPO rankings six times.

 

- Hong Kong maintains a simple and low tax system, which is key to Hong Kong’s success as an international financial, trading and business centre. The Hong Kong Special Administrative Region Government is free to implement tax measures according to policy needs under its independent tax system. Since I took office, I have put in place initiatives such as the two-tier profits tax system and tax deduction for research and development expenditure to enhance Hong Kong’s competitiveness.

 

Rule of law and independent judiciary

The Basic Law preserves and guarantees Hong Kong’s long-established and trusted common law system and allows the HKSAR to enjoy independent judicial power, including that of final adjudication. The rule of law and an independent judiciary, which are held dearly by Hong Kong people, are constitutionally protected. The Basic Law stipulates that judges shall be appointed by the Chief Executive on the recommendation of an independent commission; for the appointment of judges of the Court of Final Appeal (CFA) and the Chief Judge of the High Court, the Chief Executive shall obtain the endorsement of the Legislative Council and report such appointment to the Standing Committee of the NPC for the record. Last month, I accepted the recommendation of the Judicial Officers Recommendation Commission to appoint the Honourable Justice Andrew Cheung, Permanent Judge of the CFA, to succeed The Honourable Chief Justice Geoffrey Ma who will retire next year.

 

The Basic Law also allows the CFA to draw on the experience of judges from other common law jurisdictions. Currently, 15 eminent judges from the United Kingdom, Australia and Canada are sitting on the CFA as non-permanent judges. Their participation shows that our rule of law and independent judiciary are well recognised.

 

Rights and freedoms of residents

The fundamental rights and freedoms of Hong Kong residents are fully protected by the Basic Law. Under Chapter 3, Hong Kong residents shall have freedom of speech, of the press and of publication; freedom of association, of assembly, of procession and of demonstration; freedom of the person; freedom of communication; freedom of religious belief; freedom of choice of occupation; freedom to engage in academic research, literary and artistic creation, and other cultural activities; freedom of marriage and so forth. However, as pointed out by our courts in their judgments, freedom is not absolute; one should respect the rights and freedoms of other people and be subject to law when exercising such freedoms.

 

Developing external affairs

Hong Kong has always been a bridge between the East and the West. The Basic Law allows the HKSAR to maintain and develop relations with foreign states and regions and relevant international organisations in the appropriate fields, including economic, trade, financial and monetary, shipping, communications, tourism, cultural and sports fields on its own, using the name Hong Kong, China. The HKSAR has participated in the World Trade Organization, the World Meteorological Organization, the Asia-Pacific Economic Cooperation and many others in the name Hong Kong, China and has entered into hundreds of bilateral agreements with other countries, including Free Trade Agreements, Investment Promotion & Protection Agreements and Comprehensive Double Taxation Agreements. Hong Kong athletes can also represent Hong Kong in international competitions.

 

The implementation of “one country, two systems” fully demonstrates that it is the best institutional arrangement to maintain Hong Kong’s long-term prosperity and stability. As a pioneering initiative, its application entails an evolving process and we have to effectively and fully apply this principle in order to maintain the prosperity and stability of Hong Kong, to meet the aspirations of our citizens and to meet the fundamental interests of our country. I encourage all Hong Kong citizens to learn more about the Basic Law, including the institutional safeguards, and the rights and duties of Hong Kong residents. In so doing, we should consider how best we can continue to leverage on Hong Kong’s advantages, allowing Hong Kong to advance with the country and enabling every Hong Kong resident to realise their goal.

 

Chief Executive Carrie Lam wrote this op-ed entitled The Basic Law - Best Safeguard for the Prosperity & Stability of Hong Kong on April 4.




basic

Units under EDB continue to provide basic public services




basic

The histone H4 basic patch regulates SAGA-mediated H2B deubiquitination and histone acetylation [DNA and Chromosomes]

Histone H2B monoubiquitylation (H2Bub1) has central functions in multiple DNA-templated processes, including gene transcription, DNA repair, and replication. H2Bub1 also is required for the trans-histone regulation of H3K4 and H3K79 methylation. Although previous studies have elucidated the basic mechanisms that establish and remove H2Bub1, we have only an incomplete understanding of how H2Bub1 is regulated. We report here that the histone H4 basic patch regulates H2Bub1. Yeast cells with arginine-to-alanine mutations in the H4 basic patch (H42RA) exhibited a significant loss of global H2Bub1. H42RA mutant yeast strains also displayed chemotoxin sensitivities similar to, but less severe than, strains containing a complete loss of H2Bub1. We found that the H4 basic patch regulates H2Bub1 levels independently of interactions with chromatin remodelers and separately from its regulation of H3K79 methylation. To measure H2B ubiquitylation and deubiquitination kinetics in vivo, we used a rapid and reversible optogenetic tool, the light-inducible nuclear exporter, to control the subcellular location of the H2Bub1 E3 ligase, Bre1. The ability of Bre1 to ubiquitylate H2B was unaffected in the H42RA mutant. In contrast, H2Bub1 deubiquitination by SAGA-associated Ubp8, but not by Ubp10, increased in the H42RA mutant. Consistent with a function for the H4 basic patch in regulating SAGA deubiquitinase activity, we also detected increased SAGA-mediated histone acetylation in H4 basic patch mutants. Our findings uncover that the H4 basic patch has a regulatory function in SAGA-mediated histone modifications.




basic

Self-Monitoring of Blood Glucose: The Basics

Evan M. Benjamin
Jan 1, 2002; 20:
Practical Pointers