How to create a HTML tag, using an object of properties.
[code]$(‘#somediv’).append($(‘<a/>’, {href: ‘#’, id: ‘dothing’, text: ‘Do Thing’}));[/code]
You are currently browsing the archives for the Code category.
How to create a HTML tag, using an object of properties.
[code]$(‘#somediv’).append($(‘<a/>’, {href: ‘#’, id: ‘dothing’, text: ‘Do Thing’}));[/code]
Tags: Code, dom, html, javascript, jquery, object
Posted in Code | No Comments »
Here are some useful Javascript snips for working with form data.
How to get the name of the HTML tag for an element:
[code]this.nodeName.toLowerCase()[/code]
This code will see if we have a map set of inputs (somename[]):
[code]// See if we have a map here
var mapFound = 0;
if (thisName.indexOf(‘[]’) != -1) {
mapFound = 1;
thisName = thisName.replace(/[\[\]’]+/g, ”);
}[/code]
How to take a map of inputs and turn them into a Javascript map type var, and toss the empty ones:
[code]var map = $(thisName).map(function(){
if (this.value != ”) {
return this.value;
} else {
return null;
}
}).get();[/code]
Tags: form, html, javascript, jquery, programming
Posted in Code | No Comments »
Trolling around on the web, found a fun little process for generating animated GIFs: http://rarlindseysmash.com/posts/stupid-programmer-tricks-and-star-wars-gifs
Tags: animation, developer, gif, programming, python
Posted in Code | No Comments »
This week, I ran into a problem when I was profiling that didn’t seem to be very well documented anywhere. I was trying to profile a query that included a view. The error message that I got when I tried to execute my EXPLAIN was: “EXPLAIN/SHOW can not be issued; lacking privileges for underlying table”
After a lot of flailing out, me and the DBA for this project figured out that in order to be able to execute my EXPLAIN, I needed to have SELECT on the key columns that I was using in my query for the table behind the view. Simple enough, but not something made easy to figure out.
Hopefully this helps someone else figure this out faster.
Happy hunting!
Tags: database, dba, explain, mysql, permissions, profiling, query, sysadmin
Posted in Code, Systems | No Comments »
Every time I need to check out the last revision, I have to Google it. Here is how to check out the rev you want.
svn up -r 1000
Posted in Code, Systems | No Comments »