Search Results

Search found 1491 results on 60 pages for 'dan guzman'.

Page 44/60 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • align li tags with an auto width vs hard coding

    - by Diver Dan
    I am having trouble trying to get a group of li tags to align how I want. I have some basic html <div class="menu"> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> </div>? and some css .menu { border:solid 2px red; width:520px; } ul { border:solid 1px #e5e5e5; height:40px; margin:0 auto; list-style:none; width:500px; } li{ text-align:center; display:inline; margin:10px; } I dont want to hard code li widths for each of the elements but I would like for the li elements to take up all available space with the ul element. What do I need to change to get the result I am looking for? My attempt on jsfiddle

    Read the article

  • ASP.NET MVC Url Masking/Rewriting

    - by Dan Appleyard
    Let us say I have a url of subdomain.domain.com. Is there a way in ASP.NET MVC to have a url of say otherdomain.com/gotothesubdomain that takes you to subdomain.domain.com? I know that a simple redirect could do it, but I want the url to stay as otherdomain.com/gotothesubdomain. Any advice would be greatly appreciated and thanks!

    Read the article

  • Hooking entity creation in SQLAlchemy

    - by Dan Ellis
    I want to write a SessionExtension that fires a 'Foo-created' event or 'Bar-created' event every time a new Foo or new Bar is committed to the database. However, once inside the after_commit method, I don't know where to find which entities have been committed. Where do I get this information?

    Read the article

  • Problem with incomplete input when using Attoparsec

    - by Dan Dyer
    I am converting some functioning Haskell code that uses Parsec to instead use Attoparsec in the hope of getting better performance. I have made the changes and everything compiles but my parser does not work correctly. I am parsing a file that consists of various record types, one per line. Each of my individual functions for parsing a record or comment works correctly but when I try to write a function to compile a sequence of records the parser always returns a partial result because it is expecting more input. These are the two main variations that I've tried. Both have the same problem. items :: Parser [Item] items = sepBy (comment <|> recordType1 <|> recordType2) endOfLine For this second one I changed the record/comment parsers to consume the end-of-line characters. items :: Parser [Item] items = manyTill (comment <|> recordType1 <|> recordType2) endOfInput Is there anything wrong with my approach? Is there some other way to achieve what I am attempting?

    Read the article

  • How do you unit-test a method with complex input-output

    - by Dan
    When you have a simple method, like for example sum(int x, int y), it is easy to write unit tests. You can check that method will sum correctly two sample integers, for example 2 + 3 should return 5, then you will check the same for some "extraordinary" numbers, for example negative values and zero. Each of these should be separate unit test, as a single unit test should contain single assert. What do you do when you have a complex input-output? Take a Xml parser for example. You can have a single method parse(String xml) that receives the String and returns a Dom object. You can write separate tests that will check that certain text node is parsed correctly, that attributes are parsed OK, that child node belongs to parent etc. For all these I can write a simple input, for example <root><child/></root> that will be used to check parent-child relationships between nodes and so on for the rest of expectations. Now, take a look at follwing Xml: <root> <child1 attribute11="attribute 11 value" attribute12="attribute 12 value">Text 1</child1> <child2 attribute21="attribute 21 value" attribute22="attribute 22 value">Text 2</child2> </root> In order to check that method worked correctly, I need to check many complex conditions, like that attribute11 and attribute12 belong to element1, that Text 1 belongs to child1 etc. I do not want to put more than one assert in my unit-test. How can I accomplish that?

    Read the article

  • Finding the attributes on the properties of an instance of a class

    - by Dan
    Given an instance of a class I want to set properties on attributes at runtime. So I tried this, but as far as I can tell this finds the attributes on the class not the instance, so any changes I make to the attribute properties have no effect. var properties = myObject.GetType().GetProperties(); foreach (object prop in properties) { var attribute =prop.GetCustomAttributes(typeof(MyAttribute), true)[0]; //attribute.MyProp do some stuff } If I try using type descriptor like below, there is no way of getting to the attributes on the properties. var myObject= (MyClass) object; PropertyDescriptorCollection props = TypeDescriptor.GetProperties(myObject); //There is no props[0].GetCustomAttributes(

    Read the article

  • Design pattern to encapsulate common funtionality among UI controls

    - by Dan
    I'm brainstorming some ideas around a pattern to use for the following scenario. I have some 3rd party controls that I want to add common functionality to. Functionality is added by handling several of the the events and doing certain things when the events fire along with adding some private variables to hold some state info between events. I want to reuse the code and functionality so this is what I'd typically do. Create a class for this functionality and pass in the instance of the control that I want to add the functionality to in the constructor. Then I can add event handlers to the control in the instance of the class. Can anyone think of alternative patterns to use in order to create this kind of reusable functionality.

    Read the article

  • POST Ajax call results in not found using jqGrid and ASP.NET MVC 2 on IIS6

    - by Dan
    This is puzzling me. I deployed an MVC 2 application to IIS6 and everything works fine except for my jqGrid calls to get data. All is well on my development machine, but here are the two URLs I'm working with Local dev web server: POST http://localhost:port/Ctrl.mvc/JsonMethod IIS6 (notice https - not sure if that matters) POST https://www.domain.com/AppName/Ctrl.mvc/JsonMethod The latter URL results in a HTTP 404, which is really confusing as all works well on my local machine. The JsonMethod is properly declared with [AcceptVerbs(HttpVerbs.Post)] Let me know if any more info is needed - I appreciate any and all help with this!

    Read the article

  • Unit testing class in a web service in .net

    - by Dan Bailiff
    After some digging here, I took the advice in this thread: http://stackoverflow.com/questions/371961/how-to-unit-test-c-web-service-with-visual-studio-2008 I've created a separate class and my web service class is just a wrapper for that one. The problem is that when I try to create a unit test project in VS2008, it insists on creating a unit test that acts like I'm testing the web service calls instead of the class I specified. I can't get to the class I'm trying to test. I have a web service "subscription_api.asmx". The code behind is "subscription_api.cs" which contains the web method wrapper calls to the real code at "subscription.cs". I would expect to be able to do the following: [TestMethod()] public void GetSystemStatusTest() { subscription sub = new subscription(); XmlNode node = sub.GetSystemStatusTest(); Assert.IsNotNull(node); } But instead I get this mess which is autogenerated from VS'08: /// <summary> ///A test for GetSystemStatus ///</summary> // TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example, // http://.../Default.aspx). This is necessary for the unit test to be executed on the web server, // whether you are testing a page, web service, or a WCF service. [TestMethod()] [HostType("ASP.NET")] [AspNetDevelopmentServerHost("C:\\CVSROOT\\rnr\\pro\\product\\wms\\ss\\subscription_api", "/subscription_api")] [UrlToTest("http://localhost/subscription_api")] public void GetSystemStatusTest() { subscription_Accessor target = new subscription_Accessor(); // TODO: Initialize to an appropriate value XmlNode expected = null; // TODO: Initialize to an appropriate value XmlNode actual; actual = target.GetSystemStatus(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); } Additionally, there is a "subscription_api.accessor" in the Test References folder. When I try this: [TestMethod()] public void GetSystemStatusTest2() { subscription_Accessor sub = new subscription_Accessor(); XmlNode node = sub.GetSystemStatus(); Assert.IsNotNull(node); } I get an error: Test method subscription_api.Test.subscriptionTest.GetSystemStatusTest2 threw exception: System.TypeInitializationException: The type initializer for 'subscription_Accessor' threw an exception. ---> System.ArgumentNullException: Value cannot be null. I'm really new to unit testing and feel lost. How can I create a unit test just for my subscription class in "subscription.cs" without testing the web service? Am I limited to testing within the same project (I hope not)? Do I have to put the target class in its own project outside of the web service project?

    Read the article

  • How to manage user authentication/sessions?

    - by Dan
    What is the best way to manage user authentication/sessions in a web app, ideally in a clustered environment, using Spring Framework/MVC? I thought of creating a login bean that creates a jsession for authenticated users and then using AOP to check for the jsession before each controller method inovcation. If there isn't a better way, what are some possible alternatives? Thanks.

    Read the article

  • Indirect load of type fails in PowerShell

    - by Dan
    When invoking [System.Configuration.ConfigurationManager]::GetSection("MySection") from within a PowerShell prompt, it throws an exception because the assembly containing the type represented by "MySection" in the app config is unable to be loaded. However, I have previously loaded the assembly containing that type, and I am even able to instantiate the type directly using 'new-object'. How is the ConfigurationManager resolving types such that the assemblies already loaded into the PowerShell app domain are not visible to it?

    Read the article

  • How should I migrate a site from ZWiki to MediaWiki?

    - by Dan L
    I have a fairly extensive wiki on ZWiki on Zope (in turn on Plone). Most pages are in reStructured text format, but there are several in straight HTML as well. What is the best approach to migrate those pages over to a MediaWiki wiki with pages converted to MediaWiki and HTML formats? Of course I'd like to automagically convert all links (internal and external).

    Read the article

  • Regex to test if an input string contains a certain number of characters

    - by Dan
    So, I basically would like to test to see if a string contains a range of alphanumeric characters. It's to be used as a client-side validation and I don't want to prevent users from entering whatever they want. Best to give examples of what should/should not pass validation: So to be specific, the expression I'm looking for is to test to make sure string contains anywhere from 3 to 10 alphanumeric characters. I'd like to plug into an ASP.NET client side validator. NOTE: quotes not part of input (but could be!) " f o o " should pass since there are 3 chars "f_0_0" should pass " fo " should not "F......o......o......b.....a......r" should pass thx

    Read the article

  • NullPointerException when adding to BigDecimal

    - by Dan
    String[] toppings = new String[10]; BigDecimal toppingsPrice = null; toppings[0] = req.getParameter("extraCheese"); toppings[1] = req.getParameter("moreTomatoes"); toppings[2] = req.getParameter("extraOnions"); // ... for(int i = 0; i < toppings.length; i++) { if(toppings[i] != null) { toppingsPrice.add(new BigDecimal("0.99")); // <-- NPE is caused here. toppingsPrice = toppingsPrice.setScale(2, BigDecimal.ROUND_HALF_EVEN); } } I am getting a NullPointerException in the above code when adding 0.99 to toppingsPrice. I am working with money values, so I have used BigDecimal. Is there something wrong with how I am adding the 0.99c price?

    Read the article

  • directory resource does not create directory

    - by Dan Tenenbaum
    I have a Vagrantfile that provisions a VM by running a chef recipe. The first resource in the chef recipe is: directory "/downloads" do owner "root" group "root" mode "0755" action :create end # check that it worked: raise "/downloads doesn't exist!" unless File.exists? "/downloads" When I run this at work, it works fine. When I run it at home, it fails, the exception is raised when I check to see if /downloads exists. I'm not sure why this is happening. I would expect it to behave identically, since the underlying Vagrant box is the same both at work and at home. I am a chef newb so perhaps there is something I am not understanding about the order in which the resources are run within my recipe? I would expect them to run in sequential order... I also tried putting a notifies call inside the directory block, where I call another execute block :immediately. That works, but inside the second execute block I test to see whether /downloads has been created and it hasn't. Clearly I'm missing something very basic.

    Read the article

  • How do you overide a class that is called by another class with parent::method

    - by dan.codes
    I am trying to extend Mage_Catalog_Block_Product_View I have it setup in my local directory as its own module and everything works fine, I wasn't getting the results that I wanted. I then saw that another class extended that class as well. The method I am trying to override is the protected function _prepareLayout() This is the function class Mage_Review_Block_Product_View extends Mage_Catalog_Block_Product_View protected function _prepareLayout() { $this-&gt;getLayout()-&gt;createBlock('catalog/breadcrumbs'); $headBlock = $this-&gt;getLayout()-&gt;getBlock('head'); if ($headBlock) { $title = $this-&gt;getProduct()-&gt;getMetaTitle(); if ($title) { $headBlock-&gt;setTitle($title); } $keyword = $this-&gt;getProduct()-&gt;getMetaKeyword(); $currentCategory = Mage::registry('current_category'); if ($keyword) { $headBlock-&gt;setKeywords($keyword); } elseif($currentCategory) { $headBlock-&gt;setKeywords($this-&gt;getProduct()-&gt;getName()); } $description = $this-&gt;getProduct()-&gt;getMetaDescription(); if ($description) { $headBlock-&gt;setDescription( ($description) ); } else { $headBlock-&gt;setDescription( $this-&gt;getProduct()-&gt;getDescription() ); } } return parent::_prepareLayout(); } I am trying to modify it just a bit with the following, keep in mind I know there is a title prefix and suffix but I needed it only for the product page and also I needed to add text to the description. class MyCompany_Catalog_Block_Product_View extends Mage_Catalog_Block_Product_View protected function _prepareLayout() { $storeId = Mage::app()-&gt;getStore()-&gt;getId(); $this-&gt;getLayout()-&gt;createBlock('catalog/breadcrumbs'); $headBlock = $this-&gt;getLayout()-&gt;getBlock('head'); if ($headBlock) { $title = $this-&gt;getProduct()-&gt;getMetaTitle(); if ($title) { if($storeId == 2){ $title = "Pool Supplies Fast - " .$title; $headBlock-&gt;setTitle($title); } $headBlock-&gt;setTitle($title); }else{ $path = Mage::helper('catalog')-&gt;getBreadcrumbPath(); foreach ($path as $name =&gt; $breadcrumb) { $title[] = $breadcrumb['label']; } $newTitle = "Pool Supplies Fast - " . join($this-&gt;getTitleSeparator(), array_reverse($title)); $headBlock-&gt;setTitle($newTitle); } $keyword = $this-&gt;getProduct()-&gt;getMetaKeyword(); $currentCategory = Mage::registry('current_category'); if ($keyword) { $headBlock-&gt;setKeywords($keyword); } elseif($currentCategory) { $headBlock-&gt;setKeywords($this-&gt;getProduct()-&gt;getName()); } $description = $this-&gt;getProduct()-&gt;getMetaDescription(); if ($description) { if($storeId == 2){ $description = "Pool Supplies Fast - ". $this-&gt;getProduct()-&gt;getName() . " - " . $description; $headBlock-&gt;setDescription( ($description) ); }else{ $headBlock-&gt;setDescription( ($description) ); } } else { if($storeId == 2){ $description = "Pool Supplies Fast: ". $this-&gt;getProduct()-&gt;getName() . " - " . $this-&gt;getProduct()-&gt;getDescription(); $headBlock-&gt;setDescription( ($description) ); }else{ $headBlock-&gt;setDescription( $this-&gt;getProduct()-&gt;getDescription() ); } } } return Mage_Catalog_Block_Product_Abstract::_prepareLayout(); } This executs fine but then I notice that the following class Mage_Review_Block_Product_View_List extends which extends Mage_Review_Block_Product_View and that extends Mage_Catalog_Block_Product_View as well. Inside this class they call the _prepareLayout as well and call the parent with parent::_prepareLayout() class Mage_Review_Block_Product_View_List extends Mage_Review_Block_Product_View protected function _prepareLayout() { parent::_prepareLayout(); if ($toolbar = $this-&gt;getLayout()-&gt;getBlock('product_review_list.toolbar')) { $toolbar-&gt;setCollection($this-&gt;getReviewsCollection()); $this-&gt;setChild('toolbar', $toolbar); } return $this; } So obviously this just calls the same class I am extending and runs the function I am overiding but it doesn't get to my class because it is not in my class hierarchy and since it gets called after my class all the stuff in the parent class override what I have set. I'm not sure about the best way to extend this type of class and method, there has to be a good way to do this, I keep finding I am running into issues when trying to overide these prepare methods that are derived from the abstract classes, there seems to be so many classes overriding them and calling parent::method. What is the best way to override these functions?

    Read the article

  • Loading views dynamically

    - by Dan
    Case 1: I have created View-based sample application and tried execute below code. When I press on "Job List" button it should load another view having "Back Btn" on it. In test function, if I use [self.navigationController pushViewController:jbc animated:YES]; nothing gets loaded, but if I use [self presentModalViewController:jbc animated:YES]; it loads another view haveing "Back Btn" on it. Case 2: I did create another Navigation Based Applicaton and used [self.navigationController pushViewController:jbc animated:YES]; it worked as I wanted. Can someone please explain why it was not working in Case 1. Does it has something to do with type of project that is selected? @interface MWViewController : UIViewController { } -(void) test; @end @interface JobViewCtrl : UIViewController { } @end @implementation MWViewController (void)viewDidLoad { UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Job List!" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; [super viewDidLoad]; } -(void) test { JobViewCtrl* jbc = [[JobViewCtrl alloc] init]; [self.navigationController pushViewController:jbc animated:YES]; //[self presentModalViewController:jbc animated:YES]; [jbc release]; } (void)dealloc { [super dealloc]; } @end @implementation JobViewCtrl -(void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.view.backgroundColor = [UIColor grayColor]; UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Back Btn!" forState:UIControlStateNormal]; [self.view addSubview:btn]; } @end

    Read the article

  • Multiple left joins, how to output in php

    - by Dan
    I have 3 tables I need to join. The contracts table is the main table, the 'jobs' and 'companies' table are extra info that can be associated to the contracts table. so, since I want all entries from my 'contracts' table, and the 'jobs' and 'companies' data only if it exists, I wrote the query like this.... $sql = "SELECT * FROM contracts LEFT JOIN jobs ON contracts.job_id = jobs.id LEFT JOIN companies ON contracts.company_id = companies.id ORDER BY contracts.end_date"; Now how would I output this in PHP? I tried this but kept getting an undefined error "Notice: Undefined index: contracts.id"... $sql_result = mysql_query($sql,$connection) or die ("Fail."); if(mysql_num_rows($sql_result) > 0){ while($row = mysql_fetch_array($sql_result)) { $contract_id = stripslashes($row['contracts.id']); $job_number = stripslashes($row['jobs.job_number']); $company_name = stripslashes($row['companies.name']); ?> <tr id="<?=$contract_id?>"> <td><?=$job_number?></td> <td><?=$company_name?></td> </tr> <? } }else{ echo "No records found"; } Any help is appreciated.

    Read the article

  • Objective-C Definedness

    - by Dan Ray
    This is an agonizingly rookie question, but here I am learning a new language and framework, and I'm trying to answer the question "What is Truth?" as pertains to Obj-C. I'm trying to lazy-load images across the network. I have a data class called Event that has properties including: @property (nonatomic, retain) UIImage image; @property (nonatomic, retain) UIImage thumbnail; in my AppDelegate, I fetch up a bunch of data about my events (this is an app that shows local arts event listings), and pre-sets each event.image to my default "no-image.png". Then in the UITableViewController where I view these things, I do: if (thisEvent.image == NULL) { NSLog(@"Going for this item's image"); UIImage *tempImage = [UIImage imageWithData:[NSData dataWithContentsOfURL: [NSURL URLWithString: [NSString stringWithFormat: @"http://www.mysite.com/content_elements/%@_image_1.jpg", thisEvent.guid]]]]; thisEvent.image = tempImage; } We never get that NSLog call. Testing thisEvent.image for NULLness isn't the thing. I've tried == nil as well, but that also doesn't work.

    Read the article

  • Java Applet - ArrayIndexOutOfBoundsException

    - by Dan
    OK so I am getting an ArrayIndexOutofBoundsException. I don't know why. Here's my code: http://www.so.pastebin.com/y5MjD1k3 The thing is when I go to the red brick at board[2][2]... I go there. Then I go up... then I TRY go to back down but that error pops up. Also when I go to the right 8 squares... I ALSO get that error. ALSO, pretend my 2d map is split into FOUR squares... well square one is the top left... if I go ANYWHERE else ... I get that error. What am I doing wrong? Thanks.

    Read the article

  • Is it possible to customize @synthesized properties?

    - by Dan K.
    I'm probably just being a bit lazy here, but bear with me. Here's my situation. I have a class with two nonatomic, retained properties. Let's say: @property (nonatomic, retain) UITextField *dateField; @property (nonatomic, retain) NSDate *date; I synthesize them as expected in the implementation. What I want to happen is that whenever the setter on date is invoked, it also does something to the dateField (i.e. it sets the text property on the dateField to be a nicely formatted version of the date). I realize I can just manually override the setter for date in my implementation by doing the following: - (void) setDate:(NSDate *)newDate { if (date != newDate) { [date release]; date = [newDate retain]; // my code to touch the dateField goes here } } What would be awesome is if I could let Objective C handle the retain/release cycle, but still be able to "register" (for lack of a better term) a custom handler that would be invoked after the retain/release/set happens. My guess is that isn't possible. My google-fu didn't come up with any answer to this, though, so I thought I'd ask.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >