One of the things I would like to have working well in Plasma NM is DSL support. Unfortunatelly, I do not have easy access to any DSL provider so I cannot test the current support for DSL in Plasma NM. I do not even know if the support really works. I asked if it works in the bug entry about DSL support and only one person has answered saying it works so I assumed it does work.
Last week I was surffing the web and stumbled accross this post in a Brazilian forum (it is Brazilian Portuguese) explaining how to set up a DSL connection in Plasma NM. Basically Plasma NM really works with DSL, which is great, but there is a catch: you need to disable the auto-connect option for the wired connection that uses the same device that the DSL connection uses. Explaining: DSL works over ethernet (more common), wifi, and maybe over other devices. When the device (ethernet) is meant to be used with DSL you must disable the auto-connect feature in the wired connection associated to that device. First create a system DSL connection:
In the Ethernet tab restrict the connection to a specific ethernet device. If you have more than one ethernet device do not be afraid, the "eth0" below is just an user-friendly way to select the device, what Plasma NM really uses is the device's MAC address. If for example you have eth0 and eth1 in your system, then you restrict to eth0 but for some reason the system swaps eth0 for eth1, Plasma NM is smart enough to see that and it will automatically change the configuration to eth1.
Save the configuration by clicking on the Ok button and go to the Wired tab in Plasma NM's kcm (k control module):
Click on "Edit", the edit dialog will appear. Go to the connections's "Ethernet" tab and disable "Connect automatically" and check "System connection" to allow the system (NetworkManager) to use the connection without you need to open a KDE session first:
Save the configuration by clickling on the Ok button and try to connect. You can check if it is connected in Interface Details for the wired connection (I got this screenshot from the forum, that is why it is in Brazilian Portuguese):
Notice the "Nome do sistema" field (System name) showing "ppp0", that means the connection is really active.
For some reason nm-applet does not require changing the wired connection configuration, which sounds reasonable. But without a connection to test it will take me time to figure out how to make that work. Until then DSL users can use the configuration above.
Hello everybody!
Dark picture with Ângela, me, Mara and Francisco
We realized the RP of KDE 4.8 on January 27 in Teresina/Brazil! It was a night of pizza, beer and KDE. And look what we did:
We hope these gifts will spread around the world!
Hello all KDE and Words fans
Sorry for being out of touch in recent times….i know i was not able to blog much…but the waits finally over!!
I have modified the Statistics Docker in Calligra Words so that the UI is now more user-customizable.Basically the old docker had a combobox with an auto-update button wherein you could choose only one kind of statistics out of Words/Sentences/Chars. With Spaces/Without spaces etc…But what about the use cases where we need two or more statistics to be tracked at the same time?Like if you are a newbie journalist and want to give in a centre-fold article within an hour’s deadline?It wouls be very,very inconvivient to just keep switching various options and see the word count.So all this fueled a detailed discussion between me and a few other Calligra and Words Developers at the Calligra fall Helsinki Sprint in Finland.The idea is:
1)To initially have all statistics being updated…but once the user wants to track only specific statistics,he/she can choose only those fields to be visible in the docker.
2)Bye-Bye to the autoupdate button…it has now been replaced by a QTimer that refreshes data every 20 ms or so…
3)KConfig saves user-customization and takes care each time the document is loaded…so you wont have to customize all over again.
So now thats that been smoothly done…i attach a few screenshots of the new UI and want suggestions and feedback from all the users/developers/communities…..all improvements are welcome as the ultimate Goal is user-satisifiability and about feeling good when you use any software .And thanks to all Words devs especially Boemann for helping me out with this
New Improved UI
The code can be found in my branch words-statistics-shreya….and bye for now guys…am really sleepy
But I promise more news from my side in the KDE World soon…!!
Ferris has extended its claws to allow the pastebin at http://paste.kde.org to be mounted. Since bash doesn't know libferris at all, without fuse you can use ferris-redirect to pipe information into any file that libferris can use as shown below (-T truncates like ">" in bash).
mkdir /tmp/test
cd /tmp/test
date > df1.txt
cat df1.txt | ferris-redirect -T pastebin://kde.org/new/foo
...
http://paste.kde.org/199754/
If you just have one file, then the "new" directory itself will act as a target too:
echo anyone, anyone... | ferris-redirect -T pastebin://kde.org/new
...
http://paste.kde.org/199760/
And because everybody knows that key protected pastebins are the new red, the following will need to have "goodkeyhere" on hand to read the data back...
echo this is secret, dudes | ferris-redirect -T pastebin://kde.org/private/goodkeyhere
...
http://paste.kde.org/199772/35847813/
The final directory is the "list" which contains virtual files allowing you to get a paste through the virtual filesystem. Of course, you could just fcat the http:// URL for the paste, but a nice tree is a nice tree.
fls pastebin://kde.org/list/
... 199700
fcat pastebin://kde.org/list/199700
I have been passionate about Free Software for a long time now. My contributions have always revolved around helping people make amazing things happen and realize what they are really capable of. I’ve shown many people that small niche that just fits them perfectly and seen them grow from there and make a difference.
Along the way I’ve always come accross two problems:
I’ve done a lot of things to overcome this but it wasn’t ever enough somehow. Today I am at FOSDEM presenting a book, that will be another step towards fixing these problems. Today I am releasing Open Advice.
Open Advice is the result of the collaboration of more than 50 people from all across Free Software. It is a collection of short essays about key things the authors wished they had known when they started contributing to Free Software. It’ll give a headstart to everyone who wants to contribute. It’ll also be useful for existing contributors who want to know a bit more about other projects and areas of contribution.
The book is available as a paperback and free PDF and is licensed under CC-BY-SA.
What are you waiting for? Download the PDF version today or order a printed version.
Additional goodies: The LaTeX source is available and a bug tracker exists as well.
A year ago I started working on this project and today it is reality. If you’re at FOSDEM I’m sure you can see me bouncing around with joy
To recap what this third report is to address if Oracle wants to argue these points on damages:
(This is part 2 of the PyQt+WebKit experiments series)
In Part 1 I described how to embed WebKit in a PyQt application and how to expose PyQt objects in WebKit and manipulate them with JavaScript.
Even if you are a great JavaScript master, you can’t avoid the occasional typo while writing JavaScript code in your application. This can be quite frustrating with QtWebKit because it likes to stay quiet: it won’t tell you about any error.
Let’s have a look at an example.
First here is loader.py, a simple Python script which loads a block of HTML:
import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * class Window(QWidget): def __init__(self): super(Window, self).__init__() self.view = QWebView(self) layout = QVBoxLayout(self) layout.setMargin(0) layout.addWidget(self.view) def main(): app = QApplication(sys.argv) window = Window() html = open(sys.argv[1]).read() window.show() window.view.setHtml(html) app.exec_() if __name__ == "__main__": main()
And here is “broken.html”, our broken HTML code:
<html> <head> <script> function brokenFunction(arg1, arg2) { var result; result = arg1 * 2; result += arg2; resul /= 4; return result; } </script> </head> <body> Complex computation: <script> document.write(brokenFunction(2, 3)); </script> </body> </html>
Notice the missing ‘t’ in “resul /= 4″?
The last-resort, grandpa-debugged-js-this-way, debugging tool is still there: the mighty alert() function. Just stuff your code with calls to alert() and be happy… Anyone ever wrote code like that?
<html> <head> <script> function brokenFunction(arg1, arg2) { var result; result = arg1 * 2; alert("1"); result += arg2; alert("2"); resul /= 4; alert("3"); return result; } </script> </head> <body> Complex computation: <script> document.write(brokenFunction(2, 3)); </script> </body> </html>
Easy enough, no? With the great alert() function we can quickly pinpoint the bug in our brokenFunction() is between alert(“2″) and alert(“3″).
Can we do better?alert()-style debugging gets old very fast. Clicking that “OK” button is a pain. Fortunately, there is a way to get more useful feedback from our PyQt application.
The job of the QWebView class is to show the content of a QWebPage instance. By default QWebView creates its own instance of QWebPage, but it is possible to replace this instance with our own QWebPage. The QWebPage class has a few virtual methods. Among them, the javaScriptConsoleMessage() method is the one we are looking for: it is called every time console.log() is called from JavaScript.
Here is an implementation of WebPage which uses Python logging module to get JavaScript console messages out:
import logging from PyQt4.QtWebKit import * class WebPage(QWebPage): """ Makes it possible to use a Python logger to print javascript console messages """ def __init__(self, logger=None, parent=None): super(WebPage, self).__init__(parent) if not logger: logger = logging self.logger = logger def javaScriptConsoleMessage(self, msg, lineNumber, sourceID): self.logger.warning("JsConsole(%s:%d): %s" % (sourceID, lineNumber, msg))
And here is “loader-log.py”, a loader which uses this class:
import os import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * from webpage import WebPage class Window(QWidget): def __init__(self): super(Window, self).__init__() self.view = QWebView(self) self.view.setPage(WebPage()) layout = QVBoxLayout(self) layout.setMargin(0) layout.addWidget(self.view) def main(): app = QApplication(sys.argv) window = Window() html = open(sys.argv[1]).read() window.show() window.view.setHtml(html) app.exec_() if __name__ == "__main__": main()
If we load “broken.html” with “loader-log.py” we get the following on stderr:
$ python loader-log.py broken.html WARNING:root:JsConsole(undefined:0): ReferenceError: Can't find variable: resulThat should make it easier to find and fix our bug, even if we don’t get very useful file names or line numbers.
javaScriptConsoleMessage() receives all console messages. This means our logger will also print out calls to console.log(). Here is “console-log.html”:
<html> <head> <script> function chattyFunction(arg1, arg2) { var result; result = arg1 * 2; console.log("result" + result); result += arg2; console.log("result" + result); result /= 4; console.log("result" + result); return result; } </script> </head> <body> Complex computation: <script> document.write(chattyFunction(2, 3)); </script> </body> </html>
When loaded with “loader-log.py”, we get this output:
$ python loader-log.py console-log.html WARNING:root:JsConsole(about:blank:5): result: 4 WARNING:root:JsConsole(about:blank:5): result: 7 WARNING:root:JsConsole(about:blank:5): result: 1.75 Not good enough?Getting the output of console.log() is nice, but modern browsers have much more efficient tools: if you open “broken.html” with Rekonq and look at the output in the Web Inspector Console, you can not only see console output, but you can also easily inspect your HTML tree and many other things.
Like us, Rekonq uses QtWebKit, so is there a way to get a similar tool?
It is actually possible. Rekonq uses a class named QWebInspector. All that is necessary to get a nice inspector tool for our application is to:
Here is “loader-webinspector.py”, a new HTML loader which can show a web inspector when one presses F12:
import os import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * from webpage import WebPage class Window(QWidget): def __init__(self): super(Window, self).__init__() self.view = QWebView(self) self.setupInspector() self.splitter = QSplitter(self) self.splitter.setOrientation(Qt.Vertical) layout = QVBoxLayout(self) layout.setMargin(0) layout.addWidget(self.splitter) self.splitter.addWidget(self.view) self.splitter.addWidget(self.webInspector) def setupInspector(self): page = self.view.page() page.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True) self.webInspector = QWebInspector(self) self.webInspector.setPage(page) shortcut = QShortcut(self) shortcut.setKey(Qt.Key_F12) shortcut.activated.connect(self.toggleInspector) self.webInspector.setVisible(False) def toggleInspector(self): self.webInspector.setVisible(not self.webInspector.isVisible()) def main(): app = QApplication(sys.argv) window = Window() html = open(sys.argv[1]).read() window.show() window.view.setHtml(html) app.exec_() if __name__ == "__main__": main()
The four steps I described are done in the “setupInspector()” method.
And here is “console-webinspector.html”:
<html> <head> <script> function chattyFunction(arg1, arg2) { var result; result = arg1 * 2; console.log("result: %d", result); result += arg2; console.warn("result: %d", result); result /= 4; console.error("result: %d", result); return result; } </script> </head> <body> Complex computation: <script> document.write(chattyFunction(2, 3)); </script> </body> </html>
It is similar to “console-log.html” but takes advantage of two new features which do not work with the previous approach:
Loading “console-webinspector.html” with “loader-webinspector.py” and pressing F12 we get this:
Closing wordsThese two approaches should help you track down the nastiest bugs in your embedded JavaScript code. The Web Inspector approach is probably the most powerful one, but the Python logging approach can also be useful when tracking down bugs where it is more practical to have one single log output for both the PyQt and the JavaScript sides.
I ordered a new keyboard thin week, and today it finally arrived. But even though I’m a firm believer it free software, I bought the Natural Ergonomic 4000, made by Microsoft. It is about half the price of any comparable Logitech product available in Slovenia, despite it costing 50€. In comparison, the American Amazon sells it at 27$. This disparity (which is noticeable everywhere, but especially with tech products) made even more happy about Spark coming out first in Europe.
First thing I noticed, this thing is monstrous. My previous keyboard is rather old, so it’s mechanical and larger than newer keyboards, but in pales in comparison with MS’s product. The desk I use at home has a keyboard drawer, and it fits in perfectly, both in width and height (The keyboard has a large and elevated wrist-rest). My second thought, after trying to type on it, is that it’s going to take some time getting used to it. Having been using the Dvorak layout for several years, I’m used to touch typing, but I’ve never tried a curvy ergonomic keyboard before. It’s quite different, but I haven’t used it enough to formulate any king of informed opinion.
And as to apologize for buying from Microsoft, I feel a comparison between our favourite evil empires is in order. In Slovenia, 50€ will get you this mighty keyboard with split keys, a soft wrist-rest, all kinds of shortcut button and a scroller between the key sets. On the other hand, this costs 75€:
I know that both are cheaper in USA, and even some places in Europe, but the ratio of their official recommended prices is similar. And still I have no doubt many people will claim how typing anything on the Apple product is so much easier and more comfortable. Sorry for turning this post into a rant, but it got me quite angry while shopping.
Ok, writing this post on the new toy went better than expected, now I’ll get back to homework coding. Yes, I have to write code for school as well, but it also involves less interesting parts, like writing sentences. Ugh.
Every once in a while I add another piece of query optimization code to the Nepomuk Query API. This time it was a direct result of my earlier TV Show handling. I simply thought that a query like “downton season=2 episode=2” takes too long to complete.
Now in order to understand this you need to know that there is a rather simple QueryParser class which converts a query string like the above into a Nepomuk::Query::Query which is simply a collection of Nepomuk::Query::Term instances. A Query instance is then converted into a SPARQL query which can be handled by Virtuoso. This SPARQL query already contains a set of optimizations, some specific to Virtuoso, some specific to Nepomuk. Of course there is always room for improvement.
So let us get back to our query “downton season=2 episode=2” and look at the resulting SPARQL query string (I simplified the query a bit for readability. The important parts are still there):
select distinct ?r where { ?r nmm:season "2"^^xsd:int . { ?r nmm:hasEpisode ?v2 . ?v2 ?v3 "2"^^xsd:int . ?v3 rdfs:subPropertyOf rdfs:label . } UNION { ?r nmm:episodeNumber "2"^^xsd:int . } . { ?r ?v4 ?v6 . FILTER(bif:contains(?v6, "'downton'")) . } UNION { ?r ?v4 ?v7 . ?v7 ?v5 ?v6 . ?v5 rdfs:subPropertyOf rdfs:label . FILTER(bif:contains(?v6, "'downton'")) . } . }Like the user query the SPARQL query has three main parts: the graph pattern checking the nmm:season, the graph pattern checking the episode and the graph pattern checking the full text search term “downton“. The latter we can safely ignore in this case. It is always a UNION so full text searches also include relations to tags and the like.
The interesting bit is the second UNION. The query parser matched the term “episode” to properties nmm:hasEpisode and nmm:episodeNumber. On first glance this is fine since both contain the term “episode“. However, the property nmm:season which is used in the first non-optional graph-pattern has a domain of nmm:TVShow. nmm:hasEpisode on the other hand has a domain of nmm:TVSeries. That means that the first pattern in the UNION can never match in combination with the first graph pattern since the domains are different.
The obvious optimization is to remove the first part of the UNION which yields a much simpler and way faster query:
select distinct ?r where { ?r nmm:season "2"^^xsd:int . ?r nmm:episodeNumber "2"^^xsd:int . { ?r ?v4 ?v6 . FILTER(bif:contains(?v6, "'downton'")) . } UNION { ?r ?v4 ?v7 . ?v7 ?v5 ?v6 . ?v5 rdfs:subPropertyOf rdfs:label . FILTER(bif:contains(?v6, "'downton'")) . } . }Well, sadly this is not generically true since resources can be double/triple/whateveriple-typed, meaning that in theory an nmm:TVShow could also have type nmm:TVSeries. In this case it is obviously not likely but there are many cases in which it in fact does apply. Thus, this optimization cannot be applied to all queries. I will, however, include it in the parser where it is very likely that the user does not take double-typing into account.
If you have good examples that show why this optimization should not be included in the query parser by default please tell me so I can re-consider.
Now after having written this and proof-reading the SPARQL query I realize that this particular query could have been optimized in a much simpler way: the value “2″ is obviously an integer value, thus it can never match to a non-literal like required for the nmm:hasEpisode property…
It happened in São Carlos, on January 27th, the KDE 4.8 Release Party – the second time in this city.
It was time to meet friends, drink some beers, talk about KDE, the life, the universe and everything, and of course, drink more beer. This time I had time to install the new version of KDE on Mageia (thanks mikala!), to allow those who had not seen the new version, could do a test drive.
The rain interfered a little, but attended four brave comrades to celebrate the work of the entire ecosystem of free software that is KDE.
Left to right: Daniel, Rodrigo, Vitor e Filipe
For me, KDE 4.8 release is more special because it is the first time that I have a large contribution of software being distributed with the project. This is the backend for Scilab in Cantor, a result of my work in the Google Summer of Code 2011, which finally came to you computer, KDErs. Thanks to Scilab team, especially to my mentor Sylvestre Ledru.
But that’s a topic to a future post.
Recent comments
6 weeks 1 day ago
10 weeks 3 days ago
13 weeks 8 hours ago
15 weeks 3 days ago
15 weeks 3 days ago
15 weeks 3 days ago
15 weeks 3 days ago
15 weeks 3 days ago
21 weeks 6 days ago
25 weeks 3 days ago