Thursday, September 29, 2011

use python to decode qr code

 #!/usr/bin/python  from sys import argv import zbar import Image   # create a reader scanner = zbar.ImageScanner()  # configure the reader scanner.parse_config('enable')  # obtain image data     pil = Image.open("base.png").convert('L') width, height = pil.size raw = pil.tostring()  # wrap image data image = zbar.Image(width, height, 'Y800', raw)  # scan the image for barcodes scanner.scan(image)  # extract results for symbol in image:     # do something useful with results     print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data  # clean up del(image)

qr code decode PHP

api decode api



Unicode的编码和解码QRCode的问题


我想生成的UTF - 8 QRCode的,这样我可以再来口音和Unicode字符。

为了测试它,我用的很多解码解决方案:


  1. http://zxing.org/w/decode.jspx -该zxing机器人项目还利用

  2. http://www.drhu.org/QRCode/QRDecoder.php -一个PHP解码器

  3. http://zbar.sf.net -条形码阅读器的ZBar -开源嵌入式和C项目

他们都给予我总是相同的结果。

你可以尝试这种形象工程,以及与 Unicode字符。

但如果我要使用zxing或谷歌图的API生成QRCode的,我不能正确解码。

我曾经尝试这样做:


  1. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=SHIFT%5FJIS及叶绿素=ṛ%体C3%A9my +许布舍尔

  2. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=ISO-8859-1&chl=R%体C3%A9my +许布舍尔

  3. http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=UTF-8&chl=R%体C3%A9my +许布舍尔

但是,所有没有成功。

你知道我可以做些什么? 你知道哪些是该工作的编码图像中使用?


该解决方案的出现,是编码为UTF - 8文本,并添加一个BOM的指定该字符串实际上是在UTF - 8。

这里的作品:



qr code decoder c/c++ lib

qr code related

ZXing ("Zebra Crossing")

ZXing (pronounced "zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Our focus is on using the built-in camera on mobile phones to scan and decode barcodes on the device, without communicating with a server. However the project can be used to encode and decode barcodes on desktops and servers as well. We currently support these formats:

  • UPC-A and UPC-E
  • EAN-8 and EAN-13
  • Code 39
  • Code 93
  • Code 128
  • QR Code
  • ITF
  • Codabar
  • RSS-14 (all variants)
  • Data Matrix
  • PDF 417 ('alpha' quality)
  • Aztec ('alpha' quality)

 JavaScript QRCode reader for HTML5 enabled browser. 2011 Lazar Laszlo  http://lazarsoft.info  Try it online: http://webqr.com  This is a port of ZXing qrcode scanner, http://code.google.com/p/zxing.  Usage:  Include the scripts in the following order:  <script type="text/javascript" src="grid.js"></script> <script type="text/javascript" src="version.js"></script> <script type="text/javascript" src="detector.js"></script> <script type="text/javascript" src="formatinf.js"></script> <script type="text/javascript" src="errorlevel.js"></script> <script type="text/javascript" src="bitmat.js"></script> <script type="text/javascript" src="datablock.js"></script> <script type="text/javascript" src="bmparser.js"></script> <script type="text/javascript" src="datamask.js"></script> <script type="text/javascript" src="rsdecoder.js"></script> <script type="text/javascript" src="gf256poly.js"></script> <script type="text/javascript" src="gf256.js"></script> <script type="text/javascript" src="decoder.js"></script> <script type="text/javascript" src="qrcode.js"></script> <script type="text/javascript" src="findpat.js"></script> <script type="text/javascript" src="alignpat.js"></script> <script type="text/javascript" src="databr.js"></script>  Set qrcode.callback to function "func(data)", where data will get the decoded information.  Decode image with: qrcode.decode(url or DataURL). Decode from canvas with "qr-canvas" ID: qrcode.decode()
 
 qr code generator:
 
 http://goqr.me/

Tuesday, September 27, 2011

http://thrivingkings.com/ very good jquery sticky, badger, popup etc plugins

Sticky

An unbelievably simple notification system for jQuery

Keep your users all warm and fuzzy by quickly notifying them of software updates, process completions, or annoying registration reminders.

  • Released: July 19th, 2011
  • Current version: 1.0
  • Filed under: Plugins
  • Badger

    Super sexy iOS style badges for jQuery

    Give your users a dose of familiarity with iOS style badges. Badger will easily add a beautiful badge to your element without the need for images.

  • Released: May 14th, 2011
  • Current version: 1.0
  • Filed under: Plugins
  • Formly

    The form glamorizer for jQuery

    An unbelievably easy way to add style and validation to your forms. Easily add style, validation, and a more impressive user interaction with a single function.

  • Released: May 11th, 2011
  • Current version: 1.0
  • Filed under: Plugins
  • Apprise

    The attractive alert alternative for jQuery

    Apprise is a very simple, fast, attractive, and unobtrusive way to communicate with your users. Also, this gives you complete control over style, content, position, and functionality.

  • Released: April 15th, 2011
  • Current version: 1.5
  • Filed under: Plugins
  • Droool

    A presenter of Dribbble

    Droool is a simple app that makes use of Dribbble's API. A great tool if you're ever in need of some inspiration.

  • Released: April 6th, 2011
  • Current version: 2.0
  • Filed under: Apps
  • Boo.kz

    A URL shortener for book lovers

    Boo.kz is a very simple and easy to use URL shortener with a premium top level domain name aimed towards book lovers. Boo.kz was immediately successful and was quickly acquired by LibraryThing.

    Monday, September 26, 2011

    How to create a custom admin theme for the symfony/doctrine admin generator

    this works for symfony 1.4

    I am currently working heavily on the gjPositionsPlugin which concept and idea I blogged about earlier. One part that I didn't like too much and that als Ryan Weaver pointed out to me is that I limited its use to a single model class.

    Now I wanted to change that and turned the functionality from being attached to a model to being a behaviour instead. I then realised that being model independant will not easily allow me to provide functionality in an admin module. Then I remebered admin generator themes. And started building one.


    To start you basically just copy the existing default theme admin and give it a new name. You can place this in the /data folder of your project or like me in your plugin. (This can be applied to Propel as well of course).

     
    $ mkdir -p data/generator/sfDoctrineModule/THEME_NAME
    $ cp -r /path/to/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/* \
    data/generator/sfDoctrineModule/THEME_NAME/

    Note that there is no fallback mechanism. Files that you delete from your theme will not be taken from the default theme!

    Lets have a look at what was being copied.

     
    data/generator/sfDoctrineModule/THEME_NAME/
    +- /parts/
    | `- /actionsConfiguration.php
    | `- /batchAction.php
    | `- /configuration.php
    | `- /createAction.php
    | `- /deleteAction.php
    | `- /editAction.php
    | `- /fieldsConfiguration.php
    | `- /filterAction.php
    | `- /filtersAction.php
    | `- /indexAction.php
    | `- /newAction.php
    | `- /paginationAction.php
    | `- /paginationConfiguration.php
    | `- /processFormAction.php
    | `- /sortingAction.php
    | `- /sortingConfiguration.php
    | `- /updateAction.php
    |
    +- /skeleton/
    | `- /actions/
    | `- /actions.class.php
    | `- /config/
    | `- /configuration.php
    | `- /helper.php
    | `- /lib/
    | `- /generator.yml
    | `- /view.yml
    | `- /templates/
    | `- /.sf
    |
    `- /template/
      `- /actions/
        `- /actions.class.php
      `- /config/
        `- /helper.php
      `- /lib/
        `- /generator.yml
      `- /templates/
        `- /_assets.php
        `- /editSuccess.php
        `- /_filters_field.php
        `- /_filters.php
        `- /_flashes.php
        `- /_form_actions.php
        `- /_form_field.php
        `- /_form_fieldset.php
        `- /_form_footer.php
        `- /_form_header.php
        `- /_form.php
        `- /indexSuccess.php
        `- /_list_actions.php
        `- /_list_batch_actions.php
        `- /_list_field_boolean.php
        `- /_list_footer.php
        `- /_list_header.php
        `- /_list.php
        `- /_list_td_actions.php
        `- /_list_td_batch_actions.php
        `- /_list_td_stacked.php
        `- /_list_td_tabular.php
        `- /_list_th_stacked.php
        `- /_list_th_tabular.php
        `- /newSuccess.php
        `- /_pagination.php

    The parts folder

    The parts folder is actually part of the templates folder. You can find two kinds of files in it: action files and configuration files.

    The action files contain one action method each that will be included from the appropriate action class from the templates folder.

    The configuration files will be included when the actual module in the cachedirectory will be generated (after every clear-cache). They will consider the settings the user has chosen in his generator.yml and configuration class!

    If you make changes in the parts folder they will not take effect until you cleared the cache.

    The template folder

    The template folder holds the skeleton for the admin module that will be generated into the cache dir. This includes an actions class, templates and partials, configuration and helpers.

    This is the folder you want to work in to provide functionality to the user.

    If you make changes in the template folder they will not take effect until you cleared the cache.

    The skeleton folder

    The skeleton folder holds the skeleton for the module that will be generated into the users application.

    This module is meant to be edited by the user and you should not add any fancy stuff here. The only sensible change I can think of is to set a different default configuration.

    If you make changes in the skeleton folder they will not take effect until you re-generated the module!

    Because the admin module needs to be re-generated in order to consider your changes I propose that the best practice workflows for changes in this folder is to work on the generated module itself and "packport" the changes to the skeleton folder when you're done. Please also note that every change in this folder requires the user to reproduce it when he wants to use your theme on an existing module. This means you have to document it!

    PHP inside PHP

    The files we discussed are processed by PHP when the generation is taking place. But the resulting module code needs to include PHP as well. This is why there are two different PHP notations present in almost all the above files. Consider the following example:

     
    <h1>[?php echo <?php echo "$barfoo->getValue()" ?> ?]</h1>

    // will produce

    <h1><?php echo $barfoo->getValue() ?></h1>

    view rawexample.phpThis Gist brought to you by GitHub.

    How to apply the theme

    There are two ways to apply your new theme. The most common one is to change the generator.yml of your existing admin module.

     
    generator:
      param:
        ...
        theme: THEME_NAME
        ...

    Don't forget to clear the cache afterwards!

    The other method will generate not only the cache files from your theme but the admin module on the application level as well.

     
    $ php symfony doctrine:generate-admin --theme=THEME_NAME frontend YourModel

    If you need to re-generate the module you have to delete the module from the application first and also remove the route collection generated in the applications routing.yml.