Posts

Showing posts with the label Asp.net MVC

Aspnet MVC Cheatsheet

Probably the best place to start with this cheatsheet is with this blog itself. I have tons of articles under my tags "aspnet" and "aspnet-mvc" on this blog. Since aspnet is where I started in my career its probably the most important cheatsheet I should have ready. This article will always be on going... Assigning and Setting Bound models some of my notes here include javascript because so much of my code is, but you need to be aware how it ties in with the backend. Accessing Your Model's Data from a Controller Microsoft Workers Worry Most About Re-Org - Dice News Use View Models instead of FormCollection - Jaco Pretorius Assign Model property value from JavaScript value MVC 3 form post and persisting model data Setting property on the model object? (javascript) Controller without a form? Sending JSON to an ASP.NET MVC Action Method Argument JSON.stringify not converting array.object correctly (javascript) associative array to JSON (javascri

Intuitive Third Party Packages

   In relevance  to my package npm "flavorstrap" this is a little of a working progress for me and a few of my github projects I hopes it helps others. I've based this heavily on what I've seen others do  and what I think looks helpful to others. In that there enough context provided for others to go off from github package. I I face this problem with sometimes but I love to code so I spend the extra time to read someone else's code using a project as well. It helps if the documentation isn't there or if the code shows something the developer didn't think of.  Now this is just in my opinion and not so much a complain but advice for myself. I would definitely say I have used my share of third party libraries more often than actually written any but I do appreciate the ones well written. For example bootstrap and android's documentation pretty good and they even include some examples. However there are a couple of things I would suggest. For starters d

My Patco Now Runs on Firebase

   Over the past two months I've do to made a critical decision due to costs and completely redid the backend for mypatco. Of course there was breaking changes but that wasn't related to the bad reviews that came in (caused by another developer). Instead of using azure now the app is hosted on firebase which everything I need starts out for free. Key Features Free Https Later needed for Geolocations Free use of Custom Domain  *Databasing (real-time) Json type database greatly reduces time for developing with api's Static Hosting Plugins for Angular with Database Authentication The first two really sold me on the idea but the static hosting had me worried since a lot of my data was handle at the middle tier level. Pretty soon though I had my data flatten and it just made sense but the process of updating my database is still in the works luckily though not all my code had to be scraped. To get the database corrected I still have my azure code to handle th

Google Service Account with Aspnet MVC Behind A Proxy

    Recently I had a fun project to attach google analytics data to an internal site which took longer complete than I thought intial thought but now I could complete in just a day. My biggest issue was finding out the issue was related to the company's proxy. Which I quickly fixed by just added the following snippet at the bottom of this article. For everything else this is just my notes and things I found to help me drill down into the queries for grabbing the data.  Questions How to get the Access Token for GA? - C redential.RequestAccessTokenAsync Querying example -  Use Google Analytics API to show information in C# - Stack Overflow Behind a Company Firewall     Both errors I encountered were "No connection could be made because the target machine actively refused it 172.217.1.77:443" and  “requested service '…' could not be activated” the first time it's accessed ".   <system.net>     <defaultProxy useDefaultCredentials="

Asp.net: Dynamic Sitemap.xml

    This is an article I started to working for the project: rustkickers, which for now I'm putting on hold. What I was trying to do was kill two birds with one stone. If you need a good sitemap to submit to google or to create a "site map" for you users then this would do it. I haven't finished making it but there is where my notes are. Generating dynamic XML Sitemaps in ASP.NET MVC - Ben Foster ASP.NET MVC: Get all controllers - Stack Overflow Resource http://www.robtennyson.us/post/dynamic-sitemaps-with-aspnet-mvc  - Example http://blog.divergencehosting.com/2009/04/01/dynamic-create-google-sitemap-aspnet/  - Another example Create a Google Site Map with ASP.NET ASP.NET MVC: Get all controllers - Stack Overflow http://msdn.microsoft.com/en-us/library/yy2ykkab(v=vs.100).aspx Maybe create a atom feed instead of a sitemap.xml? http://weblogs.asp.net/seanmcalinden/create-rss-and-atom-feeds-using-custom-asp-net-mvc-action-results-and-the-microsoft-syndicat

Wrapping Asp.net MVC with Nodejs for Development

Image
    With Asp.net 5 around the corner I get all the nodejs support I could need, but convincing a team to get on board with early technology is difficult. So what I'm playing around with nodejs projects and what I'm doing with them is wrapping them around Asp.net MVC 5 projects. Having all my front-end taken care of outside the Asp.net MVC project and then severing the dependencies up in a single file. I think this is the best approach and will meet future solutions without breaking things. I'm still using Asp.net MVC's bundle feature but for personal JavaScript files I create. Nuget doesn't have that feature out of the box for Asp.net MVC applications so for now this helps adapt to the solution with taking advantage with npm packages. Side Note        I'm also looking at is using Typescript + Typelite. I'm not completely sold on typescript but I would highly recommend using  typelite  if you do. Synchronizing fronted model with back-end model

My Career at Coriell Institute and Personal Achievements

Image
     The time  has come where I need a change in my career and sadly that requires me to leave my current position at Coriell Institute . So just like what I did way  back in 2013 with Northern Safety , I thought I would wrap things up in an article and look back on my achievements.  Achievements (Order of Completion) The ones with asterisks are ones I built in groups.  Atlas Project - Storage Module -   Provided an interface to store unique data sets in multi-forms . Coriell Bio-Repository Catalog *  Atlas Project - Manager Module -  Provided managers to control other user to access data. Blits Project - Modules   Issues & Repairs* - Reported equipment  that were broken or had problems. Inspections* - Collected equipment w/ schedules for inspections.  Maintenance - Collected equipment  for  regular maintenance and  setup schedules.  Dashboard* - G raphical dashboard on data provided from other modules. 2015 Coriell Institute. All rights reserved My Goals

Just a Thought with Asp.net MVC and Portability

        Since the release of Vnext this idea has become less of a concern for me but a majority of my "professional" projects have been in MVC and with Vnext offering larger amount of support this article doesn't really reflect any of my current solutions. Instead it is just a thought on allowing me to continue with the frameworks that I currently use in my career with frameworks that are available to me in my personal projects.       It is very important to me, to create fast, low cost, and high processing application. As I like build with large number of tools in order to increase my productivity since I have less time at home. Working in familiar frameworks between work and home isn't a must but just something I think that works in my favor. If all else fails, I can just pick things up. I go along. Plus there's always the bonus of my javascript skills.      My original thoughts for this approach show below was to move all my controllers into an angular pr

AngularJS: Facets in a Search Grid

    Sometime back I really needed this code however it came a little too late and unfortunately didn't make it into the final product. However I have since then built a complete explain showing how to hand facets with little javascript code and with a whole lot of functionality! Requirements Load appropriate facets, make a search. Update the UI, reload page if necessary but scale up for a single page application. Make things bookmarkable but don't lose that awesomeness from SPA's. Example http://jsfiddle.net/t7kr8/211/  - I forget where I found this but its probably buried somewhere in my resources. My Example https://fassetar.github.io/blog-examples/catalog-facets/ Javascript code var myApp = angular.module('myApp', []); myApp.controller('mainController', function($scope) { $scope.items = [{ item:"apples", flag: true }, { item:"oranges", flag: true }, { it

Razor syntax in Javascript files

    I don't always mix server side code with client side code... but  continuing  with my thoughts on  server and client models . I wanted to know if I could use razor syntax in a javascript file. Which means I woud be able take advantage of the Asp.net  Bundling and Minification  feature. Now I probably didn't bring this approach up in the article but what I did talk about was using query url with the javascript. Not being able to cache javascript files is the major reason why avoid using using it and I didn't think I would take this approach either but I did want to see if it was possible.   In my research I did notice some loss of performance, I didn't do any benchmarking but I felt the process was a little  wonky. I think the third link best describes my thoughts on this approach. So  what  I have been doing now since this is using the "data" attribute  and assigning a value with razor syntax.  It's not completely perfect  but it does have some advan

Compiling Bootstrap LESS using Asp.net MVC and Web Essentials

Image
    My goal is to work with others in whatever framework they choose but I'm constantly update css styles with a pre-processor so that I do not have to work with the css libraries directly. Download the   Web Essentials  and the Bootstrap less nuget package. Get this nuget package! I see it all the time where developers install the wrong packages, sometimes theres ones with similar names and you just not sure what the differences are. So just so we're clear its the first package with the bootstrap .less in the name. Just search for bootstrap less as two seperate keywords, should be no problem. Solution For this solution did  not have to change thing with my setup or move around files on the directory once I got things up and running. I even made it easier for colleagues to come into web applications without any problems so in case they are new to bootstrap they can simple ignore the less files. Now what I did was create  separate  bootstrap.less file and did some reg

A Thought on Server Side and Client Side Models

   The truth is if you want to take server side models for example in Asp.net Mvc directly to a client side mvc framework's enviroment the common approach is via ajax. What has me troubled about this approach is that in some cases we already know the information that will be passed from server side to client before the call based on the request in some cases. So why do we make clients call this ajax? It's simply because we don't have enough ways to bridge the two technologies. Now just to be clear I'm not talking about third party api's or in any extreme case where the data is so dynamic that it is dependent on the front-end. What I am talking about is in cases where the data is in within the web application and we know what is needed by the page request. In case I haven't made myself clear (probably not) here is an example of what I mean. Example       I'm going to use an example from a Asp.net Mvc perspective just because that is what I'm familar w

My Firefox Bug with Returning Csv Content

    So this was an interesting bug that I encountered last week and it was just happening with Firefox. I'm not complete sure about the information I found but my guess was firefox  grabs it's file types from the register in windows. Either way my issue was what I was using for the mime type and below is what I tried in order. application/vnd.ms-excel  - This would for some users open up the file in xls and trim file name. application/csv - Worked fine for all my users. text/csv - Worked just like the previous one. I think this is the safest choice. I'm already treating it like a text file on the server side so this would more apparent in my case to use. Resources How do I map a .csv MIME type to the "Microsoft Excel Comma Separated Values File" application? What to set as mimetype for csv files to open in spreadsheet applications - Stack Overflow

Nuget Packages You May Not want to use

    This is just a thought and in my opinion, I feel that there are certain packages in Nuget that include css files  in which developers should use with caution. A good example is Bootstrap, which you should try using less instead of your own css file other customizing the bootstrap css. The reason for this is because less allows you to separate your styles from the root of bootstrap and makes it simpler for later updates with bootstrap. Not to mention the possibility of changing the third party libraries that you might be using. If the library you are using isn't in a less format I would be worried about customizing it because it would only make things harder for when you want to move away to something else.     I think most developers out there are using Jquery UI or bootstrap but not many are using less which puts a lot of projects in danger for restyling and restructuring their code. I've made it my goal to try and not to separate css files into more than one css in prod

Updating Jquery Nuget Package to 1.11

       I feel a lot of developers out there are unaware of the fact that they can update Jquery without any work, and since I did the digging already I wanted to get other developers excited about Jquery 1.11.  If  currently you try to update the Jquery Nuget package via the package manager currently is will only display Jquery 2.x.x which may break some javascript instead use the simply use the command console to update.  So if your using Jquery's Nuget package with your Asp.net MVC application it's easy to update from 1.10 to 1.11. There is no breaking changes from what I have read with the update and if you're trying to support IE8 you should be in the clear as well. Command PM> Install-Package jQuery -Version 1.11.0 Also just as a personal note I find the  warning message that appears for jquery 1.10 to be extremely annoying and I feel its my mission to help out others by removing it from the internet. Update Can I keep Nuget on the jQuery 1.9.x/1.x path

Asp.net MVC: Partial View to handle Multiple Models

    I was working on this idea a few years back and the idea was to make two partial views in an asp.net MVC more scalable. I was looking the down road for something that could handle whatever the object was and display it. What I later discovered thanks to a colleague was that I should just do a reflection of the object but I feel the better longer term solution could be found in  third link  of resources. Rather than spend anymore time on this idea I simply kept the two partial views and wrote this down as I have bigger plans with this strategy in mind for a project. Resources Using partial views in ASP.net MVC 4 - Stack Overflow How to get the list of properties of a class? - Stack Overflow How to get data to my view that comes from more than one object? - Stack Overflow When To Use Templates vs When to Use Partial Views - Stack Overflow ASP.NET MVC 3 Partial View Template - Stack Overflow

Create Custom Webconfigs in Asp.Net MVC

Image
   Here are some highlighted notes on creating a custom web-config, that I wrote after finding a very quick and easy solution to. Overall the process is very easy to get started just I felt pictures were needed because the solution I found lacked any. Start of our Application Without editing, and by default Asp.net MVC comes with a Debug and Release config but since I like to create a QA stage for my configurations with all my application another webconfig needs to be added. Now right click on the project solution and go to properties , this will bring up the configuration manager. You can also just click on the build tab shown in the second image below. Configuration Manager/Properties Under the configuration tab and inside the dropdown simply select "New" and add in your custom Config name, for this article I just name mine example. Important keep the l eave the "create new project configurations" check." If not checked you will not be able to

Asp.Net MVC Warning Msg: "Consider app.config Remapping of Assembly"

    I don't like to ignore warnings if I can help it so looking at the output window in Visual Studio I can see the following message listed in the title. I make it my goal once a project is working and completely setup to go back and clean out as many warnings as possible which in most cases I do this while I'm working. There are a lot of ways to see this warning message but one of the reasons that it appears for me is from updating packages. For one reason or another some packages aren't updating properly and the older versions are still being pointed to in one or more webconfigs.     There are two approaches I have found to solve this, one is updating the webconfigs manually which will require you to look at the packages and versions being pointed to in the webconfigs. Or you can try the using Nuget command console. Targeting just the packages that appears in the warning message, and re-installing. This sometimes will work but if that fails there is a step had to I try

Setting up QunitJs for Asp.net MVC Debugging

    Using  QUnit  is important for me on some of my projects that are more front-end driven. So developing, debugging and testing all need to happen in javascript but without being in the final production. One thing I do not want to do is include the QunitJs in my bundles and would serve no purpose because the bundling and minifying does not happen for debugging. Instead what I did was create an extension method and return a bool, like the one shown in the resources. //Location ../Helpers/IsDebugging public static bool IsDebugging(this HtmlHelper helper) { #if DEBUG return true; #else return false; #endif } //Location ../Views/Shared/_Layout.cshtml //These two files are not apart of any bundled packages. @ if(Html.IsReleaseBuild()) { @ Scripts.Render( "~/Scripts/qunit-1.14.0.js" ) @ Styles.Render( "~/Content/qunit-1.14.0.css" ) } Side Notes The intellisense will do some weird things with the coloring for code inside the else sta

Integrating Orchard CMS with an Existing MVC Apps

I have created multiple modules within the Orchard CMS framework and even setup complete systems that have helped maintain internal data but after all that I still had a question for myself. Can I use Orchard for a project where Orchard was not the focus of the application and integrated with existing applications. So in other words Orchard was an extension or a sub application. Resources Orchard Project - Integrate Orchard with existing asp.net web forms site asp.net mvc - How do I integrate Orchard CMS with a current MVC2 application? - Stack Overflow .net - Integrate existing ASP.NET MVC application with Orchard CMS - Stack Overflow Orchard Project - Integrating Orchard into existing MVC site Orchard Project - Can I integrate nopCommerce with Orchard Theory Using MVC's Area concept you might be able to create a MVC application and have Orchard rest inside the created area and if you wanted also have your database on a single or separate instance from the Orchard solut

Popular posts from this blog

UI-Bootstrap Collapsible Sticky Footer

Installing Windows on Acer chromebook 15 cb3-532

Aspetcore: NLog with Postgresql