Category Archives: web
Hi,
when you have several virtualhosts with SSL enabled and also, the certificate has been generated with a pass phrase, you need to use SSLPassPhraseDialog to print to apache the password each time it starts, the problem comes as this directive can only be declared 1 time in the general configuration, so to use several password for each SSL generated, you can use this code:
#!/bin/sh
PASS1=”password1″
PASS2=”password2″case $1 in
www.url1.com:443) echo $PASS1;;
www.url2.com:443) echo $PASS2;;
esacexit 0
just replace the passwords and url with the one configured on your webserver, set them execution permission and add this to your apache conf:
SSLPassPhraseDialog exec:/path/to/bash/file
Regards,
Shadow.
Related Post
Hi,
i’m migratin a server, and i’m installing everything from source, so, the old server have subversion too, and after installing apache, mysql and php, i need it and configure it to use DAV for user authentication. for my surprise the apache source comes with the dav module do not include the mod_dav_svn and mod_authz_svn, and i found almost no info of how to make it work.
so to everyone who need it, just add the –with-apr flag when you configure the subversion source, like this:
./configure –with-apr=/usr/local/apache2/bin/apr-1-config
of course, your compiled version of apache needs to have apr, adding the flag “–with-included-apr” will do the trick
then use make and make install, automatically will place the modules on the apache module directory and you will be able to load it from there.
when you restart apache loading this modules, found any missing library or shared object error, check that the file is on /usr/local/lib and /usr/lib depending your apache configuration. it should be in at least 1 of those locations, to fix it, i just created a symbolic link of the file in the missing location and that fixed the problem.
i hope this will be useful for you
Regards,
Shadow.
Related Post
Hi,
recently i moved some scripts to a new server, so i was needed to reinstall everything from the old one. this has been also a change of platform, as the old was on a debian lenny, and this new one was a RHEL 6.0. in resume, here are the instructions of how to install imagick and support it on your php installation for any redhat based distribution:
yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
echo “extension=imagick.so” > /etc/php.d/imagick.ini
service httpd restart
of course, change i386 with your architecture (like x86_64) and also, you need to install php-pear package to be able to use pecl and install the php extension.
i hope you find this useful
Regards,
Shadow.
Related Post
Hi,
recently i was needed to add some like and tweet button to a site. i supposed will be a 5 minuted task, but i discovered something really weird, that for some reason, the button not only was screwing up the load of the adsense ads, but also, sometimes the ads appeared inside the iframe of the buttons. looking for a solution on the web, i found something for the facebook like button and i applied something seamless for the twitter button.
Facebook Like Button
the steps to solve this are the following:
1)go to this page and create an application: https://developers.facebook.com/setup/
2) paste this code where you want the like button and edit with the correct paths and the appID you generated before
<!-- like button -->
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like layout="button_count" width="100"></fb:like>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXXXXXX', // ID generated for WEBSITE provided above.
xfbml : true, // parse XFBML
channelUrl : 'http://www.YOUR_SITE_NAME.com/facebook/channel.html' // new file custom channel
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- like button -->
3)create the channel.html file on the path of your server and paste this only line:
<script src="http://connect.facebook.net/en_US/all.js"></script>
and that’s it, now you have a like button and will not screw up your adsense ads
Tweet Button
for the tweet button, the solution is more simple, i basically pasted the code inside a file and called it from a iframe. is not the most cleanest way, i know, but is the only thing i figured out to solve it.
i hope this help you in some way
Regards,
Shadow.
Related Post
Hi,
maybe this could sound obvious but is something that i didn’t know till a few days ago when i was making some changes on a js code i made. like the title says, the each() function used in mootools to apply a code to each element in the array, do not work with associative arrays.
so basically if you have this code:
var myArray=new Array();
myArray["key1"]="value1";
myArray["key2"]="value2";
myArray.each(function (item, index){
//do stuff
});
will not work, simply will not execute the loop on each array element. to fix this, you need to use the for loop like this:
var myArray=new Array();
myArray["key1"]="value1";
myArray["key2"]="value2";
for(key in myArray){
//do stuff
}
dunno if this is a mootools bug or was designed to work like this, but i hope this help you and save you time in debugging when you are using associative arrays.
update: from the comments below, let’s clarify some things:
*there is no associative arrays in javascript, they are objects, and i was wrong, indeed you can process it using the solution that Dimitar Christoff posted
var myArray= {};
myArray["key1"]="value1";
myArray["key2"]="value2";
Object.each(myArray, function (item, key){
console.log(item, key);
});
*when you process the object like this, you need to check that you are not processing the js methods that mootools define, personally i stop processing the object after i found the “$family” key, in the comments recommend to use the hasOwnProperty() function but i don’t see why is better or different than mine, if you know it, post it
thanks for the comments, i recognize when i’m wrong, for your collaboration, i’m a bit a better dev
Regards,
Shadow.
Related Post
Hi,
months ago i wrote this post where i commented about a tool that adobe was developing that convert any fla into html5. on the same post i also talk about the eternal fight of flash vs html5 and the “end of flash”, i recommend you to give it a quick read. today adobe have released this tool to the public, you can download it from here
of course that the app is on a test phase, is not even a beta version, but i hope flash will continue the development converting it into a real product.
Regards,
Shadow.
Related Post
Hi,
i just saw this on my twitter TL and i think it worth a mini-post. All those who develop some application that require user authentication, deal with the password problem. is not only a problem to store passwords (BTW, i wrote another post about it recently) but also the problem is the user, trying to encourage him to use stronger ones, using uppercase, lowercase letters, number and symbols is not easy. usually most of the app’s have a bar that measure the strength of the password. is nice and useful, but most of the users just don’t pay attention to it. in this cases is where naked password take action and i will not say anything else, just go to the site and try it, is a twist in usability to say it in some way
Regards,
Shadow.
Related Post
Hi,
recently, visiting one of the most popular Anonymous site’s to check some of their news, got my attraction at the donate section, a logo that say’s “Bitcoin Accepted”, in my infinite curiosity, i made a click and i learned what bitcoin was and what i want to share with you.
What is bitcoin?
Bitcoin basically is a virtual currency, like mochimedia have the mochicoins, like facebook have their own etc.. but the difference remains in there is no issuer or centralized institution that control how much it worth, how much of this coins are on the market or if there are available or not. like the P2P systems, users run the program and handle the transactions, yours and others one, where you can send and receive bitcoins.
Who or how is the bitcoin value decided ?
As a decentralized currency, the value is made by the goods that can be exchanged with. there are several people and company that will accept bitcoins for services, products, licenses and there are even exchangers that will give you USD,EUR or others virtual currency’s for it. basically the value of the bitcoins is made by their own users.
How i can get the bitcoins?
there are several methods, the most effective is selling something (as a product or service) for bitcoins and with that, buy any other thing or exchange it for USD or other virtual currency in some exchanger. the other method, the hard one, is running the program and check the option “generate coins”, this will use the remaining process in your machine and generate the coins in some period of time. depending the difficulty level and the number of hashes per second that your machine can make, it will take from months to years to generate the first 50 BC. anyway, is free money, and you are contributing to the system.
Where you can exchange bitcoins for real, virtual goods or money?
you will find all the necessary info in their site you will find a large list of services and exchanger that could fit your needs. by the way, i’m also accepting donations in this currency too
there are some advantages and problems in the system that i will detail:
advantages:
*like is a p2p currency, if there are users that run the program and give to the coin a “value” it will live forever.
*like there is no central authority, cannot be taken down by anyone, and no one can screw you up (didn’t even the creator of the app) why the other clients will correct the problem or the variation.
*if there any trustful virtual currency, i think this is the best in the market.
problems:
*the “wallet” where you have the money, is stored in your computer, so you need to have a persistent backup solution, why if not you will lost your money
*like is in your computer, others can steal it
*like is a p2p network, the payments are not instantaneous, if you are not running the app, could take more than 10 minutes to get credited the transaction, and even then, is better to wait for some confirmations from the others node networks to be sure that is legit.
i think is a project to follow and support, using it, donating real or bitcoin money, and a good opportunity to those service providers to offer another payment method in their websites.
Regards,
Shadow.
Related Post
Hi,
weeks ago i posted this function that basically let you serialize object and arrays in javascript and is compatible with the unserialize funcion in php. recently i discovered a problem in this function related with the management of the weird, other language characters. the problem is that when you save a word with, let say, russian characters, the count of the chars is different as how php do it, so when you try to unserialize the string you get a offset errors. to solve this, you need to convert the string into unicode, serialize it and then send it to the php.
the function to convert any string into unicode with javascript is the following:
function convertToEntities(tstr) {
var bstr = '';
for(i=0; i127)
{
bstr += '&#' + tstr.charCodeAt(i) + ';';
}
else
{
bstr += tstr.charAt(i);
}
}
return bstr;
}
and in the php, you process the string like this:
$unserliazed= html_entityt_decode(unserialize($string),ENT_NOQUOTES, "UTF-8");
is very important that you set the UTF-8 charset to the decode function, so you get the original string.
also, remember that the database need to be support unicode-utf8, here you will find a quick guide for it
Regards,
Shadow.
Related Post
Hi,
recently, i have a problem with the flash content in a page that is customized by the user. the problem was that i popup a div with a higher z-index to show some info, this popup was not showing it in front of flash or youtube embed videos. and to make it more difficult, this content was load using ajax and even that i could filter the information or the html code, i prefered to make it using javascript.
here i will share with you the function that process all the objects, embed and youtube iframe tags and set the wmode that you want to them.
function setWmode(mode,reinsert,youtube){
if(youtube==true){
var allIframes=$(document.body).getElements('iframe');
allIframes.each( function (item, index){
if(item.get('src').test('http:\/\/www.youtube.com\/embed\/')){
item.set('wmode',mode);
item.set('src',item.get('src')+"?wmode="+mode);
if(reinsert==true){
var newElem= item.clone(true,true);
var parentElem= item.getParent();
item.destroy();
parentElem.grab(newElem);
}
}
});
}
var allObjects=$(document.body).getElements('object');
allObjects.each(function (item, index){
var allParams=item.getChildren('param');
var WmodeExist=false;
allParams.each(function (item2, index2){
if(item2.get('name')=='wmode'){
item2.set('value',mode);
WmodeExist=true;
}
});
if(WmodeExist==false){
item.grab(new Element('param', {name: 'wmode',value: mode}));
}
if(reinsert==true){
var newElem= item.clone(true,true);
var parentElem= item.getParent();
item.destroy();
parentElem.grab(newElem);
}
});
var allEmbed=$(document.body).getElements('embed');
allEmbed.each(function (item, index){
item.set('wmode',mode);
if(reinsert==true){
var newElem= item.clone(true,true);
var parentElem= item.getParent();
item.destroy();
parentElem.grab(newElem);
}
});
}
this function requires of 3 paramenters:
mode: the value of wmode to set
reinsert: what this make is, clone the iframe/object/embed, erase the original and insert it again on the same location. this is made when you load the content before you set the wmode, so you can restart the load of the flash object and the wmode will have effect.
youtube: process or not youtube videos
i hope it help you in some way and save you maybe some time
Regards,
Shadow.





