Here's the way I use my web browsers. I pin google calendar and gmail. But I don't ever want to close them or navigate away. Tab Mix Plus is great for this, for firefox, but it's a bit of a hog. Firefox also has the setting to always open typed URLs in a new window, which would really solve all the problems for me, but I'm currently migrating to Chrome, and Chrome doesn't have the option. I was looking into writing my own extension to do that, but I really didn't want to go down that rabbit hole. First I'd have to learn it. Plus, I wasn't really sure it was feasible. For my usage, which is two pinned tabs, I had a better idea. It's not ideal, but I made a bookmarklet that will "lock" page . I think this only really works because of how google's apps navigate within their own window, but it works for my use case.
Lock Page
Tuesday, March 3, 2015
Thursday, December 4, 2014
WRITE_SECURE_SETTINGS on kitkat 4.4
I recently updated my android to a Kitkat rom, and to my dismay, my car dock app, Car Dock Home v3 no longer turned on my GPS. It only brought up the location settings page, and also didn't turn it off when undocking. Apparently this is by design (see below). Now that author has a separate app that manages car dock settings, but I think he baked most features from that into the dock app. ,From the settings app page:
Check GPS Enabled – If the GPS is not enabled upon docking, try to enable it in the secure settings, if that doesn’t work, show the user the Location & Security settings screen.I thought at first secure settings meant the Xposed module, but no it means the way android firmware apps (i.e. system apps) do it which is to use the permission WRITE_SECURE_SETTINGS and do something in the API (I didn't look in to how). The point is that non-system apps can't acquire this permission. So the app should have worked fine if I made it a system app. I never even noticed this becuase
There is also a known exploit to enable GPS using the back end of the power controls widget. I’ve taken advantage of that in the latest releases of this app. It will eventually fail when Google patches it up. The above ‘system app’ technique should still work in that event.So I guess this was patched, but alas, moving it to the /system/app didn't help. The solution was to put it in the new poorly documented /system/priv_app folder. Apparently, apps that previously needed to be converted to system apps to get some permission, now need to be in that folder.
Hopefully this helps someone else get a previously working app functioning.
Friday, March 8, 2013
Outlook to Ical and google
So I'm trying to make it so that my wife can see my calendar which I use at work. This was more difficult then I thought. Biggest problem was the work computer. Second was Microsoft and/or Google's messed up ical implementations. The automated publish options didn't work for me because i couldn't do the whole calendar, and publishing to CalDav didn't work, probably because of the proxy firewall. I could publish to Office but then you can only really see it with Outlook, and I wanted to use google.
Ok so as far as problems normal people might have, they involve the ical file. For extra joy, Google doesn't tell you what the problem is. Since I only got it to work once the this validator passed my file, I assume Google also uses ical4j. Microsoft's main problem was that when publishing events with a timezone, my timezone didn't have a label (e.g. GMT, EST EDT). Even after giving it one in settings it wouldn't export the timezone with an TZID identifier. It just said "TZID:". Interestingly this didn't cause the error, it was when the parser tried to read a time stamp that looked like "TZID=:20130101000000" (rather than "TZID=timezone:2013..."). Having no characters between the = and : caused the parser to pick up a null rather than an empty string, so I didn't even get friendly error messages to help me figure this out. The other problem is how Microsoft wraps long lines. ical files have to be a certain line width. lines are terminated with CRLF and then the next line starts with one space or a tab. MS uses tabs. Both the validator and google didn't like this, but AFAIK MS is correct in doing that. Running the file through simple search and replaces fixed these problems.
The next big question was where to put this file. My work computer is locked down and the proxy blocks most file storage sites. Windows 7 doesn't come with Web Folders. These can refer to the WebDAV folders or the frontpoint server extension version. Comcast which I used to use, uses only FPSE web folders. FTP upload was blocked (mostly, more on that later). Because of this I'd been using MS SkyDrive for online files. But both that and Google Drive don't give you direct dl links, so GCal wouldn't be able to parse it.
Icalx.com looked promising, I think I got a simple HTTP PUT to upload the file a couple of times with a firefox extension. But doing it from my own program was another story. I have a lot of trouble automating the web through my work proxy. The only way I usually have success is to use the IE browser itself through MS Internet Controls (SHDocVw and ieframe.dll). Especially when I need to authenticate site and the proxy, I just can't do it. WinHTTP, MSXML, WebRequest, it just never works, especially if it's anything other than a GET. So FTP is blocked from uploading, but on Windows firewall. So if the program has access already, you can do it. ftp.exe... blocked, the only thing that had access was IE. And the only way I could figure out how to upload was with the FTP Explorer view. After trying Scripting.FileSystemObject, I realized there was another COM library, shell32, Shell Automation. Most of the documentation for this is about using the shell to zip and unzip files, but you can use for http also. There are a few quirks. The best of which is that none of the flags for CopyHere work. Which means no overwriting files, no hiding progress bars. And CopyHere is asyncronous but with no way to get progress or block. Now windows firewall only blocks some ftp commands. So I could use FTPWebRequest to delete the file, without authentication problems, and also use it to check the modification date on the file to see when the upload was done.
Not very pretty or efficient, but it finally works. Hopefully she looks at it.
See what I did
Ok so as far as problems normal people might have, they involve the ical file. For extra joy, Google doesn't tell you what the problem is. Since I only got it to work once the this validator passed my file, I assume Google also uses ical4j. Microsoft's main problem was that when publishing events with a timezone, my timezone didn't have a label (e.g. GMT, EST EDT). Even after giving it one in settings it wouldn't export the timezone with an TZID identifier. It just said "TZID:". Interestingly this didn't cause the error, it was when the parser tried to read a time stamp that looked like "TZID=:20130101000000" (rather than "TZID=timezone:2013..."). Having no characters between the = and : caused the parser to pick up a null rather than an empty string, so I didn't even get friendly error messages to help me figure this out. The other problem is how Microsoft wraps long lines. ical files have to be a certain line width. lines are terminated with CRLF and then the next line starts with one space or a tab. MS uses tabs. Both the validator and google didn't like this, but AFAIK MS is correct in doing that. Running the file through simple search and replaces fixed these problems.
The next big question was where to put this file. My work computer is locked down and the proxy blocks most file storage sites. Windows 7 doesn't come with Web Folders. These can refer to the WebDAV folders or the frontpoint server extension version. Comcast which I used to use, uses only FPSE web folders. FTP upload was blocked (mostly, more on that later). Because of this I'd been using MS SkyDrive for online files. But both that and Google Drive don't give you direct dl links, so GCal wouldn't be able to parse it.
Icalx.com looked promising, I think I got a simple HTTP PUT to upload the file a couple of times with a firefox extension. But doing it from my own program was another story. I have a lot of trouble automating the web through my work proxy. The only way I usually have success is to use the IE browser itself through MS Internet Controls (SHDocVw and ieframe.dll). Especially when I need to authenticate site and the proxy, I just can't do it. WinHTTP, MSXML, WebRequest, it just never works, especially if it's anything other than a GET. So FTP is blocked from uploading, but on Windows firewall. So if the program has access already, you can do it. ftp.exe... blocked, the only thing that had access was IE. And the only way I could figure out how to upload was with the FTP Explorer view. After trying Scripting.FileSystemObject, I realized there was another COM library, shell32, Shell Automation. Most of the documentation for this is about using the shell to zip and unzip files, but you can use for http also. There are a few quirks. The best of which is that none of the flags for CopyHere work. Which means no overwriting files, no hiding progress bars. And CopyHere is asyncronous but with no way to get progress or block. Now windows firewall only blocks some ftp commands. So I could use FTPWebRequest to delete the file, without authentication problems, and also use it to check the modification date on the file to see when the upload was done.
Not very pretty or efficient, but it finally works. Hopefully she looks at it.
See what I did
Thursday, March 7, 2013
Simple way to save Password in a settings file.
/// <summary>
/// Description of Settings.
/// </summary>
public class Settings:ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
public Settings():base()
{
}
[UserScopedSettingAttribute()]
[DefaultSettingValueAttribute("false")]
public bool PASS_SET {
get { return (bool)this["PASS_SET"]; }
private set { this["PASS_SET"] = value; }
}
[UserScopedSettingAttribute()]
[DefaultSettingValueAttribute("")]
/// <summary>
/// <returns> null if !PASS_SET</returns>
/// </summary>
public string Password {
get {
return (PASS_SET)?ToInsecureString(DecryptString(this["Password"].ToString())):null;}
set { this["Password"] = EncryptString(ToSecureString(value)); PASS_SET=true; }
}
static byte[] entropy = System.Text.Encoding.Unicode.GetBytes("Bumblebee Tuna, I can see your balls!");
public static string EncryptString(System.Security.SecureString input)
{
byte[] encryptedData = System.Security.Cryptography.ProtectedData.Protect(
System.Text.Encoding.Unicode.GetBytes(ToInsecureString(input)),
entropy,
System.Security.Cryptography.DataProtectionScope.CurrentUser);
return Convert.ToBase64String(encryptedData);
}
public static SecureString DecryptString(string encryptedData)
{
try
{
byte[] decryptedData = System.Security.Cryptography.ProtectedData.Unprotect(
Convert.FromBase64String(encryptedData),
entropy,
System.Security.Cryptography.DataProtectionScope.CurrentUser);
return ToSecureString(System.Text.Encoding.Unicode.GetString(decryptedData));
}
catch
{
return new SecureString();
}
}
public static SecureString ToSecureString(string input)
{
SecureString secure = new SecureString();
foreach (char c in input)
{
secure.AppendChar(c);
}
secure.MakeReadOnly();
return secure;
}
public static string ToInsecureString(SecureString input)
{
string returnValue = string.Empty;
IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(input);
try
{
returnValue = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(ptr);
}
finally
{
System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(ptr);
}
return returnValue;
}
}
Monday, October 8, 2012
OAuth in VB6 or VBA
Things I know.. how to do Oauth in VB6 or VBA so I hopefully can import fantasy data into excel. link to project Should work for yahoo, OAuth, looks like it works for netflix also.
Subscribe to:
Posts (Atom)