text:
Q: jvm crash in 8.0_121-b13 Our production servers crashed twice with problematic frame inside one of our classes. We have not been able to reproduce this issue and haven't seen it in any other environment. What can cause this?
how to play..........
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32744 bytes for ChunkPool::allocate
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:273), pid=3304, tid=0x000000000000139c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode windows-amd64 compressed oops)
# Failed to write core dump.
#

---------------  T H R E A D  ---------------

Current thread (0x000000005507a000):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=5020, stack(0x0000000056180000,0x0000000056280000)]

Stack: [0x0000000056180000,0x0000000056280000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

Current CompileTask:
C2:4318067 19033       4       org.hibernate.event.internal.DefaultLoadEventListener::convertCacheEntryToEntity (533 bytes)

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0000000059d16000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=4116, stack(0x0000000077170000,0x0000000077270000)]
  0x0000000059d1a800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=4964, stack(0x00000000774e0000,0x00000000775e0000)]
  0x0000000059d19800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=5780, stack(0x0000000076e60000,0x0000000076f60000)]
  0x0000000058980000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=4112, stack(0x0000000076fe0000,0x00000000770e0000)]
  0x0000000058980800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=5732, stack(0x0000000076d10000,0x0000000076e10000)]
  0x0000000058982000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=4772, stack(0x0000000072ad0000,0x0000000072bd0000)]
  0x000000005897f000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=5068, stack(0x0000000072d00000,0x0000000072e00000)]
  0x0000000058981800 JavaThread "Dispatch-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@71c1d887" daemon [_thread_blocked, id=6052, stack(0x0000000075700000,0x0000000075800000)]
  0x0000000058983000 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" daemon [_thread_blocked, id=3080, stack(0x0000000073a60000,0x0000000073b60000)]
  0x0000000058983800 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" daemon [_thread_blocked, id=4996, stack(0x0000000073c20000,0x0000000073d20000)]
  0x000000005897e800 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" daemon [_thread_blocked, id=2864, stack(0x0000000073910000,0x0000000073a10000)]
  0x0000000059d17800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=2724, stack(0x00000000765f0000,0x00000000766f0000)]
  0x0000000059d19000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=6040, stack(0x0000000076b40000,0x0000000076c40000)]
  0x0000000059d18000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=4916, stack(0x00000000769e0000,0x0000000076ae0000)]
  0x0000000059d14800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=5176, stack(0x00000000760c0000,0x00000000761c0000)]
  0x0000000059d15000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=1104, stack(0x0000000076470000,0x0000000076570000)]
  0x000000005897b800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=2916, stack(0x0000000075fc0000,0x00000000760c0000)]
  0x0000000058979000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=3548, stack(0x0000000075e00000,0x0000000075f00000)]
  0x000000005897d000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=4092, stack(0x0000000073680000,0x0000000073780000)]
  0x000000005897a800 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=5456, stack(0x0000000072ea0000,0x0000000072fa0000)]
  0x000000005897c000 JavaThread "Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=5188, stack(0x0000000075a90000,0x0000000075b90000)]
  0x0000000058978800 JavaThread "Dispatch-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@702d98be" daemon [_thread_blocked, id=2932, stack(0x0000000075850000,0x0000000075950000)]
  0x000000005ac66000 JavaThread "executor-10" [_thread_blocked, id=5052, stack(0x0000000075970000,0x0000000075a70000)]
  0x000000005ac65800 JavaThread "executor-9" [_thread_blocked, id=2476, stack(0x00000000753f0000,0x00000000754f0000)]
  0x000000005ac64800 JavaThread "http-nio-8080-exec-10" daemon [_thread_blocked, id=804, stack(0x00000000749e0000,0x0000000074ae0000)]
  0x000000005ac64000 JavaThread "http-nio-8080-exec-9" daemon [_thread_blocked, id=4540, stack(0x0000000061c50000,0x0000000061d50000)]
  0x000000005ac63000 JavaThread "http-nio-8080-exec-8" daemon [_thread_blocked, id=5892, stack(0x0000000075210000,0x0000000075310000)]
  0x0000000059d23800 JavaThread "http-nio-8080-exec-7" daemon [_thread_blocked, id=6084, stack(0x0000000075100000,0x0000000075200000)]
  0x0000000059d22800 JavaThread "executor-8" [_thread_blocked, id=6140, stack(0x0000000074f30000,0x0000000075030000)]
  0x0000000059d22000 JavaThread "http-nio-8080-exec-6" daemon [_thread_blocked, id=5212, stack(0x0000000066180000,0x0000000066280000)]
  0x0000000059d20800 JavaThread "http-nio-8080-exec-5" daemon [_thread_blocked, id=4732, stack(0x0000000074e00000,0x0000000074f00000)]
  0x0000000059d21000 JavaThread "http-nio-8080-exec-4" daemon [_thread_blocked, id=4712, stack(0x00000000748e0000,0x00000000749e0000)]
  0x0000000059d1f800 JavaThread "http-nio-8080-exec-3" daemon [_thread_blocked, id=3464, stack(0x00000000747d0000,0x00000000748d0000)]
  0x0000000059d1f000 JavaThread "http-nio-8080-exec-2" daemon [_thread_blocked, id=3444, stack(0x00000000741b0000,0x00000000742b0000)]
  0x0000000059d1e000 JavaThread "http-nio-8080-exec-1" daemon [_thread_blocked, id=3512, stack(0x0000000074440000,0x0000000074540000)]
  0x0000000059d1d800 JavaThread "executor-7" [_thread_blocked, id=4924, stack(0x0000000056080000,0x0000000056180000)]
  0x0000000059d1c800 JavaThread "executor-6" [_thread_blocked, id=5772, stack(0x0000000074300000,0x0000000074400000)]
  0x0000000059d1c000 JavaThread "executor-5" [_thread_blocked, id=3124, stack(0x000000006d810000,0x000000006d910000)]
  0x00000000653ec000 JavaThread "executor-4" [_thread_blocked, id=312, stack(0x0000000073090000,0x0000000073190000)]
  0x00000000653ea800 JavaThread "executor-3" [_thread_blocked, id=636, stack(0x0000000073780000,0x0000000073880000)]
  0x00000000653eb000 JavaThread "executor-2" [_thread_blocked, id=544, stack(0x000000006dc00000,0x000000006dd00000)]
  0x0000000059d1b000 JavaThread "executor-1" [_thread_blocked, id=264, stack(0x0000000073eb0000,0x0000000073fb0000)]
  0x0000000059cf1800 JavaThread "ajp-nio-8009-Acceptor-0" daemon [_thread_in_native, id=5480, stack(0x00000000729c0000,0x0000000072ac0000)]
  0x0000000059cf0800 JavaThread "ajp-nio-8009-ClientPoller-1" daemon [_thread_blocked, id=3184, stack(0x0000000070d30000,0x0000000070e30000)]
  0x0000000059cef800 JavaThread "ajp-nio-8009-ClientPoller-0" daemon [_thread_blocked, id=2760, stack(0x0000000072750000,0x0000000072850000)]
  0x0000000059cef000 JavaThread "http-nio-8080-Acceptor-0" daemon [_thread_in_native, id=3640, stack(0x000000006f450000,0x000000006f550000)]
  0x0000000059cee000 JavaThread "http-nio-8080-ClientPoller-1" daemon [_thread_blocked, id=3180, stack(0x0000000070bd0000,0x0000000070cd0000)]
  0x0000000056f02000 JavaThread "http-nio-8080-ClientPoller-0" daemon [_thread_blocked, id=5408, stack(0x0000000070ab0000,0x0000000070bb0000)]
  0x0000000056f01000 JavaThread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon [_thread_blocked, id=2960, stack(0x0000000070740000,0x0000000070840000)]
  0x0000000056f00800 JavaThread "Timer-3" daemon [_thread_blocked, id=5032, stack(0x000000006fb40000,0x000000006fc40000)]
  0x0000000056eff800 JavaThread "schedulerFactoryBean_QuartzSchedulerThread" [_thread_blocked, id=1168, stack(0x000000006f950000,0x000000006fa50000)]
  0x0000000056eff000 JavaThread "schedulerFactoryBean_Worker-10" [_thread_blocked, id=5412, stack(0x000000006f760000,0x000000006f860000)]
  0x00000000571b9000 JavaThread "schedulerFactoryBean_Worker-9" [_thread_blocked, id=5896, stack(0x000000006f5b0000,0x000000006f6b0000)]
  0x00000000571b8000 JavaThread "schedulerFactoryBean_Worker-8" [_thread_blocked, id=3116, stack(0x000000006e940000,0x000000006ea40000)]
  0x00000000571b7800 JavaThread "schedulerFactoryBean_Worker-7" [_thread_blocked, id=2416, stack(0x000000006f320000,0x000000006f420000)]
  0x00000000571b6800 JavaThread "schedulerFactoryBean_Worker-6" [_thread_blocked, id=2052, stack(0x000000006f170000,0x000000006f270000)]
  0x00000000571b6000 JavaThread "schedulerFactoryBean_Worker-5" [_thread_blocked, id=3660, stack(0x000000006f000000,0x000000006f100000)]
  0x00000000636d7000 JavaThread "schedulerFactoryBean_Worker-4" [_thread_blocked, id=3992, stack(0x000000006eed0000,0x000000006efd0000)]
  0x00000000636d6800 JavaThread "schedulerFactoryBean_Worker-3" [_thread_blocked, id=5416, stack(0x000000006ed60000,0x000000006ee60000)]
  0x00000000636d5800 JavaThread "schedulerFactoryBean_Worker-2" [_thread_blocked, id=976, stack(0x000000006eb70000,0x000000006ec70000)]
  0x00000000636d5000 JavaThread "schedulerFactoryBean_Worker-1" [_thread_blocked, id=5724, stack(0x000000006ea40000,0x000000006eb40000)]
  0x00000000636d4000 JavaThread "Timer-2" daemon [_thread_blocked, id=5276, stack(0x000000006e770000,0x000000006e870000)]
  0x000000005ade5000 JavaThread "scheduler_QuartzSchedulerThread" [_thread_blocked, id=3340, stack(0x000000006e570000,0x000000006e670000)]
  0x00000000653ed800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2260, stack(0x000000006e1f0000,0x000000006e2f0000)]
  0x00000000653ec800 JavaThread "com%002ejeecms%002ecore%002esecurity%002e%0043ms%0041uthorizing%0052ealm%002eauthorization%0043ache.data" [_thread_blocked, id=4896, stack(0x000000006dfc0000,0x000000006e0c0000)]
  0x00000000653e9800 JavaThread "Timer-1" daemon [_thread_blocked, id=5360, stack(0x000000006d950000,0x000000006da50000)]
  0x00000000653e9000 JavaThread "com%002ejeecms%002ecore%002eentity%002e%0043ms%0055ser%002elogs.data" [_thread_blocked, id=5844, stack(0x000000006d360000,0x000000006d460000)]
  0x00000000653e8000 JavaThread
  0x000000005adeb000 JavaThread "MySQL Statement Cancellation Timer" daemon [_thread_blocked, id=5644, stack(0x0000000063e00000,0x0000000063f00000)]
  0x000000005adea800 JavaThread "com%002ejeecms%002ecms%002eentity%002eassist%002e%0043ms%0056ote%0052eply.data" [_thread_blocked, id=5172, stack(0x00000000644b0000,0x00000000645b0000)]
  0x000000005ade9800 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2" daemon [_thread_blocked, id=3356, stack(0x0000000064260000,0x0000000064360000)]
  0x000000005ade9000 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" daemon [_thread_blocked, id=3724, stack(0x0000000064130000,0x0000000064230000)]
  0x000000005ade8000 JavaThread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" daemon [_thread_blocked, id=5224, stack(0x0000000063f40000,0x0000000064040000)]
  0x000000005ade7800 JavaThread "Timer-0" daemon [_thread_blocked, id=3136, stack(0x0000000063d00000,0x0000000063e00000)]
  0x000000005ade6800 JavaThread "org%002ehibernate%002ecache%002einternal%002e%0053tandard%0051uery%0043ache.data" [_thread_blocked, id=3396, stack(0x0000000062c30000,0x0000000062d30000)]
  0x000000005ade6000 JavaThread "org%002ehibernate%002ecache%002espi%002e%0055pdate%0054imestamps%0043ache.data" [_thread_blocked, id=5744, stack(0x000000005df70000,0x000000005e070000)]

  0x000000005b4c4000 JavaThread "net.sf.ehcache.CacheManager@30f61e1d" daemon [_thread_blocked, id=5236, stack(0x000000005e0b0000,0x000000005e1b0000)]
  0x00000000571d3000 JavaThread "NioBlockingSelector.BlockPoller-2" daemon [_thread_blocked, id=1332, stack(0x0000000057440000,0x0000000057540000)]
  0x000000005734d800 JavaThread "NioBlockingSelector.BlockPoller-1" daemon [_thread_blocked, id=712, stack(0x0000000058cf0000,0x0000000058df0000)]
  0x0000000056ec8000 JavaThread "GC Daemon" daemon [_thread_blocked, id=2068, stack(0x00000000566c0000,0x00000000567c0000)]
  0x00000000563d4800 JavaThread "AsyncFileHandlerWriter-929338653" daemon [_thread_blocked, id=3360, stack(0x0000000056b40000,0x0000000056c40000)]
  0x0000000056297000 JavaThread "Service Thread" daemon [_thread_blocked, id=3268, stack(0x00000000567e0000,0x00000000568e0000)]
  0x00000000550cb800 JavaThread "C1 CompilerThread1" daemon [_thread_blocked, id=2248, stack(0x0000000055840000,0x0000000055940000)]
=>0x000000005507a000 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=5020, stack(0x0000000056180000,0x0000000056280000)]
  0x0000000055079000 JavaThread "Attach Listener" daemon [_thread_blocked, id=1164, stack(0x0000000055a60000,0x0000000055b60000)]
  0x000000005508d000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3516, stack(0x0000000055f80000,0x0000000056080000)]
  0x0000000055048800 JavaThread "Finalizer" daemon [_thread_blocked, id=3544, stack(0x0000000055d80000,0x0000000055e80000)]
  0x0000000055005000 JavaThread "Reference Handler" daemon [_thread_blocked, id=4188, stack(0x0000000055bd0000,0x0000000055cd0000)]
  0x00000000025ff800 JavaThread "main" [_thread_in_native, id=2424, stack(0x00000000028a0000,0x00000000029a0000)]

Other Threads:
  0x0000000054ffd000 VMThread [stack: 0x0000000055950000,0x0000000055a50000] [id=3160]
  0x00000000562c9800 WatcherThread [stack: 0x0000000056960000,0x0000000056a60000] [id=5560]

VM state:at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x00000000025fdca0] Threads_lock - owner thread: 0x0000000054ffd000

Heap:
 PSYoungGen      total 325632K, used 165084K [0x00000000eab00000, 0x00000000fec80000, 0x0000000100000000)
  eden space 323584K, 50% used [0x00000000eab00000,0x00000000f4a672b0,0x00000000fe700000)
  from space 2048K, 90% used [0x00000000fea80000,0x00000000fec50000,0x00000000fec80000)
  to   space 2048K, 0% used [0x00000000fe880000,0x00000000fe880000,0x00000000fea80000)
 ParOldGen       total 155136K, used 100497K [0x00000000c0000000, 0x00000000c9780000, 0x00000000eab00000)
  object space 155136K, 64% used [0x00000000c0000000,0x00000000c6224720,0x00000000c9780000)
 Metaspace       used 80452K, capacity 84083K, committed 84928K, reserved 1124352K
  class space    used 8658K, capacity 9289K, committed 9472K, reserved 1048576K

Card table byte_map: [0x0000000011d60000,0x0000000011f70000] byte_map_base: 0x0000000011760000

Marking Bits: (ParMarkBitMap*) 0x00000000716bb6d0
 Begin Bits: [0x00000000124d0000, 0x00000000134d0000)
 End Bits:   [0x00000000134d0000, 0x00000000144d0000)

Polling page: 0x0000000000130000

CodeCache: size=245760Kb used=55299Kb max_used=55513Kb free=190461Kb
 bounds [0x00000000029a0000, 0x0000000006030000, 0x00000000119a0000]
 total_blobs=15443 nmethods=14730 adapters=624
 compilation: enabled

Compilation events (10 events):
Event: 4209.671 Thread 0x00000000550cb800 nmethod 19028 0x0000000003a22690 code [0x0000000003a227e0, 0x0000000003a22970]
Event: 4209.707 Thread 0x00000000550cb800 19029       3       org.quartz.utils.ClassUtils::isAnnotationPresentOnSuperClasses (68 bytes)
Event: 4209.707 Thread 0x00000000550cb800 nmethod 19029 0x00000000034e5b90 code [0x00000000034e5d80, 0x00000000034e6668]
Event: 4209.760 Thread 0x00000000550cb800 19030       3       org.apache.tomcat.util.buf.MessageBytes::<init> (5 bytes)
Event: 4209.761 Thread 0x00000000550cb800 nmethod 19030 0x0000000004995dd0 code [0x0000000004995f40, 0x00000000049960c8]
Event: 4209.775 Thread 0x00000000550cb800 19031   !   3       org.hibernate.cache.ehcache.internal.regions.EhcacheGeneralDataRegion::put (86 bytes)
Event: 4209.776 Thread 0x00000000550cb800 nmethod 19031 0x0000000003c639d0 code [0x0000000003c63c00, 0x0000000003c64888]
Event: 4209.843 Thread 0x000000005507a000 19032       4       org.hibernate.event.internal.DefaultLoadEventListener::postLoadEventListeners (36 bytes)
Event: 4209.860 Thread 0x000000005507a000 nmethod 19032 0x0000000006023fd0 code [0x0000000006024280, 0x0000000006024cc8]
Event: 4209.864 Thread 0x000000005507a000 19033       4       org.hibernate.event.internal.DefaultLoadEventListener::convertCacheEntryToEntity (533 bytes)

GC Heap History (10 events):
Event: 4049.872 GC heap before
{Heap before GC invocations=1082 (full 5):
 PSYoungGen      total 300032K, used 299744K [0x00000000eab00000, 0x00000000fd480000, 0x0000000100000000)
  eden space 298496K, 100% used [0x00000000eab00000,0x00000000fce80000,0x00000000fce80000)
  from space 1536K, 81% used [0x00000000fd300000,0x00000000fd438000,0x00000000fd480000)
  to   space 2048K, 0% used [0x00000000fd080000,0x00000000fd080000,0x00000000fd280000)
 ParOldGen       total 155136K, used 100489K [0x00000000c0000000, 0x00000000c9780000, 0x00000000eab00000)
  object space 155136K, 64% used [0x00000000c0000000,0x00000000c6222720,0x00000000c9780000)
 Metaspace       used 80442K, capacity 84077K, committed 84928K, reserved 1124352K
  class space    used 8658K, capacity 9288K, committed 9472K, reserved 1048576K
Event: 4049.879 GC heap after
Heap after GC invocations=1082 (full 5):
 PSYoungGen      total 302592K, used 1408K [0x00000000eab00000, 0x00000000fec80000, 0x0000000100000000)
  eden space 300544K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000fd080000)
  from space 2048K, 68% used [0x00000000fd080000,0x00000000fd1e0000,0x00000000fd280000)
  to   space 2048K, 0% used [0x00000000fea80000,0x00000000fea80000,0x00000000fec80000)
 ParOldGen       total 155136K, used 100489K [0x00000000c0000000, 0x00000000c9780000, 0x00000000eab00000)
  object space 155136K, 64% used [0x00000000c0000000,0x00000000c6222720,0x00000000c9780000)
 Metaspace       used 80442K, capacity 84077K, committed 84928K, reserved 1124352K
  class space    used 8658K, capacity 9288K, committed 9472K, reserved 1048576K
}
Event: 4079.948 GC heap before
{Heap before GC invocations=1083 (full 5):
 PSYoungGen      total 302592K, used 301952K [0x00000000eab00000, 0x00000000fec80000, 0x0000000100000000)
  eden space 300544K, 100% used [0x00000000eab00000,0x00000000fd080000,0x00000000fd080000)
  from space 2048K, 68% used [0x00000000fd080000,0x00000000fd1e0000,0x00000000fd280000)
  to   space 2048K, 0% used [0x00000000fea80000,0x00000000fea80000,0x00000000fec80000)
 ParOldGen       total 155136K, used 100489K [0x00000000c0000000, 0x00000000c9780000, 0x00000000eab00000)
  object space 155136K, 64% used [0x00000000c0000000,0x00000000c6222720,0x00000000c9780000)
 Metaspace       used 80442K, capacity 84077K, committed 84928K, reserved 1124352K
  class space    used 8658K, capacity 9288K, committed 9472K, reserved 1048576K
Event: 4079.958 GC heap after
Heap after GC invocations=1083 (full 5):
 PSYoungGen      total 325632K, used 1856K [0x00000000eab00000, 0x00000000fec80000, 0x0000000100000000)
  eden space 323584K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000fe700000)
  from space 2048K, 90% used [0x00000000fea80000,0x00000000fec50000,0x00000000fec80000)
  to   space 2048K, 0% used [0x00000000fe880000,0x00000000fe880000,0x00000000fea80000)
 ParOldGen       total 155136K, used 100497K [0x00000000c0000000, 0x00000000c9780000, 0x00000000eab00000)
  object space 155136K, 64% used [0x00000000c0000000,0x00000000c6224720,0x00000000c9780000)
 Metaspace       used 80442K, capacity 84077K, committed 84928K, reserved 1124352K
  class space    used 8658K, capacity 9288K, committed 9472K, reserved 1048576K
}

Deoptimization events (10 events):
Event: 4000.892 Thread 0x0000000059d22000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000518e500 method=org.springframework.core.annotation.AnnotationUtils.synthesizeAnnotation(Ljava/lang/annotation/Annotation;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/annotation/Anno
Event: 4000.892 Thread 0x0000000059d22000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000002af3c78 method=java.lang.ref.SoftReference.get()Ljava/lang/Object; @ 6
Event: 4000.892 Thread 0x0000000059d22000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000518e500 method=org.springframework.core.annotation.AnnotationUtils.synthesizeAnnotation(Ljava/lang/annotation/Annotation;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/annotation/Anno
Event: 4000.892 Thread 0x0000000059d22000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000000000518e500 method=org.springframework.core.annotation.AnnotationUtils.synthesizeAnnotation(Ljava/lang/annotation/Annotation;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/annotation/Anno
Event: 4000.893 Thread 0x0000000059d22000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000004d2b214 method=org.springframework.core.annotation.AnnotationUtils.synthesizeAnnotation(Ljava/lang/annotation/Annotation;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/annotation/Anno
Event: 4000.920 Thread 0x0000000059d22000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000000000435b84c method=java.lang.ref.SoftReference.get()Ljava/lang/Object; @ 6
Event: 4001.371 Thread 0x000000005ac63000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000005a136a4 method=java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.offer(Ljava/lang/Runnable;)Z @ 39
Event: 4035.113 Thread 0x000000005add0800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000004c29518 method=java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(I)V @ 19
Event: 4209.730 Thread 0x000000005ac63000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000005253c0c method=java.nio.channels.spi.AbstractInterruptibleChannel.end(Z)V @ 31
Event: 4209.730 Thread 0x000000005ac63000 Uncommon trap: reason=unloaded action=reinterpret pc=0x0000000003aa4118 method=org.apache.coyote.http11.InternalNioInputBuffer.fill(Z)Z @ 270

Internal exceptions (10 events):
Event: 4205.040 Thread 0x000000005897a800 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa1b838) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.043 Thread 0x0000000059d19000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa26b28) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.045 Thread 0x000000005897b800 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000ef9fd718) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.048 Thread 0x0000000059d15000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa353c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.050 Thread 0x000000005897d000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa04090) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.052 Thread 0x0000000059d18000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa3d5b8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.054 Thread 0x0000000058979000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa0ad58) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.056 Thread 0x0000000059d14800 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa4a258) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.056 Thread 0x000000005897c000 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa14cc8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]
Event: 4205.056 Thread 0x0000000059d17800 Exception <a 'java/net/ConnectException': Connection timed out: connect> (0x00000000efa54d50) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 735]

Events (10 events):
Event: 4209.842 Executing VM operation: RevokeBias done
Event: 4209.842 Executing VM operation: RevokeBias
Event: 4209.842 Executing VM operation: RevokeBias done
Event: 4209.842 Executing VM operation: RevokeBias
Event: 4209.843 Executing VM operation: RevokeBias done
Event: 4209.861 Thread 0x000000005507a000 flushing nmethod 0x0000000005a612d0
Event: 4209.862 Thread 0x000000005507a000 flushing nmethod 0x0000000005c09550
Event: 4209.862 Thread 0x000000005507a000 flushing nmethod 0x0000000005c4fed0
Event: 4209.863 Thread 0x000000005507a000 flushing nmethod 0x0000000005e39bd0
Event: 4209.902 Executing VM operation: RevokeBias

  ---------------  S Y S T E M  ---------------

OS: Windows Server 2008 R2 , 64 bit Build 7601 (6.1.7601.23572)

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 79 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, bmi1, bmi2, adx

Memory: 4k page, physical 4193784k(415244k free), swap 4191924k(123832k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.121-b13) for windows-amd64 JRE (1.8.0_121-b13), built on Dec 12 2016 18:21:36 by "java_re" with MS VC++ 10.0 (VS2010)

time: Sat May 06 15:33:04 2017
elapsed time: 4317 seconds (0d 1h 11m 57s)


text:
Q: onclick of a widget in pygtk, display other widgets I want to create a ToolButton widget in pygtk that displays ToolItem widget on its click.. I have a file that contains all classes of widgets(say widgets.py) and another file(say demo.py) that instantiates these widgets and are then inserted into a toolbar.
Demo.py
class Demo(activity.Activity):
    def __init__(self,activity):
        toolbar_box = ToolbarBox()
        self.set_toolbar_box(toolbar_box)
        toolbar_box.toolbar.insert(MathButton(self), -1)
        toolbar_box.toolbar.insert(MathStartTitleEntry(self), -1)
        toolbar_box.show_all()

Widgets.py
class MathButton(ToolButton):
    def __init__(self,activity, **kwargs):
        ToolButton.__init__(self,'add',**kwargs)
        self.props.tooltip = _('Start Maths Game')
        self.connect('clicked', self.mathfun, activity)
    def mathfun(self, button, activity):
        activity.close()

class MathStartTitleEntry(gtk.ToolItem):
    def __init__(self,activity, **kwargs):
        gtk.ToolItem.__init__(self)
        self.entry = gtk.Entry(**kwargs)
        self.entry.set_size_request(int(gtk.gdk.screen_width() / 9),-1)
        self.entry.set_text("Start ")
        self.entry.set_property("editable", False)
        self.entry.unset_flags(gtk.CAN_FOCUS)
        self.entry.show()
        self.add(self.entry)

redpajama_set_name: RedPajamaStackExchange


text:
Q: The height of the combobox changes when I select an item I have a combobox that binds to a collection in which I want to collapse some of them according to a condtion.
The problem is that if in my view model I select an item that it is collapsed in my view, still is displayed the text of the DisplayMemeberPath, so I am trying to set the text of the texblock to an empty string.
I think that I get it, the problem with my solution it is that the hight of the combobx changes when I select and item, so the height it is very few and I can't see the combobox completely.
The code that I am using is this:
<ComboBox
        ItemsSource="{x:Static vg:MyCOllection}"
        SelectedItem="{Binding MySelectedItem}">

    <ComboBox.ItemContainerStyle>
        <Style TargetType="ComboBoxItem">
            <Setter Property="Visibility" Value="Collapsed"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding MyCondition}" Value="True">
                    <Setter Property="Visibility" Value="Visible"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ComboBox.ItemContainerStyle>

    <ComboBox.ItemTemplate>
        <DataTemplate>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding MyCondition}" Value="true">
                    <Setter Property="TextBlock.Text" Value="{Binding MyPropertyInItem}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding MyCondition}" Value="false">
                    <Setter Property="TextBlock.Text" Value=""/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

Perhaps there are better ways to achieve, so I could accept another solutions, how to set the text of the text block in the case the selected item is one of the items collapsed in the combobox.
Thanks.

A: Don't use DisplayMemberPath in your scenario. This will create a TextBlock as string value presenter for the selection box to replace the ComboBoxItem.
Instead of DisplayMemberPath create a DataTemplate:
<ComboBox ItemsSource="{Binding MyCollection}">
  <ComboBox.ItemContainerStyle>
    <Style TargetType="ComboBoxItem">
      <Style.Triggers>
        <DataTrigger Binding="{Binding MyCondition}" Value="False">
          <Setter Property="Visibility" Value="Collapsed" />
        </DataTrigger>
      </Style.Triggers>
    </Style>
  </ComboBox.ItemContainerStyle>

  <ComboBox.ItemTemplate>
    <DataTemplate DataType="{x:Type MyDataType}">
      <TextBlock Text="{Binding MyPropertyInItem}" />
    </DataTemplate>
  </ComboBox.ItemTemplate>
</ComboBox>


text:
Q: How to install google maps through npm? Is there any package available on npm for google maps? Or am I really
supposed to paste this
<script src="https://maps.googleapis.com/maps/api/jskey=YOUR_API_KEY">
</script>

to my index.html and download this js file on every refresh?
This is super annoying, because sometimes I get ReferenceError: google is not defined.

A:
Or am I really supposed to paste this
 to my index.html and download this js file on every refresh?

Yes. This is the only way to do so. There are some packages to dynamically do this for you, but the behavior is the same.
To reiterate, there is no official package for loading the Google Maps JavaScript for the web environment on NPM. The @google/maps referenced by others is for node only.
google is not defined errors can be avoided by using the callback query parameter when loading the google maps script.
Update - 2020/01/17
I wrote @googlemaps/js-api-loader to help load the script dynamically and support promises.
import { Loader } from '@googlemaps/js-api-loader';

const loader = new Loader({
  apiKey: "",
  version: "weekly",
  libraries: []
});

loader
  .load()
  .then(() => {
    new google.maps.Map(div, mapOptions);
  })
  .catch(e => {
    // do something
  });

A: The ReferenceError you're getting is likely because you're not calling the library the right way.
In Google's Documentation suggests that you should specify a callback (like initMap) which would be called when the API finishes loading. Anything you need to do with the Map should go within that function so that you ensure the API is loaded and google is already defined.
<script async defer
        src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>

A: I came across same problem when I was working with React + TypeScript. Firstly I installed Google Maps SDK with this line;
npm install @google/maps

But TypeScript compiler gave an error, also offered me this line to install;
npm install @types/google__maps

and then it worked.
import { createClient } from "@google/maps"

const googleMaps = createClient({
  key: "YOUR_API_KEY"
})

A: The official google maps package (@google/maps) is for node only. In a browser environment, you need to use an unofficial package or include the official script on your site.
To the ReferenceError problem, make sure the script tag for google maps is above the script tag for your code so that it loads first. If it isn't, your script may run before the google global variable is created.
One unofficial package is google-maps, which can be used in a browser.

A: Yes there are a few packages out there.
You can try this one out.
npm - google maps

A: The official documentation refers to this google npm package:
https://www.npmjs.com/package/@googlemaps/js-api-loader
Official documentation: https://developers.google.com/maps/documentation/javascript/overview#js_api_loader_package


text:
Q: Unintended rm-rf command on server I was trying to remove a directory on my server when I unintentionally ran the following command (notice the space) as root
rm -rf db /*

can someone tell me, in what ways this must have impacted my server, since I can see I can no longer access some of the sites on my server.
I am getting a 500 error on these sites.
Any help is appreciated.

A: Wow...Sorry...that's bad. You just deleted pretty much everything on your server. Time to reinstall and restore from backups.
In the future, you might want to put this little line in your bashrc and stop running as root on your server:

alias rm="rm -i"

A: Like Jason Berg said, your're mostly screwed.
You should use this alias to prevent this from happening:
alias rm="rm --preserve-root"

You can recover some files if any running processes have them open: http://www.linux.com/archive/feed/58142

A: Don't do that. You've potentially lost files in the root directory level of the server, starting alphabetically with /bin, /boot, dev... Did you allow the command to run in its entirety or did you Ctrl-C to stop it?

A: I suppose you realized the problem and cancelled the command? (since you're saying that some of your sites are still alive). You deleted everything in / probably in alphabetically order, until the point where you cancelled the command.
If you just type
ls -l /

do you then have /bin and /boot? I would expect these to get deleted first.


text:
Q: Jquery onclick event icon color is not changing for example here i have three icon (fa fa-heart),Normally icon color is green,  My requirement is,if icon 2 is clicked, the background color should change red using an onclick event. suppose again i am clicking same icon 2 means background color should change in green, after that i am clicking icon 3 means background color should change red, I have tried but I am not able to do this. i am getting answer like this, If I click icon 2, icon 1 color is changing. If I click icon 3 , icon 1 color is changing. like every time icon 1 is changing color

 function searchLocality() {

   var city = "something";
   var locality = "something";

   $.ajax({
     type: "POST",
     data: {
       city: city,
       locality: locality
     },
     url: "rentlocalityFilter.php",
     success: function(data) {

       var htmlString = '';
       $.each(res['data'], function(key, value) {
         var id = value.id;
         htmlString += '';

       });
       $('.rentListing').empty().append(htmlString);

     }

   });

 }
 var count = 1;

 function setColor(id) {
   var btn = 'button';
   var color = '#101010';

   var property = document.getElementById(btn);
   if (count == 0) {
     property.style.backgroundColor = "green"
     count = 1;
   } else {
     property.style.backgroundColor = "red"
     count = 0;
   }
 }

A: $('.fa-heart').on('click',function(){
    $(this).toggleClass('redBackground');
});

Each time you click a heart the class will be toggled - if it is present it will be removed.
This can be further developed into
$(this).toggleClass('redBackground greenBackground');

css:
.redBackground{background-color:red}

A: Please find updated code , In your code you are using static id of button so it will update that only.
You have to pass id of actually clicked icon to javascript function and function should store that for that icon its is clicked first time or clicked previously. That needs to be saved in javascript
Note: Code is not tested its just providing you logic how to implement it

         function searchLocality() {

       var city = "something";
       var locality = "something";

       $.ajax({
           type: "POST",
           data: {
               city: city,
               locality: locality
           },
           url: "rentlocalityFilter.php",
           success: function(data) {

               var htmlString = '';
               $.each(res['data'], function(key, value) {
                   var id = value.id;
                   htmlString += '';

               });
               $('.rentListing').empty().append(htmlString);

           }

       });

   }
   var count = 1;

   var objCount = {};

   function setColor(id) {
       var btn = id;
       var color = '#101010';
       if (objCount && objCount[id] != undefined) {
           if (objCount[id] == 0) {
               objCount[id] = 1;
           } else {
               objCount[id] = 0;
           }
       } else {
           objCount[id] = 1;
       }

       var property = document.getElementById(btn);
       if (objCount[id] == 0) {
           property.style.backgroundColor = "green"
           objCount[id] = 1;
       } else {
           property.style.backgroundColor = "red"
           objCount[id] = 0;
       }
   }


text:
Q: How to install Oracle Java 7 in an Amazon Elastic Beanstalk instance Has anyone one come up with a good config script to install Oracle Java 1.7 in to an Elastic Beanstalk instance using the config files stored in .ebextensions. I am using a tomcat7 version of elastic beanstalk and I was able to install openJDK with yum using the following:
packages:
  yum:
    java-1.7.0-openjdk: []
    java-1.7.0-openjdk-devel: []

commands:
  use_java7:
    command: alternatives --set java /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

How ever I would like to use Oracle Java 1.7 not OpenJDK and yum does not have that in it's repo natively.

A: You could alternately install it as you would normally do and use this ami as your ami for creating new ec2 instances.

A: try this configuration file
files:
  "/home/ec2-user/install-oracle-jdk.sh":
    mode: "000755"
    owner: ec2-user
    group: ec2-user
    content: |
      #!/usr/bin/env bash
      wget -O jdk-7u25-linux-x64.rpm --no-cookies --no-check-certificate --header 'Cookie:gpw_e24=http://www.oracle.com; oraclelicense=accept-securebackup-cookie' 'http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm'
      rpm -Uvh /home/ec2-user/jdk-7u25-linux-x64.rpm
      alternatives --install /usr/bin/java java /usr/java/default/bin/java 3
      alternatives --set java /usr/java/default/bin/java

commands:
  execute-install-oracle-jdk-script:
    command: ./install-oracle-jdk.sh
    cwd: /home/ec2-user

A: The accepted answer no longer works, its outdated. This worked for me:
# Install Oracle JDK
rpm --erase --nodeps java-1.6.0-openjdk java-1.6.0-openjdk-devel
rpm -Uvh .ebextensions/jdk-6u45-linux-amd64.rpm
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/default/bin/java 3
/usr/sbin/alternatives --set java /usr/java/default/bin/java
/usr/sbin/alternatives --install /usr/bin/java_sdk java_sdk /usr/java/default/bin/java 3
/usr/sbin/alternatives --set java_sdk /usr/java/default/bin/java

This is for java 6, since I needed it to be. Also, the jdk downloaded from oracle is actually a bin file now (oracle's custom sh script extractor), so what I did is I downloaded the bin file from oracle, extracted it to get the RPM, and then included the RPM inside the ebextensions.
Just include that sh script to run in an ebextensions config file (google ebextenions config if you're unsure).
Hope this helps somebody.


text:
Q: Firebase Web Push background message is never displayed I am using Firebase web push notification in our web application.
The message send from the FCM is never displayed when the application is not active or open. No errors generated.
Front End Code:
<script src="https://www.gstatic.com/firebasejs/5.6.0/firebase.js"></script>
    <script>
        MsgElem = document.getElementById("msg")
        TokenElem = document.getElementById("token")
        NotisElem = document.getElementById("notis")
        ErrElem = document.getElementById("err")
        // Initialize Firebase
        // TODO: Replace with your project's customized code snippet
        var config = {
            apiKey: "<apikey>",
            authDomain: "<app>.firebaseapp.com",
            databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
            storageBucket: "<app>.appspot.com",
            messagingSenderId: "<id>",
        };
        firebase.initializeApp(config);

        const messaging = firebase.messaging();
        messaging
            .requestPermission()
            .then(function () {
                MsgElem.innerHTML = "Notification permission granted."
                console.log("Notification permission granted.");

                // get the token in the form of promise
                return messaging.getToken()
            })
            .then(function(token) {
                TokenElem.innerHTML = "token is : " + token
            })
            .catch(function (err) {
                ErrElem.innerHTML =  ErrElem.innerHTML + "; " + err
                console.log("Unable to get permission to notify.", err);
            });

        messaging.onMessage(function(payload) {
            console.log("Message received. ", payload);
            NotisElem.innerHTML = NotisElem.innerHTML + JSON.stringify(payload)
        });
    </script>

firebase-messaging-sw.js
    importScripts ('https://www.gstatic.com/firebasejs/5.6.0/firebase-app.js');

    importScripts ('https://www.gstatic.com/firebasejs/5.6.0/firebase-messaging.js');

    firebase.initializeApp ({'messagingSenderId': 'id'});

    const messaging = firebase.messaging();

    messaging.setBackgroundMessageHandler (function(payload) {

    console.log('[firebase-messaging-sw.js] Received background message ', payload);

     const data = payload.data;
     const notificationTitle = data.title;
     const notificationOptions = {
body: data.body
     };

      return self.registration.showNotification (notificationTitle,  notificationOptions);
    });

FCM Request:
 {
      "to":"ids",
      "data":{
      "body":"clicktoaction",
      "title":"Simplext Notification"
      }
    }

The event messaging.onMessage (function(payload) is always called irrespective of the application is in fore ground or in background.
I tried changing the FCM Request from "data" to  "notification". It is still the same.
I am using Chrome v 70.

A: I finally found that the firebase client app should be under https for the serviceworker to work.


text:
Q: How did Severus know where the Cloak of Invisibility was? In Harry Potter and the Prisoner of Azkaban, Severus goes into the Shrieking Shack with Harry's Invisibility Cloak on him.

Harry's fists clenched as they watched Snape skid to a halt next to the tree, looking around. He grabbed the cloak and held it up.

How did he know where it was?

A: The cloak is not invisible from both side.
Got it from http://harrypotter.wikia.com/wiki/Cloak_of_Invisibility


text:
Q: Lifting a metric on the base space to the principal $U(1)$ bundle "Let $π:P→M$ be a $U(1)$-principal bundle. We may lift any metric $m$ on $M$ to a $U(1)$-invariant metric $\widehat{m}$ on P such that $π_∗\widehat{m}=m$."
I found a more general form of the above statement in https://mathoverflow.net/questions/372424/lifting-a-metric-on-a-principal-bundle-with-non-compact-fibre. Could anyone tell me what the name of this theorem is? Any reference is welcome.

A: I don't think this theorem has any particular name (it's a fairly simple construction), although I've occasionally seen the metric referred to as the "Kaluza-Klein metric", since the U(1)-version can be used to construct a Hamiltonian that reproduces the motion of a charged particle in an magnetic field (i.e. the Lorentz force equation - the nonabelian version is called Wong's equation). If you're looking for some specific references to the definition of this metric, you could try "Canonical formulations of a classical particle in a Yang-Mills field and Wong's equations"
 Section 2 or "A Tour of Subriemannian Geometries, Their Geodesics and Applications"
 Chapter 11 (both by Richard Montgomery), or "Riemannian Geometry, Fiber Bundles, Kaluza-Klein Theories and All That..." Chapter 4 by Coquereaux and Jadczyk. I'm sure there are plenty of other references out there.


text:
Q: mocking fields of global objects like window using jest I am trying to write code for a small utility class that detects change in orientation. Unfortunately, the only way I found to access these fields window.orientation and window.screen.orientation
I can see that window.orientation is deprecated. The alternative I found is the experimental detection api that is not supported on Safari. And so I decided to stick to the deprecated apis for now till I find something better.
Now the other challenge I am facing is whilst mocking access to these readonly field

I am facing a similar problem when trying same approach with window.orientation.
Essentially properties we are trying to alter are readonly properties.
What is the correct approach in this situation?
Note the deprecation warning for window.orientation that I see is present in lib.dom.d.ts

A: You can use Object.defineProperty() to do this.
E.g.
index.ts:
export function main() {
  const orientation = window.screen.orientation;
  return orientation.type;
}

index.test.ts:
import { main } from './';

describe('63570675', () => {
  it('should pass', () => {
    Object.defineProperty(window.screen, 'orientation', {
      value: { type: 'landscape-primary' },
    });
    const actual = main();
    expect(actual).toEqual('landscape-primary');
  });
});

unit test result with coverage report:
 PASS  src/stackoverflow/63570675/index.test.ts
  63570675
    ✓ should pass (5ms)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |      100 |      100 |      100 |      100 |                   |
 index.ts |      100 |      100 |      100 |      100 |                   |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        5.292s, estimated 14s

source code: https://github.com/mrdulin/jest-codelab/tree/master/src/stackoverflow/63570675


text:
Q: Variability of the reference data and its effect on the transformed values I conducted a study to compare two different tests at two different ages (children). Based on the previous literature we had hoped that the scores should be better (low score) with age but this was not true in our case.
We hypothesised that this finding could be due to the use of different tests (different tests measuring different things). To tackle this issue I collected data from a reference population using same tests  and used the median value of the reference population to calculate a ratio (divided each sample by the median of the reference population).
Now, my question is, how will the variability and spread of the reference population data affect the results that I calculated using the ratios.
Your help is much appreciated.


text:
Q: WebStorm: search does not work I know that is used to search : Ctrl+Shift+F or Edit | Find | Find in Path
and it worked before, but now always returns the empty set, although I know that what I'm looking for - there is in the project
Maybe someone had this problem?

A: As lena said, the following should fix it for you:

*

*Click File -> Invalidate Caches / Restart..

*Click the button "Invalidate and Restart"

*After restart, try run the search again

A: Newer version of Webstorm /PHPStorm automatically exclude some folders. For example vendor folder.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000798990-Vendor-directory-being-automatically-excluded
make sure that folders are not excluded

A: For me nbaosullivan's proposed solution didn't work.
In my case Recursive(Alt+Y) options wasn't selected. I selected it and it worked and it will be set as default, you don't need to select it all the time.

A: Try this (it helped me in PhpStorm 2019.3.1 when "Invalidate Caches / Restart" did not):

*

*Close WebStorm

*Backup directory <your project>/.idea/ to anywhere

*Delete file <your project>/.idea/modules.xml

*Open WebStorm

A: I thought I had this issue but I think actually WebStorm is only returning the first 100 or so results which all happen to be located in 2 files and thus the other occurrences in other files are not shown.

A: For me unchecking the "Words" option (which searches as a whole word) make it work.

A: As an alternative where I needed to refactor the word "holder" with "owner". Using Webstorm's find did not work very well for me. I decided to use instead the the command line with egrep:
egrep -Rli [^place]holder ./src
-R (recursive all files in directory including symbolic links)-l (file name only) -i (ignore case)
I found everything and excluded some instances as well via regex. It is way easier and most accurate.

A: This is how I fixed the issue:

*

*File

*Repair IDE...

*(Follow steps to repair indexes)

After doing this, I was able to search "everywhere" using Shift Shift


text:
Q: Xampp: error 403 on Linux but not on Windows I have installed Ubuntu and XAMPP on my computer but when i start the web server and go to htt://localhost/webname (webname is the folder name inside htdocs) i receive error 403.
There .htaccess inside webname is the following:
# Created on: 03/01/2012
# Author: **********

# Redirect every request to index.php
RewriteEngine on
RewriteBase /
RewriteRule ^$ /webname/public/index.php
RewriteRule ^about/?$ /webname/public/about.php
RewriteRule ^changelog/?$ /webname/public/changelog.php
RewriteRule ^home/?$ /webname/public/home.php
RewriteRule ^friends/?$ /webname/public/friends.php
RewriteRule ^(\w+)/?$ /webname/public/home.php?user=$1
RewriteRule ^login/?$ /webname/public/index.php?show=login
RewriteRule ^signup/?$ /webname/public/index.php?show=signup
RewriteRule ^profile/(\w+)/?$ /webname/public/profile.php?user=$1

# Rewrite www.webname.com -> webname.com
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Disable directory listing for all the subdirectories
Options -Indexes

On Windows everything works fine but on Ubuntu i keep receiving this error.
Thanks for helping.

A: It was a problem of permissions. I just needed to change them to solve it.


text:
Q: How to write quarters on X-Axis labels in Telerik's RadChart? I am using the Telerik's RadChart control that displays some time-based data on a chart. Timestamp is the X-axis dimension.
The control lets me set the label format for that axis, and that's the same format used by DateTime.ToString() method. For example:
"yyyy-mm-dd" would produce dates like 2011-11-18.
However, I'd like to categorize the data by the Quarters (I,II,III,IV). There is no such format specifier nor does the DateTime deals with Quarters.
Is there any way to define the quarter (via format specifiers), or delegate the process of writing the label to a custom function (via some Telerik RadChart's settings)?

A: I have made something like this:

http://www.telerik.com/community/forums/metro/chart-xaml/labeling-the-radcartesianchart-categorical-axis.aspx#2330414


text:
Q: How to create comma separated string from using this kind of a two dimensional array? I have a two dimensional array like this
$FrstArr = Array(
    [0]= array(
                [0]=>101,
                [1]=>ename1,
                [2]=>1110
            ),

    [1]= array(
                [0]=>102,
                [1]=>ename2,
                [2]=>1111
            ),

    [2]= array(
                [0]=>103,
                [1]=>ename3,
                [2]=>1112
             )
)

From this array I need to create one single dimensional array like this
$secondArr = array([0]=>1110,[1]=>1111,[2]=>1112);

With out using any loops how can I create $secondArr array using $FrstArr multidimensional array? Any php built in functionality is available for that?

A: $secondArr = array_map(function ($i) { return $i[2]; }, $FrstArr);

This loops as well, but behind the scenes.

A: $secondArr = array_map(
  function ($item) { return $item[2]; },
  $firstArr
);

Worth to mention, that this will also (internally) loop over the array.


text:
Q: Why are Australian redheads often called 'bluey'? From Wikipedia's article on Virgin Australia:

Virgin Australia was launched as Virgin Blue in August 2000, with two Boeing 737–400 aircraft, one leased from then-sister airline Virgin Express. Initially offering seven return flights a day between Brisbane and Sydney, this has since been expanded to cover all major Australian cities and many holiday destinations. The Virgin Blue name was the result of an open competition; it was a play on the predominantly red livery and the Australian slang tradition of calling a red-headed male 'Blue' or 'Bluey'.

This is confirmed on other sites such as this one.
How did blue come to represent red in Australia?

A: This is an example of a common tendency towards perverse sense of humor in Australian slang. Several sources attest to this.
"In Australian society, Australian men will often give ironic nicknames. For example, a man with red hair will be given the nickname 'Blue' or 'Bluey'."¹
"1978 R.H. Conquest, Dusty Distances: 'I found out later that he was a native of New South Wales, called "Bluey" because of his red hair – typical Australian logic.'"²
"According to an Aussie government site (http://www.cultureandrecreation.gov.au/articles/slang/) it could just be an example of a 'perverse reversal' found in Aussie slang. As writer, poet and member of the modernist literary and artistic movement the Angry Penguins, Max Harris points out in his book The Australian Way with Words, 'one of the Australian ratbag traditions is to take a word and perversely use it as the opposite of its intended meaning.' A well-known illustration of this is the word 'bluey', a nickname for someone with red hair."³

A: The nickname Bluey originated in the 1890s and was used as a nickname throughout World War One to refer to red-haired soldiers of the Australian Imperial Force, especially from New South Wales. During the Second World War, nearly every redhead was nicknamed Bluey, and it spread to civilian life.
The name is ironic, and it seems red-haired men didn't mind it, compared to the usual ginger or red nicknames that are often derogatory.
(I've not confirmed it, but it's been said it may have come from blue meaning fight, based on the belief red-haired Irishmen were prone to fighting, and the phrase, "There goes a blue", when an potential fight walks past.)
Newspapers
The Barrier Miner (Broken Hill, NSW), Saturday 30 March 1940:

It is hard to understand why New South Wales pals in the A.I.F. always named red-headed fellows "Bluey." That nickname of "Bluey" stack to copper headed diggers throughout the war, and it has been carried on in civilian life until this one.

In the Bendigo Advertiser (Vic), Saturday 23 November 1918, "'Nuggutt' in the London "Daily Express" writes about "Army Nicknames" and asks, without answer, "Why is a Red-Headed Man Called Bluey":

I have absolutely nothing to say against the unalterable military law that all Murphies in the army are "Spuds" and that all Clarkes must be "Nobbies". True, I don't know what "Nobbies" are, but I am satisfied that even young and tender Clarkes can qualify for the job. What I want to know is: Why do the Australians call a red-headed man "Bluey?"
Bluey! It seems so silly. Why Bluey? You see a red-headed Australian and you sing out, "Got, a match, Bluey?" and he smiles and gives you one. He doesn't knock you down; he smiles, and answers to the astonishing inexactitude with the cheerful alacrity of a dug-outful of kamerads responding, to a Mills grenade. It is very strange.
I have tried to follow ihis "Bluey" to its lair, but army nicknames have no certuinable parents. They are like Topsy, and they seem to accompany their owners, often their unhappy owners—as a sort of aura.

The Argus (Melbourne, Vic.), Saturday 6 January 1940 says it wasn't an insulting nickname:

Strange, but while with his copper-coloured hair he responds cheerfully to the nickname of "Bluey," call him "Red" and he sees that colour vividly.

But the nickname goes back further, and can be found in the Australian Town and Country Journal (NSW), Saturday 22 October 1898, writing about "The Sydney Newsboys' Day Out":

Quite a number made a little god of Mr. "Johnny" Coleman, who was entertained with songs by lads of the high-toned nicknames of "Jinks,"  "Chops," "Nipper," "Big Tommy, "Bluey," &c., each of whom he rewarded with a silver coin.

Dictionaries
The Concise New Partridge Dictionary of Slang and Unconventional English (2008) by Eric Partridge, Tom Dalzell and Terry Victor says:

Bluey noun used as a nickname for a red-haired person. Ironic in origin. Australia, 1906

A Dictionary of Slang and Unconventional English (2002) by Eric Partridge and Paul Beale defines it:

5. A nickname for a red-headed man: from ca. 1890, esp. in Aus. and NZ.

Virgin Blue
Richard Branson says in his 2012 autobiography, Like A Virgin: Secrets They Won't Teach You at Business School:

In the 1850s, a large influx of immigrants arrived in Australia, hoping to make their fortunes in the gold fields. The Irish, many of whom were redheads, soon gained a reputation as hard drinkers and fighters. A fight, in local slang, was a 'blue'. When a redheaded Irishman passed by, people would say, 'There goes a blue', and to this day, Australians often give their redheaded friends the nickname 'Bluey' while 'blue' is the general equivalent to 'pal', 'mate' or 'buddy'.
In 2000, when we were preparing to launch the airline in Australia, an Australian chef on Necker said to me 'Why not call it Virgin Blue?'. He suggested that Aussies would connect our upstart nature and the traditional red logo with the name Virgin Blue. To highlight the play on words, we painted the planes a bold red.

I can't find any other instance of "There goes a blue" in Google Books, nor in the Trove archive of Australian newspapers (1803 - 1994) or in any dictionaries.
The Concise New Partridge Dictionary of Slang and Unconventional English (2008) has the verb blue meaning to fight as Australian but only since 1962. The OED has the verb as Australian and New Zealand slang from 1955 (the quotations use blueing and blued), and a noun blue as Australian and New Zealand slang (an argument, quarrel, fight, brawl) from 1944 which they suggest may be from to turn the air blue, meaning to swear.

A: The nickname Blue for a redhead originated from the gold fields in the 1860s. An influx of Irish fellows - many of whom had red hair - were considered feisty - especially after drinking, and would be the instigators of fights (a blue). Hence the catch cry - "There goes a blue" - when a redheaded Irishman passed. Problem with this is why is a fight called a blue?

A: I was told it is because the skin of redheads is so pale you can see their blue veins through their skin.


text:
Q: Creating a folder and sub folder where none exist, but don't if they do Ok, I've been working with people on this code, and they have with some help we have come up with this:
This works universally between a Mac and PC.
Option Explicit

Sub CreateFolders()

Dim Sheet1 As Worksheet 'Sheet1
Dim lastrow As Long, fstcell As Long
Dim strCompany As String, strPart As String, strPath As String
Dim baseFolder As String, newFolder As String
Dim cell As Range

Set Sheet1 = Sheets("Sheet1")

With Application
    .ScreenUpdating = False
    .DisplayAlerts = False
    .EnableEvents = False
End With

With Sheet1

    lastrow = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row
    baseFolder = "Lists!$G$1"
     'folders will be created within this folder – Change to sheet of your like.

    If Right(baseFolder, 1) <> Application.PathSeparator Then _
     baseFolder = baseFolder & Application.PathSeparator

       For Each cell In Range("S3:S" & lastrow)    'CHANGE TO SUIT

           'Company folder - column A

           newFolder = baseFolder & cell.Value
           If Len(Dir(newFolder, vbDirectory)) = 0 Then MkDir newFolder

           'Part number subfolder - column C

           newFolder = newFolder & Application.PathSeparator & cell.Offset(0, 1).Value
           If Len(Dir(newFolder, vbDirectory)) = 0 Then MkDir newFolder

       Next

End With

    With Application
        .ScreenUpdating = True
        .DisplayAlerts = True
        .EnableEvents = True
    End With

End Sub

A:
baseFolder = "Lists!$G$1"

This assigns to baseFolder the literal value "Lists!$G$1", not the contents of the cell. You probably meant
baseFolder = Woksheets("Lists").Range("$G$1").Value

(or baseFolder = [Lists!$G$1], if you prefer that syntax).

Also you might find this function useful: MakeSureDirectoryPathExists.


text:
Q: Problem with including libraries stored on server I have a standard set up to work remotely with CLion. I have a header for a library included in my main file(I use the full path) and have a corresponding linking in CMakeLists.txt. The library is stored on server.
The problem is that CLion highlights the header itself as it is not found. Also, all usage cases for functions of the library are highlighted as unknown.
However, when I upload and build my project remotely, everything works normally and I don't have any issues. But it does bug me to work with a bunch of text highlighted in red.
Thanks!


text:
Q: Flutter How to open soft input keyboard when i have physical keyboard too? I use RawKeyboardListener widget for listening barcode scanner, but when scanner connecting to device, soft input keyboard don't work.
How i can open soft input keyboard, when i use scanner?
This code not helpful:
SystemChannels.textInput.invokeMethod('TextInput.show');

or
FocusScope.of(context).requestFocus(FocusNode());

RawKeyboardListener example
RawKeyboardListener(
              focusNode: _focusNode,
              onKey: (event) {
                    if (event is RawKeyDownEvent) {
                      if (event.physicalKey == PhysicalKeyboardKey.enter) {
                        log('ENTER');
                        _barcodeText = '';
                      } else {
                        log('Event data keyLabel ${event.data.keyLabel}');
                        _barcodeText += event.data.keyLabel;
                      }
                      log('barCodeText: $_barcodeText');
                    }
              },
    )


text:
Q: Get `favicon.ico` error, but can not find it in the code When I run my project in browser I get the "can not find favicon.ico" error in browser console:

Failed to load resource: the server responded with a status of 404 (Not Found)
  :8080/favicon.ico

But when I search for favicon in whole project in WebStorm it finds nothing:

A: favicon.ico is the icon on the title bar in your website.
Browser did not find it in your website.
You should provide it to your index.html:
<link rel="shortcut icon" href="assets/images/favicon.ico">

The path you can change by your case.

A: This is normal. No matter if you declared it or not in your code, Chrome will try will try to fetch favicon.ico at the root of your site to display it in your tab. In your case it will try to fetch: http://localhost:8080/favicon.ico
All browsers will do this except SeaMonkey according to Wikipedia article on Favicon
In the old days, this was the standard way of personalizing the browser icon. Now there is a ton of possible icons you can set for various devices: https://stackoverflow.com/a/26768184/1375487
Also, you can check this answer as it suggests ways to prevent that auto-fetch: https://webmasters.stackexchange.com/a/34572
In any case, the best practice would be to set a favicon.ico for your project.


text:
Q: how to connect webcamera to jsp? I have an jsp page and i want to connect my webcam to jsp page, but i cant have a idea how to connect them. so please help me, so i can access my webcam on my jsp page.

A: I think that there are two ways:

*

*You can use the HTML5 <device> tag;

*You can use RIA interfaces with Java Applets or Flash;

I would use the second method because the first one is at its begging.
It's pretty easy to a webcam Applet in your page, but the problem is what will you do with the sent stream and where will you route it?
Regards.


text:
Q: Question About An Time Complexity Example I'm new programmer and learning data structure and algorithm recently. Right now I cannot understand a time complexity example from Geeks for Geeks and really appreciate your advice
Here is the link:
https://www.geeksforgeeks.org/analysis-of-algorithms-set-4-analysis-of-loops/
We can refer to part (1) and (2) in the above link
   // 1st piece of code
   for (int i = 1; i <= c; i++) {
        // some O(1) expressions
   }

   // 2nd piece of code: and c is a constant
   for (int i = 1; i <= n; i += c) {
        // some O(1) expressions
   }

   for (int i = n; i > 0; i -= c) {
        // some O(1) expressions
   }

I don't know why the 2nd piece of code has O(N) while the first piece has O(1) just because the 2nd piece increases by c, but the first piece increases by a constant (which is one) too.
If possible, can anyone suggest any resources that I can read so that I can understand time complexity well? Recently I'm doing some practice on HackerRank and a lot of my programs cannot pass all the test cases just because they run slowly:)

A: The bottom line of complexity analysis is to find a relation between the size of the input and the approximate number of operations an algorithm will perform given that input. The link you provided uses the Big-Oh, an upper bound for the number of operations of an algorithm.
In summary, Big-Oh may be defined as:
O(g(n)) = { f(n): there exist positive constants c and n0
          such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0 }

The first loop is executed a constant amount of iterations, independent of the input size. So, f(n) - the function that represents the number of operations your algorithm perform for a input of size n - is affected by a constant. Therefore, you can find another constant c that, when multiplied by 1 (g(n)), will result in a value always bigger than f(n). In a chart, you'll see your f(n) as a horizontal line (it is a constant - it does not change with N).
On the other hand, the second loop depends on the size of N since it determines when the loop ends. Thus, you cannot find a constant that can be multiplied by 1 (g(n)) so that it will always be bigger than f(n). For instance, as your loop depends on the size of n, assume the function f(n) = n. If you initially pick a constant c (c=10), when n >= 11, f(n) > c.g(n), so O(1) does not apply. Of course, you could pick a bigger c, but then, when n > c, it won't apply. The only way to make it works is to have, at least, O(n).
There are some good MOOC on the subject. For instance:
 - https://www.coursera.org/learn/analysis-of-algorithms
 - https://www.courses.com/university-of-new-south-wales/cs2-data-structures-and-algorithms/1
For a list of available MOOCs on the subject: https://medium.com/@codingfreak/best-online-video-courses-for-data-structures-and-algorithms-616a97556de1
https://www.coursera.org/learn/analysis-of-algorithms


text:
Q: Website not opening google search http to https We have a website and our domain is on dnsimple and server is on heroku. We configured all necessary steps with ssl both on heroku & dnsimple.
When you type any of these 4 urls to url bar it works.
But the problem is, when I search on google as my website and click on the link, it is not opening especially with internet explorer & safari. It gives 404 error.
Error from the console;
ActionController::RoutingError (No route matches "https://www.google.com.tr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwiU0JX39YnQAhWJEiwKHSq2BpQQFggcMAA&url=https%3A%2F%2Fwww.example.com%2F&usg=AFQjCNFg0D1KFk0WGvYOfUoVzNm19KDBYw&bvm=bv.137132246,d.bGg"):

I have added all 4 websites to google search console as;
https://www.example.com
https://example.com
http://www.example.com
http://example.com

Its been more than 24 hours btw. For internet explorer I tried to remove history and flush dns config. Still no luck.
EDIT:
There is no checks as referrer. But there is a code to show header or not as in application controller but I do not think this is relevant;
before_filter :set_locale, :location_action_name
 def location_action_name
    if !logged_in?
      url = Rails.application.routes.recognize_path(request.referrer)
      @last_controller = url[:controller]
      @last_action = url[:action]

    end
  end

EDIT2:
I removed the below code and pushed to heroku now it works. But why is that?

A: The issue is caused by the following code fragment:
  url = Rails.application.routes.recognize_path(request.referrer)
  @last_controller = url[:controller]
  @last_action = url[:action]

As far as I remember (and I guess, given that recognize_path was removed in recent versions of Rails) recognize_path raises a routing error in case it can't find the path.
You are passing arbitrary strings to the function, but the function only recognizes paths internally described in the router.
request.referrer would return 3 different types of URL:

*

*blank: when no referrer

*external URL: when the visitor clicks elsewhere and reaches your app

*internal URL: when the visitor clicks somewhere in your app

In all cases except the third one, recognize_path will raise an error. The error will be caught by the default Rails handler and displayed as 404 (an unrecognized route results in a 404 in production).
I'm not sure what location_action_name is supposed to do, but as it is implemented now it's very fragile and in most cases it will result into causing 404 responses in your app.


text:
Q: Does anyone know of an asynchronous CouchBase client for the Tornado web framework? I am writing a web application that uses nginx to serve static content and tornado to serve dynamic content.  I was thinking of utilizing CouchBase as my datastore, but am having trouble locating a suitable client for use with the Tornado framework (i.e. asynchronous).  Anybody know of one?
I've seen trombi: https://github.com/inoi/trombi but couldn't find much information on it.  If anyone has had any experience with it (good or bad), I'd love to hear about it.

A: I would really recommend sticking with the Couchbase released code for Python. While it isn't technically asynchronous, the queries are so fast that it really doesn't factor into things. Its not like building out a query for a Database which could easily lock up continued actions for a period of time. Not to mention the fact there is a lot of load balancing and bucket management code that you would lose in most situations by trying to find some third party module for it.
Also you can always build a multiprocessing package to create sub-processes to handle removing these calls from the primary process stream and reduce the impact to almost nothing.
UPDATE
Another option is to use Tornado's internal callback functionality to offset the blocking process so it doesn't impair browsing. A method for this is described here: http://tornadogists.org/2185380/


text:
Q: Session is not Defined Using OpenShift for a Meteor Application I am trying to use OpenShift for my Meteor application which uses session variables. The application loads fully, but once the user begins interacting with it, the site fails to load anything because "ReferenceError: Session is not defined." This is really weird because the application runs flawlessly on localhost. Anyone know why this could occur?

A: You need to add the 'Session' package with 'meteor add session'. I've had the same error in the past when I forgot to add the package.


text:
Q: How to backup a bare-metal Ubuntu server with MySQL running 24/7 with zero downtime? I've been researching this for a long time but I cannot find a satisfying solution. People tend to:

*

*Backup Linux systems with rsync - which is good if you want to backup a lot of standalone files but not if you want to backup and eventually restore and entire bare-metal server. Additionally, my MySQL databases have 100GB+ in size and are open 24/7 so there isn't any consistent state other than a point-in-time snapshot.

*Backup Linux systems with Clonezilla is also great for imaging and recovery from standalone hard drives but not really suitable for 24/7 running systems.
What I am looking for is an equivalent of Windows' Volume Shadow Service (VSS) that can backup a running system at any point in time in a consistent state.
My closest idea is to use LVM and an LVM snapshot, backup the LVN snapshot and merge the snapshot with the main partition right after the snapshot. Is this a viable option? If there's any tool that makes this safe and automated (can be commercial) I'm happy with that, too.


text:
Q: Convert Simpletest test suite to PHPUnit I use Simpletest test suites to run all tests, with different configuration methods. I've created one suite per config method, and it sets up the environment and then runs all tests.
Take a look at Adapter.php and Constants.php if that's unclear.
Now there seems to be support for test suites in PHPUnit, but as I understand it, it's merely for grouping tests with no support for setting up the environment or running PHP scripts.
How can I convert my test suites to PHPUnit? I'm open to rethink how the tests are structured :)

A: You can use test fixtures to setup your environment either before each test, or before each test suite:
http://www.phpunit.de/manual/3.6/en/fixtures.html#fixtures.more-setup-than-teardown
The methods you are looking for are

*

*setUp() and tearDown() (called before/after each single test), and

*setUpBeforeClass() and tearDownAfterClass() (called before/after each test class (suite)).

A: Apart from restructuring your test suite you should also be aware that the behaviour of the assertions in PHPUnit is different from SimpleTest.
While in SimpleTest you can test on an assertions result and execute further code after a failed assertion, you cannot in PHPUnit: test the return value of a method that triggers an error with PHPUnit
This will likely also force refactoring some of the actual tests.


text:
Q: How handle Invalid Session Id I am trying to perform a re-login once my sessionId expires but for some reason the catch block is not being executed. The try block returns:
 "[{\"message\":\"Session expired or invalid\",\"errorCode\":\"INVALID_SESSION_ID\"}]"

I am now trying to access the property errorCode, but I cant seem to get it right. Please help.
    var requestResponse = (String)null;

    try
    {
         requestResponse = await apiCallResponse.Content.ReadAsStringAsync();
    }
    catch (FaultException fex)
    {
        if (fex.errorCode == "INVALID_SESSION_ID")
        {
           ...
        }
   }


text:
Q: XNA - Attempting to load textures in another class always gives GraphicsDevice component not found I have read many different solutions to problems similar to this but I cannot find a solution that works for me.
I am just starting on making a simple game to learn the basics of XNA, but I cannot get textures to load in an additional class. I tried this:
EDIT: This is not the main class incase I didn't make that clear enough
class Wizard
{
    // Variables
    Texture2D wizardTexture;
    GraphicsDeviceManager graphics; // I added this line in later, but it didn't seem to do anything

    public Wizard(ContentManager content, GraphicsDeviceManager graphics)
    {
        this.graphics = graphics;
        Content.RootDirectory = "Content";
        LoadContent();
    }

    protected override void LoadContent()
    {
        wizardTexture = Content.Load<Texture2D>("Wizard"); // Error is here
        base.LoadContent();
    }

I have also tried making a method like
public Texture2D Load(ContentManager Content)
{
     return Content.Load<Texture2D>("Wizard");
}

And then have wizardTexture = Load(Content); but that did not work either.
Any help and an explanation is appreciated, thanks

A: That's not the usual constructor for an xna game... it seems that you are using a hack to let using the game class in a winform... if you want to use that way... you are passing wrong the parameteres or your not creating right the graphicsdevicemanager
The usual way to create a xna game is defining this two files:
 // program.cs file
 static class Program
    {
        static void Main(string[] args)
        {
            using (Game1 game = new Game1())
            {
                game.Run();
            }
        }
    }

 // Game1.cs file
 public class Game1 : Microsoft.Xna.Framework.Game {
    GraphicsDeviceManager graphics;

    public Game1( ) {
        graphics = new GraphicsDeviceManager( this );
        Content.RootDirectory = "Content";
    }
    ....
 }

You should realize that the game constructor has no parameters, and the graphicsdevicemanager its created inside the constructor
EDIT: I was thinking that maybe your wizard class its not intended to be a game, but a GameComponent or DrawableGameComponent, in this case it should be:
class Wizard : DrawableGameComponent {
    Texture2D wizardTexture;

    public Wizard(Game game) : base(game)
    {
    }

    protected override void LoadContent()
    {
       wizardTexture = Content.Load<Texture2D>("Wizard"); // Error is here
        base.LoadContent();
    }
    ....
}

Then in you main game class when you initialize the object... you can add add it to the Components collection.
 class Game1: Game {
    ....
    public override void Initialize() {

        Components.Add( new Wizard(this));
    }
 }

A: Works in this way
texture = Game.Content.Load<Texture2D>(textureName);


text:
Q: Saving the audio file when using Android's speech recognition Is there a way to save the file that is recorded when using Android's voice/speech recognition software? I tried the alternative of both recording and using the speech recognition at the same time, but this doesn't seem to work; probably because Android itself won't let two activities use the microphone at the same time. Of course, finding where (and if) the file is saved would be much better.
Thanks!

A: When using RecognitionListener, the function onBufferReceived reads the speech into a buffer, which you can collect.


text:
Q: Raid 0+1 vs raid 1 and disk span in windows server 2012 What is the difference between  hardware raid 0+1 and 2 or more RAID 0 with disk span?
what are the differences: advantages and disadvantages?

A: First of all, you'd want to do 1+0, not 0+1. 1+0 is more fault tolerant, has shorter rebuild times, and almost identical performance. There's a reason you never see 0+1 in production and 1+0 is everywhere.
Second of all, why would you want to bring software RAID into the mix? It's generally accepted that a good hardware controller is superior to most forms of software RAID (ZFS aside). If you do have a reason for software RAID over hardware RAID though,like disk portability, then why are you using hardware RAID at all. Mixing both gives you the benefit of neither.
Also, imagine this support call:

You: My disk arrays keep degrading.
Dell: OK, let's take a look at the PERC here...Ok so it looks healthy,
  but you're using software RAID on top. This is most likely a Microsoft
  issue.
Microsoft: Sorry, this isn't our problem, it's the RAID controller
  underneath causing the software RAID to degrade.

Why would you ever want to put yourself in that situation without having a very good reason?


text:
Q: Delete data from large table efficiently I am running below query to delete data from a very large table.
delete from
  schema2.table2 using schema1.table1
where
  schema2.table2.timestamp2 <= schema1.table1.timestamp2
  and schema2.table2.id = schema1.table1.id;

This query is using hash join for data deletion and scanning more than 3 TBs of data. Reason being out of these 2 columns, none of them are either sort or dist key.
We have 2 timestamp columns in the table, timestamp1(our sort key) we use for select queries and timestamp2 for insertion and deletion.
I solution I can think of is to separate these queries, so first we select the data from 1st table and then delete it from 2nd table in batches:
WHILE EXISTS ( SELECT * FROM table1 WHERE (condition for deleting))

BEGIN
SET ROWCOUNT 1000
DELETE Table2 WHERE (condition for deleting)
SET ROWCOUNT 0
END

but I am not sure how efficient this option is.
Please suggest me what would be the best way to delete data efficiently?

A: Why don't you create a new table for the rows you will keep instead of deleting the rows. Delete is always costly no matter which db you use.
if your table is called schema2.table2  you can use the following
create table schema2.table3 as
select t2.* from
  schema2.table2 t2, schema1.table1 t1
where
  t2.timestamp2 > t1.timestamp2
  and t2.id = t1.id;

drop table schema2.table2;
alter table schema2.table3 rename to schema2.table2;


text:
Q: Why is Android looking for QVGA resources in the wrong order mdpi > hdpi > ldpi? I'm trying to do some testing with a QVGA emulator and I find that it looks for an image resource in the mentioned order.
drawable-mdpi 1st
drawable-hdpi 2nd
drawable-ldpi 3rd(it does get found only after I change the name of the image in the other two dirs for testing)
I would expect it to be ldpi first.
When running other emulators (HVGA and WVGA) they use their appropriate drawable dirs... it's only QVGA. The only code that I see could affect this is here (based on the docs)

I have tested this with a 2.0 emulator and a 1.6, I get the same result.
Any ideas? Thank you very much.

A: Check the hw.lcd.density setting in the config.ini for you QVGA AVD.  If this is set incorrectly then the emulator might not be running as a low density device.  It should be 120.
You can also check using the Details button in the Android SDK and AVD Manager GUI which you can launch from Eclipse or by entering android at a command prompt:

A: It appears that I have to enter the density manually.
If I just select QVGA as a Skin from the "Built-in" drop down list it puts 120 as the value for the Abstracted LCD density, but it doesnt seem to work...
So I delete that property and add it back, then change the value to 120. Thank you much Dave for your direction.


text:
Q: TLS error by connecting to API with OkHttpClient I get an error while tring to connect to an APi server with OkHttpClient
made full of reaserch about it and tryed any option that can maybe help
I am working with Eclipse
my error was "connection closed by peer" and I couldnt resolve it so I downloded jar files of OkHttp and then I det the error:
Unable to find acceptable protocols. isFallback=false, modes=[ConnectionSpec(cipherSuites=[TLS_DHE_RSA_WITH_AES_256_CBC_SHA], tlsVersions=[TLS_1_2], supportsTlsExtensions=true)], supported protocols=[SSLv3, TLSv1]

....
String r = "";
Response response;
try {
String url = "https://api.honeywell.com/oauth2/token";
        RequestBody requestBody = new
    MultipartBody.Builder().setType(MultipartBody.FORM)
                    .addFormDataPart("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML").build();

Request request = new Request.Builder().url(url).post(requestBody).build();
        OkHttpClient client = new OkHttpClient();

        ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS).tlsVersions(TlsVersion.TLS_1_2)
                .cipherSuites(CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA).build();

        client = new OkHttpClient.Builder().connectionSpecs(Collections.singletonList(spec)).build();

        try {
            response = client.newCall(request).execute();
            r = response.body().toString();

        } catch (IOException e) {
            r = "1111 " + e.getMessage();
        }

    } catch (Exception e) {
        r = "222 " + e.getMessage();
    }

    return r;

can anyone help me How to set up the ConnectioSpecs? I think this is my issue what ecver I put over there I get an error with what I put.
Thank you for looking into my problem because I am lost.


text:
Q: MySQL Selecting ID's that are not in another table I'm trying to write a query which selects two ID's from a list of Items, which have never met in a head-to-head match (previous head-to-head matches are stored in a table called Face-offs). The intention is the select two ID's for the next match. They should be random, so you could keep running the query, and keep returning a new random face-off.
Items:
+----+-----------+
| ID | Item name |
+----+-----------+
|  1 | trees     |
|  2 | plants    |
|  3 | animals   |
+----+-----------+

Face-Offs:
+--------+-------+
| winner | loser |
+--------+-------+
|      1 |     2 |
|      2 |     3 |
+--------+-------+

Currently, I have this query:
select id from items order by rand() limit 2

to select two random item IDs, however, I'm not sure how to find out if they have met in two different columns of the Face-Off table before.
Can this query be done with just MySQL or would I have to loop the query over and over until a result is returned?

A: You should return a row with two items that have not met the face off.  The simple way to write the query is:
select i1.id as id1, i2.id as id2
from items i1 cross join
     items i2 left join
     faceoffs f
     on (f.winner = i1.id and f.loser = i2.id) or
        (f.winner = i2.id and f.loser = i1.id)
where f.winner is null and i1.id <> i2.id
order by rand()
limit 1;

This may work for you.  However, the performance may be abyssmal.  The following is an approach that might have better performance because it chooses one randome item first.  The downside is the random might might have faced off to everything else, so it might not return anything.  You can just call it again:
select i1.id
from (select id
      from items
      order by rand()
      limit 1
     ) i1 cross join
     items i2 left join
     faceoffs f
     on (f.winner = i1.id and f.loser = i2.id) or
        (f.winner = i2.id and f.loser = i1.id)
where f.winner is NULL and i1.id <> i2.id;


text:
Q: What would be the proper distribution to model the number of particles in a state in canonical ensemble Suppose my system has $N$ particles, and I want to find a distribution for $n_i$, the number of particles in the $\epsilon_i$ energy state.
What I do know is the boltzmann probability, which tells me the probability of a single particle being in a certain energy state, and is denoted using $p_i$. I also know the expected number of particles in a system, given by $p_iN=\mu$.
According to some people that I asked, the distribution of particles would follow a binomial distribution, where the number of particles in the state would be a random variable. Hence, it would be given by :
$$p(n_i)={^{N}C_{n_i}}\space p_i^{n_i}(1-p_i)^{N-n_i}$$
Using this I can find the probability of each possible occupation number, through a binomial distribution.
Physically, this is equivalent to picking $N$ particles out of the system and counting the number of particles in $n_i$, and then repeating this experiment many many times and checking the frequency of each value of $n_i$. Because of fluctuations, we can be sure that $n_i$ keeps on changing every time I do this trial. It is basically like the distribution of heads in a $100$ coin tosses.
However, there is a second distribution that came to my mind. We know that the system can have $n_i$ particles, where $n_i$ ranges from $0$ to $N$. So, we consider $N+1$ different systems, labelled from $0$ to $N$, where the label denotes the number of particles in $\epsilon_i$ state of this system at a particular timestamp. Now what we do is, we check the probability of each of these systems of being the original system. Since these systems have a fixed number of $n_i$ each, we are indirectly getting the distribution of the number of particles $n_i$ of the original system.
So, what we check is, the probability of each of these systems, to give us a $p_i$ probability of picking up a particle at random, and finding it is in the $i$ state. In a sense, this is probability of probabilities.
How do we do that ?
Well, you know the expected number of particles in the energy state is given by $\mu$. So, we take each of these systems, and take out $N$ particles with replacement, and count the number of particles in that state, and repeat this experiment many many times. Whenever $\mu$ out of $N$ particles are in the desired state, we consider it a success. We check the frequency of success for each of these $N+1$ systems. This would give us a probability distribution of which system is how likely to give us a $p_i$ chance of picking up a random particle and finding it in a particular state. This distribution would be given by :
$$p(n_i)={^NC_\mu} \space\space(\frac{n_i}{N})^\mu \space\space (1-\frac{n_i}{N})^{N-\mu}$$
This distribution is not normalized, and looks a lot like the Binomial distribution. However, this takes into account, that for each system, the probability of getting a certain particle to be in a certain state, would be different. Moreover, the physical analogy also makes more sense in this case.
As discussed in my previous question, the boltzmann distribution is more like an estimator of the true probability of finding a particle in a certain state, as written by @Roger Vadim in this answer. So, instead of the distribution of the particles being a perfect boltzmann distribution, should it not be the distribution of different systems based on how likely the probability of getting a single particle in $i$ state in that system matches the boltzmann probability of the same.
In other words, shouldn't the second distribution be more accurate ?
I've checked that for large numbers, the two distributions produce more or less the same result, but I wanted to know which one is more accurate.

A: Tracking links to previous "similar" problems, one finds
several over the last four years--some on this site and
some on the physics site. Unfortunately, none of them
is clearly stated and several mention more than one
probability model. So this "Answer" of mine has to be speculative.
Suppose the proportion $p_i$ of particles in state $i$
is truly $p_i = 0.4.$ Then it is certainly possible
for as few as 30 of 100 particles to be in state $i.$
Such particular potentially misleading results happen with probability about $0.025;$ counts as small as $35$ occur
with probability about $0.18;$ and misleading counts above $40$ may
also occur. [Using R.]
pbinom(30, 100, .4)
 0.02478282
pbinom(35, 100, .4)
[1] 0.1794694

It seems possible that the current question (and some of its several
predecessors) may really be concerned about the power
of formal tests against alternatives as far from the true value $0.4$ as $0.3$ and $0.5.$
Such power values are easily simulated in R as shown below.
Power values for tests (at the 5% level of significance) are only about $55\%$ against incorrect value $p_i=0.3$ and $46\%$ against $p_i=0.5.$
set.seed(2021)
pv = replicate(10^5, binom.test(rbinom(1,100,.3), 100, p=.4)$p.val)
mean(pv <= .05)
[1] 0.54955
pv = replicate(10^5, binom.test(rbinom(1,100,.5), 100, p=.4)$p.val)
mean(pv <= .05)
[1] 0.46214

So, by using binomial tests, $N=100$ observations is not enough
to distinguish among $0.3, 0.4,$ and $0.5,$ using
exact binomial tests.
Moreover, if we observe $35$ in state $i$ out of $100,$
one 95% CI for $p_i$ a Jeffreys 95% CI for $p_i$ is
$(0.26s, 0.446)$ and an exact binomial 95% CI is
$(0.275, 0.452),$ both of which include $0.4.$
qbeta(c(.025,.975), 35.5, 65.5)
[1] 0.2618456 0.4466968

binom.test(35,100)$conf.int
[1] 0.2572938 0.4518494
attr(,"conf.level")
[1] 0.95

If the concern is that looking at $N=100$ particles
may give a false impression about the proportion in
energy state $i,$ then the concern is well founded.
Even if this speculative answer of mine is not useful, I hope
complaints about it might provide a foundation for a cogent statement
of the question in statistical language. Also, it would be helpful to know what accuracy of estimation
of $p_i$ would be required and how many particles it is feasible to observe.


text:
Q: Borders and equal height css columns I have code like this

      a profile pic and some text

      a wider div with much more text and some bio info

i would like a dotted border in between the two divs to separate the left column from the right.  my problem is that no matter if i put the border on the left column or the right column it doesn't stretch to the bottom. if either column is shorter/longer than the other the border always stops before reaching the bottom looking cut off.

A: Try this:
 html,body,.container, .section, .left, .right{height:100%}
  .left, .right {border:1px dotted black;float:left;}

example: http://jsbin.com/agaza5

A: Set the height property equally for both divs columns using CSS:
.left {
    border:1px solid #ccc;
    height:100px; /* you can use "100%" too, if you want */
}

.right {
    height:100px; /* you can use "100%" too, if you want */
}

You can also use the min-height attribute if you want to create the same minimum height for both divs, but let only one div stretch further if its content grows.
I would also add that you should use more semantic names for your divs. What if one day you decided to move your left column and it was no longer on the left? You would have to rename everything!

A: Make both your left and right divs stretch the full height of the container (section).
.left{ height:100%; }
.right{ height: 100%; }

A: I would set the height of your section div and then just set the children heights to 100%.
Check it out


text:
Q: Extremely slow connection with BCM4318 wireless card and Ubuntu 14.04 I'm getting terrible internet speeds on my computer running Ubuntu 14.04 with a Broadcom BCM4318 wireless card. I have 20 mb/s internet and when I run a speed test, I'm not even getting 1 mb/s. I run Speedtest from my phone while I'm at my desk and get close to 20 mb/s. I have similar results from a Windows laptop and a Windows PC, both just under 20 mb/s. I never had a problem until I upgraded to 14.04 from 13.10. I did a fresh install as well. The issue did not start right away so I'm not really sure if it could be the upgrade.
Here are a few things I've already tried:

*

*blacklist wl

*blacklist brcmsmac

*sudo apt-get purge bcmwl-kernel-source

*Set ipv6 to 'ignore'

*purging the b43 driver and manually re-installing

*purging the b43 driver and re-installing with sudo apt-get install firmware-b43-installer

I ran the wireless script and here are the results.
Here is a screenshot with the results from two of the Speedtests that I ran. On the left is from the slow computer and the right is from my phone.
Thanks for any help!