2014-11-01
[Technology] Work, web automation, Firefox and Selenium
Posted by
Richard
um
17:23
Labels: #Technology, automation, firefox, open source, Selenium, testing, web, web development
Labels: #Technology, automation, firefox, open source, Selenium, testing, web, web development
The following doesn't have a point, it's just me rambling about a software testing tool.
There is a lot I'd like to write about, but for now I'll just put notes.
At work, an unusual situation let me spend a lot of time on Selenium. Selenium is an open source tool set that lets you automate activities in a web browser. It comes in two flavours; one is a browser extension, Selenium IDE, that lets you record your actions and then let's you replay them. The other is the Selenium Web Driver, which provides a plugin or a driver for your browser that you can communicate with from many programming languages, using supporting libraries.
Selenium IDE is nice because it's fairly accessible to non-programmers, though you definitely benefit from programming experience. You can record a set of actions and save them as a test case that you can re-use, or that you can integrate into a collection of test cases, forming a test suite. Whoa. Then you can run the entire suite and sit back and watch while the browser simulates your activity and see whether a test succeeds or fails. Brill. Selenium IDE has a provide of built-in commands, such as entering text into a field, clicking an element, comparing text on the page, and even has a concept of variables, letting you store text at one point to re-use later. One thing it lacks, though, is flow control; no looping or conditional branching by default. (Though a go-to implementation exists for it...)
Selenium Web Driver is a bit nicer if you're comfortable with programming, because you have the benefits of file I/O, conditional logic, looping, building re-usable functions, rich exception handling, etc. You can even built your own GUI around your Selenium test cases to cater to your specific needs.
batch administration through automation
We ended up actually using Selenium to automate a lot of administrative tasks for third-party web software that we didn't have control of the back-end, and whose interface was ... tedious. To that end, I got to use the Web Driver to build a few classes of re-usable functions that we trivialised a lot of repetitious tasks the administrators had to handle. (They once hired a co-op to manually go over 120 pages and make the same multi-step configuration change every time something new came up.) Using Selenium, I helped reduce the effort involved from someone taking hours of repetition, and risking human error, to 10 minutes of writing a <10 line script, starting it, and letting it run the background in a separate instance of Firefox. :) They thought it was magic. I thought it was ridiculous to have software that we have to configure in such a round-about way; seriously, having access to the back-end or database would obviate the need for software to simulate a human on the client-side. Ugh.
So that's interesting. Openness and control. Who owns software that a company uses. Ideally, if you're selling proprietary software, you're trying to provide an interface that is adequate for your users, to make tasks easy. Perhaps we just have unrealistic requirements. This is why I ultimately prefer working with and using open source software. No obstacles imposed by others. Any problem just requires my attention and my time (which is not bountiful these days).
accessing data on the web
There are a lot of websites I use on a daily basis that I would love to have more direct access to my data. Facebook, GMail, Google Calendar. And a lot of these websites offer APIs. They're not always convenient APIs. They're rarely standardised. I miss the days when Facebook allowed RSS feeds, for example. It is honestly sometimes easier to use a client-side automation tool like Selenium to achieve larger scale operations.
Some more examples are shopping sites, where they list product information in a free-form way, often incomplete. Sometimes, for electronics, they'll have a 'specifications' section, but the specifications will be in different formats for different devices. Why are they not interested in standardising/normalising their data so their customers can make better decisions? Perhaps it's because making it easier to compare would change consumer habits, making the best choice more trivial, so one supplier would receive a lot more customer attention than others, ruining some businesses. I do believe a lot of businesses survive on the basis of consumer ignorance; if people could only see how awful a product/deal they were getting on some things (e.g. horrible smartphones), I'm sure some suppliers would have to go out of business (as smaller ones especially might find it hard to compete with the price points of the largest distributors).
That said, I would still love to be able to quickly draw all the information on hard drives at FutureShop, Staples, Canada Computers, and NCIX into a single spreadsheet so I could easily compare the characteristics that matter most to me, and also filter for my esoteric hard drive size (7mm, 2.5 shorter than the industry average). Or see table schemas and do standard SQL queries on their data sets to obtain the information I want.
In lieu of those, I can use tools like wget and curl to automatically scrape websites for information, but sometimes the HTML you pull down does not reflect the page as you could see it to interact with. That's where web automation tools with a programming component (like Selenium Web Driver) can really help. They can see the live DOM and let you output what you find to files.
Sadly, this obviously requires a bit more effort than if web sites provided sane, easy access to their data. Ah well. Open Data for the future.
Performance
Regardless, a lot of what I like to use tools like Selenium and JMeter (from Apache) for is actual testing for quality assurance. Websites grow, and as they become more dynamic, it becomes increasingly difficult to verify their correctness and performance by hand. I have a private little web-app called My Daily which I use to track my daily routine. It has helped me rise out of a few slumps, by making me more accountable to myself. (I know I'm in dire straits when I start ignoring myself, though, and that's when I can make the most drastic changes.) However, for a while, it's been getting more sluggish, and sometimes as I've added features, I've unwittingly broken existing features.
I enjoy using Selenium and JMeter to measure performance. I can get average timing information. That's heavily influenced by external factors, yes, but it's a good idea of how things are going. I can also do things to help compensate for variable network performance. I can have a standard, simple page that I can access a variety of times to get a base measurement for performance for the entire network, and then consider other numbers against that. Is it taking me 9 seconds to load my 20-item task list for today because the whole network is slow or is the network in general still fast and I've introduced a slow-down somewhere? Even if it is the former, is there anything I can do with caching or batching information or reducing overall data size to help alleviate that problem?
I can also do things like measure the size of pages that are constructed, their complexity (e.g. how many nodes), so I can try to keep things simpler for computers with memory constraints (like mobile devices). KISS.
Correctioness, verification of verification
I also just enjoy verifying correctness. Selenium has VerifyText/AssertText-type commands built-in to its IDE and comparable features connected to testing frameworks for the Web Driver based on language. It's so important whenever you're letting something operate automatically to verify your context, especially before performing actions that meaningfully affect data. So you have a test that creates a few records, modifies them, then deletes them? Let's be certain that the record you're about to delete is indeed the test one you created.
Look before you leap. Metsuke before kiritsuke. Assert before you click. All good advice.
So, it's useful to try to create a test for each feature you invent (oh wow, what a time commitment comprehensive testing can be (and oh the perceived diminishing returns)), but it's hard to verify that tests work. That's why you make tests for your te- oh, oh my. Actually, I sometimes do. Sometimes I do negative testing. I'll intentionally test broken situations, and see what happens, but not just verifying that the system handles it correctly, but that some of the more important tests do. "This test better actually fail when I give it- oh nope, it just passes everything :(" This situation actually arose with an auto-marker I wrote for a course I was TA'ing the other year. As I was reviewing the marks, I noticed it strange that everyone passed a certain test. The class was not happy to see their collective grade drop. :D
Reusability
One of the lovely things about Selenium Web Driver (and the IDE) is of course the ability to re-use parts. The IDE isn't so great, because I tend to need to copy the test into multiple suites. The Web Driver is a bit nicer as I have a library of common parts that I recycle. I try to treat testing code not just as scaffolding or something quick-and-dirty at the end, but as a complete software package in itself. (While trying to avoid Testception.) Frameworks like JUnit can help with that, too.
Knowledge Requirements
It's a bit of a downer that rich web development tends to involve so many different languages each with a different style. Web development is one of the most desirable areas of development for a lot of common folk, but in some ways less accessible. Do you understand your CSS, your JavaScript, your (X)HTML, and how they interact? How about we throw in a server-side language, its standard libraries and extra libraries for this and that. Do you understand your server configuration? Are you secure (oh dear Lord). Speaking of security, Andy Wingo has a nice blog post recently on trying to setup HTTPS access for your website and how it's a gigantic mess.
Selenium IDE is nice in that you can record and play back with minimal knowledge. That can be helpful to people who are building their website with a tool like Wordpress for example. It would be nice if the common-folk could rely on simple, straightforward interfaces to accomplish this. Sadly, even in Selenium IDE, it helps to understand XPath + DOM + CSS, at the very least for target disambiguation. This ties in with my earlier topic of verification, actually. It's not hard to write a test that ends up identifying an element by a numeric offset. "Hmm, this has the id 'box9', lets rely on that!" when in reality sometimes your Tweet Box is not just box9, but sometimes it's box8! (Yeah, it sure would pay to have given it a more descriptive name than "box9", but let's pretend the page elements are dynamically generated and you might have a variable # of Tweet Boxes because your page shows as many as are trending on the topics of various cheeses, one for each trending cheese. (Go Daiya!)
If you don't understand the target in use, then it's hard to understand the potential consequences of what Selenium has (somewhat intelligently) picked for you.
Closing Comments
This is just me rambling with a head full of thoughts after using Selenium for a few months. There are a lot more technical considerations I've encountered and dwelled on, and I am sure I am not using it completely optimally (though I do find its documentation straightforward and helpful). I just like to write unimportant rambling sometimes.
I don't have a point.
2014-10-04
[Technology] Contributions
I've been on a hiatus from Open Source development for almost a year now, but discovered this today:
https://wiki.gnome.org/ThreePointThirteen/Features/PicasaWebPhotos
GNOME Photos will support PicasaWeb/Google+ photos, using code I wrote in 2009.
https://wiki.gnome.org/ThreePointThirteen/Features/PicasaWebPhotos
GNOME Photos will support PicasaWeb/Google+ photos, using code I wrote in 2009.
[Technology] Generic selection in C11? Pretty neat
http://www.robertgamble.net/2012/01/c11-generic-selections.html
Also, need to remember that character constants are ints, and not char.
Also, __auto_type is pretty cool:
#define acos(X) _Generic((X), \
long
double
complex: cacosl, \
double
complex: cacos, \
float
complex: cacosf, \
long
double
: acosl, \
float
: acosf, \
default
:
acos
\
)(X)
Also, need to remember that character constants are ints, and not char.
Also, __auto_type is pretty cool:
#define max(a,b) \
({ __auto_type _a = (a); \
__auto_type _b = (b); \
_a > _b ? _a : _b; })
2014-10-02
[Technology] beware pocket lint
For months, a year?, I've struggled with my phone. My phone's charging port thingy hasn't held a USB cable well for a while. They slide right now. I have had to weight it down with my wallet, a measuring tape, and responsibility. A charge has been hard to keep.
Then one night in a laundromat, a Swiss army knife and a sewing needle later, my phone's charging port is fixed. Beware pocket lint.
Then one night in a laundromat, a Swiss army knife and a sewing needle later, my phone's charging port is fixed. Beware pocket lint.
2014-08-11
[General] Friendship
Posted by
Richard
um
21:10
Labels: #General, #Technology, computers, friends, friendship, google, internet, mario, Mario Kart, Nintendo, technology
Labels: #General, #Technology, computers, friends, friendship, google, internet, mario, Mario Kart, Nintendo, technology
I've made a lot of acquaintances and friends while in Guelph these past three years. I don't quite seem to make the friendships I used to, though. I think I remain a bit distant and reserved. I'm fun and amusing and adventurous, but I think people experience a barrier between myself and them. Like the smile is a bit of a façade. It might be. I'm not sure.
So I find it immensely pleasurable that thanks to the Internet and Nintendo, I've been able to spend more time with my best friend, despite him living in Terranova. In particular, Mario Kart. Nintendo in their wisdom has limited the opportunities for voice chat, so children won't hear crude language (a noble cause indeed), but my friend and I chat over Google Hangouts instead.
Sure, the conversation isn't always the most sophisticated, but one thing I've always appreciated about him is that he and I can look at almost anything in the world and find something interesting about it. And that happens in games as well. And we have lots of opportunities to chat about things unrelated to the games.
Nintendo and modern technology have created a comfortable environment for us to have meaningful social interactions in. I was thinking about how gigabit internet (thanks Google Fibre) and 4K displays will help upgrade remote social interactions, so that in the future we can have realistic conversations on the other side of a window. Next stop, VR?
So I find it immensely pleasurable that thanks to the Internet and Nintendo, I've been able to spend more time with my best friend, despite him living in Terranova. In particular, Mario Kart. Nintendo in their wisdom has limited the opportunities for voice chat, so children won't hear crude language (a noble cause indeed), but my friend and I chat over Google Hangouts instead.
Sure, the conversation isn't always the most sophisticated, but one thing I've always appreciated about him is that he and I can look at almost anything in the world and find something interesting about it. And that happens in games as well. And we have lots of opportunities to chat about things unrelated to the games.
Nintendo and modern technology have created a comfortable environment for us to have meaningful social interactions in. I was thinking about how gigabit internet (thanks Google Fibre) and 4K displays will help upgrade remote social interactions, so that in the future we can have realistic conversations on the other side of a window. Next stop, VR?
2014-07-27
[Technology] quotes
Another good reason to encapsulate bash variables in quotes:
If you have multilined data that you're going to echo, the quotes will preserve the newlines.
The first reason I tend to think of is so spaces in file names aren't mistranslated as separators between arguments.
If you have multilined data that you're going to echo, the quotes will preserve the newlines.
$ DATA="foo
bar";
$ echo $DATA
foo bar
$ echo "$DATA"
foo
bar
$
The first reason I tend to think of is so spaces in file names aren't mistranslated as separators between arguments.
$ FILENAME="foo bar.txt"
$ ls -l $FILENAME
ls: cannot access foo: No such file or directory
ls: cannot access bar.txt: No such file or directory
$ ls -l "$FILENAME"
-rw-rw-r--. 1 user group 0 27. Jul 18:03 foo bar.txt
$
[Technology] GNOME, missing features, and screenshots
I have been taking a lot of screen shots for a project recently and was wondering why they weren't going into my screenshots directory. Now I know why.
https://marteydodoo.com/writing/2013/12/15/saving-screenshots-different-directory-gnome-3/
Basically gnome-shell now handles it (which is fine) but doesn't provide an option for a directory other than your GNOME Pictures directory (not fine). I'm not really sure why people would want to have their default images directory littered with screen shots, but whatever.
So, I went to Settings > Keyboard > Shortcuts
For reasons I haven't explored yet, pressing Shift-PrtSc once doesn't trigger it, but instead sounds a bell. Holding shift and tapping PrtSc twice quickly does, though.
The second half is then to make gnome-screenshot save it where I'd like it to. Running it in interactive mode (gnome-screenshot -i) doesn't seem to give me an option on where to save it. So, instead, I turned to gsettings.
$ gsettings set org.gnome.gnome-screenshot auto-save-directory "/home/myuser/path/to/my/screenshot/dir"
$ gsettings set org.gnome.gnome-screenshot last-save-directory "/home/myuser/path/to/my/screenshot/dir"
I don't think I need to set the second one, but I did so out of laziness.
A lot of my screenshots are fine as JPGs, and save me a lot of disk space that way, so I wrote a small bash script that uses ImageMagick's convert and my 'splitalbum' to further organise them.
In the interest of getting me to publish more of my work, I automated turning little projects into tarballs and web pages and uploading them. Here is 'Process New Screenshots', quick and dirty.
http://kosmokaryote.org/codepoems/pns/
Wait, Blogger supports having more after a break?!
https://marteydodoo.com/writing/2013/12/15/saving-screenshots-different-directory-gnome-3/
Basically gnome-shell now handles it (which is fine) but doesn't provide an option for a directory other than your GNOME Pictures directory (not fine). I'm not really sure why people would want to have their default images directory littered with screen shots, but whatever.
Over-riding Screenshot Keyboard Shortcuts
So, I went to Settings > Keyboard > Shortcuts
Title | Command | Keys |
---|---|---|
Screenshot | gnome-screenshot | PrtSc |
Screenshot of window | gnome-screenshot -w | Alt-PrtSc |
Screenshot of region | gnome-screenshot -a | Shift-PrtSc |
For reasons I haven't explored yet, pressing Shift-PrtSc once doesn't trigger it, but instead sounds a bell. Holding shift and tapping PrtSc twice quickly does, though.
Changing the Default Save Directory for Gnome Screenshot
The second half is then to make gnome-screenshot save it where I'd like it to. Running it in interactive mode (gnome-screenshot -i) doesn't seem to give me an option on where to save it. So, instead, I turned to gsettings.
$ gsettings set org.gnome.gnome-screenshot auto-save-directory "/home/myuser/path/to/my/screenshot/dir"
$ gsettings set org.gnome.gnome-screenshot last-save-directory "/home/myuser/path/to/my/screenshot/dir"
I don't think I need to set the second one, but I did so out of laziness.
Write a script that lets me process my screenshots
A lot of my screenshots are fine as JPGs, and save me a lot of disk space that way, so I wrote a small bash script that uses ImageMagick's convert and my 'splitalbum' to further organise them.
In the interest of getting me to publish more of my work, I automated turning little projects into tarballs and web pages and uploading them. Here is 'Process New Screenshots', quick and dirty.
http://kosmokaryote.org/codepoems/pns/
Wait, Blogger supports having more after a break?!
2014-07-21
[Technology] More people access the Internet in China than on computers
I find that strange.
I like having a smart phone, because it helps liberate me. I don't need to be tethered to my desk in a seated position, and I won't get super-involved in digital tasks, if I'm using my smart phone. I can take it and just do a lot quickly and get it out of the way and resume enjoying the out doors. Yay!
However, for doing almost anything particularly interesting with the Internet, I want a computer. I want to be able to type efficiently. I want to be able to see things at a larger scale. I want to be able to be able to have multiple things open and go between them (I mean like two things for easy cross-referencing).
I'd rather get rid of my phone than my computer, I think. The computer is a bit limiting geospatially, but he phone limits everything I could want to do digitally.
I like having a smart phone, because it helps liberate me. I don't need to be tethered to my desk in a seated position, and I won't get super-involved in digital tasks, if I'm using my smart phone. I can take it and just do a lot quickly and get it out of the way and resume enjoying the out doors. Yay!
However, for doing almost anything particularly interesting with the Internet, I want a computer. I want to be able to type efficiently. I want to be able to see things at a larger scale. I want to be able to be able to have multiple things open and go between them (I mean like two things for easy cross-referencing).
I'd rather get rid of my phone than my computer, I think. The computer is a bit limiting geospatially, but he phone limits everything I could want to do digitally.
2014-05-02
[General] What's that?
This was kind of cool. It's a 7 minute re-enactment of a court deposition, wherein
The specific deposition, which dates back to 2010, involved the
Recorders' Office refusing to hand out electronic documents, but instead
telling people who wanted copies of records that they had to pay for
them to be printed/photocopied at $2 per page.
Apparently the Recorders' Office lost the case.
I really, really enjoy the idea of dramatic re-enactments of transcripts. I don't even care which transcripts. I just want to get my hands on some.
The other aspect that I enjoy about this, is thinking about that period of time wherein almost no one knew what a photocopier was to it becoming common place. This also came up today when an employee at OMAFRA, who is 50, recalled a time when a deputy minister refused to use e-mail, so no one else in the office did, and then eventually he sent out one mass e-mail, and it was a catalyst for regular electronic communication.
People still frequently hand-wrote messages and documents, or typed them on a type-writer, or typed them on a computer (which leading up to the e-mail became common place, but people only used them for specialised purposes) and then printed them out. The Internet and networked communication was still largely foreign. It makes sense. There had to be a before and an after. It's just impressive to consider. E-mail seems so fundamental to me.
I think I'm a bit disappointed by how much comes between me and core functions like e-mail, like text documents. Images, pretty window frames, fancy desktops, they're all very distracting. Blogger's compose window is nicer than a lot of editors, but it's still distracting. I still see the tab bar. I suppose I would enjoy maximal focus. That can be a side-project for me, I guess.
I was speaking with my friend Peter about the rate of change of technology, futurism, transhumanism, the singularity, etc. last night. The length of time a technology can rise up before being superseded by something better keeps getting shorter. I feel like the life as lived today will be closer to life as it was lived five generations ago than it will be to life lived five or even three generations from now. It's weird to think about how integral my mobile phone is to my daily life when even five years ago I was phoneless and adamantly against owning one. (My objections were their lousy design, inadequate functionality, and abusing service plans, all of which have been addressed thanks to smart phones and WIND Mobile.)
I really cherish e-mail as a technology. I'm sad when people communicate predominantly in a closed silo like Facebook, whose messaging platform is borders on unusable and fails to benefit from over 30 years of electronic messaging evolution.
Ah well.
2014-03-20
[Technology] Just how big is my cursor
Sometimes I work with a second monitor, which is 1920x1080, which adds to my 1366x768, and it makes it hard to find my mouse cursor. :(
Here's how I get by,
As seen in the images, I just used gsettings and the org.gnome.desktop.interface schema with its cursor-size key to change the size of my pointy arrow thing, just like in GNOME 2!
Here's how I get by,
Default size of 24 pixels |
Double size at 48 pixels |
As seen in the images, I just used gsettings and the org.gnome.desktop.interface schema with its cursor-size key to change the size of my pointy arrow thing, just like in GNOME 2!
2014-03-19
[Technology] Managing my self
Posted by
Richard
um
11:45
Labels: #General, #Technology, growth, javascript, life, php, time management, web, web development
Labels: #General, #Technology, growth, javascript, life, php, time management, web, web development
I've been trying to work more routine into my life for things that are important to me. I feel like I miss many opportunities to be who I want to be due to inefficient management of my own life. So, there are some things I'd like to do regularly or build towards, and being reminded with a clear plan on how to go about them simplifies this for me, and improves my chances of getting these things done.
I've used a variety of task managers before, but none of them quite provide the flow and feel I want, so with some free time, I've written my own. Here's My Daily.
So, the visual design is still primitive, but you can see what it does already.
The main page has a list of daily tasks, in a prioritised order. (You can alter the order from the manage page.) It's a simple UI, and you just click anywhere in a row to mark it as completed. You can see that some are labeled "if needed". That's going to be replaced by a delay at some point, where once you've done it, it won't appear again for a couple days. That way, non-daily tasks won't make me feel like I'm lazy for not doing them. You can traverse backwards through time to complete tasks you failed (or just see a day).
Here, on the history page, you can see how well I've been doing. I used some pretty CSS transformation for slanted text, and UTF8 characters for checkmarks. At the bottom, unfortunately cut off, you can see greyed-out cells. My Daily tracks when a task is added (and when it's retired), and periods in which a task did not exist (or was retired) appear in grey (so I won't mistake myself for being lazy). Statistics will be calculated soon. Clicking on a date takes you to the main page, but for that date.
Here's the task management page. You can add tasks, change their priority/order (up and down arrows), and retire them (X). The date field and the empty field are for when the date started and when it was retired. I'll probably add the ability to back-date a task. Most of the functionality is instant, no page reloads. Hooray! Tasks move up and down as you click on the arrows. I'm going to replace the arrows with a drag-and-drop method. There are no retired tasks in this image, but if there were, you'd see that they get an extra button, for permanent deletion. The buttons are obviously going off the edge for now. :)
There are lots of features to come that don't exist yet.
And various other things.
If you like what you see, though, and would like to try using it, I can set you up an instance on my server. Alternatively, I'll be making all the source code available, so I could give you that already.
The system has been implemented with PHP, pure Javascript, HTML, and CSS. It's running on Apache 2 with a MariaDB (MySQL) backend. One of my favourite parts about working on this was setting up my own local development server, to get the most out of error messaging and logs, and setting up a git-based deployment method to my 'production' server.
I've used a variety of task managers before, but none of them quite provide the flow and feel I want, so with some free time, I've written my own. Here's My Daily.
My Daily
So, the visual design is still primitive, but you can see what it does already.
Main Page |
The main page has a list of daily tasks, in a prioritised order. (You can alter the order from the manage page.) It's a simple UI, and you just click anywhere in a row to mark it as completed. You can see that some are labeled "if needed". That's going to be replaced by a delay at some point, where once you've done it, it won't appear again for a couple days. That way, non-daily tasks won't make me feel like I'm lazy for not doing them. You can traverse backwards through time to complete tasks you failed (or just see a day).
History Page |
Here, on the history page, you can see how well I've been doing. I used some pretty CSS transformation for slanted text, and UTF8 characters for checkmarks. At the bottom, unfortunately cut off, you can see greyed-out cells. My Daily tracks when a task is added (and when it's retired), and periods in which a task did not exist (or was retired) appear in grey (so I won't mistake myself for being lazy). Statistics will be calculated soon. Clicking on a date takes you to the main page, but for that date.
Management Page |
Here's the task management page. You can add tasks, change their priority/order (up and down arrows), and retire them (X). The date field and the empty field are for when the date started and when it was retired. I'll probably add the ability to back-date a task. Most of the functionality is instant, no page reloads. Hooray! Tasks move up and down as you click on the arrows. I'm going to replace the arrows with a drag-and-drop method. There are no retired tasks in this image, but if there were, you'd see that they get an extra button, for permanent deletion. The buttons are obviously going off the edge for now. :)
To Come
There are lots of features to come that don't exist yet.
- Encryption
- Multi-user
- Occasional tasks (the ones noted above with the delay)
- Statistics (noted above)
- Laziness warnings (something like emphasising tasks you've been ignoring)
- Android companion app (maybe)
And various other things.
If you like what you see, though, and would like to try using it, I can set you up an instance on my server. Alternatively, I'll be making all the source code available, so I could give you that already.
The system has been implemented with PHP, pure Javascript, HTML, and CSS. It's running on Apache 2 with a MariaDB (MySQL) backend. One of my favourite parts about working on this was setting up my own local development server, to get the most out of error messaging and logs, and setting up a git-based deployment method to my 'production' server.
2014-03-12
[Technology] Apache, PHP, MySQL, PDO, "Permission denied", Fedora, and SELinux
I'm working on a fun little PHP web application (a manager for my repeating, daily tasks), mostly for the exercise. The 'production' server is a bit limiting, and I cannot view httpd's (Apache's) error logs there, so I've set up my own local httpd as a development server (just good sense). However, my web app makes use of a MySQL database. I will create a local one eventually, but I thought, to make things easier to start, I would just use the remote one.
This is what came back each time I tried running the web application from my local httpd. I'm using PHP's PDO database interface, and its mysql driver, and it works when deployed on the remote server. I made sure that my remote server had permissions for my local user. I tested connecting from my local machine from the mysql client, and it worked. I tested the PHP connection statement from the command-line and ... it worked. It was only causing a problem when running within the web application.
Eventually, I found this explanation, which boils down to:
Yes, SELinux on Fedora strikes again. I actually appreciate SELinux. The main problem with it is the often total lack of feedback. SELinux's troubleshooter is running and in theory it's suppose to report issues like this and give me options, but it didn't seem to notice at all. If things did not simply fail silently and mysteriously, I'm sure most complaints about SELinux would go away
SQLSTATE[HY000] [2002] Permission denied
This is what came back each time I tried running the web application from my local httpd. I'm using PHP's PDO database interface, and its mysql driver, and it works when deployed on the remote server. I made sure that my remote server had permissions for my local user. I tested connecting from my local machine from the mysql client, and it worked. I tested the PHP connection statement from the command-line and ... it worked. It was only causing a problem when running within the web application.
Eventually, I found this explanation, which boils down to:
setsebool -P httpd_can_network_connect_db=1
Yes, SELinux on Fedora strikes again. I actually appreciate SELinux. The main problem with it is the often total lack of feedback. SELinux's troubleshooter is running and in theory it's suppose to report issues like this and give me options, but it didn't seem to notice at all. If things did not simply fail silently and mysteriously, I'm sure most complaints about SELinux would go away
2014-02-25
[Technology] Working in parallel
I have about 704 .flac music files that I want to convert to .ogg. Mostly because flac is a lossless encoding while ogg is lossy, so for a potentially imperceptible reduction in audio quality, I reduce disk usage for these files by ~75%. Hooray.
I noticed oggenc doesn't seem to make good use of my quadcore processor, so I used find + head + tail to split the collection into 4 sets that are being re-encoded in their own terminals. Each process is using 70-80%, with gnome-shell stealing the other cycles (GNOME Shell tends to run ~90% when I have my second monitor attached).
Hooray. Once they're in ogg, I'll have an easier time sharing them with my tablet. Speaking of which, it's a bit sad that it's faster to copy music files to a USB key and then copy them from there to the tablet then to just copy them over wifi. Hehe. (~1MB/s over wifi versus ~15MB/s to the USB (but gets copied twice, for an average of 7.5MB/s)).
I noticed oggenc doesn't seem to make good use of my quadcore processor, so I used find + head + tail to split the collection into 4 sets that are being re-encoded in their own terminals. Each process is using 70-80%, with gnome-shell stealing the other cycles (GNOME Shell tends to run ~90% when I have my second monitor attached).
Hooray. Once they're in ogg, I'll have an easier time sharing them with my tablet. Speaking of which, it's a bit sad that it's faster to copy music files to a USB key and then copy them from there to the tablet then to just copy them over wifi. Hehe. (~1MB/s over wifi versus ~15MB/s to the USB (but gets copied twice, for an average of 7.5MB/s)).
[Technology] Building Synergy
Synergy is software that will share a keyboard, mouse, and clipboard between computers over a network. It's great. If you have multiple machines in one place, you can just drag your mouse cursor between their screens, even if they're running different operating system.
I want to start off by saying that synergy seems like great software. I used it a lot in the past, and was very pleased with the results. It wasn't very user friendly then, and at some point it was no longer actively maintained. It seems to be actively maintained now, and even has file drag-and-drop support between computers (for Windows and Mac, not for Linux yet ;_;). In the rest of this post, I'll be detailing each step and obstacle I encountered trying to set up synergy 1.4.16 (the latest as of today) on Fedora 20. In part, I hope it helps the next person who tries this and perhaps Googles their error messages. Know that if you're just a regular user, don't take the issues that arise below as a cause for terror. You can do what you should, just install the package from the repository (if you're fine not having your key presses be encrypted over the network...) and not worry about anything. A lot of the problems below will emerge from me not properly understanding what's expected, but then that goes to show how straightforward or not building Synergy can be.
A quick summary is:
I run Fedora Linux 20. The version Fedora has in its repository is 1.4.10. The latest version from synergy-foss.org is 1.4.16 and has some features I would like. synergy-foss.org provides a pre-built package for Fedora, but there's an issue with their package for 1.4.16 preventing it from installing.
They explain that in their release notes. Basically the packages get built on a Ubuntu installation which has an out-dated version of curl. Whoops. So, I'll take the opportunity to build it myself.
The first problem I have in building is that their wiki tells me to use their hm script. First, I try following hm.sh's own suggestion of
Hmm, double check the wiki and ... aha, yes, apparently -g should go to conf and not build. When I try doing
Fine. I install qt-devel, and set PATH to include the directory containing qmake
Success. Next step,
... Great. The instructions say I can skip the hm script, so yay. I follow its advice and go to
... Alright. I see that there is a configure script. I am used to doing ./configure && make && make install, so let's try it the old fashioned way. The next problem I encounter is with Xtst,
I thus installed libXtst-devel (which may have been unnecessary; libXtst was already installed) but still, I get that error message. I then grep'd about and checked CMakeError.log.
Hmm.
I then went to /tmp/ and tried compiling with -lXtst myself and... it worked.
I deleted the build directory, and unpacked a new one, and ... it worked. Annoyingly, their configure script apparently doesn't check again, and I'm not sure what you would use to clear its memory of the failure. Ah well.
Next problem is this:
I poked about with find and grep and ultimately found tools/cryptopp562.zip. If I just use unzip on it, it actually dumps all its files into the tools/ directory, so, clean up that mess, and then create cryptopp562, and unzip it into there.
And ... it works. I think. I manage to success do "make", but then there's no "make install" target. Hmm, let's check hm.sh again; yup, there's an install target!
...
I peeked in bin/ and found a bunch of binaries that are familiar to me from the old synergy/synergy2 days, but reading the User Manual and the User Wiki to find out how to set it up again almost exclusively references a GUI, and none of these binaries are a GUI...
OK, let's just extract the contents of the 1.4.16 RPM and see how the .desktop application file works and- aha, there is another binary, synergy, that hasn't been built. Let's just copy these into ~/.local/bin and ... it works.
It works.
Now, getting it to run. Two more hiccoughs. One was that I needed to open the firewall port. Using FirewallD in Fedora, I used this command,
Next, I configured the server to know the client using the GUI, and they could finally connect. Hurrah!
It's running beautifully now. Hopefully future releases will Just Work on Fedora like older releases. :)
I want to start off by saying that synergy seems like great software. I used it a lot in the past, and was very pleased with the results. It wasn't very user friendly then, and at some point it was no longer actively maintained. It seems to be actively maintained now, and even has file drag-and-drop support between computers (for Windows and Mac, not for Linux yet ;_;). In the rest of this post, I'll be detailing each step and obstacle I encountered trying to set up synergy 1.4.16 (the latest as of today) on Fedora 20. In part, I hope it helps the next person who tries this and perhaps Googles their error messages. Know that if you're just a regular user, don't take the issues that arise below as a cause for terror. You can do what you should, just install the package from the repository (if you're fine not having your key presses be encrypted over the network...) and not worry about anything. A lot of the problems below will emerge from me not properly understanding what's expected, but then that goes to show how straightforward or not building Synergy can be.
A quick summary is:
- can't install from RPM
- can't build from source using cmake
- can't install from source using configure
- just copied binaries out of RPM in the end :(
attempt 1: installing from an RPM
I run Fedora Linux 20. The version Fedora has in its repository is 1.4.10. The latest version from synergy-foss.org is 1.4.16 and has some features I would like. synergy-foss.org provides a pre-built package for Fedora, but there's an issue with their package for 1.4.16 preventing it from installing.
Error: Package: synergy-1.4.16-1.x86_64 (/synergy-1.4.16-r1969-Linux-x86_64)
Requires: libcurl.so.4(CURL_OPENSSL_3)(64bit)
They explain that in their release notes. Basically the packages get built on a Ubuntu installation which has an out-dated version of curl. Whoops. So, I'll take the opportunity to build it myself.
attempt 2: building from source, with cmake (their recommendation)
The first problem I have in building is that their wiki tells me to use their hm script. First, I try following hm.sh's own suggestion of
$ ./hm.sh build -g 1
Error: option -g not recognized
Hmm, double check the wiki and ... aha, yes, apparently -g should go to conf and not build. When I try doing
$ ./hm.sh conf -g1
Error: Could not find qmake.
Error: Cannot continue without qmake.
Fine. I install qt-devel, and set PATH to include the directory containing qmake
PATH=$PATH:/usr/lib64/qt4/bin ./hm.sh conf -g1
Success. Next step,
$ ./hm.sh build
Entering dir: build/release
make: *** No targets specified and no makefile found. Stop.
... Great. The instructions say I can skip the hm script, so yay. I follow its advice and go to
$ cd build/
$ make
make: *** No targets specified and no makefile found. Stop.
attempt 3: building from source, the old fashioned way (not their recommendation)
... Alright. I see that there is a configure script. I am used to doing ./configure && make && make install, so let's try it the old fashioned way. The next problem I encounter is with Xtst,
Missing library: Xtst
I thus installed libXtst-devel (which may have been unnecessary; libXtst was already installed) but still, I get that error message. I then grep'd about and checked CMakeError.log.
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=XTestQueryExtension CMakeFiles/cmTryCompileExec218679776.dir/CheckFunctionExists.c.o -o cmTr\
yCompileExec218679776 -rdynamic -lXtst -lXext -lX11
/usr/bin/ld: cannot find -lXtst
Hmm.
I then went to /tmp/ and tried compiling with -lXtst myself and... it worked.
I deleted the build directory, and unpacked a new one, and ... it worked. Annoyingly, their configure script apparently doesn't check again, and I'm not sure what you would use to clear its memory of the failure. Ah well.
Next problem is this:
CMake Error at tools/CMakeLists.txt:87 (add_library):
Cannot find source file:
cryptopp562/3way.cpp
I poked about with find and grep and ultimately found tools/cryptopp562.zip. If I just use unzip on it, it actually dumps all its files into the tools/ directory, so, clean up that mess, and then create cryptopp562, and unzip it into there.
And ... it works. I think. I manage to success do "make", but then there's no "make install" target. Hmm, let's check hm.sh again; yup, there's an install target!
$ ./hm.sh install
Not yet implemented: install
...
I peeked in bin/ and found a bunch of binaries that are familiar to me from the old synergy/synergy2 days, but reading the User Manual and the User Wiki to find out how to set it up again almost exclusively references a GUI, and none of these binaries are a GUI...
attempt 4: pillaging the RPM
OK, let's just extract the contents of the 1.4.16 RPM and see how the .desktop application file works and- aha, there is another binary, synergy, that hasn't been built. Let's just copy these into ~/.local/bin and ... it works.
It works.
running it
Now, getting it to run. Two more hiccoughs. One was that I needed to open the firewall port. Using FirewallD in Fedora, I used this command,
firewall-cmd --add-port=24800/tcp
Next, I configured the server to know the client using the GUI, and they could finally connect. Hurrah!
It's running beautifully now. Hopefully future releases will Just Work on Fedora like older releases. :)
2014-02-24
[Technology] Trackpad only scrolling
So I've run into a problem on my Lenovo Thinkpad Twist occasionally where my trackpad starts only scrolling, as though for every touch it senses two fingers (if I disable two finger scroll then the trackpad stops responding all together). Googling had advice such as "modprobe -r psmouse; modprobe psmouse" which doesn't work on my Fedora install since psmouse is built-in. Some people suggest using the hardware key for disabling and re-enabling your trackpad. My Thinkpad Twist does not have such a key. So, I ended up using xinput.
# find out the ID of my trackpad
$ xinput list
# Ah, it's 12! Then disable and re-enable it
$ xinput disable 12
$ xinput enable 12
Hooray, my trackpad works again. Well, works as well as it ever did. It's kind of hysterical on the Lenovo Thinkpad Twist. If only I had the leisure to debug the actual problem. :)
# find out the ID of my trackpad
$ xinput list
# Ah, it's 12! Then disable and re-enable it
$ xinput disable 12
$ xinput enable 12
Hooray, my trackpad works again. Well, works as well as it ever did. It's kind of hysterical on the Lenovo Thinkpad Twist. If only I had the leisure to debug the actual problem. :)
2014-02-17
[General] Wanted: A personal information database
Update: and then I discovered dokuwiki
I want to be able to to
What I'd like right now
I think Microsoft OneNote offers some (if not all) of this. I sort of want an experience that merges using Wikipedia and Aloha Editor.
Things that exist that are inadequate:
I want to be able to to
What I'd like right now
- personal wiki
- accessible remotely (but securely)
- accessible via my mobile device
- WYSIWYG, with inline images, tables
- searchable, tags
- open source
- nice, standardised data representation (OrgMode, Latex, HTML); something easy and clean to parse
I think Microsoft OneNote offers some (if not all) of this. I sort of want an experience that merges using Wikipedia and Aloha Editor.
Things that exist that are inadequate:
- MediaWiki: big, requires web infrastructure (well, Apache), not WYSIWYG; comprehensive though
- Tomboy: doesn't have inline images or tables; nicely WYSIWYG though
- TiddlyWiki: doesn't save automatically, or have WYSIWYG; easy to setup though
- org-mode in emacs: no WYSIWYG, no obvious remote; great data representation
- MS OneNote: not open source, doesn't run on Linux; seems featureful
2014-02-07
[General] Website Changes
Not very user visible, but I am now managing my website with git, as per these instructions. That should eliminate issues I have with synchronisation.
2014-01-18
[Technology] E-mail encryption
In an ideal world, everyone would be able to make use of encryption in their daily life and communications. The other day, I had a mild challenge setting it up with a friend. Basically, Apple Mail wants to handle encryption via S/MIME using certificates, which is typical of most enterprise usage. Evolution can do that, but I'd prefer to do it via GPG/PGP using public-private keys. The main reason is because I find that approach is more usable for personal use. (Self-signed certificates are a bit annoying, and I find it a bit more involved to generate your own certificate.)
We finally settled on using GPG Tools for Apple Mail. Next we had issues where I had to trust his key, which worked out, but left me wishing that GNOME had a better interface for handling keys.
Ideally to me, everyone would have a public-private key pair and have some concept of how it was used. I'd be happy for roaming usage if they kept their private key on a tiny USB computer that you could plug into any other computer, and would have a partition the foreign computer could see, and a partition only the computer on the USB could see. You'd drop content into the public partition and the computer would see it and sign it with the private key (which is on the private partition, so a foreign computer can't just grab it). It could also handle data other than files copied over. If enough software understood that there was a USB key providing a signing/encryption service, they'd have decent interfaces for requesting the USB key computer sign an e-mail or an instant message. This (or some other solution to securely using a private key out and about) hopefully already exists. :) (I'd imagine the USB key computer would have a button on it that you press when you approve of it signing/encrypting something.)
Basically, I just want encryption to be easy for users and to reduce the chance of people compromising their keys.
But of course, with encrypted e-mail, there's the problem of how can you make use of webmail and its search services without allowing a third-party e-mail provider access to the plain text of messages? I find the conveniences of Google generally worthwhile, and difficult to achieve without a large centralised infrastructure. Hmm.
We finally settled on using GPG Tools for Apple Mail. Next we had issues where I had to trust his key, which worked out, but left me wishing that GNOME had a better interface for handling keys.
Ideally to me, everyone would have a public-private key pair and have some concept of how it was used. I'd be happy for roaming usage if they kept their private key on a tiny USB computer that you could plug into any other computer, and would have a partition the foreign computer could see, and a partition only the computer on the USB could see. You'd drop content into the public partition and the computer would see it and sign it with the private key (which is on the private partition, so a foreign computer can't just grab it). It could also handle data other than files copied over. If enough software understood that there was a USB key providing a signing/encryption service, they'd have decent interfaces for requesting the USB key computer sign an e-mail or an instant message. This (or some other solution to securely using a private key out and about) hopefully already exists. :) (I'd imagine the USB key computer would have a button on it that you press when you approve of it signing/encrypting something.)
Basically, I just want encryption to be easy for users and to reduce the chance of people compromising their keys.
But of course, with encrypted e-mail, there's the problem of how can you make use of webmail and its search services without allowing a third-party e-mail provider access to the plain text of messages? I find the conveniences of Google generally worthwhile, and difficult to achieve without a large centralised infrastructure. Hmm.
Abonnieren
Posts (Atom)
Dieses Blog durchsuchen
Labels
#Technology
#GNOME
gnome
gxml
fedora
bugs
linux
vala
google
#General
firefox
security
gsoc
GUADEC
android
bug
xml
fedora 18
javascript
libxml2
programming
web
blogger
encryption
fedora 17
gdom
git
emacs
libgdata
memory
mozilla
open source
serialisation
upgrade
web development
API
Spain
containers
design
evolution
fedora 16
fedora 20
fedora 22
fedup
file systems
friends
future
glib
gnome shell
internet
luks
music
performance
phone
photos
php
podman
preupgrade
tablet
testing
typescript
yum
#Microblog
Network Manager
adb
apache
art
automation
bash
brno
catastrophe
css
data loss
debian
debugging
deja-dup
disaster
docker
emusic
errors
ext4
facebook
fedora 19
gee
gir
gitlab
gitorious
gmail
gobject
google talk
google+
gtk
html
libxml
mail
microsoft
mtp
mysql
namespaces
nautilus
nextcloud
owncloud
picasaweb
pitivi
ptp
python
raspberry pi
resizing
rpm
school
selinux
signal
sms
speech dispatcher
systemd
technology
texting
time management
uoguelph
usability
video
web design
youtube
#Tech
Air Canada
C
Electron
Element
Empathy
Europe
GError
GNOME 3
GNOME Files
Go
Google Play Music
Grimes
IRC
Mac OS X
Mario Kart
Memento
Nintendo
Nintendo Switch
PEAP
Selenium
Splatoon
UI
VPN
Xiki
accessibility
advertising
ai
albums
anaconda
anonymity
apple
ask
asus eee top
automake
autonomous automobiles
b43
backup
battery
berlin
bit rot
broadcom
browsers
browsing
canada
canadian english
cars
chrome
clarity
comments
communication
compiler
complaints
computer
computers
configuration
console
constructive criticism
cron
cropping
customisation
dataloss
dconf
debug symbols
design patterns
desktop summit
development
discoverability
distribution
diy
dnf
documentation
drm
duplicity
e-mail
efficiency
email
english
environment
estate
experimenting
ext3
fedora 11
festival
file formats
firejail
flac
flatpak
forgottotagit
freedom
friendship
fuse
galaxy nexus
galton
gay rights
gdb
german
germany
gimp
gio
gjs
gnome software
gnome-control-center
google assistant
google calendar
google chrome
google hangouts
google reader
gqe
graphviz
growth
gtest
gtg
gvfs
gvfs metadata
hard drive
hard drives
hardware
help
hp
humour
ide
identity
instagram
installation
instant messaging
integration
intel
interactivity
introspection
jabber
java
java 13
jobs
kernel
keyboard
language
language servers
languages
law
learning
lenovo
letsencrypt
libreoffice
librpm
life
livecd
liveusb
login
lsp
macbook
maintainership
mariadb
mario
matrix
memory leaks
messaging
mounting
mouse
netflix
new zealand
node
nodelist
numix
obama
oci
ogg
oggenc
oh the humanity
open
open standards
openoffice
optimisation
org-mode
organisation
package management
packagekit
paint shedding
parallelism
pdo
perl
pipelight
privacy
productivity
progress
progressive web apps
pumpkin
pwa
pyright
quality
recursion
redhat
refactoring
repairs
report
rhythmbox
rust
sandboxes
scheduling
screenshots
self-navigating car
shell
sleep
smartphones
software
software engineering
speed
sql
ssd
synergy
tabs
test
tests
themes
thesis
tracker
travel
triumf
turtles
tv
tweak
twist
typing
university
update
usb
user experience
valadoc
video editing
volunteering
vpnc
waf
warm
wayland
weather
web apps
website
wifi
wiki
wireless
wishes
work
xinput
xmpp
xorg
xpath
Powered by Blogger.