Search Results

Search found 960 results on 39 pages for 'annotations'.

Page 3/39 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • SpringMvc Annotations for DAO interface and DAO implementation

    - by dev_darin
    I would like to know if I am annotating these classes correctly, since I am new to the annotations: Country.java @Component public class Country { private int countryId; private String countryName; private String countryCode; /** * No args constructor */ public Country() { } /** * @param countryId * @param countryName * @param countryCode */ public Country(int countryId, String countryName, String countryCode) { this.countryId = countryId; this.countryName = countryName; this.countryCode = countryCode; } //getters and setters } CountryDAO.java @Repository public interface CountryDAO { public List<Country> getCountryList(); public void saveCountry(Country country); public void updateCountry(Country country); } JdbcCountryDAO.java @Component public class JdbcCountryDAO extends JdbcDaoSupport implements CountryDAO{ private final Logger logger = Logger.getLogger(getClass()); @Autowired public List<Country> getCountryList() { int countryId = 6; String countryCode = "AI"; logger.debug("In getCountryList()"); String sql = "SELECT * FROM TBLCOUNTRY WHERE countryId = ? AND countryCode = ?"; logger.debug("Executing getCountryList String "+sql); Object[] parameters = new Object[] {countryId, countryCode}; logger.info(sql); //List<Country> countryList = getJdbcTemplate().query(sql,new CountryMapper()); List<Country> countryList = getJdbcTemplate().query(sql, parameters,new CountryMapper()); return countryList; } CountryManagerIFace.java @Repository public interface CountryManagerIFace extends Serializable{ public void saveCountry(Country country); public List<Country> getCountries(); } CountryManager.java @Component public class CountryManager implements CountryManagerIFace{ @Autowired private CountryDAO countryDao; public void saveCountry(Country country) { countryDao.saveCountry(country); } public List<Country> getCountries() { return countryDao.getCountryList(); } public void setCountryDao(CountryDAO countryDao){ this.countryDao = countryDao; } }

    Read the article

  • java annotations - problem with calling a locator class from a Vaadin Project

    - by George
    Hello, I'm not sure how to explain this without writing several pages so I hope the actual code is more expressive. I've made a jar containing multiple annotation declaration similar to the following: @Target(ElementType.PACKAGE) @Retention(RetentionPolicy.RUNTIME) public @interface MarkedPackage { } then I have made a test jar containing several classes in several packages and marked just one package with the above annotation (with package-info.java) like below: @myPackage.MarkedPackage package package.test.jar; this jar had in its build path the jar containing the annotations. then I made a static class that has a method (LoadPlugins) that retrieves a list with all the jars of a directory. Then it searches through the jars for the 'package-info' class and checks if that classes package contains the MarkedPackage annotation. by calling this: if (checkPackageAnnotation(thisClass.getPackage())) where thisClass is the package-info class retrieved via a classloader. and: public static boolean checkPackageAnnotation(AnnotatedElement elem) { System.out.println(elem.getAnnotations().length); if (elem == null || !elem.isAnnotationPresent(MarkedPackage.class)) return false; return true; } the elem.getAnnotatios().length is there for debug purposes. And the problem appears when I call the method from the static class: if I call it from a main function: public class MyMain { public static void main(String[] args){ PluginUtils.LoadPlugins(); } } everything works perfectly it displays '1' from that System.out.println(elem.getAnnotations().length); But if I call it from a button from my Vaadin project: header.addComponent(new Button("CallThat", new Button.ClickListener() { public void buttonClick(ClickEvent event) { PluginUtils.LoadPlugins(); } })); It displays '0' from that System.out.println(elem.getAnnotations().length); Also I should mention that I created the main inside my Vaadin project so it would have the exact same build path and resources. Is there a problem with web applications and that "@Retention(RetentionPolicy.RUNTIME)" ? hope I was clear enough... Hope someone has a solution for me... If you need more information - let me know. Thank you.

    Read the article

  • Multi-Column Join in Hibernate/JPA Annotations

    - by bowsie
    I have two entities which I would like to join through multiple columns. These columns are shared by an @Embeddable object that is shared by both entities. In the example below, Foo can have only one Bar but Bar can have multiple Foos (where AnEmbeddableObject is a unique key for Bar). Here is an example: @Entity @Table(name = "foo") public class Foo { @Id @Column(name = "id") @GeneratedValue(generator = "seqGen") @SequenceGenerator(name = "seqGen", sequenceName = "FOO_ID_SEQ", allocationSize = 1) private Long id; @Embedded private AnEmbeddableObject anEmbeddableObject; @ManyToOne(targetEntity = Bar.class, fetch = FetchType.LAZY) @JoinColumns( { @JoinColumn(name = "column_1", referencedColumnName = "column_1"), @JoinColumn(name = "column_2", referencedColumnName = "column_2"), @JoinColumn(name = "column_3", referencedColumnName = "column_3"), @JoinColumn(name = "column_4", referencedColumnName = "column_4") }) private Bar bar; // ... rest of class } And the Bar class: @Entity @Table(name = "bar") public class Bar { @Id @Column(name = "id") @GeneratedValue(generator = "seqGen") @SequenceGenerator(name = "seqGen", sequenceName = "BAR_ID_SEQ", allocationSize = 1) private Long id; @Embedded private AnEmbeddableObject anEmbeddableObject; // ... rest of class } Finally the AnEmbeddedObject class: @Embeddable public class AnEmbeddedObject { @Column(name = "column_1") private Long column1; @Column(name = "column_2") private Long column2; @Column(name = "column_3") private Long column3; @Column(name = "column_4") private Long column4; // ... rest of class } Obviously the schema is poorly normalised, it is a restriction that AnEmbeddedObject's fields are repeated in each table. The problem I have is that I receive this error when I try to start up Hibernate: org.hibernate.AnnotationException: referencedColumnNames(column_1, column_2, column_3, column_4) of Foo.bar referencing Bar not mapped to a single property I have tried marking the JoinColumns are not insertable and updatable, but with no luck. Is there a way to express this with Hibernate/JPA annotations? Thank you.

    Read the article

  • Compound Primary Key in Hibernate using Annotations

    - by Rich
    Hi, I have a table which uses two columns to represent its primary key, a transaction id and then the sequence number. I tried what was recommended http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping in section 2.2.3.2.2, but when I used the Hibernate session to commit this Entity object, it leaves out the TXN_ID field in the insert statement and only includes the BA_SEQ field! What's going wrong? Here's the related code excerpt: @Id @Column(name="TXN_ID") private long txn_id; public long getTxnId(){return txn_id;} public void setTxnId(long t){this.txn_id=t;} @Id @Column(name="BA_SEQ") private int seq; public int getSeq(){return seq;} public void setSeq(int s){this.seq=s;} And here are some log statements to show what exactly happens to fail: In createKeepTxnId of DAO base class: about to commit Transaction :: txn_id->90625 seq->0 ...<Snip>... Hibernate: insert into TBL (BA_ACCT_TXN_ID, BA_AUTH_SRVC_TXN_ID, BILL_SRVC_ID, BA_BILL_SRVC_TXN_ID, BA_CAUSE_TXN_ID, BA_CHANNEL, CUSTOMER_ID, BA_MERCHANT_FREETEXT, MERCHANT_ID, MERCHANT_PARENT_ID, MERCHANT_ROOT_ID, BA_MERCHANT_TXN_ID, BA_PRICE, BA_PRICE_CRNCY, BA_PROP_REQS, BA_PROP_VALS, BA_REFERENCE, RESERVED_1, RESERVED_2, RESERVED_3, SRVC_PROD_ID, BA_STATUS, BA_TAX_NAME, BA_TAX_RATE, BA_TIMESTAMP, BA_SEQ) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [WARN] util.JDBCExceptionReporter SQL Error: 1400, SQLState: 23000 [ERROR] util.JDBCExceptionReporter ORA-01400: cannot insert NULL into ("SCHEMA"."TBL"."TXN_ID") The important thing to note is I print out the entity object which has a txn_id set, and then the following insert into statement does not include TXN_ID in the listing and thus the NOT NULL table constraint rejects the query.

    Read the article

  • spring-nullpointerexception- cant access autowired annotated service (or dao) in a no-annotations class

    - by user286806
    I have this problem that I cannot fix. From my @Controller, i can easily access my autowired @Service class and play with it no problem. But when I do that from a separate class without annotations, it gives me a NullPointerException. My Controller (works)- @Controller public class UserController { @Autowired UserService userService;... My separate Java class (not working)- public final class UsersManagementUtil { @Autowired UserService userService; or @Autowired UserDao userDao; userService or userDao are always null! Was just trying if any one of them works. My component scan setting has the root level package set for scanning so that should be OK. my servlet context - <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <!-- the application context definition for the springapp DispatcherServlet --> <!-- Enable annotation driven controllers, validation etc... --> <context:property-placeholder location="classpath:jdbc.properties" /> <context:component-scan base-package="x" /> <tx:annotation-driven transaction-manager="hibernateTransactionManager" /> <!-- package shortended --> <bean id="messageSource" class="o.s.c.s.ReloadableResourceBundleMessageSource"> <property name="basename" value="/WEB-INF/messages" /> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${database.driver}" /> <property name="url" value="${database.url}" /> <property name="username" value="${database.user}" /> <property name="password" value="${database.password}" /> </bean> <!-- package shortened --> <bean id="viewResolver" class="o.s.w.s.v.InternalResourceViewResolver"> <property name="prefix"> <value>/</value> </property> <property name="suffix"> <value>.jsp</value> </property> <property name="order"> <value>0</value> </property> </bean> <!-- package shortened --> <bean id="sessionFactory" class="o.s.o.h3.a.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>orion.core.models.Question</value> <value>orion.core.models.User</value> <value>orion.core.models.Space</value> <value>orion.core.models.UserSkill</value> <value>orion.core.models.Question</value> <value>orion.core.models.Rating</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop> </props> </property> </bean> <bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> Any clue?

    Read the article

  • How to display downloaded youtube annotations ( not captions) on offline video player?

    - by kowalsk
    i need to display the annotations for some of my downloaded youtube videos. It's also important to make them closeable. Making them clickable would also be nice. What i found out so far: From what i understand there there is a vlc plugin/extension that could also render the annotations but i'm having a hard time finding it. Mplayer might also be an option but i'd have to convert the xml files to .bmp and then use a bmov filter to play them. Any suggestions welcome. Edit: to further clarify i would like to display/overlay annotations from a youtube xml file (i'm willing to go through a conversion step if i have to) pretty much the same way i can display subtitles from a srt or sub file. Edit2: I'm open to using other players too ( if vlc is not a feasible option for what i want)

    Read the article

  • How to setup an hibernate project using annotations compliant with JPA2.0

    - by phmr
    I would like to setup an hibernate project, for this I use the lastest hibernate 3.5-Final. BTW my IDE is Netbeans. The problem is that each time a run the application, it seems to start from a fresh database whatever db backend I use (I tried hsqldb & sqlite): here is my persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="PMMPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>model.Extrait</class> <class>model.Mot</class> <class>model.Prefixe</class> <class>model.Suffixe</class> <class>model.Texte</class> <properties> <property name="hibernate.dialect" value="dialect.SQLiteDialect"/> <property name="hibernate.connection.username" value=""/> <property name="hibernate.connection.driver_class" value="org.sqlite.JDBC"/> <property name="hibernate.connection.password" value=""/> <property name="hibernate.connection.url" value="jdbc:sqlite:test.db"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/> <property name="hibernate.hbm2ddl.auto" value="update"/> </properties> </persistence-unit> </persistence> I tried to change hibernate.hbm2ddl.auto value. I got a HibernateUtil class which takes care of creating the emf & em: public class HibernateUtil { private static EntityManagerFactory emf = null; private static EntityManager em = null; public static EntityManagerFactory getEmf() { if(emf == null) emf = Persistence.createEntityManagerFactory("PMMPU"); return emf; } public static EntityManager getEm() { if(em == null) em = getEmf().createEntityManager(); return em; } What did a I do wrong ? edit1: further research with mysql lead me to think that the problem is related to sqlite & hsqldb interaction with hibernate 3.5

    Read the article

  • Interfaces with hibernate annotations

    - by molleman
    Hello i am wondering how i would be able to annotate an interface @Entity @Table(name = "FOLDER_TABLE") public class Folder implements Serializable, Hierarchy { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "folder_id", updatable = false, nullable = false) private int fId; @Column(name = "folder_name") private String folderName; @OneToMany(cascade = CascadeType.ALL) @JoinTable(name = "FOLDER_JOIN_FILE_INFORMATION_TABLE", joinColumns = { @JoinColumn(name = "folder_id") }, inverseJoinColumns = { @JoinColumn(name = "file_information_id") }) private List< Hierarchy > fileInformation = new ArrayList< Hierarchy >(); above and below are 2 classes that implement an interface called Hierarchy, the folder class has a list of Hierarchyies being a folder or a fileinformation class @Entity @Table(name = "FILE_INFORMATION_TABLE") public class FileInformation implements Serializable, Hierarchy { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "file_information_id", updatable = false, nullable = false) private int ieId; @Column (name = "location") private String location; i have serached the web for someway to annotate or a workaround but i cannot map the interface which is simply this public interface Hierarchy { } i get a mapping exeception on the List of hierarchyies with a folder but i dont know how to map the class correctly

    Read the article

  • Setting column length of a Long value with JPA annotations

    - by Gearóid
    Hi, I'm performing a little database optimisation at the moment and would like to set the column lengths in my table through JPA. So far I have no problem setting the String (varchar) lengths using JPA as follows: @Column(unique=true, nullable=false, length=99) public String getEmail() { return email; } However, when I want to do the same for a column which is of type Long (bigint), it doesn't work. For example, if I write: @Id @Column(length=7) @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return id; } The column size is still set as the default of 20. Are we able to set these lengths in JPA or am I barking up the wrong tree? Thanks, Gearoid.

    Read the article

  • using the ASP.NET Caching API via method annotations in C#

    - by craigmoliver
    In C#, is it possible to decorate a method with an annotation to populate the cache object with the return value of the method? Currently I'm using the following class to cache data objects: public class SiteCache { // 7 days + 6 hours (offset to avoid repeats peak time) private const int KeepForHours = 174; public static void Set(string cacheKey, Object o) { if (o != null) HttpContext.Current.Cache.Insert(cacheKey, o, null, DateTime.Now.AddHours(KeepForHours), TimeSpan.Zero); } public static object Get(string cacheKey) { return HttpContext.Current.Cache[cacheKey]; } public static void Clear(string sKey) { HttpContext.Current.Cache.Remove(sKey); } public static void Clear() { foreach (DictionaryEntry item in HttpContext.Current.Cache) { Clear(item.Key.ToString()); } } } In methods I want to cache I do this: [DataObjectMethod(DataObjectMethodType.Select)] public static SiteSettingsInfo SiteSettings_SelectOne_Name(string Name) { var ck = string.Format("SiteSettings_SelectOne_Name-Name_{0}-", Name.ToLower()); var dt = (DataTable)SiteCache.Get(ck); if (dt == null) { dt = new DataTable(); dt.Load(ModelProvider.SiteSettings_SelectOne_Name(Name)); SiteCache.Set(ck, dt); } var info = new SiteSettingsInfo(); foreach (DataRowView dr in dt.DefaultView) info = SiteSettingsInfo_Load(dr); return info; } Is it possible to separate those concerns like so: (notice the new annotation) [CacheReturnValue] [DataObjectMethod(DataObjectMethodType.Select)] public static SiteSettingsInfo SiteSettings_SelectOne_Name(string Name) { var dt = new DataTable(); dt.Load(ModelProvider.SiteSettings_SelectOne_Name(Name)); var info = new SiteSettingsInfo(); foreach (DataRowView dr in dt.DefaultView) info = SiteSettingsInfo_Load(dr); return info; }

    Read the article

  • question on database query using hibernate in java with annotations

    - by molleman
    Hello, simple question regarding HQL(Hibernate query language) so i have user class , that can hold a list of Projects, how do i take this out of the database depending on a username, this is how i take out my user String username = "stephen"; YFUser user = (YFUser) session.createQuery("select u FROM YFUser u where u.username = :username").setParameter("username", name).uniqueResult(); but i want to take out the list of projects here is the projects list within the class YFUser(my user class); how would i query the database to get this list of projects @Entity @Table(name = "yf_user_table") public class YFUser implements Serializable,ILightEntity { ......... @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinTable(name = "YFUSER_JOIN_PROJECT", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "project_id") }) private List<Project> projects = new ArrayList<Project>();

    Read the article

  • Enums and Annotations

    - by PeterMmm
    I want to use an Annotation in compile-safe form. To pass the value() to the Annotation i want to use the String representation of an enum. Is there a way to use @A with a value from enum E ? public class T { public enum E { a,b; } // C1: i want this, but it won't compile @A(E.a) void bar() { // C2: no chance, it won't compile @A(E.a.toString()) void bar2() { } // C3: this is ok @A("a"+"b") void bar3() { } // C4: is constant like C3, is'nt it ? @A(""+E.a) void bar4() { } } @interface A { String value(); }

    Read the article

  • Google Annotations Gallery

    The Google Annotations Gallery is an exciting new Java open source library that provides a rich set of annotations for developers to express themselves. Do you find the...

    Read the article

  • Help combining these two queries

    - by Horace Loeb
    I need a SQL query that returns results matched by EITHER of the following SQL queries: Query 1: SELECT "annotations".* FROM "annotations" INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation' WHERE (votes.vote = 't' AND votes.voter_id = 78) Query 2: SELECT "annotations".* FROM "annotations" INNER JOIN "songs" ON "songs".id = "annotations".song_id INNER JOIN "songs" songs_annotations ON "songs_annotations".id = "annotations".song_id INNER JOIN "users" ON "users".id = "songs_annotations".state_last_updated_by_id WHERE (annotations.referent IS NOT NULL AND annotations.updated_at < '2010-04-05 01:51:24' AND (body = '?' OR body LIKE '%[?]%') AND ((users.id = songs.state_last_updated_by_id and users.needs_edit = 'f' and songs.state != 'work_in_progress') OR (songs.state = 'published')) Here's what I tried, but it doesn't work: SELECT "annotations".* FROM "annotations" INNER JOIN "songs" ON "songs".id = "annotations".song_id INNER JOIN "songs" songs_annotations ON "songs_annotations".id = "annotations".song_id INNER JOIN "users" ON "users".id = "songs_annotations".state_last_updated_by_id INNER JOIN "votes" ON "votes".voteable_id = "annotations".id AND "votes".voteable_type = 'Annotation' WHERE ((votes.vote = 't' and votes.voter_id = 78) OR (annotations.referent IS NOT NULL and annotations.updated_at < '2010-04-05 01:43:52' and (annotations.body = '?' OR annotations.body LIKE '%[?]%') and ((users.id = songs.state_last_updated_by_id and users.needs_edit = 'f') OR songs.state = 'published')))

    Read the article

  • Spring: Bean fails to read off values from external Properties file when using @Value annotation

    - by daydreamer
    XML Configuration <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <util:properties id="mongoProperties" location="file:///storage/local.properties" /> <bean id="mongoService" class="com.business.persist.MongoService"></bean> </beans> and MongoService looks like @Service public class MongoService { @Value("#{mongoProperties[host]}") private String host; @Value("#{mongoProperties[port]}") private int port; @Value("#{mongoProperties[database]}") private String database; private Mongo mongo; private static final Logger LOGGER = LoggerFactory.getLogger(MongoService.class); public MongoService() throws UnknownHostException { LOGGER.info("host=" + host + ", port=" + port + ", database=" + database); mongo = new Mongo(host, port); } public void putDocument(@Nonnull final DBObject document) { LOGGER.info("inserting document - " + document.toString()); mongo.getDB(database).getCollection(getCollectionName(document)).insert(document, WriteConcern.SAFE); } I write my MongoServiceTest as public class MongoServiceTest { @Autowired private MongoService mongoService; public MongoServiceTest() throws UnknownHostException { mongoRule = new MongoRule(); } @Test public void testMongoService() { final DBObject document = DBContract.getUniqueQuery("001"); document.put(DBContract.RVARIABLES, "values"); document.put(DBContract.PVARIABLES, "values"); mongoService.putDocument(document); } and I see failures in tests as 12:37:25.224 [main] INFO c.s.business.persist.MongoService - host=null, port=0, database=null java.lang.NullPointerException at com.business.persist.MongoServiceTest.testMongoService(MongoServiceTest.java:40) Which means bean was not able to read the values from local.properties local.properties ### === MongoDB interaction === ### host="127.0.0.1" port=27017 database=contract How do I fix this? update It doesn't seem to read off the values even after creating setters/getters for the fields. I am really clueless now. How can I even debug this issue? Thanks much!

    Read the article

  • Is there a way to hide annotations in Netbeans or Eclipse?

    - by Boden
    Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up. Is this one of those "you should never want to do that, code folding is a sin!" things? Personally I'd find it useful for annotated entity classes. All the hibernate / etc annotations are just fluff that I never look at once my mapping is working fine. It's similar to imports, really. (Yes, I can use XML instead of annotations, which I might start doing. But I was just wondering...)

    Read the article

  • What can you do and not do with java annotations?

    - by swampsjohn
    The typical use-case is for simple things like @Override, but clearly you can do a lot more with them. If you push the limits of them, you get things like Project Lombok, though my understanding is that that's a huge abuse of annotations. What exactly can you do? What sort of things can you do at compile-time and run-time with annotations? What can you not do?

    Read the article

  • MKMapKit custom annotations being added to map, but are not visible on the map

    - by culov
    I learned a lot from the screencast at http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/ , and ive been trying to incorporate the way he creates a custom annotation into my iphone app. He is hardcoding annotations and adding them individually to the map, whereas i want to add them from my data source. So i have an array of objects with a lat and a lng (ive checked that the values are within range and ought to be appearing on the map) that i iterate through and do [mapView addAnnotation:truck] once this process is completed, i check the number of annotations on the map with [[mapView annotations] count] and its equal to the number it ought to be, so all the annotations are getting added onto the mapView, but for some reason I cant see any annotations in the simulator. I've compared my code with his in all the pertinent places many times, but nothing seems to stand out as being incorrect. Ive also reviewed my code for the last several hours trying to find a point where I do something wrong, but nothing is coming to mind. The images are named just as they are assigned in the custom AnnotationView, the loadAnnotation function is done properly, etc... i dont know what it could be. so i suppose if i could have the answer to one question it would be, what are possible causes for a mapView to contain several annotations, but to not show any on the map? Thanks

    Read the article

  • MapKit custom annotations being added to map, but are not visible on the map

    - by culov
    I learned a lot from the screencast at http://icodeblog.com/2009/12/21/introduction-to-mapkit-in-iphone-os-3-0/ , and ive been trying to incorporate the way he creates a custom annotation into my iphone app. He is hardcoding annotations and adding them individually to the map, whereas i want to add them from my data source. So i have an array of objects with a lat and a lng (ive checked that the values are within range and ought to be appearing on the map) that i iterate through and do [mapView addAnnotation:truck] once this process is completed, i check the number of annotations on the map with [[mapView annotations] count] and its equal to the number it ought to be, so all the annotations are getting added onto the mapView, but for some reason I cant see any annotations in the simulator. I've compared my code with his in all the pertinent places many times, but nothing seems to stand out as being incorrect. Ive also reviewed my code for the last several hours trying to find a point where I do something wrong, but nothing is coming to mind. The images are named just as they are assigned in the custom AnnotationView, the loadAnnotation function is done properly, etc... i dont know what it could be. so i suppose if i could have the answer to one question it would be, what are possible causes for a mapView to contain several annotations, but to not show any on the map? Thanks

    Read the article

  • How do I make vim indent java annotations correctly?

    - by wds
    When indenting java code with annotations, vim insists on indenting like this: @Test public void ... I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not sure if I can use that together with regular cindent. edit: The filetype plugin was already turned on I just got a bit confused about indenting plugins. The accepted answer may be a bit hackish but works for me as well.

    Read the article

  • Is the Google Annotations Gallery useful in production code?

    - by cafe
    I could actually see a use for the Google Annotations Gallery in real code: Stumble across code that somehow works beyond all reason? Life's short. Mark it with @Magic and move on: @Magic public static int negate(int n) { return new Byte((byte) 0xFF).hashCode() / (int) (short) '\uFFFF' * ~0 * Character.digit ('0', 0) * n * (Integer.MAX_VALUE * 2 + 1) / (Byte.MIN_VALUE >> 7) * (~1 | 1); } This is a serious question. Could this be used in an actual code review?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >