Tuesday, August 26, 2025

The Hidden Risks of AI: Hallucinations, Indirect Prompt Injection, and Jailbreaks

I have read an excellent article analyzing the most popular AI vulnerabilities, organized into three most common categories of AI security issues:

  1. Hallucinations
  2. Indirect Prompt Injection
  3. Jailbreaks

Tuesday, August 4, 2020

What do you need to be prepared for AI-900 Azure AI Fundamentals?

Microsoft Certified: Azure AI FundamentalsDisclaimer: I am not an AI engineer, and I have passed beta AI-900 just for fun. I want to share the minimum level of knowledge that is required to pass this exam. The beta exam has 53 questions. My score was 800.

It will be a small post because AI-900 is a pretty simple fundamentals exam. I know that you could download the required exam skills outline, but I want to share the minimum set of skills:

Monday, June 18, 2018

FaaS on AWS for .NET developers


Last weekend, I joined to IT Talk event series promoted one of the Lviv's company. This event was dedicated to cloud solutions for C# developers.

I have prepared the presentation about FaaS on AWS for .NET developers. There are I presented how to develop&deploy a serverless solution on Amazon. And I did a demo with C# in Visual Studio 2017.



FaaS on AWS for .NET developers from Taras Romanyk

Slides contain brief information about the theme. So anybody feels free to contact me if he/she has any questions or needs additional explanations.

You could find more photos - there.

And read info about my presentation and extra info+slided of another presentation there.

Wednesday, December 6, 2017

Secure ASP.NET Core Web API using API Key Authentication

I am implementing the simple web service that grants access via usual login and api login with some token. I have googled a bit for good solution but found it for asp.net mvc 5 application only (original article - Secure ASP.NET Web API using API Key Authentication – HMAC Authentication).

So it is something that helps me to do the same stuff for asp.net core that I am using for my web services.

First of all, I went through great workshop related to the various new pieces in ASP.NET Core Authorization - AspNetAuthorizationWorkshop. Also, check out the great article about Filters.

Monday, July 24, 2017

Dynamic Configuration Settings in ASP.NET Core



I read the great article about the configuration of ASP.NET Core web application - Strongly Typed Configuration Settings in ASP.NET Core. As for me, it is better than access via dictionary's keys but it is always boring to create another POCO classes. I prefer to use a dynamic object. And it is easy to replace POCO class with dynamic.

Monday, August 22, 2016

TFS 2015: deploy website to IIS without installing extra add-ons to TFS

Recently, I started to keep my sources under TFS 2015. After moving our work items I have time to pay attention to new build. Everything looks pretty simple until I tried to deploy my website to local IIS. I have found pretty simple article how to do it - Deploy ASP.NET apps to domain-joined machines using WinRM. But this way was closed for me because I didn't have permission to install add-on from the market on TFS Server. So I came back to the old and proven method with MS Build. My parameters for MS Build look like :

/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=RemoteAgent /p:CreatePackageOnPublish=True /p:DeployIisAppPath="Sites/Stage" /p:MsDeployServiceUrl=10.XXX.XXX.XXX /p:username=DOMAIN\MyUserName /p:password=MyPassword

But I didn't want to store my password in build's configuration. So I looked into TFS variables for this. After small investigation I modified a bit MS Build string:

/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=RemoteAgent /p:CreatePackageOnPublish=True /p:DeployIisAppPath="$(SiteName)" /p:MsDeployServiceUrl=10.XXX.XXX.XXX /p:username=DOMAIN\$(User) /p:password=$(Password)

And added SiteName, User and Password variables: 

Pay attention, that I set checkboxes at "Allow at Queue Time" section - it shows parameter in the dialog window during queue and set secret for Password variable. But you can't clear this field and turn off secret - in this case a developer who starts a build has to enter own credential.

So in such simple way, I added the possibility to deploy website without adding new add-ons to TFS.

Saturday, July 6, 2013

Migration to ASP.NET MVC 4: Deployment.



We are developing ASP.NET MVC application. We are using a latest version of the frameworks. So I need to update a software after each framework's upgrade. It easy to do on the developer's machine: you can use web or standalone installer or nuget package.
Usual I used to run installer on the server for the previous version of ASP.NET MVC. But I noticed that installer for ASP.NET MVC 4 contains SQL Express Server and Visual Studio Express 2012 for Web. They are definitely not tools for the server's PC. I carried on with googling and found out that ASP.NET MVC 4 doesn't need any extra library in GAC. It requests .NET Framework (4 or 4.5) on the server and it all.

Tuesday, May 14, 2013

Developing ASP.NET MVC 4 Web Applications - passed.

I have successfully passed Exam 70-486: Developing ASP.NET MVC 4 Web Applications.

I used next sources for preparations:
From the other hand I filled problem with questions related to Azure and CSS. At least first one is topic for develop.

Sunday, March 24, 2013

10gen: M101P MongoDB for Developers - has been completed

I have successfully completed, with distinction, M101P, MongoDB for Developers (Python). My score puts me in the top 6% of all students who registered for the course.
My final grade: 95%.

Monday, July 16, 2012

How to force to update JavaScript and CSS files after deploying new version of ASP.NET MVC application.

Usually after each deployment my ASP.NET MVC (Razor view) site I have a little mess with cached JavaScript and CSS files. Sometimes user's browsers show unappropriated view or some client functionality doesn't work.
Yeah, it is very easy to fix - just clear browser cache or reload JavaScript and CSS files (press CTRL+F5). But I want user to avoid this annoying action moreover not all users are so familiar with PC to know this trick.
My friend Mykhailo found nice solution for this. If I add parameter to JavaScript's url and will change parameter's value after each deployment. Browser will recognize it as other script and will update file.
So now I should add something like "?v=xxxx" to all links of CSS and JavaScript files in my project and keep in mind it for future links. Looks not really smart solution doesn't it?
First of all I want to say that I set JavaScript and CSS files in "Razor" style. For instance:

Wednesday, June 13, 2012

Route of executing in Controller of ASP.NET MVC

Base classes of controller is ASP.NET MVC have number of methods for initialization before your code runs in an action. Lets review them.

  • First of all about constructor. You can't do a lot in it because most of properties aren't initialized yet and you will get NullReferenceException if try to use them.
  • Execute is inherited from IController interface and manages all other initialization methods. Usually you have to avoid override it.
  • Initialize sets ControllerContext. You should to override it if you need to set culture so on.
  • ExecuteCore is called to process request and responsible for loading TempData.
  • If I want to predefine some information (grab data from Session and so on) You should use OnActionExecuting. This methods is called just before executing your action method.
  • And finally you should use OnActionExecuted for any finalization after executing your code. 

PS: During preparing for this post I've used ILSpy. It is excellent free substitute for .NET Reflector (it is payment tool now).

Tuesday, December 27, 2011

Introduction to Artificial Intelligence

Introduction to AI
Some time ago I have joined to Introduction to Artificial Intelligence  it is online course that is based on Stanford CS221, Introduction to Artificial Intelligence.
This class introduced students to the basics of Artificial Intelligence, which included machine learning, probabilistic reasoning, robotics, and natural language processing.
My reason to join this class was simple I wanted to know more. I took 82% it isn't so bad for not native speaker.
If you want to get more you can join a lot of next online courses - http://www.class-central.com/

Tuesday, August 16, 2011

Trouble with resources in WP7

I started a few projects on WP7. It was done just for fun and for improving my skills (Fun was profitable - I won in Ukrainian WP7 competition). So I had completed my projects and tried to localize it.
I met some issues:
  1. If you have experience in developing for web silverlight - first isn't new for you. When I edit/add/remove a item in resources's file I need to open resources designer's file and change access modifiers of parameterless constructor from "internal" to "public".
    It is know issue and know fix - proof.
  2. Second was new for me. It is strange issue because it appeared only in one of my projects. I created resources file and added key in Resources section of app.xaml (for binding to resources in my xaml files). My project started to crash after this.
    I had spent some time and found source of the issue. I noticed that Resource class (auto generated) is internal. I checked "Custom tool" field in properties of resource file. It was filled "ResXFileCodeGenerator" value. In my other projects this field contained "PublicResXFileCodeGenerator" value. I didn't found detailed description of "ResXFileCodeGenerator" but looks like that it is obsolete tool. I no idea how to it was set in my project.
One more note: it is for WP7 without "Mango" update. I hope I will not meet such issues after this update.

Monday, February 7, 2011

Trimmed TextBlock for Windows Phone 7.

Unfortunately WP7 is based on Silverlight 3. So we can't use some nice features of Silverlight 4 i.e. dynamic key word or TextBlock's trimming. But I've solved issue with trimming for Silverlight 3. Solution is here. Let me explain which code I use in WP7 project:
  • Generic.xaml: File contains style and template for custom control. This file is located in Themes folder. WP7 tools doesn't contains Resources.xaml file template. So I created xml file and name it as "Generic.xaml".
  • TrimmedTextBlock.cs: It is implementation of custom control. I just copied this file. One more note: I decrement c_POINTS_COUNT to "1" because screen resolution of desktop and mobile versions are different.
Easy coding.

Wednesday, December 15, 2010

"using" directive in aspx's pages.

It is funny but I don't know about this. I used full name of type (namespace+type name) in aspx pages. It is unnecessary. ASP.NET has directive for this.
<%@ Import namespace="value" %>
Sometime we omit in haste important things.

UPD: And more easy for Razor view engine:
@using MyNamespace

Monday, November 15, 2010

ASP.NET MVC aplication inside in an iframe (fix issue with empty session).

I developed application using ASP.NET MVC framework. It worked well but when I put my app inside of iframe I founded that in some case in Internet Explorer application missed session.
I started to investigate for the source of the issue.
I founded that application worked well if I decrease security level in the IE. But this fix weren’t suitable for me (I can`t request something in the customers). So I carried on with investigation.
Well description what happen I founded on the follow page (unfortunately, I didn’t found English version of this page, so I used google translate for figure out this article).
So for fix this I should add “PSP” header to response. How can I do it for the ASP.NET MVC application? In classic ASP.NET it is easy to do in code behind or in aspx file. I overrode ExecuteResult method in all classes inherited from ActionResult that used in my application. ViewResult for example:
public class CustomViewResult : ViewResult
{
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.AddHeader("P3P", "CP=\"CAO PSA OUR\"");
base.ExecuteResult(context);
}
}

After it I used my customized classes in base controller of all controllers in application (It was very nice idea to implement one base controller for all other controllers, wasn't it?). For example:
public class BaseController : Controller
{
protected override ViewResult View(string viewName, string masterName, object model)
{
if (model != null)
{
base.ViewData.Model = model;
}

return new CustomViewResult
{
ViewName = viewName,
MasterName = masterName,
ViewData = base.ViewData,
TempData = base.TempData
};
}
}

For figure out which methods I need to override I used cool tools - .NET Reflector.

Thursday, September 16, 2010

Unit Tests for ASP.NET MVC application that uses resources in code behind.

Download source files - here.

Some time ago I start to play with ASP.NET MVC. It is very well pattern and Microsoft made nice choose that implemented it for ASP.NET in my opinion.
I started a project that uses ASP.NET MVC. This project requests multilingual support. I use resources for this. It works well when I use resource's properties in the View's layer but when I call resource's properties from code behind. It's something likes to next:
public ActionResult Index()
{
ViewData["Message"] = CommonResource.WELCOME;
return View();
}
It works but I pay attention that this code breaks my Unit Tests. My Unit Tests looks like:
[TestMethod]
public void Index_Test()
{
//// Arrange
var controller = new HomeController();

// Act
var result = controller.Index();

// Assert
Assert.IsInstanceOfType(result, typeof(ViewResult));
}
It happens because I run my code in other project and my ResourceManager is not filled (it equals to null). How can I fix it? A first idea that came to mind is "extract interface".. but it is very annoying because resource's class is auto-generate and I should update this code after each updating of resources.. I made some research and found additional way for extracting resources - HttpContext contains GetGlobalResourceObject method! It is well way because I can set mock for HttpContext and for any its methods or properties.

Note: GetGlobalResourceObject returns object but I use only strings for localization. So I create linq method for HttpContext that returns string if it presents:
public static string GetGlobalResource(
this HttpContextBase httpContext
, string classKey, string resourceKey)
{
var result = httpContext.GetGlobalResourceObject
(classKey, resourceKey);
return null != result
? result.ToString() : string.Empty;
}
Pay attention, MissingManifestResourceException is possible in this code if you pass incorrect key/keys!

So I change pieces of code in Controller's classes in the next manner:
public ActionResult Index()
{
ViewData[CommonStrings.MESSAGE] = HttpContext
.GetGlobalResource(CommonStrings
.COMMON_RESOURCE, CommonStrings.WELCOME);
return View();
}
After it I should change my Unit Test's methods in next manner:
[TestMethod]
public void Index_Test()
{
//// Arrange
var httpContextMock = MockRepository
.GenerateMock<HttpContextBase>();
httpContextMock.Stub
(x => x.GetGlobalResource(
CommonStrings.COMMON_RESOURCE, CommonStrings.WELCOME))
.Return(CommonStrings.WELCOME);

var controller = new HomeController();
var context = new ControllerContext
(httpContextMock, new RouteData(), controller);
controller.ControllerContext = context;

// Act
var result = controller.Index();

// Assert
Assert.IsInstanceOfType(result, typeof(ViewResult));
ViewDataDictionary viewData = ((ViewResult)result).ViewData;
Assert.AreEqual(CommonStrings.WELCOME
, viewData[CommonStrings.MESSAGE]);
}
Moreover, you can see that I added additional checking related to localization.

Wednesday, March 24, 2010

Trimmed TextBlock for Silverlight.

Download source files - here

Not always Silverlight TextBlock that contains long text has enough space for shows all this text. TextBlock clips text in this case - this behaviour isn't best way for this. Because I wait that TextBlock not only trims but also adds "..." to clipped text. WPF has brilliant property that helps to resolve this trouble - TextTrimming. I implemented this possibility for Silverlight and now want to present it for you. Furthermore I implemented ToolTip that shows trimmed text (only if text is trimmed!)
Enjoy!

UPD: I have just updated performance and behaviour when width defined zero.

Wednesday, February 24, 2010

Trips&Ticks: Easy way to navigate from XAML to class's definition.

Working with XAML code in VS2008 I have just found that I can easy jump to class's or property definition. If I press CTRL and click left mouse button on certain class or property in XAML I will be immediately switched to Object Browser (if it is class or property of .NET or external dll) or to class's or property definition in my code (if it is class or property from my sources).
Eugene Dolinskyy just pay my attention that "clear" VS2008 doesn't have this possibility. This feature is presented by ReSharper.

Monday, January 25, 2010

Zoom event for FlowDocumentPageViewer (corrected)

Download source files - here

When I wrote my article Zoom and page chaged events for FlowDocumentPageViewer I make mistake, you can read about it - there. However Martin offer solution for this problem. But I don't like this solution, overriding of OnPropertyChanged isn't best solution because this method is risen in many cases so any logic there is serious performance issue.
So how can we fix it in other way? We can find object of Slider in Visual Tree of FlowDocumentPageViewer and subscribe to ValueChanged event and call OnZoomChanged(); there.
Bingo! It fixes my trouble.