Re: Newbie looking for elegant solution
On Wednesday, March 25, 2015 at 11:23:08 AM UTC+5:30, Paul Rubin wrote: > kai.peters writes > > 1 bit images of a size of 1024 x 1280 need to be processed this way, > > so 1310720 list elements. Also needs to be 2.7 only. > > Where are these lists going to come from? Files? Process the file > differently, probably. Use generators instead of lists, maybe. Some C-ish solutions and then two loop-unrollings: def foo(lst): i = 0 while i < len(lst): acc = 0 for j in range(8): acc = 2*acc+lst[i] i += 1 yield acc def bar(lst): i = 0 while i < len(lst): acc = 0 acc = 2*acc+lst[i] acc = 2*acc+lst[i+1] acc = 2*acc+lst[i+2] acc = 2*acc+lst[i+3] acc = 2*acc+lst[i+4] acc = 2*acc+lst[i+5] acc = 2*acc+lst[i+6] acc = 2*acc+lst[i+7] i += 8 yield acc def baz(lst): i = 0 while i < len(lst): acc = (128*lst[i] + 64*lst[i+1] + 32*lst[i+2] + 16*lst[i+3] + 8*lst[i+4] + 4*lst[i+5] + 2*lst[i+6] + lst[i+7]) i += 8 yield acc -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
otaksoftspamt...@gmail.com wrote: >I have a list containing 9600 integer elements - each integer is either 0 or 1. >Starting at the front of the list, I need to combine 8 list elements into 1 by >treating them as if they were bits of one byte with 1 and 0 denoting bit >on/off (the 8th element would be the rightmost bit of the first byte). >The end result should be a new list that is 8 x shorter than the original list >containing integers between 0 and 255. >Speed is not of utmost importance - an elegant solution is. Any suggestions? >Thanks for all input, Here's another way. Works in Python 2 and 3. >>> x = [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1] >>> [int(''.join( str(y) for y in x[z:z+8]),2) for z in range(0, len(x), 8)] [177, 105, 117] -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
kai.pet...@gmail.com writes: > 1 bit images of a size of 1024 x 1280 need to be processed this way, > so 1310720 list elements. Also needs to be 2.7 only. Where are these lists going to come from? Files? Process the file differently, probably. Use generators instead of lists, maybe. Or process one scan line at a time instead of the whole image. Or something. Basically your plan and your question seem kind of naive. If you can describe the ACTUAL application, you might be able to get some better answers. E.g. if it's image conversion, maybe there's an existing tool for the formats you want. How many of these images do you want to process? If just a few, who cares if it takes a little while? If a lot, think about writing a C program. -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Wednesday 25 March 2015 14:13, otaksoftspamt...@gmail.com wrote: > I have a list containing 9600 integer elements - each integer is either 0 > or 1. > > Starting at the front of the list, I need to combine 8 list elements into > 1 by treating them as if they were bits of one byte with 1 and 0 denoting > bit on/off (the 8th element would be the rightmost bit of the first byte). > > The end result should be a new list that is 8 x shorter than the original > list containing integers between 0 and 255. > > Speed is not of utmost importance - an elegant solution is. Any > suggestions? Collate the list into groups of 8. Here, I pad the list with zeroes at the end. If you prefer to drop any excess bits instead of padding them, use itertools.izip instead of izip_longest. import itertools mylist = [1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1] grouped = itertools.izip_longest(*([iter(mylist)]*8), fillvalue=0) Now convert each group of eight into a byte: def byte(bits): n = 0 for b in bits: assert b in (0, 1) n = n*2 + b return n [byte(x) for x in grouped] Or if you prefer using built-ins: [int(''.join(str(b) for b in x), 2) for x in grouped] I have no idea which will be faster. Exercise for the reader: izip will drop any bits that don't make up an octet. izip_longest will pad with zeroes on the least-significant side, e.g. [1, 1] -> 192. How to pad on the most-significant side, or equivalently, don't pad at all, so that [1, 1] -> 3? -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
Chris Angelico writes: > Of course, this does mean installing numpy. It is crushing the nut > with the triphammer - an absurd extravagance of energy, but the nut is > effectively crushed all the same. It also has the advantage that it hopefully won't be acceptable for a homework assignment. Whether homework assignment or not, the original poster is well advised to try the problem themselves, and present their code for us to discuss. -- \ “Skepticism is the highest duty and blind faith the one | `\ unpardonable sin.” —Thomas Henry Huxley, _Essays on | _o__) Controversial Questions_, 1889 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Wed, Mar 25, 2015 at 3:46 PM, wrote: > Now I have just read the latest spec and speed/memory may become issues: > > 1 bit images of a size of 1024 x 1280 need to be processed this way, so > 1310720 list elements. Also needs to be 2.7 only. > > Any recommendations? 2.7 only? Then my solution won't work (I just tried to port it, and integers don't have to_bytes). Paul's solution works. Here's an alternative: >>> import numpy >>> list(numpy.packbits(numpy.array(l),-1)) [177, 105, 117] Of course, this does mean installing numpy. It is crushing the nut with the triphammer - an absurd extravagance of energy, but the nut is effectively crushed all the same. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: test2
On Wednesday 25 March 2015 14:11, Tiglath Suriol wrote: > # Make this unique, and don't share it with anybody. > SECRET_KEY = '42=kv!a-il*!4j&7v+0(@a@vq_3j-+ysatta@l6-h63odj2)75' You'll need to change the comment to say "don't share it with anybody unless they have an internet connection." -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: test2
On Wed, Mar 25, 2015 at 1:11 PM, Tiglath Suriol wrote: > # Make this unique, and don't share it with anybody. > ... > SECRET_KEY = '42=kv!a-il*!4j&7v+0(@a@vq_3j-+ysatta@l6-h63odj2)75' > > # List of callables that know how to import templates from various sources. > TEMPLATE_LOADERS = ( > 'django.template.loaders.filesystem.Loader', > 'django.template.loaders.app_directories.Loader', > # 'django.template.loaders.eggs.Loader', > ) > > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > # Uncomment the next line for simple clickjacking protection: > # 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ) > > CACHES = { > 'default': { > 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', > 'LOCATION': '127.0.0.1:11211', > } > } > > SESSION_ENGINE = 'django.contrib.sessions.backends.cache' > > ROOT_URLCONF = 'ipdb.urls' > > # Python dotted path to the WSGI application used by Django's runserver. > WSGI_APPLICATION = 'ipdb.wsgi.application' > > TEMPLATE_DIRS = ( > # Put strings here, like "/home/html/django_templates" or > "C:/www/django/templates". > # Always use forward slashes, even on Windows. > # Don't forget to use absolute paths, not relative paths. > PROJECT_PATH + '/ipdb/asset/templates', # Change this to your own > directory. > ) > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > # Uncomment the next line to enable the admin: > 'django.contrib.admin', > # Uncomment the next line to enable admin documentation: > 'django.contrib.admindocs', > 'django.contrib.flatpages', > 'ipdb.asset', > 'registration', > ) > > # > # Send logs to the console and to a file. > # > LOGGING = { > 'version': 1, > 'disable_existing_loggers': True, > 'formatters': { > 'standard': { > 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] > %(message)s", > 'datefmt' : "%d/%b/%Y %H:%M:%S" > }, > }, > 'handlers': { > 'null': { > 'level':'DEBUG', > 'class':'django.utils.log.NullHandler', > }, > 'logfile': { > 'level':'DEBUG', > 'class':'logging.handlers.RotatingFileHandler', > 'filename': LOG_DIR + "/ipdb.log", > 'maxBytes': 5, > 'backupCount': 2, > 'formatter': 'standard', > }, > 'console':{ > 'level':'DEBUG', > 'class':'logging.StreamHandler', > 'formatter': 'standard' > }, > }, > 'loggers': { > 'django': { > 'handlers':['console'], > 'propagate': True, > 'level':'DEBUG', > }, > 'django.db.backends': { > 'handlers': ['console'], > 'level': 'DEBUG', > 'propagate': False, > }#from django.conf.urls.defaults import patterns, include, url > from django.conf import * > from django.conf.urls.static import static > from django.views.static import serve > from django.conf.urls import * > #from ip_db.views import ipdb_input_add, ipdb_input_start, > ipdb_input_delete, ipdb_input_save, ipdb_api_add, ipdb_api_search > from asset.views import api_add, api_search, gui_search, gui_add, > ipdb_overview, api_file > from asset.utils.elastic_func import country_tally, grid, > newest_to_oldest, country_tally_web_top10, country_tally_web, asset_tally > from django.http import HttpResponsePermanentRedirect > from django.shortcuts import render_to_response > from django.contrib import admin > admin.autodiscover() > > import os > > PROJECT_PATH = os.path.realpath(os.path.dirname(__file__)) > > # Uncomment the next two lines to enable the admin: > from django.contrib import admin > admin.autodiscover() > > urlpatterns = patterns('asset.views', > # Examples: > # url(r'^$', 'ipdb.views.home', name='home'), > # url(r'^ipdb/', include('ipdb.foo.urls')), > > # Uncomment the admin/doc line below to enable admin documentation: > > # Uncomment the next line to enable the admin: > url(r'^admin/', include(admin.site.urls)), > #(r'^accounts/', include('registration.urls')), > (r'^$', lambda request: > HttpResponsePermanentRedirect('/asset/overview')), > (r'^heatmap/', country_tally), > (r'^grid/',grid), > (r'^nto/',newest_to_oldest), > (r'^ctwtt/',country_tally_web_top10), > (r'^ctw/',country_tally_web), > (r'^at/',asset_tally), > > #(r'^/$', ipdb_overview), #Start > #(r'^$', ipdb_overview), #Start >
Re: Newbie looking for elegant solution
On Tuesday, 24 March 2015 21:20:11 UTC-7, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 3:04 PM, Paul Rubin wrote: > > This works for me in Python 2.7 but I think > > Python 3 gratuitously broke tuple unpacking so it won't work there: > > > > > > > > from itertools import count, groupby > > old = [0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, > > 1] > > new = [reduce(lambda x,(y,i):x*2+y, g, 0) > >for k,g in groupby(zip(old,count()), lambda (a,b): b//8)] > > print new > > > [18, 222, 53] > > > > You don't need tuple unpacking. Here's the Py3 version of the above: > > from functools import reduce > new = [reduce(lambda x,y:x*2+y[0], g, 0) > for k,g in groupby(zip(old,count()), lambda a: a[1]//8)] > > ChrisA Now I have just read the latest spec and speed/memory may become issues: 1 bit images of a size of 1024 x 1280 need to be processed this way, so 1310720 list elements. Also needs to be 2.7 only. Any recommendations? -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Tuesday, 24 March 2015 21:04:37 UTC-7, Paul Rubin wrote: > nobody writes: > > I have a list containing 9600 integer elements - each integer is > > either 0 or 1. > > Is that a homework problem? This works for me in Python 2.7 but I think > Python 3 gratuitously broke tuple unpacking so it won't work there: > > > > from itertools import count, groupby > old = [0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1] > new = [reduce(lambda x,(y,i):x*2+y, g, 0) >for k,g in groupby(zip(old,count()), lambda (a,b): b//8)] > print new > > >>> [18, 222, 53] > no homework - real life. thanks for your contribution -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Wed, Mar 25, 2015 at 3:04 PM, Paul Rubin wrote: > This works for me in Python 2.7 but I think > Python 3 gratuitously broke tuple unpacking so it won't work there: > > > > from itertools import count, groupby > old = [0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1] > new = [reduce(lambda x,(y,i):x*2+y, g, 0) >for k,g in groupby(zip(old,count()), lambda (a,b): b//8)] > print new > [18, 222, 53] > You don't need tuple unpacking. Here's the Py3 version of the above: from functools import reduce new = [reduce(lambda x,y:x*2+y[0], g, 0) for k,g in groupby(zip(old,count()), lambda a: a[1]//8)] ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
otaksoftspamt...@gmail.com writes: > I have a list containing 9600 integer elements - each integer is > either 0 or 1. Is that a homework problem? This works for me in Python 2.7 but I think Python 3 gratuitously broke tuple unpacking so it won't work there: from itertools import count, groupby old = [0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1] new = [reduce(lambda x,(y,i):x*2+y, g, 0) for k,g in groupby(zip(old,count()), lambda (a,b): b//8)] print new >>> [18, 222, 53] -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Tuesday, March 24, 2015 at 8:29:24 PM UTC-7, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 2:13 PM, wrote: > > I have a list containing 9600 integer elements - each integer is either 0 > > or 1. > > > > Starting at the front of the list, I need to combine 8 list elements into 1 > > by treating them as if they were bits of one byte with 1 and 0 denoting bit > > on/off (the 8th element would be the rightmost bit of the first byte). > > > > Speed is not of utmost importance - an elegant solution is. Any suggestions? > > Oooh fun! > > >>> l = [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, > >>> 1] > >>> list(int(''.join(str(i) for i in l),2).to_bytes(len(l)//8,'big')) > [177, 105, 117] > > Convert it into a string, convert the string to an integer > (interpreting it as binary), then convert the integer into a series of > bytes, and interpret those bytes as a list of integers. > > Example works in Python 3. For Python 2, you'll need ord() to get the > integers at the end. > > I'm not sure how elegant this is, but it's a fun trick to play with :) > > Next idea please! I love these kinds of threads. > > ChrisA Impressive - thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: Newbie looking for elegant solution
On Wed, Mar 25, 2015 at 2:13 PM, wrote: > I have a list containing 9600 integer elements - each integer is either 0 or > 1. > > Starting at the front of the list, I need to combine 8 list elements into 1 > by treating them as if they were bits of one byte with 1 and 0 denoting bit > on/off (the 8th element would be the rightmost bit of the first byte). > > Speed is not of utmost importance - an elegant solution is. Any suggestions? Oooh fun! >>> l = [1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1] >>> list(int(''.join(str(i) for i in l),2).to_bytes(len(l)//8,'big')) [177, 105, 117] Convert it into a string, convert the string to an integer (interpreting it as binary), then convert the integer into a series of bytes, and interpret those bytes as a list of integers. Example works in Python 3. For Python 2, you'll need ord() to get the integers at the end. I'm not sure how elegant this is, but it's a fun trick to play with :) Next idea please! I love these kinds of threads. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: test2
On Wed, Mar 25, 2015 at 2:11 PM, Tiglath Suriol wrote: > # Make this unique, and don't share it with anybody. > SECRET_KEY = '42=kv!a-il*!4j&7v+0(@a@vq_3j-+ysatta@l6-h63odj2)75' This right here is a reason to send your test messages someplace other than a huge, high-traffic mailing list! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Newbie looking for elegant solution
I have a list containing 9600 integer elements - each integer is either 0 or 1. Starting at the front of the list, I need to combine 8 list elements into 1 by treating them as if they were bits of one byte with 1 and 0 denoting bit on/off (the 8th element would be the rightmost bit of the first byte). The end result should be a new list that is 8 x shorter than the original list containing integers between 0 and 255. Speed is not of utmost importance - an elegant solution is. Any suggestions? Thanks for all input, Kai -- https://mail.python.org/mailman/listinfo/python-list
test2
# Django settings for ipdb project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_em...@example.com'), ('jol', 'tegijjjlath.net'), ('totis', 't...@oint.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE':'django.db.backends.postgresql_psycopg2', 'NAME': 'ipdb_db',# Or path to database file if using sqlite3. 'USER': 'ipdb', # Not used with sqlite3. 'PASSWORD': 'admin', # Not used with sqlite3. 'HOST': 'localhost', # Set to empty string for localhost (NOT TRUE). Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } PROJECT_PATH = '/var/opt/ipdb/ipdb/' # this dir contains 'ipdb' and 'manage.py' GEOIP_PATH = PROJECT_PATH + '/ipdb/asset/geo' AS_IPV4_PATH = PROJECT_PATH + '/ipdb/asset/geo/GeoIPASNum.dat' AS_IPV6_PATH = PROJECT_PATH + '/ipdb/asset/geo/GeoIPASNumv6.dat' RUN_DIR = PROJECT_PATH + '/ipdb/asset/run' LOCK_FILE= PROJECT_PATH + '/ipdb/asset/crawler.pid' # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. TIME_ZONE = 'America/Atikokan' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale. USE_L10N = True # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" MEDIA_ROOT = PROJECT_PATH + '/ipdb/asset/media/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/";, "http://example.com/media/"; MEDIA_URL = '/media/' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" STATIC_ROOT = PROJECT_PATH + '/ipdb/asset/static/' # # Temporary client files. # FILE_UPLOAD_DIR = '/tmp/' LOG_DIR = PROJECT_PATH + '/ipdb/asset/log/' # URL prefix for static files. # Example: "http://media.lawrence.com/static/"; STATIC_URL = '/static/' # Additional locations of static files STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', #'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. SECRET_KEY = '42=kv!a-il*!4j&7v+0(@a@vq_3j-+ysatta@l6-h63odj2)75' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', } } SESSION_ENGINE = 'django.contrib.sessions.backends.cache' ROOT_URLCONF = 'ipdb.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'ipdb.wsgi.application' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. PROJECT_PATH + '/ipdb/asset/templates', # Change this to your own directory. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages',
Re: test1
On Wed, Mar 25, 2015 at 1:47 PM, Tiglath Suriol wrote: > {% block title %}{% endblock %} Looks to me like you're playing around with a templating system like Jinja, but may I suggest that you send tests to yourself rather than to an entire mailing list/newsgroup? :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
test1
body {color:black;} h1 {text-align:center;color:maroon;font-size:30px;font-style:normal;} td {font-size:12;font-style:monospace;} } {% block title %}{% endblock %} IPDB Data Input Window Address:{{ form.address }} Filename:{{ form.filename }} {{ form.box }} Delete Selected Description:{{ form.description }} Expiry date:{{ form.expiry }} function submitReset() { document.getElementById("frm1").reset(); } function add() { window.location.replace="http://127.0.0.1:8000/add/"; } function clearForms() { // variable declaration var x, y, z, type = null; // loop through forms on HTML page for (x = 0; x < document.forms.length; x++) { // loop through each element on form for (y = 0; y < document.forms[x].elements.length; y++) { // define element type type = document.forms[x].elements[y].type; // alert before erasing form element //alert('form='+x+' element='+y+' type='+type); // switch on element type switch (type) { case 'text': case 'textarea': case 'password': //case "hidden": document.forms[x].elements[y].value = ''; break; case 'radio': case 'checkbox': document.forms[x].elements[y].checked = ''; break; case 'select-multiple': for (z = 0; z < document.forms[x].elements[y].options.length; z++) { document.forms[x].elements[y].options[z].selected = false; } case 'iframe' } // end switch } // end for y } // end for x //x = window.frames["frame1"]; //x.document.body.innerHTML = ""; } --- body { font-size:10px; color:black; backgrounc:CC; } h1 { text-align:center; color:maroon; font-size:30px; font-style:normal; } td { font-size:12; font-style:monospace; } select { background: transparent; width: 500; height: 300; padding: 5px; font-size: 16px; border: 1px solid #ccc; height: 34px; } #righty { float:right ; width:20% ; } #des { float:right ; width:50% ; } #tab { font-size:12;font-style:normal; } #msg { font-size:12;font-style:monospace;background:FFCC66; } #id_box { width:300px;height:150;border:1px solid black;background-color:ivory;padding:8px; } IPDB Asset Input