surprise

Oct. 28th, 2015 03:46 pm
juan_gandhi: (VP)
This morning I found a null in my code output. An error message was null. No shit. Spent some time tracing. Turned out an NPE is thrown somewhere inside a java library; ok, I intercept it. But the message of that NPE is null.

So what I did, I fixed all cases where t.getMessage is called. No way.

So, just FYI.
juan_gandhi: (VP)
    /** {@inheritDoc} */
    public final boolean equals(Object obj) {
        if(obj == this){
            return true;
        }
        
        return super.equals(obj);
    }


and what do we see there in super:
public class Object {
...
    public boolean equals(Object obj) {
        return (this == obj);
    }


What's even funnier, they do not lock hashCode, so anybody can have, theoretically, two distinct instances that are equal but have different hashcodes.

Good that it's opensource; will grab the crap to my folder and fix it.
juan_gandhi: (VP)
    public List getOrderedChildren() {
        ArrayList children = new ArrayList();
        
        if (encryptedData != null) {
            children.add(encryptedData);
        }
        
        children.addAll(encryptedKeys);
        
        if (children.size() == 0) {
            return null;
        }
        
        return Collections.unmodifiableList(children);
    }
juan_gandhi: (VP)
    // temporary, used by RSACipher and RSAPadding. Move this somewhere else
    public static byte[] convert(byte[] b, int ofs, int len) {
        if ((ofs == 0) && (len == b.length)) {
            return b;
        } else {
            byte[] t = new byte[len];
            System.arraycopy(b, ofs, t, 0, len);
            return t;
        }
    }
juan_gandhi: (VP)
Say, we have Set<T> objects;



vs



(Yes, it's Java)

What happens here. If you declare a function as injective, it can map a set to a set; otherwise, "elements can be repeated"; and map won't be "efficient enough", so an abstract collection is returned. It does not happen if you map a list.
juan_gandhi: (VP)
selenium, джавный код, класс Куки.

В этих куках toString() возвращает весь текст (дату, домен и т.п.); а equals() сличает только имя и значение.

Так что пляшите, Варвара Лискова, две равных вещи производят разные результаты только так.

Ну или этих... не знаю, кто писал, дареному коню в зубы... джавщики, хуле, что с них взять.

P.S. Это я тут парсер-комбинатор для кук нарисовал, ну и это.
juan_gandhi: (VP)
http://www.wired.com/2013/09/the-second-coming-of-java/all/

What I read here:
- Java's back
- Twitter uses Java
- Java is the fastest
- Bob Lee sees no choice
- Medvedev visited Twitter office 4 years ago

Any ideas what it was about?
juan_gandhi: (VP)
Hey crypto-haskellers! I mean those who know Haskell well and can write anything in it, but have to use C++ or Java, because the world around is pretty dumb and not ready for the truth.

How do you feel, did Haskell help you write more reasonable code?

Actually, there are two questions here:
a) you write in C++
b) you write in Java

I'd love to see examples.
juan_gandhi: (VP)
Ковырял в чаду угара Java семена,
и гадал, кому пришла IDEA
брать классов имена
в IKEA.

(src: [livejournal.com profile] sergeif)

apple swift

Jun. 2nd, 2014 04:22 pm
juan_gandhi: (VP)
So, with the new "Apple language", object-oriented Java people are going to do what?
There must be some deep philosophy, explaining why they are so retarded.
I think.

I mean, I kind of heard an explanation from Josh; in my translation it sounds like this: "Java programmers are not very smart anyway, let's not overload them with closures and all that stuff."

The correlation I was writing about lately kind of shows itself again.
Weird.

Well, it's not Scala, of course; but it's a nice step in the right direction, I think.
juan_gandhi: (VP)
Сижу на джавном митапе. Человек рассказывает, как они там на линух поставили wildfly8, каковая является просто новым именем джейбосса. Ощущение как будто на встречу энтузиастов форта или дельфи зашел. Мужик несет какую-то хуйню про эксемельную конфизурацию, показывает дикую картинку интероперабилити с другими аббревиатурами. "Common Annotations", например. Или еще - Concurrency. У них что там, конкарренси раньше не было? В одну нитку джейбосс работал?

Ну и т.д. Народ сидит какой-то кондовый; подобного рода толпу я последний раз видел, когда за каким-то хреном зашел на местный кампус Майкрософта. Бухгалтеры какие-то. Ну и в самом деле, кого сейчас интересует джава в наши дни?

Я-то зашел, на самом деле, чтобы объявление сделать, что нанимаем. Но уже жалею.

Вот одна строчка с экрана:


private static final Object PRESENT = new Object()


Кстати, мероприятие происходит на гугловском кампусе, но этот факт в данном случае нерелевантен. Единственно что водят по кампусу под конвоем.
juan_gandhi: (VP)
RE: Rockstar Engineering Team at Multiscale

Hi Bara,

Ok, I see. I don't believe the word "rock star" may be applied these days to a Java/Python shop.

Best regards,
-Vlad

On 05/12/14 12:53 PM, Bara Boom wrote:
--------------------
Hi Vlad,
We are a Java/Python shop, yes but no immediate plans to use Scala.

Thanks for your note.

Cheers,
Bara
juan_gandhi: (VP)

List<string> stringSet = parseProvider(provider);
juan_gandhi: (VP)
    /**
     * The filter will be used in case the URL of the request contains the DEFAULT_FILTER_URL.
     *
     * @param request request used to determine whether to enable this filter
     * @return true if this filter should be used
     */
    protected boolean processFilter(HttpServletRequest request) {
        return SAMLUtil.processFilter(filterProcessesUrl, request);
    }
juan_gandhi: (VP)
public class Streams {

  /**
   * Drains the contents of a stream without blocking on further input from that stream.
   *
   * @param stream the stream to drain
   * @return the contents of the drained stream
   */
  public static String drainStream(OutputStream stream) {
    if (stream == null) {
      return null;
    }
    
    if (stream instanceof CircularOutputStream) {
      return stream.toString();
    }
    
    return null;
  }
}
juan_gandhi: (VP)
public static curry<X,Y,Z>(final Function2<X,Y,Z> f) {
  return new Function<X,Function<Y,Z>>() {
    public Function<Y,Z> apply(final X x) { 
      return new Function<Y,Z>() {
        public Z apply(Y y) { 
          return f(x,y) 
        }
      }
    }
  }
}


Just to scare my students a little bit. Hope they won't be scared, but will just laugh.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14151617181920
21222324252627
282930    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 11th, 2025 10:12 pm
Powered by Dreamwidth Studios