How to Stop Facebook Sending Emails to You

I got tired of my googlemail inbox filling up with facebook emails. After some research, here is how i stopped them. Remember that i am writing this in nov.2013, so this may not work if Facebook change their tools.

1. Sign in to FB

2. Click photo to see larger view Picture 2

3. When you click EDIT this panel appears. Picture 3

4. Change this setting to ‘Only…’. If you see a SAVE button you should clikc that to confirm that’s what you want to do, then click close.

5. The other place you may need to adjust is in the ‘App Requests and Activity’ section at the bottom of the screen. I clicked that to reveal all the tools and apps that are loaded into my F/B account. A few of these apps were ones that i’d chosen, but most were not. So when you click ‘Apps…’ you should see the below. Your list will vary. Uncheck the check box after the apps you do NOT want to send you junk mail. If you see a SAVE button, you should click that to make it permanent. Then click close.
Picture 4

6. Do some F/B action that would cause an email to be sent, or get your friends to do so. Check the email address that belongs to your primary email a/c. Hopefully this should correct the problem.

7. If that does not stop them all, you may need to EDIT other Notification settings from step 2. Just uncheck them and hopefully stop them from sending you stuff. Good luck 🙂

Code Fragment Syntax Highlighter – Part Two

Read part one here : Syntax Highlighter Part One

Ok, here is a screen snippet of what our test2.html page looks like when rendered by a browser. Notice each color fragment has it’s code keywords colored according to the language of the fragment. Also note that the ‘Midnight’ theme is used for all code fragment displays. Click to grow.

Code Fragment Test Page
Code Fragment Test Page

Image of Example Folder Layout
Image of Example Folder Layout

Here is my test folder with a ‘styles’ sub-folder for the test2.html file. The HTML for our example test page follows. As Alex explains in his installation page, there are two approaches to markup of code fragments :

  1. Use the html <pre> tag
  2. Use the html <script> tag witha CDATA extension

Again, there are several javascript files we need to declare in our test2.html page. A core j/s file with overall logic plus three j/s brushes for the three code fragments, each in a different programming language.

For overall color control, five CSS files declare 1) the core colors 2) a theme default if no override theme has been chosen and 3) in this case we do use an overriding theme called ‘Midnight’. There are several other themes you can try.

Points to note in the following html document – both styles of highlighting are used. The <pre> element needs a class declaration for the brush (programming language) contained within the fragment. You can see class=’brush: groovy’ in the first fragment to color groovy keywords. The <script type=”syntaxhighlighter” class=”brush: js”><![CDATA[ declaration is the alternative approach to present code fragments. We can place any < or > characters within the CDATA of a script declaration otherwise if we use the pre approach, we need to manually change each < and > for their &lt; and &gt; equivalents.

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="no-js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link rel="stylesheet" href="./styles/shCore.css" type="text/css" />
<link rel="stylesheet" href="./styles/shCoreDefault.css" type="text/css" />
<link rel="stylesheet" href="./styles/shCoreMidnight.css" type="text/css" />
<link rel="stylesheet" href="./styles/shThemeDefault.css" type="text/css" />
<link rel="stylesheet" href="./styles/shThemeMidnight.css" type="text/css" />

<title>Technology Page To Check Muliple Column text Features</title>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type='text/javascript'></script>
<script type="text/javascript" src="./scripts/shCore.js"></script>
<script type="text/javascript" src="./scripts/shBrushJScript.js"></script>
<script type="text/javascript" src="./scripts/shBrushJava.js"></script>
<script type="text/javascript" src="./scripts/shBrushGroovy.js"></script>
</head>
<body >
<h2>Code Examples Using Midnight Theme</h2>
<div><h3>Groovy Code Fragment</h3>
<p>
<pre class='brush: groovy'>
println 'Hi kids'
def cats=[]
cats.each{cat -> println cat}
</pre>
</p></div>
<h3>Javascript Code Fragment</h3>
<p>
<script type="syntaxhighlighter" class="brush: js"><![CDATA[
var setArray = function(elems) {
this.length = 0;
push.apply(this, elems);
return this;
}
]]></script>
</p>

<h3>Java Code Fragment</h3>

<script type="syntaxhighlighter" class="brush: java"><![CDATA[
// require(url:'https://scripting.dev.java.net', jar:'groovy-engine.jar')
// this runs in groovy 1.8 using java 1.6 to run the script engine

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class CalcMain {
public static void main(String[] args) throws Exception {
System.out.println("Starting …");

ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("groovy");

// basic example
System.out.println(engine.eval("(1..10).sum()"));

// example showing scripting variables
engine.put("first", "HELLO");
engine.put("second", "world");
System.out.println(engine.eval("first.toLowerCase() + second.toUpperCase()"));
System.out.println("Ending ...");
}
}
]]></script>
</p>

<script type="text/javascript">
$(document).ready(function()
{
SyntaxHighlighter.highlight();
});
</script>
</body>
</html>

Finally, look at the bottom of the html to see how we invoke syntax highlighter. We can invoke it only after the page has loaded completely. Here is a nice use of JQuery as it has a convenient function of $(document).ready(); which is called upon page load completion. It’s a nice place to insert our call to fire up the highlighter engine. Copy the code above into a textfile named test2.html and then use your favorite browser to open this file. If you’ve done it all correctly, you’ll be rewarded with a display like the screen snippet shown at the top of this post.

It look quite a while to figure out all these bits and pieces. The website documentation is sparse hence a steep lerning curve. Hope this helps you a bit. 🙂

Code Fragment Syntax Highlighter

Writing a blog can be fun and possibly, for the reader, educational. As i enjoy technology, it satisfies a creative urge to write on discoveries i come across in the wonderful world of technology. Often this takes the form of developing code for various platforms in a variety of different languages. One problem i find in blogging platforms is the ability to format and display segments of software code in a pleasing fashion.This wordpress platform has several features to do so.

Part of WordPress Edit Page
Part of WordPress Edit Page

The html <pre> and <code> elements provide some scope for this. With these html tags, i can present fragments of code and script in several languages. The actual presentation of these elements can be marked up with additional CSS. This gives me a wider scope to show my findings in an appealing way.

Unfortunately, the wordpress blogging platform does not allow me to include javascript files and css markup files as free, stand-alone files. If i need that level of control, i resort to the HTML tab at the top of my editing page.

This leads me on to the subject of syntax highlight utilities. These utility modules offer a number of ways to improve the readability of code fragments. One module i’ve been learning is the Syntax Highlighter written by Alex Gorbatchev. He’s written this module in javascript and it did take me quite a while to learn how to use it.

Unzipped Layout of Syntax Highlighter Folders
Unzipped Layout of Syntax Highlighter Folders

Firstly, you can only use this tool when you are able to include your own CSS and javascript files into your blog or website. If you use wordpress on-line then you will not be able to do this. If you download and host wordpress on your own system, you might, but have not done so, therefore cannont comment.  The download page can be found here. A zip file will arrive with a filename that indicates the version of highlighter you’ve downloaded. Unzip that file in your preferred location and you should find several directories within the root directory of syntax highlighter.

Minimum List of Required Files in Blue
Minimum List of Required Files in Blue

Two folders hold the key components necessary to markup a web page or code fragment. The styles folder has the CSS files for markup and the scripts folder has javascript code to do the deed. Click the image right to view the minimum set of files needed to use syntax highlighting. There are two core files, one each for CSS and javascript. A second pair of files hold basic default values. The markup of code fragments can be controlled using themes and brushes.

Each programming language can have it’s keywords colored using the idea of brushes. Since i do a lot of work in the groovy programming language, the blue bars in the image right shows the shBrushGroovy.js javascript file that has logic to color my code fragments according to keywords of the groovy programming language.

Ok, let’s cover this again : the files we need to invoke syntax highlighting total a minimum of seven files.

Javascript :

  • shCore.js – the foundation logic for all syntax highlighting, written in javascript
  • shBrushGroovy.js – this javascript file has logic to color the keywords in groovy

CSS:

  • shCore.css – the foundation style markup for syntax highlighting
  • shCoreDefault.css – foundation coloring
  • shCoreMidnight.css – one of three theme support files, this theme is Midnight
  • shThemeDefault.css – a base theme with default values if no other theme chosen
  • shThemeMidnight.css – a color scheme for the shCoreMidnight.css theme

These files will need to be declared in your html page. See my example in next post. Here is a squint at the html markup for that example  page :

Minimum files needed to support syntax highlighting
Minimum files needed to support syntax highlighting

To Recap :

Code fragments can be colored according to the keywords of each language. The Syntax Highlighter of Alex supports keywords for at least 13 scripting and coding languages declared in ‘brush’ files. Brush files are written in javascript.  You will typically have at least one language-specific brush for a code fragment. This ‘brush’ will color the keywords.

A ‘theme’ will construct and color the overall look of our box containing the code fragment. A minimum of three core CSS files plus two theme-based CSS files apply a color scheme onto your code fragment, courtesy of  several files with javascript. the inclusion of jquery 1.6 is a convenience feature to activate syntax highlighter after our html page has finished loading.

IN part two, we’ll explore further requirements to make this all work.