package com.indrajith; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<String> a= split("[\n" + "\t{\n" + "\t\t\"id\": \"0001\",\n" + "\t\t\"type\": \"donut\",\n" + "\t\t\"name\": \"Cake\",\n" + "\t\t\"ppu\": 0.55,\n" + "\t\t\"batters\":\n" + "\t\t\t{\n" + "\t\t\t\t\"batter\":\n" + "\t\t\t\t\t[\n" + "\t\t\t\t\t\t{ \"id\": \"1001\", \"type\": \"Regular\" },\n" + "\t\t\t\t\t\t{ \"id\": \"1002\", \"type\": \"Chocolate\" },\n" + "\t\t\t\t\t\t{ \"id\": \"1003\", \"type\": \"Blueberry\" },\n" + "\t\t\t\t\t\t{ \"id\": \"1004\", \"type\": \"Devil's Food\" }\n" + "\t\t\t\t\t]\n" + "\t\t\t},\n" + "\t\t\"topping\":\n" + "\t\t\t[\n" + "\t\t\t\t{ \"id\": \"5001\", \"type\": \"None\" },\n" + "\t\t\t\t{ \"id\": \"5002\", \"type\": \"Glazed\" },\n" + "\t\t\t\t{ \"id\": \"5005\", \"type\": \"Sugar\" },\n" + "\t\t\t\t{ \"id\": \"5007\", \"type\": \"Powdered Sugar\" },\n" + "\t\t\t\t{ \"id\": \"5006\", \"type\": \"Chocolate with Sprinkles\" },\n" + "\t\t\t\t{ \"id\": \"5003\", \"type\": \"Chocolate\" },\n" + "\t\t\t\t{ \"id\": \"5004\", \"type\": \"Maple\" }\n" + "\t\t\t]\n" + "\t},\n" + "\t{\n" + "\t\t\"id\": \"0002\",\n" + "\t\t\"type\": \"donut\",\n" + "\t\t\"name\": \"Raised\",\n" + "\t\t\"ppu\": 0.55,\n" + "\t\t\"batters\":\n" + "\t\t\t{\n" + "\t\t\t\t\"batter\":\n" + "\t\t\t\t\t[\n" + "\t\t\t\t\t\t{ \"id\": \"1001\", \"type\": \"Regular\" }\n" + "\t\t\t\t\t]\n" + "\t\t\t},\n" + "\t\t\"topping\":\n" + "\t\t\t[\n" + "\t\t\t\t{ \"id\": \"5001\", \"type\": \"None\" },\n" + "\t\t\t\t{ \"id\": \"5002\", \"type\": \"Glazed\" },\n" + "\t\t\t\t{ \"id\": \"5005\", \"type\": \"Sugar\" },\n" + "\t\t\t\t{ \"id\": \"5003\", \"type\": \"Chocolate\" },\n" + "\t\t\t\t{ \"id\": \"5004\", \"type\": \"Maple\" }\n" + "\t\t\t]\n" + "\t},\n" + "\t{\n" + "\t\t\"id\": \"0003\",\n" + "\t\t\"type\": \"donut\",\n" + "\t\t\"name\": \"Old Fashioned\",\n" + "\t\t\"ppu\": 0.55,\n" + "\t\t\"batters\":\n" + "\t\t\t{\n" + "\t\t\t\t\"batter\":\n" + "\t\t\t\t\t[\n" + "\t\t\t\t\t\t{ \"id\": \"1001\", \"type\": \"Regular\" },\n" + "\t\t\t\t\t\t{ \"id\": \"1002\", \"type\": \"Chocolate\" }\n" + "\t\t\t\t\t]\n" + "\t\t\t},\n" + "\t\t\"topping\":\n" + "\t\t\t[\n" + "\t\t\t\t{ \"id\": \"5001\", \"type\": \"None\" },\n" + "\t\t\t\t{ \"id\": \"5002\", \"type\": \"Glazed\" },\n" + "\t\t\t\t{ \"id\": \"5003\", \"type\": \"Chocolate\" },\n" + "\t\t\t\t{ \"id\": \"5004\", \"type\": \"Maple\" }\n" + "\t\t\t]\n" + "\t}\n" + "]","topping"); } private static List<String> split(String json,String field) { char startChar = '{'; char endChar = '}'; List<String> returnList = new ArrayList<>(); if (field != null && !field.isEmpty()) { json = json.split(field)[1]; } for (int i = 0; i < json.length(); i++) { if (json.charAt(i) == startChar) { int count = 0; for (int j = 0; j < json.length(); j++) { if (json.charAt(j) == startChar) { count++; } if (json.charAt(j) == startChar) { count--; } if(count==0){ returnList.add(json.substring(i,j+1)); i=j; break; } } } } return returnList; } }
Wednesday, February 17, 2016
Custom json parser to convert an array within an array to java.util.List of type String
Sunday, February 14, 2016
How to Completely Install Oracle JDK on Linux Mint 17.3 Rosa
I followed the methods given in the below linux mint forum and I was able to successfully install oracle jdk 1.8.0_73.
http://community.linuxmint.com/tutorial/view/1839
http://community.linuxmint.com/tutorial/view/1839
Play HEVC video format in VLC player Linux Mint 17.3 Rosa
VLC out of the box does not play HEVC files. To fix this we need to install libde265 via PPA, which is an open source implementation of the h.265 video codec.
Open up the Terminal and run the commands below:
- sudo apt-add-repository ppa:strukturag/libde265
- sudo apt-get update
- sudo apt-get install vlc-plugin-libde265
VLC should now play these media files.
Source: http://www.unixmen.com/fix-vlc-not-support-audio-video-format-hevc/
Fix for wifi signal dropping with Realtek RTL8723BE wifi adapter in Linux mint 17.3 Rosa
http://forums.linuxmint.com/viewtopic.php?t=204172&f=53
In a terminal type the following commands
1. sudo apt-get install linux-headers-generic build-essential git
2. git clone https://github/com/lwfinger/rtlwifi_new
3. cd rtlwifi_new
4. make
5. sudo make install
6. sudo modprobe rtl8723be
rtl8723be was my wireless ..change rtl8723be to your model
If it's still not working...
http://www.dedoimedo.com/computers/ubuntu-trusty-realtek.html
1. sudo gedit /etc/modprobe.d/rtl8723be.conf
2. add> options rtl8723be fwlps=N ips=N
3. sudo modprobe rtl8723be
check for wifi adapter information:
lspci -vq | grep -i wireless -B 1 -A 5
modinfo rtl8723be
Tuesday, January 12, 2016
Convert json string to an array list in java
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import com.google.gson.Gson;
String json="{}";
Gson gson = new Gson();
Collection<Document> docCollection= null;
List<Document> documentList=null;
docCollection=gson.fromJson(json,new TypeToken<List<Document>>(){}.getType());
import java.util.ArrayList;
import java.util.Collection;
import com.google.gson.Gson;
String json="{}";
Gson gson = new Gson();
Collection<Document> docCollection= null;
List<Document> documentList=null;
docCollection=gson.fromJson(json,new TypeToken<List<Document>>(){}.getType());
if(docCollection instanceof List){
documentList=(List<Document>)docCollection;
}else{
documentList=new ArrayList<Document>(docCollection);
}
Saturday, December 19, 2015
How to find about RAM in your laptop. Everything you should know
So after installing Windows 10 in my newly bought HP Pavilion laptop I was keen on finding out the specs of the laptop. Everything except RAM information I could able to find. (In windows system information it only shows Installed memory: 4GB).
I installed CPU-Z software and it could access RAM details.
Or go to command line and type wmic memorychip list full
It will list down important information like below.
If you want to expand memory you should find laptop mainboard details before doing that. Some mainboard chipsets don't support dual channel memory architecture.
2. Kingston memory stick
4GB Module - DDR3L 1600MHz
Part Number: KTH-X3CL/4G
Specs: DDR3L, 1600MHz, Non-ECC, CL11, 1R, X8, 1.35V, Unbuffered, SODIMM, 204-pin
Even they are from 2 manufacturers they can be used in dual channels. That is because they are both DDR3 and they have the same frequency.
DDR3 vs DDR3L:
DDR3L is a dual voltage capable memory SoDIMM, which supports operation at both 1.5V and 1.35V. DDR3L is also pin-compatible with DDR3. DDR3 is a single voltage capable memory SoDIMM, which supports 1.5V operation only.
DDR stands for Double Data Rate(For example above 4GB modules run in 800MHz frequency but their Data rate is 1600MHz)
I installed CPU-Z software and it could access RAM details.
Or go to command line and type wmic memorychip list full
It will list down important information like below.
- Capacity=4294967296
- Manufacturer=Micron
- PartNumber=8KTF51264HZ-1G6N1
- DeviceLocator=Bottom-Slot 1(left)
- SerialNumber=16760011
- Speed=1600
Difference between single channel and dual channel:
- single channel: only one memory card is installed in one memory card slot.
- dual channel: in order this to work chipset should support dual channeling. It will have 2 identical memory cards in 2 memory card slots.
Difference between single rank memory and dual rank memory:
Take a look at below 4GB modules.
1. Micron memory stick
Part -MT8KTF51264HZ-1G6
1. Micron memory stick
Part -MT8KTF51264HZ-1G6
Technology -DDR3 SDRAM
Density -4GB
Depth -512Mb
Width -x64
Pin Count -204-pin
Data Rate -1600 MT/s
Speed -PC3-12800
CAS Latency -11
Voltage -1.35V
Comp Config -512 Meg x 8
Module Rank -Single Rank
2. Kingston memory stick
4GB Module - DDR3L 1600MHz
Part Number: KTH-X3CL/4G
Specs: DDR3L, 1600MHz, Non-ECC, CL11, 1R, X8, 1.35V, Unbuffered, SODIMM, 204-pin
Even they are from 2 manufacturers they can be used in dual channels. That is because they are both DDR3 and they have the same frequency.
DDR3 vs DDR3L:
DDR3L is a dual voltage capable memory SoDIMM, which supports operation at both 1.5V and 1.35V. DDR3L is also pin-compatible with DDR3. DDR3 is a single voltage capable memory SoDIMM, which supports 1.5V operation only.
DDR stands for Double Data Rate(For example above 4GB modules run in 800MHz frequency but their Data rate is 1600MHz)
Friday, December 18, 2015
How to resolve missing PCI Data Acquisition and Signal Processing Controller driver in Windows 10 x64
I bought my 2nd laptop this Wednesday(16/12/2015) from Tulip Computers, Sri Lanka. Model is HP Pavilion AB055TX. It didn't have an OS in it so I had to download Windows 10 Enterprise Evaluation Edition from Microsoft site and install it in the laptop.
ISSUE:
Almost everything worked perfect after one round of a windows update. But still there was a missing driver for PCI Data Acquisition and Signal Processing Controller driver.
SOLUTION:
I searched Google and finally found the answer from this hp support forum . So what I had to do was to simply download sp71262 driver that enables the Intel Dynamic Platform and Thermal Framework firmware and install. It worked like a charm.
ISSUE:
Almost everything worked perfect after one round of a windows update. But still there was a missing driver for PCI Data Acquisition and Signal Processing Controller driver.
SOLUTION:
I searched Google and finally found the answer from this hp support forum . So what I had to do was to simply download sp71262 driver that enables the Intel Dynamic Platform and Thermal Framework firmware and install. It worked like a charm.
Subscribe to:
Posts (Atom)