Search Results

Search found 14500 results on 580 pages for 'model metadata'.

Page 9/580 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Django anonymous user in model

    - by jack
    I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other = models.CharField(max_length=100) The problem is Django refuses to assign django.contrib.auth.models.AnonymousUser directly to Example.user as null field so everytime I have to check if request.user.is_authenticated() ans assign Example.user = None manually. Is there a default value for AnonymousUser to use in a model field?

    Read the article

  • zend framework can't find Model classes ?

    - by user284503
    Yall: I have a simple question, it might be a simple configuration issue, but I have a Model defined, and when I try to access it from a controller it fails. The Model is in the model directory, and when I look at the quickstart app, it seems like this should work. Here is my model: <?php class Application_Model_User { protected $_user; protected $_password; protected $_userId; // very simple right } ?> My controller just stops.. here is the controller code: <?php class UserController extends Zend_Controller_Action { public function init() { } public function indexAction() { // display login form $users = new Application_Model_User(); echo "test never echos.. stopped above ? weird huh.."; // fails before .. } ?> Thank you everyone,

    Read the article

  • Alloy MVC Framework Titanium Network (Model)

    - by flyingDuck
    I'm trying to authenticate using the Model in Alloy. I have been trying to figure this problem out since yesterday. If anybody could help me, I'd really appreciate it. So, I have a view login.xml, then a controller login.js. The login.js contains the following function: var user = Alloy.Models.user; //my user.js model function login(e) { if($.username.value !== '' && $.password.value !== ''){ if(user.login($.username.value, $.password.value)){ Alloy.createController('home').getView().open(); $.login.close(); } }else{ alert('Username and/or Password required!'); } } Then in my user.js model, it's like this: extendModel : function(Model) { _.extend(Model.prototype, { login: function(username, password) { var first_name, last_name, email; var _this = this; var url = 'http://myurl.com/test.php'; var auth = Ti.Network.createHTTPClient({ onerror: function(e){ alert(e.error); }, onload: function(){ var json = this.responseText; var response = JSON.parse(json); if(response.logged == true){ first_name = response.f_name; last_name = response.l_name; email = response.email; _this.set({ loggedIn: 1, username: email, realname: first_name + ' ' + last_name, email: email, }); _this.save(); }else{ alert(response.message); } }, }); auth.open('POST', url); var params = { usernames: username, passwords: password, }; auth.send(params); alert(_this.get('email')); //alert email }, }); When I click on login in login.xml it calls the function login in index.js. So, now my problem is that, when I click the button for the first time, I get an empty alert from alert(_this.get('email')), but then when I click the button the second time, everything works fine, it alerts the email. I have no idea what's going on. Thank you for the help.

    Read the article

  • Proper design a Model-Controller in Cocoa?

    - by legege
    Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to represent a locally fetched version. How should the data be loaded initially? I'm reading the Cocoa Design Pattern book, and they talk about a Model-Controller that is centric to the Model. How would that be done? Thanks!

    Read the article

  • symfony 1.4: doctrine build model warning

    - by tigerstyle
    Hi volks, I copied my sources from my lokal dev (everything works fine) to my repository and from there I did a checkout on my remote dev. Now when I try to build everything I get this error: devel:/var/www/myproject# ./symfony doc:build-model doctrine generating model classes file+ /tmp/doctrine_schema_48726.yml Warning: file_get_contents(/var/www/myproject/lib/model/doctrine//base/BaseAdvert.class.php): failed to open stream: No such file or directory in /var/www/myproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php on line 77 Do you know what the problem could be? Thx for your answers :)

    Read the article

  • List of models in Model in MVC

    - by arri
    I have two models: class ModelIn{ public string FirstName { get; set; } public string LastName { get; set; } public string Address { get; set; } } class ModelOut{ public ModelOut(){ People = new List<ModelIn>();} public List<ModelIn> People { get; private set;} public string Country { get; set; } } And I have Controller editing ModelOut: public ActionResult People() { ... return View(SomeModelOutInstanceWith3People); } [HttpPost] public ActionResult(ModelOut m) { ... } In view I have sth like: <% using (Html.BeginForm()) { %> <%: Html.EditorFor(m => Model.Country) %> <% for(int i = 0; i < Model.People.Count; ++i){ %> <%: Html.EditorFor(m => Model.People[i].FirstName) %> <%: Html.EditorFor(m => Model.People[i].LastName) %> <%: Html.EditorFor(m => Model.People[i].Address) %> <% } %> <input type="submit" /> <% } %> It works all OK, but in post action I have empty ModelOut m. I can see in logs that data is sent correctly. I have tried everything, nothing works.

    Read the article

  • Django model help

    - by dotty
    Does anyone have any clue why this doesn't work as expected. If i use the python shell and do team.game_set or team.games It returns an error AttributeError: 'Team' object has no attribute 'game' If i create a Game object and call game.home_team it returns the correct team object Heres my model class Team(models.Model): name = models.CharField(blank=True, max_length=100) class Game(models.Model): home_team = models.ForeignKey(Team, related_name="home_team")

    Read the article

  • Error Handling in Model (MVC)

    - by Andre
    I was wondering what the excepted standard is for handling errors in the Model. Currently I have 'setError' and 'getError' methods that's in use by all my Models. This means I'm only concerned with whether a call to a method in my Model is true or false. If it's false then I would use $this-model-getError() in my Controller. Additionally I'm contemplating setting up a separate file that contains all my errors. One file per model, also wanted to have thoughts on this.

    Read the article

  • Implementing a Cakephp Model using an Array

    - by Zubin
    The CakePHP Cookbook states that a Model can use a file (csv for example) instead of an actual database table but I couldn't find any implementation for it. I was wondering if it is possible to use an Array of data as a model in CakePHP since I have a fairly static set of data which is important to me in a relationship with another table but it doesn't make a whole lot of sense to create a complete table for it. Is it possible to implement a CakePHP Model using an Array?

    Read the article

  • Codeigniter: Check where model is loaded from?

    - by qwerty
    I'm having the strangest thing ever right now. I "disabled" a model because i don't need to access it ever again. I did so by echoing out an error string in the __construct() and right after that die(). That way i would notice if i ever loaded the model, even by mistake, which should never happen. Alright? The problem is, the model is not loaded ANYWHERE in the entire project, but it still gets loaded for some reason. It's not auto loaded, that's for sure. Is it possible to track down where a model is loaded? Like which line it happens etc?

    Read the article

  • Formating a date field in the Model (Codeigniter)

    - by Landitus
    Hi, I', trying to re-format a date from a table in Codeigniter. The Controller is for a blog. I was succesfull when the date conversion happens in the View. I was hoping to convert the date in the Model to have things in order. This is the Model: class Novedades_model extends Model { function getAll() { $this->db->order_by('date','desc'); $query = $this->db->get('novedades'); if($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[] = $row; } } return $data; } } This is part of the controller $this->load->model('novedades_model'); $data['records'] = $this->novedades_model->getAll(); Here's the date conversion as it happens in the View. This is inside the posts loop: <?php foreach($records as $row) : ?> <?php $fdate = "%d <abbr>%M</abbr> %Y"; $dateConv = mdate($fdate, mysql_to_unix($row->date)); ?> <div class="article section"> <span class="date"><?php echo $dateConv ;?></span> ... Keeps going ... How can I convert the date in the Model? Can I access the date key and refactor it?

    Read the article

  • C#: Take Out Image Portion of JPEG to Backup Metadata?

    - by Carlo Mendoza
    This will be a little backwards from the typical approach. I've used ExifTool for metadata manipulation before, but I really want to keep the best metadata backup I can before I make anything permanent. What I want to do is remove the compressed image portion of a JPEG file to leave everything else intact. That's backing up EXIF, Makernotes, IPTC, XMP, etc whether at the beginning or end of the file. What I've tried so far is to strip all metadata from a copy of the original JPEG, and use it as a basis of what bytes will be taken out of the original. After looking at the raw data, it doesn't seem like the stripped copy is contiguous in the original copy. There may be some header information still remaining in the stripped version. I don't really know. Not a good way to do it, I suppose. Are there any markers that will absolutely tell me where the compressed JPEG image data starts and ends? I understand that JPEG files have 0xFFD8 and 0xFFD9 to mark the start and end of the image, but have come to find out that metadata is actually between those markers. I'm using C#. Thank you.

    Read the article

  • Is it possible to refer to metadata of the target from within the target implementation in MSBuild?

    - by mark
    Dear ladies and sirs. My msbuild targets file contains the following section: <ItemGroup> <Targets Include="T1"> <Project>A\B.sln"</Project> <DependsOnTargets>The targets T1 depends on</DependsOnTargets> </Targets> <Targets Include="T2"> <Project>C\D.csproj"</Project> <DependsOnTargets>The targets T2 depends on</DependsOnTargets> </Targets> ... </ItemGroup> <Target Name="T1" DependsOnTargets="The targets T1 depends on"> <MSBuild Projects="A\B.sln" Properties="Configuration=$(Configuration)" /> </Target> <Target Name="T2" DependsOnTargets="The targets T2 depends on"> <MSBuild Projects="C\D.csproj" Properties="Configuration=$(Configuration)" /> </Target> As you can see, A\B.sln appears twice: As Project metadata of T1 in the ItemGroup section. In the Target statement itself passed to the MSBuild task. I am wondering whether I can remove the second instance and replace it with the reference to the Project metadata of the target, which name is given to the Target task? Exactly the same question is asked for the (Targets.DependsOnTargets) metadata. It is mentioned twice much like the %(Targets.Project) metadata. Thanks. EDIT: I should probably describe the constraints, which must be satisfied by the solution: I want to be able to build individual projects with ease. Today I can simply execute msbuild file.proj /t:T1 to build the T1 target and I wish to keep this ability. I wish to emphasize, that some projects depend on others, so the DependsOnTargets attribute is really necessary for them.

    Read the article

  • What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model)

    - by Stephane
    Other than the type it returns and the fact that you call it differently of course <% Html.RenderPartial(...); %> <%= Html.Partial(...) %> If they are different, why would you call one rather than the other one? The definitions: // Type: System.Web.Mvc.Html.RenderPartialExtensions // Assembly: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll using System.Web.Mvc; namespace System.Web.Mvc.Html { public static class RenderPartialExtensions { public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName); public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, ViewDataDictionary viewData); public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, object model); public static void RenderPartial(this HtmlHelper htmlHelper, string partialViewName, object model, ViewDataDictionary viewData); } } // Type: System.Web.Mvc.Html.PartialExtensions // Assembly: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll using System.Web.Mvc; namespace System.Web.Mvc.Html { public static class PartialExtensions { public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName); public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName, ViewDataDictionary viewData); public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName, object model); public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string partialViewName, object model, ViewDataDictionary viewData); } }

    Read the article

  • How to remove Thumbnail property of a JPEG image without distrubing other Exif data in C ++ .net.

    - by Ravi shankar
    I have an application which edits the metadata part of the JPEG image. I have to remove the thumbnail metadata with out disturbing other metadata. I have tried out the code below but was not successful in removing thumbnail metadata. can some help me out in solving this query thanks in advance. array<String^>^ query = gcnew array<String^>(4); query[0] = "/app1/ifd/tiff:"; query[1] = "/app1/ifd/tiff/subifd:"; query[2] = "/ifd/tiff:"; query[3] = "/ifd/tiff/subifd:"; for each (String^ SetQuery in query) { metaData->RemoveQuery(SetQuery + "{uint=256}"); metaData->RemoveQuery(SetQuery + "{uint=257}"); metaData->RemoveQuery(SetQuery + "{uint=258}"); metaData->RemoveQuery(SetQuery + "{uint=259}"); metaData->RemoveQuery(SetQuery + "{uint=273}"); metaData->RemoveQuery(SetQuery + "{uint=262}"); metaData->RemoveQuery(SetQuery + "{uint=277}"); metaData->RemoveQuery(SetQuery + "{uint=278}"); metaData->RemoveQuery(SetQuery + "{uint=279}"); metaData->RemoveQuery(SetQuery + "{uint=282}"); metaData->RemoveQuery(SetQuery + "{uint=283}"); metaData->RemoveQuery(SetQuery + "{uint=284}"); metaData->RemoveQuery(SetQuery + "{uint=296}"); metaData->RemoveQuery(SetQuery + "{uint=513}"); metaData->RemoveQuery(SetQuery + "{uint=514}"); metaData->RemoveQuery(SetQuery + "{uint=529}"); metaData->RemoveQuery(SetQuery + "{uint=530}"); metaData->RemoveQuery(SetQuery + "{uint=531}"); metaData->RemoveQuery(SetQuery + "{uint=532}"); }

    Read the article

  • (Quaternion based) Trouble moving foward based on model rotation

    - by ChocoMan
    Using quaternions, I'm having trouble moving my model in its facing direction. Currently the model moves can move in all cardinal directions with no problems. The problem comes when I rotate the move as it still travelling in the direction of world space. Meaning, if I'm moving forward, backward or any other direction while rotating the model, the model acts like its a figure skater spinning while traveling in the same direction. How do I update the direction of travel proper with the facing direction of the model? Rotates model on Y-axis: Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(speedAngleMAX); AddRotation = Quaternion.CreateFromYawPitchRoll(yaw, 0, 0); ModelLoad.MRotation *= AddRotation; MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation); Moves model forward: // Move Forward if (pController.IsButtonDown(Buttons.LeftThumbstickUp)) { SpeedX = (float)(Math.Sin(ModelLoad.ModelRotation)) * FWDSpeedMax * pController.ThumbSticks.Left.Y * (float)gameTime.ElapsedGameTime.TotalSeconds; SpeedZ = (float)(Math.Cos(ModelLoad.ModelRotation)) * FWDSpeedMax * pController.ThumbSticks.Left.Y * (float)gameTime.ElapsedGameTime.TotalSeconds; // Update model position ModelLoad._modelPos += Vector3.Forward * SpeedZ; ModelLoad._modelPos += Vector3.Left * SpeedX; }

    Read the article

  • How to copy newly added document with metadata to another document library?

    - by James
    I need to copy the item that user just added (for example. myresume.doc or financial.xls) with the metadata (doc lib obtains the columns from content type, ct obtains the columns from site colum) and copy the item with metadata in a folder called "NativeFile". Every doc library has this folder. I know itemadded can be used but then I heard itemadded fires before user have a chance to complete the metadata for the item they just added. What are my options? (new to sp, so some sample code would greatly help. or some good link similar to this issue) Sharepoint 2007, itemadded or itemadding or itemupdating or itemupdated....

    Read the article

  • copy the item with the metadata that user just added to a folder called "NativeFiles". this folder i

    - by James
    I need to copy the item that user just added (for example. myresume.doc or financial.xls) with the metadata (doc lib obtains the columns from content type, ct obtains the columns from site colum) and copy the item with metadata in a folder called "NativeFile". Every doc library has this folder. I know itemadded can be used but then I heard itemadded fires before user have a chance to complete the metadata for the item they just added. What are my options? (new to sp, so some sample code would greatly help. or some good link similar to this issue) Sharepoint 2007, itemadded or itemadding or itemupdating or itemupdated....

    Read the article

  • Model value not being set on return from View to Controller

    - by sagesky36
    I have a boolean model variable who's value is supposed to be set to TRUE in order to perform a process on return back into the Controller. It works absolutely fine on my local machine, but not on the remote web server. Can somebody PLEASE inform me what I am missing? Below is the "proof of the pudding": The boolean value in quesion is "ShouldGeneratePdf"; MODEL: namespace PDFConverterModel.ViewModels { public partial class ViewModelTemplate_Guarantors { public ViewModelTemplate_Guarantors() { Templates = new List<PDFTemplate>(); Guarantors = new List<tGuarantor>(); } public int SelectedTemplateId { get; set; } public List<PDFTemplate> Templates { get; set; } public int SelectedGuarantorId { get; set; } public List<tGuarantor> Guarantors { get; set; } public string LoanId { get; set; } public string DepartmentId { get; set; } public bool isRepeat { get; set; } public string ddlDept { get; set; } public string SelectedDeptText { get; set; } public string LoanTypeId { get; set; } public string LoanType { get; set; } public string Error { get; set; } public string ErrorT { get; set; } public string ErrorG { get; set; } public bool ShowGeneratePDFBtn { get; set; } public bool ShouldGeneratePdf { get; set; } } } MasterPage: <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.common.min.css")" rel="stylesheet" type="text/css" /> <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" /> <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.blueopal.min.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-2.5.3.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/kendo/2012.2.913/kendo.all.min.js")"></script> <script src="@Url.Content("~/Scripts/kendo/2012.2.913/kendo.aspnetmvc.min.js")"></script> </head> <body> <div class="page"> <header> <div id="title"> <h1>BHG :: PDF Service Generator</h1> </div> </header> <section id="main"> @RenderBody() </section> <footer> </footer> </div> </body> </html> View: @model PDFConverterModel.ViewModels.ViewModelTemplate_Guarantors @using (Html.BeginForm("ProcessForm", "Home", new AjaxOptions { HttpMethod = "POST" })) { <table style="width: 1000px"> @Html.HiddenFor(x => x.ShouldGeneratePdf) <tr> <td> <img alt="BHG Logo" src="~/Images/logo.gif" /> </td> </tr> <tr> <td> @(Html.Kendo().IntegerTextBox() .Placeholder("Enter Loan Id") .Name("LoanId") .Format("{0:#######}") .Value(Convert.ToInt32(Model.LoanId)) ) </td> </tr> <tr> <td>@Html.Label("Loan Type: ") @Html.DisplayFor(model => Model.LoanType) </td> <td> <label for="ddlDept">Department:</label> @(Html.Kendo().DropDownListFor(model => Model.ddlDept) .Name("ddlDept") .DataTextField("DepartmentName") .DataValueField("DepartmentID") .Events(e => e.Change("Refresh")) .DataSource(source => { source.Read(read => { read.Action("GetDepartments", "Home"); }); }) .Value(Model.ddlDept.ToString()) ) </td> </tr> @if (Model.ShowGeneratePDFBtn == true) { if (Model.ErrorT == string.Empty) { <tr> <td> <u><b>@Html.Label("Templates:")</b></u> </td> </tr> <tr> @for (int i = 0; i < Model.Templates.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Templates[i].IsChecked) @Html.DisplayFor(model => Model.Templates[i].TemplateId) </td> } </tr> } else { <tr> <td> <b>@Html.DisplayFor(model => Model.ErrorT)</b> </td> </tr> } if (Model.ErrorG == string.Empty) { <tr> <td> <u><b>@Html.Label("Guarantors:")</b></u> </td> </tr> <tr> @for (int i = 0; i < Model.Guarantors.Count; i++) { <td> @Html.CheckBoxFor(model => Model.Guarantors[i].isChecked) @Html.DisplayFor(model => Model.Guarantors[i].GuarantorFirstName)&nbsp;@Html.DisplayFor(model => Model.Guarantors[i].GuarantorLastName) </td> } </tr> } else { <tr> <td> <b>@Html.DisplayFor(model => Model.ErrorG)</b> </td> </tr> } } <tr> <td> <input type="submit" name="submitbutton" id="btnRefresh" value='Refresh' /> </td> @if (Model.ShowGeneratePDFBtn == true) { <td> <input type="submit" name="submitbutton" id="btnGeneratePDF" value='Generate PDF' /> </td> } </tr> <tr> <td style="color: red; font: bold"> @Model.Error </td> </tr> </table> } <script type="text/javascript"> $('#btnRefresh').click(function () { Refresh(); }); function Refresh() { var LoanID = $("#LoanID").val(); if (parseInt(LoanID) != 0) { $('#ShouldGeneratePdf').val(false) document.forms[0].submit(); } else { alert("Please enter a LoanId"); } } //$(function () { // //DOM loaded // $('#btnGeneratePDF').click(function () { // DisableGeneratePDF(); // $('#ShouldGeneratePdf').val(true) // }); //}); //function DisableGeneratePDF() { // $('#btnGeneratePDF').attr("disabled", true); // $('#btnRefresh').attr("disabled", true); //} $('#btnGeneratePDF').click(function () { alert("inside click function"); DisableGeneratePDF(); $('#ShouldGeneratePdf').val(true) tof = $('#ShouldGeneratePdf').val(); alert("ShouldGeneratePdf set to " + tof); }); function DisableGeneratePDF() { alert("begin DisableGeneratePDF function"); $('#btnGeneratePDF').attr("disabled", true); $('#btnRefresh').attr("disabled", true); alert("end DisableGeneratePDF function"); } </script> Controller: [HttpPost] public ActionResult ProcessForm(string submitbutton, ViewModelTemplate_Guarantors model, FormCollection collection) if ((submitbutton == "Refresh") || (submitbutton == null) && (model.ShouldGeneratePdf == false)) { } else if ((submitbutton == "Generate PDF") || (model.ShouldGeneratePdf == true)) { } The "Alerts" in the script above come out to exactly what they should be on the remote server. The last alert shows that the value of the bool variable is "true". However, when I do page source views of the hidden variable, below is the result. The values of the hidden variable when the page loads and when the last alert button finishes are as follows: My local machine: The remote machine: As you can see, the value on my machine is set to true when the process executes. However, on the remote machine, it is set to false where it then doesn't excute. Why isn't the value in the model being returned as TRUE on the remote machine?

    Read the article

  • How to deal with data on the model specific to the technology being used?

    - by user1620696
    There are some cases where some of the data on a class of the domain model of an application seems to be dependent on the technology being used. One example of this is the following: suppose we are building one application in .NET such that there's the need of an Employee class. Suppose further that we are going to implement relational database, then the Employee has a primary key right? So that the classe would be something like public class Employee { public int EmployeeID { get; set; } public string Name { get; set; } ... } Now, that EmployeeID is dependent on the technology right? That's something that has to do with the way we've choose to persist our data. Should we write down a class independent of such things? If we do it this way, how should we work? I think I would need to map all the time between domain model and persistence specific types, but I'm not sure.

    Read the article

  • Developing a Cost Model for Cloud Applications

    - by BuckWoody
    Note - please pay attention to the date of this post. As much as I attempt to make the information below accurate, the nature of distributed computing means that components, units and pricing will change over time. The definitive costs for Microsoft Windows Azure and SQL Azure are located here, and are more accurate than anything you will see in this post: http://www.microsoft.com/windowsazure/offers/  When writing software that is run on a Platform-as-a-Service (PaaS) offering like Windows Azure / SQL Azure, one of the questions you must answer is how much the system will cost. I will not discuss the comparisons between on-premise costs (which are nigh impossible to calculate accurately) versus cloud costs, but instead focus on creating a general model for estimating costs for a given application. You should be aware that there are (at this writing) two billing mechanisms for Windows and SQL Azure: “Pay-as-you-go” or consumption, and “Subscription” or commitment. Conceptually, you can consider the former a pay-as-you-go cell phone plan, where you pay by the unit used (at a slightly higher rate) and the latter as a standard cell phone plan where you commit to a contract and thus pay lower rates. In this post I’ll stick with the pay-as-you-go mechanism for simplicity, which should be the maximum cost you would pay. From there you may be able to get a lower cost if you use the other mechanism. In any case, the model you create should hold. Developing a good cost model is essential. As a developer or architect, you’ll most certainly be asked how much something will cost, and you need to have a reliable way to estimate that. Businesses and Organizations have been used to paying for servers, software licenses, and other infrastructure as an up-front cost, and power, people to the systems and so on as an ongoing (and sometimes not factored) cost. When presented with a new paradigm like distributed computing, they may not understand the true cost/value proposition, and that’s where the architect and developer can guide the conversation to make a choice based on features of the application versus the true costs. The two big buckets of use-types for these applications are customer-based and steady-state. In the customer-based use type, each successful use of the program results in a sale or income for your organization. Perhaps you’ve written an application that provides the spot-price of foo, and your customer pays for the use of that application. In that case, once you’ve estimated your cost for a successful traversal of the application, you can build that into the price you charge the user. It’s a standard restaurant model, where the price of the meal is determined by the cost of making it, plus any profit you can make. In the second use-type, the application will be used by a more-or-less constant number of processes or users and no direct revenue is attached to the system. A typical example is a customer-tracking system used by the employees within your company. In this case, the cost model is often created “in reverse” - meaning that you pilot the application, monitor the use (and costs) and that cost is held steady. This is where the comparison with an on-premise system becomes necessary, even though it is more difficult to estimate those on-premise true costs. For instance, do you know exactly how much cost the air conditioning is because you have a team of system administrators? This may sound trivial, but that, along with the insurance for the building, the wiring, and every other part of the system is in fact a cost to the business. There are three primary methods that I’ve been successful with in estimating the cost. None are perfect, all are demand-driven. The general process is to lay out a matrix of: components units cost per unit and then multiply that times the usage of the system, based on which components you use in the program. That sounds a bit simplistic, but using those metrics in a calculation becomes more detailed. In all of the methods that follow, you need to know your application. The components for a PaaS include computing instances, storage, transactions, bandwidth and in the case of SQL Azure, database size. In most cases, architects start with the first model and progress through the other methods to gain accuracy. Simple Estimation The simplest way to calculate costs is to architect the application (even UML or on-paper, no coding involved) and then estimate which of the components you’ll use, and how much of each will be used. Microsoft provides two tools to do this - one is a simple slider-application located here: http://www.microsoft.com/windowsazure/pricing-calculator/  The other is a tool you download to create an “Return on Investment” (ROI) spreadsheet, which has the advantage of leading you through various questions to estimate what you plan to use, located here: https://roianalyst.alinean.com/msft/AutoLogin.do?d=176318219048082115  You can also just create a spreadsheet yourself with a structure like this: Program Element Azure Component Unit of Measure Cost Per Unit Estimated Use of Component Total Cost Per Component Cumulative Cost               Of course, the consideration with this model is that it is difficult to predict a system that is not running or hasn’t even been developed. Which brings us to the next model type. Measure and Project A more accurate model is to actually write the code for the application, using the Software Development Kit (SDK) which can run entirely disconnected from Azure. The code should be instrumented to estimate the use of the application components, logging to a local file on the development system. A series of unit and integration tests should be run, which will create load on the test system. You can use standard development concepts to track this usage, and even use Windows Performance Monitor counters. The best place to start with this method is to use the Windows Azure Diagnostics subsystem in your code, which you can read more about here: http://blogs.msdn.com/b/sumitm/archive/2009/11/18/introducing-windows-azure-diagnostics.aspx This set of API’s greatly simplifies tracking the application, and in fact you can use this information for more than just a cost model. After you have the tracking logs, you can plug the numbers into ay of the tools above, which should give a representative cost or in some cases a unit cost. The consideration with this model is that the SDK fabric is not a one-to-one comparison with performance on the actual Windows Azure fabric. Those differences are usually smaller, but they do need to be considered. Also, you may not be able to accurately predict the load on the system, which might lead to an architectural change, which changes the model. This leads us to the next, most accurate method for a cost model. Sample and Estimate Using standard statistical and other predictive math, once the application is deployed you will get a bill each month from Microsoft for your Azure usage. The bill is quite detailed, and you can export the data from it to do analysis, and using methods like regression and so on project out into the future what the costs will be. I normally advise that the architect also extrapolate a unit cost from those metrics as well. This is the information that should be reported back to the executives that pay the bills: the past cost, future projected costs, and unit cost “per click” or “per transaction”, as your case warrants. The challenge here is in the model itself - statistical methods are not foolproof, and the larger the sample (in this case I recommend the entire population, not a smaller sample) is key. References and Tools Articles: http://blogs.msdn.com/b/patrick_butler_monterde/archive/2010/02/10/windows-azure-billing-overview.aspx http://technet.microsoft.com/en-us/magazine/gg213848.aspx http://blog.codingoutloud.com/2011/06/05/azure-faq-how-much-will-it-cost-me-to-run-my-application-on-windows-azure/ http://blogs.msdn.com/b/johnalioto/archive/2010/08/25/10054193.aspx http://geekswithblogs.net/iupdateable/archive/2010/02/08/qampa-how-can-i-calculate-the-tco-and-roi-when.aspx   Other Tools: http://cloud-assessment.com/ http://communities.quest.com/community/cloud_tools

    Read the article

  • Ruby on rails model and controllers inside of different namespaces

    - by Nelson LaQuet
    OK. This is insane. I'm new to RoR and I really want to get into it as everything about it that I have seen so far makes it more appealing to the type of work that I do. However, I can't seem to accomplish a very simple thing with RoR. I want these controlers: /admin/blog/entries (index/show/edit/delete) /admin/blog/categories (index/show/edit/delete) /admin/blog/comments (index/show/edit/delete) ... and so on And these models: Blog::Entry (table: blog_entries) Blog::Category (table: blog_categories) Blog::Comments (table: blog_comments) ... and so on Now, I have already gone though quite a bit of misery to make this work. My first attempt was with generating scaffolding (I'm using 2.2.2). I generated my scaffolding, but had to move my model, then fix the references to the model in my controller (see http://stackoverflow.com/questions/903258/ruby-on-rails-model-inside-namespace-cant-be-found-in-controller). That is already a big of a pain, but hey, I got it to work. Now though form_for won't work and I cannot figure out how to use the url helpers (I have no idea what these are called... they are the automatically generated methods that return URLs to controllers associated with a model). I cannot figure out what their name is. My model is Blog::Entries. I have tried to mess with the route.rb's map's resource method, but no luck. When I attempt to use form_for with my model, I get this error undefined method `blog_entries_path' for #<ActionView::Base:0xb6848080> Now. This is really quite frustrating. I am not going to completely destroy my code's organization in order to use this framework, and if I cannot figure out how to accomplish this simple task (I have been researching this for at least 5 hours) then I simply cannot continue. Are there any ideas on how to accomplish this? Thanks EDIT Here are my routes: admin_blog_entries GET /admin_blog_entries {:controller=>"admin_blog_entries", :action=>"index"} formatted_admin_blog_entries GET /admin_blog_entries.:format {:controller=>"admin_blog_entries", :action=>"index"} POST /admin_blog_entries {:controller=>"admin_blog_entries", :action=>"create"} POST /admin_blog_entries.:format {:controller=>"admin_blog_entries", :action=>"create"} new_admin_blog_entry GET /admin_blog_entries/new {:controller=>"admin_blog_entries", :action=>"new"} formatted_new_admin_blog_entry GET /admin_blog_entries/new.:format {:controller=>"admin_blog_entries", :action=>"new"} edit_admin_blog_entry GET /admin_blog_entries/:id/edit {:controller=>"admin_blog_entries", :action=>"edit"} formatted_edit_admin_blog_entry GET /admin_blog_entries/:id/edit.:format {:controller=>"admin_blog_entries", :action=>"edit"} admin_blog_entry GET /admin_blog_entries/:id {:controller=>"admin_blog_entries", :action=>"show"} formatted_admin_blog_entry GET /admin_blog_entries/:id.:format {:controller=>"admin_blog_entries", :action=>"show"} PUT /admin_blog_entries/:id {:controller=>"admin_blog_entries", :action=>"update"} PUT /admin_blog_entries/:id.:format {:controller=>"admin_blog_entries", :action=>"update"} DELETE /admin_blog_entries/:id {:controller=>"admin_blog_entries", :action=>"destroy"} DELE

    Read the article

  • JBD: Spotted dirty metadata buffer

    - by Jake Mach
    Sep 25 22:19:38 host kernel: [7798806.146942] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 267). There's a risk of filesystem corruption in case of system crash. Sep 25 22:19:38 host kernel: [7798806.146956] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 1). There's a risk of filesystem corruption in case of system crash. Sep 25 22:19:38 host kernel: [7798806.146967] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 353). There's a risk of filesystem corruption in case of system crash. Sep 25 22:19:38 host kernel: [7798806.147121] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 353). There's a risk of filesystem corruption in case of system crash. Sep 25 22:19:38 host kernel: [7798806.147133] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 1). There's a risk of filesystem corruption in case of system crash. Sep 25 22:19:38 host kernel: [7798806.147143] JBD: Spotted dirty metadata buffer (dev = loop0, blocknr = 267). There's a risk of filesystem corruption in case of system crash. [7817859.850517] EXT4-fs error (device loop0): ext4_mb_generate_buddy: EXT4-fs: group 1: 28618 blocks in bitmap, 29028 in gd what does this mean? how did this happen?

    Read the article

  • Custom model in ASP.NET MVC controller: Custom display message for Date DataType

    - by Rita
    Hi I have an ASP.NET MVC Page that i have to display the fields in customized Text. For that I have built a CustomModel RequestViewModel with the following fields. Description, Event, UsageDate Corresponding to these my custom Model has the below code. So that, the DisplayName is displayed on the ASP.NET MVC View page. Now being the Description and Event string Datatype, both these fields are displaying Custom DisplayMessage. But I have problem with Date Datatype. Instead of "Date of Use of Slides", it is still displaying UsageDate from the actualModel. Anybody faced this issue with DateDatatype? Appreciate your responses. Custom Model: [Required(ErrorMessage="Please provide a description")] [DisplayName("Detail Description")] [StringLength(250, ErrorMessage = "Description cannot exceed 250 chars")] // also need min length 30 public string Description { get; set; } [Required(ErrorMessage="Please specify the name or location")] [DisplayName("Name/Location of the Event")] [StringLength(250, ErrorMessage = "Name/Location cannot exceed 250 chars")] public string Event { get; set; } [Required(ErrorMessage="Please specify a date", ErrorMessageResourceType = typeof(DateTime))] [DisplayName("Date of Use of Slides")] [DataType(DataType.Date)] public string UsageDate { get; set; } ViewCode: <p> <%= Html.LabelFor(model => model.Description) %> <%= Html.TextBoxFor(model => model.Description) %> <%= Html.ValidationMessageFor(model => model.Description) %> </p> <p> <%= Html.LabelFor(model => model.Event) %> <%= Html.TextBoxFor(model => model.Event) %> <%= Html.ValidationMessageFor(model => model.Event) %> </p> <p> <%= Html.LabelFor(model => model.UsageDate) %> <%= Html.TextBoxFor(model => model.UsageDate) %> <%= Html.ValidationMessageFor(model => model.UsageDate) %> </p>

    Read the article

  • What's faster Model.get(keys) or Model.get_by_id(ids, parent=None)

    - by WooYek
    I'm wondering is there a difference in terms of computing cost for the Model.get(keys) and Model.get_by_id(ids, parent=None) methods? Is there a server side computing advantage of using numeric id's over encoded string keys, or other way around? How big is the difference? PS. Sorry, if it's a dupe. I'm sure I read an article about it, but I cannot find it now.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >