- What's the best was to schedule Hell/Finals week stuff... setting a threshold for paper and toner being replaced on a quicker schedule
- For checking the available computer stuff, we should just have one page that takes a $_GET variable for the lab and displays the information accordingly. So based on the passed lab, we can display the title, image, CSS, and MySQL query dynamically... this could save a lot of time
- Put download images in place of links for tar.gz and zip files
- Make sure to attribute Guillaume Fricker and Adan Vivar
- Add AV4
- Have people be able to text/e-mail TCDB if a printer is out of paper/toner/oo and the Helpdesk will be notified; additionally, the status should automatically update on the map
- Have image change based on weather, temperature, and time of day... should be able to get info from Yahoo Weather API
- http://developer.yahoo.com/weather/
- For the time of day, I could have a few different images based on the location of the sun at a given time and date... this could be really neat to program
- Make URL update dynamically when user moves to a new tab... tcdb/map/#labs , tcdb/map/#printers , etc.
- If there's no URL for a lab (i.e. if we have an empty string, don't print the URL)
- I forgot why I wanted to do this, but what about speech recognition? http://www.bigwebmaster.com/General/Howtos/Speech-Recognition-HOWTO/
- Instead of printing "are closed" for just the labs I've hard coded, I should do a regexp search to see if the $lab->lab_name contains the word "and", in which case I should print "are"... that seems like a good way, but I'm sure there's something better I can do...
- Tap into Google calendar API to figure out if its a national holiday... what holidays do we celebrate and are employees off for?
- And what places are closed as a result... not many
- Change to mysqli module
- Look into MySQL triggers for triggering certain events... this could be a good way to keep track of toner stats, etc.
- SQLite?!
- If we have any technical difficulties, redirect to a tech difficulties page
- If a TC is on duty in a given lab, print "lab is open and has a TC on duty"
- AI applications... the possibilities could be endless...
- Store toner, OO, paper info in DB and in object info
ALL CODE CAN BE FOUND AT http://code.google.com/p/gctechmap/ALWAYS CHECK YOUR XHTML AND CSS!
MAKE SURE LABS SAY THEY'RE OPEN WHEN THEY REALLY ARE OPEN (AND VICE VERSA)
HOW DO I CENTRALIZE AND MANAGE CODE EFFECTIVELY? HOW DO I STOP THE MAP FROM BECOMING A BEHEMOTH THAT IS OUTSIDE OF MY CONTROL?
TOP PRIORITIES
- Indent and comment code... almost done
- Do IE/Safari stylesheets for all the other users -- since I redid the map, I'll need to do some slight mods for lte IE7
http://www.tatanka.com.br/ies4linux/page/Main_Page
- Also fix Library floor issues... I thought I had already done that...
Fix Science Library hours
- Move open_labs stats to files (and code it in Perl)
- We also need a way to get at this data without refreshing the page... check the TCDB suggestion page for a way to have AJAX dynamically pull the data from the DB
- Create a virtual tour for users
Make a bug-reporting system (can link with e-mailing suggestions, like "If you'd like to suggest a feature, or if you see something wrong with the map, please e-mail me")
- Consolidate and simplify code --
CSS properties can be grouped (class="closed gencomp", for instance), which means that we can cut down on all those lab and printer styles
I also need to go back through and change the relative positioning of the icons
- Set up common functions in functions.php
- Figure out ways to perfect toner e-mails
- Make the code consistent (variable names, structure, foreach loops) and efficient! I have a lot of duplicate code that needs taking care of
Finish printers.php -- find a good way to handle the GENCOMP/BURLING issue (I should just make more icons... one for each printer)
- Take care of all the files that get arbitrarily large in size
- Make a dependency map of everything and do some planning! Look at places where I can cut down on code... I'm sure I've made some errors and duplicated things in places
- Where can I use arrays and foreach loops?
- Make a list of the problems I ran across in doing all of this! This will help both others and myself succeed in the future!
- Think before you code!
- Don't try to do too much with php alone!
- This increases page load time, reduces efficiency, and screws up things in a lot of places
- Try as much as possible to move away from shell scripts and towards Python/Perl. This helps with portability, even though I would never recommend that this be used on a Windows server
- I need to move open_labs.php over to Perl and have it write data to file/DB so that other scripts can read from it
- IIF is technically open from 5-7, even though there is no TC staffing it. It should also be shown as open until 1, even though there is no TC there
- We should change the hours for some of the labs to be open regardless of if a TC is staffing it or not
- Make a list of these labs and change hours list accordingly
- Fix holiday hours -- some labs still show up as open, like Gencomp and Scilab
- Should have a holiday/back-to-school script to update the holiday info in the DB, then have the PHP pull from that... is that the best solution?
- Even if a lab is open during the break (like the Libraries, for instance), when they close for the evening, the message "closed for break" still appears... what's the most elegant way to fix this?
What the map does:
- Based on a given time and day of the week (this is done through a php script that retrieves the time/date information; the script checks based on a conditional, like the following...)
- I may be able to substitute a foreach loop for part of this to cut some code
$date = date ( 'l' ); // assigns the variable $date the day of the week
$hour = date ( 'H' ); // assigns the variable $hour the hour of the day (24 hour format, like TCDB)
if (($date == 'Monday' || $date == 'Tuesday') && $hour >= 8 && $hour <= 23)
{
print 'open image goes here';
}
else
{
print 'closed image goes here';
}
An image is superimposed over the map in the appropriate place to show whether or not the lab is open/closed
I think they turn off the Scilib printer at night, which is why it has trouble displaying for me. Maybe I should make something where if the script can't contact a printer once, it should display a sort of out-of-order message...
-
It may have just been a fluke, but Micah also had some trouble with the Read printer displaying info properly
- *Completed* printer map-- at least, I have the images, the names of the printers, links to the status page, whether or not the printer is open, and toner level presented in the pop-up box. I'm sure there's more we can add, but I wanted to keep it simple enough
- I also have a string similar to the one for the open labs, telling the user which places have printers currently available
- I also fixed the printer icons to reflect out-of-order status, as well. Hopefully this will work
- Added new icons for Helpdesk, AV Center, and MathLAN
- Sorted the printer list under "General Information" by toner level (and thank god, too! I actually killed two birds w/ one stone-- I sorted the array and I cut down on about 150 lines of code I had previously)
- Also added similar script to check for number of available pages with the given toner. This is confusing and a bit misleading -- it is the estimated number of pages left given that amount of toner, not the number of pages of paper in the printer. That will be a bit harder.
- Added some links for the AV Center, MathLAN, Libraries and IIF on the hover elements
- Validated XHTML and CSS, included tcdb.grinnell.edu/map/validate.php as "proof" (the real proof is in validation itself...) and explanation
- Wrote script to keep track of toner levels every half an hour, for statistical purposes. As indicated below, I hope to aggregate and track this data and present it in a graph. These files can be found on TCDB in /home/satherdy/printers/toner_level/toner_stats
- Separated most of the php code into separate files, which are called with include() in index.php. Should also make a php dependency map...
- Changed header on a whim -- I don't know if I'll keep it or not, I mainly just wanted to play around with the GIMP. One neat thing: the binary background is a translation of "Micah Bot-Miller rocks my socks off"
- Created tcdb/map_test for testing purposes (this will be more of an issue once people actually start using the map)
- Added ROSE to toner list (it had some strange certificate issues -- got around it by using the "--no-check-certificate" flag with wget)
- Changed check_level.sh to e-mail HD when the toner gets too low
or when the printer may be out-of-order. Hope it works!
- Created a low-key login system with sessions, working on cookies
- I got some more done on this -- login system is done through a cookie, and authorized users can change status messages and whether or not out-of-order e-mails should be sent. This all works off of files in my home directory on TCDB -- that way I can store the information and draw from it, change it, do whatever
- I also found out how to make a certain tab active on the map -- that is, if I wanted to refresh the infomation on only one of the tabs, the user wouldn't be lead back to the lab map, then have to go to "General Info", for instance. The page refreshes and the user sees the information immediately. I'm actually kind of proud of this one... the code is nice. There are lots of applications for this on the map that I may implement in the future. There is one problem, however -- once the page refreshes, the lab map (i.e. tab 0) flashes across the screen, and then the tab you want appears. This isn't really the seamless refresh I was looking for... I'll look into ways to make it better
- Set up Google Code project at http://code.google.com/p/gctechmap/
- Added script check_oo_status.sh to check out-of-order status of all public printers. It records historical data to a file in /home/satherdy/printers/oo_status/oo_stats , and anyone can view the data at http://tcdb.grinnell.edu/map/oo_stats.php. Rockin!
- I also added a small part to track individual out-of-order stats. Basically, if the printer is golden, a 1 is appended to the printer file; otherwise, if the printer is out-of-order, a 0 is appended. After a long time, we'll have a series of 0's and 1's in this file for each printer. If we count up the total number of 1's and divide by the total number of both 0's and 1's, it will tell us how much of the time the printer has been available. I also have a file that tracks only the date and time -- the rows of these files should match up perfectly, so we should also be able to find out how much of the time this printer has been available since date/time X.
- Consolidated code for shell scripts with arrays and for loops -- changed filenames to match the names of the printers (i.e. jrc_email instead of just jrc... I learned my lesson on this one)
- Consolidated the out-of-order statistics and made things a lot easier to search through. Currently, the file oo_stats keeps track of the current day's out-of-order info; at 12:02 AM the next day (just to make sure the other scripts have all done their business on the hour), that file is moved to the old_stats directory and its name is changed to the previous day's date (i.e. the date the statistics are for). Then, a new oo_stats file is created to keep track of that day's statistics. But another cool thing happens -- in the old_stats directory, there's a file called 'list_of_days' that keeps a list of the files in the directory (since the files are named for the dates they represent, it's both a list of files and dates, with the filenames corresponding to the dates). oo_stats.php then reads through this file line by line, creating a link to archives.php, sending the date along and retrieving the correct file information. All around, probably the coolest thing I've done on the map -- I'll have to work on it a bit more, but it's looking promising
- For checklabs.php, I made something similar to what Google does with their search for the "Did you mean Y?" (as opposed to the word they typed, X). I just made the word a link, and then I have the link refresh the page and present the information as the user wants it to appear. I also have a section for the user to indicate that that word is NOT what he meant, and I have options to "Search Again" (which takes him back to index.php on the fourth tab) or "View a list of all software" (which takes him to the list of software...)
- I finally got the map to check lab and printer open statuses against the DB. Basically, if you look in the hours_worked table, each shift has a start time and an end time. If the TC is still clocked in to a lab, a start time exists for the shift, but the end time is NULL. This is a very easy way to check if a TC is still clocked in -- after that, we just find out the corresponding lab and we're ready to rock and roll.
- Moved to OO programming for labs.php and printers.php. I create Lab and Printer objects, each with certain "state" (is that the correct term in php?), gather them into an array, and loop through them to consolidate code
- Added link from Google Code page to map and vice versa
- Changed CSS to have consistent names with printer names, just as the files do
- Cleaned up CSS by grouping properties, similar to the OO idea of inheritance
- Added a neat script to check the file in /var/www/map that's most recently modified and store the date in a file; then, in the "revised" meta information in the header of index.php, I read the date from file. Therefore, this gets updated dynamically!
- Separated Lab and Printer objects into objects.php
- Created init.php to hold important constants and variables
- Added info to classes.php, objects.php, labs.php and printers.php to check to see if a lab or printer is always available
- Added CCL3_BW, Changed HELPDESK and INSLAB over to HELPDESK2 and INSLAB2
- Added a check for AV1 and LAZIER to make sure they don't display toner info (they have nothing to display, but...)
- Allowed users to sort toner information
- Separated content in /var/www/map into folders
- Made script to separate old oo_stats into folders by year and month
- Also called order_oostats.sh from mv_oostats.sh so that once we're done moving, we can order. Makes more sense this way
- Made IE7 stylesheet... finally!
- Added "Reply-To" header for bash scripts, so that people won't e-mail satherdy@tcdb.grinnell.edu.
Have yet to see if this works, though... IT WORKS
- Changed oo_stats stuff to match the directory structure, so that you can traverse directories to look for specific out-of-order files. Pretty shnazzy formatting, too.
- Also sorted by file modification time so that we get the months sorted by date (instead of their default, alphabetically)
- Added "Feedback/Report a Bug" tab
- Added paper.sh to check for paper outs and jams, and had printers.php reflect that on the map, marking the printer as unavailable with a nice little status message about what's up
- Changed 24 hour time on lab search to real-people time
- Added a part on the Feedback tab for a source download -- also added a script to redirect users through a php script that counts the number of times people go to access the script. I can make this a little bit better by adding one script each for source file (i.e. one for tarball and one for ZIP), but it works alright for now. If a Helpdesker is logged in, he can see how many times the source has been downloaded
- Added JavaScript to search.php to toggle certain elements based on user choice -- added questions for software, number of computers, and Macs or PCs?
- On search.php, I added a script to get information on what day it currently is and display the day on which users are searching to be chronological in order and to start with "Today" and "Tomorrow"
- Added labels for big buildings to campus image, as per the request of [kresjaja].
Will do 3D stuff in Google Sketchup soon DONE
- Added a check for maintenance script outages... still haven't done the e-mail stuff as we do with the toner, though
- Since IE8 is relatively standards compliant now, the CSS I was serving IE browsers actually messed it up (in a strange twist of fate!). So I changed the "comment" for IE to <-- [if lte IE 7]> so that IE 8 should work fine... still waiting to hear back from K Svez to see if it works on IE 8 WORKS
- Created nice jQuery popups for links at the top... still working on popups for labs
- Changed campus map to include 3D text for buildings
- Added HOLIDAY check for the open labs/printers strings at the bottom of the respective tabs to read "Unless otherwise noted, labs/printers are closed for break"
- Added changing URLs on click of tabs... still looking at how to get back to that tab once you navigate away from the page and go back
- Got available computer stuff set up for the CCL!
- Added separate scripts for Kevin Engel and Sheryl Bissen
What I'd like the map to do:
ARCHIVING -- all of our archiving should be consistent (i.e. do we want to archive into folders by month or simply include the date in the file name?)
- We should have a script to archive the toner files after, say, 1000% lines, or after 1 week, or something like that.
- Have scripts to archive any file that gets arbitrarily large in size
Archive the old oo_stats files by week, month, etc. (What's an easy way to look through the files after we archive them, though?) I need a shell script that generates folders each time there's a new week, month, year,DONE and then code the php to look through each of those folders, set permissions accordingly, and have users view them
TONER
TONER LEVELS
- For the printer toner level under "General Info", only present info about the printers that are open. We should create an array from the start to determine this (i.e. retrieve open data status from file, set data to array, then use that array throughout code
TONER/OO E-MAILS
For the toner e-mails-- if it's from 8:00-17:00 (there's no HD2 after 17:00), the e-mails should be sent to the HD DONE. Micah and myself are also CC'd; otherwise, if it's the library, for instance, the script should e-mail the person who's working the IIF/Burling shift (we can retrieve this information through the database), or e-mail me or something so I can replace the toner... we can finagle this one a bit to make sure we get it right enough (they should probably always be cc'd to Micah and myself anyway, so no worries). Check out http://www.adminschoice.com/docs/crontab.htm
- We should also figure out what to do during breaks, or, rather, when none of the labs are staffed. This gets back to the whole static/dynamic determination -- I could write an extremely long crontab that takes into account the breaks for the next five years and simply not send toner e-mails, OR we could figure out what to do in case X, case Y, and case Z. That is, toner e-mails should be sent to the person staffing the lab, but if no one is staffing the lab, the e-mails should be sent to the Helpdesk; if no one is staffing the Helpdesk at a certain point in time (which should never really happen anyway), the toner e-mails should be sent to Micah and I.
- For the person whom we should e-mail, we should set an $email variable that is the result of a MySQL query... have an array of printers corresponding to labs... once we know which printer is out of toner, find the corresponding lab, then find the corresponding lab ID; once we know the lab ID, look up a shift for which the end time is NULL (i.e. where a TC is still on duty) that matches the lab ID (if there is no matching shift, e-mail the HD, Micah, and I... but only if someone is on duty at the HD. If no one is staffing the HD, e-mail just Micah and I). Once we've found the appropriate shift, get the user ID of the TC staffing the lab, and look in the users table to find his or her e-mail. That should be stored in the $email variable, and then an e-mail should be sent to that person.
- Some TCs also might not have access to the toner cabinet, especially during times at which the HD is not open... this should mostly be done only for the library
- For each OO e-mail file that is OFF, write the name of that printer to file, caps the name, and send in an e-mail every day with other info as a reminder to turn the e-mails back on, if necessary.
- Change toner e-mails based on toner trends
- If it's a Friday afternoon and a printer has 2% toner left, we should change the toner since it will likely run out over the weekend
- Even during the weekdays, if based on previous trends a printer is likely to run out of toner that night, we should replace it before 17:00 that day
- We need to find out how fast a toner cartridge drops 1%, on average, and at what times these shifts are more dramatic
- Are there certain levels that drop faster (i.e. does it take less time on average to go from 20% to 19% than from 2% to 1%)? This is more a function of HP's representation of the somewhat abstract concept of a "toner level", which is not really our problem, but we should try to account for it
- We can either weight our average in some way, or...
- Just look at the most important averages, i.e. the average rate of change from, say, 5% to 1%
- Also, are there times of day during which the toner runs out faster, or times of the week, for instance
- Does this change semester-to-semester? It certainly changes from printer to printer
- There should also be some added buffer during midsems, hell week, and finals, just to make sure toner gets to the right place at the right time
- Also for the toner e-mails, Micah and I should receive e-mails after Helpdesk hours, but if we just don't have the time to get to them, we should be able to send an e-mail like "I'll get it tomorrow". Then, TCDB can parse the e-mail to see if it includes the word "tomorrow, no, later, hell no", etc. and then stop sending e-mails accordingly. Otherwise, we'll probably get to it. These e-mails should also stop at midnight... Osgood's sleep initiative and everything : )
- Send OO e-mails to HD only when a printer has been out-of-order at least two hours in a row, unless there's a sever error where we know something is wrong
- Put printer model in toner e-mail, where it reads... "Grab a 4350 cartridge and..."
- We could find a regexp to read the printer model from something... or even do some telnet action... I'll figure it out when I get to this part
- If a printer is projected to run out of toner anytime before 8am the
next day or over the weekend, we should send an e-mail at the start of
the shift of the last HD2, or of the closer if he or she has a mentee
and they both clock in (this is essential), so that someone can replace
the toner. The same should be done for paper, once we get that working
LABS/PRINTERS
- Finish hover elements (I'd also like to make them transition from transparent to solid in a short time frame (check out the first example here: http://www.alistapart.com/articles/sprites2 , the fadein/fadeout would definitely require JS, though, but maybe you could steal their fade script and add it to OverLib?)... could make it a bit more sexy...)
I'll definitely look into adding that to the hover element... I feel like I should really learn javascript before I attempt this [ds] . Used CSS hover elements instead-- seems to have some strange effects on IE7, but that can be fixed by serving IE7 users a new stylesheet
- There are a couple labs (on in the JRC and the helpdesk) where the hover box shows up below the image. Is this just an IE7 issue? YES I would try to separate the z-indexes by a lot. Maybe use 20-50 for the icons and 60-90 for the hover elements where the first lab would have the image at 20 and hover at 60, second lab 21 and 61, etc.
- Things to include in hover element:
Name of lab
Location of lab (also include link to "video tour" [see below] )
- Lab phone number
Current TC on duty? (we can talk about this one-- not at all necessary, just more of a quirk) (for historical reasons/problems, I don't think this should be on there [ds])
- Picture of lab
Printer information (i.e. name of printer, paper and toner levels, how to connect to the printer [link to wiki page Help.NetworkPrinting] ) -- THIS SHOULD BE DONE ON PRINTER MAP
You could do the paper and toner levels by looking through the index page of each printer (i.e for helpdesk, helpdesk.grinnell.edu), parse the page for the specific thing we're looking for (i.e. "Toner level"/ "Paper", then simply print the number that follows it. This would have to involve regular expressions, so I'd better get to work in learning how to use them!
Paper also doesn't have a number, so we'll have to see how to take care of this
Since these levels don't change *much" (well, unless someone prints off a billion pages), you could even do a wget or curl on the index page and parse it locally, as opposed to actually parsing the page on its own; you could download the page again every 10 minutes or so, alternating which pages you download and parse when to take the load off TCDB (there's got to be a simpler way to do this...)
- Anything else? I want to keep this part pretty simple...
- Should we center the hover element or keep it floating above the lab? -- the popups on the jQuery main page are absolutely beautiful; I would love to have something like that
- Have users be able to sort printers list...
Alphabetically
By toner level
- By building
- Geographically
- Color/BW
I should look more into the jQuery tabs (which I use on the page) to find out how to make tab 3 active once a user clicks on the "sort" button. As I have it now, when the page refreshes, tab 1 is reactivated, which shows the map, not the list of printers (I think I can just have it redirect the user to tcdb/map/#tab3)
- Check the <title> tag in index.php for how this works
- By number of estimated pages remaining with toner
As for out-of-order printers, there's no way I can think of to determine whether or not a printer is simply offline or if it's out-of-commission. BUT, I'm trying to implement a low-key login system to allow for Micah, the Helpdesk, and myself to be able to login and change the messages these printers display, stopping the toner/out-of-order e-mails in the process. Therefore, we would be able to log in and change the message from "Norris is out-of-order" to "Norris is out-of-order and should be back online by Wednesday", then have a checkbox that asks "Stop out-of-order e-mails?" DONE
All of this would require that we have scripts to change files on the server, which may be a high security risk for TCDB. I'll put PHP security at the top of my reading list... Not too much of a security risk, since it's all 0's and 1's really, or information that I make public to begin with, like the historical out-of-order statistics
- On a similar note, the "Out-of-order" icon should read something like "X printer is out-of-order. The Helpdesk has been notified and is working to resolve the issue." Once a printer gets to 1% toner, it should read the same thing...
- On the other hand, be able to mark a printer as unavailable if it isn't showing up that way (i.e. if it still shows up as open, we should have the option to change the CSS to show it as closed, changing the message it displays, as well; basically, we should have the ability to change everything but where it shows up on the map, which is fixed)
Check if a user is logged in and display stuff accordingly (I think I can do this with sessions...)
I'd imagine the page will look somewhat different once you log in... that is, I'd like the text boxes that normally appear on mouse-over to appear automatically, and have the messages in an editable text box. Whatever changes we make to the text boxes, we can write that to the file as xhtml and it will change the message for a normal user. Rock and roll! Also, I should have a checkbox under each textbox to say "stop sending e-mails?" or "Would you like to stop sending out-of-order e-mails?" DONE
- On another note, getting the paper status shouldn't be too much harder than getting the toner status. It'll just require more/bigger files (i.e. either helpdesk_tray_1 , helpdesk_tray_2 , or helpdesk_paper with "Tray 1: Empty , Tray 2: OK". This will take a while, though, and I'm in no rush...
- This information is not available on all printers. It is on HELPDESK2 and GENCOMP2, though, so I can try those as a test run
- objects.php -- set up open statuses based on holidays
- Also fix holiday hours stuff to make it near enough perfect (library, Gencomp, for instance...)
- At this point, once a printer is at 1% toner, the message says that "The Helpdesk has been notified and will replace the toner soon". But if it's after hours, the Helpdesk isn't notified; therefore, if it's after 5:00pm and a printer runs out of toner (which shouldn't be a problem soon after we figure out how to avoid toner outages), we should instead print a message about netprinters and what printers are available (this can be done with a quick conditional on whether or not the Helpdesk is open... bamm!)
- For the paper jam/outs stuff, since we check that stuff every 10 minutes, it would be a bit excessive to send an e-mail immediately to the HD, but if it happens for one hour, we might want to check the printer, since people may not know to e-mail the HD. This doesn't relate to the map, but we should also probably have signs in labs showing people how to fix paper jams (with pictures) and who to call if the lab is out of paper.
- If a printer if unavailable, that trumps everything -- but the way printers.php checks, a printer shows up as out-of-order before anything. We should change that...
- If a lab is closed, display a message about when it will be open next
- We should also include a list about when labs are open during normal hours. We could even generate stats on how well TCs do staffing labs (i.e. percent coverage over time), a bit like our out-of-order stats
- Display out-of-paper and jam messages on General Info tab, as well
- For each individual lab map, show all the computers, whether or not a computer is in use, and which OS the computer is booted into at the time, but we also want to show which OSs are available on a given computer
- Mark RW had a brilliant idea -- when a HD'er goes to replace paper in a lab, we know how many reams we take out (usually a box's worth, or somewhere around 10 reams). We also know how many pieces of paper are in a ream (500 sheets). Therefore, we can simply enter the number of reams we take out and then count the number of pages printed (I believe this is possible). Then, when we get down to about 1 ream (this should depend on what time of day it is, and how fast on average a printer runs out of paper [therefore, we should keep paper stats, as well]), the HD should get an e-mail asking them to replace the paper; once we do, simply repeat the process.
- This could be even sexier, and require less HD effort, if it was automated in an e-mail reply feature, where the HD'er simply replied with something like, "I replaced the printer with 5 reams". Then, based on the subject (e.g. "The paper in READ2 needs to be replaced"), exim would receive the mail on the server and a script would run to automatically find the (a) Printer name and (b) number of reams got from regexp by parsing for a number in the response text. Same thing happens there. Rinse, repeat, decrement until it runs out again...
- Need to create an out-of-order message for "500 Internal Error" on printers
- Add e-mail script for maintenance kit outages
- For checklabs.php, we should provide a map of what's open and where you can find stuff, as opposed to the normal list
- Maybe a map with a darker overlay, but with lighter circles above the labs that are open... we could make it very nice
AVAILABLE COMPUTERS
- Check to see how many available computers are in a given lab (i.e. number of computers - number of computers people to which people are currently logged on). This may be of some use for the Windows domain: http://www.unixwiz.net/tools/nbtscan.html . For the MathLAN, this may help: http://thomas.cs.grinnell.edu:8080/ . I've e-mailed Tim Miller to ask him about how he designed the MathLAN users list. He may be able to help me implement a design of my own for this page.
- When determining the number of available computers, we should also determine the OS (we can have an OS specific message like, "MAC L0gon Succ3ssfu1"), so that we can say, "There are N available Macs in the CCL and M available PCs"
I was reading through some notes from my Internet Computing class about HTTP Applications... came across something interesting --
If we use CGI processes on the TCDB, I could pass a GET request to it and it could make things a lot easier...
For the login script...
#!/bin/bash
(sleep 3; echo "GET /cgi/
comp_on.cgi?lab=gencomp HTTP/1.1") | telnet tcdb.grinnell.edu 80
exit 0
(Do I also need newline characters after the GET request, or will it terminate automatically?)
And for the logout script...
#!/bin/bash
(sleep 3; echo "GET /cgi/
comp_off.cgi?lab=gencomp HTTP/1.1") | telnet tcdb.grinnell.edu 80
exit 0
In my lecture notes, they talk about CGI as being tough to use and outdated, but I think this is exactly what I want... I'll have to see
Anyway, the CGI process will then parse the query_string for the lab, then add or take away the number of available computers from that lab. Basically, I think it should
write a number to the "gencomp" file, which should be 1 more than whatever number is currently there. Therefore, the number starts out at 0 in the morning (maybe
we could have a script that does
#!/bin/bash
for each file in available_comps directory...
echo "0"
exit 0
at around 7:30am...
Then, for the
comp_on script, it should add one, like so...
read contents of file, store read number in a variable
add 1 to the number, overwriting contents of file
The
comp_off script should simply subtract one, instead
The benefits of this are...We don't have to parse the server logs every X minutes... the requests are automatically taken care of
The code should be a lot cleaner and easier to read, and there should be a lot less code, as well
This will be easier to make modular... that way we should be able to handle any request (i.e. based on the name of the variable in the query_string
[here, "lab"], we should be able to write data to any number of different files; if we wanted to do stuff with printers or other agents later, perhaps we could... this is a minor issue but still something to consider)
We could also do a C/C++/Java script that uses the Winsock library
2009-02-24
Technically, I should use POST as the type of HTTP Request, since my program effects a change on the server (as per the HTTP specifications)
This shouldn't be too hard to fix, should just be able to add some \r\n to the $http_request variables
Final (?) Mac Script:
#!/bin/bash
(sleep 3; echo "GET /map/cgi/available_comps.php?id=$(hostname -s)&comp_on=TRUE&type=mac") | telnet tcdb.grinnell.edu 80
exit 0
Final(?) Windows script:
#!/usr/bin/env perl
use Net::Telnet;
use Sys::Hostname;
# Get hostname
$hostname = hostname();
# Initiate telnet connection on port 80, send "$hostname" as HTTP request
$telnet = new Net::Telnet (Port=> 80);
$telnet->open('tcdb.grinnell.edu');
$http_request = "GET /map/cgi/available_comps.php?id=$hostname&comp_on=TRUE&type=pc";
$telnet->print($http_request);
- We should also have a script to check for PC IDs that are not assigned to any place -- that is, I'll be doing a physical mapping of each PC ID/Mac ID to its corresponding lab and location. But if ITS replaces a computer, it'll have a new PC ID, so we'll have to re-do the physical mapping and replace the old PC ID to the new one.
- We should also have a report that generates a list of PC IDs that haven't checked in in a while, so we can see where the new computers might be hiding. We can also just get the information about the new computer from KBOX, as well... but we should make it as KBOX independent as possible
- What if someone hard shuts down a computer? The logout script will never run... . The alternative would be having a script that runs every 5 minutes or so and checks in with the server, but that would be excessive. We'll just have to hope that users logout when they leave...
- We could also have something that resets the used_computers count to 0 once a lab closes
- We should keep track of how long a computer is being used for (logout time - login time); then, we can tabulate the data for all the campus computers and do a color spectrum or something (see http://www.graphic-design.com/Photoshop/color_cast/color_wheel.jpg) for the computers being used a lot vs. those not use a lot. I'd like this to look like a thermal image of some kind...
- In doing the imaging, we should see the range of times we're working with. So look at the computer with the most use and the computer with the least use, then subtract the values to get a range in which we can apply the use -> color mapping.
- I'd also like to get a smooth transition effect going. So instead of having just a dot for each computer, we could instead have the color start at a certain point on the map, then extend a certain range, but outside of that range we should have the colors blend across the given distance. But we should also try to limit the color from extending too far from a given lab, across Mac field, say. So the color should be isolated in the lab, but still emanate to get a glowing effect
- We should use a magnified campus image from the Sketchup model that's at more of a bird's eye view
LAB SEARCH
- Have a search box that allows you to search for a given piece of software... i.e. say it's 1:00am and you want to know which labs have ChemDraw... the search box would pass the information to a script that parses the regular expression to account for spaces, capitalization, etc., then tell you all the open labs that have the software; if it can't find any open labs, it should generate a list of labs that do have the software and when they are open (reference http://www.grinnell.edu/its/labsoft/ ) -- Refer to http://www.php.net/manual/en/function.levenshtein.php for help on making this simple
We should also have a list for users to reference DONE. I use the levenshtein algorithm to parse the string, then present the user with an alternative. But I should really make it like Google where it still displays results for the closest match, as opposed to just making them click the link for what they meant
- For the list of software, KBOX has reports we can use (CSV format... we can parse the list)
- Each lab object should have an array of software through which we can search (for lab_search.php), which we can get from the KBOX reports
- For checklabs.php, if a lab is scheduled to be open (i.e. if the shift is both taken and not up for sub [does TCDB have all of this info?]), we should show it as open. Should this be in a php/perl script... it might be nice to do perl and store info in DB
- Add Linux to the list of available OSs...
GEOGRAPHICAL
- More IP address stuff; If the first two blocks of the IP address is are not 132.161, notify the user that he is not on campus. For off-campus users, we should be able to have them choose their location and direct them from there (or just show them a more detailed map of the location)
- I also feel that this isn't completely necessary. Off-campus students (juniors and seniors) should likely know where the computer labs on campus are
- For the IP address checks...
- First, check if a user is on campus
- If the user isn't, don't present any IP specific info
- First, we should probably have an $on_campus variable (boolean) to determine whether or not we should present on-campus specific info
- Also, what about people living off campus? Is there an easy way to account for that and give them directions accordingly?
- If the user is on campus, check to see what dorm the user is in and present IP specific info for them
- We should store the IP address/subnet as a variable from the start so we can use it throughout
- If I can't find any IP address info, I should just let the user choose his or her dorm
STATISTICS
- Track usage patterns in labs (does this have any predictive power? Use stats/calc to find trends)
- Most of the graphing stuff can be done simply by passing information stored in variables to a url a la
<?php // Google chart stuff
$hsize = 250 ;
$vsize = 100 ;
$chart_type = 'p3' ;
print "<p><a href=\"http://chart.apis.google.com/chart?
chs=$hsize
x$vsize
&chd=t:60,40
&cht=$chart_type
&chl=Hello|World\">Google Chart</a></p>";
?>
- I wonder if you could also use telnet to talk to the printers who have java applets on their status pages in order to get printer info about them (i.e. toner levels, etc.)
- Also, check out this: http://pchart.sourceforge.net/
- For the historical printer info...
Have an easy way to search http://tcdb.grinnell.edu/map/oo_stats.php
By date, hour, month, printer, etc...
- DONE, for the most part... I still have two problems
- Track aggregate statistics. What's the long term availability of printers? -- sort of done on an individual level, but I'd like to have more stats on this
- Also, how do we account for when labs that contain printers are closed and the closer turns the printer off (a la SCILIB)? The printer will show up as out-of-order, but it should.
- Same sort of thing -- access the DB, check to see if lab is open, mark out-of-order or not out-of-order accordingly I think this is done, but I should check -- we still have trouble with SCILIB
- Make graphs of data (see above) -- it'd be nice to do this for each lab (I can write data to more than one file), and present a nice chart when you hover above a lab... maybe that's overkill
- For the historical out-of-order stats, indicate what labs are closed to make the stats more complete, as in
On Sat 15 Nov 2008 03:01:01 PM CST
18 out of the 18 public printers were available
SCILIB was closed
- Make all of these stats available in human-readable and XML format
GENERAL PHP STUFF
- Should I cast my variable types or use === ?
- Be consistent in naming variables (with respect to registered globals)
- Look into extract() function
- It would be really cool to have the page title change based on the current tab id
- Should I use a sticky form on the username field for login.php?
- Maybe I should provide an alternate way of storing sessions if the user has cookies turned off in his or her browser
- Follow each header() function with exit();
- Also see p. 237 of php book for how to make header Location code portable
- I can also pass values in these HTTP headers using the GET method trick
- I should look into locking some of the files that TCs are editing, such as the lab messages. I don't want to see what happens when two TCs write data to a file at the same time... but it would certainly be interesting to find out!
- I need to do more with PHP functions that use directories... that would make my life easier and my code easier to read
- Find out what happens if the scripts I include are missing -- what happens then?
- For the e-mails from [techmap] that tell us if the status message changes or if the OO e-mails were turned off, it sends both e-mails, even if just one thing was changed. This should be fixed so it sends only the appropritate e-mail
- Maybe for the status message, we can see if the message changed and then send an e-mail if it did
- md5? String equals function?
- Should the instance fields of our classes be public if we inlcude getter/setter methods?
- PHP to change resolution of map on lower resolution monitors
- Will really need to use JavaScript for this, then pass that info to PHP
- Use switch conditional to figure out why things are out-of-order or closed
- Use switch more in general for any variable that could be a lot of things...
LOGIN SYSTEM
- For the admin interface, Micah and I should be able to add printers (and labs...) easily. What does this need to be able to do?
- Edit CSS to add position (wouldn't it be cool to allow you to move the icon to the place you wanted it, and then the relative positioning for the CSS generated automatically? I'll look into it...)
- Basically, what I imagine is a drag-and-drop interface... you upload an image, drag it to the place you want, and drop it there. Then, once you set the position, a script automatically generates the appropriate CSS for the image location. Then you should be able to name the printer, etc., and it creates a lab object right there for ya. How to set it all up to be consistent among printer models will be the tough part
- Add Printer/Lab object
- Create file, write appropriate default data to file
- Give access to the setter methods in the login system -- we should be able to change all aspects of a printer/lab from the interface as well as from the code
- We should also be able to add users (look into how TCDB does this) who are not TCs (people on STAC, for instance, should have some measure of control over the ops of the map)
- As an admin, can I require that I provide both a password and an private key via upload? That would be pretty BA
- Give users the option to create a profile. Therefore, is you'd like to only see certain printers, you can set it up that way. Or, if you'd like to get an e-mail when a certain lab opens up, when a certain number of computers become available, or when a certain piece of software becomes available, you can do all of that.
- Make an interface to change lab info/ create new lab/printer -- this means we can move data into the DB and and use a for loop for our objects, really cutting down on our code
SCRIPTING/LINUX STUFF
- Log wget errors with -o flag, unless we move to Perl for all of this...
DATABASE STUFF -- After the historical data tracking and user interface, this stuff should be a priority!
- Optimizing MySQL queries : http://linuxformat.co.uk/wiki/index.php/PHP_-_Optimising_MySQL_queries
- Include a way to search for a lab based on given criteria... (we can file this under "Lab Search," as well)
- Location (based on subnet)
- Printer/no printer (shouldn't be much of an issue, as pretty much every lab has a printer [is there one that doesn't?] ...)
- Scanner/no scanner
- Whether or not there's a TC on duty
- Does the Lab have Macs/PCs/Linux machines?
- Number of available computers (see above)
- For the above, we could indicate all of this in the database
- Check user input for the changing of status messages, for completeness and security's sake -- i.e. sanitize
- Synch the login system with TCDB, and move over to HTTPS
- In checklabs.php, I still rely on the old, static code for determining when labs should be open. Instead, what I should do is to take the date and time which the user provides, translate it into TCDB time (i.e. 20 should become 20:00:00), then to a mysql_query to determine if there is a shift scheduled for that time. There are some lab hours that will never change, like Scilib and Gencomp, for instance, but overall this should be done with DB consultation.
- The DB query should partly take care of this, but I should also have a $holiday boolean variable (well, it should also be a constant to be used throughout!) that indicates when we have a break
- There's an issue with the open_labs.php script, since it relies on the last TC clocking out of the lab which he or she staffs. If the TC doesn't, the lab looks like it's open on the map when it really isn't. Therefore, to keep with the conservative philosophy of the map, we should mark the lab as closed two hours after the last shift began, unless a TC marks it as open (Micah and I should receive an e-mail when it is marked as open). I call this the closed until proven open philosophy. So for each lab on the map, we need a way to mark it as closed/open...
- To figure out if a shift is a last shift in a given lab...
(Is there a way to figure out when data is written to the DB, or to a specific table, and
only then execute a script?)
Get the shift start_time from the hours_worked table in the DB, as well as the lab id. Then, look in the shifts table and see if there is a shift in the same lab for which the start_time is >= the start_time of that shift. If there is a shift that fits the criterion, do nothing, since it IS NOT the last shift. Otherwise, if we can't find a shift that has a start_time >= the start_time of the current shift, then it IS the last shift. once we know that, we should write the start_time of the current shift + 2 hrs to file (which should be the presumed end_time of the current shift). But we should only do this once (if we kept writing the time to file, we'd never reach the end_time!). To ensure we only do this once, we should start with empty files for each lab, then see if the file is empty...
(I don't want to do this with php, but here is the code...)
if (!(empty($closing_time_file))) {
// If the file is not empty, we've already written data to it, so we don't need to do anything
}
else {
// Open file pointer, write time + 7200 sec. to file
fwrite($fp, "time + 7200");
}
This should be done for each lab. Then, if the time written to file is less than the current time, the lab should be marked as closed (unless, of course, the TC on duty wants to mark it as open)
if ($current_date_time > $file_date_time) {
$open_status = FALSE;
}
Now, to create an interface for each lab, first check to see if the login cookie is set...
if (isset($_COOKIE['logon'])) {
well, I guess before that, we should have a set of variables that point to the open_status files. Perhaps we can keep this data in open_labs.php...
After we've determined the open status of a lab, do a quick foreach loop...
$array_of_open_statuses = array ($lab_a => $open_status_a, ...,
$lab_n => $open_status_n)
foreach ($array_of_open_statuses as $lab => $open_status) {
$fp = file("$HOME/labs/${"{$lab}_open_status"});
// If the open status is true, write a "1" to file
if ($open_status) {
fwrite ($fp, "1");
}
else {
// Otherwise, write a "0" to file
fwrite ($fp, "0");
}
}
On a side note, we should keep the variables in open_labs.php to be determined by the files, not the other way around. Technically, we could have a shell (or Java, Perl, Python?) script that performs a MySQL query every 5 minutes or so, writes data to a file, and then have the variables in open_labs.php determined from that
Then, in labs.php, check to see if $open_status is true and have a checkbox just like for the printer e-mails. And just as with the printers, have a php file to handle the form and change the status accordingly, redirecting you right back to index.php. Then, after having changed the file, open_labs.php will read from the file, see the change, and change the open_status of the lab accordingly
- Some labs will have classes in the lab during a given time (Science Lab, Gencomp, CCL, etc.) -- therefore, if we can pull data from wa2.grinnell.edu about the "Meeting Information" (i.e. where a class is meeting)... we can do something like this
foreach $lab where Location == "Science, Room 1530" (we can do a quick regexp to parse for this info)
{
find class time;
mark lab as closed during class time;
}
GRAPHICS/DESIGN STUFF
- GIMP Tutorials : http://creatingdrew.com/2008/08/10-fantastic-gimp-specific-tutorials/
- This one could be cool : if we had a Google sketchup of the entire campus, we could make a set of videos (screencasts, really), taking users through a tour of how to get to a given computer lab based on his or her current location (from subnet); therefore, if a user was in Norris and wanted to know how to get to the Science lab, we could get the Google sketchup map, navigate through it while recording the screencast (to give the impression of first-person movement) from Norris to the Science lab. You wouldn't have to draw the inside of every building, either, just the relevant parts. It could be amazingly cool, even though it would take quite a bit of work...
- There are a lot of problems with it, but I at least have a google sketchup file of all the buildings that I made. Scale is a real problem, but I can send it your way if you want. - Mark
- We could have a google sketchup of each lab, with the corresponding PCs and Macs and if they are available or not... would ITS have an issue with this? Everything remains anonymous on this stuff, anyway... the MathLAN map is the real kicker when it comes to lack of anonymity [ds]
Add 3D text to the Sketchup file for building labels: http://www.sketchucation.com/?p=1273
ADMINISTRATIVE STUFF
- Offer language support
- I can do this based on country or on choice
- Perhaps, if someone is viewing the web page outside of English speaking countries, I can have a welcome page asking if the user would like to view the page in English or in their native language (also offer support for other languages of choice)
- Make php dependency map a la http://t3.dotgnu.info/blog/tags/inclued/ and http://www.graphviz.org/
- Make page on open-source philosophy, indicate that everything on the page was made using open-source technology, as much as possible
- I'd like to also have a page that lists the features of the map, how it works, and
a link to the source code for download (tar.gz), a la TCDB
- I have a tar.gz source code package on Google code, but I'd like to have this done dynamically every time there's an update to the map. That is, each time a file is added or modified, a shell script should notice that and package the source code up
- We can make a page similar to what the TCDB admins once had, packaging the contents of /var/www/map and putting it up on our own page.
- Finish documenting code
- Learn jQuery: http://docs.jquery.com/Tutorials
- Make code more portable (i.e. as with $HOME shell variable in shell scripts)
- Along with this, I should look into making the printer code more portable. Right now, it works great for our HP printers, but if another Uni wants to use this, they'll likely have to implement an entirely different system. Therefore, I should really look into a standard like Telnet to talk to printers in order to get the appropriate information.
- Furthermore, I should separate the portable code from the Grinnell-specific code; then, explain how the Grinnell specific code works and provide some idea of how to port it to a specific Uni's system
Also set SITE (http://tcdb.grinnell.edu/map), ADMIN (satherdy), ADMIN_EMAIL (satherdy@grinnell.edu), and HOLIDAY (FALSE, by default) constants. All of these constants can go in a file that we include at the beginning
- As I think about it more, some things are going to be very difficult to make portable (i.e. TCDB code for whether or not a lab should be open, etc.). I'll just have to do my best...
- XML newsfeeds: http://www.mtdev.com/2002/09/add-xml-news-feeds-to-your-site
- Should look into RSS instead of doing e-mails
- Maybe people can get an e-mail when toner gets to a lab, like, "it looks like this printer is out-of-toner, but you'll get an e-mail automatically once toner becomes available", or when a certain number of computers become available in a lab
- I should add a bunch of debugging features into the code, like so...
$debug = FALSE;
if ($debug) {
print "yada yada yada";
}
Just change $debug to TRUE and it'll make the code a lot easier to maintain
And since we'll have a lot of debug messages, they should explain themselves very well, like "The $helpdesk_open variable is set to open, so both the Helpdesk and HELPDESK should show up as open"
Perhaps I can separate the debugging based on what needs to be debugged...
- Look into delineating levels of access control. What should Micah and I have access to that other TCs don't, if anything? Perhaps other non-TCs should even have access to certain things...
- Beef up the login system (HTTPS!)
- Write up a small history/motivation for the map
- Also, write up something to show other colleges why this might be useful
- I should also look for how to handle exceptions that may occur... what happens if something breaks down, if a file gets too big, if a script stops working, if data isn't written to a file... this will be a big project... I mainly just need to reduce the interdependency of the scripts
- Follow the principle of orthogonality
- Make a SITE MAP
- Check out yslow : http://developer.yahoo.com/yslow
- Make a [techmap] account/plan
- Like jobs, et al., people should be able to edit the plan to submit ideas
- But, this should only be available to users on campus. I'm seeing a bit of IP address finagling in the near future...
- People should be able to install certain features and not install certain features when porting the map
- What is required and what is fluff?
- What is Grinnell specific and what is not?
- Is wireless coverage pretty global across campus? Are there places that aren't covered? Would it be worth it to make a wireless map?
- Check out Phing: http://phing.info/trac/
http://immike.net/blog/2007/08/15/5-tools-every-php-programmer-should-know-about/ - In init.php, I should have the variables take data from the DB.
That way I can have a web interface to update all that stuff in the DB
and the variables will cascade throughout the scripts accordingly...
shell access is sweet, but my successor may not feel the same way
- Add a v2.0 image at the end of summer
XHTML/CSS/Javascript CHANGES
Make text dynamically resizable in CSS (http://www.useit.com/alertbox/9605.html) Frankly, this doesn't look good. I might sacrifice some accessibility issues, but maybe I can have my cake and eat it, too. That is, I currently have the font set fairly small, but could a browser resize that text without it being relative? I know you can do Ctrl + on FF, for instance, to zoom in, but then you can't see the map very well... I will work on this
- Use newlines and tabs to clean up HTML
- Make separate stylesheet for IE7 users
- Use more client-side scripting to reduce page load time
- But, we should also have appropriate fallbacks (for instance, if the user has Javascript disabled, what do we do?)
- Should we use Javascript or something else, instead? Look into AJAX, too!
- Well, I should also do more with client-side code, writing data to files and having PHP read from that. I'm trying to do too much with my PHP!
- Also look into using DOM
- Separate PHP and XHTML as much as possible
- Use CSS image... this might be done already
- Make an easy fallback for users who have JavaScript turned off... make it look nice
- Make a mobile stylesheet
- We can use the AJAX autocomplete feature to make searching for labs easier
- Also look into DHTML techniques
- Use JavaScript to dynamically generate time counter (i.e. you can see the time progressing on page, as opposed to having to refresh the page).
- This is a smaller issue, but maybe we could also have the page refresh the labs if the visitor happens to go to the page at 23:59:59 and the map says that Scilab is open, for instance. This is totally not necessary, but could be cool all the same
- I believe we could do this with AJAX, and this would be a good time for me to learn JavaScript and AJAX to get it done...
- Also focus on AJAX for...
- Login/Logout
- Printer sort
- Dynamically updating open statuses
- Drag/drop interface
- Other stuff?
- What if the user has Javascript disabled?
- The way it is now, the images just cascade down the screen when JavaScript is turned off. I should provide a better alternative
JavaScript obfuscation for e-mail addresses - Found a better way -- with CSS!
- Smoothscroll? http://davidwalsh.name/smooth-scroll-mootools
- I wouldn't need this for the mainpage, obviously, but rather for the descriptions, out-of-order stuff, etc.
- Check this scrollto stuff out! http://demos.flesler.com/jquery/scrollTo/
- LavaLamp! http://www.gmarwaha.com/blog/category/client-side/jquery/
- Fade/Transition stuff
- Pop-up windows that are sexy: http://www.ericmmartin.com/simplemodal/
- Sexy checkboxes: http://kawika.org/jquery/checkbox/
- Can we style other buttons, too? http://www.appelsiini.net/projects/filestyle
- CSS Sticky footer: http://ryanfait.com/sticky-footer/
- CSS curves!
OTHER STUFF (DREAMS)
- Set up a web service that talks to a small client program on a user's computer (if the user wishes to download said program); it feeds the program raw info about lab openings, toner levels, etc. (and dynamically, too... this would basically be a local version of what is on the map). The web service could also track trends in lab usage and determine what is the best time for a group project, etc.). It would be fun to code...
- Try to keep track of other printer makes and models and see if we can keep repos of scripts that work for more of them
TEST IN MULTIPLE BROWSERS
Browsers tested:
- FF3 (Linux, Windows XP) -- when you hover over an element, the "alt" tag does not appear (If you print the same text in title="" as well, it'll show up). This shouldn't matter when we get the hover elements set up, but we'll see...
- IE7 (Windows XP) -- the open/closed icons are just a *bit* off from what I'd like them to be... this can be fixed by passing a different stylesheet to IE7 users. Also, the popups have strange effects, like when you hover over the science lab, the popup text goes below the Science library element. I originally had this problem in FF, as well, but that's because I was using z-indices where I shouldn't have been. IE7 still acts as though there are z-indices, but only on some of the labs (the pop-up for Noyce 2401/2402, for instance, doesn't have this problem)
- This seems to be a problem for only the labs that have different icons (HD, AV, MathLAN). BUT, to complicate things, everything works just fine in Firefox. What's different about those labs besides the fact that the icon is different? I tried changing a lot of the CSS to see if that worked, but I got nothing
- IE6 (Windows XP) --
Amazingly, I don't see any problems... The CSS is rendered horribly in IE6... but that'll take some more effort to fix
- Safari 3.1 (Windows XP, Mac OS X) -- Looks pretty good
- FF2 (renders a few things differently from FF3 but I don't have it on my computer anymore)...
- Iceweasel (Linux) -- Hovering over tabs doesn't work, you have to click on them. Everything else is great though.
- Google Chrome (Windows XP) -- no known issues
ACCESSIBILITY ISSUES -- I should make Accessibility a major focus, for this map and for future projects
OTHER ISSUES
- Printers say they're out-of-order under the "General Information" tab when they really might not be. I do four checks to see if a printer is out-of-order on check_level.sh, so why not do the four checks here? I have to strike a balance between being conservative and being correct with the information
- On a side note, I think I should only display the toner information for printers that are currently available under the "General Info" tab. That would make things a bit more clear
- On oo_stats.php, I don't think it's properly displaying the printers that are out-of-order/available. I should check this out...
- Are the out-of-order e-mails working?
- php includes produce whitespace at the beginning of the files...
THOUGHTS FROM MARK (Integrate this into the doc if you like, sort it some way else, or just leave it here)
- I'm pretty sure that I built that map over the campus map, so with a transformation or two, I think you could get them to overlay if you wanted to. It could be kind of sweet to allow someone to rollover a link that would trigger a 50% transparency version of that map over the current one. This could especially be useful if you were to label all the buildings on the campus map with their names and not just AD,KF, etc. (It would be especially awesome to do this, and I'll look into transition effects some more).
Now I'm getting picky: it is at least a little annoying that the map is not on the first viewable portion of the page frame (and I have a large monitor)... I would thoroughly recommend finding a way to move the map up to as close to the top of the page as possible. We'll see.
I definitely agree with this one -- I can make the padding on the header a bit smaller on the vertical end, and take away some of the information in the "main" <div> element (i.e. some of the text). That should help things a bit. I certainly think if a user is visiting the page to see the labs we have open currently, they should see the map first, as they probably know what day and time it is (or, if they don't, would they really care?). [ds] I removed everything I could, and added the tabs up top -- let me know if this works for you now YES, looks great!
- Also, the page is too wide right now. If I set my browser to display at 1024x768, I have to do some
vertical (vertical or horizontal?) (HORIZONTAL, my bad) scrolling. I think we could get around this by a) not defining the header in cm but instead 1024px. b)cropping the left side to the southern-most part of Bucksbaum c) cropping the right side to the shadow of Norris.
STUFF THAT'S DONE
BETA period: Should have a form to input a date and time to check whether or not the times are ok
Should have both a section to show labs currently open and a section to show labs open at a given time (thanks Mark) Done, but the script that checks the labs at a time provided by the user is broken. Will have to fix that. FIXED
Add Noyce 2402/2403 and JRC e-mail kiosks -- since JRC e-mail kiosks are not real computers, I feel like they should be added to the printers map, but not the labs map (Seconded)
Fix Library hours
Add script to check whether or not a lab is open, add that lab to a string variable, and print the result
Add map with printers
Along with the above printer map, we should add a set of tabs to switch between maps (computer labs, printers, etc.), using AJAX or something similar
Change map image to [rootwile]'s design
Duerer is always available -- need to change that on map (thanks Alex)
Verify XHTML Strict 1.0 and CSS
We could also track toner data to see how fast printers are running out of toner (on average, on certain days, etc.)
Create tcdb/map_test for production/testing purposes (this will be more of an issue once people actually start using the map)
Separate array data into separate file (then use include() to call it in code)
I think the Helpdesk Icon should be different. Maybe a Gel-head doctor? I was pretty confused at first. I added an icon for a sick computer, but I'd like something better, and something which looks nicer (I added something which looks a bit nicer). I also changed the image of the MathLAN to Tux the penguin, since I feel like the MathLAN should also be visibly unique
It would be nice to have both the automatic loading with the current time AND the box to check other times (for instance if you're in a CS class and need to meet with people to do a lab).DONE, but the script doesn't quite work when I pass it the arguments... so I'll work on that
This makes me wonder a bit (and I may be going overboard), but should there also be a slightly different icon for 24 hours labs. It would be nice to know that quickly. Maybe a neon sign on a post saying "24 Hr" that takes it above the icon. I'd like to keep the map as simple as it can be, and I feel like this adds an unnecessary level of complexity. But we can see what other people think. (I also indicated whether a lab/printer is always open/always available, so hopefully that will clue users in).
If I enter "Sunday at 1pm" it shows one library lab as being open and the other as being closed. Is that right? I'm still working on the hours... once I get it linked to our database (and I've said this a lot throughout the document, which makes me think I should really check out some php/MySQL tutorials), it shouldn't be a problem
- Something that would be easy to do (but require another icon, sorry) would be adding the AV center. There might be one or two other things like that worth adding as well.Ah, yes, I can work on this too. I agree that the AV Center should also have a unique icon, but we should probably keep it at that
- I think I might license the map under creative commons. That wouldn't affect this, I just might want a mention added (I do mention you in the footer wrt the image, but yeah dude, license that puppy up! If I licensed the code under the GNU GPL, as well, it could be a match made in heaven...). I'll get back to you on that.
I'm willing to make any/all of the extra icons if needed. I found some icons from the Wikimedia Commons online
I should look into separating the php scripts to do all of this, as opposed to having everything in one big index file
If a printer is out of toner, display the red icon Burling is still having some issues, but aside from that it should work
Change "Click here to find out how" to "Check this out to find out how" (semantic observation only)
Allow users to resize text -- http://www.useit.com/alertbox/9605.html
Fix issue with Burling 1st/2nd and their respective availabilities -- this looks like it's actually fixed. I must have not had a lot of sleep when I was checking this earlier. I'll keep my eye on it...
Once we get everything up and running, it would be cool to have this licensed under an Open Source/GNU license of some sort and put up on Google Code
Check out subversion -- http://subversion.tigris.org/ , http://svnbook.red-bean.com/ Google Code uses SVN
Should also add "Estimated Pages Remaining" to the Lab Info, since that's a better estimate than pure toner level
- This will get confusing for users, as it doesn't display the number of pages of paper in the printer, but rather the number of estimated pages you can print with the available toner. I'm taking it off for now, but we can use it later if users want to see this information
Create an alternate script to check on printer availabilty based on pings (I wonder if ping has an exit code that would be easy to check; for instance, if the pings are successful, the printer is available; otherwise, the printer isn't available. If wget isn't able to retrieve the info, then it's probably not available, but what about the printers with java applets on their status pages?
From the ping man page: "If ping does not receive any reply packets at all it will exit with
code 1. If a packet count and deadline are both specified, and fewer
than count packets are received by the time the deadline has arrived,
it will also exit with code 1. On other error it exits with code 2.
Otherwise it exits with code 0. This makes it possible to use the exit
code to see if a host is alive or not."
# This script checks whether or not a printer responds to pings. If it does, echo 0 to the printer status file (printer is OK-- 0 is for NOT out-of-order); else echo 1 (printer is out-of-order)
[[ ping gencomp.grinnell.edu -c 4 ]]
if [ `echo $?` == 0 ]
then
echo 0 > gencomp_status
else
echo 1 > gencomp_status
echo "You should check its status page at http://gencomp.grinnell.edu or see if it responds to pings" | mail -s "The Gencomp printer may be out-of-order" helpdesk@grinnell.edu -c satherdy@grinnell.edu,botmille@grinnell.edu
...
Consolidate shell script code in foreach loops, change file name accordingly
Get INSLAB, GENCOMP, and ESCHER toner levels on map -- done with shell script stuff, just need to implement it with php
exit 0
Then, we can include a check in printers.php to see if X_printer_status contains a 0 or a 1. That will determine which icon to display
For printer availability stats, if a printer is out-of-order in some capacity, we could have the shell script write some data to a file saying "printer $X was out-of-order at date/time()". The results of that file could be sent to me every day and we could check out what's up
Make scripts more portable with things like $HOME instead of /home/satherdy
Add out-of-order checks for printers that can't get toner info
I should also write a script to archive any files that reach an arbitrary size -- that way, things don't get out of control DONE
For checklabs.php, I should have something similar to what Google does with their search for the "Did you mean Y?" (as opposed to the word they typed, X). It shouldn't be hard at all -- just have to make the word a link, and then have the link refresh the page and present the information as the user wants it to appear. We should also have a section for the user to indicate that that word is NOT what he meant, and have options to "Search Again" (which should take him back to index.php on the fourth tab) or "View a list of all software" (which should take him to the list of software...)
Consolidate certain functions into functions.php
Finish GENCOMP, INSLAB, and ESCHER stuff on printers.php DONE, I think
lab_info.php has gotten so long that it stretches down and over the text of the footer -- should make the text smaller (this is also only an issue with the fact that I use relative text size)
- Changed text to 11px all around... may change it back to relative size; have to weigh the costs and benefits
On checklabs.php, I need to have it forward the date and time data once a user clicks on the link to choose the word that the levenshtein algorithm thought they meant
- The script currently checks the times based on what I've provided in the code. This is ok, but not for every lab. It really should check against a set of constant times (for instance, Gencomp and Inslab should stay open throughout the day, even if a shift isn't covered, so those times will never change), as well as check against a set of times that fluctuate based on whether or not a TC is there (for instance, if no one takes the 22:00-24:00 Scilab shift, the person leaving at 22:00 should probably close the lab). This can be accomplished by checking the database to see whether or not a sub is up for the shift, but what'd be EVEN cooler is to check whether or not there's a TC clocked in in the lab. That way, even if a TC decided to stay after hours (during exam week, for instance), the map would show the lab as open.
- I was thinking about how to accomplish this... I think the central point that should determine the open/closed status of a lab is whether or not a lab is currently staffed. Therefore, we have to answer a couple of questions...
- When a TC clocks in, how do we ensure that he she is clocking into the correct lab? That is, some TCs mistakenly choose Gencomp as the lab they're staffing, since its the first choice. How does TCDB check this? We could do it by IP address, as a secondary check...
- Where is this information stored in the DB?
- We can add a column of data to the "labs" table in the DB called "staffed", which would be a boolean-- the value should be TRUE if the lab is staffed and FALSE if the lab is not staffed
- But, if you have TC A and TC B, and TC B clocks in before TC A clocks out, the value will turn FALSE once TC A clocks out. How do we fix this? Is this the best way to go about solving the problem?
Switch to OOP?
- Also, once I have info in the DB about whether or not a lab is staffed, I will be able to easily cut down on lines and lines of code. Instead of having all these static hours in the code, I can just have something like
$helpdesk = mysql_query (yada yada yada) (where yada yada yada is the row and column in the DB, in the labs table, corresponding to the helpdesk open/closed status)
Then, once I have that variable defined for each lab, I can store all the labs in an array, then use a foreach loop to run through them...
[array here]
foreach ($labs as $lab_name => $staffed_status ) {
if ($staffed_status == 0) {
print code for closed lab
}
else {
print code for open lab
}
This is soooo much cleaner...
- We should also store the fact that labs are open/closed in a set of files to make it easy for shell scripts to read from them (well, you can actually read from a MySQL DB with a bash script: http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html#ss10.5 ; which way would be easier?)
Also, do I need the newline character after the text? I don't think so...
- No, we shouldn't have it, and I've removed it
- Need to put a link from map to Google code page and vice versa
- Should change CSS to have consistent naming scheme with printer names, just as most of the files do now. That way, if we ever need to loop through the names to generate HTML, it will be easy
- CSS "inheritance": http://dorward.me.uk/www/css/inheritance/
- We can use multiple classes to "group" properties, cutting down significantly on the code we have to use to do relative positioning of elements on the map
- Change Did you know that you can print to any of these printers from your room? to Did you know that you can print to any of these printers from your room?
Finish printers.php!
I might need to use stripslashes() on the message part... (stripslashes() is mostly for DBs...)
For every "the" in the $openlabs string, look into the str_to_lower() and ucwords() functions
Change header information... should make the date stuff dynamic
Separate Lab and Printer objects into objects.php
For the printers/labs that are always open, I should have a conditional check so that they say "Younker is always open" instead of just "Younker is open"
Maybe I can have an extra boolean value for the objects, like $always_open, to see if a lab should be open 24 hours or not...
print $lab->get_name() " is ";
if ($always_open) {
print "always";
}
" open";
Set up INSLAB2, CCL3_BW, HELPDESK2
Should add a file_exists() check for the toner files for printer like AV1 and LAZIER, since they show up as out-of-order
And if the file doesn't exit but the lab should still be open, a message like "no toner information can be retrieved for printer X" should appear instead of the toner level message
E-mail notifications for when certain things break?
For instance, the script to e-mail the Helpdesk when a printer gets low on toner should be extended to send e-mails when a printer is out of order, as well
"X printer may be out of order. You should check the status page to see what's up: X.grinnell.edu"
Separate content in /var/www/map into folders
Grab printer status from Device status page, see if a paper jam or out of paper message appears, and roll from there
- Paper out: TRAY 2 EMPTY PLAIN LETTER
- Paper jam: 13.12.00 JAM INSIDE REAR DOOR
- Change 24 hour time on lab search
For the out-of-paper stuff, we need
information about the number of available trays. We could set this
information staticly (i.e. read from individual files that tell us how
many trays a given printer has, which we could just create manually),
but a more elegant solution would be to grab this information from the
status page itself. This is easily done since the only time "Tray"
(case-sensitive) appears in the files is once for each tray. Therefore,
if we have one tray and an out-of-paper message appears, we know that
the printer is out-of-paper. But for printers that have more than one
tray, we know that the printer still has paper, but only one tray may
be out. I'm sure there's some sort of difference in the message, which
I can check on. The only other complication is that there are at least
two "trays" on each printer, one of which is a dummy tray to which you
can feed paper, but which no one ever fills. Therefore, we need to
subtract one from the count:
grep "Tray" $status_page | wc -l
and then pass out-of-order messages accordinglyHave a separate scilib.sh script to e-mail Kevin Engle when the
toner gets to 10% in SCILIB and ask if he has a cartridge or if he
needs us to bring one over
We actually don't need this info -- it's a lot easier. The message
changes when only one tray is out vs. when the entire printer is out,
so I just edited the paper.sh scriptOTHER ARCHIVED IDEAS
The above way would likely use up a lot of server reources on TCDB's end-- having to constantly run through an entire network to pull information from host computers would be a pain. My Internet Computing teacher thought of a better idea: have the hosts talk to you. With a batch/perl script or a cron job (depending on OS), you could have the computer send one message (simply "1", perhaps) when a user logs on. This message, however and to wherever it would be transmitted, would simply add to the count of used computers. To get the available number of computers in a lab, simply subtract the number of used computers from the total number of computers. When the user logs out, you could run the same batch script, except this time it would subtract 1 from the number of used computers.
"I'm going to ask you a bunch of questions, and I want to have them answered immediately" - Arnold S.
This sounds easy enough, and we could probably push something like this to all the computer labs via Kbox/Active Directory. BUT, there are a set of roadblocks, namely...
Will ITS agree to this? Even though this would send absolutely no information except 1's and -1's, they might have some issues with the script. I'm sure if we mention the words "send information from each computer to a server", someone would misinterpret the simplicity of the information exchange and put a hold on it. We have to talk to the right people (maybe Nate?)
- How is the information going to be transferred? There are a variety of ways we could try it, but
none of them are really satisfactory...
Connect to TCDB MySQL database-- this would have to be a database separate from the ones we use for TCDB (to eliminate the security concern of having information passed across the network) with separate tables/entries for each lab. I'm not sure you can connect to a MySQL database using a batch script, so we'd have to use something like perl or php to do this
Send e-mail-- can TCDB receive e-mail? You could take a given e-mail, parse it for the 1 or -1 and pass that to some function that calculates the number of computers. Could you delete the e-mail immediately after it is read and parsed? How much time would this take-- would it be efficient?
Send information in a small file?
- Send information over the network? How could we send simple packets of data and have TCDB receive them, then change the number of computers accordingly? This may be the simplest and most efficient way, but how to do it is the question... perhaps telnet?
I think so... we're learning about HTTP requests/responses, and I may be able to talk to the TCDB web server with telnet and post information; if TCDB receives it, then it should do something with it (namely, store data based on the request)
- YUP, telnet works. Follow the logic...
and secure). If you talk to the TDCB server on port 80, you can send any information you want in the form of an HTTP request and the web server can accept or reject the request as it
pleases. AND, the server also logs each request in /var/log/apache2/access_log-tcdb. Therefore, every request made in a web browser or otherwise shows up here. So if each host was able to
establish a telnet connection and send some uniquely identifiable piece of information like "L0gon Succ3ssfu1", we'd be able to parse the log for that phrase using grep. Therefore, if we were to
place a script on each lab machine that executes at runtime and sends that message, we could run a cron job on our server that parses the log every few minutes and finds any new logons...
Finding new logons will be the problem. I could utilize something like I did with finding new comments on the wiki... that may be the easiest way. Alternatively, if I could find a
way to check an entry each time data is written to the log (some kind of log monitor would have to be employed), that may also work, but I'm not sure if such a tool exists
I've created a symbolic link to the log file in my home directory; this way, I wont have to parse the command as root. Now, say that we had the script running on two machines with
IP addresses of 132.161.10.1 and 132.161.1.3. The TCDB server would log the requests, and we could write a shell script that looks something like...
grep -i "L0gon Succ3ssfu1" tcdb-access-log | awk '{split($1,a,"."); print a[3]}' >> in_subnets
which appends the output of the above command...
10
1
... to the file "in_subnets", 10 and 1 being the respective subnets on which the host computers reside. Now, we have this big list of subnets of computers on which the students are logged on,
and if each lab corresponds to a specific subnet (I will have to check into this one, and it may be too large an assumption), then we can parse the file "in_subnets" again using grep...
grep -c 10 in_subnets
grep -c 1 in_subnets
... which would both return 1 ("grep -c" returns the number of lines matching the given pattern). Even better, we could do something like...
printf "There are %d computers in use in the CCL\n" `grep -c 10 in_subnets`
printf "There are %d computers in use in Gencomp\n" `grep -c 1 in_subnets`
BUT, this still list will grow and grow, since we haven't done anything about when a user logs out. So we'd have to place a script on each host computer to execute at logout, as well;
it should do basically the same thing as the script does at logon, except this should send the message "L0g0ut Succ3ssfu1", instead. We can do the same apache log parsing to generate a count of
the "logged out" computers...
grep -i "L0g0ut Succ3ssfu1" tcdb-access-log | awk '{split($1,a,"."); print a[3]}' >> out_subnets
printf "%d people have logged out of computers in the CCL\n" `grep -c 10 in_subnets`
printf "%d people have logged out of computers in Gencomp\n" `grep -c 1 in_subnets`
Now let's look at the case where the same person who logged on to the computer in the CCL logged out. The file "in_subnets" would look like
10
1
and the file out_subnets would look like
10
For the next step, we can accomplish a lot in one fell swoop. If we know the total number of computers in a lab, we can find the number of available computers...
expr 24 - `comm -3 in_subnets out_subnets | grep -c 1` > gencomp
This evaluates the difference in the total number of computers (24, in this case) and the expression within the back-ticks; this expression first takes the files in_subnets and out_subnets and,
with the -3 flag, prints essentially what the files have in common. Therefore, in the above example, with in_subnets as
10
1
and out_subnets as
10
the first part of the expression would evaluate to 1, since that is the only part present in both files. We can parse this for the number of times 1 appears in the output by piping it
to "grep -c 1", then writing that to a file with the name of the lab. We can FINALLY have a php script that reads the content of the individual files when the user requests that
from the campus lab map page
// Displays number of available computers in CCL
$ccl = file ('/home/satherdy/computers/ccl');
print "The CCL has $ccl[0] available computers";
// Wash, Rinse, Repeat for each lab
Whew! I hope this works!
TO DO: if the files in_subnets and out_subnets are the same (i.e. at the end of each night, they should be, since everyone who logged on should have also logged off), we can
do something like...
echo > in_subnets && echo > out_subnets
... destroying the content of the files so they don't get too big, then have the process start over in the morning
Here's the UNIX script:
#!/bin/bash
(sleep 3; echo "L0gon Succ3ssfu1") | telnet tcdb.grinnell.edu 80
exit 0
... which should does work on Macs. Tim Miller also gave me the idea to use Python, which may prove useful on a Windows platform...
OR, I could write a Java program that works on any OS (for both the client and server side) ! I might look into this more... it would
be useful to use Java so it could work on any client or server platform. As much as I like bash, it would be good to have a Java alternative
It might also be good to look into SOAP and WSDL to set up a web service... completely unnecessary, but cool all the same
OR