Posts

raspberry pi2 - Python 2.7 - Cannot Import GPIOZERO -

i new raspberrypi, debian , python. i have configured raspberry pi 2 model b v1.1 recommendations available many many helpfull websites , people. however, when want start basic project based using gpiozero control buttons , led's not able use the: "from gpiozero import led, button" command. output reports following: > traceback (most recent call last): > file "", line 1, in > file "/usr/lib/python2.7/dist-packages/gpiozero/init.py", line 57, in > .devices import ( > file "/usr/lib/python2.7/dist-packages/gpiozero/devices.py", line 38, in > .pins.rpigpio import rpigpiopin > file "/usr/lib/python2.7/dist-packages/gpiozero/pins/rpigpio.py", line 27, in > class rpigpiopin(pin): > > ***file "/usr/lib/python2.7/dist-packages/gpiozero/pins/rpigpio.py", line 55, > in rpigpiopin 'i2c': gpio.i2c, > > attributeerror: 'module' object has no attribute 'i2c'*...

How to include all src/test/resources/** AND src/main/java/**/*.html in the test sourceset in gradle? -

i have following , thought 'adding' sourceset modified it.. sourcesets { test { resources { srcdirs = ["src/main/java"] includes = ["**/*.html"] } } } what want both src/test/resources/** , above well. don't want exclude files src/test/resources though , above including html directories put there. thanks, dean the following illustrate technique using main (so can verified): apply plugin: 'java' sourcesets { myextra { resources { srcdirs "src/main/java" includes = ["**/*.html"] } } main { resources { source myextra.resources } } } proof of concept via command-line: bash$ ls src/main/java abc.html xyz.txt bash$ ls src/main/resources/ def.html ijk.txt bash$ gradle clean jar bash$ jar tf build/libs/myexample.jar meta-inf/ meta-inf/manifest.mf abc.html def.html ijk.txt i...

ruby on rails - Google Oauth2 automatially renew token -

i'm adding oauth2 via google rails app using omniauth-google-oauth2 gem. have set according gem's readme. when click authorize button in app, directed google authorize app. once i'm sent redirect path, hash of data includes token , refresh_token , , expires_at (not expires_in ), expires_at equal time.now.to_i . hash looks this: => auth.credentials => { token: 'token', refresh_token: 'refresh_token', expires_at: 1468603958 expires: true } what programmatically renew user's token every time log app, without forcing them go through initial authorization process. have similar token renewal flow set facebook, can't figure out how make work google, since token expires_at time now. my question two-part: shouldn't value of expires_at in future (e.g. 1 hour now, or 30 days now)? how can programmatically refresh token using refresh_token got when first authorized app? can't seem find single example in...

java - I have 2 classes in Bluej and want to make a field in one of the classes be of type of the other class. How would I do this? -

i have made 2 classes in project in bluej , have link them making new field in main class of type of second class. what syntax this? i may interpreting question wrong but, assuming classes class1 , class2, can have class1 take in instance of class2 so: public class class1{ class2 otherclass; public class1(class2 otherclass){ this.otherclass = otherclass; } } now class1 has instance of class2 can play with. you may have class1 create class2 object instead of passing 1 so: public class class1{ class2 otherclass; public class1(){ otherclass = new class2(); } }

String array splitting in C# -

i have 2 string/text files : "1.dll" , "1a.dll" - 1.dll contains "order id" , "cartid"(separated enter '/n') - 1a.dll database witdh "id" , "name" (separated enter '/n') i splitting strings string array. i'm separating each array string in 2 strings. 1 number position , other odd number position. after splitting both files, have 4 array strings i'm displaying 4 listboxes. - 2 arrays 1.dll displying should - 2 arrays 1a.dll missing values. here screenshot problem //load , split "1.dll" > create 2 array strings. orderid=odd # position , cartid=even # position string = file.readalltext(@"order/1.dll"); string[] aa = a.split('\n'); aa = aa.select(s => (s ?? "").trim()).toarray(); string[] orderid = new string[aa.length]; string[] cartid = new string[aa.length]; int dial1 = 0; int dial2 = 0; ...

linux - Unable to stop suspect process even after reboot -

edit: user gene mentioned tried following commands: root@localhost:~# ps -axj | grep demo warning: bad ps syntax, perhaps bogus '-'? see http://gitorious.org/procps/procps/blobs/master/documentation/faq i tried without "-". after freezes. tried ps -aux | grep demo it freezes , nothing happens. tried root@localhost:~# ps aux user pid %cpu %mem vsz rss tty stat start time command root 1 0.0 0.0 10664 1532 ? ss 21:37 0:00 init [2] root 2 0.0 0.0 0 0 ? s 21:37 0:00 [kthreadd] root 3 1.1 0.0 0 0 ? s 21:37 0:15 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? s< 21:37 0:00 [kworker/0:0h] root 7 0.3 0.0 0 0 ? s 21:37 0:04 [rcu_sched] root 8 0.0 0.0 0 0 ? s 21:37 0:00 [rcu_bh] root 9 0.0 0.0 0 0 ? s 21:37 0:00 [migration/0] root 10 0.0 0.0 ...

ruby on rails - Generation of table and accessing elements of a Array of Hashes -

i have following array of hashes in rails application: a = ["{\"row1\"=>{\"correct\"=>{\"h\"=>\"10\", \"m\"=>\"11\", \"l\"=> \"12\"}, \"wrong\"=>{\"h\"=>\"2\", \"m\"=>\"2\", \"l\"=>\"4\"}, \"blank \"=>{\"h\"=>\"2\", \"m\"=>\"4\", \"l\"=>\"3\"}}, \"row2\"=>{\"correct \"=>{\"h\"=>\"2\", \"m\"=>\"4\", \"l\"=>\"4\"}, \"wrong\"=>{\"h \"=>\"4\", \"m\"=>\"6\", \"l\"=>\"6\"}, \"blank\"=>{\"h\"=>\"7\", \"m\"=>\"5\", \"l\"=>\"6\"}}, \"row3\"=>{\"correct\...