Tag: freedom

Email-to-SMS Gateway List With Setup & Code Example

Email-to-SMS Gateway List With Setup & Code Example

email_to_sms
email_to_sms

    For personnel projects, one might need to send a message to a phone to give updates or alerts. This can be done relatively easily by using PHP and its “mail()” command. But, we need to know what gateway to send it to and what the number is. The number part is easy but gateways vary. So, here is a reference list of Email-to-SMS Gateways. In addition, there is a quick code reference part to help get the ball rolling. As a final point before starting, you will need a proper mailing system and FQDN to make sure messages get through. Some gateways are highly fickle and you might not always get the SMS sent through using this setup. So, don’t use this in a commercial context unless you do the aforementioned.

Code Reference:

    First, you’ll need the program “mail()” uses to send messages. In a terminal do:

sudo apt-get install sendmail

Then, edit the host file found at /etc/hosts. You’ll have something like this at the top: 127.0.0.1 localhost. You need it to be setup the proper FQDN syntax; so, something like this: 127.0.0.1 localhost.example.com is needed. After all that is setup (You might need to reboot.) you simply need to insert into a PHP script the following:

$number = "[email protected]";
$subject = "Your sybject message here.";         // Not used in text messages per say
$tmessage = wordwrap("Your message here.", 70 );

mail($number, $subject, $tmessage);

Gateway List:

Cell Carrier Email Domain
AT&T Enterprise Paging page.att.net
AT&T Wireless txt.att.net
Alaska Communication Systems msg.acsalaska.com
Alltel  text.wireless.alltel.com
Now part of AT&T
Australia T-Mobile/Optus Zoo (Optus) optusmobile.com.au
Appears they charge for the service
Bell Mobility & Solo Mobile txt.bell.ca
Bluegrass Cellular sms.bluecell.com
Boost Mobile myboostmobile.com
Cellcom cellcom.quiktxt.com
Cellular South (C Spire) cellularsouth1.com
(now cspire1.com)
Centennial Wireless cwemail.com
Cincinnati Bell gocbw.com
Cingular cingular.com
Merged with AT&T Mobility 2007
Cingular Prepaid cingulartext.com
Cox Wireless Discontinued 2012
Cricket Wireless mms.cricketwireless.net
Digicel St. Lucia digitextlc.com
Fido fido.ca
Google Voice Not an actual carrier
GCI Alask Digitel (GCI) mobile.gci.net
IV Cellular (Illinois Valley Cellular) ivctext.com
i wireless (iWireless) iwspcs.net (T-Mobile)
iwirelesshometext.com (Sprint PCS)
Koodo Mobile msg.telus.com
Lime txt2lime.com
Metro PCS mymetropcs.com
Mobilicity No email-to-SMS service
MTS Mobility text.mtsmobility.com
NET10 Determine NET10’s carrier
Nex-Tech sms.nextechwireless.com
nTelos pcs.ntelos.com
Will change to Sprint early 2016
O2 (M-mail) mmail.co.uk
O2 Powered Networks  
O2 UK o2imail.co.uk
Optus optusmobile.com.au
Appears they charge for the service
Orange orange.net
PC Telecom mobiletxt.ca
PTel Mobile tmomail.net
Pioneer Cellular zsend.com
Pocket Wireless sms.pocket.com
Republic Wireless text.republicwireless.com
Rogers Wireless pcs.rogers.com
SaskTel sms.sasktel.com
Sprint messaging.sprintpcs.com
Straight Talk Determine Straight Talk’s carrier
Syringa Wireless rinasms.com
T-Mobile tmomail.net
T-Mobile UK t-mobile.uk.net
Telstra onlinesms.telstra.com
Telus Mobility msg.telus.com
Three three.co.uk
Tracfone Determine Tracfone’s carrier
US Cellular email.uscc.net
Unicel utext.com
Verizon vtext.com
Viaero viaerosms.com
Virgin Mobile vmobl.com
Virgin Mobile Canada vmobile.ca
Virgin Mobile UK vxtras.com
Vodafone No email-to-SMS service
Wind Mobile txt.windmobile.ca

Check out my article regarding test servers so you can test this out properly!


Servers
Quick Test Server

MPlayer Keyboard Controls and Shortcuts

MPlayer Keyboard Controls and Shortcuts

mplayer logo
mplayer logo

    I love MPlayer but I don’t always recall its controls since its default GUI is bare bones and uses the keyboard to do most if not all of its actions. So, I’ve shamelessly referenced another site and am backing it up onto my site. Besides, one never knows how long a site might remain up and this info is too useful to have to recompile if lost.

    To add to all of that, I’ve been thinking about doing a project where I edit the MPlayer source code to add a helpful popup that shows the control options in a pagnated way. I want this page to be a reference for it should I get the willpower to actually try and do this. Anyway, here are 74 MPlayer keyboard controls.

MPlayer Keyboard Shortcuts

Keyboard control
<- and -> Seek backward/forward 10 seconds.
up and down Seek forward/backward 1 minute.
pgup and pgdown Seek forward/backward 10 minutes.
[ and ] Decrease/increase current playback speed by 10%.
{ and } Halve/double current playback speed.
backspace Reset playback speed to normal.
< and > Go backward/forward in the playlist.
ENTER Go forward in the playlist, even over the end.
HOME and END next/previous playtree entry in the parent list
INS and DEL (ASX playlist only) next/previous alternative source.
p / SPACE Pause (pressing again unpauses).
. Step forward. Pressing once will pause movie, every consecutive press will play one frame and then go into pause mode again (any other key unpauses).
q / ESC Stop playing and quit.
+ and – Adjust audio delay by +/- 0.1 seconds.
/ and * Decrease/increase volume.
9 and 0 Decrease/increase volume.
( and ) Adjust audio balance in favor of left/right channel.
m Mute sound.
_ (MPEG-TS and libavformat only) Cycle through the available video tracks.
# (DVD, MPEG, Matroska, AVI and libavformat only) Cycle through the available audio tracks.
TAB (MPEG-TS only) Cycle through the available programs.
f Toggle fullscreen (also see -fs).
T Toggle stay-on-top (also see -ontop).
w and e Decrease/increase pan-and-scan range.
o Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
d Toggle frame dropping states: none / skip display / skip decoding (see -framedrop and -hardframedrop).
v Toggle subtitle visibility.
j Cycle through the available subtitles.
y and g Step forward/backward in the subtitle list.
F Toggle displaying forced subtitles .
a Toggle subtitle alignment: top / middle / bottom.
x and z Adjust subtitle delay by +/- 0.1 seconds.
r and t Move subtitles up/down.
i (-edlout mode only) Set start or end of an EDL skip and write it out to the given file.
s (-vf screenshot only) Take a screenshot.
S (-vf screenshot only) Start/stop taking screenshots.
I Show filename on the OSD.
! and @ Seek to the beginning of the previous/next chapter.
D (-vo xvmc, -vf yadif, -vf kerndeint only) Activate/deactivate deinterlacer.
Hardware accelerated video output
1 and 2 Adjust contrast.
3 and 4 Adjust brightness.
5 and 6 Adjust hue.
7 and 8 Adjust saturation.
SDL Video Output Driver
c Cycle through available fullscreen modes.
n Restore original mode.
Multimedia Keyboard
PAUSE Pause.
STOP Stop playing and quit.
PREVIOUS and NEXT Seek backward/forward 1 minute.
GUI Support (if compiled in)
ENTER Start playing.
ESC Stop playing.
l Load file.
t Load subtitle.
c Open skin browser.
p Open playlist.
r Open preferences.
If TV or DVB support compiled
h and k Select previous/next channel.
n Change norm.
u Change channel list.
Navigate menus (if DVNAV support)
keypad 8 Select button up.
keypad 2 Select button down.
keypad 4 Select button left.
keypad 6 Select button right.
keypad 5 Return to main menu.
keypad 7 Return to nearest menu (the order of preference is: chapter->title->root).
keypad ENTER Confirm choice.
Teletext support (if compiled)
X Switch teletext on/off.
Q and W Go to next/prev teletext page.
mouse control
button 3 and button 4 Seek backward/forward 1 minute.
button 5 and button 6 Decrease/increase volume.
joystick control
left and right Seek backward/forward 10 seconds.
up and down Seek forward/backward 1 minute.
button 1 Pause.
button 2 Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
button 3 and button 4 Decrease/increase volume.

If you’d like to check out another reference sheet, have a look at my HTML, CSS, and JavaScript Cheat Sheet that’s linked below!

Web Technologies
HTML, CSS, and JavaScript Cheat Sheet

HTML, CSS, JavaScript Useful Cheat Sheet!

HTML, CSS, JavaScript Useful Cheat Sheet!


To Top


To Bottom

Web Technologies
Web Technologies

    I love web technologies because they provide a quick return on interest (ROI) and for the beginner gives immediate feedback in terms of accomplishment and sense of progress. There are many frameworks that one can use for a web based project but knowing the base elements these frameworks are comprised from is still important. Here is a reference list/cheat sheet of some of the most common HTML tags, CSS, and JavaScript one will likely use. This is great for Web Devs, Web Admins, coders, programmers, and the like.

HTML Tags

    Most HTML tags are setup as open and close tags. This means that most tags are a pare/set and denote where they start and end. The end tag has a forward slash (/) to indicate the tag is the end tag.

<tag>Stuff in tag...</tag>
(open tag)content(/end tag)

<!--Some tags end like this-->
<tag/>

<div>

    Div tags are considered devision tags and are used to section data on a page. CSS will then be used to style the tag by setting its position, setting the background color, setting the text color, etc. Think of the div as a container and your scaffolding for the page. Div tags are block elements.

<p>

    The P tag stands for paragraph tag and this is like a sub container for the div tag. It often holds text but can contain images, links, and other non-block tags. Browsers will automatically add some space (margin) before and after each <p> element. This behavior can be modified with CSS using the margin properties. P tags are block elements.

<span>

    The span tag is pretty much like the div tag. The difference between the two is that div is a block element which puts it on a separate line. A span tag, however, is an inline element, meaning that it can be on a line with other elements.


<img>

    The img tag stands for images. People like images and I like images.

<img src="https://www.itdominator.com/wp-content/uploads/2017/07/wp-cli.jpg" alt="If image doesn't render, this text will show instead." />

<a>

    Anchor tags link to parts on the same page or to new pages entirely. They are essentially links.

<!--To an external page...-->
<a href="http://www.google.com" target="_blank">Google</a>

<!--This will jump to the content that is wrapped with another anchor tag on the same page.-->
<a href="#colors">Colors</a>

<a name="colors">
<p>Colors are cool. The primary colors are red, green, and blue.</p>
</a>

<table>

    Table is a block element that denotes there will be sub elements of th, tr, td. There are others but these are the core parts. Th stands for table header and
is inset within a tr (table row). Tr is table row which makes a row for the table. Td is table data which is like a column and is inset in a table row too.

border-collapse: separate (default):

Firstname Lastname
Tom Gar
Lois Griffin

border-collapse: collapse:

Firstname Lastname
Peter Griffin
Lois Matt

form

    A form is used to submit data to the server. There are many form objects one can use. Below is a table covering all HTML5 form objects and their code and examples.

Object Preview HTML 5 code
Label

<label>Texte</label>
Button

<input type=”button” name=”name” value=”Bouton”>
Image button


<input type=”image” src=”image/bimage.jpg”>
Text field

<input type=”text” name=”text” value=”empty”>
Password

<input type=”password” name=”monpass” value=”12345″>
Date

<input type=”date” name=”date” value=”<?php echo $today?>”>
Date and time

<input type=”datetime” name=”time” value=”<?php echo $now?>”>
Time <time>2013-06-27</time>
Number

<input type=”number” name=”num” value=”12345″>
Color

<input type=”color” name=”color” value=””>
Search input

<input type=”search” name=”” list=”datalist” value=””>
Data
Dix
<data value=”10″>Ten</data>
Check box

<input type=”checkbox” name=”checkbox1″ value=”checkbox”>
Radio group



<label>Choice 1
<input type=”radio” name=”radio1″ value=”radio1″>
</label>
<label>Choice 2
<input type=”radio” name=”radio1″ value=”radio2″>
</label>
Textarea

<textarea name=”textarea”>content</textarea>
Range


<input type=”range” min=”-100″ max=”100″
value=”0″ step=”2″ name=”power” list=”powers”>
<datalist id=”powers”>
<option value=”0″>
<option value=”-30″>
<option value=”30″>
<option value=”+50″>
</datalist>
Data list To be used with input
<datalist id=”identifier”>
<option value=”1″>
<option value=”2″>
<option value=”3″>
</datalist>
Select

<select name=”select”>
<option>Alpha</option>
<option>Beta</option>
<option>Delta</option>
</select>
Select list

<select name=”select2″ size=”3″>
<option>Alpha</option>
<option>Beta</option>
<option>Delta</option>
</select>
Menu

  • New
  • Open
  • Save
  • <menu type=”context”>
    <li>New</li>
    <li>Open</li>
    <li>Save</li>
    </menu>
    Toolbar

  • <menu type=”toolbar”>
    <li><button type=”button” onclick=”fnew()”>New</button></li>
    <li><button type=”button” onclick=”fopen()”>Open</button></li>
    <li><button type=”button” onclick=”fsave()”>Save</button></li>
    </menu>
    Combo box


    <input type=”text” list=”comboid”>
    <datalist id=”comboid”>
    <option value=”0″>
    <option value=”-30″>
    <option value=”30″>
    <option value=”+50″>
    </datalist>
    File upload

    <input type=”file” name=”file”>
    Image & caption

    Caption

    <figure>
    <img src=”image/image.gif”>
    <figcaption>Caption</figcaption>
    </figure>
    Fieldset
    Title

    …Content…

    <fieldset>
    <legend>Title </legend>

    <p>Content</p>
    </fieldset>
    Output

    <output onforminput=”value = 2 + 2″></output>
    Meter
    12 units
    <meter min=0 max=24 value=12>12 units</meter>
    Progress 0%
    <progress id=”prog” max=100>
    Summary

    Overview
    term
    definition

    <details>
    <summary>
    Presentation
    </summary>
    <dl>
    <dt>term</dt>
    <dd>definition</dd>


    </dl>
    </details>
    Submit button

    <input type=”submit” name=”submit” value=”Submit”>
    Clear/Reset button

    <input type=”reset” name=”clear” value=”Clear”>

    HTML Entities

        HTML entities are used in place of reserved characters in HTML. Characters that are not present on your keyboard can also be replaced by entities as well. The most common are listed in a table below.

    Result Description Entity Name Entity Number
    non-breaking space &nbsp; &#160;
    < less than &lt; &#60;
    > greater than &gt; &#62;
    & ampersand &amp; &#38;
    double quotation mark &quot; &#34;
    single quotation mark (apostrophe) &apos; &#39;
    ¢ cent &cent; &#162;
    £ pound &pound; &#163;
    ¥ yen &yen; &#165;
    euro &euro; &#8364;
    © copyright &copy; &#169;
    ® registered trademark &reg; &#174;

    HTML Notes

    Recommended Default HTML Markup Before Content Is Added

    <!DOCTYPE html> <!--Tells a browser its an html page-->
    <html lang="en">
    <head>
      <meta charset="utf-8">  <!--Encoding model-->
      <title>Title seen on its tab</title>
      <link rel="stylesheet" href="/css/master.css"> <!-- Attach CSS through a path -->
    
    
    
    
    </head>
    <body>
    
    <!-- content goes here... -->
    
    
    <script src="resources/scripts/script.js" charset="utf-8"></script>  <!-- Attach Javascript File through path -->
    </body>
    </html>
    

    Block Elements

        In general, HTML elements can be divided into two categories : block level and inline elements. HTML block level elements can appear in the body of an HTML page. It can contain another block level as well as inline elements. By default, block-level elements begin on new lines. Block level elements create larger structures (than inline elements).

    • p
    • h1, h2, h3, h4, h5, h6
    • ol, ul
    • pre
    • address
    • blockquote
    • dl
    • div
    • fieldset
    • form
    • hr
    • noscript
    • table

    Inline Elements

        HTML inline elements can appear in the body of an HTML page. They can contain data and other inline elements. By default, inline elements do not begin on new lines. Inline elements create shorter structures (than block elements).

    • b, big, i, small, tt
    • abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var
    • a, bdo, br, img, map, object, q, script, span, sub, sup
    • button, input, label, select, textarea

    Margins

        Margins are the spacing around an element.

    This span tag has 2em margin set…

    Padding

        Padding is the spacing internal to an element and its “walls”.

    This span tag has 2em padding set…

    CSS

    Examples/Logic

    Selector Example Example description
    .class .intro Selects all elements with class=”intro”
    #id #firstname Selects the element with id=”firstname”
    * * Selects all elements
    element p Selects all <p> elements
    element,element div, p Selects all <div> elements and all <p> elements
    element element div p Selects all <p> elements inside <div> elements
    element>element div > p Selects all <p> elements where the parent is a <div> element
    element+element div + p Selects all <p> elements that are placed immediately after <div> elements
    element1~element2 p ~ ul Selects every <ul> element that are preceded by a <p> element
    [attribute] [target] Selects all elements with a target attribute
    [attribute=value] [target=_blank] Selects all elements with target=”_blank”
    [attribute~=value] [title~=flower] Selects all elements with a title attribute containing the word “flower”
    [attribute|=value] [lang|=en] Selects all elements with a lang attribute value starting with “en”
    [attribute^=value] a[href^=”https”] Selects every <a> element whose href attribute value begins with “https”
    [attribute$=value] a[href$=”.pdf”] Selects every <a> element whose href attribute value ends with “.pdf”
    [attribute*=value] a[href*=”w3schools”] Selects every <a> element whose href attribute value contains the substring “w3schools”
    :active a:active Selects the active link
    ::after p::after Insert something after the content of each <p> element
    ::before p::before Insert something before the content of each <p> element
    :checked input:checked Selects every checked <input> element
    :disabled input:disabled Selects every disabled <input> element
    :empty p:empty Selects every <p> element that has no children (including text nodes)
    :enabled input:enabled Selects every enabled <input> element
    :first-child p:first-child Selects every <p> element that is the first child of its parent
    ::first-letter p::first-letter Selects the first letter of every <p> element
    ::first-line p::first-line Selects the first line of every <p> element
    ype.asp”>:first-of-type p:first-of-type Selects every <p> element that is the first <p> element of its parent
    :focus input:focus Selects the input element which has focus
    :hover a:hover Selects links on mouse over
    sp”>:in-range input:in-range Selects input elements with a value within a specified range
    :invalid input:invalid Selects all input elements with an invalid value
    :lang(language) p:lang(it) Selects every <p> element with a lang attribute equal to “it” (Italian)
    sp”>:last-child p:last-child Selects every <p> element that is the last child of its parent
    ype.asp”>:last-of-type p:last-of-type Selects every <p> element that is the last <p> element of its parent
    :link a:link Selects all unvisited links
    :not(selector) :not(p) Selects every element that is not a <p> element
    sp”>:nth-child(n) p:nth-child(2) Selects every <p> element that is the second child of its parent
    hild.asp”>:nth-last-child(n) p:nth-last-child(2) Selects every <p> element that is the second child of its parent, counting from the last child
    f-type.asp”>:nth-last-of-type(n) p:nth-last-of-type(2) Selects every <p> element that is the second <p> element of its parent, counting from the last child
    ype.asp”>:nth-of-type(n) p:nth-of-type(2) Selects every <p> element that is the second <p> element of its parent
    ype.asp”>:only-of-type p:only-of-type Selects every <p> element that is the only <p> element of its parent
    sp”>:only-child p:only-child Selects every <p> element that is the only child of its parent
    :optional input:optional Selects input elements with no “required” attribute
    ange.asp”>:out-of-range input:out-of-range Selects input elements with a value outside a specified range
    sp”>:read-only input:read-only Selects input elements with the “readonly” attribute specified
    sp”>:read-write input:read-write Selects input elements with the “readonly” attribute NOT specified
    :required input:required Selects input elements with the “required” attribute specified
    :root :root Selects the document’s root element
    ::selection ::selection Selects the portion of an element that is selected by a user
    :target #news:target Selects the current active #news element (clicked on a URL containing that anchor name)
    :valid input:valid Selects all input elements with a valid value
    :visited a:visited Selects all visited links

    IDs

        ID selectors are supposed to be unique within the HTML document. When queried with JavaScript it should return a single element but it can return an array/list if the web developer set the document with multiple IDs of the same type. Standards dictate this is poor form if done.

    <!-- The IDs are arbitrary. -->
    
    <div id="left-container"> <!-- Content --> </>
    <div id="middle-container"> <!-- Content --> </>
    <div id="right-container"> <!-- Content --> </>
    

    Classes

        Class selectors don’t have to be unique within the HTML document. When queried with JavaScript it usually returns an array/list.

    <!-- The Class is arbitrary. -->
    
    <div class="book"> <!-- Content --> </>
    <div class="book"> <!-- Content --> </>
    <div class="book"> <!-- Content --> </>
    

    CSS Button Generator Button Generator

        Quickly make buttons…

    Button













    JavaScript

    Get Elements By ID/Class/TagName/CSS Selector

        Getting elements by id, class, and tag among other options is a sizeable chunk of the JavaScripting one will do. This allows us to interact with the DOM

    // Get HTML element(s) with specified id.
      var x = document.getElementById('id');
    
    // Get HTML elements with specified class.
      var x = document.getElementsByClassName('className');
    
    // Get HTML elements with specified tag.
      var x = document.getElementsByTagName('tagName');
    
    // Get HTML elements tht matches a specified CSS selector
    // This example returns a list of all  elements with class="icon".
      var x = document.querySelectorAll("img.icon"); 
    

    Function

        The basic block of coding we all know and have come to love. Yes…the function.

    function sum(a, b) {
        return a + b;      // The function returns the sum of a and b
    }
    var sumVal = sum(2,4);
    alert(sumVal);  // Will pop-up saying 6
    

    If Statement

        Check the conditions.

    if (condition) {
    }
    

    Loops

        Loops baby, they’re needed and these will meet your needs.

    // Standard loop
    for (var i=0; i<array.length; i++) {
       array[i].innerHTML;
    }
    
    // For In Loop
    for (var tag in elements) {
        // Do stuff while there are tags to work on
    }
    
    // While Loop
    while (condition) {
        // Do stuff while condition is met
    }
    
    // Do While
     do {
        // One at least one and keep doing stuff while condition is met
    }
    while (condition);
    

    Switch/Case Statement

        Good for menu stuff, switch/case statements are ready for the job.

    var day;
    switch (new Date().getDay()) {
        case 0:
            day = "Sunday";
            break;
        case 1:
            day = "Monday";
            break;
        case 2:
            day = "Tuesday";
            break;
        case 3:
            day = "Wednesday";
            break;
        case 4:
            day = "Thursday";
            break;
        case 5:
            day = "Friday";
            break;
        case  6:
            day = "Saturday";
    }
    alert(day);
    

    Alert & Console Log

        Error logging is helpful. The two way to do this are through alerts and console logging. Most of the time, alert isn’t used but it can be helpful to warn the user, etc.

    // This will generate a pop-up window with the "Hello, World!" text.
    alert("Hello, World!");
    
    // This will log to the console the "Hello, World!" text.
    To access the console in Firefox, do Ctrl+Shift+J
    console.log("Hello, World!");
    

    Adding Event Listeners

        Event listeners are the next most important after getting an element. They allow us to let the user click on stuff or interact through other ways in order to create dynamic interactions.

    // This attaches a click event to the entire DOM.
    // We can then check which IDs, Classes, etc were clicked to then do other things.
    
    document.addEventListener("click", (e) => {
        if(e.target.id == "alert2")
            alert("You clicked an element with the ID of alert2");
    
    });
    
    
    // This attaches to a specific element with the ID of cars and
    // when clicked alerts us to the innerHTML text.
    
    <p id="cars">Hello, World!</p>
    
    document.getElementById('cars').addEventListener("click", (e) => {
            alert("The content is:  " + e.target.innerHTML);
    });
    
    // This attaches it in a different manner.
    document.getElementById('cars').onclick =  function(){
        // do stuff
    }
    
    // You can add it though a tag as well.
    <div onclick="myFunction()"> I am clickable! </div>
    

    Here is a list of some common HTML event attributes:

    Event Description
    onchange An HTML element has been changed
    onclick The user clicks an HTML element
    onmouseover The user moves the mouse over an HTML element
    onmouseout The user moves the mouse away from an HTML element
    onkeydown The user pushes a keyboard key
    onkeyup The user releases a keyboard key
    onload The browser has finished loading the page

    Arrays

        Arrays in JavaScript are a special object and really act like lists or vectors since we can push new values to it.

    // An empty array
    var cars = [];
    
    // Has nodes/objects
    var cars = ["Toyota", "Sab", "Mazda"];
    
    // Add to array
    cars.push("Nesan');
    
    // Remove from end of array
    cars.pop();
    

    Parent Element

        Sometimes, we need to access the element that contains the element we accessed. This could be because we want to remove the element or we want to add something next to it than in it.

    <div>
        <p id="cars" >
            Cars are cool.
        </p>
    But boats are even more cool.
    </div>
    
    var x = document.getElementById('cars').parentElement;
    alert(x.innerHTML);  // This will present an alert box with "But boats are even more cool."
    
    
    // This will remove the element we accessed from the div
    var childElm = document.getElementById('cars');
    var parentElm = childElm.parentElement;
    
    parentElm.removeChild(childElm);
    

    Cookies

        Sometimes, we need to store user information for later usage. This is where cookies come in.

    function saveAsCookie() {
        var uName = document.getElementsByName("userName")[0].value;
        var eml = document.getElementsByName("email")[0].value;
    
    
        // should set expires date: Ex -> expires=(UTC date).
        // Use secure; in argument to make sure it only transports across HTTPS or secure connections
        document.cookie = "username=" + uName  +"; path=" + document.URL;
        document.cookie = "email=" + eml + "; path=" + document.URL;
    }
    
    function displayCookies() {
        var cookiesField = document.getElementById("cookieField");
        var cookies = document.cookie.split(";");  // Set as an array to traverse....
    
        for (var i=0; i<cookies.length; i++) {
            cookiesField.innerHTML += cookies[i] + "<br/>";
        }
    }
    
    function clerCookies() {
        var expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
        document.cookie = "username=; expires=" + expireDate;
        document.cookie = "email=; expires= " + expireDate;
    }
    
    <form>
    <input type="text" title="User Name" name="userName" placeholder="User Name" value=""/>
    <input type="text" title="Email" name="email" placeholder="Email" value=""/>
    <input type="button" name="submit"  onclick="saveAsCookie()" value="loginSubmit">
    </form>
    
    <button type="button" name="button" onclick="displayCookies()">Get Cookie</button>
    <button type="button" name="button" onclick="clerCookies()">Clear Cookie</button>
    
    <div id="cookieField"></div>
    

    AJAX

        AJAX is a developer’s dream, because you can:

    • Update a web page without reloading the page
    • Request data from a server – after the page has loaded
    • Receive data from a server – after the page has loaded
    • Send data to a server – in the background
    function loadDoc() {
      var xhttp = new XMLHttpRequest();        // Create the xhttp object
      xhttp.onreadystatechange = function() {  // This is actually run after open and send are done
        if (this.readyState == 4 && this.status == 200) {  // Confirm we have a  successful connection
         // Receive the response info. For PHP it is echo that sends it. Then set into demo div
         document.getElementById("demo").innerHTML = this.responseText;  
        }
      };
      xhttp.open("GET", "ajax_info.txt", true);  // post or get, path to XML page or php script, set async 
      xhttp.send();                              // Start the process
    }
    
    
    <button type="button" name="button" onclick="loadDoc()">Load XML</button>
    <div id="demo">
    

    String Manipulation

        String Manipulation can be important when handling cookies or data. Sometimes we need to split it into an array, make it lower case or vise versa, find a sub string, or more.
    These should get you started:

    // Find sub string
    var str = "Hello world, welcome to the universe.";
    var n = str.includes("world");
    
    // Find sub string at offset
    var str = "Hello world, welcome to the universe.";
    var n = str.includes("world", 12);
    
    // Replace string 
    var str = "Windows!";
    var res = str.replace("Windows", "Linux");  // old value, new value
    
    // Replace all case sensitive
    var str = "Mr Blue has a blue house and a blue car";
    var res = str.replace(/blue/g, "red");
    
    // Replace all case-insensitive
    var str = "Mr Blue has a blue house and a blue car";
    var res = str.replace(/blue/gi, "red");
    
    // String split
    var str = "How are you doing today?";
    var arry = str.split(" ");  // Split by spaces
    
    // To Upper
    var x = "Linux";
    x.toUpperCase();
    
    // To Lower
    var x = "LINUX";
    x.toLowerCase();
    

    Conclusion

        I think this list is pretty good and fits most user's needs. This should definitely help those who are looking for a certain tag or CSS logic or are just wanting to see a broad selection of what web technologies are based off of. Coders, website developers, Admins, etc should have most of what they need right on the page with good samples to start. Leave a commemt if you'd like me to add something else! Anyway, if you liked this reference sheet/cheat sheet, start using what you have learned by setting up a quick test server! Read my article by clicking the below image!


    Servers

    W3C Killed Web Security

    W3C Killed Web Security

    W3C Logo
    W3C Logo

        It’s a sad day folks…. The W3C killed web security by accepting DRM without having a caveat that protects against DMCA’s (Digital Millennium Copyright Act) unreasonable reach. Security researchers are out; hackers are in. While I am sure that most users believe that companies and creators have the right to protect their IP (Intellectual Property), I am also sure they believe in having strong security and a reasonable right to use their purchased product in whatever manner they see fit. With the web, it was a last bastion that held to those principles. It was killed both brutally and without much compunction by W3C and its corporate backers in a vain attempt to stem the tide of piracy and illegal copying.

        Let’s be clear here for a moment about the current problem. I don’t have an issue with DRM. I don’t agree with it all the time but neither do I disagree with it all the time. No, the issue is with DMCA and it’s unreasonable reach in trying and failing to protect DRM. There are two sections in the DMCA that are of great interest. The core section I am referring to is Section 1201: Circumvention of copyright protection systems.

        Section 1201 affects the web and all technologies the most and is why it is a sad day for the internet. The EFF letter to W3C addresses some of the concerns regarding Section 1201 in its implementation in web technologies.
    Here are some of the critical points they made when hoping W3C would add a pretext for accepting DRM standards.

        “This covenant would allow the W3C’s large corporate members to enforce their copyrights. Indeed, it kept intact every legal right to which entertainment companies, DRM vendors, and their business partners can otherwise lay claim. The compromise merely restricted their ability to use the W3C’s DRM to shut down legitimate activities, like research and modifications, that required circumvention of DRM….
        More directly, such a covenant would have helped protect the key stakeholders, present and future, who both depend on the openness of the Web, and who actively work to protect its safety and universality. It would offer some legal clarity for those who bypass DRM to engage in security research to find defects that would endanger billions of web users; or who automate the creation of enhanced, accessible video for people with disabilities; or who archive the Web for posterity. It would help protect new market entrants intent on creating competitive, innovative products, unimagined by the vendors locking down web video.”

    There is the crux of the issue and why W3C should have had clear stipulations for implementing DRM into web technologies. There really isn’t anything protecting the user and their right to circumvent DRM when it is not infringing the patent holder or IP source. Security experts are now in a quasi grey area where their work is to determine vulnerabilities but they are violating DMCA. This helps no one but the bad guys and that is just sad in the day and age where billions of users need strong security the most.

        In addition, we don’t know who did and didn’t vote in favor of the implementation of a DRM standard. The votes are secret and that should disturb us even more than the terrible overreach of DMCA’s rules. It is worth noting that W3C’s member votes aren’t always public and by default one must opt-in for public disclosure of said vote. For an organization that affects our lives, to not have public disclosure of votes by default and as enforced practice is egregious. We all know why this is the case though. Companies don’t want to look like the bad guys even when they are. So they hide in anonymity as we all are left to hang by their terrible decisions. We can make some guesses as to who voted for the standardization but don’t know who else are their accomplices. Essentially, a private group gets to affect our lives without us holding them accountable. In addition, their votes wont stop piracy or illegal copying. So all in all, they hurt themselves as well as us with nothing to show for it but the further stripping of our rights.

        While it all looks bad, there are bright spots. The US government is looking to open source its code base as much as it reasonably can. Maybe they’ll step in and decide obtrusive DRM and its protective DMCA rules are too powerful. If interested in some of their projects, check out my article covering some of the best packages released to date.

    Code.gov

    Code.gov

    Picture of code dot gov slogan
    Code.gov

        I just wanted to make a shout out to Code.gov and the work they do. If one isn’t sure of who or what they are they are the US government’s team working to opensource the code used by the government’s agencies. This post comes on the heals of an email I received from their mailing list which reminded me of their transition to open source their code. I can’t think of any better way to express democracy than through opening up a sizable chunk of ones code base.

    Here are 5 projects to keep an eye on


    5 — Consumer Financial Protection Bureau’s Owning a Home Project

        Hey, getting a home isn’t always easy but it can be with these tools provided by Consumer Financial Protection Bureau and its Owning a Home project. Everything is looked at from loan options, terminology, and costs.

    Link: https://github.com/cfpb/owning-a-home

    4 — National Archives and Records Administration’s File Analyzer Project

        So, this project came to my attention because I am programming a CSV file viewer. I’m considering other functions for my application and this file analyzer just might be the thing to give it a cool boost. It says that each file test generates a table of results and that is useful given my CSV viewer dumps a csv file into a GUI table view.

    Link: https://github.com/usnationalarchives/File-Analyzer

    3 — Department of Agriculture’s RIBD Project

        Ahh leisure…. Who doesn’t want to enjoy time off at beautiful federal lands, historic sites, museums, and/or other attractions?
    According to their site, the “Recreation Information Database (RIDB) provides data resources to citizens, offering a single point of access to information about recreational opportunities nationwide.”

    Link: https://usda.github.io/RIDB/

    2 — NSA’s Unfetter Project

        When not spying on us and the world, the NSA is helping us secure our data by giving tools that analyze gaps in our security posture.

    Link: https://iadgov.github.io/unfetter/

    1 — NASA’s 3D Resources

        I am a big fan of space and even bigger fan of making beautiful Blender renders. NASA’s 3D model collection is huge and gives great assets to space fans and art lovers alike to play with.

    Link: https://github.com/nasa/NASA-3D-Resources

    Top Resources For Distro Maintainers

    Top Resources For Distro Maintainers

    Distro Maintainer
    Distro Maintainers looking serious….

        There are great resources for a Linux distribution maintainer and here are a few of my favorite. Most sources are geared towards Ubuntu based systems but a few like the Themes and Window Managers links are more or less universal.

    Window Managers

    The first site deals with the plethora of window managers that are out there. XWinMan lists many managers ranging from session and full desktop managers to just the bare windows themselves. There are some that are deprecated so be weary; but, it still has many that are not!
                  Link:  http://www.xwinman.org/

    Source List Generator

    The next is a site that generates source list files for Ubuntu. This is really awesome for a number of reasons but the biggest for me is recovering from a bad dependency hell scenario. While it is rare, it is something that a maintainer and even a user needs to be aware of. Adding too many PPAs (which generally isn’t recommended) can cause loops and other strange and unexpected behavior from a package manager. In addition, the generator gives PPA info on a number of popular software this is not necessarily shipped with the system. It is well worth keeping in ones developer/user arsenal.
                  Link:  https://repogen.simplylinux.ch/index.php

    Themes

    This third link deals with themes, icons, backgrounds, etc. Who doesn’t like themes? Anyway, it has many of these to spruce up the system and make it less boring. I started using Gnome-Look early on in my Linux experience and it has yet to fail to find me something cool or aesthetically pleasing.
                  Link:  http://www.gnome-look.org/

    Debootstrap Versions

    This fourth link is geared towards building a Debian based distribution. Debootstrap is a great peace of software but needs the PPAs of the system it will setup in a subdirectory of ones system. This links provides the needed information.
                  Link:  http://packages.ubuntu.com/search?keywords=debootstrap&searchon=names&suite=all&section=all

    Ubuntu-Mini-Remix

    This fifth link goes to a website that has minified Ubuntu ISOs. These are phenomenal for creating new distributions from pretty much scratch. It isn’t LFS kinda scratch but it’s as close as it’s likely to get.
                  Link:  http://www.ubuntu-mini-remix.org/

    Chrooting in and building up is the best way to do this. I have a video of the steps too:

    Package List

    This last link is great for doing source compiling. This can be used to find the install name of a package when an error output doesn’t give much of a hint. I must admit I only just recently heard of this page after attempting to compile a installer package. Going to the IRC of the developer was where I learned of this. It’s a bit embarrassing for not having known of this given how long I’ve been using various *nix systems. Still, I guess the old adage, “you can’t teach an old dog new tricks”, is proven wrong.
                  Link:  http://packages.ubuntu.com/

    Quick Test Server

    Quick Test Server

    Server

        There are times when I need a server in order to test some feature or bit of code. I don’t like spooling up a Linux, Apache, Mysql, and PHP (LAMP) or Linux, Nginx, Mysql, and PHP (LEMP) stack because it’s tedious. Notice what I did there? I made the whole sentence tedious to get you to think it really is tedious. It really isn’t but frankly, I needed a reason to write this. Anyway, so, what is one to do? Well, there are two option that come to mind and those are Python, Php, or Netcat. One might ask, “Whaaat? Rly?” Yup. Really. All one needs to do is open up a terminal/cli and get ta hackin.

        Python call up the Python module SimpleHTTPServer using the switch -m and then give it a port. Make the port greater than 1024 since those are reserved and require root to use. BAM! Open your browser of poison and go to localhost:portNumber or 127.0.0.1:portNumber.

    Python Server

    python -m SimpleHTTPServer 1337
    

    I did not need to insert any index.html files to the directory. Python automatically gives a list of the directory contents when no index file is found. As a side note, Python doesn’t seem to read Php properly. I have yet to get it to work.

        For Php all one does is use the switch -S and then give it an address (127.0.0.1) and port. Again, make the port greater than 1024 since those are reserved and require root to use. BAM! Once more, open your browser of poison and go to localhost:portNumber or 127.0.0.1:portNumber.

    Php Server

    php -S 127.0.0.1:1337
    

    It is worth noting that with Php I had to insert an index.php file into the directory I ran the command from. It doesn’t generate any list but does throw an error when no index is found. Additionally, this method seems to only work with Php files. To test if the Php server works, simply insert in the index.php :

    <?php
        phpinfo();
    ?>
    

        For the last one we will look at Netcat. Netcat is the swiss army knife of the networking tools and has an interesting way of creating a kind of server. To start off, simply create a file called serve.sh. The name is arbitrary but that’s what we will use for this example. Then, in the file add

    Netcat Server

    #!/bin/bash
    
        echo "`cat index.html`"
    

    When this is done, simply create an index.html as you would any other. In my case, I did:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Google Link</title>
    </head>
    <body>
        <h1><a href="http://www.google.com">Google</a></h1>
    </body>
    </html>
    

    After all this prep, which isn’t much we simply run in the terminal where serve.sh and index.html is:

    while true; \
    do { \
        echo -e 'HTTP/1.1 200 OK\r\n'; sh serve.sh; \
    } | nc -l 1337; \
    done
    

    One might need to press enter again to actually run it because of the \’s stating “look to next line for rest of command”. One can also just remove the \’s and put the whole command like so:

    while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; sh serve.sh; } | nc -l 1337; done
    

    One can use Php with this by the way. All one does is rename index.html to index.php. Then one adds some code like in the Php example above. After that, in the serve.sh, edit the cat index.php to be php index.php. This has Php interpret the file which then has its output gets echoed back to the requester.
    All of this needs some explaining. So what is happening is that the while loop is checking to see if there is anything left to run. Note that the first part before the semicolon tells the browser that there is a server where one requested one. IE, it confirms the request. Then, the serve.sh is ran. In serve.sh it echos out what cat prints from index.html or what Php prints from index.php. This is essentially sent as the file back to the requester. Thus, we can see the h1 sized Google anchor link in this example.

        Voila! A nice juicy server is ready for use in any project that needs one. If one is adventurous, one can use these simple servers to serve files on the local network. To do this, all you have to do is allow the port to accept connections using UFW and then change the address “127.0.0.1” to “0.0.0.0”. This isn’t recommended for long term use but can be useful when needing to transfer something or using an app that’s for the local network. Even then, one might be better off just using ssh or email! Still, in those rare times, all one does is allow the port to be open by using ufw.

    ufw allow portNumber/tcp
    

    To remove the rule:

    ufw status numbered
    ufw delete "the number associated with ones portNumber"
    
    ITDominator’s Github Projects

    ITDominator’s Github Projects

    Github:
    Github Cat Image
        This is my Github account. I have accumulated a good number of programs and repositories over the years. Though, much of it has now been setup in an archive repository since I no longer support the code. The ones not in the archive are my active projects and represent my current skill level barring proper try/catch handling which I am too lazy to implement at this time. Otherwise, they are my projects to improve my coding skills.

        PS – Yes, not all (probably most) properly meet OOP standards. This is a personal choice since I don’t want to create a number of files just to have code split up properly. One controller file suits my needs just fine at this time. Though, one or two will eventually get refactored and setup to meet OOP standards.

    Redirect

    ITDominator’s Youtube Channel

    ITDominator’s Youtube Channel

    Youtube Channel:

        Linked is my Youtube Channel. At the inception of this post and following my need to switch accounts in order to unify my brand, I am pretty much back to zero subscribers. Starting new yet with more knowledge is invigorating and terrifying all at the same time. I hope you dear follower will find something useful or amusing from my humble collection of videos. I cover a lot but like to focus on C, C++, Java, JavaFX, Bash, Python, Blender, Gaming, and a whole lot of other topics.

    Redirect