Search Results

Search found 6941 results on 278 pages for 'drupal views'.

Page 74/278 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Rails view - user enters minutes, we save seconds?

    - by sscirrus
    Hi everyone, I have a simple text_field in my form where a user enters a time in minutes, i.e. 60. How can I multiply that number by 60 before saving the form, such that the database stores the number in seconds? Then, how do I reverse that and show the field in minutes on another view? Thank you!

    Read the article

  • SQL Server, View using multiple select statements

    - by phil
    I've banging my head for hours, it seems simple enough, but here goes: I'd like to create a view using multiple select statements that outputs a Single record-set Example: CREATE VIEW dbo.TestDB AS SELECT X AS 'First' FROM The_Table WHERE The_Value = 'y' SELECT X AS 'Second' FROM The_Table WHERE The_Value = 'z' i wanted to output the following recordset: Column_1 | Column_2 'First' 'Second' any help would be greatly appreciated! -Thanks.

    Read the article

  • JQuery within a partial view not being called

    - by XN16
    I have a view that has some jQuery to load a partial view (via a button click) into a div in the view. This works without a problem. However within the partial view I have a very similar bit of jQuery that will load another partial view into a div in the first partial view, but this isn't working, it almost seems like the jQuery in the first partial view isn't being loaded. I have tried searching for solutions, but I haven't managed to find an answer. I have also re-created the jQuery function in a @Ajax.ActionLink which works fine, however I am trying to avoid the Microsoft helpers as I am trying to learn jQuery. Here is the first partial view which contains the jQuery that doesn't seem to work, it also contains the @Ajax.ActionLink that does work: @model MyProject.ViewModels.AddressIndexViewModel <script> $(".viewContacts").click(function () { $.ajax({ url: '@Url.Action("CustomerAddressContacts", "Customer")', type: 'POST', data: { addressID: $(this).attr('data-addressid') }, cache: false, success: function (result) { $("#customerAddressContactsPartial-" + $(this).attr('data-addressid')) .html(result); }, error: function () { alert("error"); } }); return false; }); </script> <table class="customers" style="width: 100%"> <tr> <th style="width: 25%"> Name </th> <th style="width: 25%"> Actions </th> </tr> </table> @foreach (Address item in Model.Addresses) { <table style="width: 100%; border-top: none"> <tr id="[email protected]"> <td style="width: 25%; border-top: none"> @Html.DisplayFor(modelItem => item.Name) </td> <td style="width: 25%; border-top: none"> <a href="#" class="viewContacts standardbutton" data-addressid="@item.AddressID">ContactsJQ</a> @Ajax.ActionLink("Contacts", "CustomerAddressContacts", "Customer", new { addressID = item.AddressID }, new AjaxOptions { UpdateTargetId = "customerAddressContactsPartial-" + @item.AddressID, HttpMethod = "POST" }, new { @class = "standardbutton"}) </td> </tr> </table> <div id="[email protected]"></div> } If someone could explain what I am doing wrong here and how to fix it then I would be very grateful. Thanks very much.

    Read the article

  • Foreign Key Relationships

    - by Yehonathan Quartey
    I have two models class Subject(models.Model): name = models.CharField(max_length=100,choices=COURSE_CHOICES) created = models.DateTimeField('created', auto_now_add=True) modified = models.DateTimeField('modified', auto_now=True) syllabus = models.FileField(upload_to='syllabus') def __unicode__(self): return self.name and class Pastquestion(models.Model): subject=models.ForeignKey(Subject) year =models.PositiveIntegerField() questions = models.FileField(upload_to='pastquestions') def __unicode__(self): return str(self.year) Each Subject can have one or more past questions but a past question can have only one subject. I want to get a subject, and get its related past questions of a particular year. I was thinking of fetching a subject and getting its related past question. Currently am implementing my code such that I rather get the past question whose subject and year correspond to any specified subject like this_subject=Subject.objects.get(name=the_subject) thepastQ=Pastquestion.objects.get(year=2000,subject=this_subject) I was thinking there is a better way to do this. Or is this already a better way? Please Do tell ?

    Read the article

  • Android - How can I access a View object instantiated in onCreate in onResume?

    - by Chris
    In my onCreate() method, I'm instantiating an ImageButton View: public void onCreate(Bundle savedInstanceState) { Log.d(AntengoApplication.LOG_TAG, "BrowsePicture onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.layout_post); final ImageButton ib = (ImageButton) findViewById(R.id.post_image); ... In onResume, I want to be able to change the properties of the ImageButton with something like: @Override protected void onResume() { super.onResume(); ib.setImageURI(selectedImageUri); } //END onResume But onResume doesn't have access to the ib ImageButton object. If this were a variable, I'd simple make it a class variable, but Android does not allow you to define View object in the class. Any suggestions on how to do this?

    Read the article

  • how can i query a table that got split to 2 smaller tables? Union? view ?

    - by danfromisrael
    hello friends, I have a very big table (nearly 2,000,000 records) that got split to 2 smaller tables. one table contains only records from last week and the other contains all the rest (which is a lot...) now i got some Stored Procedures / Functions that used to query the big table before it got split. i still need them to query the union of both tables, however it seems that creating a View which uses the union statement between the two tables lasts forever... that's my view: CREATE VIEW `united_tables_view` AS select * from table1 union select * from table2; and then i'd like to switch everywhere the Stored procedure select from 'oldBigTable' to select from 'united_tables_view'... i've tried adding indexes to make the time shorter but nothing helps... any Ideas? PS the view and union are my idea but any other creative idea would be perfect! bring it on! thanks!

    Read the article

  • Showing a view in Eclipse

    - by Krt_Malta
    Hi. I'm developing a plug-in in Eclipse and I want to show a view. I'm using this: PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(s); however it's being added on the right not at the bottom where I want it. How can I specify the location? Thanks and regards Krt_Malta

    Read the article

  • ERROR: there is no parameter $1 when creating view

    - by idlemoments
    When we try to create a view within a funcion we get ERROR: there is no parameter $1. This is the sample code. Begin CREATE VIEW artikelnr AS SELECT datum, 'uitgifte' as "type", CASE WHEN 'test'='test' THEN 0 END as "aantal ontvangen", aantal as "aantal uitgegeven" FROM uitgifteregel JOIN artikel ON artikel.artikelnr = new.artikelnr JOIN uitgifte ON uitgifte.uitgiftenr = uitgifteregel.uitgiftenr UNION SELECT datum, 'ontvangst' as "type", aantal as "aantal ontvangen" , CASE WHEN 'test'='test' THEN 0 END as "aantal uitgegeven" FROM ontvangstregel JOIN artikel ON artikel.artikelnr = new.artikelnr JOIN ontvangst ON ontvangst.ontvangstnr = ontvangstregel.ontvangstnr; Return new; end; When we replace new.artikelnr on line 7 with value 1 it works like it should, but the function needs to work with different artikelnr's. example line 7: JOIN artikel ON artikel.artikelnr = new.artikelnr Please point us in the right direction.

    Read the article

  • Select distinct ... inner join vs. select ... where id in (...)

    - by Tonio
    I'm trying to create a subset of a table (as a materialized view), defined as those records which have a matching record in another materialized view. For example, let's say I have a Users table with user_id and name columns, and a Log table, with entry_id, user_id, activity, and timestamp columns. First I create a materialized view of the Log table, selecting only those rows with timestamp some_date. Now I want a materliazed view of the Users referenced in my snapshot of the Log table. I can either create it as select * from Users where user_id in (select user_id from Log_mview), or I can do select distinct u.* from Users u inner join Log_mview l on u.user_id = l.user_id (need the distinct to avoid multiple hits from users with multiple log entries). The former seems cleaner and more elegant, but takes much longer. Am I missing something? Is there a better way to do this?

    Read the article

  • Capturing Drupal7 DOM content before page load for comparison

    - by ehime
    We have an MU (Multisite) installation of Drupal7 here at work, and are trying to temporarily hold back the swarm of bots we receive until we get a chance to load our content. I wrote a quick and and dirty script to send 503 headers if we find a certain criteria in Xpath (This can ALSO be done as a strpos/preg_match if DOM is not formed). In order to get the ball rolling though I need to figure out how to either A) Hijack the Drupal7 bootstrap and pull all content through this filter below B) ob_flush content through the filter before content is loaded The issue that I am having is figuring out exactly where I can catch the content at? I thought that index.php in Drupal7 would be the suspect, but I'm a little confused as to where or how I should capture the contents. Here's the script, and hopefully someone can point me in the right direction. //error_reporting(-1); /* start query */ $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->Load($_SERVER['PHP_SELF']); $xpath = new DOMXPath($dom); //if this exists we aren't ready to be read by bots $query = $xpath->query(".//*[@id='block-views-about-this-site-block']/div/div/div"); //or $query = 'klat-badge'; //if this is a string not DOM /* end query */ if(strpos($query) !== false) { //require banlist require('botlist.php'); $str = strtolower('/'.implode('|', array_unique($list)).'/i'); if(preg_match($str, strtolower($_SERVER['HTTP_USER_AGENT']))) { //so tell bots we're broken header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); exit; } }

    Read the article

  • Physical Directories vs. MVC View Paths

    - by Rick Strahl
    This post falls into the bucket of operator error on my part, but I want to share this anyway because it describes an issue that has bitten me a few times now and writing it down might keep it a little stronger in my mind. I've been working on an MVC project the last few days, and at the end of a long day I accidentally moved one of my View folders from the MVC Root Folder to the project root. It must have been at the very end of the day before shutting down because tests and manual site navigation worked fine just before I quit for the night. I checked in changes and called it a night. Next day I came back, started running the app and had a lot of breaks with certain views. Oddly custom routes to these controllers/views worked, but stock /{controller}/{action} routes would not. After a bit of spelunking I realized that "Hey one of my View Folders is missing", which made some sense given the error messages I got. I looked in the recycle bin - nothing there, so rather than try to figure out what the hell happened, just restored from my last SVN checkin. At this point the folders are back… but… view access  still ends up breaking for this set of views. Specifically I'm getting the Yellow Screen of Death with: CS0103: The name 'model' does not exist in the current context Here's the full error: Server Error in '/ClassifiedsWeb' Application. Compilation ErrorDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: CS0103: The name 'model' does not exist in the current contextSource Error: Line 1: @model ClassifiedsWeb.EntryViewModel Line 2: @{ Line 3: ViewBag.Title = Model.Entry.Title + " - " + ClassifiedsBusiness.App.Configuration.ApplicationName; Source File: c:\Projects2010\Clients\GorgeNet\Classifieds\ClassifiedsWeb\Classifieds\Show.cshtml    Line: 1 Compiler Warning Messages: Show Detailed Compiler Output: Show Complete Compilation Source: Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 Here's what's really odd about this error: The views now do exist in the /Views/Classifieds folder of the project, but it appears like MVC is trying to execute the views directly. This is getting pretty weird, man! So I hook up some break points in my controllers to see if my controller actions are getting fired - and sure enough it turns out they are not - but only for those views that were previously 'lost' and then restored from SVN. WTF? At this point I'm thinking that I must have messed up one of the config files, but after some more spelunking and realizing that all the other Controller views work, I give up that idea. Config's gotta be OK if other controllers and views are working. Root Folders and MVC Views don't mix As I mentioned the problem was the fact that I inadvertantly managed to drag my View folder to the root folder of the project. Here's what this looks like in my FUBAR'd project structure after I copied back /Views/Classifieds folder from SVN: There's the actual root folder in the /Views folder and the accidental copy that sits of the root. I of course did not notice the /Classifieds folder at the root because it was excluded and didn't show up in the project. Now, before you call me a complete idiot remember that this happened by accident - an accidental drag probably just before shutting down for the night. :-) So why does this break? MVC should be happy with views in the /Views/Classifieds folder right? While MVC might be happy, IIS is not. The fact that there is a physical folder on disk takes precedence over MVC's routing. In other words if a URL exists that matches a route the pysical path is accessed first. What happens here is that essentially IIS is trying to execute the .cshtml pages directly without ever routing to the Controller methods. In the error page I showed above my clue should have been that the view was served as: c:\Projects2010\Clients\GorgeNet\Classifieds\ClassifiedsWeb\Classifieds\Show.cshtml rather than c:\Projects2010\Clients\GorgeNet\Classifieds\ClassifiedsWeb\Views\Classifieds\Show.cshtml But of course I didn't notice that right away, just skimming to the end and looking at the file name. The reason that /classifieds/list actually fires that file is that the ASP.NET Web Pages engine looks for physical files on disk that match a path. IOW, when calling Web Pages you drop the .cshtml off the Razor page and IIS will serve that just fine. So: /classifieds/list looks and tries to find /classifieds/list.cshtml and executes that script. And that is exactly what's happening. Web Pages is trying to execute the .cshtml file and it fails because Web Pages knows nothing about the @model tag which is an MVC specific template extension. This is why my breakpoints in the controller methods didn't fire and it also explains why the error mentions that the @model key word is invalid (@model is an MVC provided template enhancement to the Razor Engine). The solution of course is super simple: Delete the accidentally created root folder and the problem is solved. Routing and Physical Paths I've run into problems with this before actually. In the past I've had a number of applications that had a physical /Admin folder which also would conflict with an MVC Admin controller. More than once I ended up wondering why the index route (/Admin/) was not working properly. If a physical /Admin folder exists /Admin will not route to the Index action (or whatever default action you have set up, but instead try to list the directory or show the default document in the folder. The only way to force the index page through MVC is to explicitly use /Admin/Index. Makes perfect sense once you realize the physical folder is there, but that's easy to forget in an MVC application. As you might imagine after a few times of running into this I gave up on the Admin folder and moved everything into MVC views to handle those operations. Still it's one of those things that can easily bite you, because the behavior and error messages seem to point at completely different  problems. Moral of the story is: If you see routing problems where routes are not reaching obvious controller methods, always check to make sure there's isn't a physical path being mapped by IIS instead. That way you won't feel stupid like I did after trying a million things for about an hour before discovering my sloppy mousing behavior :-)© Rick Strahl, West Wind Technologies, 2005-2012Posted in MVC   IIS7   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Apress Deal of the Day - 5Mar/2011 - Crafting Digital Media: Audacity, Blender, Drupal, GIMP, Scribus, and other Open Source Tools

    - by TATWORTH
    Today's Apress $10 deal of the day at http://www.apress.com/info/dailydeal has been on before. I have a copy and it is useful read on open source applications for Windows. Crafting Digital Media: Audacity, Blender, Drupal, GIMP, Scribus, and other Open Source Tools Open source software, also known as free software, now offers a creative platform with world-class programs. Crafting Digital Media is your foundation course in photographic manipulation, illustration, animation, making music, video editing, and more using open source software.

    Read the article

  • Using Drupal to build a directory listing? [on hold]

    - by Jim
    I am trying to create a form inside Drupal that will allow me to create a directory similar to this diagram: http://i.imgur.com/EtChBbG.jpg I tried looking into HTML tables but it is too basic for what I'm trying to do. How do I create a directory that can archive data in an alphabetical ordering? It also has to be able to sort by letters and other categories. Does anyone have an idea of how I should go about doing this? Thanks!

    Read the article

  • Stream classes ... design, pattern for creating views over streams

    - by ToxicAvenger
    A question regarding the design of stream classes - I need a pattern to create independent views over a single stream instance (in my case for reading). A view would be a consecutive part of the stream. The problem I have with the stream classes is that the state (reading or writing) is coupled with the underlying data/storage. So if I need to partition a stream into different segments (whether segments overlap or not doesn't matter), I cannot easily create views over the stream, the views would store start and end position. Because reading from a view - which would translate to reading from the underlying stream adjusted based on the start/end positions - would change the state of the underlying stream instance. So what I could do is take a read on a view instance, adjust the Position of the stream, read the chunks I need. But I cannot do that concurrently. Why is it designed in such a way, and what kind of pattern could I implement to create independet views over a single stream instance which would allow to read/write independently (and concurrently)?

    Read the article

  • Understanding REST: is GET fundamentally incompatible with any "number of views" counter?

    - by cocotwo
    I'm trying to understand REST. Under REST a GET must not trigger something transactional on the server (this is a definition everybody agrees upon, it is fundamental to REST). So imagine you've got a website like stackoverflow.com (I say like so if I got the underlying details of SO wrong it doesn't change anything to my question), where everytime someone reads a question, using a GET, there's also some display showing "This question has been read 256 times". Now someone else reads that question. The counter now is at 257. The GET is transactional because the number of views got incremented and is now incremented again. The "number of views" is incremented in the DB, there's no arguing about that (for example on SO the number of time any question has been viewed is always displayed). So, is a REST GET fundamentally incompatible with any kind of "number of views" like functionality in a website? So should it want to be "RESTFUL", should the SO main page either stop display plain HTML links that are accessed using GETs or stop displaying the "this question has been viewed x times"? Because incrementing a counter in a DB is transactional and hence "unrestful"? EDIT just so that people Googling this can get some pointers: From http://www.xfront.com/REST-Web-Services.html : 4. All resources accessible via HTTP GET should be side-effect free. That is, the request should just return a representation of the resource. Invoking the resource should not result in modifying the resource. Now to me if the representation contains the "number of views", it is part of the resource [and in SO the "number of views" a question has is a very important information] and accessing it definitely modifies the resource. This is in sharp contrast with, say, a true RESTFUL HTTP GET like the one you can make on an Amazon S3 resource, where your GET is guaranteed not to modify the resource you get back. But then I'm still very confused.

    Read the article

  • Configuring bind9 views so I can have DNS services?

    - by Cesar Downs
    I want to configure bind9 using the Ubuntu terminal to have the DNS resolve a local name, not a domain name. For example, if I type in Nicole it will resolve my IP address in a local network fashion. How can I do this, step-by-step please? I've already installed bind9 using: sudo apt-get install bind9 It's fully installed now, I just need some help configuring. Should I be using local views? I am going to do the connection with two laptops probably connected to each other by Ethernet cable or WIFI. One of them is running Ubuntu and the other is running Windows. I not sure if that's part of the problem.

    Read the article

  • How to compare page views/visitors to site totals in Google Analytics?

    - by frntk
    I want to measure the effects in total traffic (views or visitors) of a single URL across a time frame. For example, let's say I published a blog post on July 2012. I want to measure what chunk of the site's total traffic is coming to this particular post on a month-by-month graph from July 2012 to date. Is there a way to do this? Edit: I should clarify that what I'd like to do is to generate a month-to-month graph, similar to the one you can see comparing a metric on a period of time against the previous equivalent period (year vs last year, for example) but comparing a particular URL traffic to the site's total traffic. In other words, I can get to the part where I can see the URL's traffic for the timeframe I selected and it shows how much of the total traffic corresponds to the current URL: But I'd like to add a second line to the graph, representing the site's total pageviews, similiar to this (but this one is showing just a different metric for the same URL): Thanks!

    Read the article

  • .htaccess rewrite rule to add a string in the middle of the URL

    - by Mike Crittenden
    Using a .htaccess rewrite rule, I need to add "?q=" before the path on any URL's containing the word "imagecache" Therefore, if the URL is: http://mysite.com/sites/default/files/imagecache/myimage.jpg ...then it will really try: http://mysite.com/?q=sites/default/files/imagecache/myimage.jpg But that will ONLY happen if the URL contains "imagecache." Otherwise, it does no rewriting. Also, this will only happen if /sites/default/files/imagecache/myimage.jpg isn't already an existing image file. I believe I can do that using: RewriteCond %{REQUEST_FILENAME} !-f ...right? It's just the first part that I can't figure out.

    Read the article

  • Stop a custom submit button from firing the form validation on a CCK form

    - by kidrobot
    I've added a submit button inside a fieldgroup on a CCK form using hook_form_alter as follows: function mymodule_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'object_node_form') { $form['group_wikipedia']['search'] = array( '#type' => 'submit', '#value' => t('Search Wikipedia'), '#name' => 'searchwiki', '#submit' => array('mymodule_searchwiki_submit'), ); } } When I press the button, the validation handlers for the full form eg. checks for required fields, run as though I have pressed the 'Submit' button at the end of the form. I thought that changing the #name property from 'op' to 'searchwiki' would prevent this kind of mix-up, but not so. Does anyone know a workaround for this?

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >