CSS Rule Sets (valid syntax) & Selectors

What is a CSS Rule

A CSS Rule is a rule which states how an element or tag will look or should look. Using a valid syntax the rule can be applied to a single element or tag or many elements or tags.

CSS Selectors are case sensitive, so they must match element names and attribute values exactly.

CSS Rules Break Down

//Selector
P {
     color: blue;      //Declaration 1
     font-size: 14px;  //Declaration 2
}
Note - The declaration block is defined by the "{}".  Declarations are always placed inside the curly braces and you can place as many declarations as you would like inside of the curly braces.

Selector - selects the element or tag that the CSS rule will style.
Declaration  - defines the style to be applied (the look).
Declaration syntax - declarations are always defined by a declaration block  :  declaration value ;

The colon is the separator between the property or declaration name and the value.
The semicolon defines the end of the declaration. 

Different Types of Selectors

Selector TypeDescriptionExample
Universal SelectorApplies to all elements in the document* {} targets all elements on the page
Type SelectorMatches Elements Namesh1, h2, h3 {} Targets the elements <h1>, <h2><h3> at the same time.
Class SelectorMatches an element whose class attribute value is the same one after the period..test{} Targets any element whos class value = target.
ol.test{} Targets only order lists whose class value is test.
ID SelectorMatches an element whos id attribute value matches the one after the pound or hash symbol#complete {} Matches any element or tag with an id that has a value of complete or id=”complete”
Child SelectorMatches any element who has a direct child of anotherP > a {} Matches any anchor tag that is a direct child of a paragraph.
Descendant SelectorMatches an element or tag that is a descendent of another specified element.P a {} Targets any anchor tag that sits inside of a paragraph element no matter how deep into the paragraph.
Adjacent Sibling SelectorMatches an element that is the next sibling of anotherh4 + p {} Matches any paragraph directly after the h4 but not other paragraphs
General Sibling SelectorMatches a element that is a sibling of another but doesn’t have to directly afterh4 ~p {} Matches any paragraphs that are siblings of an h4.
Selector Types Explained

HTML & CSS Best Practice, Reusability, and Accessibility

The information below is here for those students who might need some additional documentation on this topic.

  • Reusing code helps to minimize syntax errors.
  • Webpages that include style sheets should be tested on multiple browsers (all website development should be tested on all browsers prior to going live).
  • When designing a webpage, multiple fonts should be used just in case some device is unable to display the font.
  • Well known fonts tend to be the most readable fonts on a web page.
  • Fonts that are declared with ems are always resizable (ems is a relative unit of measurement).
  • Not all browsers uniformly support all CSS declarations.
  • The webkit prefix on a CSS declaration indicates something specific to Safari and Chrome.
  • What is a CSS framework?
  • Names of CSS Frameworks (Bootstrap, Skeleton, Bulma…).
  • What is the purpose of the area element? Click here
  • What is the purpose of the map element? Click here.
  • Accessibility using tabindex=1

Java Classes & Objects

What is a class?

A class is a template that you build. From it, you will stamp out objects based on that class. In other words, think of a class as a blueprint for an object.

What is an object?

An object is something that you get from a class, sounds redundant doesn’t it? No, seriously. Think of an object like this. In your cell phone, you will have contacts. Each contact will have a name, email, phone number, address as an example. A class will be the template you fill out and create an object with that specific information. Each contact that you create will be like creating an object from the contacts class.

What are object instance variables?

Instance variables are variables of an object (the data or fields). For example, if you had a contact (from your phone remember?) object, it would be things like name, address, phone, and email. When you create a contact object from the class object, each object will have those fields. However, those fields will be different for each object based on your contact. Those fields are considered instance variables.

An object created from a class showing its instance variables.

What is a dot operator (.)?

The dot operator allows you to access the instance variables of an object as well as the methods. Using our “contact” example, we can get access directly to the instance variables by using the “.” dot operator like so.

//Make a new object from the Contact class.
Contact c = new Contact();

//Access the instance variables from the Contact object.
c.name     = "Ricardo Rodriguez";
c.email    = "rick@rickrodriguezjr.com";
c.address  = "5012 sw 23st";
c.number    = "5849898";

What are object methods?

Methods are an objects ability to do things. When you create a class, you will need that class to have a way to manipulate the data for the objects the class will create. Using our contact object as an example, our contact class will create a contact object. The contact object will have instance variables such as address, name email, and number. However, how do we collect that data or validate that data, or access that data if we don’t have direct access to the instance variables? We do it via object methods. Those methods are the ones that operate or interact with the instance variables.

It is common in Java that methods read or write data to instance variables without having access to the actual instance variables themselves (encapsulation, later I will explain).

//Create a new object
Contact c = new Contact();

//Create the variables to pass into the methods.
String name = "Ricardo Rodriguez";
String email = "rickrod99@gmail.com";
String address = "5012 sw 23 st";
String number = "5849898";


//Access the methods of the object

//Gets the name value
c.getName();
//Sets the name value
c.setName(String n);
//Gets the address value
c.getAddress();
//Sets the address value.
c.setAddress(String a);
//Gets the email address
c.getEmail();
//Sets the email value
c.setEmail(String e);
//Gets the number value
c.getNumber();
//Sets the number value
c.setNumber(String n);

Different Types Of CSS Stylings

Analyze and Implement Stylings

Inline Styling

Inline styling is a CSS styling type that is defined with the style attribute.   Each value is separated from the next by a semicolon.  
This type of styling is considered inline because it is always placed inside the opening tag of an element.  
It is also considered element level styling.
Has the highest precedence of any styling type.
<p style="font-weight: bold; color:red;">Some Content</p>

Internal Styling

Internal styling - is styling that is considered to be page level styling.
It is always defined by using the <style></style> element in the head of the document.
All CSS rules should be placed between those two tags.
It has the second highest precedence only overriding external styling.
Example
<!doctype html>
<html>
       <head>
              <style>
                     //Internal styling
                     P { color:blue; }
              </style>
       </head>
       <body>
       </body>
</html> 

External Styling

External styling - it is considered site level styling.  This styling is the separation of HTML and CSS.  External styling is best practice when using CSS.  
It is always defined by using the <link> tag to point to an external file of some kind.  The "rel" attribute defines the relationship between the HTML file and the external file.  Additionally, the "href" attribute points to the location of the external file.  In this case, the link tag will be placed in the head of the document.  
Example
<!doctype html>
<html>
       <head>
              <link rel="stylesheet" href="style.css">
       </head>
       <body>
       </body>
</html> 

CSS Precedence

The term precedence is defined as being more important than someone or something else.
In HTML & CSS, stylings do have precedence over one another.
Below is a list of order of precedence:

           1. Inline Styling - has the most precedence and it will overwrite any conflict with any other style always.
           2. Internal styling - has the second most precedence and can overwrite external styling but not inline styling.
           3. External styling - has no precedence and cannot overwrite any other styling type.

As mentioned earlier, external styling is best practice when styling a website.  In private industry, you should always use external styling, and should never comingle two or three of the different styles.   However, for the purpose of a industry certification exam, you can use one or all three styling types at once.

Resolving CSS Conflicts with Precedence

The code below is a basic example of a conflict between inline styling and internal styling.  Notice how the paragraph element has inline styling trying to set the font size of that paragraph to 10 pixels in size.  However, the internal styling is also trying to set the paragraphs to a font size of 14 pixels.  Will the paragraph element make the font size 10 pixels or 14 pixels?  

The paragraph element will make the font size 10 pixels because inline styling overrides internal styling due to its precedence.  

HTML & CSS Well-formed Markup Pages

HTML FUNDAMENTALS

Construct well-formed page markup

Doctype -tag This tag provides information to the browser on what kind of document to expect.
This tag is always the first tag in any HTML document.
(DOCTYPE is not case sensitive and can be written in multiple ways)
<!DOCTYPE html>
HTML element or tag - is the root of the HTML page and is considered a container for all other HTML content in an HTML page.  In other words, HTML holds all other tags and elements on a page.
<html>
</html>
Head element or tags - This is a container for metadata (Metadata - information about information). 
It is always located just above the body element.
You can find such other elements in the head such as title, and link tags.
<head>

</head>
Body - This element or tags define the body of an HTML page.
All HTML elements and tags will have to be defined inside the body's opening and closing tag.
Every HTML page should have the same basic structure and should include the following elements or tags.
Example:
<!doctype html>
<html lang="english">
       <head>
       </head>

       <body>
       </body>
</html>

HTML & CSS Metadata Elements

HTML Fundamentals

Constructing Markup That Uses Metadata Elements

Script Tag - Used to define where Javascript should be placed
Can be used to point to external files where Javascript may be placed using the src attribute.
Note: Typically located in the head of document.
<script>
alert("Hello world!");
</script>
No script tag - used to display other content to users who have either disabled their Javascript or their Javascript is out of date.
Typically located in the head of the document.
<noscript>Your browser is out of date.</noscript>
Style tags - Used to define CSS for an HTML page.
Typically used when creating Internal CSS.
This tag must be placed in the head of the document.
<style>
P { background-color: blue; }
</style>
Link tag - this tag is used to show the relationship between one file and another.  In most cases, you can use the link tag to point to an external CSS file.  However, it can also be used to link an HTML file and a Javascript file.
This tag doesn't contain any content.  It only contains attributes.
rel attribute - defines the relationship between the current file and the external file.
href attribute - defines where the file is located.
<link rel="relationship" href="style.css">
Meta tags - tags that provide information about the webpage.
These tags are always located inside the head of the document.
These tags do not get displayed on the web page.
Metatags are only used by search engines, and developers.
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="description" content="Mr. Rodriguez Blog">
<meta name="author" content="Ricardo Rodriguez">
<meta http-equiv="refresh" content="30">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Creating & Installing SSL Certificate on Apache

Purchase a Certificate

If you are interested in securing your site, and you are the administrator for the site, follow these steps.  These steps are for creating and installing an SSL certificate on a Apache server.  However, on other web servers it will be similar but I recommend looking for other documentation.

One can purchase an SSL certificate from any SSL provider.  I purchased a certificate from a site called Cheap SSL Certificates.  Yes, they were the cheapest.  You can visit them by going to Cheap SSL Certificates.  Each certificate is $6.98 per year or you can pay for three years and it works out roughly to about $4.00 a year.

HINT: Cheap SSL Certificates also provide chat support for a total of $5.00.  Very reasonable and they did provide great support if you are not sure how to configure the certificates.
  1. Create an account with your SSL provider (
    Cheapsslsecurity.com  purchase a certificate
    cheapsslsecurity.com

     

    cheapsslsecurity.com).  

PRODUCTS

Look at their products, and you should see a list of the various certificates available.  I purchased a regular domain certificate for one subdomain.  This will only work for one subdomain.  You will need to purchase more certificates if you have multiple subdomains.  SSL CertificatesAnother option is to purchase a wild card certificate.

PURCHASE

Once purchased, you will have to generate your CSR certificate.  CSR stands for Certificate Signing Request, which is a certificate that you will generate from your server.  You can also be able to use the web based CSR generation tool.  This tool will ask you details about the administrator to the site.  

GENERATE CSR

Generate the certificate through the sellers CSR web based generation tool.

Web Based CSR Generator
Generate CSR

A copy of the CSR Request should be placed in a file called subdomain.domain.com.csr, and download the private key, which should go in a file called subdomain.domain.com.key.   

Alternatively, you can use the Openssl command generated by the CSR generation tool use on your command line on your server:

openssl req -new -newkey rsa:2048 -sha256 -nodes -out sub.domain.com.csr -keyout sub.domain.com.key -subj "/C=US/ST=Florida/L=Plantation/OU=Ricks Blog/CN=sub.domain.com"

This will reflect your domain settings. Running this command will generate two files, your CSR and your Key.You will not have to create your certificate from the seller.  Enter your content or CSR value into the sellers interface to generate the certificate.  

VALIDATE CERTIFICATE

You will need to validate the certificate, one way to do it is by creating a TXT record through your DNS host.  I use Godaddy, so you can manage your DNS and create a TXT file with the hash code provided by your SSL seller.  It might take up to an hour to update the DNS.  Once this is done you will be able to validate that you are the owner of the domain.

DNS TXT File for
DNS TXT file for validation

 

SSL Seller Zip Content
Certificate File Download and Needed Files.

Once it has been validated, you can download your certificate.  You will get multiple files in a zip file.  The content will look like this: 

Copy the contents from the www_domain_com file into your csr file.

Place a copy of the My_CA_Bundle file in your directory where your certificates will be.

For Permissions and ownerships of the files, please see the section at the bottom.

PERMISSIONS

You should change the ownership of these files to whatever user runs your webserver.  In my case its apache.  For example, you can change the file permissions with 
chown apache:apache file

Also, your file permissions should be 600 for both.
chmod 600 filename

CONFIGUERING APACHE

Whether you use your virtualhost file or your httpd.conf file to configure your apache webserver is up to you and how you have configured your server. Here are the basics.

#SSL STUFF...
      SSLEngine on
      SSLCertificateFile /etc/apache2/crts/mysite.crt
      SSLCertificateKeyFile /etc/apache2/crts/mysite.key
      SSLCertificateChainFile /etc/apache2/crts/DigiCertCA.crt
  • SSLCertificateFile – point to the location of your crt file.
  • SSLCertificateKeyFile – will point to your key file.
  • SSLCertificateChainFile should point to the file you received from the download from your SSL seller.

If you need further information on how to configure your Apache web server, you the following link. https://www.digicert.com/kb/csr-ssl-installation/apache-openssl.htm

Java Primitive Data Type Values

Data types for java
Data Types in Java

Primitive Values

What are primitive values? They are considered the most basic data types in Java.

Java Data Types

  • Here is the list of primitive values:
    • byte – a number between -128 to 128
    • short – 16 bit with a range of -32768 to 32768
    • integer – 32 bit whole number. Range -2147483648 to 2147483647
    • long – 64 bit number with a range of
      -9223372036854775808 to 9223372036854775807
    • double – a decimal point value with a range of 64 bit
      4.94065645841246544e-324 to 1.79769313486231570e+308
    • float – is a 32 bit value 1.40239846e-45f to 3.40282347e+38f
    • boolean – has only two possible values which are true and false.
    • char – a single 16 bit Unicode character with a minimum value of ‘\u0000’ or a maximum value of ‘\uffff’ (65,535 inclusive).d

Java programming is considered to be a statically typed language. This means that all variables must be declared according to their size before they can be used.

Think of it as if someone asked you to carry 2 ounces of water around a house and on one hand you have a cup that holds 6 ounces that is empty and another that holds 24 ounces. It would seem a waste of space and weight to carry 2 ounces of water in a 24 ounces cup when you can use a 6 ounce cup just fine to carry the 2 ounces of water. Using the 24 ounce cup of water to carry 2 ounces of water is a waste of resources. This is the same concept when declaring a variable in Java; you must be mindful of the value your container will hold. We need to make sure that the container is appropriate in size to hold the value, but at the same time the container itself is not too large where we are wasting resources.

For example: int i = 0;

By doing this, you ensure that the program stores the data needed in a appropriate container. A variables data type will determine the type of container that Java will allocate for storing your data.

Examples

Here are some examples of usage of primitive types.

boolean answer = true;

char characterV = ‘c’;

byte b = 127;

short s = 30000;

int i = 210000;

double d1 = 3.23

float f1 = 124.12f;

If you are interested in practicing some data types, click here.

If you would like to contact me, please go to http://www.rickrodriguezjr.com/contactme.html

Hashtags and why they are important to understand

Basic Understanding of Hashtags

Introduction

This article is about explaining how a hashtag helps to organize and index content for social media. I felt compelled to do this because I feel like the younger generation might understand that it is important to use hashtags, but I don’t believe they really understand why and what is happening behind the scenes. Just recently I was at a training, and most of the people were fairly young, at least younger than me, but most did not understand the significance or how a hashtag works. So if you want to know why hashtags are important to use and how they work, this is the article for you.

What is a hashtag?

The hashtag has been around before the telephone was invented. The symbol, “#” was known as a pound. For a very long time, we knew the symbol as a pound and nothing else. Today some people still know it as a pound, but most folks know it as a hashtag, especially when it is associated with social media. So, what does a hashtag do? Really, a hashtag helps to organize or group content on social media or any other site that needs some type of data organization by using a word or words together proceeded by a pound sign (hashtag).

There are many reasons why you would want to use hashtags and how you should use them on different social media sites. However, this is not the article for that. If you need more information, I recommend reading the article entitled, “How to use hashtags in social media.”

What an actual hashtag does.

The main purpose of this article is to understand what the hashtag does. As we mentioned before, a hash tag is nothing more than a keyword. How do these keywords group and organize content? In the most simple way, each time you create some content and associate a hashtag with it, the word with the hashtag (keyword) is being put in one table in a database, and the content that is being associated with it is being placed in another table. This creates between two tables in a database relationship knowns as one to many relationship. This relationship is what helps to index content. By searching for that keyword, in turn that keyword will give you the results of all the content it points to. For example, if you posted three posts to a social media site, and used the hashtag #owner, then every end user who searches for the keyword “owner”, the results will be the posts that are linked to that keyword. Hashtags are important as they help to organize and group content for simpler searching.

References used on this article

https://digitalmarketinginstitute.com/blog/how-to-use-hashtags-in-social-media#heading_38454

https://iamyogesh.medium.com/what-is-the-best-approach-to-store-hashtags-in-a-database-caa796d714d4

Adobe InDesign CC Vocabulary For Students

InDesign CC Vocabulary

These are important words that we use in our InDesign classes. These words help students further understand the InDesign curriculum.

Character style – is a collection of formatting attributes that can be applied to text that already has a paragraph style applied to it.

Paragraph style – includes both characters and paragraph formatting attributes, and can be applied to a selected paragraph or range of paragraphs.

Object styles – includes settings for stroke, color, transparency, drop shadows, paragraph styles, text-wrap, and more; you can also assign different transparency effects for the object, fill, stroke, and text.

Hidden characters – these are non-printing characters that display spaces, tabs, ends of paragraphs, index markers, and ends of stories. These special characters are visible only in a document window on the screen and can be toggled on or off in the Type menu.

Overset symbol – is a red plus sign that indicates that there is more content than the frame can display.

Threading text – the process of creating linked text frames. This will allow the flow of text from one text frame to the next.

Emphasis – provides direction to various elements in a given design.

Focal point – a component size, shape, color, or position making it the most important element on the page.

Rule of thirds – it is when dividing an image into thirds.

Harmony – a design where elements balance each other.

Working with clients and what to consider:

Listen to the client.

  • Know the market design.
  • What is needed for the job.
  • Know the budget for the project.

Thumbnails – sketched variations of an idea.

Roughs – a combination of specific elements from each thumbnail.

Comp- show exactly what the final design will look like when printed.

Print proof – used to show indications for folding, cutting, bleeding, trapping, registration or any special requirements for print.

Typography – the study and use of text in a document.

Fair Use Act – a part of the US Copyright law that indicates that excerpts of copyrighted materials may be used under certain circumstances such as news reports, teaching, and research.

Derivative work – it is any work based on one or more works that already exist.

Specifications – refers to a set of documents requirements to be satisfied by a material, design, product, or service.

Export – the act of sending or transferring a saved database or element to another application or location.

Gif – Graphic Interchange format (GIF) is a common image file format that has the ability to have frames used in animation.

Graphic – a broad term used to explain objects placed in Indesign such as images.

Hue – a color principle that refers to pure color.

Copyright – a form of protection provided by the laws of the US to authors of ‘original works of authorship’, including, literary, dramatic, musical, artistic, and certain other intellectual works.

Hyperlink – an element on a page that links to another page, webpage, or area on the same page.

Concordant – a typeface that doesn’t have much variety in weight, style, or size.

DPI – Dots Per Inch – refers to the output resolution of a printer or imagesetter.

Process color – is printing using the four standard ink colors; CMYK.

Scaling – is a word that means stretching or shrinking the image to fit a specified area.

Button state – the appearance change of a button when it interacts with a mouse or some other clickable device.

Pixel – so it is the smallest controllable element of a picture represented on the screen.

Cropping – removes certain parts of an image to get a new width and height.

Resampling – changes the number of pixels in an image.

Resizing – resizes or decreases the number of pixels in an image.

Project scope – The work performed to deliver a product, service, or result with the specified features and functions.

Scope – establishes client expectations of which tasks are—and are not—included in the project.

Contrast – This term refers to the differences between design elements, which include color, shape, and scale.

Tint – This color term is created by adding white to a hue.

Shade – This color term is created by adding black to a hue.

White space – This term is sometimes a by-product of proximity, organization, or simplicity.

Baseline shift – a formatting option that moves selected characters above or below the baseline of normal text.

Bounding box – An area that defines the outer border of an object.

Clipboard – The portion of computer memory that holds data that has been cut or copied.

EPS – Encapsulated PostScript – File format used to transfer PostScript data within compatible applications. EPS files can contain text, vector artwork, and images.

Vector graphics – Graphics defined using coordinate points and mathematically drawn lines and curves, which may be freely scaled and rotated without image degradation in the final output.

Typesetting – the arrangement of individual characters of text into words, sentences, or paragraphs.

Trademark – A legal designation that identifies and protects the ownership of a specific device (such as a name, symbol, or mark).

Script font – Typefaces that appear to have been created with a pen or a brush, whether the letters are connected or unconnected.