473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

server-side JavaScript: Example 3: Dictionary class

Example server-side JavaScript Web script, Dictionary class


Expand|Select|Wrap|Line Numbers
  1. //Dictionary class, hash array unlimited length configurable speed/efficiency
  2. //
  3. printf("<html><body>");
  4.  
  5. printf("<b>Creating dictionary</b><br\n>");
  6.  
  7. var dictobj     = new Dictionary(5);  //dictionary class
  8. var dvname      = "varnam0";          //dict var name
  9.  
  10. var smplobj = new Object(); //create object
  11. smplobj.xx = "text1";       //add properties
  12. smplobj.yy = "text2";
  13.  
  14. printf("<b>Storing object into dictionary</b><br\n>");
  15. printf("<br\n>");
  16. //put object into array
  17. dictobj.set(dvname,smplobj);
  18.  
  19. printf("<b>Reading value stored in dictionary</b><br\n>");
  20. printf("value of " ,dvname, " property xx: [", dictobj.get(dvname).xx, "]<br\n>");
  21. printf("<br\n>");
  22.  
  23. printf("<b>Changing property xx value to otherval567</b><br\n>");
  24.  
  25. //values in dictionary are stored by reference, not copy
  26. //modifying value of object's property also changes value stored in dictionary
  27. smplobj.xx = "otherval567";
  28.  
  29. printf("value of " ,dvname, " property xx after change: [", dictobj.get(dvname).xx, "]<br\n>");
  30. printf("<br\n>");
  31.  
  32.  
  33. printf("<b>Checking array (dictionary) length</b><br\n>");
  34. printf("array length: [", dictobj.len(), "]<br\n>");
  35. printf("<br\n>");
  36.  
  37. printf("<b>Deleting value from array</b><br\n>");
  38. //erase value from dictionary
  39. dictobj.set(dvname,null);
  40.  
  41. printf("array length after delete: [", dictobj.len(), "]<br\n>");
  42.  
  43.  
  44. printf("</body></html>");
--
Jun 28 '08 #1
1 4150
GVDC wrote:
Example server-side JavaScript Web script, Dictionary class
Example client-side JavaScript, complete Idiot "class":

Expand|Select|Wrap|Line Numbers
  1. function Idiot()
  2. {
  3. var value = "GVDC";
  4. this.who = function() { return value; };
  5. }
  6.  
  7. window.alert((new Idiot()).who());
<http://jibbering.com/faq/>


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jun 28 '08 #2

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

Similar topics

9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
10
by: sara | last post by:
Hi All, I was able to connect to MS SQL Server 2005 on my computer but after a while I can not. When I want to connect to it using MS SQL Server Management Studio I got this error: An error...
1
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: ...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
3
by: Lee T. Hawkins | last post by:
I am having a number of problems over the last two full days trying to get an ASP.NET 2.0 application to connect to a SQL Server 2005 database... First off, I built this application w/ Visual...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.