|
Glad it's working out.
Marc Clifton wrote: I've decided not to use it. For what I need, it looks like I might use a wee bit of knockout, but we'll see -- it may be that jQuery can handle all the functionality that I require.
Just make sure your JS doesn't look like a big mess of DOM manipulation. It can be so much cleaner -- virtually zero DOM manipulation -- using something like Knockout.
Marc Clifton wrote: I also find it interesting how easy it is to absolutely ignore the whole "model" part of MVC. Mike's examples use code embedded in the cshtml which as a certain convenience but which I don't like. That means then, if I put the C# code into the controller, I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that.
Yep. Personally, if the view is small; if there's just one or two pieces of data from the server I need, ViewBag.WhateverINeed = 42 does the trick. But for anything more than just a couple pieces of data, that's when I use the full View("Index", new MyModel(..)) bits.
|
|
|
|
|
Marc Clifton wrote: Oh, and I hate style sheets.
Make sure you've got Mads Kristensen's Web Essentials[^] installed. It'll make your life so much easier!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Make sure you've got Mads Kristensen's Web Essentials[^] installed. It'll make your life so much easier!
Wow, thanks for the info - I'll definitely do that!
Marc
|
|
|
|
|
I use Mindscape web workbench[^] to do sass in visual studio. But it is starting to bog down as we've grown the number of files, so I might move to grunt at some point.
|
|
|
|
|
Andy Brummer wrote: I might move to grunt at some point.
This[^] might be useful, then.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, that's one of the things that made me consider it. I use grunt for a number of tasks when I do wordpress development, and I've had less problems with it than I have with Visual Studio and nuget.
The simple fact that nuget needs a -safe switch says volumes.
|
|
|
|
|
+1 for knockout -- easy to learn and use. Like angular, it can be applied to the DOM selectively so you can start out small.
IMHO the well argued catch-phrase "JavaScript is the Assembly Language of the Web" is mostly correct. CSS should also be included. The JS/CSS chaos is of course what's spawning all of these compilers, frameworks, and tools. The evolution of these higher level abstractions is still in its infancy (think fish with feet) so the ride is going to be rough for a while.
|
|
|
|
|
Using knockout and web API I found I could ignore the controller (as in view controller) part of MVC as well. Who needs loads of view controllers with actions that just return the relevant view?
You just need to tweak the HTTP handler so it's a bit smarter https://github.com/brentj73/ControllerLess[^]
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Brent Jenkins wrote: Who needs loads of view controllers with actions that just return the relevant view?
Exactly. I'm also not quite "getting it" with the whole model thing, other than the model giving you strongly typed fields, which is only marginally useful while in the C# paradigm, of which, when I look at the cshtml file, is maybe 10% of the entire markup. The rest is HTML and jQuery and working with JSON structures.
ControllerLess looks great - thanks for pointing that out.
Marc
|
|
|
|
|
Marc Clifton wrote: It is really really cool to be doing posts/gets to the server without having to reload the page.
If You didn't get there yet, you will see the delight it is to render partial views. Which is a combination of Razor+CodeBehind easy way of rendering and AJAX, without having to deal with Javascript.
blockquote class="quote">Marc Clifton wrote: One thing that's slightly annoying is that the view engine is so rigid.
Could you elaborate on that? My perception is that the view engine is anything but rigid.
Marc Clifton wrote: I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that.
Basically when you use the model instead of the ViewBag, you get a strongly typed view, which can make the view much more maintainable and not error prone. As the model is class, you can also add some behavior to your view models.
Marc Clifton wrote: you're pretty much coding in raw HTML.
I find that an advantage. In my case it not only forced me to really learn HTML, but it also makes it much easier to work on cross-browser bugs as you're in complete control. And in the end, HTML is actually the base for the web, so I think we are back where we should never have left.
Marc Clifton wrote: But I'm quite happy.
Awesome, I'm happy for you.
Marc Clifton wrote: Two days of concentrated effort have resulted in a grid that with a little polish will become a reusable mainstay component of this project.
You should consider jqGrid[^], it saves a lot of time, after you customizes it once. It also deals beautifully with paging.
Happy coding
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: You should consider jqGrid[^],
jqGrid looks pretty good. Horrid website though. Why the authors feel that a transparent roll-over for showing enlarged screenshots is actually readable is beyond me. Somebody was definitely smoking something when they were playing with the opacity setting.
I'll look into partial views.
Regarding the view engine, what I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor.
I'm exploring the usefulness of models. Actually, truth be told, I'm exploring the usefulness of the whole MVC concept. It's beginning to strike me as a lot of unnecessary baggage. What I'm leaning toward is a framework that just lets me wire up a method to handle the post/get/etc., otherwise, gets the f*** out of the way.
I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way. I suspect not.
Marc
|
|
|
|
|
Marc Clifton wrote: Somebody was definitely smoking something when they were playing with the opacity setting.
Yeah... developers...
Marc Clifton wrote: I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor.
I never worked with SASS, so I can't give you a definite answer for this, but whatever is supported on pure html, css applications, should be supported with Razor. I never found Razor to limit what you can already do purely in HTML or CSS. You can see Razor as a helper to build dynamic HTML and CSS with less effort.
Marc Clifton wrote: I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way.
Actually it is.Right out of the box you can use the AuthorizeAttribute to restrict access on entire views or actions by decorating them with no other programming required. AuthorizeAttribute will check if the user is logged in to decide wether to serve the Action/View. AllowAnonymous works the same way. For example, you can decorate the class the represents the controller with Authorize , which will make all of its actions require authentication. Later you can decorate one of the actions with Anonymous as an exception for the controller rule.
All of this makes a very safe way to restrict access, even to AJAX calls. Using roles will require a little bit of customization to match the roles of your application specifically. In any case, it hardly requires a lot of work and can save you a a lot of time implementing security.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: but whatever is supported on pure html, css applications, should be supported with Razor.
Yes, but that's the point. SASS and Slim are a non-CSS and non-HTML syntax. This is an example of Slim:
body
h1 Markup examples
Indentation is used to determine closing tags.
SASS is like SCSS in that it makes the CSS a lot more readable, but SASS also removes extraneous braces and semicolons, again relying on indentation:
nav
ul
margin: 0
padding: 0
list-style: none
vs. straight CSS:
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
I'm still poking around to see if Razor supports these options. Slim was definitely a Ruby plugin.
Marc
|
|
|
|
|
I actually prefer the traditional syntax, maybe my C/C# background pushes me to prefer it that way. Clear definitions where anything starts or ends. This kind of syntax remembers me of Visual Basic .
Marc Clifton wrote: if Razor supports these options. Slim was definitely a Ruby plugin.
I think that the right question should be if ASP.net supports it or if there is a Visual Studio plugin that will compile that syntax into pure CSS on build, much like it does with type script to javascript. In my experience, this should not have anything to do with the Razor rendering engine itself. Bear in mind that Razor is still compiled in the server side, although it's written in the view.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
MVC supports custom view engines, if you feel inclined to create one. The default is Razor. See: Creating your own MVC View Engine For MVC Application. You could, for example, create a Slim view engine.
Regarding SASS, you can use that in Visual Studio with an MVC application. Web Essentials can compile it, or you can use Compass to watch for changes and automatically compile to CSS.
|
|
|
|
|
Yes folks, I'm finally terminating my dedicated server. It has served me well (harhar), hosting a few sites, being an SVN repository for all my code, providing FTP services, but the day has come to recognize that a dedicated machine is being replaced by:
GitHub
Really cheap website hosting
SquareSpace
GDrive & DropBox
etc...
On the happy side, I will now have an extra $100/mo to play with.
(Oh yeah, lest you ask, it was hosted by ServerBeach -> Peer1. I was quite happy with their service.)
Marc
|
|
|
|
|
Drinks on Marc!
Life is like a s**t sandwich; the more bread you have, the less s**t you eat.
|
|
|
|
|
Every month!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: Every month!
Quite so!
Marc
|
|
|
|
|
Windows hosting is expensive. It's hard to compete with pricing on virtual linux servers like digital ocean[^]
|
|
|
|
|
Andy Brummer wrote: Windows hosting is expensive. It's hard to compete with pricing on virtual linux servers like digital ocean[^]
I actually have a DigitalOcean account. And the ASP.NET hosting that I found is cheap ($5/mo) and there's even cheaper out there. I don't need a VM I can PuTTY into, I just need an ASP.NET host with SQL Server.
Marc
|
|
|
|
|
I use Arvixe, and I've just had a reminder that my hosting is due for renewal at the end of the month: $60 for two years, same as it was two years ago. Windows, .NET, SQL server, unlimited email addresses, pretty much everything.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Yeah, I've got one client setup on arvixe and they have a good service. The only complaint I've had is that spam blocking on their email accounts is only so-so. Their dedicated windows virtual server costs are still way higher than $5 a month though.
|
|
|
|
|
Marc Clifton wrote: On the happy side, I will now have an extra $100/mo to play with.
That's the thing about saving money on one item, you end up spending it on another, at lease that is my M.O.
|
|
|
|
|
Well I decided against better judgment to renew my UK passport, technically I could survive on my US one, but what the hey.
Last time I renewed it in 2004 I overnighted it to the Embassy in DC - and 80 quid poorer and 3 days later received my renewed passport.
Monday evening I Fedex'd it to the much more convenient location of Durham, UK that is. They received it 6 hours ago.
Between shipping and the new fees this one will cost 145 quid, taking into account shipping and inflation I'd say it's costing me close to 30% more.
So for those who enjoy a betting game, any bets on when (if) I get it back?
|
|
|
|
|