Moq Setup and ignore all arguments

I’m a happy fan of Moq. However, it’s sometimes annoying when the parameters do not matter, such as:

mock
    .Setup(x => x.Method(It.IsAny<Type>(), It.IsAny<AnotherType>(), It.IsAny<YetAnotherType>())
    .Return(value);

So I’ve made an extension method so that the parameters will be ignored, so you can write:

mock
    .SetupIgnoreArgs(x => x.Method(null, null, null)
    .Return(value);

The code is available at Gist.

Advertisements

7Pass idea: destruct password

I have an idea for 7Pass that I need to put it here so I won’t forget: destruct password. Remember the UK police detained Glenn Greenward and forced him to provide them his passwords? That’s just ridiculous, yet the UK court even later decided that it’s legal for the UK police to do so.  This is a clear violation of human rights, but let’s not talk about politics here.

I’d want 7Pass to have a feature to allow user to enter a password that will destroy all databases already registered in 7Pass. The idea is simple: have a special password that if entered by user, 7Pass just pretend that it’s mad and delete the database plus any other preferences, cache, etc… everything. In order for this to not be suspicious, 7Pass certainly will have to have the feature after if user enters a password wrong, let’s say 5 times repeatedly, the database will be removed from the app. The destruct password (configured by user) will simply make 7Pass shows “wrong password too many time, database deleted” immediately. You can always blame the UK police for playing with your phone.

I’m not sure about the capability of file picking in Windows Phone 8.1, but I’d want 7Pass to first overwrite the local cache with random data first, before deleting it, to ensure no recovery attempt is possible, and, if possible, send a file with random data to the source of the database file, to ensure and 3rd party app, or your phone, or the SD card that provided 7Pass with the original database file will also overwrite it with the random data, effectively destroy every possible source for recovery of your passwords.

If my KeePass database is destroyed, I’ll lose almost everything as I never remember any password. KeePass generates my passwords, and you should be that “forgetful” too; otherwise, you’re not using KeePass to its usefulness. UK police can then hack into my brain and not able to find anything, because they toyed with my phone, damn it, don’t touch it.

Development progress – Database modification

Hi all,

I’ve had some time this week, partially feeling very exciting about the Mango update.

So far, I’ve managed to implement:

  • Pinning of databases to the start page. It works well on the emulator (target: Mango).
  • Made use of backtrack modification provided in Mango to improve the “Back to Root” & “Back to Databases” navigation.
    This change also allowed me to use transitions for some eye candy (target: Mango).
  • Improved the web navigation for the Detected Links page when you download database from a web server.
Last but not least: database modification.
The database could be quite big for a phone to handle, so I tried to avoid loading the whole database file in memory to make modifications. That, however, proved too complicated to do. Making modifications using forward only XML navigation is really painful.
So, in the end, I think it’s acceptable to be a little bit slow when saving changes to the database. This allowed much simpler code and allow much more flexible data processing.
With my current code (pushed to GitHub), I was able to make changes to the entries and groups (change details, move, create new – not all exposed via UI) and save this changes to a file.
I’ll still need to make sure the same progress is safe, meaning backing up the original database, write the new database and then recover if there’s something wrong during the writing.
Next will be implementing DropBox uploading and WebDAV uploading.
Regarding copy/paste support, as soon as I don’t have to make textboxes read only, copy/paste is simple. The whole textbox will be selected when you tap on it, so that you can either copy the content, or paste your clipboard on it. I’ve tried selecting the whole textbox when it’s readonly, but that caused some nasty bugs that I found no workaround. So please excuse me for not keeping the promise of adding copy/paste support when the OS does.
On a side note, I’ve managed to perform some FTP support, which looks good so far, but since Mango will not be released to consumers yet in the short term, this task is having lower priority.
Until next update, Van.

Database open error

I’ve received repeated issues with 7Pass not able to open the database.

The error descriptions:

  • System.IO.IsolatedStorage.IsolatedStorageException
    Operation not permitted on IsolatedStorageFileStream.
  • System.ArgumentNullException
    Value can not be null.
    Parameter name: entry
(You can see this description with more details if you allow 7Pass to prepare an email, which you can send to me or just to take a look).
I was not able to reproduce this issue, and have added safe guards for this errors through out updates of 7Pass. The problem is, I don’t really know what caused these issues. I certainly cannot ask the user for the database. Trying with a new database works, so I’m not sure why.
I’d love to find out this issue, so please leave a comment if you have these errors:
  1. Does it occurs consistently with your database, meaning you simply cannot open your database at all? Or it only occur once in a while?
  2. Did you interrupt 7Pass while it’s processing your database?
    Ex: You taped on open, and then while 7Pass is processing, you tap home/back.
  3. Did you set any customization of the encryption/compression of the database?
    Some users reported that he uses a 1 second delay key transformation, which produces a number of key transformation rounds that takes the phone much longer to perform compared to your PC.
  4. Can you open the same database with KeePass on Windows? Please make sure it’s the same file, by downloading from the same source and open it. I guess database corruption is very rare, but I just want to be sure.
  5. Can you please try to create a new database with dummy entries, with the same settings as your database. Please then try to open that database with 7Pass. If the error occurs with this new database, please send it to me (the dummy database, not your database) including the password. This will be very helpful as it will potentially allow me to reproduce the issue.

Hi to PocketPC members

My blog have received frequent visits from this thread from PocketPC. Unfortunately, I cannot speak German so I could not sign up for the forums. Chrome was able to machine translate the page though, so I hope that someone will notice this post and have their questions answered here.

How do I update my database? Removing it and add again through DropBox is such a pain.

You don’t have to type in your database again every time. Whenever your database has changed, no matter it was downloaded from DropBox or your Web server, you can tap and hold on the database, just like how you delete it, and click on update. 7Pass will display a progress bar of the updating progress, and display a download icon when the database is updated. Of course, if the update failed, 7Pass will notify you that the update was not successful, and your database was not updated. When the update fails, the current database is not affected so you can still use your database as normal and update at later time.

How 7Pass update my database?

DropBox

When you download your database from DropBox, 7Pass stores the following information about your database:

  • Your authentication: token and secret key, just as DropBox team suggest. You’ll see 7Pass in My Apps tab of your DropBox’s Account Settings. If you revoke this access, databases already added to 7Pass cannot be updated anymore.
    7Pass will use this token and secret key to authenticate with DropBox. This is not your email and password, so changing your email/password doesn’t affect 7Pass’ authentication.
  • The path of your database: 7Pass will use this path to download your database for an updated version. If you’ve moved your database, you’ll have to add it again so that 7Pass will know the new location to download/update your database.

Web server

When you add a new database from your web server, 7Pass stores the following information:

  • URL of the database: 7Pass will use this URL to download/update the database. If the url has changed, you’ll have to add the database again so that 7Pass will know where to download/update the database.
  • Authentication information: 7Pass will use these information (user, password & domain) to authenticate against your web server. If any of this information has changed, you’ll have to add your database again.

For key file, the download is one time only, since you don’t often update your key file. Updates to the database will not update your keyfile. If you’ve changed your keyfile, please download it again. You don’t have to clear the keyfile before downloading the new keyfile.

So the idea of 7Pass databases handling is that you add the database once, and then the updating will be very simple: tap & hold, then tap on update. That’s all you need to do.

Is there any difference between trial and paid version of 7Pass?

There are some difference between trial and paid version for 7Pass:

  • Trial notification: if you’re using trial version of 7Pass, 7Pass will display a trial notification to let you know that you’re using the trial version. Every time 7Pass is activated/launched, it will display the notification after 3 seconds, for 10 seconds and then disappear. This notification doesn’t prevent you from using 7Pass, nor does it requires any action from you. You can use 7Pass trial forever (just like I do, yes, I use trial version too, to make sure that 7Pass doesn’t piss off trial users, and also to monitor MarketPlace updates). If you tap on the notificationm you’ll be taken to the purchase page, where you can pay $.99 for the app to let me know that 7Pass doesn’t suck.
  • Demo database source: in trial version, Demo database is displayed as one of the 3 database sources: DropBox, Web Server and Demo Database. For paid version, since the user doesn’t need to evaluate 7Pass anymore, the Demo Database is moved to the application menu bar, which can be shown by tapping on the “…” at the bottom right corner of the page.

The functional of 7Pass is exactly the same between paid and trial version, even bugs. If a trial version has a bug, the paid version have too. Basically, you pay for the app because it doesn’t suck. If it suck, let me know as comments to this blog is not censored or require approval to be displayed. If you’d want to give 7Pass one star rating, let me know first an your issue will be solved much faster than rating it low, as I cannot response to ratings on MartketPlace.

I’d also thank zehlein for introducing 7Pass to others. I hope that 7Pass was useful to him enough that he’ll share it with others.

Hi from Vietnam

Hi all 7Pass users. As I may have noticed, 7Pass 2.2 is now available in the MarketPlace. Kudo to the MarketPlace testing team for approving 7Pass within one single day. Maybe 7Pass gets some special attention, or at least I dreamed so.

Today, I’d want to share to you how I detect issues with 7Pass: via this blog’s searched queries. From example, just some days ago, “7pass will not login to dropbox” suddenly appeared in the searched queries. I immediately investigate the issue, but did not find any problem. Curiously, I tried with my second DropBox account, which I’ve never used with 7Pass, and voilà, 7Pass cannot log in. It seems that DropBox now requires the authentication type to be specified even when there’s no authentication for that request (we’re logging in, right?). All this happens even before the first comment comes. The fix was quite simple and DropBox integration is working just right now.

Another interesting stats: 7Pass 2.2 entry was viewed 200+ times in the same day it was published. 200 may not be a big number, but since 7Pass has only 236 downloads so far, I’m happy that I was able to keep my customers updated. Happy customers are the best thing for every project isn’t it.

I’m now enjoying my 2 weeks leave for the Tết holiday (Vietnam’s Lunar New Year celebration). Please excuse my progress on 7Pass as I will not have access to development machine during this time. I’ll update on this blog if there’s any issue reported.

Ideas for trial expire notification needed

7Pass is available on MartketPlace for a small fee of $0.99 and is also available as a trial.

In version 1.3, 7Pass will start to show notification screen after 50 usages when user view any entry:

image

When user updates his database, the count started again at 1.

Clearly, this notification is annoying. I wanted to let user know that he can buy the app to support the author, not for the author’s income. I work fulltime as a desktop developer and extremely happy with my job. I develop 7Pass for my love for KeePass, not for financial reason.

I’d want 7Pass to have a better way to tell the user that he can support me, but in a way that doesn’t prevent him from using 7Pass, something very gentle. I have some ideas in mind:

  • Something like the notification when you receive an SMS, which can be clicked on to allow user to buy 7Pass.
  • Keep the notification, but then resets the count to 1 again, repeating the cycle.
  • A small link at the bottom of the Entry page to allow user to buy 7Pass.

After DropBox support, I’ll add support for multiple database, so the idea of counting based on database/application usage will have to be considered.

Please give me advise how to do this.