Daily Archives

Articles indexed Saturday December 25 2010

Page 13/22 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Python: saving and loading objects and using pickle.

    - by Peterstone
    Hello, I´m trying to save and load objects using pickle module. First I declare my objects: >>> class Fruits:pass ... >>> banana = Fruits() >>> banana.color = 'yellow' >>> banana.value = 30 After that I open a file called 'Fruits.obj'(previously I created a new .txt file and I renamed 'Fruits.obj'): >>> import pickle >>> filehandler = open(b"Fruits.obj","wb") >>> pickle.dump(banana,filehandler) After do this I close my session and I began a new one and I put the next (trying to access to the object that it supposed to be saved): file = open("Fruits.obj",'r') object_file = pickle.load(file) But I have this message: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python31\lib\pickle.py", line 1365, in load encoding=encoding, errors=errors).load() ValueError: read() from the underlying stream did notreturn bytes I don´t know what to do because I don´t understand this message. Does anyone know How I can load my object 'banana'? Thank you! EDIT: As some of you have sugested I put: >>> import pickle >>> file = open("Fruits.obj",'rb') There were no problem, but the next I put was: >>> object_file = pickle.load(file) And I have error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python31\lib\pickle.py", line 1365, in load encoding=encoding, errors=errors).load() EOFError

    Read the article

  • Autostart application of WP7

    - by sv88erik
    How is it possible to auto start my application or run a process when the user turns on the phone. If you look at ex. Outloock WP7 included in the operating system then updates the icon so that you can see that there are new mail. This is a process in the back round running. But I've read a bit about this now, but can not find out that this is possible using the SDK from microsoft? Is it not possible?? If possible, how does one do that?

    Read the article

  • Is there a Perl Syntax Highlighter (outputting to HTML) like PHP's GeSHi?

    - by nebukadnezzar
    Most PHP Developers are likely familar with the Syntax Highlighter called "GeSHi", which takes code, highlights it, with the use of HTML and CSS: include('geshi.php'); $source = 'echo "hello, world!"; $language = 'php'; $path = 'geshi/'; $geshi = new GeSHi($source, $language, $path); echo $geshi->parse_code(); GeSHi Supports a wide range of languages. I wonder, is there a similar Module for Perl?

    Read the article

  • Why would SQL be very slow when doing updates?

    - by ooo
    Suddenly doing updates into a few tables have gotten 10 times slower than they used to be. What are some good recommendations to determine root cause and optimization? Could it be that indexing certain columns are causing updates to be slow? Any other recommendations? I guess more important than guesses would be help on the process of identifying the root cause or metrics around performance. Is there anything in Fluent NHibernate that you can use to help identify the root cause of performance issues?

    Read the article

  • How to make Universal Feed Parser only parse feeds?

    - by piquadrat
    I'm trying to get content from external feeds on my Django web site with Universal Feed Parser. I want to have some user error handling, e.g. if the user supplies a URL that is not a feed. When I tried how feedparser responds to faulty input, I was surprised to see that feedparser does not throw any Exceptions at all. E.g. on HTML content, it tries to parse some information from the HTML code, and on non-existing domains, it returns a mostly empty dictionary: {'bozo': 1, 'bozo_exception': URLError(gaierror(-2, 'Name or service not known'),), 'encoding': 'utf-8', 'entries': [], 'feed': {}, 'version': None} Other faulty input manifest themselves in the status_code or the namespaces values in the returned dictionary. So, what's the best approach to have sane error checking without resorting to an endless cascade of if .. elif .. elif ...?

    Read the article

  • IO Exception on invoking execute() method of HttpGet class

    - by AndroidNoob
    Why I'm getting IOException in this peace of code? Thanks. HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://www.google.com/"); HttpResponse response; try { response = httpclient.execute(httpget); } catch (ClientProtocolException e) { Toast.makeText(this, "ClientProtocolEx", Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (IOException e) { Toast.makeText(this, "IOEx", Toast.LENGTH_LONG).show(); e.printStackTrace(); }

    Read the article

  • Trying to create a Reg Ex for the following patterns

    - by Travis
    Here are the patterns: Red,Green (and so on...) Red (+5.00),Green (+6.00) (and so on...) Red (+5.00,+10.00),Green (+6.00,+20.00) (and so on...) Red (+5.00),Green (and so on...) Each attribute ("Red,"Green") can have 0, 1, or 2 modifiers (shown as "+5.00,+10.00", etc.). I need to capture each of the attributes and their modifiers as a single string (i.e. "Red (+5.00,+10.00)", "Green (+6.00,+20.00)". Help?

    Read the article

  • <jaxrs:client> not getting autowired

    - by himangshu
    I am trying to build a restful client using jaxrs:client as defined in http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml In my test class I am getting org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.abc.service.ExportServiceTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.bankbazaar.service.ExportService com.abc.service.ExportServiceTest.exportClient; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.abc.service.ExportService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value=exportClient)} this is my spring config However exportClient=(ExportService)applicationContext.getBean("exportClient"); this works. Thanks Himangshu

    Read the article

  • Why is the binding icon not visible in blend?

    - by Ankit Rathod
    Hello, Why is the binding icon (a small gray icon) not visible in blend for some properties even though they are DependencyProperties? For eg. I dragged a button on my page and dragged a textbox. I want to bind button's content property to textbox's text property. But i can't find the Binding icon in Blend. I know if i type the binding syntax in code it will work just fine. But why is that icon missing? Thanks in advance :)

    Read the article

  • Could not determine metatable error binding list to asp.net datagridview

    - by Scott Vercuski
    I am working with the following block of code ... List<ThemeObject> themeList = (from theme in database.Themes join image in database.DBImages on theme.imageID equals image.imageID into resultSet from item in resultSet select new ThemeObject { Name = theme.Name, ImageID = item.imageID}).ToList(); dgvGridView.DataSource = themeList; dgvGridView.DataBind(); The list object populates fine. The datagrid is setup with 2 columns. A textbox column for the "Name" which is bound to "Name" An image column which is bound to the "ImageID" field When I execute the code I receive the following error on the DataBind() Could not determine a MetaTable. A MetaTable could not be determined for the data source '' and one could not be inferred from the request URL. Make sure that the table is mapped to the dats source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute. I'm not using any dynamicdataroutes as far as I can tell. Has anyone experienced this error before?

    Read the article

  • Fill ComboBox Dynamically in asp.net.. help required

    - by Abid Ali
    The Scenario which i have thought and which i want to do is that I have 2 combo boxes.. One of Country and One of Cities.. On Page Load, Country Combo box must be filled with the corresponding values present in the Database and at that time My Cities Combo box should be hidden.. By selecting the Country from the Filled Country Combo Box, the hidden Combo Box that is the Cities Combo Box visible to true and filled with those cities that the user selected the country from the country combo box... Can any one help me with that?

    Read the article

  • Importing package as a submodule

    - by wecac
    Hi, I have a package 3rd party open source package "foo"; that is in beta phase and I want to tweak it to my requirements. So I don't want to get it installed in /usr/local/lib/python or anywhere in current sys.path as I can't make frequent changes in top level packages. foo/ __init__.py fmod1.py import foo.mod2 fmod2.py pass I want to install the the package "foo" as a sub package of my namespace say "team.my_pkg". So that the "fullname" of the package becomes "team.my_pkg.foo" without changing the code in inner modules that refer "team.my_pkg.foo" as "foo". team/ __init__.py my_pkg/ __init__.py foo/ fmod1.py import foo.mod2 fmod2.py pass One way to do this is to do this in team.my_pkg.init.py: import os.path import sys sys.path.append(os.path.dirname(__file__)) But I think it is very unsafe. I hope there is some way that only fmod1.py and fmod2.py can call "foo" by its short name everything else should use its complete name "team.my_pkg.foo" I mean this should fail outside team/my_pkg/foo: import team.my_pkg import foo But this should succeed outside team/my_pkg/foo: import team.my_pkg.foo

    Read the article

  • indexing question

    - by user522962
    I have a table w/ 3 columns: name, phone, date. I have 3 indexes: 1 on phone, 1 on date and 1 on phone and date. I have the following statement: SELECT * FROM ( SELECT * FROM people WHERE phone IS NOT NULL ORDER BY date DESC) as t GROUP BY phone Basically, I want to get all unique phone numbers ordered by date. This table has about 2.5 million rows but takes forever to execute....are my indexes right? UPDATE: My EXPLAIN statement comes back with 2 rows: 1 for primary table and 1 for derived table. It says I am using temporary and using filesort for my primary table. For my derived table, it says my possible keys are (phone), and (phone, date) but it is using filesort.

    Read the article

  • Strange lazy load problem

    - by JooLio
    public class QuickQuoteTemplate { ... public virtual IList<QuickQuoteTemplateItem> InnerItems { get; set; } ... } public class QuickQuoteTemplateItem { ... public virtual IList<QuickQuoteTemplateItem> InnerItems { get; set; } ... } <class name="QuickQuoteTemplate" table="SA_QUICK_QUOTE_TEMPLATE"> ... <bag name="InnerItems" lazy="false" inverse="true" cascade="delete" > <key column="PARENT_QQ_TEMPLATE_ID" ></key> <one-to-many class="QuickQuoteTemplateItem" /> </bag> ... </class> <class name="QuickQuoteTemplateItem" table="SA_QUICK_QUOTE_TEMPLATE_ITEMS"> ... <bag name="InnerItems" lazy="false" inverse="false" cascade="delete"> <key column="PARENT_ITEM_ID" /> <one-to-many class="QuickQuoteTemplateItem" /> </bag> ... </class> InnerItems collections is set as no lazy, but after disposing the ISession instance, quickQuote.InnerItems is crying "failed to lazily initialize a collection, no session or session was closed". I've even tried to call InnerItems before the session is closed by myself. It successfully retrieves, but after disposing of the session it becomes not initialized.

    Read the article

  • Return type from DAL class (Sql ce, Linq to Sql)

    - by bretddog
    Hi, Using VS2008 and Sql CE 3.5, and preferably Linq to Sql. I'm learning database, and unsure about DAL methods return types and how/where to map the data over to my business objects: I don't want direct UI binding. A business object class UserData, and a class UserDataList (Inherits List(Of UserData)), is represented in the database by the table "Users". I use SQL Compact and run SqlMetal which creates dbml/designer.vb file. This gives me a class with a TableAttribute: <Table()> _ Partial Public Class Users I'm unsure how to use this class. Should my business object know about this class, such that the DAL can return the type Users, or List(Of Users) ? So for example the "UserDataService Class" is a part of the DAL, and would have for example the functions GetAll and GetById. Will this be correct : ? Public Class UserDataService Public Function GetAll() As List(Of Users) Dim ctx As New MyDB(connection) Dim q As List(Of Users) = From n In ctx.Users Select n Return q End Function Public Function GetById(ByVal id As Integer) As Users Dim ctx As New MyDB(connection) Dim q As Users = (From n In ctx.Users Where n.UserID = id Select n).Single Return q End Function And then, would I perhaps have a method, say in the UserDataList class, like: Public Class UserDataList Inherits List(Of UserData) Public Sub LoadFromDatabase() Me.clear() Dim database as New UserDataService dim users as List(Of Users) users = database.GetAll() For each u in users dim newUser as new UserData newUser.Id = u.Id newUser.Name = u.Name Me.Add(newUser) Next End Sub End Class Is this a sensible approach? Would appreciate any suggestions/alternatives, as this is my first attempt on a database DAL. cheers!

    Read the article

  • Drop down table and jquery

    - by Marcelo
    Hi, I'm trying to make a drop down table using jQuery, with a similar code like here: (from the topic: Conditional simple drop down list?) <body> <div id="myQuestions"> <select id="QuestionOptions"> <option value="A">Question A</option> <option value="B">Question B</option> </select> </div> <div id="myAnswers"> <div id="A" style="display: none;"> <div id="QuestionC"> <p>Here is an example question C.</p> </div> <div id="QuestionD"> <select id="QuestionOptionsD"> <option value="G">Question G</option> <option value="H">Question H</option> </select> </div> </div> <div id="B" style="display: none;"> <div id="QuestionE"> <p>Here is an example question E.</p> </div> <div id="QuestionF"> <select id="QuestionOptionsF"> <option value="I">Question I</option> <option value="J">Question J</option> </select> </div> </div> </div> And the jQuery part $(function () { $('#QuestionOptions').change(function () { $('#myAnswers > div').hide(); $('#myAnswers').find('#' + $(this).val()).show(); }); }); My problem is, when I finish to table the part of "myQuestions", and start to table the part of "myAnswers", the dynamic part of the table doesn't work. In this case, the myAnswers part won't be hidden, it'll be shown since the beginning. I tried to put everything in one table, then I tried to create a different table for myQuestions, then another table for myAnswers and it didn't work. Does anyone know where am I mistaking ? Sorry for any mistake in English, I'm not a native speaker. Thanks in advance.

    Read the article

  • Deleting items from datagrid (xml)

    - by Tonz
    Hello, I have a datagrid buttoncolumn which acts as delete buttons for my xml nodes. The elements are simply displayed in a boundcolumn, so there names get displayed. Each item generated gets a unique id (each time one is made id+++). My question his how can i remove a item (the entire element node with that certain id) when i click on one of the buttons in the bound column? <root> <element id="0"> <name>One</name> </element> <element id="1"> <name>Two</name> </element> </root> protected void dg_DeleteCommand(object sender, DataGridCommandEventArgs e) { XmlFunctions.Remove(index); }/*dg_DeleteCommand*/ (function on other class, where all my xml methods are written) public static void Remove(string index) { XmlDocument XMLDoc = new XmlDocument(); XMLDoc.Load(XMLFile); XPathNavigator nav = XMLDoc.CreateNavigator(); var node = nav.SelectSingleNode("/test/one[@id='" +???+ "']"); node.DeleteSelf(); XMLDoc.Save(XMLFile); } Edit: added datagrid <asp:View ID="viewDelete" runat="server"> <asp:DataGrid ID="dgDelete runat="server" AutoGenerateColumns="False" OnDeleteCommand="dg_DeleteCommand"> <Columns> <asp:BoundColumn DataField="name" HeaderText="names" /> <asp:ButtonColumn ButtonType="PushButton" Text="Delete" CommandName="Delete" ></asp:ButtonColumn> </Columns> </asp:DataGrid> </asp:View>

    Read the article

  • Passing operator as a parameter

    - by nacho4d
    Hi, I want to have a function that evaluates 2 bool vars (like a truth table) for example: since T | F : T then myfunc('t', 'f', ||); /*defined as: bool myfunc(char lv, char rv, ????)*/ should return true; how can I pass the third parameter? (I know is possible to pass it as a char* but then I will have to have another table to compare operator string and then do the operation which is something I would like to avoid) Is it possible to pass an operator like ^(XOR) or ||(OR) or &&(AND), etc in a function/method? Thanks in advance

    Read the article

  • How do I prevent my form from freezing when it is loading an image from the web at the click of a button?

    - by Vimal Basdeo
    I want to display an image from the web to a panel in another Jframe at the click of a button but whenever I click the button first the image loads and during this time the current form potentially freezes and once the image has loaded the form is displayed with the image.. How can I avoid the situation where my form freezes since it is very irritating My codes :: My current class private void btn_TrackbusActionPerformed(java.awt.event.ActionEvent evt) { try { sendMessage("Query,map,$,start,211,Arsenal,!"); System.out.println(receiveMessage()); } catch (UnknownHostException ex) { Logger.getLogger(client_Trackbus.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(client_Trackbus.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(client_Trackbus.class.getName()).log(Level.SEVERE, null, ex); } client_trackedbus nextform=new client_trackedbus(planform,connection,packet_receive,packet_send); this.setVisible(false); this.dispose(); nextform.setVisible(true); // TODO add your handling code here: } My next class that displays the image public class client_trackedbus extends javax.swing.JFrame { client_planform planform=null; DatagramSocket connection=null; DatagramPacket packet_receive=null; DatagramPacket packet_send=null; JLabel label=null; /** Creates new form client_trackedbus */ public client_trackedbus(client_planform planform,DatagramSocket connection,DatagramPacket packet_receive,DatagramPacket packet_send) { initComponents(); this.planform=planform; this.connection=connection; this.packet_receive=packet_receive; this.packet_send=packet_send; try { displayMap("http://www.huddletogether.com/projects/lightbox2/images/image-2.jpg", jPanel1, new JLabel()); } catch (MalformedURLException ex) { Logger.getLogger(client_trackedbus.class.getName()).log(Level.SEVERE, null, ex); } } private void displayMap(String url,JPanel panel,JLabel label) throws MalformedURLException{ URL imageurl=new URL(url); Image image=(Toolkit.getDefaultToolkit().createImage(imageurl)); ImageIcon icon = new ImageIcon(image); label.setIcon(icon); panel.add(label); // System.out.println(panel.getSize().width); this.getContentPane().add(panel); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); btn_Exit = new javax.swing.JButton(); btn_Plan = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Public Transport Journey Planner"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 368, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 172, Short.MAX_VALUE) ); jLabel1.setFont(new java.awt.Font("Arial", 1, 18)); jLabel1.setText("Your tracked bus"); btn_Exit.setText("Exit"); btn_Exit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_ExitActionPerformed(evt); } }); btn_Plan.setText("Plan journey"); btn_Plan.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_PlanActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(104, 104, 104) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(65, 65, 65) .addComponent(btn_Plan) .addGap(65, 65, 65) .addComponent(btn_Exit, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(20, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_Exit) .addComponent(btn_Plan)) .addContainerGap(12, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void btn_ExitActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Exitform(); } private void btn_PlanActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.setVisible(false); this.dispose(); this.planform.setVisible(true); } private void Exitform(){ this.setVisible(false); this.dispose(); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { // new client_trackedbus().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton btn_Exit; private javax.swing.JButton btn_Plan; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration }

    Read the article

  • org.hibernate.MappingException: Unknown entity:

    - by tsegay
    I tried to see all the questions on this topic but none of them helped me. And I really want to understand what is going on with my code. I have a standalone application which uses spring and Hibernate as JPA and I am trying to run the test using a single main Class My main class package edu.acct.tsegay.common; import edu.acct.tsegay.model.User; import edu.acct.tsegay.business.IUserBusinessObject; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class App { public static void main(String[] args) { try { ApplicationContext context = new ClassPathXmlApplicationContext( "Spring3AndHibernate-servlet.xml"); IUserBusinessObject userBusinessObject = (IUserBusinessObject) context .getBean("userBusiness"); User user = (User) context.getBean("user1"); user.setPassword("pass"); user.setUsername("tsegay"); System.out.println(user.getPassword()); userBusinessObject.delete(user); User user2 = new User(); user2.setUsername("habest"); user2.setPassword("pass1"); System.out.println(user2.getPassword()); /* * userBusinessObject.save(user2); * * User user3 = userBusinessObject.searchUserbyId("tsegay"); * System.out.println("Search Result: " + user3.getUsername()); */ System.out.println("Success"); } catch (Exception e) { e.printStackTrace(); } } } my application context is: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- data source --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/test" /> <property name="username" value="test" /> <property name="password" value="password" /> </bean> <!-- session factory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!-- exposed person business object --> <bean id="userBusiness" class="edu.acct.tsegay.business.UserBusinessObject"> <property name="userDao" ref="userDao" /> </bean> <bean id="user1" class="edu.acct.tsegay.model.User"> <property name="username" value="tse" /> <property name="password" value="pass" /> </bean> <!-- Data Access Object --> <bean id="userDao" class="edu.acct.tsegay.dao.UserDao"> <property name="sessionFactory" ref="sessionFactory" /> </bean> </beans> My User Model is: package edu.acct.tsegay.model; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Version; import org.hibernate.annotations.NaturalId; @Entity public class User implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String username; private String password; private Integer VERSION; @Version public Integer getVERSION() { return VERSION; } public void setVERSION(Integer vERSION) { VERSION = vERSION; } @NaturalId public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } My DAO is: package edu.acct.tsegay.dao; import edu.acct.tsegay.model.User; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.stereotype.Repository; @Repository public class UserDao implements IUserDao { private SessionFactory sessionFactory; private HibernateTemplate hibernateTemplate; public SessionFactory getSessionFactory() { return sessionFactory; } @Autowired public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; this.hibernateTemplate = new HibernateTemplate(sessionFactory); } public void save(User user) { // TODO Auto-generated method stub // getHibernateTemplate().save(user); this.hibernateTemplate.save(user); } public void delete(User user) { // TODO Auto-generated method stub this.hibernateTemplate.delete(user); } public User searchUserbyId(String username) { // TODO Auto-generated method stub return this.hibernateTemplate.get(User.class, username); } } And this my stacktrace error when i run the program: pass org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: edu.acct.tsegay.model.User; nested exception is org.hibernate.MappingException: Unknown entity: edu.acct.tsegay.model.User at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:837) at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:833) at edu.acct.tsegay.dao.UserDao.delete(UserDao.java:34) at edu.acct.tsegay.business.UserBusinessObject.delete(UserBusinessObject.java:30) at edu.acct.tsegay.common.App.main(App.java:23) Caused by: org.hibernate.MappingException: Unknown entity: edu.acct.tsegay.model.User at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:100) at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74) at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:793) at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:771) at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:843) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 6 more Please let me know if you need any more of my configuration. Any help is much appreciated..

    Read the article

  • Virtual hosting all resolving to the same files

    - by nona urbiz
    I'm trying to set up virtual hosts on my VPS (centos). I set both domain nameservers to fns1.dnspark.net and fns2.dnspark.net and set an A record there for each domain pointing to my IP address 50.16.219.8. Both domains are currently resolving to the first virtual host. What am I doing wrong? Thanks! NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/root/dylanstestserver.com ServerName dylanstestserver.com ServerAlias www.dylanstestserver.com ErrorLog logs/dylanstestserver.com-error-log CustomLog logs/dylanstestserver.com-access_log common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/root/repthis.info ServerName repthis.info ServerAlias www.repthis.info ErrorLog logs/repthis.info-error-log CustomLog logs/repthis.info-access_log common </VirtualHost>

    Read the article

  • Does mdadm allow to mix sata drives and USB -> sata drives ?

    - by marc
    Welcome, I have question, i have working array md5 of 5 drives. We are running out of space. Server don't have big usage but it have to be online. We can't add another controller. I got idea to buy a USB drive case ? Does mdadm allow to mix array created on sata drives by controller and virtual usb ? (we don't boot from mdadm) But im not sure is this will work ? Is usb drives are configurated before mdadm demon start ? Regards

    Read the article

  • What is a good listserv replacement?

    - by David Smith
    A board I'm on has about 700 - 1300 members being served from a listserv maintained by a company one of our board members is on. This restricts the ability of other board members to use the listserv unless they are employees of the company. They want to move to a system where anyone can administer the list. I'm thinking of switching to Constant Contact or Google Groups. We want something that allows list members to manage their own contact preferences and enables anyone authorized to send emails to the list.

    Read the article

  • Ubuntu 10.10 Ad-Hoc Setup (from Wireless Router, to Ubuntu Server/Desktop to Wireless Router)

    - by user60375
    Okay, so I know there are different approaches for this, but I will explain my story briefly before getting to the technical stuff. My fiancée and I are going through some financial issues (as I assume a lot of us are). We ended up having to move from our house and stay with some friends/family for 6 months, just to get ourselves caught up. (Medical bills, among other issues,etc). So this is where it gets fun. At our friends house, we are staying in the loft setup which is not near the cable modem and wireless router. I have a "hand-crafted" media center running XBMC, an Ubuntu 10.10 Server/Desktop (multi-purpose, very powerful and tons drive space), two working laptops, a between the two of us we have multiple wireless devices/phones. Now our friends Wireless router doesn't have any options for assigning IP addresses, but my router does. My current setup is: Friends Cable Modem -- Friend's Wireless Router -- Ubuntu 10.10 Server -- My Wireless Router (local-link from Friend's wireless (incoming) to sharing connection on ETH0 (outgoing)) -- to all devices. (Wireless Modem, Ubuntu Server that share's it's wireless incoming connection to the ethernet port my Wireless router share's with the rest of the devices). I setup my router to use default settings from my friend's router, using Google's DNS on my router (disabled DNS setup on Ubuntu Server), everything is assigned nicely and runs smooth. My Ubuntu server was given the address 10.42.43.1 (assuming standard from Network-Manager). (On the Ubuntu machine that shares to my wireless router; I have some server apps installed, but mainly just use Samba/NFS/Tangerine action. My problem/goal is that every device has no problem of accessing the internet from my router, the media-center has an assigned ip address, all services from all devices (ZeroConf, Avanhi, Bonjour, GIT, SSH, FTP, Apache2, etc) all work correctly except from my Ubuntu Server (which serves the wireless connection to ETH0 to another Wireless Router). The Ubuntu 10.10 Server/Desktop is not broadcasting anything (the Zeroconf Service Discovery 0.4 Gnome Applet shows the services from the Ubuntu server but no other computers can see them). I can access it from my Media-Center (Running Xbuntu 10.04) if I direct it to 10.42.43.1, no problem. But I cannot access Tangerine (Daapd) and the Samba shares do not show up on any computers for 10.42.43.1 (not in the WORKGROUP which Samba is setup simple and default but I can direct computers to that address and the shares will add except on a damn Windows 7 parition). Is this an issue with how I have my router setup and possible the gateway? An issue with Network-Manager? And issue with my Ubuntu Server/Desktop? I know there is a lot to that, but it's simpler than I probably have explained? Any help would be appreciated. If you need more details, I can provide them. If there is a better way of my attempting this home-network, please let me know. Thanks in advance for the help.

    Read the article

  • Where can I get Windows XP Home Edition, when I lost the CD? [closed]

    - by Kugel
    Possible Duplicates: How can I reinstall windows without a CD/DVD? Installing Windows Vista without system restore CD with OEM key (ie: from underside of my laptop) I came home for Christmas and there is this old notebook that my dad likes to use. I has a sticker with CD-key for Windows XP Home Edition. However the CD is long lost. I'd like to reinstall the system. Is there a way to obtain the CD? Thanks.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >