Skip to content

Instantly share code, notes, and snippets.

@@ -23,25 +23,27 @@ package models.healing
public var cooldown: int = 0;
public static function calculateRepairPrice(building: Building): HealPrice
{
var priceMod : Number = tech.repairPriceMod;
var cooldownMod: Number = tech.repairCooldownMod;
- price.metal = Math.round(Upgradable.calculateCost(UpgradableType.BUILDINGS,
- building.type, ResourceType.METAL, {'level': building.level})
- * priceMod * building.damagePercentage);
arturas@zeus:~/work/spacegame/server$ jruby --1.9 -S rake spec:controllers
/home/arturas/.rvm/rubies/jruby-1.6.5/bin/jruby -S rspec spec/controllers/players_controller_spec.rb spec/controllers/buildings_controller_spec.rb spec/controllers/technologies_controller_spec.rb spec/controllers/announcements_controller_spec.rb spec/controllers/daily_bonus_controller_spec.rb spec/controllers/player_options_controller_spec.rb spec/controllers/chat_controller_spec.rb spec/controllers/objects_controller_spec.rb spec/controllers/quests_controller_spec.rb spec/controllers/routes_controller_spec.rb spec/controllers/market_controller_spec.rb spec/controllers/solar_systems_controller_spec.rb spec/controllers/planets_controller_spec.rb spec/controllers/alliances_controller_spec.rb spec/controllers/notifications_controller_spec.rb spec/controllers/units_controller_spec.rb spec/controllers/game_controller_spec.rb spec/controllers/combat_logs_controller_spec.rb spec/controllers/galaxies_controller_spec.rb spec/controllers/constru
describe "fail" do
it "should not fail" do
a = some_method_that_returns_activerecord_relation
a.include?(object).should be_true # This does not fail.
a.should include(object) # This fails.
end
end
arturas@zeus:~/work/spacegame/server$ ruby ctest.rb
Starting simulation
18:03:09 [worker_1|#<Thread:0x917da50>] --- message arrived ---
18:03:09 [worker_1|#<Thread:0x917da50>] Starting work for 1 seconds.
18:03:09 [worker_2|#<Thread:0x909136c>] --- message arrived ---
18:03:09 [worker_2|#<Thread:0x909136c>] Starting work for 3 seconds.
18:03:10 [worker_1|#<Thread:0x917da50>] Done working.
18:03:10 [worker_1|#<Thread:0x917da50>] --- message arrived ---
18:03:10 [worker_1|#<Thread:0x917da50>] Waiting until worker_2 is done.
18:03:10 [worker_1|#<Thread:0x917da50>] --- message arrived ---
arturas@zeus:~/work/spacegame/server$ cat t.scala
object T {
def three = 3
}
arturas@zeus:~/work/spacegame/server$ scalac t.scala
arturas@zeus:~/work/spacegame/server$ javap T.class
Compiled from "t.scala"
public final class T {
scala> arturas@zeus:~/work/spacegame/server$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Server VM, Java 1.7.0).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :paste
// Entering paste mode (ctrl-D to finish)
object A { def t = 3 }
class A { def t = 4 }
$LOAD_PATH << "lib/"
require 'celluloid'
class LogActor
include Celluloid
def log(message); puts message; end
end
LOG = LogActor.new
@arturaz
arturaz / gist:1710912
Created January 31, 2012 14:57
jthread dump of hanging j7 u2 nebula44 server
spacegame@nexar:~/nebula-server/current$ jstack 1241
1241: Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
spacegame@nexar:~/nebula-server/current$ jstack -F 1241
Attaching to process ID 1241, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 22.0-b10
Deadlock Detection:
^\2012-01-31 17:15:33
Full thread dump Java HotSpot(TM) Server VM (22.0-b10 mixed mode):
"process reaper" daemon prio=10 tid=0x09f15400 nid=0x1ecf waiting on condition [0x8cfe2000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x98ddc190> (a java.util.concurrent.SynchronousQueue$TransferStack)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359)
^\2012-01-31 17:18:23
Full thread dump Java HotSpot(TM) Server VM (22.0-b10 mixed mode):
"Service Thread" daemon prio=10 tid=0x09f44000 nid=0x1fe9 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread1" daemon prio=10 tid=0x09f39800 nid=0x1fe8 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x09f37c00 nid=0x1fe7 runnable [0x00000000]