User Tools

Site Tools


wiki:development

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:development [2012/07/11 12:46]
wiki:development [2012/07/11 12:46] (current)
Line 1: Line 1:
 +====== Plugin Development ======
 +Plugin developers themselves. Don't forget - **Quality is our advantage!**
 +
 +
 +
 +
 +
 +
 +
 +===== Necessary tools to start making plugin =====
 +I expect you are smart enough and you already know some programming languages. It can be painful for you - as for beginner, but you can nothing to lose, just to earn.
 +So, JDK is here:
 +  *  [[http://​java.sun.com/​javase/​downloads/​widget/​jdk6.jsp|JDK]] ​
 +  *  [[http://​www.jetbrains.com/​idea/​|Free IntelliJ IDEA]] ​
 +  *  IntelliJ IDEA has many screencasts videos, where you can see how to create/​setup a project - [[http://​www.jetbrains.com/​idea/​training/​demos.html#​GetStarted|screencasts]]
 +
 +=== Working with SVN ===
 +Check my tutorials how to work with SVN:
 +  *   ​[[http://​wordrider.net/​freerapid/​video/​svndemo|SVN basics using Tortoise SVN]]
 +but you can also use the integrated Version Control in IntelliJ IDEA. 
 +
 +
 +===== A must with a plugin =====
 +==== Coding ====
 +  *  Always handle possible error state IF-ELSE and throw exception in case of error
 +
 +==== Releasing ====
 +  *  Always test it using TestApp
 +  *  Final working plugin add to a list in main build.xml in ''​src''​ folder - this build.xml is called when new FRD version is being released
 +
 +===== Documentation ​ =====
 +
 +==== Tutorial videos ==== 
 +  *  [[http://​wordrider.net/​freerapid/​video/​setup-intellij|Setting up plugins project in IntelliJ IDEA Community edition]]
 +  *  [[http://​wordrider.net/​freerapid/​video/​plugin|Making of FileSend.net]]
 +  *  [[http://​wordrider.net/​freerapid/​video/​newplugin|New plugin from template]]
 +  *  [[http://​wordrider.net/​freerapid/​video/​api082|Update of this plugin]]
 +==== Javadoc ====
 +  *  [[http://​wordrider.net/​freerapid/​javadoc/​|Public Javadoc API for version 0.83]] - you can attach sources to plugin-api-src.zip,​ which is in ''​freerapid-plugintools\lib-src\plugin-api-src.zip''​
 +
 +
 +
 +===== FAQ =====
 +  *  Q: ** When commiting updated plugin, should I increase version in plugin.xml?​** ​
 +  *  A: Yeah, always. The new number is up to you (it should usually reflect amount of changes you made)
 +
 +  *  Q: ** What should I input to PlugUtils.checkFileSize()?​ Apparently it needs the filesize in bytes (?) and I'm inputting it in megabytes.** ​
 +  *  A: [[http://​wordrider.net/​freerapid/​javadoc/​cz/​vity/​freerapid/​plugins/​webclient/​utils/​PlugUtils.html#​getFileSizeFromString(java.lang.String)|See Javadoc for Plugin API]] 
 +
 +
 +  *  Q: ** How to redirect URL of file to another URL** 
 +  *  A: 
 +
 +<code Java>
 +this.httpFile.setNewURL(....);​ //to setup new URL
 +this.httpFile.setPluginID(""​);​ //to run detection what plugin should be used for new URL, when file is in QUEUED state
 +</​code>​
 +
 +  *  Q: **What'​s difference between ServiceConnectionException and YouHaveToWaitException**
 +  *  A: When ServiceConnectionException is throwed - FRD waits for user specific time (defined in User Preferences) - it can be repeated only X times, YouHaveToWaitException waits for specific time defined **in plugin** - URL can loop indefinitely then.
 +
 +  * Q: **How to use internal OCR Engine?**
 +  * A: We use GOCR for this. Call ''​PlugUtils.recognize''​ . We call ''​gocr.exe''​ this way ''​exec("​gocr.exe " + commandLineOptions + " -f ASCII -"​);''​. You can use -i to test it directly from system. See ''​gocr.exe -help''​ for more details. Note: gocr.exe does not take jpg pictures or something like that. It's using PBM format - you can use Adobe Photoshop to generate this format.
 +
 +  * Q: **I have problems using non-ASCII characters (eg. Cyrillic, Arabian, Chinese, etc...) in plugins. Is there a workaround?​**
 +  * A: Press Alt+x after each character in Microsoft Word and add \u in front of each of them.
 +  * A2: Or use Unicode to Java string converter http://​www.snible.org/​java2/​uni2java.html
 + 
 +  * Q: ** How to add more files into queue? **
 +  * A: <code Java>​getPluginService().getPluginContext().getQueueSupport().addLinksToQueue(httpFile,​ uriList);</​code>​
 +
 +
 +===== Knowns problems in current version of API =====
 +  *  API cannot ignore two or more invalid variants of content-type (eg. plain/text something) using ''​considerAsStream''​ httpclient property
 +  *  too many constants without descriptions like '​considerAsStream'​
 +===== New feature suggestions =====
 +
 +===== Web administration =====
 +*  [[http://​wordrider.net/​freerapid/​updates/​|Web administration]] ​
 +
 +
 +===== Using Recaptcha in plugin =====
 +It's necessary to add dependency in plugin.xml after <​attributes>​ section:
 +
 +   <​requires>​
 +        <import plugin-id="​recaptcha.com"​ plugin-version="​1.0"​ match="​greater-or-equal"/>​
 +   </​requires>​
 +
 +In build.xml:
 +In target "​compile"​ - javac task - add another sourcepath to /devapp
 +     <​sourcepath location="​../​devapp"/>​
 +     <​sourcepath location="​../​recaptcha"/>​
 +
 +Then you can use **cz.vity.freerapid.plugins.services.recaptcha.ReCaptcha** plugin and call its methods.
 +After that manual build plugin with Ant task should work properly.
 +
 +===== CAPTCHA recognition =====
 +
 +Here are some steps from my experience:​\\ ​
 +a) creating a training set
 +
 +1. Trim every character from the picture, remove background color, probably with every same size
 +
 +2. Build a structure many mappings characters'​ picture->​character
 ++ convert character picture into black and white or gray
 +
 +b) testing
 +
 +1. extract every character from the captcha, trim, convert it into BW or gray
 +
 +2. compare character against training set using [[http://​en.wikipedia.org/​wiki/​Euclidean_distance|Euclidean distance]] method -
 +
 +I usually counted it this way:
 +for all x,y on the same sized pictures - \\ 
 +Sum ( (picture1.point[x,​y].value - picture2.point[x,​y].value)^2)
 +training pattern with lowest sum is the best matching picture against testing picture\\ ​
 +See Netload.in CAPTCHA recognition or older versions of Bagruj recognition. ​
 +
 +===== Other =====
  
wiki/development.txt ยท Last modified: 2012/07/11 12:46 (external edit)