Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 115/694 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • Google Maps - custom icons with infoWindows

    - by hfidgen
    Hiya, As far as I can tell, this code is fine, and should display some custom icons with popup HTML windows. But the popups aren't working! Can anyone point out what I'm doing wrong? I can't seem to debug it myself. Thanks! function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(51.410416, -0.293884), 15); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); var i_parking = new GIcon(); i_parking.image = "http://google-maps-icons.googlecode.com/files/parking.png"; i_parking.iconSize = new GSize(32, 37); i_parking.iconAnchor = new GPoint(16, 37); icon_parking = { icon:i_parking }; var marker_office = new GMarker(new GLatLng(51.410416,-0.293884)); var marker_parking1 = new GMarker((new GLatLng(51.410178,-0.292000)),icon_parking); var marker_parking2 = new GMarker((new GLatLng(51.410152,-0.298948)),icon_parking); marker_parking1.openInfoWindowHtml('<strong>On Street Parking</strong><br>Church Road - 40p per hour'); marker_parking2.openInfoWindowHtml('<strong>Multi Storey - Fairfield</strong><br>Upper Car Park - 90p per half hour<br>Lower Car Park - £1.20 per hour'); map.addOverlay(marker_office); map.addOverlay(marker_parking1); map.addOverlay(marker_parking2); } }

    Read the article

  • wordpress -> showing custom data from child pages + pagination

    - by GaVrA
    Hello! You can see here what i am doing: http://www.arvag.net/otkrijte-svet/leto/ So its pulling 2 custom fields from child pages, one of them is just url for the image on the left, and the other field is that text showing on the right. Now, what i want to do is to add pagination there. The code i have now will just simply show all child pages, but i want to show only 5 child pages, so if user want to see 6th child page he would have to click on link for "Page 2" and so on. The code im using to display these child pages is this: <?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_title&sort_order=desc'); $count = 0; foreach($pages as $page) { $short_info = get_post_meta($page->ID,'info',true); $image = get_post_meta($page->ID,'slika',true); $count++; ?> <div class='preview_slika left'><img src="<?php echo $image ?>" alt="<?php echo $page->post_title ?>" /></div> <div class='preview_info right'> <h2><?php echo $page->post_title ?></h2> <p><?php echo $short_info ?></p> <a href="<?php echo get_page_link($page->ID) ?>">Više o >></a> </div> <div class='clear'></div> <?php } ?> So any idea what to do to get what i need?

    Read the article

  • How to create custom query for CollectionOfElements

    - by Shervin
    Hi. I have problems creating a custom query. This is what entities: @Entity public class ApplicationProcess { @CollectionOfElements private Set<Template> defaultTemplates; //more fields } And Template.java @Embeddable @EqualsAndHashCode(exclude={"file", "selected", "used"}) public class Template implements Comparable<Template> { @Setter private ApplicationProcess applicationProcess; @Setter private Boolean used = Boolean.valueOf(false); public Template() { } @Parent public ApplicationProcess getApplicationProcess() { return applicationProcess; } @Column(nullable = false) @NotNull public String getName() { return name; } @Column(nullable = true) public Boolean isUsed() { return used; } public int compareTo(Template o) { return getName().compareTo(o.getName()); } } I want to create a update statement. I have tried these two: int v = entityManager.createQuery("update ApplicationProcess_defaultTemplates t set t.used = true " + "WHERE t.applicationProcess.id=:apId").setParameter("apId", ap.getId()) .executeUpdate(); ApplicationProcess_defaultTemplates is not mapped [update ApplicationProcess_defaultTemplates t set t.used = true WHERE t.applicationProcess.id=:apId] And I have tried int v = entityManager.createQuery("update Template t set t.used = true " + "WHERE t.applicationProcess.id=:apId").setParameter("apId", ap.getId()) .executeUpdate(); With the same error: Template is not mapped [update Template t set t.used = true WHERE t.applicationProcess.id=:apId] Any ideas? UPDATE I fixed it by creating native query int v = entityManager.createNativeQuery("update ApplicationProcess_defaultTemplates t set t.used=true where t.ApplicationProcess_id=:apId").setParameter("apId", ap.getId()).executeUpdate();

    Read the article

  • Fatal error with Custom Magento Module on one server but not the other

    - by Jack
    Hi, I am creating my own custom module in Magento and during testing on a Litespeed server (PHP v5.2.14) I am getting a Fatal Error: Call to a member function batch() on a non-object in ../../../BatchController.php on line 25 that was not appearing during testing on another linux server and a wamp server (PHP v5.2.11). This one has stumped me. I am guessing it has something to do with the server configuration rather than the code itself. But i am just guessing. I was hoping someone here could tell me. The only real major difference I could see, aside from the php versions and environment, is that the server that the error is on is using the Suhosin Patch. But would that be something that could cause this? The line in question is Mage::getModel('mymodule/mymodel')->batch(); which is enclosed in an IF statement. batch() is a public function located in my model file. If you need more code let me know. Thanks!

    Read the article

  • WordPress: Using a Where Clause With A Custom Field

    - by Steve Wilkison
    I have a bunch of events that are listed on a particular page. Each event is a post. I need them to display in the order in which they occur, NOT the order of the posting date. So, I've created a custom field called TheDate and enter in the date in this format for each one: 20110306. Then, I wrote my query like this: query_posts( array ( 'cat' => '4', 'posts_per_page' => -1, 'orderby' => 'meta_value_num', 'meta_key' => 'TheDate', 'order' => 'ASC' ) ); Works perfectly and displays the events in the correct order. However, I also want it to ONLY display dates from today onward. I don't want it to display dates which have passed. It seems the way to do this is with a "filter." I tried this, but it doesn't work. $todaysdate = date('Ymd'); query_posts( array ( 'cat' => '4', 'posts_per_page' => -1, 'orderby' => 'meta_value_num', 'meta_key' => 'TheDate', 'order' => 'ASC' ) ); function filter_where( $where = '' ) { $where .= "meta_value_num >= $todaysdate"; return $where; } add_filter( 'posts_where', 'filter_where' ); I figure it's just a matter of where I'm using this filter, I probably have it in the wrong place. Or maybe the filter itself is bad. Any help or guidance would be greatly appreciated. Thanks!

    Read the article

  • Custom UITableView headerView disappears after memory warning

    - by psychotik
    I have a UITableViewController. I create a custom headerView for it's tableView in the loadView method like so: (void)loadView { [super loadView]; UIView* containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height * 2 )]; containerView.tag = 'cont'; containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(padding, height, width, height); ... //configure UIButton and events UIImageView* imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"] highlightedImage:[UIImage imageNamed:@"highlight.png"]]; imageView.frame = CGRectMake(0, 0, width, height ); ... //configure UIImageView [containerView addSubview:button]; [containerView addSubview:imageView]; self.tableView.tableHeaderView = containerView; [imageView release]; [containerView release]; } None of the other methods (viewDidLoad/Unload, etc) are overloaded. This controller is hosted in a tab. When I switch to another tab and simulate a memory warning, and then come back to this tab, my UITableView is missing my custon header. All the rows/section are visible as I would expect. Putting a BP in the loadView code above, I see it being invoked when I switch back to the tab after the memory warning, and yet I can't actually see the header. Any ideas about what I'm missing here? EDIT: This happens on the device and the simulator. On the device, I just let a memory warning occur by opening a bunch of different apps while mine is in the background.

    Read the article

  • Error while reading custom configuration file(app.config)

    - by Newbie
    I am making a custom configuration in my winform application. (It will represent a country-corrency list) First the CountryList class namespace UtilityMethods { public class CountryList : ConfigurationSection { public CountryList() { // // TODO: Add constructor logic here // } [ConfigurationProperty("CountryCurrency", IsRequired = true)] public Hashtable CountryCurrencies { get { return CountryCurrency.GetCountryCurrency(); } } } } The GetCountryCurrency() method is defined in CountryCurrency class as under namespace UtilityMethods { public static class CountryCurrency { public static Hashtable GetCountryCurrency() { Hashtable ht = new Hashtable(); ht.Add("India", "Rupees"); ht.Add("USA", "Dollar"); return ht; } } } The app.config file looks like <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name ="CountryList1" type ="UtilityMethods.CountryList,CountryList,Version=2.0.0.0, Culture=neutral"/> </configSections> <appSettings /> </configuration> And I am calling this from a button_click's event as try { CountryList cList = ConfigurationManager.GetSection("CountryList") as CountryList; Hashtable ht = cList.CountryCurrencies; } catch (Exception ex) { string h = ex.Message; } Upon running the application and clicking on the button I am getting this error Could not load type 'UtilityMethods.CountryList' from assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Please help (dotnet framework : 3.5 Language: C#)

    Read the article

  • ASP.NET MVC 2 - Custom route doesn't find controller action

    - by mcfroob
    For some reason my application isn't routing to my controller method correctly. I have a routelink like this in my webpage - <%= Html.RouteLink("View", "Blog", new { id=(item.BlogId), slug=(item.Slug) }) %> In global.asax.cs I have the following routes - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "MoreBlogs", "Blog/Page/{page}", new { controller = "Blog", action = "Index" } ); routes.MapRoute( "Blog", "Blog/View/{id}/{slug}", new { controller = "Blog", action = "View"} ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Blog", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); And then I have a class BlogController that has a method - public ActionResult View(int id, string slug) { ... etc. } I put a breakpoint in the first line of the View method but it's not getting hit at all. I checked with a route debugger for the format localhost/Blog/View/1/test and it matched my custom route. All I'm getting is a 404 while running this, I can't work out why the route won't post to the view method in my controller - any ideas?

    Read the article

  • Custom Header in ASIHTTPREQUEST

    - by Sharon Nathaniel
    Here is my problem. I am using ASIHTTPREQUEST to send request and get response. Now my need of the time is to upload a image,audio , video or docs via PUT method with a custom header . The header takes filename , filesize,sha256sum,username,mediatype,resume as parameters. Here is the code how I am doing that . -(void)uploadFile { NSString *resume =@"0"; NSUserDefaults *userCredentials =[NSUserDefaults standardUserDefaults]; NSString *userName =[userCredentials objectForKey:@"userName"]; NSArray *objects =[NSArray arrayWithObjects:selectedMediaType,delegate.fileName,userName,fileSize,fileSHA256Sum,resume, nil]; NSArray *keys =[NSArray arrayWithObjects:@"mediatype",@"file_name",@"usrname",@"filesize",@"sha256sum",@"resume", nil]; discSentValue =[NSDictionary dictionaryWithObjects:objects forKeys:keys]; NSURL *url = [NSURL URLWithString:@"http://briareos.code20.com/putmedia.php"]; uploadMedia = [ASIFormDataRequest requestWithURL:url]; [uploadMedia addRequestHeader:@"MEDIA_UPLOAD_CUSTOM_HEADER" value:[discSentValue JSONRepresentation]]; [uploadMedia setData:dataToUpload forKey:@"File"]; [uploadMedia setDelegate:self]; [uploadMedia setRequestMethod:@"PUT"]; [uploadMedia startAsynchronous]; } But the server is unable to recognize the header , it always returns "invalid header"

    Read the article

  • asp.net custom control with form field validation issue

    - by Ibrar Afzal
    Hi, I have created a custom asp .net control some fields have validation controal associated with them. The problem arised when I declare more than one initializtion on a page. When I hit submit on one of the intialized control. Form validation occur on all other control that were declared. Due to this issue I can submit a for. Here is the code `<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FinancialAdvisorHelp.ascx.cs" Inherits="FinancialAdvisorHelp" %                                           Invalid Email." Member Name* E-Mail Address* Telephone Number Ask Darryl your question Note: you should receive a response within two (2) business days. *Required information.   `

    Read the article

  • wanted to extend jQuery to handle a custom enter key event based on tabindex

    - by ullasvk
    I write the following code to handle when the enter key pressed an with few validation like if it is a textarea allow only four lines and if the value is empty, focus on itself. var temp = 1; function getLines(id) { return temp=temp+id; } $("#theform").keypress(function(e){ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; if (key == 13) { var $targ = $(e.target); var tindex = $targ.attr("tabindex"); var count =1; var focusNext = false; var allowedNumberOfLines = 4; if ($targ.is("textarea") && !$targ.is(":button,:submit")) { var lines= getLines(count); if (lines > allowedNumberOfLines) { $("#login_error").css('background', '#F7F77C').fadeIn(1000).html("Only "+allowedNumberOfLines+" Lines Allowed").fadeOut(1000); tindex++; $("[tabindex=" + tindex + "]").focus(); return false; } } else if($targ.val() =='' || $targ.val() == "undefined") { $("[tabindex=" + tindex + "]").focus(); return false; } else if($targ.val() !='' || $targ.val() != "undefined") { tindex++; $("[tabindex=" + tindex + "]").focus(); return false; } } }); Is there any way to make it a custom function so that i can just call the function like $('theform').returnPress();

    Read the article

  • Why won't my Setup Project Perform my Custom Registration Process

    - by Jordan S
    I am trying to write an Setup Project/Installer for a class library driver that I wrote in C# using Visual Studio 2008. The driver project has a section of code that looks like this... [ComRegisterFunction] public static void RegisterASCOM(Type t) { Trace.WriteLine("Registration Started."); DoRegistration(true); } In the driver project Properties - "Assembly Information" I have set checked the box that says Make COM-Visible = true. I added a Setup Project to the solution in VS, added the output dll from the driver project so that it installs on the target machine and set the Register property of the dll to "vsdraCOM". So, my understanding is that when the installer runs it SHOULD execute the methods of the dll that are marked with [COMRegisterFunction]. Using SysInternals Debug View I can monitor when the above code snippet is hit by watching for the "Registration started" text to show up in the window. When I build the solution, I can see the text show up so I know the driver is registering properly. The problem is that when I run the installer, I don't think it is doing the registration bit. I see nothing show up in Debug View. And if i try to access my driver via another application I get an error saying it "Cannot create ActiveX object". Why does the registration not occur during the install process? The driver does register for COM but it does NOT call my custom registration method. Does anyone have and suggestions of what I could be missing? Is there another way I can debug this? (I can provide more code if anyone want's to take a look!!)

    Read the article

  • Custom UITableViewCell trouble with UIAccessibility elements

    - by ojreadmore
    No matter what I try, I can't keep my custom UITableViewCell from acting like it should under the default rules for UIAccessiblity. I don't want this cell to act like an accessibility container (per se), so following this guide I should be able to make all of my subviews accessible, right?! It says to make each element accessible separately and make sure the cell itself is not accessible. - (BOOL)isAccessibilityElement { return NO; } - (NSString *)accessibilityLabel { return nil; } - (NSInteger)accessibilityElementCount { return 0; } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier //cells use this reusage stuff { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self setIsAccessibilityElement:NO]; sub1 = [[UILabel alloc] initWithFrame:CGRectMake(0,0,1,1)]; [sub1 setAccessibilityLanguage:@"es"]; [sub1 setIsAccessibilityElement:YES]; [sub1 setAccessibilityLabel:sub1.text] sub2 = [[UILabel alloc] initWithFrame:CGRectMake(0,0,1,1)]; [sub2 setAccessibilityLanguage:@"es"]; [sub2 setIsAccessibilityElement:YES]; [sub2 setAccessibilityLabel:sub2.text] The voice over system reads the contents of the whole cell all at once, even though I'm trying to stop that behavior. I could say [sub2 setIsAccessibilityElement:NO]; but that would would make this element entirely unreadable. I want to keep it readable, but not have the whole cell be treated like a container (and assumed to be the English language). There does not appear to be a lot of information out there on this, so at the very least I'd like to document it.

    Read the article

  • Custom UITableViewCell from xib isn't displaying properly

    - by Kenny Wyland
    I've created custom UITableCells a bunch of times and I've never run into this problem, so I'm hoping you can help me find the thing I've missed or messed up. When I run my app, the cells in my table view appear to be standard cells with Default style. I have SettingsTableCell which is a subclass of UITableViewCell. I have a SettingsTableCell.xib which contains a UITableViewCell and inside that are a couple labels and a textfield. I've set the class type in the xib to be SettingsTableCell and the File's Owner of the xib to my table controller. My SettingsTableController has an IBOutlet property named tableCell. My cellForRowAtIndexPath contains the following code to load my table view xib and assign it to my table controller's tableCell property: static NSString *CellIdentifier = @"CellSettings"; SettingsTableCell *cell = (SettingsTableCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"SettingsTableCell" owner:self options:nil]; cell = self.tableCell; self.tableCell = nil; NSLog(@"cell=%@", cell); } This is what my xib set up looks like in IB: When I run my app, the table displays as if all of the cells are standard Default style cells though: The seriously weird part is though... if I tap on the area of the cell where the textfield SHOULD be, the keyboard does come up! The textfield isn't visible, there's no cursor or anything like that... but it does respond. The visible UILabel is obviously not the UILabel from my xib though because the label in my xib is right justified and the one showing in the app is left justified. I'm incredibly confused about how this is happening. Any help is appreciated.

    Read the article

  • How can I design a custom control in Javascript (possibly using jQuery)

    - by Mathieu Pagé
    I'd like to create a custom control in javascript. The goal is to create a building block that has methods, properties and events and render into a div. An example of one such control would be a calendar. It would render into a div, it would have properties that would define how it's displayed and what date is selected or highlighted, it would have methods to change the current month or to select some date and it would raise events when a day is clicked or the current month is changed by a user input. I can think of lots of way to implement this and I'm not sure what is the best way. I seem to remember that it's a bad thing to augment a DOM elements with properties and method, so I ruled that out. A jQuery plugin seems like a good idea, however I'm not sure if it's appropriate to create a plugin for each and every method my control would have so I could then use it like : $('#control').method1(); $('#control').method2(); And if I do use jQuery, where do I store the private data of my control? Another idea I got was to create a new kind of object that would have a reference to a div in which it could render it's elements. So what is the prefered way to do this. If I can I would like to do this as a jQuery plugin, but I'd need guidlines on how to create methods and where to store private data. I've loked at Plugins/Authoring on jQuery website and it did not helped that much in this regard.

    Read the article

  • A Delphi Custom Control: A TRichEdit with a TLabel Above It

    - by doubleu
    Hello, I want to create an custom control (descendant of TRichEdit). I simply want add some text above the editfield. I've created my own control and I override the constructor to create a TLabel for the caption. It works, but my problem: How is it possible to move the label above the richedit? When I set Top := -5 the label begins to disappaer. Here's the code of the constructor: constructor TDBRichEditExt.Create(AOwner: TComponent); begin inherited; lblCaption := TLabel.Create(self); lblCaption.Parent := parent; lblCaption.Caption := 'Header'; lblCaption.Top := -5; end; I think it's logic that the label disappaers since the richedit is the parent. I've tried lblCaption.Parent := self.parent; To make the form which owns the richedit the parent - but this dosn't work... How could I achieve this? Thank you all!

    Read the article

  • .net mvc2 custom HtmlHelper extension unit testing

    - by alex
    My goal is to be able to unit test some custom HtmlHelper extensions - which use RenderPartial internally. http://ox.no/posts/mocking-htmlhelper-in-asp-net-mvc-2-and-3-using-moq I've tried using the method above to mock the HtmlHelper. However, I'm running into Null value exceptions. "Parameter name: view" Anyone have any idea?? Thanks. Below are the ideas of the code: [TestMethod] public void TestMethod1() { var helper = CreateHtmlHelper(new ViewDataDictionary()); helper.RenderPartial("Test"); // supposingly this line is within a method to be tested Assert.AreEqual("test", helper.ViewContext.Writer.ToString()); } public static HtmlHelper CreateHtmlHelper(ViewDataDictionary vd) { Mock<ViewContext> mockViewContext = new Mock<ViewContext>( new ControllerContext( new Mock<HttpContextBase>().Object, new RouteData(), new Mock<ControllerBase>().Object), new Mock<IView>().Object, vd, new TempDataDictionary(), new StringWriter()); var mockViewDataContainer = new Mock<IViewDataContainer>(); mockViewDataContainer.Setup(v => v.ViewData) .Returns(vd); return new HtmlHelper(mockViewContext.Object, mockViewDataContainer.Object); }

    Read the article

  • Using custom detectors with FindBugs Maven plugin

    - by Lóránt Pintér
    I have a nice JAR of some custom FindBugs detectors I'd like to use with the FindBugs Maven plugin. There is a way to do this with the plugin via the <pluginList> configuration parameter, but that only accepts local files, URLs, or resources. The only way I found for doing so is to somehow copy my JAR to a local file (maybe via the Dependency plugin) and then configure the FindBugs plugin something like this: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>2.3.1</version> <configuration> <pluginList>${project.build.directory}/my-detectors.jar</pluginList> </configuration> </plugin> But this is not very flexible. Is there a way to use Maven's dependency management features together with FindBugs' plugins? I'd like to use something like this: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <dependencies> <dependency> <groupId>com.lptr.findbugs</groupId> <artifactId>my-detectors</artifactId> <version>1.0</version> </dependency> </dependencies> </plugin> ...but this simply overrides the core FindBugs detectors.

    Read the article

  • Custom PHP Framework Feedback

    - by Jascha
    I've been learning OOP programming for about a year and a half now and have developed a fairly standard framework to which I generally abide by. I'd love some feedback or input on how I might improve some functionality or if there are some things I'm overlooking. VIEW MODE 1) Essentially everything starts at the Index.php page. The first thing I do is require my "packages.php" file that is basically a config file that imports all of the classes and function lists I'll be using. 2) I have no direct communication between my index.php file and my classes, what I've done is "pretty them up" with my viewfunctions.php file which is essentially just a conduit to the classes so that in my html I can write <?php get_title('page'); ?> instead of <?php echo $pageClass->get_title('page'); ?> Plus, I can run a couple small booleans and what not in the view function script that can better tailor the output of the class. 3) Any information brought in via the database is started from it's corresponding class that has direct communication with the database class, the only class that is allowed direct to communicate with the database (allowed in the sense that I run all of my queries with custom class code). INPUT MODE 1) Any user input is sent to my userFunctions.php. 2) My security class is then instantiated where I send whatever user input that has been posted for verification and validation. 3) If the input passes my security check, I then pass it to my DB class for input into my Database. FEEDBACK I'm wondering if there are any glaringly obvious pitfalls to the general structure, or ways I can improve this. Thank you in advance for your input. I know there is real no "right" answer for this, but I imagine a couple up votes would be in order for some strong advice regarding building frameworks. -J

    Read the article

  • Re-usable Obj-C classes with custom values: The right way

    - by Prairiedogg
    I'm trying to reuse a group of Obj-C clases between iPhone applications. The values that differ from app to app have been isolated and I'm trying to figure out the best way to apply these custom values to the classes on an app-to-app basis. Should I hold them in code? // I might have 10 customizable values for each class, that's a long signature! CarController *controller = [[CarController alloc] initWithFontName:@"Vroom" engine:@"Diesel" color:@"Red" number:11]; Should I store them in a big settings.plist? // Wasteful! I sometimes only use 2-3 of 50 settings! AllMyAppSettings *settings = [[AllMyAppSettings alloc] initFromDisk:@"settings.plist"]; MyCustomController *controller = [[MyCustomController alloc] initWithSettings:settings]; [settings release]; Should I have little, optional n_settings.plists for each class? // Sometimes I customize CarControllerSettings *carSettings = [[CarControllerSettings alloc] initFromDisk:@"car_settings.plist"]; CarController *controller = [[CarController alloc] initWithSettings:carSettings]; [carSettings release]; // Sometimes I don't, and CarController falls back to internally stored, reasonable defaults. CarController *controller = [[CarController alloc] initWithSettings:nil]; Or is there an OO solution that I'm not thinking of at all that would be better?

    Read the article

  • Using custom Qt subclasses in Python

    - by kwatford
    First off: I'm new to both Qt and SWIG. Currently reading documentation for both of these, but this is a time consuming task, so I'm looking for some spoilers. It's good to know up-front whether something just won't work. I'm attempting to formulate a modular architecture for some in-house software. The core components are in C++ and exposed via SWIG to Python for experimentation and rapid prototyping of new components. Qt seems like it has some classes I could use to avoid re-inventing the wheel too much here, but I'm concerned about how some of the bits will fit together. Specifically, if I create some C++ classes, I'll need to expose them via SWIG. Some of these classes likely subclass Qt classes or otherwise have Qt stuff exposed in their public interfaces. This seems like it could raise some complications. There are already two interfaces for Qt in Python, PyQt and PySide. Will probably use PySide for licensing reasons. About how painful should I expect it to be to get a SWIG-wrapped custom subclass of a Qt class to play nice with either of these? What complications should I know about upfront?

    Read the article

  • Custom View Engine in ASP.NET MVC 2 does not work with Areas

    - by mare
    I used the code below so far with ASP.NET MVC v1 and v2 but when I added an Area today to my application, the controller for the area couldn't find any views in my Areas/Views/controllerView folder. It issued the very well known exception that it searched those 4 standard folders but it did not look under Areas.. How can I change the code so that it will work with Areas? Maybe an example of custom view engine under ASP.NET MVC 2 with Areas support? The information about it on the net is very scarse.. Here's the code: public class PendingViewEngine : VirtualPathProviderViewEngine { public PendingViewEngine() { // This is where we tell MVC where to look for our files. /* {0} = view name or master page name * {1} = controller name */ MasterLocationFormats = new[] {"~/Views/Shared/{0}.master", "~/Views/{0}.master"}; ViewLocationFormats = new[] { "~/Views/{1}/{0}.aspx", "~/Views/Shared/{0}.aspx", "~/Views/Shared/{0}.ascx", "~/Views/{1}/{0}.ascx" }; PartialViewLocationFormats = new[] {"~/Views/{1}/{0}.ascx", "~/Views/Shared/{0}.ascx"}; } protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) { return new WebFormView(partialPath, ""); } protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) { return new WebFormView(viewPath, masterPath); } }

    Read the article

  • Django: Create custom template tag -> ImportError

    - by Alexander Scholz
    I'm sorry to ask this again, but I tried several solutions from stack overflow and some tutorials and I couldn't create a custom template tag yet. All I get is ImportError: No module named test_tag when I try to start the server via python manage.py runserver. I created a very basic template tag (found here: django templatetag?) like so: My folder structure: demo manage.py test __init__.py settings.py urls.py ... templatetags __init__.py test_tag.py test_tag.py: from django import template register = template.Library() @register.simple_tag def test_tag(input): if "foo" == input: return "foo" if "bar" == input: return "bar" if "baz" == input: return "baz" return "" index.html: {% load test_tag %} <html> <head> ... </head> <body> {% cms_toolbar %} {% foobarbaz "bar" %} {% foobarbaz "elephant" %} {% foobarbaz "foo" %} </body> </html> and my settings.py: INSTALLED_APPS = ( ... 'test_tag', ... ) Please let me know if you need further information from my settings.py and what I did wrong so I can't even start my server. (If I delete 'test_tag' from installed apps I can start the server but I get the error that test_tag is not known, of course). Thanks

    Read the article

  • Custom ASP.net UserControl List<T> Property, having trouble setting declaratively

    - by Chris McCall
    I'm developing a custom UserControl to inject JQuery hotkeys into a page declaratively on the server side. Here's the control (the important parts anyway): [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), DefaultProperty("HotKeys"), ParseChildren(true, "HotKeys"), ToolboxData("<{0}:HotKeysControl runat=\"server\"> </{0}:HotKeysControl>")] public partial class HotKeysControl : System.Web.UI.WebControls.WebControl { private string crlf = Environment.NewLine; public List<HotKey> _HotKeys; public HotKeysControl() { if (_HotKeys == null) { _HotKeys = new List<HotKey>(); } // if I uncomment this line, script is injected into the page // _HotKeys.Add(new HotKey("ctrl+r","thisControl")); } [ Category("Behavior"), Description("The hotkeys collection"), DesignerSerializationVisibility( DesignerSerializationVisibility.Content), Editor(typeof(HotKeyCollectionEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.InnerDefaultProperty) ] public List<HotKey> HotKeys { set { _HotKeys = value; } get { return _HotKeys; } } Here's the .aspx code: <%@ Register Assembly="MyCompany.ProductName.WebControls" Namespace="MyCompany.ProductName.WebControls" TagPrefix="uc" %> ... <uc:HotKeysControl ID="theHotkeys" runat="server" Visible="false"> <uc:HotKey ControlName="firstControl" KeyCode="ctrl+1" /> <uc:HotKey ControlName="thirdControl" KeyCode="ctrl+2" /> </uc:HotKeysControl> Nothing happens, as if no HotKeys objects are being added to the property collection. What Am I doing wrong? If I uncomment out the line above and "manually" add items, it works. It's something about how I'm declaratively adding hotkeys to the page. Any ideas?

    Read the article

  • Why ng-hide don't work with custom directives?

    - by javier
    I'm reading the directives section of the developers guide on angularjs.org to refresh my knowledge and gain some insights and I was trying to run one of the examples but the directive ng-hide is not working on a custom directive. Here the jsfiddle: http://jsfiddle.net/D3Nsk/: <my-dialog ng-hide="dialogIsHidden" on-close="hideDialog()"> Does Not Work Here!!! </my-dialog> <div ng-hide="dialogIsHidden"> It works Here. </div> Any idea on why this is happening? Thanks. solution Seems that the variable dialogIsHidden on the tag already make a reference to a scope variable inside the directive and not to the variable in the controller; given that the directive has it's own insolated scope, to make this work it's necesary to pass by reference the variable dialogIsHidden of the controller to the directive. Here the jsfiddle: http://jsfiddle.net/h7xvA/ changes at: <my-dialog ng-hide="dialogIsHidden" on-close="hideDialog()" dialog-is-hidden='dialogIsHidden'> and: scope: { 'close': '&onClose', 'dialogIsHidden': '=' },

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >