Kamis, 27 Januari 2011

Distributing controls in a userform

On many occasions there is a need to lay out controls horizontally in a userform so that they are equally spaced and, as a group, centered within the userform. An example is the group of three buttons (OK, Cancel, and Help) in the userform below.

position-calculate-example


The worksheet below calculates the left position of each of the controls. Key assumptions: 1) each control is the same width; 2) the space between two controls is half the width of the control; 3) the layout is rational and logical (i.e., the worksheet has no GIGO protection); and, 4) there are no more than 6 controls.






Values:































































































































GHI
3


4
Form width411
5


6
Control width35
7


8
Number of controls3
9


10
Inter-control gap17.5
11
Space occupied by all controls140
12
Empty space in form271
13
Empty space on left135.5
14


15Left positionControl 1135.5
16
Control 2188
17
Control 3240.5
18


19


20


21







Formulas:





























































































































GHI
3


4
Form width411
5


6
Control width35
7


8
Number of controls3
9


10
Inter-control gap=I6/2
11
Space occupied by all controls=I6*I8+I10*(I8-1)
12
Empty space in form=I4-I11
13
Empty space on left=I12/2
14


15Left position=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H15<>"",I13,"")
16
=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H16<>"",I15+$I$6+$I$10,"")
17
=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H17<>"",I16+$I$6+$I$10,"")
18
=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H18<>"",I17+$I$6+$I$10,"")
19
=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H19<>"",I18+$I$6+$I$10,"")
20
=IF(ROW()-ROW($H$15)<$I$8,"Control

"&(ROW()-ROW($H$15)+1),"")
=IF(H20<>"",I19+$I$6+$I$10,"")
21





Celebrate 25 Years of Excel With Us!

Celebrate 25 Years of Excel With Us!: "

As many of you know, Excel has reached the ripe old
age of 25. In internet years, that’s like 200 years old! To celebrate
we’re kicking off what we hope will be a fun contest centered on fond
memories of Excel. The idea is to use this moment in time for Excel
users (sorry limited only to the US) to share their favorite memory of
how they’ve used the app, what they love about the app, etc. The stakes:
we’re giving away two Xbox & Kinect packages to two people. This is
a “popularity contest” so getting your friends to vote for your
submission is paramount.

The contest is being run on the Excel Facebook page,
so check there for more details on how to enter and get involved. Below
are the rules & conditions for the contest, so be sure to read
through these before entering.

...(read more)"

How I Do

From Walkenbach and Doctorow.

Desktop: HP HPE-150f, i7 860@2.80, 8G RAM, Win7 64bit, Dual 22″ Acer monitors. I used to be strictly a laptop guy, but when the D810 died, I decided to go for a desktop. I’m happy I did. It’s quite a bit faster for the money.


Laptop: ASUS R1F Convertible tablet, T2700@2.00, 2G RAM, Win7 32 bit. They don’t make Win7 drivers so not all the doodads work. For instance, I have to rotate the screen via software, but it’s better than using Vista.


Keyboard: Microsoft Wireless Multimedia Keyboard 1.1


File Sharing: Dropbox. I can’t tell you how useful this is. Wait, yes I can. Very useful.


Backup: Mozy. Offsite, daily backups. About $200 bucks every two years for 18.2G from my computer and 24G from wifey’s computer. What the hell does she have on there anyway? Photos, I’ll bet.


Phone: iPhone 4. I switched a few months ago. AT&T service sucks in my area, but I can survive for the 22 minutes of phone calls I make per month. This thing is a great computer that also sometimes makes phone calls.


Scanner: CanoScan LiDE 35 using LiDE60 drivers so it works on Win7-64.


Printer: HP LasterJet 1200


Storage: I have a 200G Maxtor. I used to have two, but its brother died. This one too shall die soon. I really don’t need it with Mozy, but I’ll probably get another one when this one goes.


Email: Gmail. I still have MS Outlook for programming/testing purposes, but I don’t use it. It opens every Sunday morning and downloads everything from Gmail, so I have a backup.


Calendar: Google Apps


RSS: Google Reader


Search: Google, but I’ve been reading about alternatives because I’m sick of the whole first page being crap sites. I started using Blekko recently - better on some things, not on others.


Newsgroups: I don’t read nntp much anymore, but I use Agent as my newsreader and an NNTP bridge to convert MSDN web fora to nntp.


Browser: Firefox. Chrome is not customizable enough for me.


Music: iPhone 4 and ITunes. I would love to eschew iTunes, but there’s simply nothing better for podcasts. Podcasts to which I subscribe include Marketplace Tech Report, Cincinnati Bengals Audio Minutes, Coffee Break Spanish, College Football Podcast, Jordan Jesee GO!, Merriam-Webster’s Word of the Day, Methods in Excel, Motley Fool Money, Car Talk, Fresh Air, Science Friday, You Look Nice Today, and 37signals. For the car, I use a Griffin iTrip FM transmitter hooked up to the iPhone.


Radio: Pandora. Yet another service I pay money for in a world where everything seems like it’s free.


eBooks: Dead trees.


Todo lists: Goodtodo


Note taking: Evernote. Every crazy idea I have goes here. It’s fun to go back and read what I thought was a good idea a few months ago.


Screen capture: SnagIt


Blog: WordPress


Text Editor: Notepad++


Bookmarks: Delicious. I heard they’re going out of business so I signed up for pinboard.in, but I haven’t used it yet. I need a good Firefox Addon for it, and there isn’t one yet.


FTP: Filezilla


Code: VBA goes in the VBE. Ruby goes in Intype. I’m very impressed with that as a code editor. HTML and CSS go in AlleyCode out of habit.


Compression: JustZipIt. I love programs with fewer options (except browsers apparently).


PDF: CutePDF for printing, FoxIt for reading, and PDFCreator for VBA stuff.


Graphics: IrfanView


File Copy: SynchronizeIt


SCP: WinSCP


Office: MS Office 2003 and 2007.


GPS: Garmin Approach GS - got it for xmas, so no commentary yet.


I used this program called ExamDiff recently. I started updating code in the wrong version of the spreadsheet and I needed to figure out the differences. I exported the modules, loaded them in ExamDiff, and it saved the day. Nice program, that.


Most used iPhone Apps: Gmail, Dropbox, Evernote, Netflix, Google Reader, and Cribbage Lite.


As for wish lists, I’d like to get an iPad. I really don’t have a use for it, so I haven’t pulled the trigger. I’d also like a scanner with a document feeder, but for the 10 pages a year I scan, it’s probably not worth it. I wish my car had an iPhone dock, but I’m allergic to car payments, so that one will have to wait. I’d like to get a golf simulator for my house, but then I’d need to get a house with 15 foot ceilings. I haven’t had great luck with robots, but I think I’ll be trying the new Scooba 230. If cleaning the bathroom isn’t the worst job, I can’t imagine what is.

Announcing the Flex-A-Widget Challenge for the ArcGIS Viewer for Flex

Flex-A-Widget ChallengeWe'd like to announce the Flex-A-Widget Challenge, a developer competition for the ArcGIS Viewer for Flex. The challenge: either modify an existing widget or create your own custom widget for the ArcGIS Viewer for Flex application, then submit it as part of the Viewer code gallery. The widget must work on the ArcGIS Viewer for Flex 2.2 release or higher.

You can enter as many widgets as you like for the competition. The online entry form becomes available on January 14. If you've previously submitted a widget onto the Viewer code gallery, you're welcome to enter it in this competition by completing the entry form.


We recommend that you submit the following as part of your widget entry:



  • A compiled version of your widget that works in the ArcGIS Viewer for Flex application

  • The source code for your widget

  • A ReadMe file that explains what the widget does and how to install/configure it

  • An associated sample service available to see it in action (if needed)

The winner of the competition will be decided by public voting.


For full information on contest eligibility and how to enter, see the contest home page and official rules. Study these documents closely and you'll notice that the first 100 applicants to submit a valid entry will receive a free Flex-A-Widget t-shirt!


Good luck and we hope you enter often!

Creating a time-enabled WMS with ArcGIS Server 10

The much-requested ability to show time in a WMS is now available at ArcGIS Server 10.0. A time-enabled WMS advertises a temporal extent of its layers in the GetCapabilities response, just as it does for the spatial extent. A client can 'zoom' the map to a particular point in time using a 'TIME' parameter in the GetMap request. This post shows an example of a time-enabled WMS and describes how it was built.

Preparing the data


To get a time-enabled WMS, your data has to have some temporal information associated with it. Temporal data can theoretically be stored within raster data or it can be associated with vector features in an attribute field. With ArcGIS Server, you can only publish a time-enabled WMS from a map service (as opposed to an image service), so we’re just going to focus on vector data for this example.


The test dataset we’ll use are some point and line features in Port-au-Prince, Haiti, collected from the Open Street Map (OSM) database. OSM is a crowdsourced geographic database into which any editor can contribute data. Before the January, 2010 earthquake in Haiti, OSM didn’t have much coverage of Port-au-Prince. Here’s what it looked like:


OSM before Haiti edits
(C) OpenStreetMap and contributors, CC-BY-SA


After the earthquake, volunteers quickly digitized data for the Port-au-Prince area to provide more accurate maps for responders on the ground. In a few weeks, the dataset grew into quite possibly the most complete and accurate GIS dataset of Port-au-Prince that has ever been compiled.


OSM after Haiti edits
(C) OpenStreetMap and contributors, CC-BY-SA


To better visualize this amazing power of crowdsourcing, I decided to build a WMS that shows the growth of OSM in Haiti during the days following the earthquake.


The original data I downloaded from Geofabrik was a snapshot from January 25, 2010. This was only two weeks after the earthquake, so if you download the data now, you’ll get an even more recent snapshot. A nice perk of the site is that it offers the OSM data in Esri shapefile format. For this example, I decided to download streets, waterways, and points of interest.


Here's an example of the attribute table for the streets layer. The highlighted field 'timestamp' contains the time the feature was submitted into the OSM database. All the layers I downloaded have a similar 'timestamp' field.


Timestamp field in ArcGIS


Configuring time settings in the ArcMap document


Before publishing the map document through ArcGIS Server, you need to enable time settings on each layer in ArcMap. This involves opening the layer properties and telling your map which field holds the time information that should be used for that particular layer. Here’s an example screenshot for the streets layer:


Enabling time on a layer


To get here, I just right-clicked the streets layer in the ArcMap table of contents and clicked Properties. Then I clicked the Time tab, which is new at ArcGIS 10.


Here are some of the settings I adjusted:



  • Layer Time – This specifies whether a feature in the layer is associated with a single time point (defined by one attribute field) or a time span (defined by two attribute fields). With the OSM data, each feature has a single time field showing when it was added to the database, so I picked Each feature has a single time field.

  • Time Field – This is the attribute field that holds the time information. Depending on what you selected above for Layer Time, you get either one or two dropdowns here. In my case, I specified the 'timestamp' field I showed earlier.

  • Field format – This denotes the pattern or format of the values in the Time Field. The OSM data has a timestamp format of 'yyyy-mm-dd hh:mm:ss', which is valid according to the ISO8601 spec and is also supported by ArcMap. You can see that it's one of the choices in the dropdown.

There are other settings you can adjust in this dialog which will all affect the resulting time-enabled WMS. The ArcGIS Desktop Help explains these options in detail.


After adjusting these settings, you can save the map and prepare for publishing to ArcGIS Server.


Publishing the time-enabled WMS


The workflow for publishing a time-enabled WMS with ArcGIS Server is the same as publishing a regular WMS. You just publish your map as an ArcGIS Server map service, and enable the WMS capability on it. Both .msd and .mxd files can be published as map services exposing time-aware data.


Once you start the map service, you can begin making WMS requests to it.


Consuming the time-enabled WMS


There are many good WMS clients in either the commercial or open source realms, but ArcMap is a particularly appropriate client for a time-enabled WMS because it comes with a time slider. This not only lets you display or animate your map using the TIME parameter, but also helps you parse and display temporal extent information advertised in the GetCapabilities response.


ArcMap time slider


Here are some brief steps to consume a time-enabled WMS in ArcMap:



  1. Start ArcMap and add your WMS layer.

  2. Click the Open Time Slider Window button. Open Time Slider button in ArcMap

  3. Experiment with dragging the time slider or playing the time animation.

In the series of images below, the time slider demonstrates the daily addition of data to OSM in the Port-au-Prince area in the weeks following the earthquake.


Time slider progression as data added to Haiti in OSM

Deploying a high-capacity ArcGIS Server Web app on Amazon EC2: A case study

Recently Esri Technical Marketing was asked to host a wildfire application for the esri.com web portal. This portal was then linked by CNN’s Tech section. With this added user load we had to quickly increase the amount of resources devoted to the application, and so we turned to the cloud. With the new ArcGIS Server on Amazon EC2 it is relatively easy to create ArcGIS server instances that are already connected to the cloud and ready to serve content to users. In as little as 15 minutes I can create an instance that has Windows, ArcGIS Server, and ArcGIS Desktop installed and ready to use. Unfortunately one server wasn’t going to get me the capacity that we felt was going to be needed to support this new demand, so the process would take a few more steps.

Planning the architecture


In planning this setup, we needed to accommodate a potentially large number of users that would be too much for one system to handle at any given time. This meant we needed a load balanced architecture that would spread the load across multiple servers all serving the same content. In addition to that, one of the services we were hosting on this site was an ArcSDE-based feature service that allows users of the site to add points to the map. This SDE data would have to be viewable by all of the instances running this map service. So in addition to the load balanced server instances, we were also going to need an SDE database that all of these instances could access at any given time.


After reviewing the architecture help for ArcGIS Server on Amazon EC2, we felt the following setup would best suit our needs:


Architecture for ArcGIS Server on Amazon EC2


Creating the staging instances


Now that we had our setup, we began staging the maps and data. We created two staging instances, one for the ArcGIS Server environment and one for the ArcSDE environment. We used the two Amazon Machine Images (AMIs) that Esri provides as our starting point for these instances. On the ArcGIS Server instance we uploaded the application itself and all of the data for Web services that would not change through the life of this application. On the ArcSDE instance we created the database that would be used by the feature service that was editable by users.


The reason that we did not put all of the data on the SDE instance was because it is a single point of failure for the system. If that instance were to go down, the entire site would stop functioning properly. We wanted as little going on as possible on that instance. The ArcGIS Server instances were to be load balanced, so that if any single one ever went down, it could be removed from the load balancer and users would never notice it was gone.


With the application hosted on the staging servers and functioning the way we wanted, the next step was to create the live version of the SDE instance. To do this we simply created a custom AMI from our staging SDE server. This takes about an hour to complete, but once it is done we had an image that could be spun into a new server in just 15 minutes. We used that AMI to generate a new instance of our SDE that would now be our live SDE server. We used one of the larger instances because this was a single point of failure and wanted to be sure that it would remain running even under higher demand. We also created an elastic IP for this instance so that we would be able to reference this machine from the many ArcGIS Server instances that would need to use it, without fear of its address changing on us.


Setting up the load balancer


Next on the list was to get the ArcGIS Server instance ready for use with an Elastic Load Balancer and pointed to the SDE data on the live SDE Instance. We updated the service that was using data from the staging SDE server to point to the new live SDE server and then created an Elastic Load Balancer on our Amazon account. Once the load balancer was created we updated the staging machine to be aware of the load balanced environment and added it to the load balancer itself. The application needed to be updated so that Web links pointed to the load balancer’s DNS address instead of the machine itself.


At this point, we tested the application again to make sure everything was functioning properly from its new environment. To do this, we simply accessed the Web site we had hosted on the machine through the DNS address of the load balancer instead of the DNS address of the instance itself. Once we were confident everything was working properly, we took the staging machine off of the load balancer and generated a custom AMI of our ArcGIS Server instance.


Deploying and testing the live instances


The custom ArcGIS Server AMI was finished about an hour later and now it was time to start creating our live instances. One at a time, we created and tested the new instances to make sure they were functioning properly. While all instances are located in the US-East Region, we spread them out into all of the different Availability Zones within that region to insure that if one of the data centers went down that we would still have other instances still running.


The first thing to do when an instance is created is to log in and make sure the machine name of the system matches what ArcGIS Server thinks it is. We found that occasionally the scripts would have difficulty updating the new instances. Once logged into the system you can bring up the system properties window to determine what the current machine name is and compare it to machine name that server has in the home page within Firefox. If they do not match, shut down the instance from your Amazon Management Console and restart it. This usually fixed the problem for us.


With the machine name verified we checked to make sure all of our services were up and running, and started the ones that may not have spun up correctly. Afterwards we added that machine to the load balancer. In our deployment we created a total of three live instances of ArcGIS Server.


Monitoring the deployment


We now had a fully functional, load-balanced environment that could support the demand placed upon it. The next thing to do was to make sure it continued to function. While the load balancer itself can monitor if a Web page is responding and remove the systems as needed, it cannot check the fine-grained functionality of ArcGIS services. To do that we set up a monitoring script that checks each service periodically and makes sure it is responding.


If the service does not respond, the monitoring script sends us an e-mail telling us the service is down. This gives us a heads up on any problems that might be occurring and we can quickly respond by removing that server from the load balancer or spinning up new instances to replace it. This gives us a very reliable environment that we can feel confident will remain up and running for our users.

InnehållsFörteckning

Deutsch | English | Español | Français | Português | Русский | 中文 | Svenska | 日本語 | 한국어

EmacsWiki är tillägnad EmacsAndXEmacs-innehåll…. Se MissionStatement för mer information.

Alla kan bidra. Du är välkommen att lägga till nya eller ändra redan existerande sidor. Läs mer på HowTo-sidan.

Att lära sig emacs

Grundläggande textredigering i Emacs

Speciella mode för att redigera och manipulera olika filformat och filtyper

Andra specialfunktioner; interagera med externa program och fjärr-services

Anpassa din Emacs-miljö

Utökningar av Emacs: programmering i EmacsLisp, modifiera Emacs-källkoden

Hur man laddar hem och installerar Emacs

  • CategoryPorts – anpassningar för olika operativsystem: NT, Mac, GNU/Linux medräknat Debian, BSD
  • CategoryWThirtyTwo – speciellt för W32 (Microsoft Windows 32-bit)

Vi som älskar Emacs

Mera om EmacsWiki

Filer

Felrapporter och önskelista

Underhåll av EmacsWiki


Detta låter som en intressant idé! Folk har provat många olika sätt för att försöka samla ihop all Emacs-visdom som finns där ute, men faktumet att folk fortsätter bevisar att inget riktigt bra finns än. Med rätt mängd struktur och översikt kan kanske en Wiki fungera… – JohnWiegley, fritt översatt till svenska av MathiasDahl


I have a question regarding the text “[se, en]” that can be seen on the RecentChanges page when it lists for example this page. Normally, Swedish websites are located under the top-domain “.se”. But the “short-name” for the Swedish language, the “Swedish language code” is (now, you have to correct me if I’m wrong) “sv”. And, for those interested, we have a lonely “S” on our cars… :)MathiasDahl