User contributions for Admin
20 February 2025
- 23:2123:21, 20 February 2025 diff hist +208 User:Admin No edit summary current
- 21:3221:32, 20 February 2025 diff hist +1,262 User:Admin No edit summary
29 December 2024
- 10:3010:30, 29 December 2024 diff hist +189 Understanding Forms and Changesets No edit summary current
27 December 2024
- 09:2109:21, 27 December 2024 diff hist +419 N How to Think About Phoenix Dead Views Created page with "Each page (resource) has a route. These routes are assigned a controller and a function from that controller. In the code below, when a user goes to the "/" route a controller named PageController is found and a function named home is invoked. Controllers are simply modules and the third argument (in this case named '''home''') is a function on the controller. <source> get "/", PageController, :home </source>" current
- 09:1209:12, 27 December 2024 diff hist +39 Phoenix Flash Message No edit summary current
- 09:1209:12, 27 December 2024 diff hist +8 Phoenix Flash Message No edit summary
- 09:1109:11, 27 December 2024 diff hist +625 N Phoenix Flash Message Created page with "In Phoenix the flash message is invoked from the controller. <source> def create(conn, %{"doink" => doink_params}) do case Doinks.create_doink(doink_params) do {:ok, doink} -> conn |> put_flash(:info, "Doink created successfully.") |> redirect(to: ~p"/doinks/#{doink}") {:error, %Ecto.Changeset{} = changeset} -> render(conn, :new, changeset: changeset) end end </source> The message itself needs to be in the view..."
24 December 2024
- 03:2103:21, 24 December 2024 diff hist +1,278 User:Admin No edit summary
- 02:4702:47, 24 December 2024 diff hist +125 User:Admin No edit summary
23 December 2024
- 01:0901:09, 23 December 2024 diff hist +114 User:Admin No edit summary
- 01:0801:08, 23 December 2024 diff hist +62 User:Admin No edit summary
- 00:5700:57, 23 December 2024 diff hist +342 User:Admin No edit summary
8 December 2024
- 02:1602:16, 8 December 2024 diff hist +46 N Update Phoenix Generator Created page with "<pre> mix archive.install hex phx_new </pre>" current
29 November 2024
- 07:0407:04, 29 November 2024 diff hist +174 User:Admin No edit summary
25 November 2024
- 21:0721:07, 25 November 2024 diff hist +389 User:Admin No edit summary
24 November 2024
- 00:2500:25, 24 November 2024 diff hist +3,740 User:Admin No edit summary
- 00:2300:23, 24 November 2024 diff hist +689 User:Admin No edit summary
11 October 2024
- 15:0115:01, 11 October 2024 diff hist +1 User talk:Admin No edit summary current
- 15:0115:01, 11 October 2024 diff hist +1,242 User talk:Admin No edit summary
10 October 2024
- 17:2417:24, 10 October 2024 diff hist +3 User talk:Admin No edit summary
- 17:2417:24, 10 October 2024 diff hist +227 User talk:Admin No edit summary
21 August 2024
- 14:2114:21, 21 August 2024 diff hist +420 User:Admin No edit summary
- 14:1314:13, 21 August 2024 diff hist +952 User:Admin No edit summary
17 August 2024
- 07:1707:17, 17 August 2024 diff hist +25 N Kill Erlang Processes Created page with "pgrep erl | xargs kill -9" current
16 August 2024
- 15:2015:20, 16 August 2024 diff hist +53 N How to Install Elixir / Erlang on Ubuntu Created page with "https://thinkingelixir.com/install-elixir-using-asdf/" current
5 August 2024
- 15:4515:45, 5 August 2024 diff hist +12 Postgres Setup No edit summary current
- 15:4515:45, 5 August 2024 diff hist +308 N Postgres Setup Created page with "==Windows== Download postgres from: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads When complete , launch the SQL Shell (psql) prompt application. Press Enter for each item in the list except "password". For password the default password is password. Type the password and hit Enter."
17 July 2024
- 22:5422:54, 17 July 2024 diff hist +62 N How to Inspect the State of a GenServer From Console Created page with "<source> :sys.get_state(pid) # pid of GenServer </source>" current
13 July 2024
- 05:4405:44, 13 July 2024 diff hist +376 Elixir Todo List Exercise No edit summary current
12 July 2024
- 02:3802:38, 12 July 2024 diff hist +417 Elixir Todo List Exercise No edit summary
- 01:4601:46, 12 July 2024 diff hist +1,043 N Elixir Todo List Exercise Created page with "<source> defmodule TodoList do defstruct todos: [] def start do loop(%TodoList{}) end def loop(state) do IO.puts("Todo List:") IO.inspect state.todos IO.puts("\nOptions:") IO.puts("1. Add Todo") IO.puts("2. Mark Todo as Done") IO.puts("3. Exit") case IO.gets("Select an option: ") |> String.trim() |> String.to_integer() do 1 -> todo = IO.gets("Enter Todo: ") |> String.trim() new_state = add_todo(state, to..."
30 June 2024
- 06:2106:21, 30 June 2024 diff hist +2,397 N Genserver Created page with "mix new App --sup <b>app/lib/app.ex</b> <source> defmodule App.Service do use GenServer def start_link(state) do GenServer.start_link(__MODULE__, state, name: __MODULE__) end def init(state) do {:ok, state} end def get_state(pid) do GenServer.call(pid, :get_state) end def set_state(pid,state) do GenServer.call(pid, {:set_state, state}) end def handle_call(:get_state, _from, state) do {:reply, state, state} end de..." current
- 05:5005:50, 30 June 2024 diff hist +50 N How to View All Running Applications Created page with "<source> :application.which_applications </source>" current
29 June 2024
- 05:0705:07, 29 June 2024 diff hist +2,474 N Phoenix LiveView Async Assigns Created page with "== Example== <source> defmodule AppWeb.PageLive do use AppWeb, :live_view alias Phoenix.LiveView.AsyncResult @impl true def mount(_params, _session, socket) do {:ok, assign_async(socket, :number, fn -> {:ok, %{number: really_complicated_function()}} end)} end @impl true def handle_event("generate_number", _, socket) do {:noreply, socket |> assign(:number, AsyncResult.loading()) |> start_async(:get_random_number, fn -> really_c..." current
21 June 2024
- 20:5620:56, 21 June 2024 diff hist −24 User:Admin No edit summary
- 20:1420:14, 21 June 2024 diff hist +1,172 User:Admin No edit summary
20 June 2024
- 19:4419:44, 20 June 2024 diff hist +669 N Compare Identical Files Created page with "<source> defmodule FileComparator do def compare(file1, file2) do IO.inspect File.cwd!() content1 = read_file(file1) content2 = read_file(file2) if content1 == content2 do IO.puts("The files have identical content.") else IO.puts("The files have different content.") end end defp read_file(file_path) do case File.read(file_path) do {:ok, content} -> content {:error, reason} -> raise "Failed to read #{file_path}:..." current
17 June 2024
- 16:3416:34, 17 June 2024 diff hist −7 User:Admin No edit summary
- 16:2416:24, 17 June 2024 diff hist +1,020 User:Admin No edit summary
- 15:1115:11, 17 June 2024 diff hist +31 User:Admin No edit summary
13 June 2024
- 17:1117:11, 13 June 2024 diff hist +111 How to Upload Files Using Post Controller No edit summary current
- 17:1017:10, 13 June 2024 diff hist −9 How to Upload Files Using Post Controller No edit summary
- 17:1017:10, 13 June 2024 diff hist +904 N How to Upload Files Using Post Controller Created page with " Create a LiveView and render a form with the multipart attribute. <source> <.form :let={f} action={~p"/transmit/#{switch}"} multipart> <.input field={f[:switch_item]} name="switch" type="file" /> <input type="submit" /> </.form> </source> Create a controller for the route /transmit/#{switch} '''transmit_controller.ex''' <source> defmodule AppWeb.TransmitCont..."
12 June 2024
- 20:1620:16, 12 June 2024 diff hist +200 How to Upload Files to Phoenix No edit summary current
11 June 2024
- 20:2720:27, 11 June 2024 diff hist +308 Elixir Phoenix SSH No edit summary current
- 17:4417:44, 11 June 2024 diff hist +1,274 N Use Phoenix to SSH into a Server and Download a File to Users Local Machine Created page with "'''Download_Controller ''' <source> defmodule AppWeb.DownloadController do use AppWeb, :controller def home(conn, %{"switch" => switch}) do {:ok, conn} = SSH.connect( # "sim.com.whatever" user: "root", identity: "/home/user/.ssh/id_rsa_nop", save_accepted_host: false, silently_accept_hosts: true, user_interaction: false ) file_path = "priv/test.json" {:ok, json_data} = conn case File.write(file_path..." current
- 01:4601:46, 11 June 2024 diff hist +548 N Struct Pattern Matching in Arguments of Functions Created page with "=Example= <source> %Person{} = person </source> <source> defmodule Person do defstruct [ first_name: nil, last_name: nil, birthday: nil, location: "home" ] def full_name(%Person{} = person) do "#{person.first_name} #{person.last_name}" end def age(%Person{} = person) do days = Date.diff(Date.utc_today, person.birthday) days / 365.25 end def home(%Person{} = person) do %{person | location: "home"} end def away(%P..." current
10 June 2024
- 19:3619:36, 10 June 2024 diff hist +86 N Kill Hanging Process on Linux Created page with "Use the command "top" to view top hanging process. sudo kill -9 pid_number_of_process" current
- 18:4818:48, 10 June 2024 diff hist −4 How to Capture Text of Items When Clicked No edit summary current
- 18:4018:40, 10 June 2024 diff hist +652 N How to Capture Text of Items When Clicked Created page with "=Example= <source> defmodule AppWeb.PageLive do use AppWeb, :live_view def render(assigns) do ~L""" <div id="list-container"> <ul> <%= for item <- @items do %> <li phx-click="capture_text" phx-value-text="<%= item %>"><%= item %></li> <% end %> </ul> </div> """ end def mount(_params, _session, socket) do items = ["Item 1", "Item 2", "Item 3"] # Example list items {:ok, assign(socket, items: items)}..."