editor Take recovery from ‘avoidance transactions’ seriously, IBBI tells creditors. By www.thehindubusinessline.com Published On :: Tue, 12 Nov 2024 22:07:48 +0530 Recovery for creditors could go up at least 10 per cent on such approach, says IBBI Chief Mital; Till Sep 2024, total clawback on avoidance transactions applications stood at ₹7,516 crore Full Article Economy
editor Editorial. Brand IPL keeps shining By www.thehindubusinessline.com Published On :: Tue, 28 May 2024 20:57:42 +0530 The business of cricket has never been better Full Article Editorial
editor The Franz Boas papers / Regna Darnell, general editor By darius.uleth.ca Published On :: Lincoln : University of Nebraska Press, [2015]- Full Article
editor Gene editors grapple with standardization By cen.acs.org Published On :: 21 May 2018 05:00:01 +0000 On the brink of patient trials, genome-editing heavyweights and regulators meet to set up voluntary standards Full Article
editor Meet <i>Science</i> magazine editor Jeremy Berg, chemist and proud data wonk By cen.acs.org Published On :: 03 Jul 2018 20:44:53 +0000 Policy leader talks about publishing, the scientific enterprise, and how chemistry fits into it all Full Article
editor Solid state physics: Vol. 61 / editors, Henry Ehrenreich, Frans Spaepen By library.mit.edu Published On :: Sun, 10 May 2020 06:31:08 EDT Online Resource Full Article
editor Tribune Editorial: We are all guinea pigs now By www.sltrib.com Published On :: Sat, 09 May 2020 21:00:53 +0000 Full Article
editor A former editor at the Observer says Kushner's claim of coronavirus 'success' stems from his inability to empathize with other people's grief By news.yahoo.com Published On :: Sat, 09 May 2020 01:00:18 -0400 Elizabeth Spiers wrote about an incident where Jared Kushner used the memorial of an employee to congratulate himself for success. Full Article
editor Editor’s take: The week that was – April 27-May 1 By www.dealstreetasia.com Published On :: Sun, 03 May 2020 01:30:31 +0000 Headlines this week were dominated by more companies running into trouble amid the virus crisis. The post Editor’s take: The week that was – April 27-May 1 appeared first on DealStreetAsia. Full Article
editor Editor’s take: The week that was – May 4-8 By www.dealstreetasia.com Published On :: Sun, 10 May 2020 01:30:35 +0000 China continued to dominate the megadeal market in the week, with car trader Chehaoduo alone bagging $200 million. The post Editor’s take: The week that was – May 4-8 appeared first on DealStreetAsia. Full Article
editor The Observer view on the government's lack of a proper lockdown plan | Observer editorial By www.theguardian.com Published On :: 2020-05-10T05:00:16Z Ministers’ shambolic briefings expose a terrifying lack of competence• Coronavirus latest updates• See all our coronavirus coverage‘In spite of the sunny bank holiday, it is vitally important that we continue to abide by the current restrictions: stay home, protect the NHS and save lives.” That was the message delivered by the environment secretary, George Eustice, at Friday afternoon’s press conference. Yet just the day before, most newspapers were emblazoned with excited headlines foretelling a significant relaxation of social distancing restrictions, based on briefing from government sources: “Lockdown freedom beckons”, “First steps to freedom from Monday” and “Stay home advice to be scrapped”.Despite the critical importance of clear public messaging to any public health strategy, the government’s communications have been marred by mixed messages throughout this deadly pandemic. Its core message, asking the public to stay at home to protect the NHS and save lives, has been very effective, but this has consistently been undermined by ministers and advisers inaccurately briefing the press that there is about to be a shift in policy. Before the Easter weekend, reports appeared that ministers thought that the public had been too obedient in following the lockdown, and that a relaxation was imminent. The same happened before this bank holiday weekend, forcing the government to clarify that there was no change in restrictions and that people must continue to abide by the law. Continue reading... Full Article Coronavirus outbreak World news Health policy Health Politics UK news Society Conservatives Boris Johnson
editor The papers of Joseph Henry / Editor: Nathan Reingold. Assistant editors: Stuart Pierson and Arthur P. Molella with the assistance of James M. Hobbins and John R. Kerwood By library.mit.edu Published On :: Sun, 9 Feb 2014 06:34:19 EST Archives, Room Use Only - Q143.H6.A2 1972 Full Article
editor The papers of Thomas A. Edison / editors, Reese V. Jenkins ... [et al.] By library.mit.edu Published On :: Sun, 16 Feb 2014 06:33:42 EST Archives, Room Use Only - TK140.E3.A2 1989 Full Article
editor The 401st telegraph battalion in the World War / compiled by members of the Battalion and published under the direction of the Book Committee, consisting of J.L. Crotty ... [et al.] ; editorial staff R.E. Browning, J.L. Crotty, W.G. Thomas By library.mit.edu Published On :: Sun, 16 Mar 2014 06:33:01 EDT Archives, Room Use Only - D570.346 401st.A76 1919 Full Article
editor Railroad telegraphy and the railroad.: the people, places, unions, events, dates / researched and compiled by Robert W. Betts, AB, NIKPR ; publishing editor Maryann D. Betts By library.mit.edu Published On :: Sun, 16 Mar 2014 06:33:01 EDT Archives, Room Use Only - TF627.B48 1996 Full Article
editor Radio pioneers, 1945: commemorating the Radio pioneers dinner, Hotel Commodore, New York, N.Y., November 8, 1945 / [Harold P. Westman, editor in chief.] By library.mit.edu Published On :: Sun, 8 Jun 2014 06:17:54 EDT Archives, Room Use Only - TK6547.I56 2006 Full Article
editor Modern electrical engineering / prepared under the editorship of Magnus Maclean By library.mit.edu Published On :: Sun, 27 Jul 2014 07:06:48 EDT Archives, Room Use Only - TK145.M334 1919 Full Article
editor Hello, Editorially By feedproxy.google.com Published On :: 2013-02-11T17:59:43+00:00 I’ve always sucked at writing. Not the words, mind you: those usually come easily. (When I remember to sit down and write them, that is; hellooooooo, sad and neglected blog.) It’s more the process of the thing, I guess. It’s a struggle for me to get ideas down quickly; I get intimidated by the promise of that final draft, of shipping, so I often feel every word needs to be perfect as soon as it’s typed. (No, I’m not going to tell you how long it took to write this fucking blog entry.) Anyway. So, yes: writing’s hard. But I’m learning how to make it easier. And, alongside a few friends, I’m working on something that might make it easier for you, too. Last year, I had a long conversation with Mandy. She talked about this idea she had: an idea for a tool that would facilitate conversation, discussion, and, most importantly, iteration during the writing process. Not just an application, actually: more a set of features to support a workflow, one that would, if done right, make writing not just easier, but better. She and Jason had already sketched out how it might work. Soon after, David joined our merry band, and turned our responsive prototypes a living, breathing application. And Rob joined our team recently, and has been, as Mandy said, effortlessly solving problems we once thought impossible. I am beyond honored to be a small part of this team, and I can’t wait to show you what we’ve been working on. We call it Editorially, and you can read more about it on our first blog entry. Stay tuned. Full Article
editor Simulink - Signal Editor prematurely indicates that a save operation is complete By in.mathworks.com Published On :: Fri, 08 May 2020 15:26:15 +0000 When the Signal Editor is saving data, the indicator that the save is occurring does not appear. You might notice a delay when saving large data files.This bug exists in the following release(s): R2020a Interested in Upgrading? Full Article
editor Entomologist May R. Berenbaum of the University of Illinois at Urbana-Champaign Named PNAS Editor-in-Chief By feedproxy.google.com Published On :: Fri, 26 Oct 2018 05:00:00 GMT The National Academy of Sciences (NAS) announces the appointment of May R. Berenbaum as Editor-in-Chief of the Proceedings of the National Academy of Sciences (PNAS), the official journal of the Academy. Berenbaum will begin the editorship on January 1, 2019. Full Article
editor Physical chemistry, series one. Consultant editor, A.D. Buckingham By alcuin.furman.edu Published On :: Full Article
editor Washington Post editorial: End ethanol subsidies By www.mnn.com Published On :: Wed, 06 Jul 2011 19:45:45 +0000 The latest assault on ethanol subsidies comes from one of the nation's leading newspapers. Full Article Politics
editor Catching up with the editor of Green Talk By www.mnn.com Published On :: Thu, 02 Feb 2012 19:00:45 +0000 Blogger and editor Anna Hackman chats with MNN about green buildings, green business and bar mitzvahs. Full Article Family Activities
editor Editor's letter - February 2020 By www.insuranceage.co.uk Published On :: Tue, 04 Feb 2020 12:25:21 +0000 Moving forward: After Brexit hysteria has waned, the industry has other pressing issues to tackle Full Article
editor IFPG Welcomes New Editorial Director, Jill Abrahamsen By www.24-7pressrelease.com Published On :: Fri, 28 Feb 2020 07:00:00 GMT Jill recently joined IFPG to lead Franchise Consultant Magazine and other new initiatives Full Article
editor Nobel Prize (2013) for OMICS Publishing Group Editor Dr Arieh Warshel By www.24-7pressrelease.com Published On :: Fri, 18 Oct 2013 07:00:00 GMT Dr Arieh Warshel, editor of Journal of Thermodynamics & Catalysis, receives 2013 Nobel Prize in Chemistry. Full Article
editor Investintech.com is Introducing Able2Extract Professional 12 with PDF Form Filler & Editor, Bates Numbering and More By www.24-7pressrelease.com Published On :: Wed, 06 Dec 2017 07:00:00 GMT Leading PDF solutions provider, Investintech.com, Inc., has released a new version of its flagship PDF converter, Able2Extract Professional. This version gets new powerful capabilities for PDF form filling, creation and editing, and bates numbering. Full Article
editor iSkysoft Launches FilmoraPro Video Editor for Pros and Industry Creators By www.24-7pressrelease.com Published On :: Fri, 17 Jan 2020 07:00:00 GMT iSkysoft has announced the launch of FilmoraPro, a professional video editing software for professional editors and industry creators. Full Article
editor EaseUS Releases a Powerful and Simple Video Editor for Video By www.24-7pressrelease.com Published On :: Thu, 16 Apr 2020 07:00:00 GMT EaseUS recently launched EaseUS Video Editor - an innovative and easy-to-use video editing application on multiple Windows platforms. It helps novice users and professionals to complete basic and high-level audio and video processing without effort. Full Article
editor Editors’ Picks of the Week By hbr.org Published On :: Thu, 07 Nov 2013 17:57:43 -0500 HBR editors read top posts from HBR.org. Full Article
editor Getting your dues: Procedure for creditors to file under IBC By economictimes.indiatimes.com Published On :: 2019-08-31T11:48:23+05:30 The recent Insolvency and Bankruptcy Code (IBC) has been a big sigh of relief for MSMEs which would, ensure faster debt recovery or liquidation process. Full Article
editor China needs more nuclear warheads: Global Times editor By economictimes.indiatimes.com Published On :: 2020-05-08T16:50:29+05:30 The Global Times is published by the People's Daily, the official newspaper of China's ruling Communist Party. The party has been known to float ideas and guide public sentiments via the Global Times, which tends to take a nationalistic stance on issues involving other countries. Full Article
editor Editorial cartoon: Scott Stantis on our presidential choices By www.startribune.com Published On :: 2020-05-08T23:33:40+00:00 Full Article
editor 12 Diversified Yet Free To Use WYSIWYG Text Editors By feedproxy.google.com Published On :: Wed, 20 Jun 2018 04:06:39 +0000 Are you looking for some free to use Javascript or jQuery WYSIWYG HTML editors? Well, if your answer is yes, then you are lucky enough to land on the right page. In this round up, we are presenting 12 Diversified Yet Free To Use WYSIWYG Text Editors.... The post 12 Diversified Yet Free To Use WYSIWYG Text Editors appeared first on SmashingApps.com. Full Article Best of the Web Freebies html5 Libraries Web Design
editor New Auphonic Transcript Editor and Improved Speech Recognition Services By feedproxy.google.com Published On :: Tue, 03 Jul 2018 05:35:25 +0000 Back in late 2016, we introduced Speech Recognition at Auphonic. This allows our users to create transcripts of their recordings, and more usefully, this means podcasts become searchable. Now we integrated two more speech recognition engines: Amazon Transcribe and Speechmatics. Whilst integrating these services, we also took the opportunity to develop a complete new Transcription Editor: Screenshot of our Transcript Editor with word confidence highlighting and the edit bar. Try out the Transcript Editor Examples yourself! The new Auphonic Transcript Editor is included directly in our HTML transcript output file, displays word confidence values to instantly see which sections should be checked manually, supports direct audio playback, HTML/PDF/WebVTT export and allows you to share the editor with someone else for further editing. The new services, Amazon Transcribe and Speechmatics, offer transcription quality improvements compared to our other integrated speech recognition services. They also return word confidence values, timestamps and some punctuation, which is exported to our output files. The Auphonic Transcript Editor With the integration of the two new services offering improved recognition quality and word timestamps alongside confidence scores, we realized that we could leverage these improvements to give our users easy-to-use transcription editing. Therefore we developed a new, open source transcript editor, which is embedded directly in our HTML output file and has been designed to make checking and editing transcripts as easy as possible. Main features of our transcript editor: Edit the transcription directly in the HTML document. Show/hide word confidence, to instantly see which sections should be checked manually (if you use Amazon Transcribe or Speechmatics as speech recognition engine). Listen to audio playback of specific words directly in the HTML editor. Share the transcript editor with others: as the editor is embedded directly in the HTML file (no external dependencies), you can just send the HTML file to some else to manually check the automatically generated transcription. Export the edited transcript to HTML, PDF or WebVTT. Completely useable on all mobile devices and desktop browsers. Examples: Try Out the Transcript Editor Here are two examples of the new transcript editor, taken from our speech recognition audio examples page: 1. Singletrack Transcript Editor Example Singletrack speech recognition example from the first 10 minutes of Common Sense 309 by Dan Carlin. Speechmatics was used as speech recognition engine without any keywords or further manual editing. 2. Multitrack Transcript Editor Example A multitrack automatic speech recognition transcript example from the first 20 minutes of TV Eye on Marvel - Luke Cage S1E1. Amazon Transcribe was used as speech recognition engine without any further manual editing. As this is a multitrack production, the transcript includes exact speaker names as well (try to edit them!). Transcript Editing By clicking the Edit Transcript button, a dashed box appears around the text. This indicates that the text is now freely editable on this page. Your changes can be saved by using one of the export options (see below). If you make a mistake whilst editing, you can simply use the undo/redo function of the browser to undo or redo your changes. When working with multitrack productions, another helpful feature is the ability to change all speaker names at once throughout the whole transcript just by editing one speaker. Simply click on an instance of a speaker title and change it to the appropriate name, this name will then appear throughout the whole transcript. Word Confidence Highlighting Word confidence values are shown visually in the transcript editor, highlighted in shades of red (see screenshot above). The shade of red is dependent on the actual word confidence value: The darker the red, the lower the confidence value. This means you can instantly see which sections you should check/re-work manually to increase the accuracy. Once you have edited the highlighted text, it will be set to white again, so it’s easy to see which sections still require editing. Use the button Add/Remove Highlighting to disable/enable word confidence highlighting. NOTE: Word confidence values are only available in Amazon Transcribe or Speechmatics, not if you use our other integrated speech recognition services! Audio Playback The button Activate/Stop Play-on-click allows you to hear the audio playback of the section you click on (by clicking directly on the word in the transcript editor). This is helpful in allowing you to check the accuracy of certain words by being able to listen to them directly whilst editing, without having to go back and try to find that section within your audio file. If you use an External Service in your production to export the resulting audio file, we will automatically use the exported file in the transcript editor. Otherwise we will use the output file generated by Auphonic. Please note that this file is password protected for the current Auphonic user and will be deleted in 21 days. If no audio file is available in the transcript editor, or cannot be played because of the password protection, you will see the button Add Audio File to add a new audio file for playback. Export Formats, Save/Share Transcript Editor Click on the button Export... to see all export and saving/sharing options: Save/Share Editor The Save Editor button stores the whole transcript editor with all its current changes into a new HTML file. Use this button to save your changes for further editing or if you want to share your transcript with someone else for manual corrections (as the editor is embedded directly in the HTML file without any external dependencies). Export HTML / Export PDF / Export WebVTT Use one of these buttons to export the edited transcript to HTML (for WordPress, Word, etc.), to PDF (via the browser print function) or to WebVTT (so that the edited transcript can be used as subtitles or imported in web audio players of the Podlove Publisher or Podigee). Every export format is rendered directly in the browser, no server needed. Amazon Transcribe The first of the two new services, Amazon Transcribe, offers accurate transcriptions in English and Spanish at low costs, including keywords, word confidence, timestamps, and punctuation. UPDATE 2019: Amazon Transcribe offers more languages now - please see Amazon Transcribe Features! Pricing The free tier offers 60 minutes of free usage a month for 12 months. After that, it is billed monthly at a rate of $0.0004 per second ($1.44/h). More information is available at Amazon Transcribe Pricing. Custom Vocabulary (Keywords) Support Custom Vocabulary (called Keywords in Auphonic) gives you the ability to expand and customize the speech recognition vocabulary, specific to your case (i.e. product names, domain-specific terminology, or names of individuals). The same feature is also available in the Google Cloud Speech API. Timestamps, Word Confidence, and Punctuation Amazon Transcribe returns a timestamp and confidence value for each word so that you can easily locate the audio in the original recording by searching for the text. It also adds some punctuation, which is combined with our own punctuation and formatting automatically. The high-quality (especially in combination with keywords) and low costs of Amazon Transcribe make it attractive, despite only currently supporting two languages. However, the processing time of Amazon Transcribe is much slower compared to all our other integrated services! Try it yourself: Connect your Auphonic account with Amazon Transcribe at our External Services Page. Speechmatics Speechmatics offers accurate transcriptions in many languages including word confidence values, timestamps, and punctuation. Many Languages Speechmatics’ clear advantage is the sheer number of languages it supports (all major European and some Asiatic languages). It also has a Global English feature, which supports different English accents during transcription. Timestamps, Word Confidence, and Punctuation Like Amazon, Speechmatics creates timestamps, word confidence values, and punctuation. Pricing Speechmatics is the most expensive speech recognition service at Auphonic. Pricing starts at £0.06 per minute of audio and can be purchased in blocks of £10 or £100. This equates to a starting rate of about $4.78/h. Reduced rate of £0.05 per minute ($3.98/h) are available if purchasing £1,000 blocks. They offer significant discounts for users requiring higher volumes. At this further reduced price point it is a similar cost to the Google Speech API (or lower). If you process a lot of content, you should contact them directly at sales@speechmatics.com and say that you wish to use it with Auphonic. More information is available at Speechmatics Pricing. Speechmatics offers high-quality transcripts in many languages. But these features do come at a price, it is the most expensive speech recognition services at Auphonic. Unfortunately, their existing Custom Dictionary (keywords) feature, which would further improve the results, is not available in the Speechmatics API yet. Try it yourself: Connect your Auphonic account with Speechmatics at our External Services Page. What do you think? Any feedback about the new speech recognition services, especially about the recognition quality in various languages, is highly appreciated. We would also like to hear any comments you have on the transcript editor particularly - is there anything missing, or anything that could be implemented better? Please let us know! Full Article Audio News
editor Markdown Comes Alive! Part 1, Basic Editor By feedproxy.google.com Published On :: Wed, 26 Feb 2020 08:00:00 -0500 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: Take markdown input from the textarea Send that input to the LiveServer Turn that raw markdown into HTML 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. Full Article Code Back-end Engineering
editor Markdown Comes Alive! Part 1, Basic Editor By feedproxy.google.com Published On :: Wed, 26 Feb 2020 08:00:00 -0500 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: Take markdown input from the textarea Send that input to the LiveServer Turn that raw markdown into HTML 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. Full Article Code Back-end Engineering
editor Which Graphics Editor To Choose For The Novice By icanbecreative.com Published On :: Thu, 19 Mar 2020 09:59:19 PDT Photos and other images are used in different fields, so those who know how to work with high-resolution mockups are in demand as professionals. It is useful to be able to take photos, draw, edit... Full Article Learning
editor Markdown Comes Alive! Part 1, Basic Editor By feedproxy.google.com Published On :: Wed, 26 Feb 2020 08:00:00 -0500 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: Take markdown input from the textarea Send that input to the LiveServer Turn that raw markdown into HTML 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. Full Article Code Back-end Engineering
editor Markdown Comes Alive! Part 1, Basic Editor By feedproxy.google.com Published On :: Wed, 26 Feb 2020 08:00:00 -0500 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: Take markdown input from the textarea Send that input to the LiveServer Turn that raw markdown into HTML 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. Full Article Code Back-end Engineering
editor An Issue Raised in 1978 by a Then-Future Editor-in-Chief of the Journal "Order": Does the Endomorphism Poset of a Finite Connected Poset Tell Us That the Poset Is Connected?. (arXiv:2005.03255v1 [math.CO]) By arxiv.org Published On :: In 1978, Dwight Duffus---editor-in-chief of the journal "Order" from 2010 to 2018 and chair of the Mathematics Department at Emory University from 1991 to 2005---wrote that "it is not obvious that $P$ is connected and $P^P$ isomorphic to $Q^Q$ implies that $Q$ is connected," where $P$ and $Q$ are finite non-empty posets. We show that, indeed, under these hypotheses $Q$ is connected and $Pcong Q$. Full Article
editor Making HMRC a preferred creditor 'could hit small businesses' By www.dailyecho.co.uk Published On :: Tue, 05 May 2020 10:34:10 +0100 MOVES to put HMRC near the head of the queue for money when businesses become insolvent could damage small businesses and the economy, it is claimed. Full Article
editor Echo editor lunches at luxurious No Man's Fort in the Solent - probably the world's most fascinating venue and hotel By www.dailyecho.co.uk Published On :: Fri, 05 Jun 2015 15:39:09 +0100 The band played, the flags waved, and the beef was served. It was all very British. Full Article
editor Midlands Media Awards: Panel chaired by Sky News Managing Editor By thebirminghampress.com Published On :: Thu, 02 May 2013 08:29:10 +0000 Peter Lowe, Managing Editor of Sky News, is to be chairman of the judging panel for this year’s Midlands Media Awards, shortlisted nominations for which will be announced on Monday, May 13. Full Article Birmingham Business Uncategorized awards press the media West Midlands
editor MusicDevelopments releases Melodya melody generator & motive editor with intro offer By rekkerd.org Published On :: Wed, 06 May 2020 07:10:23 +0000 MusicDevelopments has announced the release of Melodya, an advanced motive editor and melody generator plugin for Windows and macOS. Melodya separates shape and rhythm and includes several melodic and rhythmic transformations. Melodya is an advanced motive editor and melody generator which is simple to use but at the same time it offers many detailed settings […] The post MusicDevelopments releases Melodya melody generator & motive editor with intro offer appeared first on rekkerd.org. Full Article Instrument plugins News AU generator MIDI MusicDevelopments sale VST
editor Should You Use the Gutenberg Editor on Your WordPress Website? – TAP338 By feedproxy.google.com Published On :: Tue, 05 Nov 2019 13:00:56 +0000 Switching to the Gutenberg Editor was probably the most controversial change in WordPress's history. I'll help you decide whether you should start using Gutenberg for your podcast's WordPress website. Full Article Audio editing Gutenberg production WordPress WordPress plugins
editor Two Way Street: Obituary Editor Kay Powell And Musician Adron On Beginnings And Endings By feedproxy.google.com Published On :: Thu, 13 Sep 2018 21:51:58 +0000 On this edition of "Two Way Street," Georgia musician Adron stops by to talk and play a few songs from her new album "Water Music" before setting sail for the west coast. We also hear from a woman who made a career of saying goodbye: Kay Powell. Full Article
editor HYDRAMORPH™ Morphing Editor for the ASM Hydrasynth By feedproxy.google.com Published On :: Mon, 13 Apr 2020 20:12:08 +0000 During self-isolation due to COVID-19 my teaching has moved online affording me more time toward individual projects. I had already started a building a morphing editor for the Ashun Sound Machines Hydrasynth, so this is where I have been directing … Continue reading → Full Article Audio News Max Sound Design Experimental Generative Glitch HYDRAMORPH Hydrasynth Software Video
editor AP reporter and editor Ron Harrist dies in Mississippi By www.seattletimes.com Published On :: Sat, 09 May 2020 06:13:48 -0700 Ron Harrist, who covered Elvis Presley, black separatists, white supremacists and college football legends during his 41 years as a reporter and editor in Mississippi for The Associated Press, died of complications from leukemia at his home in Brandon early Saturday, his son Andy Harrist said. He was 77. “Ron was absolutely one of the […] Full Article Nation
editor Stranger editor says officers threatened arrest for police-stop photos By www.seattletimes.com Published On :: Thu, 01 Aug 2013 14:48:52 -0700 Over at The Stranger’s blog, News Editor Dominic Holden writes about an unfortunate encounter Tuesday night with King County Sheriff’s Office Sgt. Patrick Saulet and SPD Officer John Marion. Holden writes that he was riding his bike past Fourth Avenue South and South Jackson Street about 7:25 p.m. when he stopped to snap a picture, […] Full Article Local News