Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- User interface



  How to check whether a struct implements an interface in GoLang

Unlike other programming languages like Java, when implementing an interface in GoLang, there is no syntax like below to explicit tell the relationship: type I interface { } type A struct implements I { } When looking at the code or running the code in GoLang, it might lead to a case one doesn't know whether a struct implements interface before trying to use it as some interface. According to GoLang spec, as long as a struct implements all functions of an interface, it is considered as having i...

   GOLANG,INTERFACE,IMPLEMENTATION,CHECK     2020-05-03 00:05:54

  Understanding abstract interface in Java

Have you read about an interface declaration as public abstract interface InterfaceName in Java? At the first glance, is it a weird declaration? Why should we declare an interface as abstract? For example, we may see below code in some projects: public abstract interface MyInterface { public void check(); public abstract boolean check(boolean really); } Actually here abstract is redundant, an interface is implicitly abstract, we no need to put an abstract in front of interface. But it do...

   Java,abstract interface     2014-08-18 23:07:27

  Be careful about nil check on interface in GoLang

nil check is frequently seen in GoLang code especially for error check since GoLang's special error handling convention. In most cases, nil check is straight forward, but in interface case, it's a bit different and special care needs to be taken. Take a look at below code snippet and guess what the output will be. package main import ( "bytes" "fmt" "io" ) func check(w io.Writer) { if w != nil { fmt.Println("w is not nil") } fmt.Printf("w is %+v\n", w) } func main() { var b *bytes.B...

   INTERFACE,GOLANG,NIL CHECK,NIL TYPE,NIL VALUE     2019-04-06 07:47:07

  Will Microsoft use Windows 8 to replace Metro?

Since there is some dispute with a German company Metro AG on the word "Metro", it is said that Microsoft will abandon "Metro" in Windows 8. Then what will be the replacement of "Metro"? According to Zdnet, the answer may be Windows 8. Microsoft reminds Windows developers not to use "Metro" when they mention interface of Windows Phone or Windows 8 in their apps and recommends that the developers use New User Interface when they describe Windows 8 style interface design. Microsoft officially anno...

   Windows 8,Metro,name     2012-08-10 13:32:00

  Ensuring Go Interface Implementation: A Quick Guide

Introduction Go's simplicity and power shine in its interface system, offering a clean way to define contracts between types. However, when it comes to checking whether a struct satisfies an interface, Go's static typing philosophy means there isn't a direct runtime check. In this concise guide, we'll explore practical methods, including some lesser-known tricks, to verify whether a struct implements an interface. Method 1: Type Assertion and a Dummy Method package main import "fmt" type MyInt...

   INTERFACE,GOLANG,IMPLEMENTS     2023-11-25 21:36:01

  Should we use Abstract class or Interface?

When we write programs, we may often get into a situation where we don't know whether we should use Abstract class or Interface when we want to define an abstract object. These two are very similar and they are interchangeable in many cases. On Stackoverflow, this question is asked lots of times and it's related to many programming languages. Also in the official documentation of PHP regarding the Abstract class and Interface, people are arguing about this. To understand this question, their dif...

   DIFFERENCE,INTERFACE,ABSTRACT CLASS,COMPARISON,OOP     2013-04-15 11:44:36

  One interesting story about Chinese software development

I have once seen an interesting complaint written by one foreigner about Beijing South Railway Station (China) on foursquare. It says: "There is simply no way to buy a ticket at the machine unless you have a Chinese ID. What the hell they have English interface for then?" Apparently,the foreigner cannot buy ticket because he doesn’t have Chinese ID but there still presents an English interface for foreigners on the vending machine. Because of my profession, I find this awkward situation w...

   Software design,User experience,Importance     2012-03-26 14:42:50

  Configure static IP for Linux

When a Linux server is running, it has to have an IP so that other machines can talk to it. It is often desired that the server would own a static IP so that every time other machines want to connect to it, the same IP address would be used. This is extremely useful when there are virtual machines installed on a host machine where the virtual machine would start and stop now and then.  To configure static IP address for a Linux server, the /etc/network/interfaces needs to be updated. Assumi...

   LINUX,NETWORK,STATIC IP,DNS     2017-07-08 08:39:58

  Comparable and comparator in Java

Comparable and comparator are two similar interfaces used to compare objects in Java. When we want to sort a list of objects such as Employee or User etc, we may need to implement these interfaces to make them comparable as we want. However, there are some differences between comparable and comparator interface.ComparableA comparable object is capable of comparing itself with another object. The class itself must implements the java.lang.Comparable interface in order to be able to compare its in...

   Java,Comparable,Comparator,Sort     2012-07-04 12:06:15

  How does PHP session work?

This article is about how PHP session works internally. Below are the steps : 1. Session in PHP is loaded into PHP core as an extension, we can understand it as an extension. When session extension is loaded, PHP will call core functions to get the session save_handler, i.e interface or functions for reading and writing session data. By default, PHP will handle session data by writing and reading files on the server. But PHP also supplies custom methods for handling session data, we can use sess...

   PHP, session, mechanism     2012-12-28 13:36:49