====== Tips and Tricks ======
This page contains various useful information, that may become handy when developing AllPeers.
===== Bookmarklets ====
// Jump to a bug
javascript:void(window.open('http://bugzilla.apnet/show_bug.cgi?id='+prompt('Bug'))
// Show information about peer (after click on a peer in the navigator)
javascript:location.href='http://www.allpeers.com/services/account.php?type=id&value='+location.href.substring(52)
// When looking on a raw patch, click on this to see a diff
javascript:location.href=location.href+'&action=diff'
===== Problems =====
* Sometimes AllPeers certificates may not be imported as trusted. Delete and restart firefox. This would look like network connection gets aborted.
* When deploying MySQL storage copy libMySQL.dll (from Server bin) to the place from where Firefox.exe is called. This is temporary solution.
* If you cannot see a patch properly displayed in Bugzilla, check that it has been [[src:hack:patches|properly created]].
* When restarting two peers (acting as relays) on the same computer it could happen, that they would allocate other ports than they had before. Before they will upload their correct HIS information, they would download incorrect information about the other peer - presence problem. After 2 minutes they would stabilize and see each other again.
* If the Firefox from your own build crashes on start, then it usually means that you already have an XPI in the profile installed.
* Linux build fails with error "extra `;'" with apparently wrong line number. Check that macros like NS_IMPL_THREADSAFE_ISUPPORTS1 are not called with that extra semicolon.
* Client in debug mode fails on assert in ssl3.dll!ssl3_config_match_init(sslSocketStr * ss=0x0626f198) - this could happen if you use local server which is not running, the client connects to itself.
===== UI Development =====
* Debugging JavaScript: [[http://www.mozilla.org/scriptable/javascript-stack-dumper.html]]
* Add **ac_add_options --enable-chrome-format=flat** to your .mozconfig file in order to change XUL parts without building the module.
* .mozconfig-debug* have option --enable-chrome-format=flat set already.
* You have to rebuild mozilla to make this option effective).
* The resulting chrome files are placed in _obj-browser-*/dist/bin/extensions/allpeers@allpeers.com/chrome/allpeers.
* It is recommended to use [[src:hack:cpjar|a tool]] which copies chrome stuff rather then editing the files in place.
* Some javascripts like **workbench/content/apTemplateViewer.js** are not only included from XHTML or XUL pages, but also serve as components. In this case it is recommended to build the module - FF restart is required.
* In order to see the changes you have to disable cache for XUL elements: user_pref("nglayout.debug.disable_xul_cache", true);
* http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference
===== Networking Tips =====
* Check whether server is listening on the given port:
openssl s_client -connect 213.246.37.35:443
===== Error Code =====
* Use '''list-error-codes.pl''' in the root of the superman module to display list of existing errors. Use first parameter to grep in this list.
* [[http://silver.uwcs.co.uk/web/mozilla/misc/nserror|Mozilla Error Codes Breakdown]]
===== Preferences =====
* user_pref("allpeers.logfilelimit", 1000);
===== UUID Generation =====
Created by michal:
#!/bin/bash
if [ "$1" == "" ]
then
UUID=$(uuidgen)
else
UUID=$1
fi
echo $UUID
echo "{ 0x${UUID:0:8}, 0x${UUID:9:4}, 0x${UUID:14:4}, { 0x${UUID:19:2}, 0x${UUID:21:2}, 0x${UUID:24:2}, 0x${UUID:26:2}, 0x${UUID:28:2}, 0x${UUID:30:2}, 0x${UUID:32:2}, 0x${UUID:34:2} }}"
===== Database Tools ====
* In the debug use [[chrome://allpeers/content/storageinspector/storageinspector.xul|Storage Inspector]] (copy the link).
* In order to see what SQL statements were executed for some action on frontend use [[src:hack:grepsql]] script.