Archive for the ‘Dev’ Category

09
mar

Mount the Xcode 3.2.6 DMG and open Terminal

Enter commands:

sh-3.2# export COMMAND_LINE_INSTALL=1
sh-3.2# open /Volumes/Xcode\ and\ iOS\ SDK/Xcode\ and\ iOS\ SDK.mpkg/

You are now able to install Xcode 3.2.6 on Lion with no package modifications!


If the installer dialog while stage “Updating files…” show you this dialog:

In order to continue installation, please close the following application:
iTunes

but you think that have no iTunes opened, open Activity Monitor (located in Applications/Utilities),

Start typing “iTunes” into the filter box in the top right
Select iTunesHelper from the list and click the Quit Process button.





Don’t work?
Try second method:

- Download the Xcode 3.2.6 disk image, ‘xcode_3.2.6_and_ios_sdk_4.3.dmg’, (I will assume it’s in ~/Downloads for the next steps).

- Open up the Terminal and change to the directory where the image resides:

1
cd ~/Downloads

- Attach the disk image with a shadow image to make it writable. Terminal command (as one line):

1
hdiutil attach -shadow xcode_3.2.6_and_ios_sdk_4.3.shadow xcode_3.2.6_and_ios_sdk_4.3.dmg

-Remove the string ‘&& system.compareVersions(my.target.systemVersion.ProductVersion, ’10.7′) < 0 ‘ from line 148 in ‘Xcode and iOS SDK.mpkg/Contents/iPhoneSDKSL.dist’. Assuming the disk image got mounted at ‘/Volumes/Xcode and iOS SDK’, you can use this one-liner:

1
cat '/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg/Contents/iPhoneSDKSL.dist' | sed "s/&amp;&amp; system.compareVersions(my.target.systemVersion.ProductVersion, '10.7') &lt; 0 //g" > '/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg/Contents/iPhoneSDKSL.dist.new' && mv '/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg/Contents/iPhoneSDKSL.dist.new' '/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg/Contents/iPhoneSDKSL.dist'

Install Xcode!

done.

Ref: albertopasca.it
Ref: Catacombae




FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , ,

08
mar



and

Today a simple tutorial to show a right click context menu on a selection on web pages with Chrome Browser!

This:
chrome context menu extension

First of all you need to read chrome developer reference (http://goo.gl/ND5z2) .

You can start reading from manifest files format (manifest.json):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  // Required
  "name": "My Extension",
  "version": "versionString",

  // Recommended
  "description": "A plain text description",
  "icons": { ... },
  "default_locale": "en",

  // Pick one (or none)
  "browser_action": {...},
  "page_action": {...},
  "theme": {...},
  "app": {...},

  // Add any of these that you need
  "background_page": "aFile.html",
  "chrome_url_overrides": {...},
  "content_scripts": [...],
  "content_security_policy": "policyString",
  "file_browser_handlers": [...],
  "homepage_url": "http://path/to/homepage",
  "incognito": "spanning" or "split",
  "key": "publicKey",
  "minimum_chrome_version": "versionString",
  "nacl_modules": [...],
  "offline_enabled": true,
  "omnibox": { "keyword": "aString" },
  "options_page": "aFile.html",
  "permissions": [...],
  "plugins": [...],
  "requirements": {...},
  "update_url": "http://path/to/updateInfo.xml"
}


After that, open notepad and create 3 files in a folder:
- manifest.json
- rightclick.js
- background.html
and an optional icon file
- icon.png (http://goo.gl/3kK92)

In manifest.json copy/paste this code:

1
2
3
4
5
6
7
8
9
10
{
 "name": "YouTube Free Search",
 "description": "Search as you want from any web pages!",
 "version": "0.1",
 "permissions": ["contextMenus"],
 "background_page": "background.html",
 "icons": { "16": "icon.png",
            "48": "icon.png",
             "128": "icon.png" }
}

In background.html copy this string:

1
<script src="rightclick.js"></script>

In rightclick.js write:

1
2
3
4
5
6
7
8
9
10
11
12
13
function sendSearch(selectedText) {
 var serviceCall = 'http://www.youtube.com/results?search_query=' + selectedText;
 chrome.tabs.create({url: serviceCall});
}

chrome.contextMenus.create(
 {
  title: "Find '%s' on YouTube!",
  contexts:["selection"],
  onclick: function(info, tab) {
      sendSearch(info.selectionText);
  }
 });

Yeah!!

You can change serviceCall url with any search string you want like:
Google -> ‘http://www.google.com/q=’ + selectedText;
Facebook -> https://www.facebook.com/search/results.php?q=’ + selectedText;
Bing -> http://it.bing.com/search?q=’ + selectedText;
etc… etc…

Now,
open Google Chrome -> Tool -> Extensions -> Load unpacked extension.
chrome context menu extension
Done!

Select a text in any page and click to see result!
chrome context menu extension

enjoy!

Ref: albertopasca.it


FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , ,

18
feb

Hi nerdz,
today i’ll show you how to easily control remotely your room with a stupid motion detector, a piro sensor (or you can use other sensors, like ultrasonic, infrared, light sensor, pressure, etc etc…) and two lines of PHP code and C.

* Useful if you want to know if anyone enter in your room and the time that remains there! *


You can get this sensor from AirWick deo! :)

How it works?
Your piro sensor, when detect a motion, notify arduino, that was programmed to send to serial port a value (“m” or “n”).
These value are interpreted by a serial reader (c# program, objective-c, java, c++, or somethig else) that call a PHP page that send email if is enabled sending mode.
Second php page, permit you to control arduino (enable/disable/show logs/clear all).

Steps:
Connect your piro sensor to arduino, easy way, like this:
Arduino Connecting Piro Sensor

After that, write your simple arduino code:

Continue reading “[Arduino] Room Spy Email Notificator” »

FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

, , , , , , ,

15
feb

Hi all!
By chance i founded this tricks that permit to show a “Dictionary definition” for the selected word in a UITextField on a hidden menu.

Menu contains these actions:

  • cut
  • copy
  • select
  • select all
  • paste
  • suggest
  • definition
  • indent left
  • indent right
  • It’s a cool tricks, that show an hidden menu with a lot of options, that i never see before!

    Watch this:


    iOS Hidden Menu features
    iOS Hidden Menu features
    iOS Hidden Menu features

    And this is the dictionary definition for pizza on simulator:


    iOS Hidden Menu features

    How?

    Continue reading “[Objective-C] Show dictionary definition on UITextField” »

    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , ,

    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

    , , , , , , , , ,

    01
    feb

    Suppose that we have a ViewController.h and .m like this:

    1
    2
    3
    4
    5
    // ViewController.h
    #import UIKit/UIKit.h

    @interface ViewController : UIViewController
    @end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // ViewController.m
    #import "ViewController.h"
    #import "SetValue.h"

    @implementation ViewController
    - (void)viewDidLoad
    {
      [super viewDidLoad];

      [SetValue SetTheValue:@"a string"];
    }
    @end

    And a class called SetValue, with two methods.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    // SetValue.h
    #import Foundation/Foundation.h

    @interface SetValue : NSObject { }

    + (void) SetTheValue:(id)Obj;
    - (void) MySelector:(id)Obj;

    @end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    // SetValue.m
    #import "SetValue.h"

    @implementation SetValue

    + (void) SetTheValue:(id)Obj
    {
      [self performSelectorOnMainThread:@selector(MySelector:)
                    withObject:Obj
                    waitUntilDone:NO];
    }

    - (void) MySelector:(id)Obj
    {
      NSLog(@"Data: %@", [Obj description]);
    }

    @end

    What is the value printed by the NSLog?

    enjoy.

    Ref: albertopasca.it


    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    Switch to our mobile site