Assuming the SQL file is an export of one database :
cat MyFile.sql | mysql -u MyUser -p'MyPassword' MyDatabase
Note the absence of space between the -p option and the password.
Assuming the SQL file is an export of one database :
cat MyFile.sql | mysql -u MyUser -p'MyPassword' MyDatabase
Note the absence of space between the -p option and the password.
Quick and dirty, but way better than nothing !
CodeMirror.defineMode("tpl", function() {
return {
token: function(stream) {
var ch = stream.next();
if (ch == '{') {
if (stream.peek() == '$') {
// Variable
stream.skipTo('}');
stream.next();
return 'smarty_variable';
} else if (stream.peek() == '*') {
// Comment
stream.skipTo('}');
stream.next();
return 'smarty_comment';
} else {
// Logic
stream.skipTo('}');
stream.next();
return 'smarty_logic';
}
}
}
};
});
CodeMirror.defineMIME("text/tpl", "tpl");
Ever wished to define a function that will only execute once, twice, or just a dozen times, even if it’s called a thousand times ? – A disposable function, if you will.
It is not smart performance-wise to use with Events, always prefer removeEvent which is cleaner, but in a lot of other cases it can be useful.
Behold, the power of BIC ! Just use it like this :
var pen = function(foo){
alert(foo);
}.bic(2);
pen('hello'); // alerts hello
pen('goodbye'); // alerts goodbye
pen('pwned'); // nothing happens
The parameter in bic() is the max number of usages you want.
Below is the Mootools voodoo that can make it happen (note that bic and maxUsages are aliases) :
/*
---
description: Makes sure this function will only be used at most maxUsages times.
A disposable function, like a bic!
authors:
- Antoine Goutenoir <antoine@goutenoir.com>
license:
- lulz
requires:
- Core
provides:
- Function.maxUsages
- Function.bic
...
*/
Function.implement({
maxUsages: function(maxUsages) {
if (!maxUsages) maxUsages = 1;
var nbUsages = 1;
return function(){
if (nbUsages++ <= maxUsages) return this.apply(this, arguments);
}.bind(this);
}
});
Function.alias('bic', 'maxUsages');
127.0.0.1 foo.local
<VirtualHost *:80>
DocumentRoot "C:/workspace/foo/trunk/www/"
ServerName foo.local
DirectoryIndex index.html index.php
<Directory "C:/workspace/foo/trunk/www/">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
NameVirtualHost *:80
Fresh install, no sound.
Launched /opt/Osmos/Osmos :
This blog was built as a pastebin for miscellaneous code snippets, therefore it has shriveled to an empty shell and yet another ghost blog since I opened a github repository, which is better suited for that purpose.
On mootools-cloud, you will find javascript snippets and mootools extensions, written in the mootools-more way as much as possible. Feel free to fork it !
Openness of knowledge is paramount for the very survival of our civilization. It’s a long-term point of view and an arguable one ; and it’s definitely not my code that’ll influence anything. Though, all in all, removing the hindrances to access to knowledge will spawn a smarter generation more likely to make smarter decisions. Hope.
You do not want to install the php5-cli package, maybe there isn’t the 5.3.5 version in your repositories yet, maybe you think LAMPP (v1.7.4 and above have php-5.3.5) should be enough, whatever. No worries. You just need to know where you installed lamp (usually /opt/lampp/), a text file editor, and you’ll be playing with your brand-new symfony2 installation in no time !
Open the console (or console_dev) file, located in the symfony2 app/ folder, and replace the first line,
#!/usr/bin/env php
by that one :
#!/opt/lampp/bin/php
Of course, if you installed LAMPP somewhere else, replace /opt/lampp/ by your installation path.
Assuming you’re on the page http://www.mydomain.com/foo/bar.php
// BASE PATHS //////////////////////////////////////////////////////////////////
// Local path : /home/username/www/mydomain/foo
define('BASE_PATH', realpath('.'));
// Base Url without domain name : /foo
define('BASE_URL', dirname($_SERVER["SCRIPT_NAME"]));
// Absolute Base Url with trailing slash : www.mydomain.com/foo/
define('BASE_ABS', $_SERVER['SERVER_NAME'].BASE_URL.'/');
These come in handy when you’re building up a quick php/html template for flash for example ; just pass the BASE_ABS as flashvar and you won’t have to worry anymore about migrating from one server to another!
When you’re starting to build a full-featured website/webapp with HTML5 and CSS3, you start to see the problem with having so many different browsers with so many different property naming conventions. Factorization becomes mandatory, so you might should add somewhere in your main css file the following, or your custom implementation of it.
.smooth {
-webkit-transition: all 0.5s ease-in-out;
-khtml-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
Then, you’ll just have to add the smooth class to your element, and for example any property you put in the :hover CSS definition for this element will transition smoothly !
I use many pre-defined transition classes such as :
.slick {
-webkit-transition: all 0.3s ease-out;
-khtml-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
or
.slow {
-webkit-transition: all 1.8s cubic-bezier(0.1,0.5,0,0.9);
-khtml-transition: all 1.8s cubic-bezier(0.1,0.5,0,0.9);
-moz-transition: all 1.8s cubic-bezier(0.1,0.5,0,0.9);
-o-transition: all 1.8s cubic-bezier(0.1,0.5,0,0.9);
transition: all 1.8s cubic-bezier(0.1,0.5,0,0.9);
}
You get the following JavaScript error whilst interacting with flash ?
Uncaught Error: Error calling method on NPObject!
Try adding this line in your flash :
Security.allowDomain("*");