Go to advanced search

by addeswe
Wed May 30, 2018 8:34 pm
Forum: Java
Topic: Sending terminal commands using Java
Replies: 1
Views: 1686

Re: Sending terminal commands using Java

Short example: import java.io.BufferedReader; import java.io.InputStreamReader; public class process { public static void main(String args[]) { String tmp; String s = new String(); Process p; try { p = Runtime.getRuntime().exec("ls -aF"); BufferedReader br = new BufferedReader(new InputStreamReader(...
by addeswe
Wed May 30, 2018 10:38 am
Forum: Java
Topic: Need some help with program
Replies: 1
Views: 1128

Re: Need some help with program

Don't get me wrong. I feel that if it's a task given, you should do it yourself. However, I'll be happy to point you in (imho) the right direction. If you have set time values you can always use currentTimeMillis(). This is a Long that displays time since January 1, 1970 UTC (read up on epoch) in Mi...
by addeswe
Sun Feb 25, 2018 9:07 pm
Forum: Python
Topic: [Python3] Parsing Json with json
Replies: 2
Views: 517

Re: [Python3] Parsing Json with json

I don't wanna be that guy, but I always hope that you are the one to answer since you always know the answers. :-) Does not work in Python3, however. You pointed me in the right direction. So I managed to find the solution myself. Putting my answer here in case anyone else needs help with this subje...
by addeswe
Sun Feb 25, 2018 8:37 pm
Forum: Python
Topic: [Python3] Parsing Json with json
Replies: 2
Views: 517

[Python3] Parsing Json with json

So I've done some projects with json but then I came across this bastard creation and I honestly have no clue how to parse it. {"client1":{"percent":56},"client2":{"percent":53},"client3":{"percent":23},"client4":{"percent":60},"client5":{"percent":9}} If I use json.loads, the client-key returns as ...
by addeswe
Tue Nov 07, 2017 3:32 pm
Forum: Java
Topic: About How to Create Executable file in Raspberry Pi
Replies: 3
Views: 1386

Re: About How to Create Executable file in Raspberry Pi

What you can do is create a shellscript with the following code: #!/bin/sh MYSELF=`which "$0" 2>/dev/null` [ $? -gt 0 -a -f "$0" ] && MYSELF="./$0" java=java if test -n "$JAVA_HOME"; then java="$JAVA_HOME/bin/java" fi exec "$java" $java_args -jar $MYSELF "[email protected]" exit 1 After that, just cat the jar-file...
by addeswe
Tue Oct 17, 2017 2:49 pm
Forum: Python
Topic: I need some direction!!
Replies: 6
Views: 1238

Re: I need some direction!!

This is how I would write it. A list of ports that gets activated one by one. Set as output and then be set to high for 3600 seconds (1 hour). Then it loops back to the next gpio and runs again. With a little luck. This is what you wanted. import RPi.GPIO as GPIO import time # Set relay ports used a...
by addeswe
Tue Oct 03, 2017 2:49 pm
Forum: Java
Topic: Javafx with old version of JDK(1.8.0) error
Replies: 2
Views: 1750

Re: Javafx with old version of JDK(1.8.0) error

In your error. It says: Caused by: java.lang.UnsatisfiedLinkError: /opt/armv6hf-sdk/rt/lib/arm/libjavafx_font_pango.so: libpangoft2-1.0.so.0: cannot open shared object file: No such file or directory . I guess that the compiler is not finding the shared library. Check to see if libpangoft2-1.0-0 is ...
by addeswe
Mon Jul 17, 2017 6:24 am
Forum: Java
Topic: Background task, Async?
Replies: 3
Views: 2080

Re: Background task, Async?

Thanks for the reply. However I've come to the conclusion to run the led in a threaded task. :-)
by addeswe
Thu Jul 13, 2017 8:40 am
Forum: Java
Topic: Background task, Async?
Replies: 3
Views: 2080

Background task, Async?

First of, I'm pretty new with Java. So this will be a stupid question most likely. However... My parents live where there is a lot of thunder. And they need a good way to shut down the pi without logging into the pi itself. So my idea was to write an application. And this is what I would want. Appli...
by addeswe
Wed May 11, 2016 2:57 pm
Forum: Python
Topic: Capture screen of Firefox
Replies: 6
Views: 1017

Re: Capture screen of Firefox

My intention was never to sound ungrateful. However phantomjs won't really be the solution to my problem since i read pixeldata. If I offended anyone by saying that "I guess that I'm semi satisfied with the help", I apologize. It was my way of saying that it is a solution but not really the one I wo...
by addeswe
Wed May 11, 2016 1:15 pm
Forum: Python
Topic: Capture screen of Firefox
Replies: 6
Views: 1017

Re: Capture screen of Firefox

I don't really have any problems with subprocess and I've used it for other projects, but thanks anyways! My only problem with this is that i need to use tmpfs where I save the imagefile if I use it for my project. The software is running checks more then once a second. So that is why I wanted to pu...
by addeswe
Wed May 11, 2016 8:14 am
Forum: Python
Topic: Capture screen of Firefox
Replies: 6
Views: 1017

Re: Capture screen of Firefox

Thanks for the reply MarcScott. At the moment, I'm using pyscreenshot. What I am doing is to capture part of the screen with a bbox. Then reads the r,g,b-values of the pixels. The problem is that sometimes a terminal window gets in the way or I have to swap to another fullscreen application. And the...
by addeswe
Wed May 11, 2016 6:41 am
Forum: Python
Topic: Capture screen of Firefox
Replies: 6
Views: 1017

Capture screen of Firefox

Hi. So I'm trying to capture the screen of a firefox (this can actually be changed to chrome, libre office whatever). Is there a library that allows you to do this? (pid-based or whatever) And is it possible also to this while the window is minimized? With a little luck, somebody has done this befor...
by addeswe
Tue Mar 29, 2016 7:07 pm
Forum: Beginners
Topic: Alternative to at scheduler
Replies: 5
Views: 798

Re: Alternative to at scheduler

Well ain't that a treat. Thanks DougieLawson for setting me on the right path. Answer if somebody else experience the same problem: You can't write it on one line: at 21:12 -M -f /tmp/whatever.py. This throws an error since it uses /bin/sh to execute whatever the shebang is. Solution: See previous p...
by addeswe
Tue Mar 29, 2016 3:46 pm
Forum: Beginners
Topic: Alternative to at scheduler
Replies: 5
Views: 798

Re: Alternative to at scheduler

Well... that's not really true. :-( [[email protected]][/tmp] more test.py #!/usr/bin/python3 with open('/tmp/thisisanewfile.txt','w') as file: file.write('This is working?!') [[email protected]][/tmp] at 17:38 -M -f /tmp/test.py warning: commands will be executed using /bin/sh job 2 at Tue Mar 29 17:38:00 20...
by addeswe
Tue Mar 29, 2016 1:08 pm
Forum: Beginners
Topic: Alternative to at scheduler
Replies: 5
Views: 798

Alternative to at scheduler

Hi. I want to run a software at random times and for this, at would be the perfect solution. My only problem is that it runs all scripts with the shell /bin/sh. And most stuff I write is in Python3. So is there a way to set Python3 as the shell, or is there any alternative? And no. I don't want to u...
by addeswe
Tue Jun 03, 2014 1:29 pm
Forum: Python
Topic: Writing to google calendar from console.
Replies: 4
Views: 1975

Re: Writing to google calendar from console.

Well, my problem is that i now get a 400-error. And since I get that, it doesnt write my credentials to calendar.dat. Also, it ignores my redirect_uri variable... Obviously im doing something really wrong. :roll: cli_ID = '****.apps.googleusercontent.com' FLOW = OAuth2WebServerFlow( client_id=cli_ID...
by addeswe
Tue Jun 03, 2014 12:31 pm
Forum: Python
Topic: Writing to google calendar from console.
Replies: 4
Views: 1975

Re: Writing to google calendar from console.

Thanks for the reply.

There is no way to make the call without having to type in your user&pass(&2-way auth) every time?
And when do i send the json parameters to the event?

I know this sounds stupid, but I've never made code for google apis. Only others and they don't use Oauth2.0...
by addeswe
Tue Jun 03, 2014 11:29 am
Forum: Python
Topic: Writing to google calendar from console.
Replies: 4
Views: 1975

Writing to google calendar from console.

Hey. I'm doing a project to automate my calendar with my work schedule. For this, I have a python script that parses an .xlsx. My problem is when I want to write this to a calendar. I have no clue how to use Oauth2 to get verified and be able to make the api-call. Anyone feel like taking some time a...
by addeswe
Mon Apr 07, 2014 10:10 am
Forum: HATs and other add-ons
Topic: Reading S-Video signal
Replies: 2
Views: 814

Re: Reading S-Video signal

Thanks for the reply. I've tried with a easycap but got a distorted image. Do you know where I could find a usb input device with (for example) STK1160 chipset that makes a ok picture? I have no worries about framerate. If I get i pic every 5 seconds, Im ok with that. :-)
by addeswe
Mon Apr 07, 2014 9:45 am
Forum: Python
Topic: sensor data from PI to webserver
Replies: 2
Views: 758

Re: sensor data from PI to webserver

Better yet. Use sshfs and have the filesystem mounted on your pi.
by addeswe
Mon Apr 07, 2014 9:34 am
Forum: HATs and other add-ons
Topic: Reading S-Video signal
Replies: 2
Views: 814

Reading S-Video signal

What is the best way for a raspberry pi to read a S-Video signal. Got a cam with no other interface then that and have no clue how to read it.

Thanks in advance. :-)
by addeswe
Mon Jul 22, 2013 9:16 am
Forum: Python
Topic: weather
Replies: 4
Views: 1188

Re: weather

Examplecode to get current degrees in C of my hometown Umeå, Sweden: import requests import json apikey = "<insert api-key here>" url = requests.get("http://api.wunderground.com/api/"+apikey+"/conditions/q/SE/Umea.json") json = json.loads(url.text) print json['current_observation']['temp_c'] Hope th...
by addeswe
Mon Jul 22, 2013 8:57 am
Forum: Python
Topic: Apache2 and Python to call raspistill
Replies: 4
Views: 4000

Re: Apache2 and Python to call raspistill

My recomendation is to use a lockfile. Then there wont be any problem if the script is called twice. Check out os.path.isfile in the os module.
by addeswe
Sat Jul 20, 2013 8:15 am
Forum: Camera board
Topic: Moving the focus/Zoom
Replies: 9
Views: 4106

Re: Moving the focus/Zoom

Thanks jbeale. This sounds like the solution I was looking for. Will try the glasses since two of them are like £10. Quite much cheaper then a broken camera. :-)

Go to advanced search