- 1
- 2
.
buffer.put(Transaction.getTransaction((JSONObject)transactionsData.get(j)).getBytes());
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 35
+70
.
buffer.put(Transaction.getTransaction((JSONObject)transactionsData.get(j)).getBytes());
Вложенность, например. Но это нужно видеть целиком.
https://bitbucket.org/JeanLucPicard/nxt-public/src/
+136
int file_exist (char *filename)
{
char s[200];
sprintf(s, "test -e %s", filename);
if (system(s) == 0){
return 1;
}else{
return 0;
}
}
http://stackoverflow.com/questions/3828192/checking-if-a-directory-exists-in-unix-system-call
+154
let origOverviewShow;
function onOverviewShow() {
/* ... */
Lang.bind(Main.overview, origOverviewShow)();
}
function enable() {
/* ... */
origOverviewShow = Overview.Overview.prototype.show;
Overview.Overview.prototype.show = onOverviewShow;
}
https://github.com/rat4/layoutperwindow/blob/master/layoutperwindow%40rat4.github.com/extension.js
+127
/**
* Determines equality based upon the contents of this Box instead of the box itself.
* As a result, it is not symmetric. Which means that for
*
* <pre name="code" class="scala">
* val foo = "foo"
* val boxedFoo = Full(foo)
* foo == boxedFoo //is false
* boxedFoo == foo //is true
* </pre>
*
* For Full and Empty, this has the expected behavior. Equality in terms of Failure
* checks for equivalence of failure causes.
*/
override def equals(other: Any): Boolean = (this, other) match {
case (Full(x), Full(y)) => x == y
case (Full(x), y) => x == y
case (x, y: AnyRef) => x eq y
case _ => false
}
https://github.com/lift/framework/blob/master/core/common/src/main/scala/net/liftweb/common/Box.scala
+127
override def text: String = super.text
https://github.com/scala/scala/blob/master/src/library/scala/xml/Node.scala
+75
@Override
public boolean onTouchEvent(MotionEvent e) {
x=(int)e.getX(); y=(int)e.getY();
/* ... */
synchronized(this) {
try {this.wait(1000);}
catch (InterruptedException ex) {}
}
return true;
}
/* Gets (screen/pixel) x,y coordinates of last touch event*/
public boolean GetCoordinates(MutablePoint coordinates) {
if (x==-1) return false;
coordinates.init(x,y);
return true;
}
https://github.com/acl33/AndroidDasher/blob/master/src/dasher/android/DasherCanvas.java
+116
object User extends User with MetaMegaProtoUser[User] {
http://exploring.liftweb.net/master/index-2.html
+113
#include <stdio.h>
int main()
{
void say_hello()
{
puts("Hello govnokod!");
}
say_hello();
return 0;
}
http://ideone.com/QZipp
+72
public abstract class SomeActivity extends Activity implements SomeEventListener {
@Override
protected void onResume() {
super.onResume();
application.addSomeListener(this);
}
@Override
protected void onPause() {
application.removeSomeListener(this);
super.onPause();
}
В дополнение к #11379
Вопрос пользователю нужно задать поверх любой нашей активити...
+69
public abstract class SomeActivity extends Activity implements SomeEventListener {
private volatile Integer someEventAnswer;
@Override
public Integer onSomeEvent(final Collection<String> someData) {
final CountDownLatch latch = new CountDownLatch(1);
runOnUiThread(new Runnable() {
@Override
public void run() {
showSomeDialog(someData, latch);
}
});
try {
latch.await();
} catch (InterruptedException ignored) {
}
Integer ret = someEventAnswer;
someEventAnswer = null;
return ret;
}
private void showSomeDialog(final Collection<String> someData, final CountDownLatch latch) {
String[] items = someData.toArray(new String[someData.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select some data");
builder.setItems(items, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
someEventAnswer = which;
latch.countDown();
}
});
Dialog dialog = builder.create();
dialog.setOwnerActivity(this);
dialog.show();
}
Android API Level 8
Суть: из фонового потока задать вопрос пользователю