views

bigquery backup all view definitions

不羁岁月 提交于 2020-01-11 05:46:06
问题 I am working with bigquery, and there have been a few hundred views created. Most of these are not used and should be deleted. However, there is a chance that some are used and I cannot just blindly delete all. Therefore, I need to backup all view definitions somehow before deleting them. Does anyone know of a good way? I am not trying to save the data, just the view definition queries and their names. Thanks for reading! 回答1: Part 1. Issue the bq ls command. The --format flag can be used to

Rails - Displaying Foreign Key References in a form

不问归期 提交于 2020-01-10 07:59:07
问题 I'm doing a simple exercise with two models. Sport and Teams, defined as rails g scaffold sport name:integer rails g scaffold team name:integer fans:integer sport:references (Note: The reason I'm using scaffold is rapidly prototyping so I can learn/experiment with the parts I'm not familiar with yet) Problem is that my "sport" (i.e. the foreign key reference) is showing like the following So it's got that weird #<blahl blah> notation to it... <%= form_for(@team) do |f| %> <% if @team.errors

Creating readonly views in Sql Server

孤街浪徒 提交于 2020-01-09 07:44:06
问题 According to MSDN, views composed of simple selects automatically allow you to use insert/update/delete statements on the table. Is there a way to prevent this - to tell Sql Server that the view is readonly, and you can't use it to modify the table? 回答1: The best way would be to remove UPDATE/DELETE/INSERT permissions on the View. Apart from that you could create an INSTEAD OF trigger on the view that simply does nothing to have the updates silently fail or there are quite a few constructs

How to handle views in a multilayer-application

被刻印的时光 ゝ 提交于 2020-01-07 06:27:51
问题 I'm working on a project which has basically three layers: Presentation, business and data. Each layer is on a different project and all layers use DTO's defined in another project. business layer and data layer return DTO's or Lists of DTOs when querying the database. So far so good, but now we have to query views and those views of course do not match an existant DTO. What we have done until now is just create a special DTO, business- and data-layer classes so they were treated like normal

Opening .html.erb files in browser

早过忘川 提交于 2020-01-07 04:10:54
问题 Is there a way to open .html.erb files by themselves in the browser. The Rails app I am trying to have a look at is in rails 2.3 and will not run locally on the rails server nor will it run when I give the command script/server. I would just like to open the individual views in the browser by themselves...is this possible? 回答1: You can open them in the browser, but the <% %> and <%= %> tags will get shown as-is instead of executing the Ruby code. These are template files that need to get

A Drupal view to show the top rated node per day, each day for a year?

 ̄綄美尐妖づ 提交于 2020-01-05 05:30:47
问题 I have a site with user generated stories. Stories are nodes. Stories are rated with Fivestar. I want to create a calendar style view to list the top rated story - every day, for the current year. So at the end I will have a list of 365 stories. I'm not sure how to approach this, any help would be great. 回答1: You could make a View that takes a Date argument, where you'll pass a specific day', and return results sorted by Fivestar rating, and limiting the View to 1 result. Then in your custom

Dynamic SQL with variables inside a view (SQL Server)

末鹿安然 提交于 2020-01-04 15:30:25
问题 Hello I'm essentially trying to do this inside a new view window in SQL Server 2008: declare @var = (select db from databases); exec ('select name from ' + @var ' + .dbo.Names); This view actually runs in SQL Server but I cannot save it (it gives me an error), I could potentially just create a table returning function, do all of this same stuff in it and return the table and create a view that basically takes everything from that table but I was unsure of performance hits that could occur

Kendo ui Grid shows json instead of grid Asp .net razor

*爱你&永不变心* 提交于 2020-01-04 15:16:27
问题 I trying to initialize my Kendo ui grid. I am able to populate it using the View object, but when I try doing it in Json format (i.e. when moving to next page) I get a screen showing json results instead of my view. Here's the controller code: public class CampaignsController : Controller { // // GET: /Campaigns/ [HttpGet] public ActionResult Index() { return View(GetAllCampaigns()); } public ActionResult Campaigns_Read([DataSourceRequest] DataSourceRequest request) { DataSourceResult result

Codeigniter using foreach in view

萝らか妹 提交于 2020-01-03 17:01:09
问题 I'm using Codeigniter on an Apache xampp set up and attempting to use foreach in a view for the first time and I just can't get it to work. My Controller code: class Test extends CI_Controller { public function index($page = 'testv') { if ( ! file_exists(APPPATH.'/views/'.$page.'.php')) { show_404(); } $this->load->model('testm'); $data['news'] = $this->testm->get_news(); $this->load->view('headder'); $this->load->view($page, $data); $this->load->view('footer'); } } My Model: class Testm

Rails: Refactoring HTML producing helper method to use a partial - how to use blocks there?

こ雲淡風輕ζ 提交于 2020-01-03 05:28:30
问题 After my earlier question Developing helper functions that generate HTML: should I rather use nested content_tag()s or partials? I am convinced now to rewrite some of my more complex HTML generating helper functions to use templates instead of nested content_tag() calls. So here's my original helper: def bootstrap_navlist(&block) classes = ['nav', 'nav-list'] content_tag(:ul, class: classes.join(' ')) do capture(self, &block) end end And that's what I came up with using a partial now: def