Skip to content

Instantly share code, notes, and snippets.

View hugithordarson's full-sized avatar

Hugi Thordarson hugithordarson

View GitHub Profile
Varúð: Langur texti framundan. En ef þú átt, rekur eða tengist verslun eða annarri atvinnustarfsemi eða verslar einhverntíman í verslun eða kaupir aðra þjónustu þætti mér vænt um að þú læsir hann. Þú gætir unnið milljón dollara! (það væri þá að vísu ótengt textanum en hann útilokar samt á engan hátt að þú vinnir einhverntíman milljón dollara)
Svo. Jæja. Núna er ég búinn að sitja undanfarna daga og dunda mér við að smíða lesara fyrir innkaupastrimla frá Costco. Til skýringar, þá er "lesarinn" ("parserinn" upp á útlensku) sá hluti Strimils-hugbúnaðarkerfisins sem les texta af strimlum og breytir honum í þessi frábærlega gagnlegu gögn (heh) sem þúsundir íslendinga nota nú daglega í Neytandanum, appi Neytendasamtakanna.
Svona lesarasmíði er tímafrek, villugjörn og leiðinleg. Svo leiðinleg að það blæðir úr eyrunum á mér við tilhugsunina. Ekki að sjálft verkið sé leiðinlegt (forritun er jú eins og við vitum skemmtilegt og gefandi fag) heldur vegna þess að það er óþarft og ég veit ekkert leiðinlegra en að gera óþa
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.objectstyle.woproject.maven2</pluginGroup>
</pluginGroups>
<profiles>
package x;
import java.io.IOException;
import org.apache.poi.util.IOUtils;
import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOApplication;
import com.webobjects.appserver.WORequest;
import com.webobjects.appserver.WOResponse;
package stuffmaker;
import static spark.Spark.*;
import java.util.List;
import org.apache.cayenne.query.ObjectSelect;
import com.google.gson.GsonBuilder;
package strimillinn.xperimental;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention( RetentionPolicy.RUNTIME )
public @interface KVCAsync {}
/**
* Maps keyPaths in this component to the methods that should supply their values (asynchronously)
*/
private Map<String, Supplier> asyncFields = new HashMap<>();
public SMFront( WOContext context ) {
super( context );
bindAsyncField( "priceChanges", this::_priceChanges );
bindAsyncField( "numberOfEntriesToday", this::_numberOfEntriesToday );
bindAsyncField( "turnoverToday", this::_turnoverToday );
package jambalaya;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.apache.cayenne.Cayenne;
<plugin>
<groupId>org.apache.cayenne.plugins</groupId>
<artifactId>maven-cayenne-plugin</artifactId>
<version>4.0.M4-SNAPSHOT</version>
<configuration>
<map>${project.basedir}/src/main/resources/datamap.map.xml</map>
<destDir>${project.basedir}/src/main/java</destDir>
<superTemplate>${project.basedir}/src/main/resources/wosuperclass.vm</superTemplate>
</configuration>
<executions>

0. Preparing

To prepare, turn off automatic builds in Eclipse (otherwise, Eclipse is going to be really, really "helpful" by creating folders, modifying .classpath etc.). Keep automatic builds off until you've at least finished step 3 (adding a pom file).

Once you've changed the configuration files, close the project and open it again, then turn on the Eclipse builds again.

1. Creating folders and moving stuff around

Here are the modifications you have to do to your project's layout, expressed in bash (as if your working directory is your project's root).