Alexander Anikin's blog

My personal blog

Мошенники на Avito

with 2 comments

Может кому поможет…

Собрался я тут фотик продать. Подал объявление на AVITO.ru.

Пришло письмо от некоего гражданина Нигерии- “micheal pavil” < michea.pavil2014@yandex.com >  с текстом:

Hello thank you for the quick response, … I’m actually buying it for my Son …. and it is unfortunate that I’m not there to pick it up …I’m at sea right now … I work as an Oceanographer … so I do not have time to send something to my Son, that’s why I do this online shopping …. please let me know your payment method .. I can easily do business with PayPal or Bank transfer .. i will pay for the article $ 300 and $ 130 for shipping EMS …… hope you accept my offer…hope to read back from you soon
Даже адрес есть:

Name: James Wale
Address: No 5 Dugbe
City: Ibadan
Zip Code: 23402
State: Oyo State
Country:Nigeria

Навестить бы гордого африканского “морячка”… Люлей бы за такое не мешало…

Вот тут уже кто-то попадался…. Все один-в-один…

В общем, схема проста – типа получаете деньги в обмен на квитанцию об отправке EMS. Но там все польностью – липа.

Будьте аккуратнее!

 

 

Advertisements

Written by Alex Anikin

February 20, 2014 at 7:57 pm

Install bunch of DLL files to Windows Server 2012 GAC

leave a comment »

Thanks to http://devlicio.us/blogs/christopher_bennage/archive/2010/08/25/powershell-gac-and-build-servers.aspx

1. Create ps1 script with contents:

if ( $null -eq ([AppDomain]::CurrentDomain.GetAssemblies() |? { $_.FullName -eq “System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” }) ) {

[System.Reflection.Assembly]::Load(“System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”) | Out-Null
}

$publish = New-Object System.EnterpriseServices.Internal.Publish

Foreach ($file in Get-Childitem “*.dll” -recurse -force)
{
Write-Host $file

$assembly = $null

if ( $file -is [string] ) {
$assembly = $file
} elseif ( $file -is [System.IO.FileInfo] ) {
$assembly = $file.FullName
} elseif ( $file -is [System.IO.DirectoryInfo] ) {
Continue
} else {
#throw (“The object type ‘{0}’ is not supported.” -f $file.GetType().FullName)
}

if ( -not (Test-Path $assembly -type Leaf) ) {
throw “The assembly ‘$assembly’ does not exist.”
}

if ( [System.Reflection.Assembly]::LoadFile( $assembly ).GetName().GetPublicKey().Length -eq 0 ) {
throw “The assembly ‘$assembly’ must be strongly signed.”
}

Write-Output “Installing: $assembly”

$publish.GacInstall( $assembly )
}

2.  Place it to folder with DLLs and start.

PS You can use set-executionpolicy remotesigned to switch running scripts on.

Written by Alex Anikin

September 13, 2013 at 7:57 am

Posted in .Net, Windows Server

Monodroid: WebView input/textarea never get virtual keyboard focus

leave a comment »

Today I found a very strange issue.

This looks like here.

But we can reproduce this on 1-2 of our devices like Nexus, Xoom… (May depends on Android 4.1.x version)

So – WebView creating, opening html, but no one input/textarea get virtual keyboard focus.

I tried every solution for that link, and just only #35 helps me (big thanks to author):

For those who encountered this issue on Jelly Beans:
When you use one of the WebView constructors with more then 2 arguments applying the defStyle parameter, the default style com.android.internal.R.attr.webViewStyle will not be applied! For me the fix was to set the defStyle parameter to android.R.attr.webViewStyle.

e.g. to init a WebView with private browsing use

new WebView(this, null, android.R.attr.webViewStyle, true)

where this is a Context.

Hope to have saved somebody days of investigation (as in my case)..

 

But my project is on Monodroid. I couldn’t find  android.R.attr.webViewStyle value in Monodroid and just find it in SDK 

My constructor now  looks like:

const int WEVVIEWSTYLE = 16842885;

public MyWebView (Context context) : base(context, null, WEVVIEWSTYLE)

Awesome, but why?!

 

Written by Alex Anikin

April 11, 2013 at 10:00 am

Posted in C#, Monodroid

Preventing backup files on iCloud in your iPhone applications in Monotouch

leave a comment »

This is pretty simple. You just need to: 

NSFileManager.SetSkipBackupAttribute(filePath, true);

Written by Alex Anikin

April 1, 2013 at 8:30 pm

Posted in Uncategorized

How to implement Scroll To Top functionality for UIWebView in Monotouch

leave a comment »

Someone can say – this is by default! But I have a case when it’s not.

Imagine – we have a UIWebView within content and it’s almost full fills screen size without needs to be scrolled. But content inside scrolling using Javascript (something like iScroll extension). So iOS thinking: “I shouldn’t  scroll anything for this view.”.  I this case you’ll never get scroll to top event. It’s not firing!

But I found a workaround for this issue. All you need to do just:

1.  Create a fullscreen ScrollView with content size much greater than screen size  – let iOS thinks: “I should support scrolling for this huge view”.

2. Put you UIWebView at random number of pixel below the top of the screen.

3. Switch off handling of ScrollToTop for UIWebView.ScrollView. This must be done because if two controls handle ScrollToTop – nothing works.

4. SetContentOffset to this random number of pixes – to make you UIWebView looks like it placed full-screen.

5. Create ScrollViewDelegate to handle firings of ScrollToTop Event.

That’s it!

Here is the sample code:

const int scrollOffset = 100;

var contentSize = new SizeF (320, 3000);

var scrollToPoint = new PointF (0, scrollOffset);

ScrollView = new UIScrollView();

UI = new DesignedFileManager(Settings);

// UI placed 100px (scrollOffset) lower than top of the screen

UI.Frame = new RectangleF(0, scrollOffset, Window.Frame.Width, Window.Frame.Height+scrollOffset);

// this lines must be there because iOS can’t choose who will support scrolling to top

// so UI web view will not handle scroll to top

UI.ScrollView.ScrollEnabled = false;

UI.ScrollView.ScrollsToTop = false;

// set scroll view frame like window frame

ScrollView.Frame = Window.Frame;

// let scrollview handle scrolling to top

ScrollView.ScrollEnabled = true;

ScrollView.ScrollsToTop = true;

// set scroll view content size bigger than window frame to support scrolling

ScrollView.ContentSize = contentSize;

ScrollView.ShowsVerticalScrollIndicator = false;

ScrollView.ShowsHorizontalScrollIndicator = false;

// scroll to 100px lower, so wevview fills full screen

ScrollView.SetContentOffset(scrollToPoint, false);

ScrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

ScrollView.Delegate = new ScrollViewDelegate(UI);

ScrollView.AddSubview(UI);

_mainView.AddSubview(ScrollView);

And delegate:

class ScrollViewDelegate : UIScrollViewDelegate

{

DesignedFileManager UI;

public ScrollViewDelegate(DesignedFileManager ui) : base()

{

UI = ui;

}

public override bool ShouldScrollToTop(UIScrollView scrollView)

{

Trace.WriteLine(“Scroll to Top invoked.”);

UI.ScrollToTop();

return false;

}

}

Written by Alex Anikin

February 15, 2013 at 6:45 am

Posted in iOS, Mac, Monodevelop, Monotouch

Extranet Collaboration Manager 2010

leave a comment »

Written by Alex Anikin

August 8, 2012 at 9:17 am

Posted in Sharepoint

Memory Warning Received and PushViewController

leave a comment »

It was really  great investigation about why iOS application goes to black screen and craches sometimes.

Fisrst of all, I saw this: Received memory warning. Level 1

After that it goes to black screen. This is very interesting, application was working fine if no applications was started in background (I imagined – there are no free memory… but strange…). But, as I can see later, this is view was unloaded only. Several articles wrote – if view has no SuperView it will be unloaded when UIViewController receive memory warning. But this was obviously our fault. After huge  changes in UI we decided to use only one UIWebView. But some code was moved to new version, and  PushViewController invoke too. This is not clear for me now what exactly change this method, but it do something and view unloading after memory warning receive.  So we just remove this line and no black screen (means unloaded view) now.

Written by Alex Anikin

August 4, 2012 at 7:53 pm

Posted in C#, iOS, Mac, Monodevelop, Monotouch