473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Singleton desing patter approach without function expressions...

I am designing the library, which will hidden all its functions within
singleton object ... So for clients
they will use it like [functional_pref ix].[function_name] eg.

system.getEleme ntWithId('ruler ');
At library side, i will use constructs like follows (at global scope)
eg.

function System() {

function _getElementWith Id(id) {
/*
GENERIC CODE (using first DOM getElementById( id) and if not
successful
using document.all with some checks...)
*/
}

/*
MORE UTIL FUNCS
*/

this.getElement WithId = _getElementWith Id;
/*
MORE ASSIGMENTS like
this.[util_method] = _[util_method];
*/

}

var system = new System();

System = null; /* since System constructor is desinged to produce
singletons, and it
should not be visible after singleton
instantiation.. . */

My question is simple, can i use construct like:

System = null;

, to redefine constructor System reference to null ? If not, then how i
should do it ?
Also remember that i can't use function expressions like

function(...) { }

I will appreciate somebody knowlegable to lighten my problem...

Best regards
Luke Matuszewski

Feb 5 '06
56 4000
VK wrote:
For hell of it I filed bug report with request to update HTML schema to
HTML 4.02 Strict:

<http://www.w3.org/Bugs/Public/show_bug.cgi?id =2812>

At least they cannot say that they did not know.


ROTFLOLBTCASTC. YMMD.
PointedEars
Feb 7 '06 #31
VK

Thomas 'PointedEars' Lahn wrote:
ROTFLOLBTCASTC. YMMD.


Sorry?

Feb 7 '06 #32
VK
Thomas 'PointedEars' Lahn wrote:
ROTFLOLBTCASTC. YMMD.


Rolling On The Floor Laughing Out Loud
Biting The Carpet
ASTC ?
You Made My Day

I guess... I thought it was ROT13... ASTC is still dark but the main
idea is clear. Still it's not a criptography group here.

And what so funny any way? All bugs have to be reported and asked to be
fixed, it's the normal procedure. The real fun is that for many years
so many *adult* people prefered to silently cheat on validator, like
little children on their parents. That's indeed LOL.

Feb 7 '06 #33
VK wrote:
Thomas 'PointedEars' Lahn wrote:
ROTFLOLBTCASTC. YMMD.
Rolling On The Floor Laughing Out Loud
Biting The Carpet
ASTC ?


And Scaring The Cat.
You Made My Day

[...] And what so funny any way? [...]


Well, maybe you are not really a fool or a troll but only incapable of
understanding. I will give it a try. So JFYI: You have proposed one
unnecessary and one debatable extension for a future HTML document type.
And you did that in a bugtracking system for the W3C Validator software
instead of discussing it on the W3C HTML mailing list. I only wonder
/when/ this bug will be CLOSED as INVALID, not if.
F'up2 poster

PointedEars
Feb 7 '06 #34
VK
Thomas 'PointedEars' Lahn wrote:
Well, maybe you are not really a fool or a troll
Thank you for this discover. I am indeed not.
but only incapable of
understanding. I will give it a try. So JFYI: You have proposed one
unnecessary and one debatable extension for a future HTML document type.
And you did that in a bugtracking system for the W3C Validator software
instead of discussing it on the W3C HTML mailing list.


I am not a W3C contributor. I am one of customers of their products
(and the product of W3C is their documentation and DTD's)
If they had a section "Report a bug about DTD" I would post there right
away. As they did not, I filed the bug to the first section seemed
more-or-less appropriate. Olivier Thereaux forwarded me to the next
instance (appropriate mailing list) where the request is currently
located.

Now I guess (99% chance) this request will be rejected as it should. It
will fill the hearts of spectators with joy ("I told ye!") and they
will just keep secretly cheating on validator as they used to:
*including* Mosilla Foundation developers. And everyone will stay happy
*including* W3C.

Feb 8 '06 #35
I had set Followup-To poster in order to clarify this privately, but since
you insist on discussing this in public (despite you replying the same via
private e-mail) ...

VK wrote:
Thomas 'PointedEars' Lahn wrote:
Well, maybe you are not really a fool or a troll
Thank you for this discover. I am indeed not.


Well, you are. See below.
but only incapable of understanding.
You missed that.
I will give it a try. So JFYI: You have proposed one
unnecessary and one debatable extension for a future HTML document type.
And you did that in a bugtracking system for the W3C Validator software
instead of discussing it on the W3C HTML mailing list.


I am not a W3C contributor.


No, you are just an incompetent troll wasting everyone's time, using
nonsensical arguments in a eventually futile attempt to show that you
are right after all.
I am one of customers of their products
(and the product of W3C is their documentation and DTD's)
Nonsense. You are no customer of W3C as you are no customer of ECMA, ISO,
IESG, IEEE aso. W3C is more or less an international standardization
organization, and in you are free and welcome to participate in its
decision-making process. Instead you foolishly decided to complain, and
as if that was not bad enough, to complain in a foolish manner, in the
wrong place.
If they had a section "Report a bug about DTD" I would post there right
away.
There can be no bug in the DTD other than a syntax error or a referenced
but undeclared element or entity. So far no such thing exists.
As they did not, I filed the bug to the first section seemed
more-or-less appropriate.
Hello? There is no bug in the W3C Validator regarding this as the
Validator validates against the DTD (which is not necessarily sufficient
to ensure validity of a markup document as the specification imposes
further restrictions, still it is so). Unless you discover false
positives regarding something that is declared in the DTD, there is
no bug the Validator whatsoever.
Olivier Thereaux forwarded me to the next instance (appropriate mailing
list) where the request is currently located.
Where you should have posted in the first place instead of wasting his time!
Now I guess (99% chance) this request will be rejected as it should.
It will fill the hearts of spectators with joy ("I told ye!") and they
will just keep secretly cheating on validator as they used to:
*including* Mosilla Foundation developers. And everyone will stay happy
*including* W3C.


If you only post to waste people's time and bandwidth, just to see your
prejudices confirmed by annoyed reactions provoked by your irresponsible
nonsensical behavior, you are most definitely a troll.
PointedEars
Feb 8 '06 #36
VK

Thomas 'PointedEars' Lahn wrote:
you are most definitely a troll
Even Pope or Rome if it makes you sleep better.
Olivier Thereaux forwarded me to the next instance (appropriate mailing
list) where the request is currently located.


Where you should have posted in the first place instead of wasting his time!


Taking into account that not a single dot in DTD has been changed since
1999 I wonder that HTML Group could be so terribly buzy with? Their
entire mailing archive for January of this year consists of
hundred-something messages.
blah-blah-blah...
...blah


Now real stuff:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html401/strict.dtd">
<html>
<head>
<title>Cheat List v1.0</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">

<style type="text/css">
body { background-color: #FFFFFF}
</style>

</head>

<body>

<iframe src="foo.html"> </iframe>

</body>
</html>

1]
HTML Validator
The errors and warnings are generated by Tidy.
This program is originally developed by the Web Consortium W3C.

0 Errors / 0 Warnings

2]
<http://validator.w3.or g>
This page is not Valid -//W3C//DTD HTML 4.01 Strict//EN!

You want to participate in this comedy - you are welcome. Just please
stop forcing others into it. OK?

Feb 8 '06 #37
VK wrote:
Matt Kruse wrote:
Considering IE's box model "problem" ...
<snip> It is much more secure to have two algorithms and check
read-only compatMode property for the needed one:

if (document.compa tMode) { // this is IE
The - document.compat Mode - property is implemented in Gecko browsers,
and Opera browsers (and probably others by now).
if (document.compa tMode == 'BackCompat') {
// IE in its own mode
- And Gecko browsers when not in standards mode, and Opera 8+ when not
in standards mode.
}
else {
// compatMode is set to 'CSS1Compat'
- Or anything other than "BackCompat ", including the 'QuirksMode' value
used in early Opera 7 browsers.
// IE will act upon W3C (or at least it will try :-)

- And Gecko browsers when in standards mode, and Opera 7+ when in
standards mode plus Opera 7 browsers in Quirks mode.
}
}


- And all browsers not implementing - document.compat Mode - end up here.
Including IE 5 and 5.5, which are, after all, the browsers with which
'BackCompat' mode is compatible, and so logically can be handled with
the same code that handles IE 6 in that mode.

Yet another example of choosing to do something in the worst possible
way available.

Richard.

Feb 12 '06 #38
VK

Richard Cornford wrote:
VK wrote:
Matt Kruse wrote:
Considering IE's box model "problem" ...

<snip>
It is much more secure to have two algorithms and check
read-only compatMode property for the needed one:

if (document.compa tMode) { // this is IE


The - document.compat Mode - property is implemented in Gecko browsers,
and Opera browsers (and probably others by now).
if (document.compa tMode == 'BackCompat') {
// IE in its own mode


- And Gecko browsers when not in standards mode, and Opera 8+ when not
in standards mode.


Could you elaborate on "Gecko standard" vs. "Gecko quirk" mode? :-)

Well, the "I'm IE" mimicrie becomes a real epidemie as I can tell. I'm
fine (technically and humanly) with forged userAgent strings:- overall
everyone wants to survive.
But forged properties and methods is something I would cut sensitive
parts of body off for. Either *implement* it or leave it undefined,
don't place a *placeholder*. Are they nuts?!

So the sample should be adjusted to:

if ((window)&&(win dow.ActiveXObje ct)&&(document. compatMode))

It also suggested then to re-check all your features checks (not only
this one) on a monthly basis. - In case if Opera (was specially bad on
it so far) or Gecko add window.ActiveXO bject property with value
"true".

Feb 12 '06 #39
VK wrote:
Richard Cornford wrote:
VK wrote:
> Matt Kruse wrote:
>> Considering IE's box model "problem" ...
> It is much more secure to have two algorithms and check
> read-only compatMode property for the needed one:
>
> if (document.compa tMode) { // this is IE
The - document.compat Mode - property is implemented in Gecko browsers,
and Opera browsers (and probably others by now).
> if (document.compa tMode == 'BackCompat') {
> // IE in its own mode


- And Gecko browsers when not in standards mode, and Opera 8+ when not
in standards mode.


Could you elaborate on "Gecko standard" vs. "Gecko quirk" mode? :-)


Visit the well-known <URL:http://www.quirksmode. org/>. (Google, which
you are posting with, would have helped.)
Well, the "I'm IE" mimicrie becomes a real epidemie as I can tell. I'm
fine (technically and humanly) with forged userAgent strings:- overall
everyone wants to survive.
But forged properties and methods is something I would cut sensitive
parts of body off for. Either *implement* it or leave it undefined,
don't place a *placeholder*. Are they nuts?!
What you are babbling about has no relevance to Richard's argument.
So the sample should be adjusted to:

if ((window)&&(win dow.ActiveXObje ct)&&(document. compatMode))
This will be true in Gecko-based browsers with the ActiveX Plugin installed,
and the parantheses are unnecessary.
It also suggested then to re-check all your features checks (not only
this one) on a monthly basis. - In case if Opera (was specially bad on
it so far) or Gecko add window.ActiveXO bject property with value
"true".


The Gecko DOM does not implement window.ActiveXO bject, that is an extension
by the ActiveX Plugin, which is installed in Netscape for Windows by
default, to facilitate scripting of the Windows Media Player Plugin.
PointedEars
Feb 12 '06 #40

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
8296
by: JohnS | last post by:
Hi, A lot of functions (classes) in my JavaScript app are singletons. So, I have been exploring ways making JavaScript functions singletons. I thought I'ld run one idea past you all and get some feed back. The usual method of making singletons is to have a static member that returns one instance of the class. But, JavaScript has no notion of static. The closest it has is prototype functions.
1
2038
by: Richard A. DeVenezia | last post by:
foo() generates elements with event handlers that invoke foo function properties. Is this an abhorrent or misthought pattern ? It allows just the one occurence of identifier /foo/ to be changed to /whatever/ when need arises and everything should still work. function foo () { var callee = arguments.callee
4
8243
by: Eric | last post by:
Perhaps this question has been posed before (I'd be surprised if it hasn't) but I just gotta know... Is it possible to combine the Singleton and Factory Method design patterns in the same class? Let's start with your basic Singleton class: class Singleton {
10
1509
by: JFR | last post by:
i found this code sample on the net that i wanted to use: class CUniqueObject { private: CUniqueObject( void ) : m_iValue(0) { } ~CUniqueObject( void ) { }
2
1689
by: davidw | last post by:
As I asked in last post, I want to put some logic in a object and all my webcontrol instance will access that object, the object is responsed to retrieve data from database if the data has not been retrieved yet. Vadym Stetsyak suggested me to use singleton, it seems a good solution for me, but after I read more about singleton, I find another issue - if I use singleton patter, I can not store context data in the class anymore. How I used...
21
2469
by: Sharon | last post by:
I wish to build a framework for our developers that will include a singleton pattern. But it can not be a base class because it has a private constructor and therefore can be inherit. I thought maybe a Template can be use for that, but C# does not support Templates (will be C# generics in mid 2005). Does anyone have a solution on how the singleton pattern can be written, in C#, as a framework/ infrastructure class, so users can use this...
10
3333
by: wkaras | last post by:
Why aren't "Singletons" done like this in C++: A.hpp: class A { public: static A theA; // ...
3
2815
by: koredump | last post by:
I have inherited a Business Object architecture that makes heavy use of the Singleton design patter. For example the data access layer class is implemented as a static Singleton "object", there are also other business objects logic and security supporting classes that are all implemented using the Singleton patter. I 'm attempting to make use of this class library in a webservice application. The problem is that some of the Singleton...
1
1500
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm getting a little confused here. I have a C# class that I'm trying to translate to VB. The C# class is essentially: public static class Class1 { ..... some private static variables and public static properties. } The translation (from several different translation programs) is:
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.