389 Matching Annotations
  1. Dec 2022
  2. Oct 2022
    1. Gosling made the observation that computer chips were appearing in toasters, VCRs, and many other household appliances, even in the doorknobs of their Squaw Valley ski-lodge rooms. "That's getting pretty ubiquitous when it's in the bloody doorknob,'' he said. Yet three remote-control devices were needed just to get a television, a VCR, and a living-room sound system to work. Needless to say, most people still couldn't program any of them. The wonder wasn't that chips were everywhere but that they were being used so badly.

      Gosling se dio cuenta que los chips estaban en todas partes pero se usaban muy mal (el mismo tenía hasta tres controles remotos)

    1. The program will compile, but not run, because JVM will not recognize the main() method. Remember JVM always looks for the main() method with a string type array as a parameter.

      With out String args[] in main().

    1. An object in Java is the physical as well as a logical entity, whereas, a class in Java is a logical entity only.

      Object exists but Class is just logical steps to make object. Class --> Blue print and Object ---> Car

  3. Aug 2022
    1. 如果使用 Java8 以上版本可以使用 Arrays.stream 方法来转换,否则可以把 int 数组声明为包装类型 Integer 数组:
    1. 进行判等,需要使用 equals 进行内容判等。因为引用类型的直接值是指针,使用 == 的话,比较的是指针,也就是两个对象在内存中的地址,即比较它们是不是同一个对象,而不是比较对象的内容。

      默认情况

  4. Jul 2022
  5. Jun 2022
    1. Difference between Map and HashMap The Map is an interface in Java used to map the key-pair values. It is used to insert, update, remove the elements. Whereas the HashMap is a class of Java collection framework. The Map interface can only be used with an implementing class. It allows to store the values in key-pair combination; it does not allow duplicate keys; however, we can store the duplicate values. Its implementing classes are as follows: HashMap Hashtable TreeMap ConcurrentHashMap LinkedHashMap HashMap is a powerful data structure in Java used to store the key-pair values. It maps a value by its associated key. It allows us to store the null values and null keys. It is a non-synchronized class of Java collection.
  6. May 2022
    1. null is a reserved word (keyword) in Java for literal values. It is a literal similar to the true and false. In Java, null is a keyword much like the other keywords public, static or final. It is just a value that shows that the object is referring to nothing. The invention of the word “null” originated to denote the absence of something. For example, the absence of the user, a resource, or anything. But, over the years it puts Java programmers in trouble due to the disturbing null pointer exception. When you declare a boolean variable, it gets its default value as false.

      java

  7. Feb 2022
    1. Java, one of the most preferred programming languages in the world, has changed the world of software development. It operates virtually everywhere in the digital sphere. This revolutionary programming language has excelled in every way and remained in the list of ‘Top 3 most in-demand languages’ for many years, enabling more job opportunities for engineers. 

      Java, one of the most preferred programming languages in the world, has changed the world of software development. It operates virtually everywhere in the digital sphere. This revolutionary programming language has excelled in every way and remained in the list of ‘Top 3 most in-demand languages’ for many years, enabling more job opportunities for engineers.

      5 Easy Steps to Hire Java Developers Faster: A Tech Recruiter’s Perspective

  8. Jan 2022
    1. Adopting Kubernetes-native environments ensures true portability for the hybrid cloud. However, we also need a Kubernetes-native framework to provide the "glue" for applications to seamlessly integrate with Kubernetes and its services. Without application portability, the hybrid cloud is relegated to an environment-only benefit. That framework is Quarkus.

      Quarkus framework

    1. enum can contain both concrete methods and abstract methods. If an enum class has an abstract method, then each instance of the enum class must implement it 

      Yet to explore abstract methods for java enums

    2. We can’t create enum objects explicitly and hence we can’t invoke enum constructor directly.

      Color c1 = Color.RED;

      Color is the enum and "RED" is internally a class object of class "Color".

      In which language though, can invoke the constructor directly? I guess by using the parameterized constructors, one can invoke other constructors easily.

    3. Since it is static, we can access it by using the enum Name. Since it is final, we can’t create child enums.

      enum in java is implemented as a class. The static and final keywords have their meanings.

      An enum cannot explicitly inherit a class not can it create child enums.

    4. enum can implement many interfaces

      Have to learn about Interfaces.

    5. All enums implicitly extend java.lang.Enum class. As a class can only extend one parent in Java, so an enum cannot extend anything else.

      In Java, a class can extend only one parent class. Also, an enum implicitly extends the java.lang.Enum class. Therefore, an enum cannot extend anything else.

    6. In Java, we can also add variables, methods and constructors to it

      java enums allow one to add variables, methods and constructors. Java enums are apparently more powerful than C++ enums

    7. enum type can be passed as an argument to switch statement.

      An enum object can be created and the object can be passed as an argument.

  9. Jul 2021
    1. Multiple inheritance is one of the object oriented feature where a class or a sub class can inherit features from more than one parent class or super class.
    2. Interface is collection of methods of abstract type (having empty body). It’s similar to Abstract class. Interface is blueprint of class. Interface specify what class must do and not how to.

      A class which implements interface should define each and every method in the class. Interface is used to implement multiple inheritance in java (represent IS-A relationship).

    1. Java is the mother tongue of approximately 9 million developers around the globe. Developed first in 1995 by Sun Microsystems, Java has evolved to become one of the most popular languages to be used in the software industry. It is fast, secure, and reliable, therefore, used to make applications ranging from software design and gaming technology to web and mobile applications.

      More on InterviewBit

    1. Uber and Booking.com’s ecosystem was originally JVM-based but they expanded to support Python models/scripts. Spotify made heavy use of Scala in the first iteration of their platform until they received feedback like:some ML engineers would never consider adding Scala to their Python-based workflow.

      Python might be even more popular due to MLOps

  10. Jun 2021
    1. It is a compile-time error if an enum declaration has the modifier abstract orfinal.

      enum is implicitly static and final, no reason to have modifiers final and abstract.

  11. Mar 2021
  12. Feb 2021
  13. Sep 2020
    1. Tribuo is a machine learning library in Java that provides multi-class classification, regression, clustering, anomaly detection and multi-label classification.

      Tribuo - Java ML library from Oracle

  14. Aug 2020
    1. Java may have been designed as a completely object oriented language, but when Java SE 8 was released in 2014, it added Lambda expressions (aka closures), which added some functional programming elements. Not every problem is best served by OOP, and by adding Lambdas, Java became more flexible. 
  15. Jul 2020
    1. A shell script to automate the retrieval and installation of the Oracle (Sun) Java Runtime Environment
  16. Jun 2020
  17. May 2020
    1. Programming languages These will probably expose my ignorance pretty nicely.

      When to use different programming languages (advice from an Amazon employee):

      • Java - enterprise applications
      • C# - Microsoft's spin on Java (useful in the Microsoft's ecosystem)
      • Ruby - when speed is more important then legibility or debugging
      • Python - same as Ruby but also for ML/AI (don't forget to use type hinting to make life a little saner)
      • Go/Rust - fresh web service where latency and performance were more important than community/library support
      • Haskell/Erlang - for very elegant/mathematical functional approach without a lot of business logic
      • Clojure - in situation when you love Lisp (?)
      • Kotlin/Scala - languages compiling to JVM bytecode (preferable over Clojure). Kotlin works with Java and has great IntelliJ support
      • C - classes of applications (operating systems, language design, low-level programming and hardware)
      • C++ - robotics, video games and high frequency trading where the performance gains from no garbage collection make it preferable to Java
      • PHP/Hack - testing server changes without rebuilding. PHP is banned at Amazon due to security reasons, but its successor, Hack, runs a lot of Facebook and Slack's backends
  18. Apr 2020
    1. To help you get started quickly, we created a special Installer of Visual Studio Code for Java developers. Download Visual Studio Code Java Pack Installer Note: The installer is currently only available for Windows. For other OS, please install those components (JDK, VS Code and Java extensions) individually. We're working on the macOS version, please stay tuned. The package can be used as a clean install or an update for an existing development environment to add Java or Visual Studio Code. Once downloaded and opened, it automatically detects if you have the fundamental components in your local development environment, including the JDK, Visual Studio Code, and essential Java extensions.

      If you wish to use Java inside VSCode, try downloading the Installer of Visual Studio Code for Java developers

  19. Mar 2020
  20. Dec 2019
  21. Oct 2019
  22. May 2019
  23. Apr 2019
    1. (def current "Get current process PID" (memoize (fn [] (-> (java.lang.management.ManagementFactory/getRuntimeMXBean) (.getName) (string/split #"@") (first)))))

      getting current proces id (PID) more importantly: java.lang.management.ManagementFactory/getRuntimeMXBean

    1. (defn- file? [f] (instance? java.io.File f)) (defn- find-files-in-dir [dir] (filter #(.isFile ^File %) (file-seq dir)))

      finding files nice declarative way file-seq of this dir

  24. Mar 2019
  25. Jan 2019
    1. after the terminal operation of the stream pipeline commences.

      Above is because of the nature of Streams in general: they are lazily executed (or put another way, execution is delayed until the latest convenient method call).

  26. Dec 2018
    1. Headers in a manifest Header Definition Name The name of the specification. Specification-Title The title of the specification. Specification-Version The version of the specification. Specification-Vendor The vendor of the specification. Implementation-Title The title of the implementation. Implementation-Version The build number of the implementation. Implementation-Vendor The vendor of the implementation.

      It would be nice to have a bit more background, why this stuff is called like this

    1. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.

      So, other jars have to be extracted.

    2. The Class-Path header points to classes or JAR files on the local network,

      Wait, WHAT? on the local network??? Why would it look on the local network?

    1. To modify the manifest, you must first prepare a text file containing the information you wish to add to the manifest. You then use the Jar tool's m option to add the information in your file to the manifest.

      You don't add a manifest, but you add a second file that contains additional fields

    2. Warning: The text file from which you are creating the manifest must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

      This is very stupid....

    1. As an example, suppose you wanted to put audio files and gif images used by the TicTacToe demo into a JAR file, and that you wanted all the files to be on the top level, with no directory hierarchy. You could accomplish that by issuing this command from the parent directory of the images and audio directories: jar cf ImageAudio.jar -C images . -C audio .

      Don't preserve relative paths

    1. Full disclosure: I’m a co-maintainer of clj-time and I’m pretty vocal about encouraging people not to use clj-time when starting a new project: use Java Time instead. Conversion from an existing, clj-time-heavy project is another matter tho’, unfortunately.

      sean cornfield co-mainainter of clj-time use Java.Time

  27. Nov 2018
    1. in general, clojure doesn't have java interop, it has jvm interop so in places where the java language doesn't map 1:1 to the jvm, clojure gives something that matches the raw jvm, not something that matches the java language

      jvm not java interop

  28. Oct 2018
    1. Perhaps part of the confusion - and you say this in a different way in your little memo - is that the C/C++ folks see OO as a liberation from a world that has nothing resembling a first-class functions, while Lisp folks see OO as a prison since it limits their use of functions/objects to the style of (9.). In that case, the only way OO can be defended is in the same manner as any other game or discipline -- by arguing that by giving something up (e.g. the freedom to throw eggs at your neighbor's house) you gain something that you want (assurance that your neighbor won't put you in jail).

      [9] "Sum-of-product-of-function pattern - objects are (in effect) restricted to be functions that take as first argument a distinguished method key argument that is drawn from a finite set of simple names."

    2. Sum-of-product-of-function pattern - objects are (in effect) restricted to be functions that take as first argument a distinguished method key argument that is drawn from a finite set of simple names.

      fwiu: the "finte set of simple names" are all the objects defined in the codebase e.g. in java there are no functions as such just methods attached to classes i.e. "their key argument"

    3. All you can do is send a message (AYCDISAM) = Actors model - there is no direct manipulation of objects, only communication with (or invocation of) them. The presence of fields in Java violates this.

      from what I understand in Java... there are some variables on classes (class instances) that are only acessible through methods and for those the "only send message" paradigm holds but there are also fields which are like attributes in python which you can change directly

    4. Parametric polymorphism - functions and data structures that parameterize over arbitrary values (e.g. list of anything). ML and Lisp both have this. Java doesn't quite because of its non-Object types.

      generics so you've got a "template" collection e.g. Collectoin<animal> and you parametrise it with the Animal type in this example how is that broken by "non-Object types" in java</animal>

  29. Mar 2018
    1. a mutator method is a method used to control changes to a variable. They are also widely known as setter methods

      For example, a method definition in Java would be:

      class MyClassDef {
      
          public void setProperty(String propertyVal) { .. }
      
      }
      

      For above, setProperty(..) method is the mutator

  30. Jan 2018
    1. Default Value

      Please note that the values listed below are the default ones. An Option can represent a Boolean toggle flag (i.e. HeapDumpOnOutOfMemoryError, PrintConcurrentLocks). For such Options, '+' and '-' flags deal with Boolean toggling. In short:

      • '+' means Enable (or set to '1');
      • '-' means Disable (or set to '0').

      For example, in the table pertaining to Debugging Options, by default the -XX:-HeapDumpOnOutOfMemoryError is Disabled, because it has the - prepended to it. To actually Enable it, change that with +, yielding the variant -XX:+HeapDumpOnOutOfMemoryError.

  31. Sep 2017
    1. but the true technology of Java is not in the language, but the virtual machine itself. The JVM as it stands today, is a fast, abstract machine that you can plug any languages into, and is able to operate at speeds comparable to natively compiled binaries.

      This is something really neat to ponder at... Thank you for your insight!

  32. Jul 2017
  33. May 2017
    1. Optimum buffer size is related to a number of things: file system block size, CPU cache size and cache latency. Most file systems are configured to use block sizes of 4096 or 8192. In theory, if you configure your buffer size so you are reading a few bytes more than the disk block, the operations with the file system can be extremely inefficient (i.e. if you configured your buffer to read 4100 bytes at a time, each read would require 2 block reads by the file system). If the blocks are already in cache, then you wind up paying the price of RAM -> L3/L2 cache latency. If you are unlucky and the blocks are not in cache yet, the you pay the price of the disk->RAM latency as well. This is why you see most buffers sized as a power of 2, and generally larger than (or equal to) the disk block size. This means that one of your stream reads could result in multiple disk block reads - but those reads will always use a full block - no wasted reads. Now, this is offset quite a bit in a typical streaming scenario because the block that is read from disk is going to still be in memory when you hit the next read (we are doing sequential reads here, after all) - so you wind up paying the RAM -> L3/L2 cache latency price on the next read, but not the disk->RAM latency. In terms of order of magnitude, disk->RAM latency is so slow that it pretty much swamps any other latency you might be dealing with. So, I suspect that if you ran a test with different cache sizes (haven't done this myself), you will probably find a big impact of cache size up to the size of the file system block. Above that, I suspect that things would level out pretty quickly. There are a ton of conditions and exceptions here - the complexities of the system are actually quite staggering (just getting a handle on L3 -> L2 cache transfers is mind bogglingly complex, and it changes with every CPU type). This leads to the 'real world' answer: If your app is like 99% out there, set the cache size to 8192 and move on (even better, choose encapsulation over performance and use BufferedInputStream to hide the details). If you are in the 1% of apps that are highly dependent on disk throughput, craft your implementation so you can swap out different disk interaction strategies, and provide the knobs and dials to allow your users to test and optimize (or come up with some self optimizing system).

      What's the cache size to keep when reading from file to a buffer?

  34. Apr 2017
    1. array with component type int

      My only suggestion is that this should be changed to single-dimension array with component type int. As per the Encoding conventions defined by java.lang.Class#getName()'s contract.

      In other other words, the OP missed the fact that for every dimension of the array-object, an [ character is prepended to the enconding of the type contained in the array.

  35. Mar 2017
  36. Jun 2016
  37. May 2016
    1. Java Programming Language was developed by James Gosling, Chris Warth, Patrick Naughton, Mike Sheridan and Ed Frank at Sun Microsystems, Inc in the year 1991. At first Java Programming Language was named as Oak, later that it was renamed to Java in the year 1995. Java Programming is a platform independent language. The Internet (World Wide Web) made Java programming more valuable. Since, Internet is connected to different types of systems which having different CPU's & environments, it must have the programs to run on any OS, CPU and Platform. Since, Java programming obtain platform independence and can able to run on any platform like Unix, Intel, Mac etc., it was widely used. Java language also protects two other major issues of Internet, they are security & portability.

      Java Programming Language was developed by James Gosling, Chris Warth, Patrick Naughton, Mike Sheridan and Ed Frank at Sun Microsystems, Inc in the year 1991. At first Java Programming Language was named as Oak, later that it was renamed to Java in the year 1995.

      Java Programming is a platform independent language. The Internet (World Wide Web) made Java programming more valuable. Since, Internet is connected to different types of systems which having different CPU's & environments, it must have the programs to run on any OS, CPU and Platform. Since, Java programming obtain platform independence and can able to run on any platform like Unix, Intel, Mac etc., it was widely used. Java language also protects two other major issues of Internet, they are security & portability.

  38. Dec 2015
    1. blade is a web framework for rapid development of Java applications,you can be used to develop API, Web and back-end services and other applications, a RESTful framework, it provides a simple and convenient way of development, the whole operation of the micro kernel MVC bus guide frame, initial goal is to simplify the web development, and of course the author will upgrade in the future and integrate more compact components based on blade.

      MVC backend java micro framework for API

    1. Compose complex, data-driven visualizations from reusable charts and components with d3.

      wykresy i grafy w javascript

    1. booking.jsMake a beautiful embeddable booking widget in minutes.

      Great google calendar conector in java script

  39. Sep 2015
    1. MyInterfaceImpl

      I believe that a better name would be StandardOutputMyInterface. The name of the implementation should describe the character of the implementation, which in this case is output to the standard output stream. I consider simply appending Impl to the interface name a (common) bad habit.

  40. Jul 2015
  41. Feb 2015
    1. 2.3.2. Mapping native queries You can also map a native query (ie a plain SQL query). To achieve that, you need to describe the SQL resultset structure using @SqlResultSetMapping (or @SqlResultSetMappings if you plan to define several resulset mappings). Like @NamedQuery, a @SqlResultSetMapping can be defined at class level or in a JPA XML file. However its scope is global to the application.

      JPA SQL native query den join ile birden fazla nesne elde etme

    1. @SqlResultSetMappings( { @SqlResultSetMapping(name = "ProfessorWithAddress", entities = { @EntityResult(entityClass = Professor.class), @EntityResult(entityClass = Address.class) }) })

      jpa birden fazla tabloyu direk sınıf ile eşleme join table mapping

    1. Use @FieldResult in the SqlResultSetMapping, to link each entity property to its column alias

      birden fazla tablonun birleşimini sınıflara eşleştirirken oluşan hatanın giderilmesi

  42. Jan 2015