Thursday, October 28, 2010

Looping Logins at KDM for KDE4

If, for some reason, the kdm is not letting you proceed with the login, and is instead sending you back to the login screen, check your ~/.xsession-errors file. If you see the following:


startkde: Starting up...
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kded(7607): Communication problem with "kded" , it probably crashed.
Error message was: "org.freedesktop.DBus.Error.ServiceUnknown" : " "The name org.kde.kded was not provided by any .service files" "

startkde: Shutting down...

then it may be nice to know that the following method fixed the problem for me:



  1. Create a new user.

  2. Copy over the ~/.Xauthority and ~/.ICEauthority files from this new user to your dysfunctional user's home folder.

  3. Remove the /var/tmp/kdecache- folder.

Friday, August 27, 2010

Setting up Ruby on Rails on Windows 7


  1. Install Ruby (1.9.2 as of time of writing)
  2. Install RubyGems (1.3.7 as of time of writing)
  3. gem install mysql, rake, authlogic, rspec
  4. Remove rake.gemspec from C:\Ruby192\lib\ruby\gems\1.9.1\specifications
  5. Replace libmySQL.dll in C:\Program Files\MySQL\MySQL Server 5.1\bin with the one from InstantRails
  6. Login to MySQL (mysql -uroot -p)
    • CREATE DATABASE DB_NAME;
    • CREATE DATABASE DB_NAME_test;
    • CREATE USER 'test_user'@'localhost' IDENTIFIED BY 'test_pass';
    • GRANT ALL PRIVILEGES ON *.* TO 'test_user'@'localhost' WITH GRANT OPTION;
  7. Update database.yml correspondingly

Sunday, July 25, 2010

dual monitors in Linux.

If you are trying to set up dual monitors in Linux, and are finding that any attempts are being foiled by a forced log out. You may need to disable effects (i.e. Kwin effects on KDE4)

https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/273505

xrandr --output VGA1 --auto --right-of LVDS1

Tuesday, July 20, 2010

Segmentation Fault when saving a QImage in Qt 4.6

This function should save its QImage image to a file either specified by the user or that it was opened from.
void ImageDocument::save(QString file)
{
if (file.isEmpty())
file = filename;
cout << qPrintable(file) << endl;
if (this->image.save(file, "PNG")) {
if (!this->undoStack->isClean())
this->undoStack->setClean();
filename = file;
}
}

If I were to use it with the following, it would cause a segmentation fault:
void PixelEasel::saveAs()
{
QString fileName(QFileDialog::getSaveFileName(this, tr("Save As"),
QDir::currentPath(),
tr("Images (*.png *.gif)")));
if (fileName.isEmpty())
return;
activeDocument()->save(fileName);
saveAct->setEnabled(!undoGroup->isClean());
}

Whereas the exact same code, except for the manual specification of the file path, will succeed.

Apparently, I am a moron and wrongly assumed that QMdiArea::activeSubWindow() will give you the sub-window if the area of focus is the top-level window menu. (Hint: QMdiArea::currentSubWindow() will do the trick). It is apparent I have not been using C++ in such a long time, because Qt was letting me execute methods on an object that was cast from a NULL pointer. I thought that would throw an exception earlier rather than when it went and tried to look for class members that didn't officially exist.

Saturday, June 12, 2010

day 3.

Zipper Data Structure

It is a detail of implementation of aggregate data structures which can be constructed inductively. It is a method of encapsulating both the structure itself as well as an unobtrusive indication of an arbitrary position within the structure. In fact, it is more appropriate to say that it exists to keep track of a location inside the data structure.
An example would be for a list [1,2,3,4] with position 3 to be represented as the tuple: ([2,1],[3,4]) and moving left or right will give us ([1],[2,3,4]) or ([3,2,1],[4]) respectively.

Tuesday, March 16, 2010

day 2.

General Code
  • Java does not support operator overloading
  • Java is not considered a pure OOP language due to primitive types not being treated as objects are (for performance reasons)
To Do
  • Look up Just-In-Time (JIT) compiling and LLVM
  • Finish comparison of Java and C++, look at C# next: link

Monday, March 15, 2010

day 1.

General Code
  • Java does not support multiple inheritance. alternatives: delegation, composition

Testing Practices?
  • when testing for randomness: statistics can be a valuable tool (e.g. determining if datasets are uniformly distributed)
  • multiple heuristics when testing for such (rotational shuffling can achieve a uniform distribution)
  • ideas for testing login which takes in a username/password, returns a boolean: different encodings; differing string lengths (0-maximum value) - make sure it doesn't do weird things and/or accepts/honours input of accepted lengths; check for returned values; case sensitivity; symbols/punctuation; other symbols

To Do
  • general testing work flow
  • need to know strengths and weaknesses of languages, think on that
  • look into Chomsykan theory (his idea that natural languages are context free at their core with additional transformations)