Search Results

Search found 139 results on 6 pages for 'zack fernandes'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • UML enumeration as a return type

    - by Ryan Fernandes
    << enumeration>> E1 | .RED .GREEN .BLUE | I have the above as an enumeration class in a UML diagram. I associate it with another class say House. I now need a method on House say +getColor() which returns a color from the above enumeration. How would I depict this in UML? would it be like : +getColor(): E1 ?

    Read the article

  • 2d Vector with wrong values

    - by Petris Rodrigo Fernandes
    I'm studing STL, then i thought "i'll make a 2d array!" but whatever... a coded this: vector< vector<int> > vetor; vetor.resize(10); vetor[0].resize(10); for(int i = 0; i < vetor.capacity(); i++){ for(int h = 0; h < vetor[0].capacity();h++){ vetor[i][h] = h; } } Until here, ok. But when i try to show the array value a use this: for(int i = 0; i < vetor.capacity(); i++){ cout << "LINE " << i << ": "; for(int h = 0; h < vetor[0].capacity();h++){ cout << vetor[i][h] <<" "; } cout << "\n"; } And the results are really wrong: LINE 0: 4 5 6 7 8 9 6 7 8 9 LINE 1: 0 1 2 3 0 1 2 3 0 1 LINE 2: 0 1 2 3 0 1 2 3 0 1 LINE 3: 0 1 2 3 0 1 2 3 0 1 LINE 4: 0 1 2 3 0 1 2 3 0 1 LINE 5: 0 1 2 3 0 1 2 3 0 1 LINE 6: 0 1 2 3 0 1 2 3 0 1 LINE 7: 0 1 2 3 0 1 2 3 0 1 LINE 8: 0 1 2 3 0 1 2 3 4 5 LINE 9: 0 1 2 3 4 5 6 7 8 9 What's happening with my program? it isn't printing the right values!

    Read the article

  • Why can't I project ToString() in VB?

    - by Martinho Fernandes
    If you try to compile the query below in Visual Basic .NET, it fails. From x In {1, 2} Select x.ToString() The error given by the compiler is: Range variable name cannot match the name of a member of the 'Object' class. There is nothing wrong with the equivalent C# query, though: from x in new[]{1, 2} select x.ToString() This does not happen with the ToString overload that takes a format (it is a member of Int32, not Object). It does happen with other members of Object, as long as they don't take an argument: with GetType and GetHashCode it fails; with Equals(object) it compiles. Why is this restriction in place, and what alternatives can I use?

    Read the article

  • Server side method not getting called

    - by Rangel Fernandes
    From the below javascript code i am trying to call a serverside method, but serververside method is not getting called. I am using jquery, ajax <script type="text/javascript" src="JquryLib.js"></script> <script type="text/javascript" language="javascript"> function fnPopulateCities() { debugger; var State = $("#ddlState").val(); GetCities(State); return false; } function GetCities(StateId) { debugger; var v1 = 'StateId: ' + StateId; $.ajax( { type: "POST", url: 'DropDownList_Cascade.aspx/PopulateCities', data: '{' + v1 + '}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (result) { if (result.status === "OK") { alert('Success!!'); } else { fnDisplayCities(result); } }, error: function (req, status, error) { alert("Sorry! Not able to retrieve cities"); } }); } </script> This is my serverside method which i need to call. private static ArrayList PopulateCities(int StateId) { //this code returns Cities ArrayList from database. } It is giving me the following error: 500 (Internal Server Error) I cannot figure out what is wrong. please help! Stack Trace: [ArgumentException: Unknown web method PopulateCities.Parameter name: methodName]

    Read the article

  • What encoding does c32rtomb convert to?

    - by R. Martinho Fernandes
    The functions c32rtomb and mbrtoc32 from <cuchar>/<uchar.h> are described in the C Unicode TR (draft) as performing conversions between UTF-321 and "multibyte characters". (...) If s is not a null pointer, the c32rtomb function determines the number of bytes needed to represent the multibyte character that corresponds to the wide character given by c32 (including any shift sequences), and stores the multibyte character representation in the array whose first element is pointed to by s. (...) What is this "multibyte character representation"? I'm actually interested in the behaviour of the following program: #include <cassert> #include <cuchar> #include <string> int main() { std::u32string u32 = U"this is a wide string"; std::string narrow = "this is a wide string"; std::string converted(1000, '\0'); char* ptr = &converted[0]; std::mbstate_t state {}; for(auto u : u32) { ptr += std::c32rtomb(ptr, u, &state); } converted.resize(ptr - &converted[0]); assert(converted == narrow); } Is the assertion in it guaranteed to hold1? 1 Working under the assumption that __STDC_UTF_32__ is defined.

    Read the article

  • Invalid attempt to access a field before calling Read() INSERT

    - by Raphael Fernandes
    I'm trying to use this code to check if the system already exists a field with this value Dim adap As New MySqlDataAdapter Dim sqlquery = "SELECT * FROM client WHERE code ='"+ TxtCode.Text +"'" Dim comand As New MySqlCommand() comand.Connection = con comand.CommandText = sqlquery adap.SelectCommand = comand Dim data As MySqlDataReader data = comando2.ExecuteReader() leitor.Read() If (data(3).ToString) = code Then MsgBox("already exists", MsgBoxStyle.Information) TxtCode.ResetText() TxtCode.Focus() Else Console.WriteLine(insert("INSERT INTO client (name, tel, code) VALUES ('" & name & "', '" & tel & "')")) con.Close() End If

    Read the article

  • "Could not load file or assembly 'System.Web.Mvc, ...

    - by Zack Peterson
    My new ASP.NET MVC Web Application works on my development workstation, but does not run on my web server... Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Source Error: Line 44: <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> Line 45: <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> Line 46: <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> Line 47: <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> Line 48: <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> Source File: C:\inetpub\www.example.org\web.config Line: 46 Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 Do I need to install the AspNetMVCBeta-setup.msi on the server? Or is there a different installer for servers?

    Read the article

  • JavaScript and CSS files for ASP.NET MVC 2 EditorTemplate user controls

    - by Zack Peterson
    I'm using an EditorTemplate DateTime.ascx in my ASP.NET MVC 2 project. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime>" %> <%: Html.TextBox(String.Empty, Model.ToString("M/dd/yyyy h:mm tt")) %> <script type="text/javascript"> $(function () { $('#<%: ViewData.TemplateInfo.GetFullHtmlFieldId(String.Empty) %>').AnyTime_picker({ format: "%c/%d/%Y %l:%i %p" }); }); </script> This uses the Any+Time™ JavaScript library for jQuery by Andrew M. Andrews III. I've added those library files (anytimec.js and anytimec.css) to the <head> section of my master page. Rather than include these JavaScript and Cascading Style Sheet files on every page of my web site, how can I instead include the .js and .css files only on pages that need them--pages that edit a DateTime type value?

    Read the article

  • Swig typecast to derived class?

    - by Zack
    I notice that Swig provides a whole host of functions to allow for typecasting objects to their parent classes. However, in C++ one can produce a function like the following: A * getAnObject() { if(someBoolean) return (A *) new B; else return (A *) new C; } Where "A" is the parent of classes "B" and "C". One can then typecast the pointer returned into being a "B" type or "C" type at one's convenience like: B * some_var = (B *) getAnObject(); Is there some way I can typecast an object I've received from a generic-pointer-producing function at run-time in the scripting language using the wrappers? (In my case, Lua?) I have a function that could produce one of about a hundred possible classes, and I'd like to avoid writing an enormous switch structure that I'd have to maintain in C++. At the point where I receive the generic pointer, I also have a string representation of the data type I'd like to cast it to. Any thoughts? Thanks! -- EDIT -- I notice that SWIG offers to generate copy constructors for all of my classes. If I had it generate those, could I do something like the following?: var = myModule.getAnObject(); -- Function that returns an object type-cast down to a pointer of the parent class, as in the function getAnObject() above. var = myModule.ClassThatExtendsBaseClass(var); -- A copy constructor that SWIG theoretically creates for me and have var then be an instance of the inheriting class that knows it's an instance of the inheriting class?

    Read the article

  • My images are blurry! Why isn't WPF's SnapsToDevicePixels working?

    - by Zack Peterson
    I'm using some Images in my WPF applcation. XAML: <Image Name="ImageOrderedList" Source="images/OrderedList.png" ToolTip="Ordered List" Margin="0,0,5,5" Width="20" Height="20" SnapsToDevicePixels="True" MouseUp="Image_MouseUp" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" /> But, they appear fuzzy: Here's a zoomed-in, side-by-side comparison. An original is on the left: Why doesn't that SnapsToDevicePixels="True" line prevent this problem?

    Read the article

  • Does the DataAnnotations.DisplayAttribute.Order property not work with ASP.NET MVC 2?

    - by Zack Peterson
    I set values for the Order property of the Display attribute in my model metadata. [MetadataType(typeof(OccasionMetadata))] public partial class Occasion { private class OccasionMetadata { [ScaffoldColumn(false)] public object Id { get; set; } [Required] [DisplayName("Title")] [Display(Order = 0)] public object Designation { get; set; } [Required] [DataType(DataType.MultilineText)] [Display(Order = 3)] public object Summary { get; set; } [Required] [DataType(DataType.DateTime)] [Display(Order = 1)] public object Start { get; set; } [Required] [DataType(DataType.DateTime)] [Display(Order = 2)] public object Finish { get; set; } } } I present my models in strongly-typed views using the DisplayForModel and EditorForModel methods. <%= Html.DisplayForModel() %> and <%= Html.EditorForModel() %> But, ASP.NET MVC 2 displays the fields out of order! What might I have wrong?

    Read the article

  • Creating Signed URLs for Amazon CloudFront

    - by Zack
    Short version: How do I make signed URLs "on-demand" to mimic Nginx's X-Accel-Redirect behavior (i.e. protecting downloads) with Amazon CloudFront/S3 using Python. I've got a Django server up and running with an Nginx front-end. I've been getting hammered with requests to it and recently had to install it as a Tornado WSGI application to prevent it from crashing in FastCGI mode. Now I'm having an issue with my server getting bogged down (i.e. most of its bandwidth is being used up) due to too many requests for media being made to it, I've been looking into CDNs and I believe Amazon CloudFront/S3 would be the proper solution for me. I've been using Nginx's X-Accel-Redirect header to protect the files from unauthorized downloading, but I don't have that ability with CloudFront/S3--however they do offer signed URLs. I'm no Python expert by far and definitely don't know how to create a Signed URL properly, so I was hoping someone would have a link for how to make these URLs "on-demand" or would be willing to explain how to here, it would be greatly appreciated. Also, is this the proper solution, even? I'm not too familiar with CDNs, is there a CDN that would be better suited for this?

    Read the article

  • Who sells the cheapest EV SSL certificate?

    - by Zack Peterson
    I want a SSL certificate for my web site that will not only be accepted without warning by all popular browsers (at least accepted by Firefox and Internet Explorer), but also give my visitors the green address bar. Which certificate authority is selling the least expensive extended validation SSL certificates?

    Read the article

  • Implementing arrays using a stack

    - by Zack
    My programming language has no arrays, no lists, no pointers, no eval and no variable variables. All it has: Ordinary variables like you know them from most programming languages: They all have an exact name and a value. One stack. Functions provided are: push (add element to top), pop (remove element from top, get value) and empty (check if stack is empty) My language is turing-complete. (Basic arithmetics, conditional jumps, etc implemented) That means, it must be possible to implement some sort of list or array, right? But I have no idea how... What I want to achieve: Create a function which can retrieve and/or change an element x of the stack. I could easily add this function in the implementation of my language, in the interpreter, but I want to do it in my programming language. "Solution" one (Accessing an element x, counting from the stack top) Create a loop. Pop off the element from the stack top x times. The last element popped of is element number x. I end up with a destroyed stack. Solution two: Do the same as above, but store all popped off values in a second stack. Then you could move all elements back after you are done. But you know what? I don't have a second stack!

    Read the article

  • How do I prevent Visual Studio from renaming my controls?

    - by Zack Peterson
    If I paste something like <asp:DropDownList ID="DropDownListExpirationDate" runat="server" /> onto an ASPX file that already has a DropDownListExpirationDate control, it will rename the newly-pasted control as DropDownList1. <asp:DropDownList ID="DropDownList1" runat="server" /> I'd rather it didn't. I'd rather is just paste exactly what I copied. Is there a way to disable this feature?

    Read the article

  • Invalidating Memcached Keys on save() in Django

    - by Zack
    I've got a view in Django that uses memcached to cache data for the more highly trafficked views that rely on a relatively static set of data. The key word is relatively: I need invalidate the memcached key for that particular URL's data when it's changed in the database. To be as clear as possible, here's the meat an' potatoes of the view (Person is a model, cache is django.core.cache.cache): def person_detail(request, slug): if request.is_ajax(): cache_key = "%s_ABOUT_%s" % settings.SITE_PREFIX, slug # Check the cache to see if we've already got this result made. json_dict = cache.get(cache_key) # Was it a cache hit? if json_dict is None: # That's a negative Ghost Rider person = get_object_or_404(Person, display = True, slug = slug) json_dict = { 'name' : person.name, 'bio' : person.bio_html, 'image' : person.image.extra_thumbnails['large'].absolute_url, } cache.set(cache_key) # json_dict will now exist, whether it's from the cache or not response = HttpResponse() response['Content-Type'] = 'text/javascript' response.write(simpljson.dumps(json_dict)) # Make sure it's all properly formatted for JS by using simplejson return response else: # This is where the fully templated response is generated What I want to do is get at that cache_key variable in it's "unformatted" form, but I'm not sure how to do this--if it can be done at all. Just in case there's already something to do this, here's what I want to do with it (this is from the Person model's hypothetical save method) def save(self): # If this is an update, the key will be cached, otherwise it won't, let's see if we can't find me try: old_self = Person.objects.get(pk=self.id) cache_key = # Voodoo magic to get that variable old_key = cache_key.format(settings.SITE_PREFIX, old_self.slug) # Generate the key currently cached cache.delete(old_key) # Hit it with both barrels of rock salt # Turns out this doesn't already exist, let's make that first request even faster by making this cache right now except DoesNotExist: # I haven't gotten to this yet. super(Person, self).save() I'm thinking about making a view class for this sorta stuff, and having functions in it like remove_cache or generate_cache since I do this sorta stuff a lot. Would that be a better idea? If so, how would I call the views in the URLconf if they're in a class?

    Read the article

  • Why is TortoiseSVN so slow?

    - by Zack Peterson
    I'm using TortoiseSVN to connect to my Subversion repository hosted with CVSDude. It's unreasonably slow--especially on small transfers... 5 kBytes transferred in 5 minute(s) and 9 second(s)?! It's not just slow to respond, though. It bogs the computer down for 5 minutes while processing those 5 kilobytes. Could there possibly be anything wrong with my installation or settings? Or, is the blame purely with my Subversion host, CVSDude?

    Read the article

  • Excel VBA Select Case Loop Sub

    - by Zack
    In my excel file, I have a table setup with formulas. with Cells from Range("B2:B12"), Range ("D2:D12"), and etc every other row containing the answers to these formulas. for these cells (with the formula answers), I need to apply conditional formatting, but I have 7 conditions, so I've been using "select case" in VBA to change their interior background based on their number. I have the select case function currently set up within the sheet code, as opposed to it's own macro Private Sub Worksheet_Change(ByVal Target As Range) Dim iColor As Integer If Not Intersect(Target, Range("B2:L12")) Is Nothing Then Select Case Target Case 0 iColor = 2 Case 0.01 To 0.49 iColor = 36 Case 0.5 To 0.99 iColor = 6 Case 1 To 1.99 iColor = 44 Case 2 To 2.49 iColor = 45 Case 2.5 To 2.99 iColor = 46 Case 3 To 5 iColor = 3 End Select Target.Interior.ColorIndex = iColor End If End Sub but using this method, you must be actually entering the value into the cell for the formatting to work. which is why I want to write a subroutine to to do this as a macro. I can input my data, let the formulas work, and when everything is ready, I can run the macro and format those specific cells. I want an easy way to do this, obviously I could waste a load of time, typing out all the cases for every cell, but I figured it'd be easier with a loop. how would I go about writing a select case loop to change the formatting on a a specific range of cells every other row? thank you in advance.

    Read the article

  • How do I install ASP.NET MVC 2 Futures?

    - by Zack Peterson
    I want to use the DataAnnotations.DisplayAttribute.Order property to arrange my fields when using the DisplayForModel and EditorForModel methods. Related question: Does the DataAnnotations.DisplayAttribute.Order property not work with ASP.NET MVC 2? I think that I need to use the ASP.NET MVC 2 Futures. But I can't get it to work. How do I install ASP.NET MVC 2 Futures? Why are my fields still out of order?

    Read the article

  • Sorting a nodeset before passing to xsl:for-each

    - by Zack Mulgrew
    I have a situation where loop through a sorted nodeset and apply a template on each of the nodes: <div id="contractscontainer"> <xsl:for-each select="document"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> I want to do something special with the "first" 5 nodes in the node set and render them nested element. The problem is that they need to be in the same order as if they were sorted (as they are in the loop). I had planned on doing this by using two xsl:for-each elements, each with the correct nodes selected from the set. I can't do this, however, because they need to be sorted before I can select the "first" 5. Example: <div id="contractscontainer"> <div class="first-five"> <xsl:for-each select="document[position() < 6]"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> <div class="rest-of-them"> <xsl:for-each select="document[position() > 5]"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> </div> I don't think this will work because I'm selecting the nodes by position before sorting them, but I can't use xsl:sort outside of the xsl:for-each. Am I approaching this incorrectly?

    Read the article

  • WPF: "Items collection must be empty before using ItemsSource."

    - by Zack Peterson
    I'm trying to get images to display in a WPF ListView styled like a WrapPanel as described in this old ATC Avalon Team article: How to Create a Custom View. When I try to populate the ListView with a LINQ-to-Entities queried collection of ADO.NET Entity Framework objects I get the following exception: Exception Items collection must be empty before using ItemsSource. My code… Visual Basic Private Sub Window1_Loaded(...) Handles MyBase.Loaded ListViewImages.ItemsSource = From g In db.Graphic _ Order By g.DateAdded Ascending _ Select g End Sub XAML <ListView Name="ListViewImages" SelectionMode="Single" ItemsSource="{Binding}"> <local:ImageView /> </ListView> I put a breakpoint on that line. ListViewImages.ItemsSource is Nothing just before the LINQ assignment.

    Read the article

  • How do I create a check constraint?

    - by Zack Peterson
    Please imagine this small database... Diagram Tables Volunteer Event Shift EventVolunteer ========= ===== ===== ============== Id Id Id EventId Name Name EventId VolunteerId Email Location VolunteerId Phone Day Description Comment Description Start End Associations Volunteers may sign up for multiple events. Events may be staffed by multiple volunteers. An event may have multiple shifts. A shift belongs to only a single event. A shift may be staffed by only a single volunteer. A volunteer may staff multiple shifts. Check Constraints Can I create a check constraint to enforce that no shift is staffed by a volunteer that's not signed up for that shift's event? Can I create a check constraint to enforce that two overlapping shifts are never staffed by the same volunteer?

    Read the article

  • How do I assign a value to a MailMessage ReplyTo property?

    - by Zack Peterson
    I want to set the ReplyTo value for a .NET MailMessage. MailMessage.ReplyTo Property: ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses. MailMessage.ReplyToList Property: Gets or sets the list of addresses to reply to for the mail message. But, ReplyToList is ReadOnly. I've tried to use the MailMessage.Headers property like this: mail.Headers.Add("Reply-To", "[email protected]"); as described here: System.Web.Mail, OH MY! But, that doesn't seem to work. How do I set the value(s) of the MailMessage's ReadOnly property ReplyToList?

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >