Quantcast
Browsing latest articles
Browse All 25 View Live

Comment by rafalcieslak on Any way to speed up/reduce CPU usage when drawing...

Probably the first suggestion of yours may work. How can I do that? Which surface type should I use, how do I get it's context to draw on it, and finally how to perform a quick copy?

View Article


Comment by rafalcieslak on How can I make the icons in an IconView spread out...

Have you, by any chance, figured out some solution?

View Article


Comment by rafalcieslak on Same C++'if' statement, different results on...

Yes, exactly, thanks for suggesting a reason for this issue :-)

View Article

Comment by rafalcieslak on Same C++'if' statement, different results on...

Thanks for suggesting epsilon comparison, even if your answer does not explain why did this problem happen ;)

View Article

Comment by rafalcieslak on Delaying file data for several minutes

@Dave: Not exactly, I need that copy file to be also updated each second, yet with outdated data.

View Article


Comment by rafalcieslak on python-twisted and SIGKILL

Thank you for your answer, this seems quite logical. Yet that makes me wonder why - when a user logs out - a SIGTERM is no sent to that twisted daemon, instead a SIGKILL is used?

View Article

Comment by rafalcieslak on python-twisted and SIGKILL

This is what I do currently. If the file is present, but the daemon is not responding, the launcher tries killing the given pid, and then I removing the file. However, there is no way to distinguish...

View Article

Comment by rafalcieslak on python-twisted: How to stop the daemon when user...

@Jean-PaulCalderone: A linux machine, gnome-session in my case, but ideally that should work even when logged in remotely.

View Article


Comment by rafalcieslak on Why is the asterisk before the variable name,...

This point can be misleading in such context: int x = 5; int *pointer = &x;, because it suggests we set the int *pointer to some value, not the pointer itself.

View Article


Comment by rafalcieslak on Convert a number to a string with specified length...

And stringstream, setw and setfill (as well as string) are within the std namespace.

View Article

Comment by rafalcieslak on CMake: Print out all accessible variables in a script

This does not print out all available libraries, only the cached ones.

View Article

Comment by rafalcieslak on How to enable global menu bar for Emacs on Ubuntu...

I'm out of words. This is the most hackish answer I've ever read. Please, do not attempt this fix unless you understand the consequences of manually editing a binary executable! Otherwise it is very...

View Article

Unable to get height/width of a widget - gtkmm

I'm writing an application using gtkmm.I wrote a simple widget class, that I want to display in the application's main window only in some cases. Otherwise, I would like a Label "disabled" to be...

View Article


Navigating through widgets using the TAB key

What should I do in order to allow users to navigate through widgets using the Tab key (in either Gtk or any derivative like gtkmm, pyGtk)?

View Article

Answer by rafalcieslak for Any way to speed up/reduce CPU usage when drawing...

I finally forced to use maximally 25 fps, by using a lock flag.bool lock = 0;bool needs_redraw = 0;void Redraw(){ if(lock){ needs_redraw = 1; return; } //draw image to a surface needs_redraw = 0; lock...

View Article


Any way to speed up/reduce CPU usage when drawing with Cairo?

I wrote an app that uses Cairo to draw things on screen (on a Gtk::DrawingArea, to be exact). It needs to redraw everything frequently. It turns out, that despite the draphics drawn are very simple,...

View Article

Find differences in a .po file

I have a .po file where most translated strings are identical to original ones. However, few are different. How do I quickly find the ones that differ from original?

View Article


Answer by rafalcieslak for How can I make the icons in an IconView spread out...

We have encountered that problem in Ubuntu Accomplishments Viewer, and as we managed to solve it, I'll present our solution.The trick is to place the GtkIconView in a GtkScrolledWindow, and set it's...

View Article

Same C++'if' statement, different results on Linux/Windows

I've found an interesting case where the same C++ code yields different results on different system.#include <cstdio>int main(){ int a=20, b=14; if(a*1.0/b*(a+1)/(b+1)==2) printf("YES!"); else...

View Article

python-twisted and SIGKILL

I have a python application that uses twisted framework.I make use of value stored in the pidfile generated by twistd. A launcher script checks for it's presence and will not spawn a daemon process if...

View Article

How do I generate multiple .exe files from a single solution?

I am using MonoDevelop to develop 2 simple C# programs in separate solutions.Due to their nature, they share a similar codebase. A large number of objects is identical among these two programs.I would...

View Article


Joining a pointer and member pointer into a function pointer

Please consider such code:class MyClass{public: void MyFunc(int x){ std::cout << x << std::endl; }};int main(){ MyClass* class_ptr = new MyClass(); void (Myclass::*member_func_ptr)(int) =...

View Article


Answer by rafalcieslak for Direct-­mapped instruction cache VS fully...

This can happen for caches of small size. Let's compare caches of size 2.In my example, the directly-mapped "DM" cache will use row A for odd addresses, and row B for even addresses.The LRU cache will...

View Article

Answer by rafalcieslak for In emacs, how do I save without running save hooks?

A simpler solution I came up with is that my fundamental-mode has no hooks installed, because I want it to be as plain as possible. Thus if I want to save a file without running hooks, I temporarily...

View Article

Is there a safe way to have a std::thread as a member of a class?

I would like to use a class that manages a thread (or several threads). Using composition, this would look like:class MyClass{private: std::thread mythread; void _ThreadMain();public: MyClass(); //...

View Article

Browsing latest articles
Browse All 25 View Live