Technology

From Wiki2
Revision as of 17:30, 1 July 2010 by 98.217.194.133 (talk)

log

5/20/10

=ImportHtml("http://en.wikipedia.org/wiki/Demographics_of_India"; "table";4). This function returns demographic information for the population of India.

5/15/10

  • move everything to serve /forms/quiz wiki2db, db2xml, gloss2db glossdb2quizlet
  • /quiz/glossary2db /vocab/2quizlet/glossdb2quizlet
  • to DROP VIEW badview use command line: phpmyadmin thinks views are tables,
  • mysql --user=pathbost_tim --password=nji9ol pathbost_assess

5/2/10 - now turn quiz xml into eggcode and wiki code using xsl

5/1/10

4/23-25/10 - working on moving wikiquizzes to db /code/quiz/wiki2db.html and ,php

SELECT quiz.tname, quiz.unit, questions.question, qanswers.answer, qanswers.iscorrect
FROM quiz
LEFT JOIN questions ON quiz.tid = questions.tid
LEFT JOIN qanswers ON questions.qid = qanswers.qid

  • am filling the database, 2quizzes in mamp db, ready to pull to xml
  • https://www.ohloh.net/ timmck gmail 6j
  • you can't really move wuff quizzes unless you disable .htaccess
  • LOG ERRORS: MAC: sudo tail -f /Applications/MAMP/logs/php-error.log SERVER sudo tail -f /var/logs/php-error.log
  • firePHP enabled IT HAS TO BE CHECKED, ob_start(); HAS TO BE THERE Sobe video has to be off
  • forum http://www.firephp.org/HQ/Support/Community.htm gmail 6j timmck

todo

4/12/10


2/5/10

  • to see changes in xsl stylesheet change its name and the reference to it in the .js page.

1/18/10

12/31/09


  • create an editable grid with multiple records
    • then make it selectable for certain words or submitters
  • output select words into an:
    • eggquiz
    • quizlet
    • wikipage
  • autocomp word entry

there is a book on Ajax in pdf in code

autocompl
have put up autocompl for voacab database in http://pathboston.com/vocab/autocomp
grid
http://pathboston.com/vocab/grid/ has code to get from vocab xml file to web To see the data generated by the server, make a simple call to http://pathboston.com/vocab/grid/grid.php?action=FEED_GRID_PAGE&page=1

electronics

quizlet export -> csv2sql ->mysql

http://pathboston.com/ajax/csv2sql.php runs the conversion which gets uploaded through phpmyadmin

visualthesaurus vocgrabber to db

11/19 - vocab from vocabgrabber a javascript that you run with an article open in the browser that you want to grab then you select the words you want and save the list.

javascript:var%20_vgurl='http://www.visualthesaurus.com';%20var%20s=document.createElement('script');s.src=_vgurl+'/vocabgrabber/bookmarklet.js';document.getElementsByTagName('head')[0].appendChild(s);%20void(0);

http://pathboston.com/vocab/grab/vocabgrab.html goes to the visualthesuarus list page and parses the word and usage into arrays, looks up the definition

ubuntu

chromium

mediawiki

mailto:mediawiki-l@lists.wikimedia.org

bot

mediawiki API
creating a bot
login bot (MrMcKenna bh)
append21.html (gets error badtoken)

Trying to send stuff to api.php to append to a page. Eventually I want to append to the main page of all users. First I'll us a POST form then I'll try multiple POSTS without a form using this snippet


http://www.linux.com/archive/feature/54334

bulk import to users

http://pathboston.com/forms/bulk.html then from terminal ssh'd to pathboston.com

cd public_html/hum310/maintenance/
php importUserSubpage.php --title test

will put a page with that title on each user page

Don't transclude especially not sources:biblio

tesseract-ocr

to OCR an image

  1. open ~/Applications/ControlCenter.sh, use custom scan toBWtiff
  2. get it on screen (big) and 'file/grab' it or take a snapshot of it
  3. saveas 'j' nocompress, noalpha, TIFF
  4. open a terminal and run ocrjtif (it is in $PATH in /opt/sbin) and then copy and paste the ocr'd text from the terminal window.

quiz authoring environments

http://escholarship.bc.edu/jtla/vol4/6/

http://www.attotron.com/pub/quizmaker.html

http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcexam_description

http://www.bridgewater.edu/~rbowman/JSQuizMaker/makeselftest-questions.html

http://www.extropia.com/

vocab

http://wise.sourceforge.net/ http://xdxf.revdanica.com/down/index.php

web development

vocab grid

actual function

init by creating a drop down box
return an array of article names -get articles.php
on submit send source choice to server
return a page of data

development version

init by creating a drop down box
return an array of article names -get articles.php
on submit send source choice to server
return a message


http://www.w3schools.com/sitemap/sitemap_tutorials.asp

http://www.tonymarston.net/php-mysql/sample-application.html

http://www.w3schools.com/PHP/php_ajax_database.asp

csv2sql converter on pathboston.com

http://style-sheet.info/

http://www.computorcompanion.com/LPMArticle.asp?ID=202

javascript

http://www.daaq.net/old/javascript/ javascript tutorial

http://www.javascript-coder.com/javascript-form/javascript-get-form.htm

css

http://css.maxdesign.com.au/index.htm

web development using ajax

xslt

http://www.tonymarston.net/php-mysql/client-side-xslt.html

http://www.developer.com/xml/article.php/3630526/JavaScript-XSLT-Support-in-Firefox

http://www.xmlfiles.com/xsl/xsl_client.asp

Oreilly XSLT book

XSLT tutorial

_SESSION variables

The problem with having stuff happen on the server is that it always forgets what is going on from moment to moment. The server waits for a request, it could be from anywhere in the world. It doesn't know you from a whole in the wall. The only thing you can do to be remembered is stick stuff in _SESSION variables.

ajax

Asynchronous Javascript and XML(XSL) is a way to update just the part of a html page that changes instead of redrawing the whole page. AJAX combines languages like html, javascript, php, sql, xml and xsl.

historically

There are a number of mechanisms used to combine them.

  • You call an HTML page and it displays
  • You call an PHP page and it displays
  • You call an HTML page and it calls a PHP page which gets combined and displays
  • You call an HTML or PHP page and it calls a javascript page which gets combined and displays

ajax does all this

  • You call an HTML page that includes a javascript page that responds to events by sending some action to PHP on the server which then instantiates a class and calls class methods some of which access a MYSQL database using SQL and then puts the results in a XML container which gets sent back to the browser then gets interpreted into XHTML by an XSL file and gets injected into some location in the page.

breaking it down

to check what's going on at the server

Send some stuff: http://pathboston.com/vocab/grid2/test/test.php?action=CHANGE_SOURCE&source=NFLhistory and get the XML back.

to check the XSL

Create a file of the XML that will be coming back from the server and then include an XSL file and see how it does.

simple bang bang browser to server to browser to server to browser

Call for data. Select from that data to query

getting around a XSL page using javascript

ex: You want to update a database based upon what is in some text fields. How do you find the name/value pairs that you want to send to the server? The construct document.forms.grid_form_id has some elements? What are its elements?
innerHTML

a complex example form the AJAX boook

index.html includes grid.js which replaces the

portion of the html page. (also loads the grid.css)

grid.js initializes creating a xmlhttp request object loading a XSL stylesheet and page1 of the grid

FEED_GRID_PAGE To create page 1 of the grid has to create a URL query = grid.php?action=FEED_GRID_PAGE&page=1 and then send that query to the server by opening the request object with the query - xmlHttp.open("GET", query, true);

The script running in the browser acts once the data comes back from the server. When the readyState property changes to 4, the xmlhttp.onreadystatechange handleGridPageLoad() function will be executed. It gets the data sent back from a server using the xmlhttp.responseText property to get the xml data. The (previosly loaded) xsl stylesheet loads the XML putting it in xmlResponse=stylesheetDoc.load(xmlHttp.responseXML)

The XML is transformed to HTML and put in page = xsltProcessor.transformToFragment(xmlResponse, document);

Meanwhile to replace the gridDiv from the index.html page we've got to get the ID and put the html in there:

var gridDiv = document.getElementById(gridDivId); gridDiv.innerHTML = ""; gridDiv.appendChild(page);


meanwhile at the server...

The server just sits there waiting to do shit getting its instructions to grid.php. Grid.php takes some 'action' and then echos shit back to the browser.

The actions can be FEED_GRID_PAGE or UPDATE_ROW or DELETE_ROW.

FEED_GRID_PAGE calls the grid-class function read page and it creates the key-value pairs of the XML and puts them in in a variable that comes back as getGridXML()

The whole show runs out of the grid.xsl file which has certain live buttons that respond to "on click" events. The xsl has a menu template sitting on top of and below a table. The table has heading then a foreach row section.

The loadGridPage() function is whenever you hit previous page and next page.

EditID() is called when you click on a particular row's "edit" link. The first parameter is some unique ID which seems to be assigned for the "tr" element right after foreeach statement. It is set equal to the database ID value for the record. The function on the first time through has edit as "true" and it replaces the inner html with input boxes and update,cancel and delete buttons. The Cancel button calls editID again this time has edit as false and just displays the row data.

The update button appears when the input boxes are drawn and when clicked it calls the updateRow() which puts together a url query ?action=UPDATE_ROW&id=" + id completing it with createUpdateUrl(grid).

In createUpdateUrl(grid), grid is from document.forms.grid_form_id and document.forms.grid_form_id.elements[i].name and value pairs are added to the url query.

Update row finishes by sending off the query to grid.php and waits for the reply. It uses: xmlHttp.open("GET", query, true); xmlHttp.onreadystatechange = handleUpdatingRow; xmlHttp.send(null);

I suppose you could edit any record in the database just by sending it something like: http://pathboston.cpm/vocab/grid2/grid.php?action=UPDATE_ROW&id=224&word=covert&def=sneaky&usage=you_are_covert

All the server (grid.php) sends back is a number, if it is -1 everything is cool and edit mode is turned off and the screen is redrawn with new values by calling editID(id,false).


<source lang="php"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> AJAX Grid [bar] [foo] [ant]

This is a version using msqli and adding an OOclass to handle wuff

frog

duck

antelope
</source> XSL tutorial

http://www.smallbizonline.co.uk/php_session_variables.php

http://roshanbh.com.np

http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html

xml and db

http://www.rpbourret.com/xml/XMLAndDatabases.htm

What techniques have you tried already? With java, there are 2 main ways of reading XML documents:

1. DOM - Document Object Model interface. This loads the XML document into main memory. With the Document Object Model, you can build documents, navigate their structure, and add, modify, or delete elements and content. Basically the DOM specifies an abstract datatype for XML logical structure. In Java the API for this is known as JAXP

http://java.sun.com/j2se/1.5.0/docs/...e-summary.html

An example of reading in a doc could be:

Expand|Select|Wrap|Line Numbers

  1. public void readDoc() {
  2.   try {
  3.  
  4.    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  5.    DocumentBuilder builder = factory.newDocumentBuilder();
  6.    doc = builder.parse( new File("myXMLFile.xml") );
  7.  
  8.   }
  9.   catch (FactoryConfigurationError fce){
 10.     System.err.println("Could not create DocumentBuilderFactory");
 11.   }
 12.   catch (ParserConfigurationException pce) { 
 13.     System.out.println("Could not locate a JAXP parser"); 
 14.   }
 15.   catch (SAXException se) {
 16.     System.out.println("XML file is not well-formed.");
 17.   }
 18.   catch (IOException ioe) { 
 19.     System.out.println(
 20.     "Due to an IOException, the parser could not read the XML file"
 21.     ); 
 22.   }
 23. }
 24.  

doc is the object which holds the xml document in.

obviously you'd need to import all relevant packages etc.

Expand|Select|Wrap|Line Numbers

  1.  
  2. import javax.xml.parsers.DocumentBuilder;
  3. import javax.xml.parsers.DocumentBuilderFactory;
  4. import javax.xml.parsers.FactoryConfigurationError;
  5. import javax.xml.parsers.ParserConfigurationException;
  6.  
  7. import org.xml.sax.SAXException;
  8. import org.xml.sax.SAXParseException;
  9.  
 10. import java.io.File;
 11. import java.io.IOException;
 12.  
 13. import org.w3c.dom.*;
 14.  
 15.  

2. The second way in java is to use the SAXP API, which doesn't load the XML file into memory. This is quicker than JAXP, and is useful when you know the structure of the xml file isn't going to change etc.

http://java.sun.com/j2se/1.5.0/docs/...SAXParser.html

Finally, to send it to mySQL, you need to open a connection String to the mySQL database, and then run whatever queries you want. You can use a system ODBC driver, or Sun's own JDBC driver if you haven't got the first one.

This isn't comprehensive, but should give you enough to start.....

mharrison Reply

xp pro

CD KEY:

V2C47-MK7JD-3R89F-D2KXW-VPK3J

firefox extensions

/Applications/Firefox.app/Contents/MacOS/firefox-bin --profilemanager

/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev &


http://lifehacker.com/software/programming/how-to-build-a-firefox-extension-264490.php

unix

php

good class tutorial

http://www.weberdev.com/Manuals/PHP/function.get-meta-tags.html

authentication script http://sitebuilt.net/w/index.php?title=Comp&action=edit&section=9

/*multi-dimensional arrays */
$a = array();
$a[0][0] = "a";
$a[0][1] = "b";
$a[1][0] = "y";
$a[1][1] = "z";

$firephp->log($a, 'nearrtest');

perl

handy code

remove blank lines from file

perl -wnl -e 'print $_ unless /^$/' infile.txt >outfile.txt

sed awk

regex

sites

expressions

If you want to get'Aloha World'out

Input:

Hello World
Aloha World
Hey There

RegEx:

  \<div\sclass\=\"somename\"\>(?<Text>.*?)\<\/div\>

Yields:

Aloha World (note: In a single group named Text)


  • [1-9]\. //finds all the line numbers. (replace with #)
  • [A-E]\. //find A. etc (replace with ##)


to clean special characters from a string

$clean = preg_replace("/^[^a-z0-9]?(.*?)[^a-z0-9]?$/i", "$1", $text);

mycode

file:///Users/teacher/code/

/hosted/vocab/quiz/db2egg.php
uses multidimensional arrays
does sorting

msaccess/excel

http://support.microsoft.com/?kbid=208840

http://www.thescripts.com/forum/thread546932.html

http://www.blueclaw-db.com/mail_rtf_report_access.htm
http://forums.aspfree.com/microsoft-access-help-18/ms-access-email-report-19094.html
emailing reports

http://support.microsoft.com/kb/319317 printing to particular printer

http://www.vertex42.com/ExcelArticles/user-defined-functions.html

http://www.contextures.com/xlToolbar02.html

http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm

http://www.techonthenet.com/excel/formulas/index_vba.php


online tools

http://www.sitebuilt.net/moodle/course/view.php?id=2&edit=1&sesskey=zsCDYluKen http://www.sitebuilt.net/moodle/course/mod.php?id=2&section=0&sesskey=zsCDYluKen&add=quiz

Ari's phone: 011 237 529-4438 calling card:

  • 18008872991
  • 617

installedMACtools

pic

http://www.rentron.com/Myke3.htm

http://www.play-hookey.com/digital/jk_nand_flip-flop.html

http://www.digital-diy.net/16F%20Examples/LM35DZ.aspx

open source circuits wiki

sparkfun hobby shop

batchpcb.com pcb fabrication

AVR is alternative to PIC

a good tutorial on embedded systems

Google any of these for more info. I have chosen the ATmega168 as the learning IC of choice. Why?
  • 20 MIPs (million instructions per second!) is powerful enough to do some really cool projects
  • It's cheap! $2.13 currently
  • It's got all the goodies under the hood (UART, SPI, I2C, ADC, internal osc, PWM, kitchen sink, etc)
  • 16K of program memory is enough for almost any beginner project
  • The tools are free! (C compilers for many of the other micros cost a lot of money)
  • The programming and debugging tools are low cost ($20 will get you started)

evil mad scientist on AVR programming

isp

host 206.71.150.94

http://www.networksolutions.com/whois/index.jsp

http://www.namecheap.com/myaccount/index.asp mckennatim nanj

https://thenynocportal.com/clientarea.php

text a photo to picasa

text it to your and then forward it without the tmobile gifs then forward it to mckenna.tim.upload@picasaweb.com

making transparent in gimp

1. open image

2. Right click the image and go to LAYERS then ADD ALPHA CHANNEL. You won't notice anything happening, but don't be concerned. It basically adds a transparent layer at the bottom of your image so when we erase the colors.....it's shows the transparent layer. Which of course would show whatever was under it on the screen.

3. Right click on the image again and go to SELECT and then down to BY COLOR. A window that is all black opens up. Don't change any of the settings....just use the defaults for now.

4. Now click on the color in the image you want to be transparent. These colors will now show up outlined.

5. Right click on the image again and go to EDIT and then down to CLEAR. This should now erase the outlined color you just picked from the image and the "transparent gimp checkerbox" should show through. This is the Gimps way of showing you that section is now transparent.

6. Right click on the image and choose SAVE AS and make sure to save as a GIF file if you want the transparency to work on the web.

embedding video

  1. find the file Sanitizer.php in the folder /includes of your mediawiki installation
  2. find the function removeHTMLtags in that file. below that you’ll find a list of whitelisted HTML tags. add the tag embed to the list.
  3. find the function setupAttributeWhitelist in the same file. several lines below you will find HTML-attributes being whitelisted for each HTML tag. so you add a new line (maybe below the line that defines span):
     ‘embed’ => array( ’style’, ‘id’, ‘type’, ’src’, ‘width’, ‘height’ ),

take care to replace the typographic ‘-quotes by straight ones when doing copy&paste. (wordpress converts the quotes on this blog, so you need to convert them back.)

you’re done. now you can copy the HTML-code provided by google or youtube into your wiki textbox and it’ll work. (make sure to make backups and document so you know what you’ve changed. when upgrading you’ll have to repeat the process. no warranties for possibile security leaks resulting from the hack.)

update april 2007: i just tested, this hack also works with mediawiki 1.9.2, just that you need to add embed to $htmlpairs. (note: in case the embed-code you want to use has the format <embed /> you now have to convert it to <embed> </embed> before posting it to your wiki.) i also would recommend to paste the last line of code near br instead of span (the file has got rearranged a bit).

mediawiki memory problem

php.ini is in public_html, it has to be copied into everywhere that uses php left ini_set commented out in localsettins.php .htaccess php_mem ... didn't work

mediawiki upgrade

http://www.g-loaded.eu/2006/09/05/mediawiki-upgrade-procedure/ easy way:

  • goto maintainance directory and run php dumpBackup.php --current> dumfile.xml
  • on new site install wiki, put dumpfile.xml on its maintenance dir run php importDump.php dumfile.xml

mediawiki css

  • sitewide changes go in Mediawiki:Monobook.css
  • user changes go in User:MrMcKenna/monobook.css

lynx

Moving_from_shared_to_VPS