New Site: randgame.info

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 11-10-2009

0

Hi,

the other day i was thinking to make a site where you play a random game each time you visit.

so, i have registered a domain and set it up:

Rand Games

need to do a lot of more work on it, i’m still thinking some features i can add and a proper design for it (that need to be light and at the same time, look nice)

As soon i make some changes, i going to post it here :)

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Change of design

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 09-10-2009

0

Hi,

as you see, i changed the style of the blog, i hope you like it :D

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

OAuth and REST with AJAX or FLASH

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 06-10-2009

0

Hi,

the last days i was working on a API for project. for that, i was needed to set a OAuth system. all went perfect but i have a problem when i wanted to use the API in a AJAX app.

as you already know, AJAX it’s a technique where you use javascript to request info to a page and show it to the user. as you also know, javascript it’s executed in the user machine, and for OAuth it’s a problem :s

no matter what how it’s implemented the OAuth system in the API that you need to use, you need always to send the $consumer_key and the $consumer_secret encrypted in the signature, also depending of the type of request, also need to send the $token and $token_secret, for that, you can’t include in any javascript way (or in a swf) any of this vars why compromise the security of the consumer, why any with this data can access to the protected resources as you.

for that, the solution it’s to create a bridge between your AJAX/FLASH app and the API/OAuth server.

the process it’s simple, create a php with a code like this:

<?php

//check if the one who are making the call to the bridge it’s trusted

//for that you can use a filter ip, an authenticated session or any method that fits your needs

$consumer_key=”lalala”;

if($trusted){

//making the request

$result=$OAuth->request($url_of_the_server.$_GET['service'],

$consumer_key,$consumer_secret,$_SESSION['token'],$_SESSION['token_secret']);

echo $result;

}

?>

of course the code can be diferent depending of your client library and stuff, but basically that are the steps to make the bridge:

1)check that the one who call the bridge it’s trusted or ahiterized, checking a sesssion var or anything what you have

2)make the request using the $service var that define the service to call to the service

3)print the result of the call and it’s done :D

i hope this give you some help at the time to use OAuth and REST with ajax and flash

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

serialize array with javascript (php compatible, associative arrays and mootools)

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 04-10-2009

0

Hi,

one of the task i was need to do, was to write a javascript funtion to serialize a array, so can be sent through ajax.

the task wasn’t easy, why searching on the web i only found partially working functions (some that only proccess numerical arrays, other even’t didn’t worked, and wasn’t recursive) but serching i come up with the perfect javascript serialize function ever :D

in resume it can:

  • parse numerical arrays
  • associative arrays
  • mixed arrays
  • multidimensional arrays
  • it detect if the index or values of the element it’s int or string and parse it accordingly
  • mootools compatible (read below what i mean with  this

so i dont want you wait anymore, here it’s the function:

function serializeArray(ArrayElem)
{
var cont=”";
var counts=0;
var jj;
var res = “”;

for(jj in ArrayElem)
{
//if mootools it’s included, this hack prevent that the function parse also the prototype objects
if(jj==”$family”){
res = ‘a:’+counts+’:{‘;
res += cont;
res += ‘}’;
return res;
}
if(isInt(jj)){
cont += ‘i:’+jj+’;';
}else{
cont += ’s:’+jj.length+’:”‘+jj+’”;’;
}
if(isArray(ArrayElem[jj])){
cont += serializeArray(ArrayElem[jj]);
}else{
if(isInt(ArrayElem[jj])){
cont += ‘i:’+ArrayElem[jj]+’;';
}else{
cont += ’s:’+ArrayElem[jj].length+’:”‘+ArrayElem[jj]+’”;’;
}
}
counts++;
}

res = ‘a:’+counts+’:{‘;
res += cont;
res += ‘}’;

return res;
}

function isArray(obj) {

return obj.constructor == Array;

}

function isInt(myNum) {
// get the modulus: if it’s 0, then it’s an integer
var myMod = myNum % 1;

if (myMod == 0) {
return true;
} else {
return false;
}
}

i going to explain some things about this function:

  1. the isInt() function it’s very simple, i dont know if it can fail with some weird value, but at least it’s fast and cross browser compatible
  2. i’m using a counter and not the length propertie of the array why with associative array it return 0
  3. as you see, there it’s a hack for mootools, that it’s it make it “compatible”, whiteout that hack the function also parse all the native properties and elements added at the moment when you add mootools to the document. i didn’t know any other form to stop it, so if you know something advise :D
  4. in the php that receive the serialized array, remember to use stripslashes if the magic quotes are ON and maybe you going to need to use html_entity_decode() (at least that was my case) to convert the doble quotes character to signs.

i hope it help you, it’s very easy to use and understand and can save you some hours of work :D

Regards,

Shadow

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Import big xml to oscommerce or mysql database

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 02-10-2009

0

Hi,

recently i have needed to do a script that parse a big xml file and insert it to a oscommerce database. i wanted to write this post why can be useful if you are doing something like this and maybe with other CMS system or database schema :)

the script no only need to insert the products, also download the images, check if the product already ,xist and update the product with the info of the xml. i don’t going to describe the trivial process of check for the product, make the queries etc.. if you are seeing this post you are run with some of the 2 essential problem:

1)out of memory error

2)session timeout, php execution time limit or 500 internal error

so, here are the soltuion for your problems :)

1) out of memory error

this it’s happen why surely you are usng the xml_parse() to parse the xml. this function always going to give you a out of memory error why need to load all the document in the memory to use it.

the solution it’s simple, use XMLReader this going to allow to load all the xml file and let you review each element of the xml. the documentation it’s very clear of how to use it and with some of testing, in a few hours you should have working your parse function :) . the only “problem” can be it’s that’s only available from php version biggers that 5.1.2, i don’t think so but maybe you can run with some problem in some host :)

2)session timeout, php execution time limit or 500 internal error

well, this error can be fixed but going to be you more effort and ugly code but i didn’t thinked any other posible solution for this :s

if you have a php execution limit error, simply add: set_time_limit(0); this this going to let you run the script forever. of course this isn’t safe, why if you have a bug or something, can be running forever and consumming so much memory than you going to have your shosting account suspended, so be sure to test everything before you run it live :)

after you set the execution time to 0, if you still have a timeout error or a 500 internal error it’s surely happening by the mysql queries. the xml parse it’s very fast with XMLReader but the real time take the mysql queries and if you are using oscommerce and need to check too much thing going to be a nightmare :P

the only solution i come up for this, was to re-execute the script till i procesed all the xml. basically i have parse the xml into a multidimensional array like this:

$rows[$rownumber][elements]

so, i process all the xml (in this time i processed a 3MB xml) to a array, send it to a function that update the DB and processing it in 200 rows parts. after the part finished, i keep the number of rows processed and printed:

echo “processed…. $numberofrows”;

echo ‘<meta http-equiv=”refresh” content=”4;url=xmlimport.php?f=’.$filename2.’&cont=’.$continue.’&start=’.$finished.’” />’;

i used a meta and not a header() why with header it still crashed with a 500 internal error.

so, when the script load again in the function that parse the xml, i set:

if($_GET['cont']==true){

for($i=0;$i<$_GET['start'];$i++){

$xml->read();

}

}

with that, i have moved the pointer of the xmlReader object to the last inserted row, and then start to parse the rest. it continue till the rows to parse are none and the script stop :)

i hope this help someone to resolve this problem :)

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

you can’t sort by date in gmail WTF??

Posted by shadow_of__soul | Posted in News | Posted on 12-09-2009

0

Hi,

i never use the web interface of gmail, i always use my gmail account with thunderbird but just i was suprised when i was need to search for a old email, and make a search. at that point all was perfect but when i tried to sort by date i didn’t found any link for that, and even didn’t you the “last page” link, so i was forced to make a next action till seeing hundreds of emails, when i only needed to sort by the most old email or at least can go the last page.

google UI design FAIL

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

5 payflow pro integration tips

Posted by shadow_of__soul | Posted in News | Posted on 31-08-2009

0

Hi,

has been like 6 months i’m dealing with the payflow pro platforms making integrations for this processor payment. basically, this it’s a processor like others, managed by paypal, it’s nor hard to do it, but sometimes you can get some errors that can make you crazy searching info about it, i think this tips can help you to make you work easier :)

1) have a problem? check the paypal forums

here it’s where i solved my 90% of my problems, and i didn’t even need to ask !. it’s a little hard to search and the forum it’s not “friendly” but they do the job :) . Payflow Gateway Forums

2) if you don’t know anything about, first, read some guides

when i started lookin for this, i didn’t even know how this working (the most close thing i ever made was the IPN paypal integrations, what are very diferents from this :P ) and the guides help me a lot to know what i needed to get the job done. Payflow PDF Guides

3) look for the best solution for your platform

the payflow pro have several options for each platform. if you are using something web based (like php) you need to use the https interface and if you are using other platform, like .NET or java, check the SDK .if after all of this you still feel lost, check the examples to see what you are doing wrong :)

4) use https for all your data transactions

maybe it’s a little obvious, but you need to use https in all the pages that involves the process of vital integration, from the form where the user enter her credit card number to the script that call to the payflow service and make the transaction

5) commons errors and solutions

here i going to detail you the commons error that can return the payflow gateway when you make a transaction:

User Authentication Failed

this happen when you are sending the incorrect credentials to the payflow pro server, check that the username, password, vendor and partner are correct from your account.this can happen also if you are filtering by ip the call’s to the gateway, if it’s yes, go to the manager , log in, go to “service settings” and check if the ip of your server are in the list.

User Authentication Failed: Vital

this usually happen when something it’s wrong with you account, like it’s not active for live transactions (if you are trying to run a live transaction). i recommend that if your account it’s already active for live transactions, call to your bank or who provide you the account and let them know the error.

account rules broken

i don’t remember exactly the name of this error, sorry :P but basically it’s a configuration error, again, log in into manager, and go to “account administration” -> “manage security” and there change the values of according of what you need to process, take note that the changes take effect in 1 hour.

transaction declined

it’s the more common error, and can have several reasons, some of them are:

*order amount more than 1000 dollars in test mode

*trying to process card’s not supported by the account (this need to check it with your bank)

*the credit card it’s invalid or you are passing in a incorrect way the parameters

*you are not sending a unique ID.

i hope all this tips help you and make you save some time :) if you need some cards number for test, you can user this below:

MasterCard: 5431111111111111
Amex: 341111111111111
Discover: 6011601160116611
American Express (15 digits) 378282246310005
American Express (15 digits) 371449635398431
American Express Corporate (15 digits) 378734493671000
Diners Club (14 digits) 30569309025904
Diners Club (14 digits) 38520000023237
Discover (16 digits) 6011111111111117
Discover (16 digits) 6011000990139424
JCB (16 digits) 3530111333300000
JCB (16 digits) 3566002020360505
MasterCard (16 digits) 5555555555554444
MasterCard (16 digits) 5105105105105100
Visa (16 digits) 4111111111111111
Visa (16 digits) 4012888888881881
Visa (13 digits) 4222222222222
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

obama smasher flies

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 19-06-2009

0

Hi,

i have made a awuful, boring and crappy game, if you still want to play it, you can do it here

regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

legislative elections in argentina

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 14-06-2009

0

Hi,

has been a lot of time from the last post, sorry i was really busy working in a lot of things, now in a new company, with my own projects, family, dog etc..

now i wanted to write a post not about tech or programming, something about politics and what it’s current happening in my country, the campaign for the legislative elections. maybe you think i should write this in spanish, like it’s my native language and it’s a post what concern more with my fellows than you but i think it backward. i lost the hope in my own country, has been passed 20 years, i see a lot of actitudes, promises of changes, revolutionary movements etc.. but all of that always finish in the same thing: the self destruction of the idea and the pursue of personal objetives (like power or money for the lider of the movements). and i lost the hope why the people do anything about that. when you try to concientize the “normal” people, they choose to look other way and follow the leader (no matter if that mean we go all to the hell). and i’m a little tired of this shit.

in this elections i see a lot of candidates, all well presented, with a great personality, they seems to be professionals, but NONE LOGICAL AND REAL PROPOSITION to have a better economy, improve the life quality of the people etc.. al what they say it’s complicated words to look professional and the ignorant people believe that and put the vote, and when assume only look for the perosnal objetives (and the people whi voted you eat shit). i dont hae any politics affiliation but i’m starting to fill sick seeing too corruption and egoism on our leaders and in the people itself.

i say the people itself why also they have the fault, they use the politic to improe her own personal life, not how it’s created, like a tool to improve the life of all and the common well.

maybe i should say sorry for this post, has been more a rant than something informative for you, but if you are foregeing and you love argentina, maybe with this you going to be more informed about our egoist culture, self-enrichment politics and or well now premium meat :P

Regards,

Shadow.

PD: i wanted to write something and was the first it come to my mind, excuse me if i say bullshits (i dont think so anyways)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

My products for FREE

Posted by shadow_of__soul | Posted in Uncategorized | Posted on 26-05-2009

0

Hi,

has been a long time from my last post, i was really busy working, and i developed some themes and a flash gallery to sell in my website. unfortunately, i don’t sell anything, so i give all for free :)

this it’s a good news for you, bad for me :P but enjoy it anyway :D

download it from here

Regards,

Shadow

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]