Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-07-2009, 04:09 AM   PM User | #1
jeffmatthews
New Coder

 
Join Date: Oct 2009
Posts: 72
Thanks: 2
Thanked 1 Time in 1 Post
jeffmatthews is an unknown quantity at this point
change font size mid line

I want to deviate from using css to designate a font size in one place.

I have a string with a name.

This is stored in a variable called "name."

I just re-defined name to include district number.

Now, it is name=lastname+', '+district;

I am appending this string into the html dom.

I want the district portion to appear in a slightly smaller font.

How can I do this without having to set up a separate <span>? Or can this be done?
jeffmatthews is offline   Reply With Quote
Old 11-07-2009, 04:43 AM   PM User | #2
oesxyl
Senior Coder


 
Join Date: Dec 2007
Posts: 4,658
Thanks: 374
Thanked 562 Times in 551 Posts
oesxyl has a spectacular aura aboutoesxyl has a spectacular aura about
Quote:
Originally Posted by jeffmatthews View Post
I want to deviate from using css to designate a font size in one place.

I have a string with a name.

This is stored in a variable called "name."

I just re-defined name to include district number.

Now, it is name=lastname+', '+district;

I am appending this string into the html dom.

I want the district portion to appear in a slightly smaller font.

How can I do this without having to set up a separate <span>? Or can this be done?
put district between span tags, get the node and change the font in style attribute.
or more simple:
Code:
name = lastname +', <span style="font-size: 7pt;">' + district + '</span>';
Edit: oops, I didn't see you mention span,

Edit: the font size inside a element will be the same overall, you need a inner element to make it different

best regards

Last edited by oesxyl; 11-07-2009 at 04:46 AM..
oesxyl is offline   Reply With Quote
Old 11-07-2009, 05:14 AM   PM User | #3
jeffmatthews
New Coder

 
Join Date: Oct 2009
Posts: 72
Thanks: 2
Thanked 1 Time in 1 Post
jeffmatthews is an unknown quantity at this point
I guess it's no big deal. I'll add a span. It's just this is in a navigation pane where a traverse parents and siblings to act on them when user clicks and mouses in that area. Another span might cause the family structure to change.

If it turns out to be a nightmare, I can put it back.

Thanks.
jeffmatthews is offline   Reply With Quote
Old 11-07-2009, 05:21 AM   PM User | #4
jeffmatthews
New Coder

 
Join Date: Oct 2009
Posts: 72
Thanks: 2
Thanked 1 Time in 1 Post
jeffmatthews is an unknown quantity at this point
Since you're 2 for 2, I have another question.

I am trying to optimize for speed. I don't know how to be a judge of how fast things should take.

I am putting pushpins next to names (places) in the navigation panel I wrote. There can be around 150 names in the list, meaning I am loading a little icon (pushpin) from Google's url about 150 times.

Should this be an area where I could make adjustments and improve speed? Basically, map loads in 9-10 seconds. I shouldn't complain as it is amazing what you can do these days, but....
jeffmatthews is offline   Reply With Quote
Old 11-07-2009, 02:39 PM   PM User | #5
oesxyl
Senior Coder


 
Join Date: Dec 2007
Posts: 4,658
Thanks: 374
Thanked 562 Times in 551 Posts
oesxyl has a spectacular aura aboutoesxyl has a spectacular aura about
Quote:
Originally Posted by jeffmatthews View Post
Since you're 2 for 2, I have another question.

I am trying to optimize for speed. I don't know how to be a judge of how fast things should take.

I am putting pushpins next to names (places) in the navigation panel I wrote. There can be around 150 names in the list, meaning I am loading a little icon (pushpin) from Google's url about 150 times.

Should this be an area where I could make adjustments and improve speed? Basically, map loads in 9-10 seconds. I shouldn't complain as it is amazing what you can do these days, but....
this is a extension for firefox, debuger and have a very good profiler:

https://addons.mozilla.org/en-US/firefox/addon/216

I guess that loading the icon from google happend only once, first time, in the rest is using the cache, that's ofcourse if you don't have pragma no-cache. If you have and become a problem you can load all this stuff at the begining of the script and reuse it latter but this will complicate the script.

best regards
oesxyl is offline   Reply With Quote
Old 11-07-2009, 10:06 PM   PM User | #6
Old Pedant
Senior Coder

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Location: Snohomish, WA
Posts: 4,045
Thanks: 18
Thanked 656 Times in 648 Posts
Old Pedant will become famous soon enoughOld Pedant will become famous soon enough
Oesxyl is of course correct. Browsers are smart enough to not go get an image more than once from the server. I'm not sure, but I think even a pragma no-cache wouldn't apply to using the same image in the same page occurrence. As that doesn't really involve caching, per se.
__________________
"Old age and cunning win out over youth and enthusiasm every time."
Old Pedant is offline   Reply With Quote
Old 11-08-2009, 01:23 AM   PM User | #7
jeffmatthews
New Coder

 
Join Date: Oct 2009
Posts: 72
Thanks: 2
Thanked 1 Time in 1 Post
jeffmatthews is an unknown quantity at this point
Good answers! That is helping to narrow down the source of drag in loading a map in Google Earth, while at the same time, using some jscript to update a navigation pane to the left of it.

Two things:

1. How owuld I empty my browser's cache to check speed as I develop? "Deleting temporary files" is not what I want because it tells me it will wipe-out saved passwords and other things.

2. To simplify the description of what my app. is doing, I load a US Map which contains only polygons which are state boundaries. THe boundaries, in all, contain probably 12,000 points. THe file size is about 127k.

This map loads pretty quick - about 2-3 seconds. I then load a Texas map. It has boundaries of election districts. These are probably roughly the same number of points. The size of the file is about 147k.

The Texas map takes about 10-12 seconds to load. There is a difference from the US map in that it contains some database information on each district - about 40 fields for each of 150 districts. These, I would assume, all load into memory.

Also, when I load the Texas map, I expand the navigation tree on the left. It creates a line in the panel for each district, so the user can click on that district and fly there. Each displayed line has either a yellow or blue pushpin and alos, either an elephant or donkey - depending on whether the legislator is Rep. or Dem.

Now that you indicate it is not re-loading the images over and over, this leads me to suspect it must be the 40 fields per district that is dragging it down.

Have I supplied enough information to allow anyone to give me advice on whether they agree and/or what I might do to improve speed?
jeffmatthews is offline   Reply With Quote
Old 11-08-2009, 03:20 AM   PM User | #8
oesxyl
Senior Coder


 
Join Date: Dec 2007
Posts: 4,658
Thanks: 374
Thanked 562 Times in 551 Posts
oesxyl has a spectacular aura aboutoesxyl has a spectacular aura about
Quote:
Originally Posted by jeffmatthews View Post
Good answers! That is helping to narrow down the source of drag in loading a map in Google Earth, while at the same time, using some jscript to update a navigation pane to the left of it.
I'm not sure if this will help you but you make use extensive of xml, why don't you use xslt to build the navigation panel( apply the xslt transformation to the xml file and append the document fragment in the place of the dom tree where you want to put the panel).

Quote:
Two things:

1. How owuld I empty my browser's cache to check speed as I develop? "Deleting temporary files" is not what I want because it tells me it will wipe-out saved passwords and other things.
are few firefox extension which you can use to clear cache but this one help you with some other task usual in web development. The first button help you to disable/enable different things in browser.

https://addons.mozilla.org/en-US/firefox/addon/60

I don't think is a good idea to store password and user names in browser but maybe I'm a little paranoic,

Quote:
2. To simplify the description of what my app. is doing, I load a US Map which contains only polygons which are state boundaries. THe boundaries, in all, contain probably 12,000 points. THe file size is about 127k.

This map loads pretty quick - about 2-3 seconds. I then load a Texas map. It has boundaries of election districts. These are probably roughly the same number of points. The size of the file is about 147k.

The Texas map takes about 10-12 seconds to load. There is a difference from the US map in that it contains some database information on each district - about 40 fields for each of 150 districts. These, I would assume, all load into memory.

Also, when I load the Texas map, I expand the navigation tree on the left. It creates a line in the panel for each district, so the user can click on that district and fly there. Each displayed line has either a yellow or blue pushpin and alos, either an elephant or donkey - depending on whether the legislator is Rep. or Dem.

Now that you indicate it is not re-loading the images over and over, this leads me to suspect it must be the 40 fields per district that is dragging it down.

Have I supplied enough information to allow anyone to give me advice on whether they agree and/or what I might do to improve speed?
in my opinion only profiling can help you. The earth api is probably loaded from google servers, firebug can profile, using the net tab, how much time it take the comunication on the net. Venkman help you to profile the local code. I would focus to optimize on what is used frecvently and spend much time( the function or object methods).

best regards
oesxyl is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:34 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.