http://www.stillbreathing.co.uk/2014/04/08/progressive-enhancement
This is the crux of progressive enhancement. Here’s the recipe:
Start with a basic web page that functions with nothing but the HTML, using standard semantic mark-up. Yes, it will require full-page GET or POST requests to perform actions, but we’re not going to stop there – we’re going to enhance the page.
Add CSS to style the page nicely; go to town with CSS3 animations if you want
Add JavaScript to enhance the UI and provide all the modern goodies: AJAX, client-side models, client-side validation etc
The benefits are obvious:
If the JavaScript or CSS files (or both) fail for any reason whatsoever the page still works
The use of semantic HTML means the page is fully understandable by search engine spiders
Because everything is rendered in HTML, not built up in JavaScript, it is understandable immediately by assistive devices
Serving fully-rendered HTML is quicker than building that same HTML client-side
Built-in support for older – and newer – browsers and devices
The best web developers on the planet all argue that progressive enhancement is the best way to approach web development. I honestly have no idea why anyone would think otherwise. There’s a good article (it’s actually the first chapter of Filament Group’s “Designing With Progressive Enhancement” book) on the case for progressive enhancement here.
Sunday, November 06, 2016
Tuesday, January 05, 2016
Obama on gun control
"We know we can't stop every act of violence, every act of evil in the world. But maybe we could try to stop one act of evil, one act of violence"
"We do have to feel a sense of urgency about it. In Dr King's words, we need to feel the fierce urgency of now, because people are dying," he said. "And the constant excuses for inaction no longer do."
"Yes, it will be hard. And it won't happen overnight. It won't happen during this Congress. It won't happen during my presidency," he said. "But a lot of things don't happen overnight. A woman's right to vote didn't happen overnight. The liberation of African-Americans didn't happen overnight. LGBT rights, that was decades worth of work."
- Barack Obama
"We do have to feel a sense of urgency about it. In Dr King's words, we need to feel the fierce urgency of now, because people are dying," he said. "And the constant excuses for inaction no longer do."
"Yes, it will be hard. And it won't happen overnight. It won't happen during this Congress. It won't happen during my presidency," he said. "But a lot of things don't happen overnight. A woman's right to vote didn't happen overnight. The liberation of African-Americans didn't happen overnight. LGBT rights, that was decades worth of work."
- Barack Obama
Wednesday, December 30, 2015
starting nodejs
a) express --sessions projectName
Create directory projectName with views, routes
b) cd projectName
c) npm install handlebars
d) npm install consolidate
Google for npm consolidate,
With reference to the example for express 3, modify app.js
e)
Create directory projectName with views, routes
b) cd projectName
c) npm install handlebars
d) npm install consolidate
Google for npm consolidate,
With reference to the example for express 3, modify app.js
e)
Mr Lee's final gift: One united people
"For those who say that Singaporeans are spoiled, selfish, always complaining and mercenary, what would they make of what's happening now: tens of thousands, soon-to-be hundreds, and possibly a million before the week is out, queueing for hours in the hot sun without a peep of disgruntlement. No one told them to do it. There are no freebies at the end of this queue. There are no goodie bags to be had, no fancy aerial displays, no ballot sheets to tick, no certificates of participation awaiting.
Yet there is nothing but stoic contemplation, a people united by sadness but at the same time, an amazing, totally unscripted display of goodwill and community. People are chipping in to help with free water, flowers, food and general kindness for one's fellow man. Without any expectations of reward or publicity - just plain human decency. "
-By Jaime Ee, The Business Times, 27 Mar 2015
Yet there is nothing but stoic contemplation, a people united by sadness but at the same time, an amazing, totally unscripted display of goodwill and community. People are chipping in to help with free water, flowers, food and general kindness for one's fellow man. Without any expectations of reward or publicity - just plain human decency. "
-By Jaime Ee, The Business Times, 27 Mar 2015
Thursday, January 15, 2015
select it!
select * from (
select 'lkj' name, 1 isSup, 0 isHse, 1 isMgr
union
select 'lky' name, 0 isSup, 0 isHse, 1 isMgr
union
select 'Jon' name, 0 isSup, 1 isHse, 0 isMgr
union
select 'Kim' name, 1 isSup, 0 isHse, 0 isMgr
) myTable
where isSup in (1) and isHse in (0,1) and isMgr in (0,1)
select row_number() over (partition by groupid order by date) r from test_table
select 'lkj' name, 1 isSup, 0 isHse, 1 isMgr
union
select 'lky' name, 0 isSup, 0 isHse, 1 isMgr
union
select 'Jon' name, 0 isSup, 1 isHse, 0 isMgr
union
select 'Kim' name, 1 isSup, 0 isHse, 0 isMgr
) myTable
where isSup in (1) and isHse in (0,1) and isMgr in (0,1)
select row_number() over (partition by groupid order by date) r from test_table
Tuesday, December 30, 2014
mysql group_concat
SET SESSION group_concat_max_len = 1000000;
SELECT
cast(
concat(
PCR_M.PCR_Year,
'-',
LPAD(PCR_M.PCR_Id,4,'0')
) as CHAR
) as PCR_Id,
PCR_M.PCR_Name,
PCR_M.PCR_SEV_Id as Severity,
(
select
group_concat(I.ITM_Name separator ", ")
from
LINK_PCR_ITEM ITM
join ITEM I
where
I.ITM_Id=ITM.ITM_Id and ITM.PCR_Year=PCR_M.PCR_Year and ITM.PCR_Id=PCR_M.PCR_Id group by 'ITM_Id'
) as CSCI,
(
select group_concat(
"[Start][",
(select USR_Name from USERS where PAN.PAN_Author=USR_Id),
"] [",
date_format(PAN.PAN_Modification_Date, "%Y%m%d %H:%i"),
"]\r\n",
PAN.PAN_Comment,
"\r\n[End][",
(select USR_Name from USERS where PAN.PAN_Author=USR_Id),
"] [",
date_format(PAN.PAN_Modification_Date, "%Y%m%d %H:%i"),
"]"
separator "\r\n\r\n"
)
from PCR_ANALYSIS PAN
where (PCR_M.PCR_Id=PAN.PCR_Id and PCR_M.PCR_Year=PAN.PCR_Year)
) as Analysis,
(
select group_concat(
"[Start][",
(select USR_Name from USERS where PCT.PCT_Author=USR_Id),
"] [",
date_format(PCT.PCT_Modification_Date, "%Y%m%d %H:%i"),
"]\r\n",
PCT.PCT_Comment,
"\r\n[End][",
(select USR_Name from USERS where PCT.PCT_Author=USR_Id),
"] [",
date_format(PCT.PCT_Modification_Date, "%Y%m%d %H:%i"),
"]"
separator "\r\n\r\n"
)
from PCR_CORRECTIVE PCT
where (PCR_M.PCR_Id=PCT.PCR_Id and PCR_M.PCR_Year=PCT.PCR_Year)
) as Corrective
from PCR_MAIN PCR_M;
SELECT
cast(
concat(
PCR_M.PCR_Year,
'-',
LPAD(PCR_M.PCR_Id,4,'0')
) as CHAR
) as PCR_Id,
PCR_M.PCR_Name,
PCR_M.PCR_SEV_Id as Severity,
(
select
group_concat(I.ITM_Name separator ", ")
from
LINK_PCR_ITEM ITM
join ITEM I
where
I.ITM_Id=ITM.ITM_Id and ITM.PCR_Year=PCR_M.PCR_Year and ITM.PCR_Id=PCR_M.PCR_Id group by 'ITM_Id'
) as CSCI,
(
select group_concat(
"[Start][",
(select USR_Name from USERS where PAN.PAN_Author=USR_Id),
"] [",
date_format(PAN.PAN_Modification_Date, "%Y%m%d %H:%i"),
"]\r\n",
PAN.PAN_Comment,
"\r\n[End][",
(select USR_Name from USERS where PAN.PAN_Author=USR_Id),
"] [",
date_format(PAN.PAN_Modification_Date, "%Y%m%d %H:%i"),
"]"
separator "\r\n\r\n"
)
from PCR_ANALYSIS PAN
where (PCR_M.PCR_Id=PAN.PCR_Id and PCR_M.PCR_Year=PAN.PCR_Year)
) as Analysis,
(
select group_concat(
"[Start][",
(select USR_Name from USERS where PCT.PCT_Author=USR_Id),
"] [",
date_format(PCT.PCT_Modification_Date, "%Y%m%d %H:%i"),
"]\r\n",
PCT.PCT_Comment,
"\r\n[End][",
(select USR_Name from USERS where PCT.PCT_Author=USR_Id),
"] [",
date_format(PCT.PCT_Modification_Date, "%Y%m%d %H:%i"),
"]"
separator "\r\n\r\n"
)
from PCR_CORRECTIVE PCT
where (PCR_M.PCR_Id=PCT.PCR_Id and PCR_M.PCR_Year=PCT.PCR_Year)
) as Corrective
from PCR_MAIN PCR_M;
Wednesday, June 04, 2014
Truncated Text SSRS display in IE 10
Reference URL: http://answers.microsoft.com/en-us/ie/forum/ie10-windows_7/ie-10-ssrs-report-viewer-issue-after-kb2888505/1e82a8b9-dea6-4351-90d3-7f4f47c4fb2a
<script> block:
<script> block:
try {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
document.getElementById("ReportViewerControl_fixedTable").style.tableLayout = '';
});
} catch(e) {
//ignore me alert("error");
}
Monday, March 31, 2014
Timeline plotting
Graphite
http://graphite.wikidot.com/
OpenTSDB
http://opentsdb.net/index.html
npm bucky-server
FLOT?
references
http://jedi.be/blog/2012/01/04/monitoring-wonderland-visualization/
http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitoring/
http://www.designyourway.net/drb/javascript-visualization-libraries-to-display-charts-and-graphs-34-items/
Sunday, March 16, 2014
Binary decoding with AWK
http://awk.info/?doc/bitmaps.html
function Bytes2Number( String, x, y, z, Number ) {
x = split( String, Scratch, "" )
Number = 0
for( y = 1; y <= x; y++ ) {
z = index( CharString, Scratch[ y ] ) -1
Number = Number + z * (256^(x - y))
}
return Number
}
BEGIN{
for( x = 0; x <= 255; x++ ) {
CharString = CharString sprintf( "%c", x )
FS= ""
RS = /ABC/
}
{ Width = Bytes2Number( $22 $21 $20 $19 )
Height = Bytes2Number( $26 $25 $24 $23 )
Data = Bytes2Number( $14 $13 $12 $11 )
Size = Bytes2Number( $6 $5 $4 $3 )
Depth = Bytes2Number( $30 $29 ) / 8
ImgSize = Bytes2Number( $38 $37 $36 $35 )
....
}
function Bytes2Number( String, x, y, z, Number ) {
x = split( String, Scratch, "" )
Number = 0
for( y = 1; y <= x; y++ ) {
z = index( CharString, Scratch[ y ] ) -1
Number = Number + z * (256^(x - y))
}
return Number
}
BEGIN{
for( x = 0; x <= 255; x++ ) {
CharString = CharString sprintf( "%c", x )
FS= ""
RS = /ABC/
}
{ Width = Bytes2Number( $22 $21 $20 $19 )
Height = Bytes2Number( $26 $25 $24 $23 )
Data = Bytes2Number( $14 $13 $12 $11 )
Size = Bytes2Number( $6 $5 $4 $3 )
Depth = Bytes2Number( $30 $29 ) / 8
ImgSize = Bytes2Number( $38 $37 $36 $35 )
....
}
Wednesday, February 19, 2014
Sharepoint - Registering apps using appregnew.aspx
http://yourSharePointServerName/_layouts/15/appregnew.aspx.
Thursday, December 19, 2013
Monday, December 16, 2013
node-mapnik on windows
1) Cleaning up mess
npm cache clean if encounter issues despite changes
2) binding.gyp
2a) From the dos command prompt, running npm install
set protobuf_src=
eg set protobuf_src=x:\progra~1\protobuf\src
set cairo_src=
eg set cairo_src=x:\progra~1\cairo\src
2b) Modifying binding.gyp in directory node-mapnik
from
'conditions': [
['OS=="win"', {
'variables': {
'PROTOBUF_INCLUDES%':'C:/dev2/protobuf/vsprojects/include',
'PROTOBUF_LIBS%':'C:/dev2/protobuf/vsprojects/Release',
'PROTOBUF_LIBRARY%':'libprotobuf-lite.lib',
to
'conditions': [
['OS=="win"', {
'variables': {
'CAIRO_INCLUDES%':'$(CAIRO_SRC)',
'PROTOBUF_INCLUDES%':'$(PROTOBUF_SRC)',
'PROTOBUF_LIBS%':'$(PROTOBUF_SRC)/../vsprojects/Release',
['OS=="win"', {
'include_dirs':[
'<!@(mapnik-config --includes)',
'<!@(mapnik-config --dep-includes)',
'<@(PROTOBUF_INCLUDES)',
'<@(CAIRO_INCLUDES)'
],
3) As advised in binding.gyp, make changes to .node-gyp\*\common.gypi under user directory
xp - c:\documents and settings\username\...
win7 - c:\users\username\...
see https://groups.google.com/forum/?fromgroups=#!topic/gyp-developer/p98GJxYJuH4
see https://github.com/TooTallNate/node-gyp/issues/26
4) Testing
npm install -g mocha
npm install sphericalmercator
Grab a copy of GDAL for windows from http://www.gisinternals.com/sdk/
sdkshell.bat to set the environment for
4a) PROJ_LIB
4b) GDAL_DATA
mocha -R spec to list details
npm cache clean if encounter issues despite changes
2) binding.gyp
2a) From the dos command prompt, running npm install
set protobuf_src=
eg set protobuf_src=x:\progra~1\protobuf\src
set cairo_src=
eg set cairo_src=x:\progra~1\cairo\src
2b) Modifying binding.gyp in directory node-mapnik
from
'conditions': [
['OS=="win"', {
'variables': {
'PROTOBUF_INCLUDES%':'C:/dev2/protobuf/vsprojects/include',
'PROTOBUF_LIBS%':'C:/dev2/protobuf/vsprojects/Release',
'PROTOBUF_LIBRARY%':'libprotobuf-lite.lib',
to
'conditions': [
['OS=="win"', {
'variables': {
'CAIRO_INCLUDES%':'$(CAIRO_SRC)',
'PROTOBUF_INCLUDES%':'$(PROTOBUF_SRC)',
'PROTOBUF_LIBS%':'$(PROTOBUF_SRC)/../vsprojects/Release',
'PROTOBUF_LIBRARY%':'libprotobuf-lite.lib',
2c) from
'conditions': [
['OS=="win"', {
'include_dirs':[
'<!@(mapnik-config --includes)',
'<!@(mapnik-config --dep-includes)',
'<@(PROTOBUF_INCLUDES)'
],
to
'conditions': [['OS=="win"', {
'include_dirs':[
'<!@(mapnik-config --includes)',
'<!@(mapnik-config --dep-includes)',
'<@(PROTOBUF_INCLUDES)',
'<@(CAIRO_INCLUDES)'
],
3) As advised in binding.gyp, make changes to .node-gyp\*\common.gypi under user directory
xp - c:\documents and settings\username\...
win7 - c:\users\username\...
see https://groups.google.com/forum/?fromgroups=#!topic/gyp-developer/p98GJxYJuH4
see https://github.com/TooTallNate/node-gyp/issues/26
4) Testing
npm install -g mocha
npm install sphericalmercator
Grab a copy of GDAL for windows from http://www.gisinternals.com/sdk/
sdkshell.bat to set the environment for
4a) PROJ_LIB
4b) GDAL_DATA
mocha -R spec to list details
Thursday, December 12, 2013
node-gyp on windows
For node-gyp command, see *.js in the directory nodejs\node_modules\npm\node_modules\node-gyp\lib
Prerequisite
a) Visual Studio
b) Windows SDK
c) Visual Studio SP1
d) C++ 2010 SP1 compiler update
See https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
See http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
Prerequisite
a) Visual Studio
b) Windows SDK
c) Visual Studio SP1
d) C++ 2010 SP1 compiler update
See https://github.com/TooTallNate/node-gyp/wiki/Visual-Studio-2010-Setup
See http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
Monday, September 09, 2013
Pay-it-forward
Decades of sustained, methodical development of Singapore’s water policies has its many players, from multi-national corporations to international organisations, all of whom have performed a crucial role. During the dialogue, Mr Lee acknowledged their contributions, and in a pay-it-forward move, Singapore now wants to share its expertise with other countries facing water shortages.
"We did not do this by ourselves. We climbed on other people’s shoulders. We brought this [technology] together and improved on them. We’re happy to have people climb on our shoulders, whether they are from the Middle East, China, India, whatever. It’s a collaborative effort. The world will need this because what we have assumed was limitless — endless supplies of water — is not so. We’ve found it not to be so, and that we’ve got a way out of it.” -MM Lee
"We did not do this by ourselves. We climbed on other people’s shoulders. We brought this [technology] together and improved on them. We’re happy to have people climb on our shoulders, whether they are from the Middle East, China, India, whatever. It’s a collaborative effort. The world will need this because what we have assumed was limitless — endless supplies of water — is not so. We’ve found it not to be so, and that we’ve got a way out of it.” -MM Lee
C++ build environment for mapnik project on Windows
C/C++ General
\mapnik\mapnik-v2.2.0\include;\mapnik\mapnik-v2.2.0\include\mapnik\agg;.;%(AdditionalIncludeDirectories)
C/C++ Preprocessor
LINUX;_WINDOWS;HAVE_JPEG;HAVE_PNG;HAVE_TIFF;MAPNIK_USE_PROJ4;BOOST_REGEX_HAS_ICU;MAPNIK_THREADSAFE;BIGINT;HAVE_LIBXML2;HAVE_CAIRO;%(PreprocessorDefinitions)
Linker General
Additional Library Directories \mapnik\mapnik-v2.2.0\lib
Linker Input
mapnik.lib;icuuc.lib;icuin.lib;cairo.lib;libboost_system-vc100-mt-1_49.lib
main include
#include "mapnik/layer.hpp"
#include "mapnik/rule.hpp"
#include "mapnik/line_symbolizer.hpp"
#include "mapnik/polygon_symbolizer.hpp"
#include "mapnik/text_symbolizer.hpp"
#include "mapnik/feature_type_style.hpp"
#include "mapnik/graphics.hpp"
#include "mapnik/datasource_cache.hpp"
#include "mapnik/font_engine_freetype.hpp"
#include "mapnik/agg_renderer.hpp"
#include "mapnik/expression.hpp"
#include "mapnik/color_factory.hpp"
#include "mapnik/image_util.hpp"
#if defined(HAVE_CAIRO)
#include "mapnik/cairo_renderer.hpp"
#include "mapnik/cairo_context.hpp"
#endif
#include <iostream>
Remarks:
Build with
C/C++ Code Generation>Basic Runtime Checks>Default
C/C++ Code Generation>Runtime Library>Multi-threaded DLL (/MD)
If you attempt to build with C/C++ Code Generation>Runtime Library>Multi-threaded Debug DLL (/MDd)
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_49.lib'
\mapnik\mapnik-v2.2.0\include;\mapnik\mapnik-v2.2.0\include\mapnik\agg;.;%(AdditionalIncludeDirectories)
C/C++ Preprocessor
LINUX;_WINDOWS;HAVE_JPEG;HAVE_PNG;HAVE_TIFF;MAPNIK_USE_PROJ4;BOOST_REGEX_HAS_ICU;MAPNIK_THREADSAFE;BIGINT;HAVE_LIBXML2;HAVE_CAIRO;%(PreprocessorDefinitions)
Linker General
Additional Library Directories \mapnik\mapnik-v2.2.0\lib
Linker Input
mapnik.lib;icuuc.lib;icuin.lib;cairo.lib;libboost_system-vc100-mt-1_49.lib
main include
#include "mapnik/layer.hpp"
#include "mapnik/rule.hpp"
#include "mapnik/line_symbolizer.hpp"
#include "mapnik/polygon_symbolizer.hpp"
#include "mapnik/text_symbolizer.hpp"
#include "mapnik/feature_type_style.hpp"
#include "mapnik/graphics.hpp"
#include "mapnik/datasource_cache.hpp"
#include "mapnik/font_engine_freetype.hpp"
#include "mapnik/agg_renderer.hpp"
#include "mapnik/expression.hpp"
#include "mapnik/color_factory.hpp"
#include "mapnik/image_util.hpp"
#if defined(HAVE_CAIRO)
#include "mapnik/cairo_renderer.hpp"
#include "mapnik/cairo_context.hpp"
#endif
#include <iostream>
Remarks:
Build with
C/C++ Code Generation>Basic Runtime Checks>Default
C/C++ Code Generation>Runtime Library>Multi-threaded DLL (/MD)
If you attempt to build with C/C++ Code Generation>Runtime Library>Multi-threaded Debug DLL (/MDd)
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_49.lib'
Sunday, August 18, 2013
Changing someone
“But we have each come to the understanding that there is no need to try to influence the other to your own point of view. We cannot change them. They cannot change us,” -Former MM Lee
Monday, April 08, 2013
log4cxx debugging
Add debug="true" to enable debugging
example:
log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' debug="true"\
QML extension
1. QML2_IMPORT_PATH is necessary for QML dll
example
set QML2_IMPORT_PATH=d:\qt\imports
2.uri
From the QML2_IMPORT_PATH, the uri comes into play
with a uri of qml.test (case sensitive),
the directory structure shall be %QML2_IMPORT_PATH%\qml\test
3.qmldir
Under the directory %QML2_IMPORT_PATH%\qml\test,
you shall have qmldir,
where the bare minimum configuration contains
plugin yourDllPluginName
optional
module uri
4.qmlpluginsdump
qmlpluginsdump will
first look at QML2_IMPORT_PATH
then the uri
The following command shall dump some values
qmlpluginsdump qml.test 1.0
5.qmltypes
Generate qmltypes with qmlpluginsdump
qmlpluginsdump qml.test 1.0 d:\qt\imports\ > d:\qt\imports\qml\test\dllname.qmltypes
6. Append typeinfo logger.qmltypes to qmldir
Title case for module name is a must to work -
Need to use Logger instead of logger for qmlRegisterType(uri, 1, 0, "logger");
example
set QML2_IMPORT_PATH=d:\qt\imports
2.uri
From the QML2_IMPORT_PATH, the uri comes into play
with a uri of qml.test (case sensitive),
the directory structure shall be %QML2_IMPORT_PATH%\qml\test
3.qmldir
Under the directory %QML2_IMPORT_PATH%\qml\test,
you shall have qmldir,
where the bare minimum configuration contains
plugin yourDllPluginName
optional
module uri
4.qmlpluginsdump
qmlpluginsdump will
first look at QML2_IMPORT_PATH
then the uri
The following command shall dump some values
qmlpluginsdump qml.test 1.0
5.qmltypes
Generate qmltypes with qmlpluginsdump
qmlpluginsdump qml.test 1.0 d:\qt\imports\ > d:\qt\imports\qml\test\dllname.qmltypes
6. Append typeinfo logger.qmltypes to qmldir
Title case for module name is a must to work -
Need to use Logger instead of logger for qmlRegisterType
Subscribe to:
Posts (Atom)