Shared posts

16 Oct 23:56

Da série: respostas para perguntas intolerantes.

by lucasmansoldo

Não respondam assim, gente. É feio.

CABELO

Nem joguem merda nos outros porque também é.

<<BÔNUS CAPILAR>>
1390729_576881899026542_1819917681_n

 

16 Oct 23:08

Esse dia foi loco

by Joe

gato

Gato hardcore, dá mortal, joga a ração, dirige os carro, pega as vadia, bebe red leibo…

15 Oct 19:16

...é fim de mês e tenho que me virar com o que tem de comida em casa.

image

15 Oct 19:13

Como receber o entregador de pizza

by Joe

UA DOS DEFOX SEI?

DIN DIN DIN DIN DIN DIN DIN DIN

Alguém por favor promova este entregador.

Quê? Você não conhece a musiquinha?

15 Oct 19:12

Sereia do asfalto

by Joe

sereia

“Não se preocupa amor, eu coloco você numa praia depois no photoshop” DELA, Marido.

15 Oct 13:40

CodeSOD: Which Would YOU Rather Support?

by snoofle
Edison Gustavo

Spring....uma abdominação!

To populate a temporary database table, most of us would write something like this:

-- Assume table TempData exists
Truncate table TempData;
Insert Into TempData
Select ... From ... Where id = 1234 and Flag Is Not NULL;

Trevor A.'s cohort decided to use Spring to help do it better:

SpringStuff.xml:

    <bean id="ourReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
       <property name="saveState" value="false" />
       <property name="dataSource" ref="ourDataSource" />
       <property name="rowMapper" ref="filterRowMapper" />
       <property name="fetchSize" value="5000" />
       <property name="prepatedStatementSetter">
           <bean class="org.springframework,batch.core.resource.listPreparedStatementSetter">
              <property name='parameters">
                 <list>
                    <value>1234</value>
                 </list>
              </property>
           </bean>
       </property>
    </bean>

    <bean id="ourValidator" class="org.springframework.batch.core.job.DefaultJobParametersValidator" >
       <property name="requiredKeys">
           <array value-type="java.lang.int">
              <value>id</value>
           </array>
       </property>
    </bean>

    <bean id="filterRowMapper" class="x.y.z.FilterRowMapper" />

    <bean id="theDao" class="x.y.z.TheDao">
       <constructor-arg ref="ourDataSource" />
       <constructor-arg value="Truncate Table TempData" />
    </bean>

    <bean id="truncateTemptTable" class="x.y.z.TruncateTempTable">
       <constructor-arg ref="theDao"/>
    </bean>

    <bean id="ourProcessor" class="x.y.z.OurProcessor"/>

    <bean id="ourWriter" class="x.y.z.OurWriter" scope="step">
       <constructor-arg ref="theJdbcTemplate"/>
       <constructor-arg value="insert into tempdata values(?,?, ..., ?)"/>
    </bean>

    <batch:job id="loadTempTable">
       <batch-description>Load the temp table for id: 1234</batch:description>
       <batch:validate ref="ourValidator"/>
       <batch:step id="step1" next="step2">
           <batch:tasklet ref="truncateTempTable"/>
       </batch:step>
       <batch:step id="step2">
           <batch:tasklet>
               <batch:chunk reader="ourReader" processor="ourProcessor" writer="ourWriter" commit-interval="5000"/>
           </batch:tasklet>
       </batch:step>
    </batch:job>

public class FilterRowMapper implements RowMapper<MyRecord> {
  public final static String COL_1 = "ColName-1";
  // ...
  public final static String COL_N = "ColName-n";

  public MyRecord mapRow(ResultSet rs, int rowNum) throws SQLException {
    MyRecord r = new MyRecord();
    r.setField1(rs.getString(COL_1));
    // ...
    r.setFieldN(rs.getInt(COL_N));
    return r;
  }
}

public class TruncateTempTable implements Tasklet {
  private TheDao dao;

  public TruncateTempTable(TheDao dao) {
    this.dao = dao;
  }

  public RepeatStatus execute(StepContribution sc, ChunkContext cc) throws Exception {
    dao.truncateTempTable();
    return RepeatStatus.FINISHED;
  }
}

public class TheDao extends NamedParametersJdbcDaoSupport {
  private String truncateTempTableSql;

  public TheDao(DataSource ds, String sql) {
    super();
    setDataSource(ds);
    truncateTempTableSql = sql;
  }

  public void truncateTempTable() {
    getJdbcTemplate().execute(truncateTempTableSql);
  }
}

public class OurProcessor implements ItemProcessor<MyRecord, MyRecord> {

  public MyRecord process(MyRecord in) throws Exception {
    MyRecord out = in;
    return out;
  }
}

public class OurWriter implements ItemWriter<MyRecord> {
  private JdbcTemplate jt;
  private String sql;

  public OurWriter(JdbcTempalte jt; String sql) {
    this.jt  = jt;
    this.sql = sql;
  }

  public void write(List<? extends MyRecord> list) throws Exception {
    for (MyRecord r : list) {
        if (r.getFlag() != null) {
           jt.batchUpdate(sql, new BatchPreparedStatementSetter() {

             public void setValues(PreparedStatement ps, int rowNum) throws Exception {
               ps.setString(1,r.getField1());
               // ...
               ps.setInt(n,r.getFieldN());
             }

             public int getBatchSize() {
               return list.size();
             }
           });
        }
    }
  }
}

Don't get me wrong, I'm all for utilizing tools to help get things done, but when the tool obfuscates what you're trying to accomplish, perhaps it's not helping as much as you think it's helping.

Axiom: 95% of the cost of software is in maintenance and upgrades: if the next person can't figure out what you did without your help, you didn't do as good a job as you might think!

[Advertisement] Make your team a DevOps team with BuildMaster. Pairing an easy-to-use web UI with a free base platform, BuildMaster gets you started in minutes. See how Allrecipes.com and others use BuildMaster to automate their software delivery.
14 Oct 19:35

Desejos

by Daniel Lafayette


11 Oct 13:58

October 11, 2013

09 Oct 19:18

OMG como funciona isso aqui?

by Joe

Essas Fischer-Price da vida cada vez mais próximas da bruxaria.

09 Oct 18:56

Heavy Metal em números

by Joe

Sempre me perguntam por que eu falo que Noruega é sinônimo de Heavy Metal. Vejam o gráfico:

noruega

Acho que agora está tudo esclarecido.

08 Oct 13:42

OpenMP* project

by Jim Cownie
I am extremely glad to announce that Intel has decided to provide a copy of our Intel® open-source OpenMP* runtime as an LLVM sub-project (and the LLVM project has been kind enough to accept our contribution!). This gives the community a fully LLVM license compatible version of the OpenMP runtime for use in  OpenMP development projects. 

The complete source code is now available at openmp.llvm.org

We open-sourced the Intel OpenMP runtime code to support the development of a full LLVM-based implementation of the OpenMP specification. Intel’s compiler team in Moscow has made outstanding progress in implementing the Clang changes to support the OpenMP language extensions (you can see their work at http://clang-omp.github.io), and now we’ve reached a milestone where we can create an LLVM sub-project for some of the other components that are needed to build a complete OpenMP system.

Personally, I am very happy (and proud) to be associated with LLVM, and I look forward to a long and productive collaboration.

-- Jim Cownie
07 Oct 22:39

Batman Should Never Try To Get A Driver's License, Clearly

by Patricia Hernandez

If Batman ever tried getting a driver's license...well, according to this video by Animation Domination High-Def, he probably shouldn't, cause he'd be crap at taking the test. But it's okay. His failed attempts would make for hilarious stories.

Read more...

04 Oct 18:00

O celular e a bebida…

by Vanessa

celular-e-bebidaQuem nunca?

04 Oct 17:54

The Game of Life Select the difficulty level: Easy (Fácil) /...



The Game of Life

Select the difficulty level: Easy (Fácil) / Normal / Hard (Difícil)

[ cinismo ilustrado ]

01 Oct 21:05

Google X Bing

by leonardovaz

LGBmQMJ

Sério, quem usa bing?

19 Sep 18:59

Apartment Hunting: Pick Two

by moderator

Apartment Hunting: Pick Two

The post Apartment Hunting: Pick Two appeared first on Programming Fun Hub.

19 Sep 00:32

Love Never Ends Special Delivery

by moderator
Edison Gustavo

cute :P

17 Sep 22:03

The king of the Virjões

by Joe

virjao

BÔNUS:

nerd

Quando sair o novo GTA, eu serei assim. Afinal, pra chegar perto dos 100% no GTA é preciso abdicar de fornicações na piroca.

17 Sep 22:02

As maravilhas do PS1

by Joe

lindo

Nessa época você precisava usar muito a imaginação…

04 Sep 23:29

129. MARC MARON: The social media generation

by Gav

129. MARC MARON: The social media generation

Marc Maron is a comedian and the host of my favourite podcast, WTF with Marc Maron, which is a comedy podcast where Maron interviews not only comedians, but musicians, actors, chefs and artists. His conversations are always engaging, funny, raw and honest. I recommend it especially to those who are pursuing a creative field, as most of his interview subjects have insightful and unique stories about how they became successful. (As you can tell from its title, WTF contains explicit language and is for mature listeners … you’ve been warned!)

Maron’s own success story is worth mentioning. In his 40s, having lived a life of anger, resentment, addiction, failed relationships and burnt bridges, Maron had just gotten fired from a radio gig when he started the WTF podcast as a last, desperate attempt to stay in the comedy game. The podcast not only became incredibly successful, leading to a resurgence in his stand-up career and a television series, but it’s also proven to be his salvation.

I can’t believe it’s taken me so long to do a Maron quote, as I must have listened to hundreds of hours of his voice while working on Zen Pencils. This quote is taken from his latest memoir, Attempting Normal.

RELATED COMICS: Bill Hicks It’s just a ride, Louis C.K. We don’t think about how we talk, George Carlin On assassination (explicit), Henry Rollins Who’s the crazier man?.

- Since my last comic about social media, I think it’s fair to say I’m still totally dependent and addicted to my phone. Who checks their phone as soon as they wake up and while still in bed? I do. Who takes their phone into the toilet with them? Me. It’s gross, but I bet you do it too … don’t lie. Who can’t be alone in public without looking at their phone every five minutes? Yep, me again. While I love social media (it has obviously helped Zen Pencils enormously and it’s incredible how easy I can interact with readers from all over the world), we should also remember some of its negative side effects, as this article points out.
- What are your favourite podcasts? Some of my other recommendations: Hardcore History, The Bugle, The Smartest Man in the World, The Nerdist, Stuff You Should Know, StarTalk Radio and The BS Report.

28 Aug 23:24

when I solve a bug that nobody could for a year

by kbironneau

/* by undokbeka */

27 Aug 15:59

Counter Strike Zoom Logic

by moderator

Counter Strike Zoom Logic

The post Counter Strike Zoom Logic appeared first on Programming Fun Hub.

27 Aug 15:55

August 25, 2013


Friend of SMBC Theater Greg Platt is running to support research for Crohn's Disease! Please take a look!
22 Aug 04:19

Oi, eu sou Goku.

by lucasmansoldo

Nem venham de mimimi, era assim mesmo!

dbz

WHEYTA PORRA!

21 Aug 01:58

mindfuck [video version]



mindfuck

[video version]

21 Aug 01:42

when my untested code flawlessly works in production

by kbironneau

image

/* by oldskool */

19 Aug 04:17

...tento fingir que sei o que tô fazendo no meu emprego novo.

image

16 Aug 22:27

Acordando a gata com um beijo

by Joe

Os beiço da gata caem até o umbigo depois dessa…

15 Aug 12:51

Curso de Java

by ProgramadorREAL

Curso de Java

15 Aug 12:45

Geothermal Power Plants Face Rocky Starts

Vast reservoirs of heat are locked in the earth's interior, untapped. The ground underneath our feet holds so much heat that tapping only 2 percent of it could satisfy current annual U.S. energy use 2,000-fold for each and every year of the foreseeable future, according to an analysis from the Massachusetts Institute of Technology. Fracking, the same technology used to drill for natural gas, may provide an economical way to get at that geothermal energy.

The idea is simple: Pump water or other fluids down deep beneath the surface. Hot rocks at depth boil the water into steam, which rises back to the surface to spin a turbine and generate electricity. In regions with hot rocks and plentiful water near the surface, building massive power plants is straightforward. But such optimal sites are few and far between. Fracking, which is the technique of fracturing passages in subterranean rock, can help. The same fractures that send natural gas streaming out from deep wells also allow geothermal heat to be tapped from practically anywhere on earth.

[More]