Oct 17 2011

Simple editor in RICcreator

Category: UncategorizedSpiller @ 00:33

To show a nxtCanvas in QT I made a custom widget called nxtCanvasWidget. nxtCanvasWidget implements everything needed to view, move and edit nxtCanvas. However to add scroolbars I had to create another widget, which is named nxtCanvasWidgetContainer and which contains a nxtCanvasWidget. However it does not include the interface needed to do editing, so another widget called spriteValue is used which includes nxtCanvasWidgetContainer.

To simplify this, I merged nxtCanvasWidgetContainer and spriteValue. In the process I also tried to improve the edit interface.

While far from perfect, it is a bit better than before in my opinion. (I just noticed that the scrollbars have stopped working and probably have been for quite some time. I just love the scroll wheel I guess.)

I have also finally resized the icons, this makes them look quite a bit better than before. I’m still missing icons for bucket fill and crop though.

However now that the editor interface is done and that adding a sprite editor is simplified, I added another editor as visible above. It simply hides everything else than the nxtCanvas.

Editors can be changed with the “View” menu, I have also added a RIC font editor there, but it is not implemented anyway in case you are wondering.

In order to change to the simple editor, a RIC file must be “simple” too. That is, it must only contain one Sprite, one CopyBits (which refers to the sprite) and may have an optional Options element as the first element.

Download

RICcreator rev. 139 – win32.zip (The advanced editor’s tool bar disappears if you change between simple and advanced editor, I think that I’m trying to use QT incorrectly here… Or it might just be a bug…)


Oct 16 2011

Password security

Category: SoftwareSpiller @ 00:39

After about 3 years of using the same password I decided it was about to create a new one. I simple don’t think my password is secure enough. But how do you make a secure password?

Common guidelines:[1]

  • Keep the password at least 8 characters long.
  • Use mixed case letters and mix in numbers. Include special characters if possible.
  • Use different passwords for different sites.
  • Change passwords every 3 months.
  • Do not include personal information.
  • Do not include sequences or repeated characters.
  • Do not include dictionary words, abbreviations or common misspellings.
  • Do not write your password down (or at least keep it inaccessible for unauthorized people).

I will admit that I use the same password everywhere and I do not think it is feasible to have a separate password for each site. Since you have to create logins for about every site out there, you easily end up having to remember 20-30 passwords. To have a separate password for each site you easily end up making a list of them which is potentially unsafe. And then you have to change all the passwords once in a while which is honestly a pain to do.

Avoiding security

It is near impossible to keep security to a maximum everywhere you go, so why even try? Actually, wouldn’t it be better to avoid the need of having security at all?

How many of the 20 to 30 accounts are actually important to keep safe? I tried making a list and I would say I only have one, my “NemID” account which gives access to banking accounts and services by the government.

So what makes an account important? The importance of an account is equal to the loss you experience when it is hijacked. Based on this I make three categories of web-accounts:

  • Sites dealing with money (banks, stores, casino)
  • Personal content (personal websites, blogs, YouTube)
  • Social networking (Facebook, chats, forums)

Minimizing loss

Instead of just accepting how important an account is it is much better to actively make it less important, in order words, minimizing the loss in the worst case scenario.

With sites dealing with money, to the greatest amount as possible, make sure they are only dealing with an account which can’t be overdrawn and only have a small amount of money in that account at a given time.

If the site contains personal content like WordPress, YouTube, and deviantART, always keep a local backup so you can create a new account and restore the content. You might lose ratings and similar it is still the content which is important.

My plan

Important accounts will have a strong password and is changed every 3 months. (Actually, the only account in this category is my bank account.) Passwords will be automatically generated.

Semi-important accounts like my WordPress and SourceForge accounts will have a single medium-strong password which will rarely be changed. Backups will be taken of personal content. The password will most be an obfuscated passphrase which is easy to write.

Unimportant accounts (which are about 75%) will just use the old password.

 

Tags: ,


Oct 12 2011

MainWindow vs. Editor

Category: Lego,Mindstorms,RICcreator,SoftwareSpiller @ 21:24

RICcreator is a MDI application which is implemented by using tabs. Because tabs are used, only one document is viewed at a time.

Up to this point it was implemented using QTabWidget which provides tabs and a area on each tab to place widgets in. Using this, a editor (ricfile_widget) was created on each tab which each owned a ricfile.

When a user clicked on an action in the menus or toolbars, this action had to be routed to the editor currently shown. Since there are about 10-15 commands which deals with the ricfile, 10-15 wrapper functions had to exist in the MainWindow with 10-15 actual implantations in the editor. There were mainly two types of actions, open/save/export actions and actions which added a specific object.

The open/save/export actions are useful no matter which editor you are currently using, while the “add polygon” action is pretty useless when using an editor for modifying RIC fonts. (Not implemented) The goal was therefore to keep the implementations for open/save/export in MainWindow while removing all the other actions from MainWindow and keeping them strictly in ricfile_widget.

Design

Instead of having the QTabWidget manage the editor for us, we make MainWindow keep track of it instead. Secondly we change the ownership of ricfiles to the MainWindow. To do this we make a class which keep track of a ricfile which contains the information needed. The class (openRicfile) contains the following information:

  • The ricfile
  •  The file source, was this created in the program, loaded from the HDD or downloaded from the NXT?
  • The ricfile editor which is used to edit this file.
  • The name of the file
  • The file edit state, has the file been changed since it was loaded?

Since MainWindow now owns the ricfile and the required information about it to save/export the file, the actions can now be directly implemented here.

To make it possible to create different editors, we create an interface between the MainWindow and editor. As open/save/export is now done by MainWindow and that every other command was editor specific the interface must not contain any of these. To still be able to have editor specific commands in MainWindow we allow the editor to create a Toolbar which the MainWindow will shown.

In return we add a requiriment to the editor, it must be able to change the active ricfile. The interface (ricfileEditor) have the following properties:

  • Change the ricfile to be edited by specifying a openRicfile.
  • Request a toolbar to be shown
  • Signal which tells MainWindow when openRicfile as been edited.

Implementation

Instead of using a QTabWidget, a QTabBar is used instead. QTabBar only shows the tabs, it does not create a space to hold widgets. However we get slightly more control over the tabs appearance. But now that an editor can change file, we only need one for each type and therefore not a separate space.

In openRicfile we therefore only save the editor type for each file. So openRicfile instead keeps an list of implemented editors. When we request a editor, it will return the editor specified by the openRicfile. (Editors will only be created on request to preserve resources.) But since there is only one editor, we will need to store information about how the file was viewed in the editor, as this is lost when changing file. I still need to implement this, but it will just be an extra field in openRicfile containing the required information.

All the “Add [object]” actions have been implemented as a Toolbar in ricfile_widget, so MainWindow is now completely free of them, it just changes the shown toolbar whenever a new editor is to be shown.

Results

MainWindow and ricfile_widget is now much cleaner implemented as it doesn’t contain functions which is half implemented in MainWindow and half implemented in ricfile_widget.

Secondly it is now possible add new editors quite easily and there is an way of adding actions to be shown in the MainWindow.

A side effect is that memory use has dropped greatly. ricfile_widget used about 600KB of RAM, so after opening 10 files you had doubled the memory use of the program. Now it only increases with a few KB for each file. (This is an empty file however, haven’t quite tested it with large files, but it shouldn’t be too much nevertheless.)

Another side effect is that since QTabBar is now used, it is possible to specify the text color of each tab individually. So a file which have been edited and not saved yet is highlighted by changing the color to red and adding an asterisk to the end:

Download

RICcreator rev. 133 – win32


Oct 06 2011

Customizing my Windows computer – part 2

Category: SoftwareSpiller @ 05:46

More customization to be done, still far from the goal. Just minor tweaks this time.

Fix disappeared Explorer jump list

Not quite a customization, but I will include it here never the less. As you perhaps have spotted in the last post, I do not have either “Recent” or “Pinned” entries in my Explorer jump list. This is caused by a bug in win7 which has been known since the beta days, yet it still appears to be unfixed.

The reason appears to be that the file containing the jump list entries have been corrupted. You can find the files here: (You must enter the path, you can’t navigate to the folder!)

%AppData%MicrosoftWindowsRecentAutomaticDestinations

The file containing the Explorer jump list is “1b4dd67f29cb1962.automaticDestinations-ms”, just delete it to get it working again. However if you experience this issue with another application, simply delete all entries (to the Recycle Bin) and pin a entry to that application. The file that now appears is the jump list for that application. Simply press CTRL+Z to undo the previous delete and select “Don’t move” when it attempts to undelete the broken file.

Change locations of user folders

You can move your “My Documents” folder by right-clicking it and clicking “Properties”. Click “Move…” under the “Location” tab. (It will ask whether you want to move the current contents to the new location.) You can do this for most of the folders in %USERPROFILE%, for example your Desktop.

I use a separate HDD partion (D:) for all my data so I can easily format the system drive and reinstall Windows without loosing anything important. Since applications sometimes save user data or other strange stuff in those automatically, I moved them all to “D:userconfWindows”. It will make a reinstall a little bit easier.

I also started to stop using “My Documents”, “My Music” and “My Videos” completely. The “My Documents” folder in particular is misused by many applications so all kinds of weird stuff ends up here, removing my attention from what I’m actually trying to store in those folders.

Modify the Start menu

As more and more entries get into the start menu, it gets increasingly harder to find the programs you want. You can edit it by changing the contents this the following two folders:

%APPDATA%MicrosoftWindowsStart Menu
%PROGRAMDATA%MicrosoftWindowsStart Menu

The first folder is for your user, the second is for all users. The entries in the first will automatically be merged together with the second.

Notice that if you start editing these folders, then the shortcuts will not be automatically deleted when you uninstall the application since the paths have changed.


Notice that I prefix folders which contains several applications with “#”, this makes them stand on the top of the list. (You can’t do this on top-level folders of some reason though, it will not merge the user and all user folder correctly.) To make the folders which contains several applications stand out I the icon (the method is explained in the last section). Also note that I have the “HxD” program listed twice, an easy to reach shortcut at the top and a folder containing the uninstaller and more.

You can also change the paths of these two Start Menu folders by doing the same as explained in the previous section. I have moved all normal shortcuts into the all-user folder and I moved the user folder to “D:userconfWindows”. In this folder I placed links to all the portable applications I have on my D: drive, so these will survive after a reinstall. (It requires that the drive letter remains the same though.)

Extending Aero Snap

EDIT: multi-monitor support was removed from the free version and I found a better alternative, WinSplit Revolution. I find this one better and it is completely free, so check out that one instead. EDIT END

Aero Snap doesn’t work very well when using multiple monitors and it doesn’t give you as many possibilities as similar solutions in Linux. Luckily there are a few tools out there to replace it. I tried two and settled on AqauSnap.

AqauSnap only supports simple grid operations, like right-upper corner, but I do not need more than that anyway. Multi-monitor support and with a bit of tweaking okay graphics. Hotkeys are implemented, however it doesn’t work well across monitors. Furthermore you can’t undock a maximized window with the mouse.

All in all, it works better than Aero Snap, but there is still room for improvement. You can download it from the authors homepage or read more about it here.

Disabling the desktop

The desktop easily ends up being cluttered because you trow all kinds of random stuff into it. Most of the time it is just stuff I just dump there because I’m too lazy to properly navigate to the folder it should have been in. So I will try force myself do it properly from the start.

Hiding the icons is easy, just right-click on the desktop and uncheck “View->Show desktop icons”. (You should pin the Recycle Bin to Explorer first though.)

This doesn’t prevent you from saving stuff here, it just hides it. However you can change the permissions for the Desktop folder and disallow Write operations. To do this, right-click on your Desktop folder (located in %USERPROFILE%) and click “Properties”. Under the “Security” tab, click “Edit…”. In this window, check the “Deny” box for “Write” for the users you want to restrict.

If you restricted the right users it should now give you an error message if you try to save/move anything to the desktop. I fear it might annoy some installers which want to create shortcuts on the desktop, but I don’t think it will be a major issue.

Using folder icons

Using visual clues to locate a folder instead of relying on reading the text makes it much easier to find. If you have a fitting .ico file, changing the icon is painless.

Right-click the folder and click “Properties”. Under the “Customize” tab, click “Change Icon…” at the bottom. Click “Browse…” to select the .ico file you want to use. (The list is used in case you select a .dll or .exe which contains multiple icons.)

If the folder icon does not update, try pressing F5 a couple of times. To get most out of folder icons, only apply them to your most used folders as it makes them stand out more.

 

Tags: , , , , , , , ,