Showing posts with label Damned Defaults. Show all posts
Showing posts with label Damned Defaults. Show all posts

Monday, January 3, 2011

Monday, October 11, 2010

VS2010 Web Development (Code Only) Profile.

1. Java Script validation is turned off
2. HTML validation is turned off

I do not know what MS calls web development,
but for me it is JS, HTML, and CSS....
Also Error List and other windows must be opened manually.
I do not like this "damned default",
so if hou click CTRL+SHIFT+J as mad
and no errors (you sure have some) appear in your Error List
....
now you know why.

Comming soon:
detailed compare of profile settings,
and maybe exported setting for
more realistic web code only development.

Tuesday, September 7, 2010

VS 2008, ASP.NET Development Server, .xslt vs .xsl filename extension

MS VS 2008, .xslt vs .xsl filename extension

Add New Item "Wizard" generates by default .xslt extension. The file is then served by magic cassini (ASP.NET Development Server) when testing locally.

All works fine until you try to load xslt file with XMLHttpRequest.
Cassini sends incorrect Content-Type:

HTTP/1.1 200 OK
Server: ASP.NET Development Server/9.0.0.0
Date: Tue, 07 Sep 2010 13:02:40 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: application/octet-stream
Content-Length: 347
Connection: Close

and of course XHR (correctly) fails to provide xhr.responseXml property.

Questions:
How can you configure ASP.NET Development Server or .NET web application to serve "correct Content-Type"?
What is the "correct Content-Type" anyway ?
Will be XHR capable to read this "correct Content-Type" (XB of course)?

Thanx for one nice default
inconsistent with another one.

Because of using
twisted version of XHR
and MSIE 7.0 it was hard to spot.

Solution ?

Use .xsl instead of .xslt.
ASP.NET Development Server servres them with text/xml Content-Type which seems to work ;-)

Monday, August 2, 2010

Eclipse and JSP Validation rtexprvalue

Sometimes the ment for RAD slows you down.
Specially if not implemented by specs:

Tag:
<jsp:directive.attribute name="title"/>

Usage:
<l:holy-grail-no-quirks-mode title="${param.title}">

Result:
"title" does not support runtime expressions holy-grail-no-quirks-mode.jspx

Read the docs (jsp-2_0-fr-spec.pdf, Table JSP.8-3 Details of attribute directive attributes):
rtexprvalue (optional) Whether the attribute’s value may be dynamically
calculated at runtime by a scriptlet expression.Unlike the
corresponding TLD element, this attribute defaults to true.


Fix: you have to type extra chars if you want this warning to disapear:
<jsp:directive.attribute name="title" rtexprvalue="true"/>

Already registered ;-(

https://bugs.eclipse.org/bugs/show_bug.cgi?id=302060

Thursday, July 22, 2010

Double DOCTYPE, jsp:output, trh:html (trinidad) and JDeveloper wizards

This the result when you click "new JSF Page" "wizard"
and use "*.jspx" and "Render in mobile device" option.


<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:dvtt="http://xmlns.oracle.com/dss/trinidad/faces">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<trh:html>
....


This however has one major problem,
produces invalid HTML markup with DOUBLED DOCTYPE.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="ltr" lang="en-US">
....


This is because one is produced by
jsp:output
and another by
thr:html + org.apache.myfaces.trinidad.core renderkit
(which is default for JDeveloper 11.1.1.3.0 and "ADF Mobile")
It seems just like coincidence that both are the same (read more...)

Solution:
As far as I hnow, the thr:html does not have "none" option for "Mode"
see http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_html.html
So the best is to remove all doctype-* from jsp:output.
Actually if reading the JSP spec for omit-xml-declaration, you can remove whole
jsp:output because:
omit-xml-declaration....
The default value for a JSP document that has a jsp:root element is “yes”.

To bring some more info: the actual DOCTYPES rendere for MSIE 7.0 with
various swiches are:


default (damned again ?):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
S S A A A A A A Q

quirks:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Q Q Q Q Q Q Q Q Q

strict (this should be default in 2010 !!!):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
S S S S S A A A A


The letters are modes for specific browsers taken from:
http://hsivonen.iki.fi/doctype/

Wednesday, July 21, 2010

JDeveloper 11g and encodings (Damned Default)

After fresh instalation JDeveloper will produce new JSPX pages that may look like this.

<?xml version='1.0' encoding='windows-1252'?>
.....
<jsp:directive.page contentType="text/html;charset=windows-1252"/>



This 1252 seems to me like "unwanted legacy".

Tools/Preferences/Environment/encoding:
Encoding
Use to select an encoding value. The default is CP1252.
Once you have selected a value, all new files will be created with the new encoding, and the new encoding will be used to open and save files without encoding tags.
Note that XML files and JSP 2.0 documents (XML compliant files)
must include an appropriate XML encoding declaration on a per-file basis.
For details refer to the W3C XML specification.
You can expand the encodings
in this list by appending new
encoding definitions to the encodings.xml file, found in the jdev/bin directory. This XML file contains a list of mappings from Sun JDK to IANA encoding names.
Note that files already open in JDeveloper will not be opened with the new encoding. To change the encoding used to read open files, close the files and reopen them after changing the encoding value here. Also note that files with encoding tags will always be opened and saved using the specified tags, and not JDeveloper's encoding.

This is tricky, half true, or buggy ...
I have tried to make a new page in an existing project and again the 1252.
Then I have tried new page in different project and UTF-8.

Beware:
There are two more "Character Encoding" (at least) in Project Preferences.
XML.encoding and JSP.charset in JSF pages seems to be controlled by
Project Preferences/Compiler/JSP.

WorstCase:
So If you have already created projects change those, and
manualy fix text in files and if you have non ascii markup in the text, resave all files as UTF-8 as well ;-))

Damned Defaults

Under this "Label" I will try to mark
default settings,
configurations and so called
"convenience APIs"

that I personally consider

WRONG,
DANGEROUS
or in best case
NOT HELPING.

Thursday, December 10, 2009

loadXml MAY involve network activities

Argument that MSXML.loadXML cannot be async, because it is loading string and does not involve networking activity (which only can be async) is a bit wrong:

loadXML with string

<!DOCTYPE page [
<!ENTITY ent1 "internal">
<!ENTITY ent2 SYSTEM "test2.xml">
]>
<root>
<e1>&ent1;</e1>
<e2>&ent2;</e2>
</root>


will cause request to URL test2.xml (resolved against URI of the current page).
So Yes there is network activity with loading strings !.

Anyway even this scenario seems to behave synchronously (loadXml is blocking) even with async=true ;-)

"More on XML entities", and "Damned Defaults" are comming soon.... keep in touch