<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iVira.name &#187; Computer science</title>
	<atom:link href="http://ivira.name/blog/category/computer-science/feed/" rel="self" type="application/rss+xml" />
	<link>http://ivira.name/blog</link>
	<description>Mostly about programming, Apple and some random stuff</description>
	<lastBuildDate>Mon, 10 Oct 2011 09:39:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cocoa Tip: Filtering NSArray using NSPredicate</title>
		<link>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/</link>
		<comments>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 22:13:35 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=160</guid>
		<description><![CDATA[Today I&#8217;ve had a small task in one of my projects &#8211; to get subset of elements from NSArray. I&#8217;ve already started writing all this NSEnumerator&#8217;s stuff (need to support 10.4) when I remembered about NSPredicator. So, instead of iterating over an array and finding elements that satisfy some condition and adding them to some [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve had a small task in one of my projects &#8211; to get subset of elements from NSArray. I&#8217;ve already started writing all this NSEnumerator&#8217;s stuff (need to support 10.4) when I remembered about NSPredicator. So, instead of iterating over an array and finding elements that satisfy some condition and adding them to some output array you just need to create predicate and filter your input array with it. Here is the sample code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc">NSPredicate <span style="color: #002200;">*</span>predicate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>NSPredicate predicateWithFormat<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;storeState == 1&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #0000ff;">NSArray</span>  <span style="color: #002200;">*</span>outputArray <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>inputArray filteredArrayUsingPredicate<span style="color: #002200;">:</span>predicate<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Predicates language seems to be very powerful and simple. But I can&#8217;t tell you anything about performance, need to investigate.</p>
<p>UPDATE If you want to filter array with regular expressions just use a predicate like this one:</p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;" lang="objc">[NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexp];</pre>
<p>Further reading: <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/index.html">Apple Predicates Programming Guide</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Cocoa Tip: Filtering NSArray using NSPredicate+http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Cocoa Tip: Filtering NSArray using NSPredicate&amp;uri=http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2010/01/13/cocoa-tip-filtering-nsarray-using-nspredicate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Google AJAX search API in Cocoa</title>
		<link>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/</link>
		<comments>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 17:05:12 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://ivira.name/blog/?p=94</guid>
		<description><![CDATA[Sometimes it&#8217;s needed to allow user to find some information in the Web, without interrupting he/she from working with your application. In this small article I&#8217;ll describe simple solution to fulfill this task.
As for today, search = Google and I&#8217;m going to implement search using it. I&#8217;ve implemented category for Cocoa&#8217;s NSArray class for creating [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s needed to allow user to find some information in the Web, without interrupting he/she from working with your application. In this small article I&#8217;ll describe simple solution to fulfill this task.<br />
As for today, search = Google and I&#8217;m going to implement search using it. I&#8217;ve implemented category for Cocoa&#8217;s NSArray class for creating array of dictionaries. Each dictionary represents a search results. You can define where to search (web, news, video) etc and how many results to return. This code requires <a href="http://code.google.com/p/json-framework/">JSON Framework by Stig Brautaset</a></p>
<p>Here is the code of the main search method. The full project can be downloaded <a href='http://ivira.name/blog/wp-content/uploads/2009/10/iGoogle.zip'>here</a> (XCode 3.2, JSON Framework included)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
</pre></td><td class="code"><pre class="objc"><span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>arrayWithSearchFor<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>query type<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>searchType range<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSRange</span><span style="color: #002200;">&#41;</span>range
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>range.location &gt; <span style="color: #0000dd;">56</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    	NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Error while searching in Google : start must be in range [0;56]&quot;</span><span style="color: #002200;">&#41;</span>;
    	<span style="color: #0000ff;">return</span> <span style="color: #0000ff;">nil</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">NSMutableArray</span> <span style="color: #002200;">*</span>results <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMutableArray</span> array<span style="color: #002200;">&#93;</span>;
    SBJSON <span style="color: #002200;">*</span>parser <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
    <span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span>json_string <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
    NSUInteger i <span style="color: #002200;">=</span> range.location;
&nbsp;
    <span style="color: #0000ff;">while</span> <span style="color: #002200;">&#40;</span>i &lt; range.length <span style="color: #002200;">+</span> range.location<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #0000ff;">@try</span> <span style="color: #002200;">&#123;</span>
    	    <span style="color: #0000ff;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>BASE_URL stringByAppendingFormat<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;%@?v=%@&amp;q=%@&amp;start=%i&quot;</span>, searchType, @<span style="color: #666666;">&quot;1.0&quot;</span>, query, i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSMutableURLRequest</span> <span style="color: #002200;">*</span>request <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSMutableURLRequest</span> requestWithURL<span style="color: #002200;">:</span>url
                                        cachePolicy<span style="color: #002200;">:</span>NSURLRequestReloadIgnoringCacheData
                                        timeoutInterval<span style="color: #002200;">:</span><span style="color: #0000dd;">120</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">NSError</span> <span style="color: #002200;">*</span>error <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
            <span style="color: #0000ff;">NSURLResponse</span> <span style="color: #002200;">*</span>response <span style="color: #002200;">=</span> <span style="color: #0000ff;">nil</span>;
            <span style="color: #0000ff;">NSData</span> <span style="color: #002200;">*</span>searchResults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSURLConnection</span> sendSynchronousRequest<span style="color: #002200;">:</span>request
                                         returningResponse<span style="color: #002200;">:&amp;</span>response
                                        error<span style="color: #002200;">:&amp;</span>error<span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>searchResults<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                        <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to search cuz: %@&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #ff0000;">//parse results</span>
            parser <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>SBJSON alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
            json_string <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSString</span> alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span>searchResults encoding<span style="color: #002200;">:</span>NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>;
&nbsp;
            <span style="color: #ff0000;">//NSLog(@&quot;Raw JSON result %@&quot;, json_string);</span>
            <span style="color: #0000ff;">NSDictionary</span> <span style="color: #002200;">*</span>allResult <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>parser objectWithString<span style="color: #002200;">:</span>json_string error<span style="color: #002200;">:&amp;</span>error<span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>allResult || <span style="color: #002200;">&#91;</span>allResult isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNull</span> <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                    <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse all results JSON&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseStatus&quot;</span><span style="color: #002200;">&#93;</span> isEqualToNumber<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNumber</span> numberWithInt<span style="color: #002200;">:</span><span style="color: #0000dd;">200</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseStatus&quot;</span><span style="color: #002200;">&#93;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseDetails&quot;</span><span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            allResult <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;responseData&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>allResult || <span style="color: #002200;">&#91;</span>allResult isKindOfClass<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSNull</span> <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse responseData&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span>newResults <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>allResult objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;results&quot;</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span>newResults<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #0000ff;">@throw</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSException</span> exceptionWithName<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;Failed to parse results&quot;</span> reason<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>error description<span style="color: #002200;">&#93;</span> userInfo<span style="color: #002200;">:</span><span style="color: #0000ff;">nil</span><span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>		
&nbsp;
            <span style="color: #002200;">&#91;</span>results addObjectsFromArray<span style="color: #002200;">:</span>newResults<span style="color: #002200;">&#93;</span>;
            i <span style="color: #002200;">+=</span> SMALL_RESULT_SET;
        <span style="color: #002200;">&#125;</span> <span style="color: #0000ff;">@catch</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSException</span> <span style="color: #002200;">*</span> e<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Exception during searching in Google: %@&quot;</span>, e<span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#125;</span> <span style="color: #0000ff;">@finally</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #002200;">&#91;</span>parser release<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#91;</span>json_string release<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">return</span> results;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>arrayWithWebSearchFor<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>query range<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSRange</span><span style="color: #002200;">&#41;</span>range
<span style="color: #002200;">&#123;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>self <span style="color: #0000ff;">class</span><span style="color: #002200;">&#93;</span> arrayWithSearchFor<span style="color: #002200;">:</span>query type<span style="color: #002200;">:</span>WEB_URL range<span style="color: #002200;">:</span>range<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>And the sample usage:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="objc"><span style="color: #0000ff;">NSArray</span> <span style="color: #002200;">*</span>results <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #0000ff;">NSArray</span> arrayWithWebSearchFor<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;apple&quot;</span> range<span style="color: #002200;">:</span>NSMakeRange<span style="color: #002200;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">5</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
    NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Search finished, found %i&quot;</span>, <span style="color: #002200;">&#91;</span>results count<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #0000ff;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">NSDictionary</span> <span style="color: #002200;">*</span>result in results<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        NSLog<span style="color: #002200;">&#40;</span>@<span style="color: #666666;">&quot;Url = %@&quot;</span>,  <span style="color: #002200;">&#91;</span>result objectForKey<span style="color: #002200;">:</span>@<span style="color: #666666;">&quot;url&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>In this sample code I&#8217;ve searched for &#8220;apple&#8221; and got the following results:</p>
<blockquote><p>2009-10-13 01:18:40.638 iGoogle[63665:a0f] Url = http://en.wikipedia.org/wiki/Apple_Inc.<br />
2009-10-13 01:18:40.641 iGoogle[63665:a0f] Url = http://www.info.apple.com/<br />
2009-10-13 01:18:40.641 iGoogle[63665:a0f] Url = http://www.crunchbase.com/company/apple<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://developer.apple.com/<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://apple.slashdot.org/<br />
2009-10-13 01:18:40.642 iGoogle[63665:a0f] Url = http://finance.yahoo.com/q%3Fs%3DAapl<br />
2009-10-13 01:18:40.644 iGoogle[63665:a0f] Url = http://support.apple.com/batteryprogram/<br />
2009-10-13 01:18:40.644 iGoogle[63665:a0f] Url = http://topics.nytimes.com/topics/news/business/companies/apple_computer_inc/index.html</p></blockquote>
<p>This code has never been used in production, so use on your own risk <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Using Google AJAX search API in Cocoa+http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Using Google AJAX search API in Cocoa&amp;uri=http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2010/01/08/using-google-ajax-search-api-in-cocoa/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XCode Tips</title>
		<link>http://ivira.name/blog/2009/03/31/xcode-tips/</link>
		<comments>http://ivira.name/blog/2009/03/31/xcode-tips/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 11:57:39 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2009/03/31/xcode-tips/</guid>
		<description><![CDATA[This post contains constantly updated list of my favorite XCode/GDB/etc tips.
XCode HotKeys:

Switch to header/source file : Opt + Cmd + Up
Show Console : Shift + Cmd + R
Move to the next argument in Code Completion : Control + / or just Tab (works the latest XCode)
Jump to definition: Cmd + Double Click
Code Completion: Esc
Open Quickly &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>This post contains constantly updated list of my favorite XCode/GDB/etc tips.</p>
<p>XCode HotKeys:</p>
<ul>
<li><strong>Switch to header/source file</strong> : Opt + Cmd + Up</li>
<li><strong>Show Console</strong> : Shift + Cmd + R</li>
<li><strong>Move to the next argument in Code Completion</strong> : Control + / or just Tab (works the latest XCode)</li>
<li><strong>Jump to definition</strong>: Cmd + Double Click</li>
<li><strong>Code Completion</strong>:<strong> </strong>Esc</li>
<li><strong>Open Quickly &#8211; </strong>fast search of symbols; great time-saver: Shift + Cmd + D</li>
</ul>
<p><a title="Xcode shortcuts" href="http://www.1729.us/xcode/Xcode%20Shortcuts.png">Cool shortcut&#8217;s list for XCode</a></p>
<p>GDB Tips:</p>
<ul>
<li>po &#8211; prints object description e.g. po self</li>
<li>t a a bt &#8211; all threads&#8217; descriptions</li>
</ul>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2009/03/31/xcode-tips/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=XCode Tips+http://ivira.name/blog/2009/03/31/xcode-tips/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=XCode Tips&amp;uri=http://ivira.name/blog/2009/03/31/xcode-tips/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2009/03/31/xcode-tips/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2009/03/31/xcode-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magic of svn:keywords</title>
		<link>http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/</link>
		<comments>http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 00:45:23 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2008/12/11/magic-of-svnkeywords/</guid>
		<description><![CDATA[Сегодняшний день не прошел без мини откровений  &#8211; узнала о возможности динамически изменять ревизию/дату изменения в исходниках при коммите. Для этого просто необходимо установить свойство svn:keywords (svn propset svn:keywords &#8220;Date Author&#8221; source.c) с необходимыми ключевыми словами (напр. Revision, Author и т.д.), а в исходнике добавить что-то вроде &#8220;$Revision$&#8221;. И при коммите вместо ключевого слова будет [...]]]></description>
			<content:encoded><![CDATA[<p>Сегодняшний день не прошел без мини откровений  &#8211; узнала о возможности динамически изменять ревизию/дату изменения в исходниках при коммите. Для этого просто необходимо установить свойство svn:keywords (<em>svn propset svn:keywords &#8220;Date Author&#8221; source.c</em>) с необходимыми ключевыми словами (напр. Revision, Author и т.д.), а в исходнике добавить что-то вроде <em>&#8220;$Revision$&#8221;</em>. И при коммите вместо ключевого слова будет вставлен номер ревизии с которой он произведен -<em>&#8220;</em><em>$Revision: 666$&#8221;</em></p>
<p>Одно из применений этого метода для Java &#8211; добавить в каждый класс статический блок</p>
<p><em>static{ System.out.println(&#8221;$Revision$ $Source$ $Date$&#8221;);} </em></p>
<p>При загрузке классов будет выводиться указанная информация, которая может быть крайне полезна при отладке &#8211; напр. один из классов устаревший.</p>
<p>Детали в <a href="http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html">svnbook</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Magic of svn:keywords+http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Magic of svn:keywords&amp;uri=http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2008/12/11/magic-of-svnkeywords/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Google Search API from Java</title>
		<link>http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/</link>
		<comments>http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 09:34:56 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[java google ajax]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/2008/04/25/using-google-search-api-from-java/</guid>
		<description><![CDATA[Recently I&#8217;ve discovered ability to search in Google from Java program in a way different from brute &#8220;crawling&#8221;. And I&#8217;ve found out two options:

Google SOAP API
Google AJAX API


With this API you can issue search requests to Google&#8217;s index of billions of web pages and receive results as structured data, access information in the Google cache, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve discovered ability to search in Google from Java program in a way different from brute &#8220;crawling&#8221;. And I&#8217;ve found out two options:</p>
<ul>
<li><a href="#SOAP">Google SOAP API</a></li>
<li><a href="#AJAX">Google AJAX API</a></li>
</ul>
<p><a name="SOAP"></a></p>
<p>With this API you can issue search requests to Google&#8217;s index of billions of web pages and receive results as structured data, access information in the Google cache, and check the spelling of words. Google SOAP Search API is implemented as a web service and all you need is just get WSDL and call remote methods through SOAP protocol. Usage of this service is limited to 1000 requests per day.</p>
<p>But as you can read on <a href="http://code.google.com/apis/soapsearch/index.html">SOAP API site</a></p>
<blockquote><p>As of December 5, 2006, we are no longer issuing new API keys for the SOAP Search API. Developers with existing SOAP Search API keys will not be affected.</p></blockquote>
<p>So you aren&#8217;t able to get a new API key (I found the old one in Internet). And Google encourages you to use the AJAX Search API, which is described below.</p>
<p>Example of code that perform search request and show obtained results:</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span style="color: #a1a100;">import com.google.soap.search.*;</span>
<span style="color: #a1a100;">import java.io.*;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SimpleGoogleDemo <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> args<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Create a Google Search object, set our authorization key</span>
		GoogleSearch s = <span style="color: #000000; font-weight: bold;">new</span> GoogleSearch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #aaaadd; font-weight: bold;">String</span> clientKey=<span style="color: #ff0000;">&quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;</span><span style="color: #66cc66;">;</span>
		s.<span style="color: #006600;">setKey</span><span style="color: #66cc66;">&#40;</span>clientKey<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		s.<span style="color: #006600;">setQueryString</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;vera.org.ua&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		GoogleSearchResult result = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">;</span>
		<span style="color: #808080; font-style: italic;">// Depending on user input, do search or cache query, then print out result</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
			result = s.<span style="color: #006600;">doSearch</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>GoogleSearchFault f<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;The call to the Google Web APIs failed:&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
			<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>f.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>    <span style="color: #808080; font-style: italic;">// if we made it here, the search went through</span>
		<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Google Search Results:&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;======================&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>result.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>To run this code you need to have <a href="http://vera.org.ua/stuff/googleapi.jar">googleapi.jar</a> in your classpath. This jar file contains very useful and easy-to-use class <code>com.google.soap.search.GoogleSearch</code>, which does all search work.<a name="AJAX"></a></p>
<p><a name="AJAX"></a></p>
<p><a name="AJAX"></a></p>
<p><strong>Google AJAX API</strong></p>
<p>Usage of this unlimited and you can make as many request as you want. Despite the fact that Google in this API FAQ say &#8220;The Google AJAX Search API is currently available only for websites.&#8221; ability to use it exists <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Example of code that perform search request and show obtained results.</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span style="color: #a1a100;">import java.io.*;</span>
<span style="color: #a1a100;">import java.net.*;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GoogleAJAXSearchAPI <span style="color: #66cc66;">&#123;</span>    
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #aaaadd; font-weight: bold;">String</span> endpointURL = <span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;amp;q=vera&quot;</span><span style="color: #66cc66;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">String</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> args<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #aaaadd; font-weight: bold;">Exception</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #aaaadd; font-weight: bold;">URLConnection</span> uc = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">URL</span><span style="color: #66cc66;">&#40;</span>endpointURL<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">openConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #aaaadd; font-weight: bold;">HttpURLConnection</span> connection = <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">HttpURLConnection</span><span style="color: #66cc66;">&#41;</span> uc<span style="color: #66cc66;">;</span>
		connection.<span style="color: #006600;">setDoOutput</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		connection.<span style="color: #006600;">setRequestMethod</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;GET&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		connection.<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #aaaadd; font-weight: bold;">String</span> line<span style="color: #66cc66;">;</span>
		<span style="color: #aaaadd; font-weight: bold;">InputStream</span> inputStream = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>
			inputStream = connection.<span style="color: #006600;">getInputStream</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">IOException</span> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			inputStream = connection.<span style="color: #006600;">getErrorStream</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #aaaadd; font-weight: bold;">BufferedReader</span> rd = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">BufferedReader</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">InputStreamReader</span><span style="color: #66cc66;">&#40;</span>inputStream<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>line = rd.<span style="color: #006600;">readLine</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>line<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>To run this code you <span style="text-decoration: line-through;">need</span> <span style="text-decoration: line-through;">to</span> can get API key <a href="http://code.google.com/apis/ajaxsearch/signup.html">here</a>.</p>
<p>So, have fun <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>PS Take a look at <a href="http://vera.org.ua/blog/projects/oo-wrapper-for-google-ajax-api/">this</a> too &#8211; Java OO wrapper for Google AJAX API.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Using Google Search API from Java+http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Using Google Search API from Java&amp;uri=http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2008/04/25/using-google-search-api-from-java/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Mac Tips: Mac OS X+DosBox+TASM=true dos development in assembler environment</title>
		<link>http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/</link>
		<comments>http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 11:00:59 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/?p=32</guid>
		<description><![CDATA[Что-то моя &#8220;формула счастья&#8221; усложняется   &#8211; после (Mac+Cord=remote Win)
Возникла задача делать лабы по асму для х86-го на моем Маке. Вначале думала найти родную cреду для МакОС, но так сразу не нашлось   И потом вспомнила про старый-добрый TASM, который можно было бы запустить под эмулятором DOS-a. И вышло )
В качестве эмулятора выбран [...]]]></description>
			<content:encoded><![CDATA[<p>Что-то моя &#8220;формула счастья&#8221; усложняется <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  &#8211; после (Mac+Cord=remote Win)</p>
<p>Возникла задача делать лабы по асму для х86-го на моем Маке. Вначале думала найти родную cреду для МакОС, но так сразу не нашлось <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  И потом вспомнила про старый-добрый TASM, который можно было бы запустить под эмулятором DOS-a. И вышло )</p>
<p>В качестве эмулятора выбран <a href="http://dosbox.sourceforge.net/">DosBox</a> &#8211; An open source DOS emulator for BeOS, Linux, Mac OS X, OS/2, and Windows. Ну и TASM ) После стандартной установки DosBox-a и его запуска необходимо примонтировать директорию, в которую заранее необходимо скопировать установщик TASM-a. В моем случае команда имела вид: <strong>mount c ~/dos</strong></p>
<p>Установка TASM-a правда успешно до конца не дошла ( и пришлось доустановить нужные его части, что сделать довольно таки просто. Например, для установки отладчика просто нужно распаковать tddos.pak командой <strong>unpak.exe xl tddos.pak c:\tasm\bin</strong>. Правда вполне возможно, что такая проблема возникла только у меня.</p>
<p>Итак, мы сделали все, чтобы работать в полноценной среде, для разработки программ на ассемблере под дос. Править исходные файлы можно в любимом текстовом редакторе под MacOS, а дальше <strong>tasm.exe prog.asm, tlink.exe /v prog.obj </strong>и наконец<strong> td.exe prog.exe</strong></p>
<p>Так выглядит запущенный отладчик:</p>
<p align="center"><img src="http://neword.org.ua/img/dosbox.jpg" title="td_dosbox" alt="td_dosbox" /></p>
<p style="text-align: left" align="center"> Только ресурсов этот эмулятор ест &#8211; уджас просто</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Mac Tips: Mac OS X+DosBox+TASM=true dos development in assembler environment+http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Mac Tips: Mac OS X+DosBox+TASM=true dos development in assembler environment&amp;uri=http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2007/10/24/mac-tips-mac-os-xdosboxtasmtrue-dos-development-in-assembler-environment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Семинар от IBM на тему безопасности J2EE приложений</title>
		<link>http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/</link>
		<comments>http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 12:01:37 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/?p=31</guid>
		<description><![CDATA[Очередной семинар в Киеве &#8211; на этот раз от IBM (на их семинарах я еще не была  
&#8220;Решения IBM для построение защищенной ИТ-инфраструктуры&#8221;
Когда? 6 ноября 2007, с 10 до 15
Где?  Украина, Киев, ул. Богдана Хмельницкого, д. 53, отель &#8220;Опера&#8221;, зал &#8220;Симфония&#8221;
Registration and details
    More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>Очередной семинар в Киеве &#8211; на этот раз от IBM (на их семинарах я еще не была <img src='http://ivira.name/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>&#8220;Решения IBM для построение защищенной ИТ-инфраструктуры&#8221;</strong></p>
<p>Когда? <em>6 ноября 2007, с 10 до 15</em></p>
<p>Где?  <em>Украина, Киев,</em><em><span class="Apple-tab-span" style="white-space: pre"> </span>ул. Богдана Хмельницкого, д. 53,</em><em><span class="Apple-tab-span" style="white-space: pre"> </span>отель &#8220;Опера&#8221;, зал &#8220;Симфония&#8221;</em></p>
<p><a href="https://www.ibm.com/developerworks/ru/events/devkiev_security/index.html?">Registration and details</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Семинар от IBM на тему безопасности J2EE приложений+http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Семинар от IBM на тему безопасности J2EE приложений&amp;uri=http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2007/10/22/семинар-от-ibm-на-тему-безопасности-j2ee-прил/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2007/10/22/%d1%81%d0%b5%d0%bc%d0%b8%d0%bd%d0%b0%d1%80-%d0%be%d1%82-ibm-%d0%bd%d0%b0-%d1%82%d0%b5%d0%bc%d1%83-%d0%b1%d0%b5%d0%b7%d0%be%d0%bf%d0%b0%d1%81%d0%bd%d0%be%d1%81%d1%82%d0%b8-j2ee-%d0%bf%d1%80%d0%b8%d0%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet works &#8211; help to find Steve Fossett</title>
		<link>http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/</link>
		<comments>http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 16:37:57 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/?p=24</guid>
		<description><![CDATA[3-го вересня зник на своєму літаку Стів Фоссет &#8211; людина, що встановила багато світових рекордів, при чому у різних видах змагань. Це сумна подія і сподіваюсь, що його знайдуть. Але питання не в цьому. Подібний пост йому не допоможе.Цікавим є метод пошуку. Кожен користувач Інтернету може допомогти знайти Стіва Фоссета аналізуючи супутникові знімки на предмет [...]]]></description>
			<content:encoded><![CDATA[<p>3-го вересня зник на своєму літаку Стів Фоссет &#8211; людина, що встановила багато світових рекордів, при чому у різних видах змагань. Це сумна подія і сподіваюсь, що його знайдуть. Але питання не в цьому. Подібний пост йому не допоможе.Цікавим є метод пошуку. Кожен користувач Інтернету може допомогти знайти Стіва Фоссета аналізуючи супутникові знімки на предмет об&#8217;єктів, що схожі на його літак. Цю акцію підтримує Гугл та <a href="http://www.mturk.com/mturk/preview?groupId=9TSZK4G35XEZJZG21T60&amp;kw=Flash">Амазон</a>. При чому кількість розглянутих знімків стрімко зменшується &#8211; швидкість по моїм оцінкам складає приблизно 5 зображень за 1 сек.Якщо це спрацює, то людство матиме цікравий приклад застосування Інтернету для такого важливого завдання як пошук людей. Звичайно ж і раніш таке робилося, але до цього не заохочувались звичайні користувачі Інтернету, які представлють собою величезні за розміром людські ресурси.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Internet works &#8211; help to find Steve Fossett+http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Internet works &#8211; help to find Steve Fossett&amp;uri=http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2007/09/10/internet-works-help-to-find-steve-fossett/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java tips: get last inserted autoincrement fields</title>
		<link>http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/</link>
		<comments>http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 22:02:35 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/?p=23</guid>
		<description><![CDATA[To get last inserted autoincrement fields using JDBC you should write something like this:
                 ResultSet resultSet = statement.getGeneratedKeys();
		      int newId=0;
		      if ( resultSet != null &#038;&#038; resultSet.next() )
		  [...]]]></description>
			<content:encoded><![CDATA[<p>To get last inserted autoincrement fields using JDBC you should write something like this:</p>
<p>                 ResultSet resultSet = statement.getGeneratedKeys();<br />
		      int newId=0;<br />
		      if ( resultSet != null &#038;&#038; resultSet.next() )<br />
		      {<br />
		          newId = resultSet.getInt(1);<br />
		      }</p>
<p>And don&#8217;t forget to add Statement.RETURN_GENERATED_KEYS parameter when create statement.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Java tips: get last inserted autoincrement fields+http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Java tips: get last inserted autoincrement fields&amp;uri=http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2007/09/06/java-tips-get-last-inserted-autoincrement-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another one )</title>
		<link>http://ivira.name/blog/2007/07/03/another-one/</link>
		<comments>http://ivira.name/blog/2007/07/03/another-one/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 19:18:25 +0000</pubDate>
		<dc:creator>vira</dc:creator>
				<category><![CDATA[Computer science]]></category>

		<guid isPermaLink="false">http://vera.org.ua/blog/?p=15</guid>
		<description><![CDATA[Today I&#8217;ve got another one certificate  )))
    More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve got another one <a href="http://vera.org.ua/blog/?page_id=2">certificate</a>  )))</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://www.facebook.com/share.php?u=http://ivira.name/blog/2007/07/03/another-one/' title='Save to Facebook' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/facebook.png' style='width:16px; height:16px;' alt='[Facebook] ' ></a> <a href='http://twitter.com/home/?status=Another one )+http://ivira.name/blog/2007/07/03/another-one/' title='Save to Twitter' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/twitter.png' style='width:16px; height:16px;' alt='[Twitter] ' ></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Another one )&amp;uri=http://ivira.name/blog/2007/07/03/another-one/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://ivira.name/blog/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' ></a>  <a title='See more bookmark and sharing options...' href='http://ivira.name/blog/2007/07/03/another-one/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://ivira.name/blog/2007/07/03/another-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

