Search Results

Search found 1823 results on 73 pages for 'eric brown'.

Page 51/73 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • create a class attribute without going through __setattr__

    - by eric.frederich
    Hello, What I have below is a class I made to easily store a bunch of data as attributes. They wind up getting stored in a dictionary. I override __getattr__ and __setattr__ to store and retrieve the values back in different types of units. When I started overriding __setattr__ I was having trouble creating that initial dicionary in the 2nd line of __init__ like so... super(MyDataFile, self).__setattr__('_data', {}) My question... Is there an easier way to create a class level attribute with going through __setattr__? Also, should I be concerned about keeping a separate dictionary or should I just store everything in self.__dict__? #!/usr/bin/env python from unitconverter import convert import re special_attribute_re = re.compile(r'(.+)__(.+)') class MyDataFile(object): def __init__(self, *args, **kwargs): super(MyDataFile, self).__init__(*args, **kwargs) super(MyDataFile, self).__setattr__('_data', {}) # # For attribute type access # def __setattr__(self, name, value): self._data[name] = value def __getattr__(self, name): if name in self._data: return self._data[name] match = special_attribute_re.match(name) if match: varname, units = match.groups() if varname in self._data: return self.getvaras(varname, units) raise AttributeError # # other methods # def getvaras(self, name, units): from_val, from_units = self._data[name] if from_units == units: return from_val return convert(from_val, from_units, units), units def __str__(self): return str(self._data) d = MyDataFile() print d # set like a dictionary or an attribute d.XYZ = 12.34, 'in' d.ABC = 76.54, 'ft' # get it back like a dictionary or an attribute print d.XYZ print d.ABC # get conversions using getvaras or using a specially formed attribute print d.getvaras('ABC', 'cm') print d.XYZ__mm

    Read the article

  • Somewhat newb question about assy and the heap.

    - by Eric M
    Ultimately I am just trying to figure out how to dynamically allocate heap memory from within assembly. If I call Linux sbrk() from assembly code, can I use the address returned as I would use an address of a statically (ie in the .data section of my program listing) declared chunk of memory? I know Linux uses the hardware MMU if present, so I am not sure if what sbrk returns is a 'raw' pointer to real RAM, or is it a cooked pointer to RAM that may be modified by Linux's VM system? I read this: How are sbrk/brk implemented in Linux?. I suspect I can not use the return value from sbrk() without worry: the MMU fault on access-non-allocated-address must cause the VM to alter the real location in RAM being addressed. Thus assy, not linked against libc or what-have-you, would not know the address has changed. Does this make sense, or am I out to lunch?

    Read the article

  • How to suppress all Warnings

    - by Eric
    The unit tests for a product that I am taking over have not been kept up with during the products development and they are very broken. I am trying to fix them as an exercise to become familiar with the code. However, the all the deprecation warnings are a PITA as they interfere with the display of the test results. Is there a way to suppress the warnings when I execute the unit tests? Thanks!

    Read the article

  • Enumerating all hamiltonian paths from start to end vertex in grid graph

    - by Eric
    Hello, I'm trying to count the number of Hamiltonian paths from a specified start vertex that end at another specified vertex in a grid graph. Right now I have a solution that uses backtracking recursion but is incredibly slow in practice (e.g. O(n!) / 3 hours for 7x7). I've tried a couple of speedup techniques such as maintaining a list of reachable nodes, making sure the end node is still reachable, and checking for isolated nodes, but all of these slowed my solution down. I know that the problem is NP-complete, but it seems like some reasonable speedups should be achievable in the grid structure. Since I'm trying to count all the paths, I'm sure that the search must be exhaustive, but I'm having trouble figuring out how to prune out paths that aren't promising. Does anyone have some suggestions for speeding the search up? Or an alternate search algorithm?

    Read the article

  • How do I extend the classpath used for 'grails run-app'

    - by Eric
    I have the following in my Config.groovy file: grails.config.locations = [ "classpath:env.groovy" ] Now, where exactly am I supposed to place "env.groovy" such that it is available on the CLASSPATH during grails run-app? The documentation here is sorely lacking. I am able to get it to work on the pure commandline by placing "env.groovy" in $APP_HOME/etc and then running: $ grails -classpath ./etc run-app This seems a little hackish, but I can live with it... However, I am unable to get any such configuration working when I launch run-app using the Grails eclipse plugin (STS): Unable to load specified config location classpath:env.groovy : class path resource [env.groovy] cannot be opened because it does not exist I've seen related posts here, here, here, and here but the answers have been unfulfilling. I am looking for a CLASSPATH-based solution that will work with 'run-app' in development mode (both commandline and from eclipse). I know how to set up the CLASSPATH for my deployment servlet container, so that is not an issue.

    Read the article

  • EJB / JSF java.lang.ClassNotFoundException: com.ericsantanna.jobFC.dao.DAOFactoryRemote from [Module "com.sun.jsf-impl:main" from local module loader

    - by Eric Sant'Anna
    I'm in my first time using EJB and JSF, and I can't resolve this: 20:23:12,457 Grave [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost-127.0.0.1-8081-2) com.ericsantanna.jobFC.dao.DAOFactoryRemote from [Module "com.sun.jsf-impl:main" from local module loader @439db2b2 (roots: C:\jboss-as-7.1.1.Final\modules)]: java.lang.ClassNotFoundException: com.ericsantanna.jobFC.dao.DAOFactoryRemote from [Module "com.sun.jsf-impl:main" from local module loader @439db2b2 (roots: C:\jboss-as-7.1.1.Final\modules)] I'm getting this when I do an action like a selectOneMenu or a commandButton click. DAOFactory.class @Singleton @Remote(DAOFactoryRemote.class) public class DAOFactory implements DAOFactoryRemote { private static final long serialVersionUID = 6030538139815885895L; @PersistenceContext private EntityManager entityManager; @EJB private JobDAORemote jobDAORemote; /** * Default constructor. */ public DAOFactory() { // TODO Auto-generated constructor stub } @Override public JobDAORemote getJobDAO() { JobDAO jobDAO = (JobDAO) jobDAORemote; jobDAO.setEntityManager(entityManager); return jobDAO; } JobDAO.class @Stateless @Remote(JobDAORemote.class) public class JobDAO implements JobDAORemote { private static final long serialVersionUID = -5483992924812255349L; private EntityManager entityManager; /** * Default constructor. */ public JobDAO() { // TODO Auto-generated constructor stub } @Override public void insert(Job t) { entityManager.persist(t); } @Override public Job findById(Class<Job> classe, Long id) { return entityManager.getReference(classe, id); } @Override public Job findByName(Class<Job> clazz, String name) { return entityManager .createQuery("SELECT job FROM " + clazz.getName() + " job WHERE job.nome = :nome" , Job.class) .setParameter("name", name) .getSingleResult(); } ... TriggerFormBean.class @ManagedBean @ViewScoped @Stateless public class TriggerFormBean implements Serializable { private static final long serialVersionUID = -3293560384606586480L; @EJB private DAOFactoryRemote daoFactory; @EJB private TriggerManagerRemote triggerManagerRemote; ... triggerForm.xhtml (a portion with problem) </p:layoutUnit> <p:layoutUnit id="eastConditionPanel" position="center" size="50%"> <p:panel header="Conditions to Release" style="width:97%;height:97%;"> <h:panelGrid columns="2" cellpadding="3"> <h:outputLabel value="Condition Name:" for="conditionName" /> <p:inputText id="conditionName" value="#{triggerFormBean.newCondition.name}" /> </h:panelGrid> <p:commandButton value="Add Condition" update="conditionsToReleaseList" id="addConditionToRelease" actionListener="#{triggerFormBean.addNewCondition}" /> <p:orderList id="conditionsToReleaseList" value="#{triggerFormBean.trigger.conditionsToRelease}" var="condition" controlsLocation="none" itemLabel="#{condition.name}" itemValue="#{condition}" iconOnly="true" style="width:97%;heigth:97%;"/> </p:panel> </p:layoutUnit> In TriggerFormBean.class if comments daoFactory we get the same exception with triggerManagerRemote, both annotated with @EJB. I'm don't understand the relationship between my DAOFactory and the "Module com.sun.jsf-impl:main"... Thanks.

    Read the article

  • Magento backend problem

    - by Eric Di Bari
    I've just installed Magento on my website, but I can't access the backend. The frontend works fine, but in the backend once I successfully login, it takes me to a blank screen. I've read there's an issue with cookies and I've tried a range of commenting out lines in varien.php, but didn't work.

    Read the article

  • C# "Rename" Property in Derived Class

    - by Eric
    When you read this you'll be awfully tempted to give advice like "this is a bad idea for the following reason..." Bear with me. I know there are other ways to approach this. This question should be considered trivia. Lets say you have a class "Transaction" that has properties common to all transactions such as Invoice, Purchase Order, and Sales Receipt. Let's take the simple example of Transaction "Amount", which is the most important monetary amount for a given transaction. public class Transaction { public double Amount { get; set; } public TxnTypeEnum TransactionType { get; set; } } This Amount may have a more specific name in a derived type... at least in the real world. For example, the following values are all actually the same thing: Transaction - Amount Invoice - Subtotal PurchaseOrder - Total Sales Receipt - Amount So now I want a derived class "Invoice" that has a Subtotal rather than the generically-named Amount. Ideally both of the following would be true: In an instance of Transaction, the Amount property would be visible. In an instance of Invoice, the Amount property would be hidden, but the Subtotal property would refer to it internally. Invoice looks like this: public class Invoice : Transaction { new private double? Amount { get { return base.Amount; } set { base.Amount = value; } } // This property should hide the generic property "Amount" on Transaction public double? SubTotal { get { return Amount; } set { Amount = value; } } public double RemainingBalance { get; set; } } But of course Transaction.Amount is still visible on any instance of Invoice. Thanks for taking a look!

    Read the article

  • Core Data and iTunes File Sharing - Move/hide the .sqlite file on app update?

    - by Eric
    I have an iPad app that uses Core Data for data storage. I would like to enable file sharing in iTunes and I don't really want the users to be able to delete or modify the .sqlite file. Can I move the file to a different, hidden directory? Alternatively, could the file be made read-only? I wouldn't mind users having access to the file as long as it couldn't be changed. I suspect there is a trivial solution that is escaping me at the moment.

    Read the article

  • Is vbscripting that difficult?

    - by eric young
    I need to write some vbscripts in my new project. I was told by other people that vbscripting is easy, but seems to me, it is not. For example, in the following example (provided by microsoft), these functions: CreateObject, CreateShortcut, as well as these property names: TargetPath, WindowStyle, Hotkey, etc, are used, but I just cannot find the corresponding API documentation about how to use them. In other words, how do you know you need to call these functions in your vbscripts? Visual Studio 2008/2010 do not have templates for vbscript either. Could anybody tell me what I am missing, and what the best way is to do vbscripting? set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop _ & "\MyExcel.lnk") oShellLink.TargetPath = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+F" oShellLink.IconLocation = _ "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE, 0" oShellLink.Description = "My Excel Shortcut" oShellLink.WorkingDirectory = strDesktop oShellLink.Save

    Read the article

  • How can I catch a change event from an HTML text field when a user clicks on a link after editing?

    - by Eric the Red
    Our webapp has a form with fields and values that change depending on values entered. Each time there is a change event on one of the form elements, we use an expensive AJAX call to update other elements on the page. This works great for selects, radio buttons and checkboxes. The issue comes in when a user adds content to a text field, and then clicks a link without taking the focus from the text field. The browser moves to a new page, and the contents of the text field are never saved. Is there an easy way to code around this? The AJAX call is too expensive to call with each key press. Here's an example of my Prototype code at the moment: $$('.productOption input.text').invoke('observe', 'change', saveChangeEvent);

    Read the article

  • MySQL : delete from table that is used in the where clause

    - by Eric
    I am writing a small script to synchronize 2 MySQL tables ( t1 to be 'mirrored' to t2 ) In a step I would like to delete rows inside t2 that has been delete in t1 with the same id. I tried this query : delete from t2 where t2.id in ( select t2.id left join t1 on (t1.id=t2.id) where t1.id is null ) But Mysql forbid me to use t2 in the same time in the delete and in the select (sound logical by the way) Of course, I can split the query into 2 queries : first select IDs, then delete rows with these IDs. My question : do you have a cleaner way to delete row from t2 that does not exist anymore in t1 ? with one query only ?

    Read the article

  • How can I make an aggregated property support ActiveRecord::Dirty semantics?

    - by Eric
    I have an aggregated attribute which I want to be able ask about its _changed? ness, etc. composed_of :range, :class_name => 'Range', :mapping => [ %w(range_begin begin), %w(range_end end)], :allow_nil => true If I use the aggregation: foo.range = 1..10 This is what I get: foo.range # => 1..10 foo.range_changed? # NoMethodError foo.range_was # ditto foo.changed # ['range_begin', 'range_end'] So basically, I'm not getting ActiveRecord::Dirty semanitcs on aggregated attributes. Is there any way to do that? I'm not having a lot of luck with alias_attribute_with_dirty, etc.

    Read the article

  • ReflectionTypeLoadException when I try to run Enable-Migrations with Entity Framework 5.0

    - by Eric Anastas
    I'm trying to use Entity Framework for the first time on one of my projects. I'm using the code first workflow to automatically create my database. Intitaly setting up the database worked fine. Now I'm trying to migrate changes in my classes into the database. The tutorial I'm reading says I need to run "Enable-Migrations" in the package manager console. Yet when I do this I get the following error PM> Enable-Migrations System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindType[TBase](String typeName, Func`2 filter, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName) at System.Data.Entity.Migrations.Design.ToolingFacade.GetContextTypeRunner.RunCore() at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run() Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. What am I doing wrong? How do I retrieve the loader exceptions property? Also NuGet says I have EF 5.0, but Version property of the EntityFramework item in my project references says 4.4.0.0. I'm not sure if this is related.

    Read the article

  • What's the SQL function for timestamp manipulation?

    - by Eric Leroy
    I'm new to SQL and the time functions are different than mySQL so I'm having a terrible time finding a good site reference with USEFUL timestamp queries. I'm not able to locate the correct way of doing this query in SQL: Id Timestamp ----------------------------------- 1145744 2012-10-10 18:15:11.500 1145743 2012-10-10 18:15:11.313 1145742 2012-10-10 18:15:11.313 1145741 2012-10-10 18:15:11.253 1145740 2012-10-10 18:15:11.190 1145739 2012-10-10 18:15:11.190 1145738 2012-10-10 18:15:11.127 1145737 2012-10-10 18:15:11.067 1145736 2012-10-10 18:15:11.063 1145735 2012-10-10 18:15:10.940 1145734 2012-10-10 18:15:10.817 SELECT * from table WHERE Timestamp ... RANGE I need the range of 2 timestamps so I can select rows by the following parameters: second range minute range hour range day range week range month range year range Is there one function to put in 2 timestamps and get the range? or is this a mix of functions I need? Any good site references would be greatly appriceated. MSDN site isn't helping me isolate the proper way of doing this. I've been searching for about an hour trying to get the last day from 1:30PM to 1:30PM today.

    Read the article

  • Character encoding issues in MySQL

    - by Eric
    In my database we have fields where the data is not readable. I now know why it happened but I don't know how to fix it. I found a way to get the info back from the database: SELECT id, name FROM projects WHERE LENGTH(name) != CHAR_LENGTH(name); One of the rows returned shows: id | name ------------------------- 1008 | Cajón el Diablo This should be: id | name ------------------------- 1008 | Cajón el Diablo Can somebody help me figure out how to fix this problem? How can I convert this using SQL? Is SQL not good? If not, how about Python?

    Read the article

  • Does JavaScript have an equivalent to Perl's DESTROY method?

    - by Eric Strom
    Is there any method that is called or event that is dispatched right before an Element is cleaned up by the JavaScript garbage collector? In Perl I would write: package MyObj; sub new {bless {}} sub DESTROY {print "cleaning up @_\n"} and then later: { my $obj = MyObj->new; # do something with obj } # scope ends, and assuming there are no external references to $obj, # the DESTROY method will be called before the object's memory is freed My target platform is Firefox (and I have no need to support other browsers), so if there is only a Firefox specific way of doing this, that is fine. And a little background: I am writing the Perl module XUL::Gui which serves as a bridge between Perl and Firefox, and I am currently working on plugging a few memory leaks related to DOM Elements sticking around forever, even after they are gone and no more references remain on the Perl side. So I am looking for ways to either figure out when JavaScript Elements will be destroyed, or a way to force JavaScript to cleanup an object.

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >