Feb
24
2012
So Apple released Mountain Lion, and everybody who cares on the interwebs knows that there is a shift with Xcode. (thanks MacRumors!) It’s now just an app like everything else. Cool.
BUT, this hoses other stuff in a pretty awesome way. Including my ability to run SproutCore Server locally. I’m sure ideally I’d have two dev machines, one dedicated to Mountain Lion, but sadly that’s not economically feasible.
Thus: my workaround to get sc-server working and not display a “No Matching Target” error. Its not pretty, and it may even be a terrible idea. But it worked for me. YMMV, don’t sue me if this wrecks your life.
- install sproutcore from the website
- install xcode, and make sure you download the command line tools from developer.apple.com while you’re at it.
- link /Developer to the xcode internal /Developer folder. I used:
sudo ln -s /Applications/Xcode.app/Contents/Developer /Developer
- cc is being looked for, but isn’t in that folder. I just linked it to gcc, because I was too lazy to find it. I cd’d into /Developer/usr/bin/ and did:
sudo ln gcc cc
- cd into your project and run sc-server. Should work!
- EDIT: make sure you install a Java Runtime if you plan to run sc-build. Otherwise your first one will fail
This is pretty hacky, and I’m quite certain there’s a better way to do it that will leave things less broken for the future. But hopefully it saves SOMEONE a headache. Or maybe just me, once Apple releases Beta 2 and it wipes out my hard drive again. C’est la vie.
no comments | posted in Javascript, OS X, SproutCore, Tips
Feb
4
2011
If you want to enable the “placeholder” attribute of input boxes in browsers that don’t support it, simply download this file, and include it anywhere on your page. It will copy the native functionality, and disable itself in browsers that already support the attribute.
This file will require a reasonably new version of jQuery to run correctly (and yes, it works in no-conflict mode).
jQuery.placeholder.1.0.1.min
Comments, questions? Feel free to comment.
NOTE: This project has been moved into github
3 comments | posted in Javascript, usability, Web Development
Mar
15
2010
So, for a while I’ve been looking for a ridiculously simple way to paginate data stored in a table. And while I love PHP, it just doesn’t come with some of the free things I take for granted in .Net
Today, while working on a pretty simple plugin, I wanted to add this functionality, and I didn’t want to waste a bunch of time. I was given a link to this great script: http://www.warkensoft.com/2009/12/paginated-navigation-bar/
It took me about a minute to implement the functionality. I then spent another 5 minutes doing CSS and that was it. Done. I’m not usually one for link sharing, but this made my life much easier. Hopefully it can make yours easier too.
The solution is pure PHP, no javascript required. Some day, I may try to expand upon this to include javascripty goodness, because that’s pretty much the only thing that could make it better
no comments | tags: HTML, internet, php, useful, Wordpress, work | posted in database, Javascript, php, Web Development, Wordpress
Jan
11
2010
//tell javascript to run a function in 1 second
setTimeout ("myFunction()", 1000 );
function myFunction(){
//do stuff
//once the function is finished, queue this function up to run again in 1 second
setTimeout ( "myFunction()", 1000 );
}
1 comment | tags: HTML, internet, Javascript, useful | posted in Javascript, Tips, usability, Web Development
Sep
12
2009
Google doesn’t make it easy to show you the latitude and longitude of an address you search in google maps, but there’s an easy way to get the info.
- go to google maps, type the address, and click search
- once you’ve found it, go to your address bar and clear what’s in it
- paste:
javascript:void(prompt('',gApplication.getMap().getCenter())); into the address bar
- use the coordinates for whatever you wish!
no comments | tags: HTML, internet, Javascript, useful, work | posted in Javascript, Tips, usability, Web Development
May
6
2009
So, wouldn’t it be user friendly, if when you went to a form page in a document, if the cursor was automagically positioned at the first field in the form?
Why, yes it would. Try:
Event.observe(window, 'load', function(){
try {
$('eventName').focus();
}
catch (e) {}
});
after your </form> tag. This requires the prototype javascript library
no comments | tags: internet, Javascript, useful, work | posted in Javascript, Tips, usability, Web Development
Apr
24
2009
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function duplicateField(field1, field2){
var theLength = document.getElementById(field1).value.length - 1;
var theString = document.getElementById(field1).value;
for(var i=0; i < theString.length-1; i++){
if(theString.charAt(i) == " "){
theString = setCharAt(theString, i, "_");
}
}
document.getElementById(field2).style.color = "#c9c9c9";
document.getElementById(field2).value = theString;
}
function setCharAt(str,index,chr) {
if(index > str.length-1) return str;
return str.substr(0,index) + chr + str.substr(index+1);
}
function changeColorBack(fieldName){
document.getElementById(fieldName).style.color = "#000000";
}
</script>
</head>
<body>
<p>
<input id="field1" onkeyup="duplicateField('field1', 'field2');" type="text" />
</p>
<p><br />
<input id="field2" type="text" onfocus="changeColorBack('field2');" /><br />
</p>
<p>
<span id="span1"></span>
<input id="submitButton" type="submit" value="Submit" />
</p>
</body>
</html>
no comments | tags: HTML, internet, Javascript, Wordpress | posted in Javascript, Web Development, Wordpress