Nov 19, 2012

Web-debugging HTTPS PHP cURL requests with Fiddler

Recently I was faced with a task of implementing OAuth 1.0 authentication. The authentication must be done with JavaScript, and I had a working example implemented in PHP (as a console app).

I've done major part of the task, but on the last step - while trying to actually use OAuth token to receive data - I've got 'signature invalid' error. I've studied PHP script carefully and 'echo'-ed values of interest to console, but still no luck to figuring out what was wrong.

It would be very convenient to see all PHP traffic in Fiddler, I thought, and what you need for it is described below.

Assume that Fiddler is running as usual on localhost (127.0.0.1) on port 8888. First of all you need to tell cURL to use proxy.

$proxy = "127.0.0.1:8888";
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $proxy);

for your convenience you can also tell cURL to print debug info:

curl_setopt($ch, CURLOPT_VERBOSE, 1);

This will run cURL thru Fiddler, but you will not see (by default) decoded HTTPS traffic, because Fiddler decode HTTPS only from browsers (again, by default), so you need to change it to '...from all processes' if you run from command line PHP script (or just cURL):



again, this will, most probably result in HTTPS certificate errors since cURL knows nothing about Fiddler certificate (and Windows certificates), so easiest way is to just tell cURL to ignore SSL certificate errors:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

That's all, now you should see PHP cURL traffic, both HTTP and HTTPS.

Sep 14, 2012

Great tools for browsers

Sometimes working with a browser becomes real frustration. Especially if this browser is Internet Explorer. Some simple operation like viewing and managing your cookies can become a real mess. They built in facilities are slow, and not comfortable at all to work with.

NirSoft web browser tools are invaluable in that aspect. It's fast, it's really good, and it's free! Particularly IECookiesViewer just saved me a ton of time and my brain.

Aug 28, 2012

WiX, worst toolset ever

So, I suppose sooner or later every developer out there will face the task of writing a installer for his product. I you are working under Windows, Windows Installer seems like a reasonable choice. I'm not so sure about it now.

Now, there is no some sort official tool from Microsoft for making Windows Installer packages. Huh? Seems like that. Presumably I didn't dig enough for that, so far I found just this nonsence.

But then, WiX! Which is infamous for being used to create Microsoft Office 2003 installer. And it's also internal Microsoft product as well. Certanly it's a big YES compared to nothing. It's even integrates into Visual Studio and adds custom projects for creating installers. And you actually start to think that will be a nice journey. But then you try to find some tutorials, examples and documentation. It is awful, all of these. If you add (but I suppose, it's the reason in the first place) that WiX markup is extremenly unintuitive, complicated and confusing then you will understand that frustration means. Contrary to what you might expect, WiX Toolset it's a pretty low-level tool, which must be backed with good documentation and comprehensive and complete examples.

The feedback is thru this mailing-list style forum with horrible desing. The leading toolset man Rob Mensching is rich for caustic comments like this. And, as you can guess from a thread, WiX Toolset is OK with bugs that lasts for more than 2 years.

The thing that finally really, really helped me out was WiX: A Developer's Guide to Windows Installer XML book. And I'm not sure how much more time I would spend in misery without it.

So for me it's official, WiX Toolset is teh worst tool I've ever encountered in all my developer experience so far. It doesn't mean however you shouldn't use it, but unless you are ought to use Windows Installer, you can consider some other tools out there.

P.S. Useful tips on MSI.

Aug 25, 2012

Fixing XBLIG (and Windows Phone) forum links

As usual, working with an elephant finesse, Microsoft, for some obvious reasons decided to split Windows Phone and XBLIG forums. This results in incredible amount of links on the web are being broken. Oh, this is so nice.. The good part however is that, you can replace old forums.create.msdn.com/forums with xboxforums.create.msdn.com/forums in address and make it to the desired topic.

As for unfortunate ones who were looking for some topics for Windows Phone, the things here are much simplier: all topics are lost somethere, or just gone, I don't actually know.

Back to XBLIG. If you are using Firefox, you can use Redirector add-on, as described here. Just in case, I'll duplicate the rules here. Goto add-on options and add two rules:

Rule 1
Example URL: http://forums.create.msdn.com/forums/p/0001/0001.aspx
Include Pattern: http://forums.create.msdn.com/forums/*/*/*
Redirect to: http://xboxforums.create.msdn.com/forums/$1/$2/$3
Pattern Type: Wildcard

Rule 2
Example URL: http://forums.create.msdn.com/forums/t/0001.aspx
Include Pattern: http://forums.create.msdn.com/forums/*/*
Redirect to: http://xboxforums.create.msdn.com/forums/$1/$2
Pattern Type: Wildcard

Aug 14, 2012

OUYA: first indie console

The phenomenon of indie games is out there for some years, and it's a great thing. However the only true indie platform was only PC. And PC is a great platform, but only for a personal amusement. But it's nothing compared to fun then you blay with you friend side by side, fighting to each other or against computer.

Since the great crash of 1983 the main game consoles were closed for indie developers. This wasn't major concern up until now, since indie devs are flourishing.

And OUYA perfectly hitted the spot. It's cheap and open to everyone. It's not that powerful, but indie games usually doesn't need that much power as AAA titles. OUYA is greatest thing that happened to console market for some last years. It will boost competition between console market players, which will be good for everyone. It will bring tons of new, beautiful games to people by creating an easy-to-enter market for indie developers.

It's success is inevitable, because it's just filling last missing piece in a complete puzzle.

Aug 7, 2012

Thoughts on Starbound and PCG

Well, it's been awhile, my vacation was pretty good, thank you :).

Meanwhile Starbound team posted some updates. Some thoughts on that. First pickaxes are confirmed. This leads to conclusion that Starbound is definetely a Terraria clone, in a good sense of that. I mean look at Terraria it's a clone itself (of Minecraft of cousrse).

However it's became more and more obvious what will be the feature of Starbound. It's procedurally generated content (PCG). This is not a new thing per se, but Tiy has a vision of moving it to a next level.

Usually PCG is limited to thing which I call 'playfield' (major) and item properties (minor). In Terraria it's, for example, a world (earth) structure. Item properties can be for example some modified items which can then start to glow (enchanted sword, etc). In Starbound, most items itself are created via PCG (more of a pseudo-PCG) which means that not only stats, but visuals of an items are somehow unredictable. This is very cool.

The key question however is how well randoness will be controlled and constrained. By that I mean, that PCG games lacks that soul part of a manually designed worlds. Imagine, for example, Fallout with PCG land. One the one hand each game would be somehow unique, that's a good part. On the other hand, you loose sense of the game world reality. The real worlds are static. So, it's really a challenge for a Starbound team how story mode (if any) will deal with randomness.

Tiy already mentioned some kind of global coordinates which players can exchange with each other and which will lead to exact same location for any player. I assume this coordinates are basically the RNG seed values which will allow to recreate world precisely on another user machine. This feature is already very good.

As a conclusion: so far Starboud is looking pretty awesome! Can't wait to play it.

Jun 9, 2012

Look on Windows 8 from the other side

Very interesting article on Windows 8. Despite the fact that I really dislike Windows 8 as of now, I must admit this article have it's point, which is very reasonable. Good read.