Posts

Automatic Switch Between LAN & Wifi in Windows 10

Image
Steps to switch between LAN and Wifi Automatically. 1.        Go to Control Panel -> Network & Sharing Centre   -> Change Adapter Settings 2.        Git ‘Alt’ button to get Menu items 3.        Click Advanced -> Advanced Settings 4.        Change the order like below. 5.        Click Ok. Note : First preference will be LAN if connected.

First Non Repeating Character Using Java 8

Hi Friends, In this post, we will see the program for FirstNonRepeatingCharacter in java. package com.raj.programs; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; public class FirstNonRepeatingCharacter { static Character getFirstNonRepeatingCharacter(String input) { Map<Character, Integer> table = new LinkedHashMap<>(input.length()); input.chars() // IntStream .mapToObj(c -> (char) c) // converting into char .forEach(ch -> table.put(ch, table.containsKey(ch) ? table.get(ch) + 1 : 1)); // putting in map return table.entrySet().stream() // getting stream from map entries .filter(entry -> entry.getValue() == 1) // getting only the entries which presented only one time .map(Entry::getKey) // getting the entry keys alone .findFirst() // getting first element in the key list .orElse(null); // If none found, null will be returned } public static void main(String[] args) { ...

First Recurring Character Java Program

Hi Folks, Below the source code for FirstRecurringCharacter in java. package com.raj.programs; import java.util.Hashtable; public class FirstRecurringCharacter { public static String firstRecurring(String inputString) { Hashtable<String, String> table =  new Hashtable<>(inputString.length()); for(char c : inputString.toCharArray()) { if(table.containsKey(String.valueOf(c))){ System.out.println("First Recurring character is : "+c); return String.valueOf(c); }else { table.put(String.valueOf(c), String.valueOf(c)); } } System.out.println("Not found"); return null; } public static void main(String[] args) { FirstRecurringCharacter.firstRecurring("ABCDEFA"); FirstRecurringCharacter.firstRecurring("ABCDEF"); } }

json editor - reorder

https://github.com/josdejong/jsoneditor/ https://jsoneditoronline.org/ https://codebeautify.org

Java - How to get all the field names from JSON Schema

public void getKey ( String response ) { List < String > keyList = new ArrayList < String >(); try { JSONObject jsonObject = new JSONObject ( response ); JSONObject schema = jsonObject . getJSONObject ( "schema" ); JSONObject properties = schema . getJSONObject ( "properties" ); Iterator iterator = properties . keys (); while ( iterator . hasNext ()) { String key = iterator . next (). toString (); keyList . add ( key ); } String [] arr = ( String []) keyList . toArray ( new String [ keyList . size ()]); } catch ( JSONException e ) { e . printStackTrace (); } }

Replace newline character in notepad ++

Then select Search → Replace from the menu, or hit Ctrl-H. The Replace dialog will show up. Therein make sure that you fill out the following values;  Find what:  \\ n  (yes,  two  back-slashes),  Replace with:  \ n  (yes, just one back-slash), and the most important, make sure you select the  Extended (\n, \r, \t, \0, \x, …)  radio button.

Handlebar

{{def 'fifteenYear' (math birthYear '+' 15)}} {{#ifb (or (and (compare (math fifteenYear '%' 4) '==' 0) (compare (math fifteenYear '%' 100) '!=' 0) ) (compare (math fifteenYear '%' 400) '==' 0) ) }} Your fifteenth anniversary was in a leap year! {{else}} Your fifteenth anniversary was in a non-leap year! {{/ifb}} https://github.com/beryx/handlebars-java-helpers birthYear: 1997 http://handlebars-java-helpers.beryx.org/releases/latest/