Sadly it was not good will of Dropbox that is dictated this change. It's reported that Apple closed breach in security, so Dropbox hack is just impossible on macOS Sierra.
C# Blog - Tips and Tricks
All About .NET, C# Tips and Tricks, Articles, Sample Code.
Sep 21, 2016
Dropbox make it right
Sep 9, 2016
Dropbox highjacked your Mac security
If you're using Dropbox on Mac OS you might be surprised that Dropbox has permission to control your computer, even it's never asking permission for doing so. Even if you uncheck or remove Dropbox from Accessibility list it will reappear on next log in to computer or next start of Dropbox app. There is good articles at applehelpwritter.com on what is exact issue revealing Dropbox’s dirty little security hack and on how Dropbox do that discovering how Dropbox hacks your mac.
As for me, I'll show you how to prevent of Dropbox to highjacking Mac OS security. What we need is to remove access to execute exploit and prevent Dropbox to revert that changes.
1. Open Terminal app. Change current directory to Dropbox exploit dir. Dropbox version might be different on your computer, just choose latest if there is more than one.
cd /Library/DropboxHelperTools/Dropbox_u502
Remove executable and set-user-id bits from exploit binary. System will prompt you for admin password.
sudo chmod -sx dbaccessperm
Lock changes for exploit binary.
sudo chflags uchg dbaccessperm
2. Now uncheck permission for Dropbox in System Preferences - Security & Privacy - Privacy. You will need to Click the lock at left bottom to make changes on this page. That's it. Permissions for Dropbox will not reappear after Mac restart. Most important, there is no dialogs on every OS reboot.
You might think that more easy to just remove exploit binary but this not the case, if binary removed, Dropbox will recreate it on next start and override permissions.
If you not sure will Dropbox correctly work without controlling your computer, there is explanation why accessibility used by Dropbox app - "We use accessibility APIs for the Dropbox badge (Office integrations) and other integrations (finding windows & other UI interactions)." link. Personally I'm not using office integration and not see any problem in Dropbox functionality since I've disabled accessibility access for Dropbox.
Oct 17, 2011
Binding to Image Path in Isolated Storage
Bind Image Source to web address is not problem, it will works well... until You don't care about performance. Problem will appear if You want to cache images. Isolated storage is only way to store downloaded files in Silverlight not matter Browser or Windows Phone. Not so difficult to download image file from Internet and save to Isolated Storage, but how to use it in Silverlight Page?
Well, lets try to figure out. First define image converter:
- public class IsoImageConverter : IValueConverter
- {
- //Convert Data to Image when Loading Data
- public object Convert(object value, Type targetType, object parameter,
- System.Globalization.CultureInfo culture)
- {
- var bitmap = new BitmapImage();
- try
- {
- var path = (string)value;
- if (!String.IsNullOrEmpty(path))
- {
- using (var file = LoadFile(path))
- {
- bitmap.SetSource(file);
- }
- }
- }
- catch
- {
- }
- return bitmap;
- }
- private Stream LoadFile(string file)
- {
- using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
- {
- return isoStore.OpenFile(file, FileMode.Open, FileAccess.Read);
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter,
- System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
Next define link in App.xaml for use in XAML code
- <local:IsoImageConverter x:Key="IsoImageCoverter"/>
And finally bind to string path to Isolated Storage image file
- <Image Source="{Binding ImagePath, Converter={StaticResource IsoImageCoverter}}"/>
Sep 28, 2011
Localize ToggleSwitch in Silverlight Toolkit
First add Localized Resource for our new On and Off string values:
Next step create ValueConverter:
- public class BoolToSwitchConverter : IValueConverter
- {
- private string FalseValue = Resources.Off;
- private string TrueValue = Resources.On;
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value == null)
- return FalseValue;
- else
- return ("On".Equals(value)) ? TrueValue : FalseValue;
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return value != null ? value.Equals(TrueValue) : false;
- }
- }
- <Application.Resources>
- <local:BoolToSwitchConverter x:Key="Switch" />
- </Application.Resources>
- <toolkit:ToggleSwitch x:Name="MySwitch" Header="Localized Switch">
- <toolkit:ToggleSwitch.ContentTemplate>
- <DataTemplate>
- <ContentControl HorizontalAlignment="Left"
- Content="{Binding Converter={StaticResource Switch}}"/>
- </DataTemplate>
- </toolkit:ToggleSwitch.ContentTemplate>
- </toolkit:ToggleSwitch>
Sep 26, 2011
Localize Windows Phone 7 Styles
Why cannot use same approach for Windows Phone application? There is many reasons:
- Windows Phone don't support satellite assemblies.
- Windows Phone don't care about xml:lang
- MergedDictionary degrade preformance
- <Button x:Name="MyStyledButton" Content="Button" Style="{StaticResource MyButton}"/>
- <Style x:Key="MyButton" TargetType="Button">
- <Setter Property="Background" Value="#303030"></Setter>
- <Setter Property="BorderThickness" Value="0"></Setter>
- </Style>
- <Style x:Key="MyButton-ru" TargetType="Button">
- <Setter Property="Background" Value="#FF8080"></Setter>
- <Setter Property="BorderThickness" Value="1"></Setter>
- </Style>
- string lang = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
- // load localized style
- Style style = (Style)App.Current.Resources["MyButton-" + lang];
- if (style != null)
- {
- MyButton.Style = style;
- }
Sep 6, 2011
Load Image at Background Thread in Silverlight WP7
Usually when you try to use BitmapImage, Image, WriteableImage in other than UI thread, you'll get exception. This is because these classes are derived from System.Windows.Threading.DispatcherObject, which is blocked access from other than UI thread. There exists an extension to WriteableBitmap, LoadJpeg, which is works fine in thread, but you have to create WriteableBitmap object on main UI thread.
- using System.Windows;
- using System.Windows.Media.Imaging;
- using System.IO;
- using System.Threading;
- namespace ImageHelpers
- {
- public delegate void ImageLoadedDelegate(WriteableBitmap wb, object argument);
- public class ImageThread
- {
- public event ImageLoadedDelegate ImageLoaded;
- public ImageThread()
- {
- }
- public void LoadThumbAsync(Stream src, WriteableBitmap bmp, object argument)
- {
- ThreadPool.QueueUserWorkItem(callback =>
- {
- bmp.LoadJpeg(src);
- src.Dispose();
- if (ImageLoaded != null)
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- ImageLoaded(bmp, argument);
- });
- }
- });
- }
- }
- }
Using scenario:
- ImageThread imageThread = new ImageThread();
- private void Init()
- {
- imageThread.ImageLoaded += LoadFinished;
- }
- void LoadFinished(WriteableBitmap bmp, object arg)
- {
- Imgage1.Source = bmp;
- }
- void DeferImageLoading( Stream imgStream )
- {
- // we have to give size
- var bmp = new WriteableBitmap(80, 80);
- imageThread.LoadThumbAsync(imgStream, bmp, this);
- }
Aug 25, 2011
Using WP7 Profiler
Open Your WP7 project and look into Debug menu. You will see disabled (probably not) menu item Start Windows Phone Performance Analysis
When application targeted Mango You can open profiler. Choose options and click hyperlink Launch Application.
After working with application click Stop Profiling. After analysis You will see profiling results. Select timeline and it shows details.
Update: Finally found MSDN Page, describing WP7 Profiler