This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Thread() { | |
@ThreadConfined("other") | |
public void run() | |
{ | |
try | |
{ | |
String feed = IO.getHttp(kHackerNewsRssUrl); | |
final List<String> titles = HackerNewsRSSParser.parseTitles(feed); | |
HackerNewsActivityV3LessBuggy.this.runOnUiThread(new Runnable() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analyze: | |
[checkthread] **** | |
[checkthread] Error in class com/flurry/example/hnreader/HackerNewsActivityV2Buggy.java on line 43 | |
[checkthread] The method 'run' has a 'other' thread policy, but the invoked method 'setText' has a 'MAIN' thread policy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Thread() { | |
@ThreadConfined("other") | |
public void run() | |
{ | |
try | |
{ | |
// doing IO off the UI thread -- ok | |
String feed = IO.getHttp(kHackerNewsRssUrl); | |
List<String> titles = HackerNewsRSSParser.parseTitles(feed); | |
for (String t : titles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analyze: | |
[checkthread] **** | |
[checkthread] Error in class com/flurry/example/hnreader/HackerNewsActivityV1Buggy.java on line 29 | |
[checkthread] The method 'onCreate' has a 'MAIN' thread policy, but the invoked method 'getHttp' has a 'other' thread policy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ThreadConfined("other") | |
public final class IO { | |
//… | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.flurry.example.hnreader; | |
import java.io.IOException; | |
import java.util.List; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.widget.LinearLayout; | |
import android.widget.TextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<threadpolicy version="1.0"> | |
<class name="android.app.Activity"> | |
<policy type="ThreadConfined" threadname="ThreadName.MAIN"> | |
<method pattern="on.*" /> | |
</policy> | |
</class> | |
<class pattern="android.*View"> | |
<policy type="ThreadConfined" threadname="ThreadName.MAIN"> | |
<method pattern=".*" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; set two global variables | |
(setq x 'global-x) | |
(setq y 'global-y) | |
;; define a function that returns a nested function | |
(defun return-a-nested-fn (x) | |
;; the nested function takes no arguments and returns a list of two values | |
(lambda () (list x y))) | |
;; call that function, and call the function returned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'RMagick' | |
import Magick | |
if(ARGV.length < 2) | |
puts "call with image filename and gcode filename" | |
exit(1) | |
end | |
XSTEP = 5 | |
YSTEP = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Foo { | |
final int bar = 6; | |
final int[] flarp = new int[] {6}; | |
public class Baz { | |
int bla() { | |
return bar; | |
} | |
int bloo() { |