Search Results

Search found 7 results on 1 pages for 'coronatus'.

Page 1/1 | 1 

  • Things you can draw with HTML tables

    - by Coronatus
    So I was watching a talk by Google's Marissa Mayer about speeding up Google's pages. They found that a shopping cart icon increased load time by 2%, and users then searched 2% less. They managed to replace the icon with an HTML table. Here is my attempt at drawing a shopping cart: (live example page) <html> <head> <style> table {border-collapse: collapse;} th, td {width: 8px; height: 8px;} th {background-color: blue;} td {background-color: white;} </style> </head> <body> <table> <!-- this row is just to see alignment --> <tr> <td></td><td></td><td></td><td></td><td></td> <td></td><td></td><td></td><td></td><td></td> <td></td><td></td><td></td><td></td><td></td> <td></td><td></td><td></td><td></td><td></td> </tr> <!-- handle --> <tr> <td colspan="14"></td> <th colspan="3"></th> <td colspan="3"></td> </tr> <tr> <td colspan="13"></td> <th colspan="2"></th> <td colspan="1"></td> <th colspan="2"></th> <td colspan="2"></td> </tr> <tr> <td colspan="13"></td> <th colspan="2"></th> <td colspan="1"></td> <th colspan="2"></th> <td colspan="2"></td> </tr> <tr> <td colspan="14"></td> <th colspan="3"></th> <td colspan="3"></td> </tr> <!-- main body --> <tr> <td colspan="5"></td> <th colspan="13"></th> <td colspan="2"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="2"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="3"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="2"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="3"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="2"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="3"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="2"></td> </tr> <tr> <td colspan="5"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <td colspan="1"></td> <th colspan="1"></th> <th colspan="1"></th> <td colspan="3"></td> </tr> <tr> <td colspan="5"></td> <th colspan="13"></th> <td colspan="2"></td> </tr> <!-- wheels --> <tr> <td colspan="7"></td> <th colspan="2"></th> <td colspan="4"></td> <th colspan="2"></th> <td colspan="5"></td> </tr> <tr> <td colspan="6"></td> <th colspan="4"></th> <td colspan="2"></td> <th colspan="4"></th> <td colspan="4"></td> </tr> <tr> <td colspan="7"></td> <th colspan="2"></th> <td colspan="4"></td> <th colspan="2"></th> <td colspan="5"></td> </tr> </table> </body> </html> What can you draw in tables?! Impress us.

    Read the article

  • org.hibernate.hql.ast.QuerySyntaxException: TABLE NAME is not mapped

    - by Coronatus
    I have two models, Item and ShopSection. They have a many-to-many relationship. @Entity(name = "item") public class Item extends Model { @ManyToMany(cascade = CascadeType.PERSIST) public Set<ShopSection> sections; } @Entity(name = "shop_section") public class ShopSection extends Model { public List<Item> findActiveItems(int page, int length) { return Item.find("select distinct i from Item i join i.sections as s where s.id = ?", id).fetch(page, length); } } findActiveItems is meant to find items in a section, but I get this error: org.hibernate.hql.ast.QuerySyntaxException: Item is not mapped [select distinct i from Item i join i.sections as s where s.id = ?] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272) ... 8 more What am I doing wrong?

    Read the article

  • Graphing the pitch (frequency) of a sound

    - by Coronatus
    I want to plot the pitch of a sound into a graph. Currently I can plot the amplitude. The graph below is created by the data returned by getUnscaledAmplitude(): AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new BufferedInputStream(new FileInputStream(file))); byte[] bytes = new byte[(int) (audioInputStream.getFrameLength()) * (audioInputStream.getFormat().getFrameSize())]; audioInputStream.read(bytes); // Get amplitude values for each audio channel in an array. graphData = type.getUnscaledAmplitude(bytes, this); public int[][] getUnscaledAmplitude(byte[] eightBitByteArray, AudioInfo audioInfo) { int[][] toReturn = new int[audioInfo.getNumberOfChannels()][eightBitByteArray.length / (2 * audioInfo. getNumberOfChannels())]; int index = 0; for (int audioByte = 0; audioByte < eightBitByteArray.length;) { for (int channel = 0; channel < audioInfo.getNumberOfChannels(); channel++) { // Do the byte to sample conversion. int low = (int) eightBitByteArray[audioByte]; audioByte++; int high = (int) eightBitByteArray[audioByte]; audioByte++; int sample = (high << 8) + (low & 0x00ff); if (sample < audioInfo.sampleMin) { audioInfo.sampleMin = sample; } else if (sample > audioInfo.sampleMax) { audioInfo.sampleMax = sample; } toReturn[channel][index] = sample; } index++; } return toReturn; } But I need to show the audio's pitch, not amplitude. Fast Fourier transform appears to get the pitch, but it needs to know more variables than the raw bytes I have, and is very complex and mathematical. Is there a way I can do this?

    Read the article

  • Learning Python coming from PHP

    - by Coronatus
    Community wiki so don't vote to close, kthxbai. My dynamic language experience is solely PHP. I want to learn Python now to broaden my career opportunities and just because I like programming. :) When learning Java, I used a site (lost the URL/real name now), something like "Java for PHP developers" that had all on one side of the page the PHP code, and on the other side the Java code to do the same thing. Is there a website like that for Python? Any other recommendations/advice? Thanks Edit: I have no votes left today, but I'll up-vote good answers tomorrow :)

    Read the article

  • htaccess: only do [some lines of code] for one domain, no others.

    - by Coronatus
    Say I have a htaccess file shared by "dev.server" and "server.site.com". The first domain should allow all users to access it unchallenged (it only exists on my local development server). The second domain I want to authenticate users with Apache (NOT by database). The code to authenticate users is: AuthType Basic AuthName "Server Admin" AuthUserFile "/path/to/passwd" require valid-user What I can't do is make those 4 lines only matter if the domain is "server.site.com". How can I do this? I searched for something like <IfEnv HTTP_HOST "site.server.com"> but had no luck.

    Read the article

  • Passing a class ("Country.class") as an argument in Java

    - by Coronatus
    I'm trying to make a method that takes an argument of Country.class, User.class etc, and returns argument.count(). All the possible classes that I would give to this method extend from Model and have the method count(). My code: private static long <T> countModel(Model<T> clazz) { return clazz.count(); } Called by: renderArgs.put("countryCount", countModel(Country.class)); However this just doesn't work at all. How do I do this, please?

    Read the article

1