views

displaying # views on a page without hitting database all the time

萝らか妹 提交于 2019-12-10 17:49:39
问题 More and more sites are displaying the number of views (and clicks like on dzone.com) certain pages receive. What is the best practice for keeping track of view #'s without hitting the database every load? I have a bunch of potential ideas on how to do this in my head but none of them seem viable. Thanks, first time user. 回答1: I would try the database approach first - returning the value of an autoincrement counter should be a fairly cheap operation so you might be surprised. Even keeping a

Cakephp Helpers in Views and $this

天涯浪子 提交于 2019-12-10 17:47:46
问题 I'm trying to determine what the best standard is for using helpers in views whether is should be echo $form->input(); or echo $this->Form->input(); In the CakePHP manual ver 1.2 the Helper class is accessed by the helper object directly, whereas in the 1.3 book the helper object is accessed through the View. Does this matter? Leo 回答1: It really only matters because of the possibility of having a collision that will "wipe out" your access to the helper. Say I had a model named Form and

Is ORDER BY honoured in SQL Server views?

☆樱花仙子☆ 提交于 2019-12-10 14:08:13
问题 In this answer to What are the downsides of using SqlServer Views?, hyprsleepy suggests the ORDER BY clause is not honoured in views in SQL Server. Could anyone explain why this is the case? Edit: Thanks for the answers, but I'm not sure thats the issue. I know you cant add an Order By Clause to a view and I dont have a problem with that, you just add it to the SELECT statement when calling the view, but my impression from the other question was that using an Order By Clause in a SELECT

Where to put view logic?

北城以北 提交于 2019-12-10 11:09:17
问题 I am a little confused regarding the design patterns of ASP.NET MVC. I have a Masterpage including a partial view that renders breadcrumbs: <div id="header"> <strong class="logo"><a href="#">Home</a></strong> <% Html.RenderPartial("BreadCrumbs"); %> The thing is, I want the breadcrumb links to work both in production and in my dev environment. So my code in the partial view goes something like this: <p id="breadcrumbs"> You are here: <a href="http:// <% if (Request.Url.IsLoopback) Response

In Zend Framework applications, what purpose does the /views/filters serve?

妖精的绣舞 提交于 2019-12-10 10:49:43
问题 I have an idea of what view helpers do (/view/helpers), but I have no idea what a view filter (/view/filters) is, or what its used for, can some one please shed some light on the matter? Thank You =) 回答1: At the end of rendering a view, Zend_View passes the output to any filter(s) you have registered, by calling the filter() method on the filter object. One use of a filter could be to minify HTML output, stripping comments and whitespace to reduce the size of the content to send over the

Performance considerations when using MySQL VIEWs

依然范特西╮ 提交于 2019-12-10 10:23:19
问题 I was considering using MySQL views to provide an abstraction when pulling data from the DB. As I was looking for material on this, I came across this article, which ends with: MySQL has long way to go getting queries with VIEWs properly optimized. The article is from 2007. Is this still applicable? Eg: Has MySQL solved these issues? 回答1: MySQL views work fine functionally, but they perform badly in the majority of cases. This is because introducing even quite a simple view tends to cause a

Updating Views in MySQL

淺唱寂寞╮ 提交于 2019-12-10 09:27:36
问题 I am creating a view to show the user his/her data, but I also want the user to be able to make changes in some of the fields in those views. Are the changes made in a view reflected in the base table as well? Also, would I be able to update a view that is made up of more than one base table? 回答1: As documented under Updatable and Insertable Views: Some views are updatable. That is, you can use them in statements such as UPDATE, DELETE, or INSERT to update the contents of the underlying table

SQL Server indexed views

独自空忆成欢 提交于 2019-12-10 01:47:41
问题 I am trying to create an indexed view in SQL Server and I was wondering If I needed to index the view columns. I am asking this because the view is composed of a tables that already have the columns indexed. So if TABLE1 has the column FOO already indexed as a non clustered index, do I have to add an index for the column FOO to the newly created view for SQL Server to use the index? Or will SQL Server know to use the index in TABLE1 when searching the view? The view looks like this CREATE

Difference Between Views and Tables in Performance

被刻印的时光 ゝ 提交于 2019-12-10 01:31:45
问题 What is best for tables with a lot of data? I have a stored procedure that creates a report based on some filters. In my SP I read the table and put all the inner joins and formulas then in the where condition I put the filters. Talking about performance what's better? Create a view with all the joins OR read the table (as I'm doing)? 回答1: Performance is a lot more dependent on having the appropriate indexes than if you are using a view or direct table access, which (except for materialized

Laravel generate models, views and controllers from database or migration script

大憨熊 提交于 2019-12-10 00:03:05
问题 I am new to Laravel 4. I wanted to know if it is possible to generate Models , Views and Controllers from existing database? I Googled and found https://github.com/JeffreyWay/Laravel-4-Generators But it allow to generate migration script, model, views and controllers by providing resource name where as i want to reverse engineering of the same in which by command line i want to create models, views and controllers from the existing database. 回答1: php artisan generate:model dbtablename it will