How to fix IntelliSense in VisualStudio for Razor ViewEngine.

If you don’t have IntelliSense in VisualStudio for Razor view, you might be using wrong project type like class library or your configuration is wrong. For last one it is enough adjust your web.config file in Views folder. But for first case you need to make several steps to enable it. Here those steps as follows :

  • Add references to following ddls : System.Web.Razor, System.Web.WebPages, System.Web.WebPages.Razor. Those you can find in packages folders like Microsoft.AspNet….. (Please check first if you have MVC installed using nuget package manager.)
  • Create new MVC project with Visual Studio. Unload MVC project file and copy Project type Guids into your project: <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
  • The same do with imports. I copied those to mine project as well. :

    <Import Project=$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets Condition=‘$(VSToolsPath)’ != ” />

      <Import Project=$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets Condition=false />

      <Target Name=MvcBuildViews AfterTargets=AfterBuild Condition=‘$(MvcBuildViews)’==’true’>

        <AspNetCompiler VirtualPath=temp PhysicalPath=$(WebProjectOutputDir) />

      </Target>

 

Now reload and rebuild your project and have fun with Razor View Engine.

Posted in Development

2015 in review

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 9,200 times in 2015. If it were a concert at Sydney Opera House, it would take about 3 sold-out performances for that many people to see it.

Click here to see the complete report

Posted in Uncategorized

JsonForm

we saw a lot of json-schema implementations nowadays. What I like about json schema that’s based on json – most popular an open standard used primarily to transmit data between a server and web application, as an alternative to XML.

We still don’t have such stand-alone standard like Json Schema, but it’s coming and I believe that in the market we need big player like jQuery, Google or Microsoft saying : hey guys, here is a json schema, from here you can do this and this, here tools, use it wisely …

I saw really good implementations with json schema, but I think that there is space for one more open-source project. So I’m glad to announce my first big open-source project I’m gonna build with help of big brother internet.

Why it should matter ?

  • I do not love software development🙂 I really do, but it’s time consuming process and I’m tired, tired of do things which can be much simpler.
  • I do not love write things twice. Web or mobile software development has a bad habit of repeating.
  • Even as software developer I like simplicity. I like idea generate and fill out those forms without writing any single line of code
  • I saw a lot of products and companies which invest a lot of time for doing simple things. 10 layers for simple web app, insane mappings, huge overwhelming ORM mappers, many to many relationship, validation, code interception and templates is not a rocket science anymore. And sometimes why I should matter those things if my goal is create simple fully functioning form.

What it will do

  • First step is defining schema : form name, display types, data types, validation rules. Regarding each combination of display type and data type you will get particular settings set.

define form

Also you can work in advanced level and enter more developer specific functionality :

Screen Shot 2015-05-20 at 10.28.22

  • Second step is load brand new form. You have two options here : put generated code into html or load form the internet.

Screen Shot 2015-05-20 at 10.34.57

  • And finally you can collect your data.

Screen Shot 2015-05-20 at 10.36.56

What is so different from other implementations ?

  • it will have tools for the end user and he will be able create forms without any single line of code.
  • it will have option for advance configuration
  • in form you can add other forms, multiple them : person has 3 addresses – shipping, home, business.
  • Form elements can be filled out from 3rd party source : web service, feeds, database.
  • Workflow after submitting form.  On submit you can define what you gonna do.

Sounds like I’m going to create new Custom Forms functionality like Orchard CMS has ? Well, maybe, but this is more based on json and javascript. As a backend I see NoSQL. 

This will be my hobby project. First implementation is already in my home made project – startup.

Code will be placed into bitbucket repo soon : https://bitbucket.org/djovaisas/jsonform

Domain is registered ! – http://jsonform.com I already spent 8 Eur per domain, so there is no way back !!!!🙂

For now – its only on my head, any contribution and collaboration is appreciated. This summer with help of several interns I will provide source code and working environment. Cya

Posted in Development, Startup

DataContracts VS MessageContracts

Lastly I was asked explain MessageContracts need.

Typically when building web service, developers pay close attention to the data structures and serialization issues and do not need to concern themselves with the structure of the messages in which the data is carried. For these applications, creating data contracts for the parameters or return values is straightforward.

However, sometimes complete control over the structure of a SOAP message is just as important as control over its contents. This is especially true when interoperability is important or to specifically control security issues at the level of the message or message part. In these cases, you can create a message contract that enables you to specify the structure of the precise SOAP message required.

Here is the code from one of my service I prefer to work with.

Screen Shot 2015-04-27 at 15.53.06

A DataContract (DTO) is a description of a type that is exposed and supported by your service. A MessageContract is an abstraction over a SOAP message that allows you to explicitly dictate the structure of the underlying message.They are meant to compliment each other and serve different purposes.

Why not in response side not use NotificationDataContract (can be called NotificationDTO) ?

Small changes can break all clients.

Let’s say I have requested for lookup data (Id and Name is enough to fulfill some drop down list in UI). In such case your response can look like List or PersonsDTO (second is better). For comming requirement it might be not enough have only two properties in PersonDTO – Id and Name. E.g. we need extra info about credibility, add list of orders, etc… We need more. What we going to do ?

First option : expand existing DataContract and put more properties to it

It might be the case that you will expand PersonDTO data transfer object(Data Contract). You will add more and more properties. But for front-end developer can be tricky manage those properties in UI. Looking at PersonDTO class you cannot be sure in which operations it was used.

Second option : rename PersonDTO to PersonSmallDTO ?

If you would prefer work in this way – that’s fine for me till I’m not involved in your team. Also this is a breaking change if you change response DTO name in service side . You change service layer, so your clients should be aware of that.

>>>

In my way I suggest you clearly define message – for what your service actions is responsible ?

Beneath messaging you can get more :

Having massages into separate assembly allows you be more flexible. You can have base classes, one for list requests where you can expecting such parameters like paging, sorting, another base class can consist of base parameters with common properties : version, token, api key.

GetPricesRequest : BaseRequest, IPaginationRequest

public interface IPaginationRequest
    {
        string Column { getset; }
        SortDirection Direction { getset; }
        int PageSize { getset; }
        int PageNumber { getset; }
    }

As I mentioned above you can have base class for all properties which consist of common properties. So you can do either global filtering in Service Stack or add service behavior in WCF for checking those properties accordingly.

For many of us DataContracts is enough, for me – interoperability, single responsibility and clarity.

To summary this I would like to share with you guys ServiceStack thoughts about message contracts. Have a good reading :

https://github.com/ServiceStack/ServiceStack/wiki/Why-Servicestack#wcf-the-anti-dto-web-services-framework

Posted in Development

Deploying angularjs, bower grunt application to Windows Azure

if you have on-premise server please follow this link to have instructions how to deploy angularjs app with TeamCity.

Deployment steps are common for all node applications. You need have all dependencies first and then build your app, test it, move to public area if necessary.

so it would be :

1) npm install

if (your package.json doesn’t have bower and grunt defined you need call it separately like : npm install bower –g, npm install grunt-cli –g ….

2) bower install

resolve your dependencies with app functionality

3) grunt build

To work with azure I installed kudu tool : npm install azure-cli –-global

so if you have azure SDK installed you can run now : azure site deploymentscript –-node 

2 files should be created .deployment and deploy.cmd

You can look at file deploy.cmd and you can see that 1st step (npm install) is already covered for you. I copied code and added 2 more steps :

:: 5. Install bower packages
IF EXIST “%DEPLOYMENT_TARGET%\bower.json” (
  pushd “%DEPLOYMENT_TARGET%”
  call :ExecuteCmd bower install
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

:: 6. Grunt build
IF EXIST “%DEPLOYMENT_TARGET%\Gruntfile.js” (
   pushd “%DEPLOYMENT_TARGET%”
  call :ExecuteCmd grunt devBuild
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

if your package file is missing bower dependency you can install it separately :

:: 4. Install bower
IF EXIST “%DEPLOYMENT_TARGET%\bower.json” (
  pushd “%DEPLOYMENT_TARGET%”
  call :ExecuteCmd !NPM_CMD! install bower -g
  IF !ERRORLEVEL! NEQ 0 goto error
  popd
)

what can I say : works in my machine !!! sorry I mean works in some Azure machine…

Posted in Deploying, Infrastructure

Deploying angularjs, bower grunt application to Windows server using TeamCity

Hi, lastly I had a chance improve my deployment skills. Our application we build now is based on AnglularJs framework. To have good practices out of the box we used yeoman. Yeoman is a nice scaffolding tool which allows you start very quickly with web app development. In our case we used angular generator (bower, grunt, bootstrap included)

To have CI deployment in Windows Server we use TeamCity. TeamCity has plugin called “Node.js build runner” by jonnyzzz.node

Deployment steps are common for all node applications. You need have all dependencies first and then build your app, test it, move to public area if necessary.

so it would be :

1) npm install

if (your package.json doesn’t have bower and grunt defined you need call it separately like : npm install bower –g, npm install grunt-cli –g ….

2) bower install

resolve your dependencies with app functionality

3) grunt build

Here is how it looks like in TeamCity :

Screen Shot 2015-04-14 at 11.58.32 

1st step is for getting dependencies regarding your package.json file. I also included grunt installation to be sure if grunt is downloaded before executing grunt commands

Screen Shot 2015-04-14 at 11.59.31

2nd step is grunt command. What it does is just a call “bower install”. I defined this command in grunt file :

grunt.registerTask('resolve', 'install the backend and frontend dependencies', function() {
var exec = require('child_process').exec;
var cb = this.async();
exec('bower install', {cwd: './frontend'}, function(err, stdout, stderr) {
console.log(stdout);
cb();
});
});

 

Screen Shot 2015-04-14 at 11.59.50

3rd step is run my custom build called DevBuild

Screen Shot 2015-04-14 at 12.00.00

I don’t use –force flag anymore. Instead if i have some build problem I save my option to resolutions section (see this thread https://github.com/bower/bower/issues/866)

And that’s it…

Posted in Deploying, Infrastructure

Top 10 Inspirational movies

Summer is coming and winter is in the past. Here is the list from watched movies I want to share with you guys. I like inspirational movies, books, podcasts. I’m preparing new 10 books I’ve read so far, but for now about movies :

1. Whiplash
2. Interstellar
3. Apocalypse: The Second World War
4. The Imitation Game
5. Gone Girl
6. The Water Diviner
7. The Theory of Everything
8.  Unbroken
9. Million Dollar Arm
10.12 Years a Slave

It’s my personal taste, though… Cheers…

Posted in Uncategorized
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: