This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java puzzler on my Intellij issue today ... | |
Given following classes : | |
public class A { | |
public String foo(){ return "foo"; } | |
} | |
public class B { | |
public String bar(){ return "bar"; } | |
} | |
public class C { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What happens when this code is compiled/executed ? | |
public class A<T> { | |
public List<T> listOfTs = new ArrayList<T>(); | |
public List<Long> listOfLongs = Arrays.asList(1l, 2l, 4l); | |
public A(List<T> _t){ this.listOfTs = _t; } | |
public static void main(String[] args){ | |
hello(new A<String>(Arrays.asList("1", "2", "4"))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | |
<property name="dataSource" ref="dataSource" /> | |
<!-- ..... --> | |
<property name="typeHandlersPackage" value="org.joda.time.mybatis.handlers" /> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.puzzlers; | |
import org.springframework.core.io.Resource; | |
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | |
import org.springframework.core.io.support.ResourcePatternResolver; | |
import org.springframework.core.type.classreading.CachingMetadataReaderFactory; | |
import org.springframework.core.type.classreading.MetadataReader; | |
import org.springframework.core.type.classreading.MetadataReaderFactory; | |
import org.springframework.util.ClassUtils; | |
import org.springframework.util.SystemPropertyUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1) 10 classes ! | |
Obvious ones : | |
com.puzzlers.a.SimpleEnum | |
com.puzzlers.b.SimpleAnonymousEnum | |
com.puzzlers.c.ClassWithNestedEnum | |
com.puzzlers.c.ClassWithNestedEnum$NestedEnum | |
com.puzzlers.d.ClassWithNestedAnonymousEnum | |
com.puzzlers.d.ClassWithNestedAnonymousEnum$NestedAnonymousEnum | |
com.puzzlers.JavaPPuzzler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given these 5 classes, could you guess : | |
(1) What is the number of total generated classes ? | |
(2) and (3) : Can you guess what are superclasses and implemented interfaces for every generated classes in (1) ? | |
Answers are here : https://gist.github.com/1771083 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array Remove - By John Resig (MIT Licensed) | |
// See http://ejohn.org/blog/javascript-array-remove/ | |
Array.prototype.remove = function(from, to) { | |
var rest = this.slice((to || from) + 1 || this.length); | |
this.length = from < 0 ? this.length + from : from; | |
return this.push.apply(this, rest); | |
}; | |
// "Ghosting" remove function in order to not iterate over it during a for(.. in ..) loop | |
// on arrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute this script in frame "hplogo-complex" on https://www.google.com/doodles/hurdles-2012 :-) | |
var script = document.createElement('script'); | |
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; | |
script.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
window.skip = false; | |
window.target = "#hplogo_pc"; | |
// Define here the time interval between 2 arrow hits :) | |
window.interval = 15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute this script in console on https://www.google.com/doodles/basketball-2012 :) | |
///////////////////////////////////////////////////////////////////////////////////// | |
// Add this prior to anything : it will allow you to use jquery in your page :) | |
var script = document.createElement('script'); | |
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; | |
script.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
///////////////////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I--J--K--L | |
/ / | |
F--G--H / | |
/ / | |
A--B / | |
\ / | |
C--D---E | |
I want to rebase branch "L" on branch "H", ideally having something like this : |
OlderNewer