Posts Tagged ‘code’
15
feb

Follow these simple steps, and after 1 minutes you’ll print your code generated pdf from your iphone!

  • Create a XIB with the size of your pdf (in my case is 612×792) and add all UILabel or UIImage that you need.
  • Import CoreText Framework and include in your project.
    Remember that CoreText.framework works only with iOS >= 3.2 for ipad and iphone 4.0.
  • Add these methods declarations in your .h:
  • 1
    2
    3
    4
    5
    6
    7
    8
    + (void) drawPDF:(NSString*)fileName;

    + (void) drawLabels;
    + (void) drawText;
    + (void) drawText:(NSString*)textToDraw inFrame:(CGRect)frameRect;
    + (void) drawLineFromPoint:(CGPoint)from toPoint:(CGPoint)to;
    + (void) drawLogo;
    + (void) drawImage:(UIImage*)image inRect:(CGRect)rect;

    Now, implement all methods in your class…

    Continue reading “[Objective-C] Print code generated PDF with AirPrint” »

    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , , , , , ,

    16
    dic

    Here a unix command line script to count code lines for your project (or something else!).

    In this example it counts lines in an Objective-C iOS Application (.h or .m files).

    1
    2
    3
    4
    $
    $find . \( -name '*.h' -o -name '*.m' \) -print -exec cat {} \; | wc -l
      25812
    $


    Explanation:

    find . \( -name ‘*.h’ -o -name ‘*.m’ \) -print

    - list all files endings with .H or .M recursively from current folder (.).

    -exec cat {} \;

    - while it finds files, exec a cat on current file

    wc -l

    - count lines of current file and sum it to total.

    25812 lines of code! Sounds good!

    enjoy!

    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , , , ,

    20
    mag

    Da una vecchia mail è venuto fuori questo codice…
    …lo pubblico giusto per fare due risate.

    Magic.cpp:

    1
    2
    3
    4
    5
    6
    7
    #include"Magic.h"

    Dear Computer
    Please print "Hello World!" string
    Then wait until user pressed a key
    Best Regards
    Programmer

    Magic.h:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #include<stdio .h>
    #include<conio .h>

    #define a )
    #define Best ;
    #define Computer (void){
    #define Dear void main
    #define key ;
    #define pressed (
    #define Please printf
    #define Programmer
    #define print (
    #define Regards }
    #define string );
    #define Then int
    #define until =
    #define user getch
    #define wait x

    have fun!

    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , , ,

    23
    lug

    Benvenuti nel blog degli appunti di viaggio!

    Snipplets, funzioni interessanti, configurazioni di vario tipo, quasi tutto legato alla programmazione.

    Iscriviti ai feed per essere sempre aggiornato sulle modifiche.

    Avviso per gli utenti:
    - i commenti verranno approvati prima della pubblicazione
    - evitare lo spam o commenti inutili
    - se si desidera commentare con codice usare la sintassi:

    [cc lang= "lang" ] codice [/cc]

    1
    2
    3
        private String funzione () {
            return "TEST";
        }

    I linguaggi evidenziabili sono i seguenti:
    abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, perl, php-brief, php, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, yaml, z80

    albertopasca.it

    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , , , , , , ,

    Switch to our mobile site