HWZ Forums

Login Register FAQ Mark Forums Read

PCWX App Discussion...

Like Tree318Likes
Closed Thread
 
LinkBack Thread Tools
Old 08-07-2017, 09:20 PM   #76
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
eh. after reply to a thread then it auto will add to the subscribed thread list?

quite irritating
hi,

okay i have fixed this. will release an update tonight.

Set low read and connect timeout. Perform retries instead.
hmmmm, okok. how low should i set the timeout? because i dont want the app to keep showing timeout error if lets say the post submission took a abit longer than usual. and for the retries, i scared later double post.
~Dragonite~ likes this.
kuma-mon is offline  
Old 08-07-2017, 10:18 PM   #77
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
hi,

i have pushed an update to the playstore


Changelog:


v1.0.6
*Fixed bug where thread auto subscribed when users replies to it
i have also tested, subscribed thread wont unsubcribed when user replies to it too.
~Dragonite~ likes this.
kuma-mon is offline  
Old 08-07-2017, 11:50 PM   #78
Arch-Supremacy Member
 
davidktw's Avatar
 
Join Date: Apr 2010
Posts: 11,050
hmmmm, okok. how low should i set the timeout? because i dont want the app to keep showing timeout error if lets say the post submission took a abit longer than usual. and for the retries, i scared later double post.
Read Timeout - 30s
Connect Timeout - 5s

Capture the exceptions inside try..catch blocks and react to them appropriately. Below is a fragment of code for your reading. You are advised to read your http response in blocks of bytes rather than line by line. It's more consistently efficient then line by line. Remember http response is one complete stream of bytes. Lines are your own interpretation to "\r\n", you don't need to respect that if your purpose is not to process line by line.

Between what kind of HTTP request it is, you can choose if you want to retry or not. If you feel some actions are better to notify the user for further actions, then don't retry those and let the user decide.

Eg:
boolean isDone = false; int triesLeft = 5; URL url = new URL(html); while (!isDone && triesLeft > 0) { HttpURLConnection urlConn = null; try { // establish connection urlConn = (HttpURLConnection)url.openConnection(); urlConn.setConnectTimeout(5000); urlConn.setReadTimeout(30000); urlConn.connect(); if (urlConn.getResponseCode() == 200) { // read in data into buffer int bytesRead; byte[] abuf = new byte[4096]; Charset cs = Charset.forName("UTF-8"); StringBuilder str = new StringBuilder(); BufferedInputStream bis = new BufferedInputStream(urlConn.getInputStream()); while ((bytesRead = bis.read(abuf, 0, abuf.length)) >= 0) str.append(new String(abuf, 0, bytesRead, cs)); bis.close(); // do something with the "str" response } else { // react to other response codes } urlConn.disconnect(); isDone = true; } catch (SocketTimeoutException stoe) { if (--triesLeft > 0) stoe.printStackTrace(); else throw stoe; } catch (IOException ioe) { if (--triesLeft > 0) ioe.printStackTrace(); else throw ioe; } finally { if (urlConn != null) urlConn.disconnect(); } }
~Dragonite~ likes this.
davidktw is online now  
Old 09-07-2017, 02:23 PM   #79
Great Supremacy Member
 
BlackCube's Avatar
 
Join Date: Jul 2003
Posts: 68,704
still have this weird ending of the page.





no end of page/thread message
~Dragonite~ likes this.
BlackCube is offline  
Old 10-07-2017, 09:03 AM   #80
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
still have this weird ending of the page.


no end of page/thread message
hi,

sry late reply, yest off day haha. okay did you use the jump to page function? or scroll normally?
~Dragonite~ likes this.
kuma-mon is offline  
Old 10-07-2017, 09:08 AM   #81
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
Read Timeout - 30s
Connect Timeout - 5s

Capture the exceptions inside try..catch blocks and react to them appropriately. Below is a fragment of code for your reading. You are advised to read your http response in blocks of bytes rather than line by line. It's more consistently efficient then line by line. Remember http response is one complete stream of bytes. Lines are your own interpretation to "\r
", you don't need to respect that if your purpose is not to process line by line.

Between what kind of HTTP request it is, you can choose if you want to retry or not. If you feel some actions are better to notify the user for further actions, then don't retry those and let the user decide.
okay thanks so much, i wil have a look at the code and understand.

well actually the reason why i need read/print line by line is because i have to get the error code hwz returns. if lets say user inputs more than 8 images, hwz will reject his post. the error is shown in the body section which is far down. but yea i understand i can improve the way i read this hmmm.
~Dragonite~ likes this.
kuma-mon is offline  
Old 10-07-2017, 09:13 AM   #82
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
implementing the themes, dont know why white background make everything so ugly









~Dragonite~ likes this.
kuma-mon is offline  
Old 10-07-2017, 09:38 AM   #83
Arch-Supremacy Member
 
davidktw's Avatar
 
Join Date: Apr 2010
Posts: 11,050
okay thanks so much, i wil have a look at the code and understand.

well actually the reason why i need read/print line by line is because i have to get the error code hwz returns. if lets say user inputs more than 8 images, hwz will reject his post. the error is shown in the body section which is far down. but yea i understand i can improve the way i read this hmmm.
You don't need to slurp in your data line by line. Line is just an illusion in a stream of data.

A line basically is denoted by the following regular expression

"[^\r\n]*\r\n"

If you need to detect for lets say an occurrence of a string in a block of text, you can search across the whole string, just by looking for text.

For example, suppose I have the following string

"Lorem Ipsum is simply dummy text of the printing and typesetting industry.\r\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s,\r\nwhen an unknown printer took a galley of type and scrambled it to make a type\r\nspecimen book. It has survived not only five centuries, but also the leap\r\ninto electronic typesetting, remaining essentially unchanged.\r\nIt was popularised in the 1960s with the release of Letraset\r\nsheets containing Lorem Ipsum passages, and more recently\r\nwith desktop publishing software like Aldus PageMaker\r\nincluding versions of Lorem Ipsum."

It is the same as when you will display it in the following form

Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
specimen book. It has survived not only five centuries, but also the leap
into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.

If I would like to search for the word specimen, I could do the following regex

"\nspecimen", or "\r\nspecimen"

I could also use specific flags to denote I'm searching at the beginning for each line

"^specimen", MULTILINE

matching or searching is more powerful this way.
~Dragonite~ likes this.
davidktw is online now  
Old 10-07-2017, 09:44 AM   #84
Arch-Supremacy Member
 
davidktw's Avatar
 
Join Date: Apr 2010
Posts: 11,050
implementing the themes, dont know why white background make everything so ugly




It's not your choice of colours that make the UI looks less appealing. It's the fonts. Appropriate fonts gives the most obvious look and feel to an interface.

Don't use such thick fonts unless you are trying to emphasise on something. Lighter fonts makes the fonts less obtrusive. It gives more whitespace to the surround and make the glyphs less cluttered. Also "Created By:" is not critical to the topics. Right align them and put them to the bottom right. Don't use so much Capitalisation. "Created by:" will do. In fact, I will recommend use a simple "By:"

Take a look at this page https://www.qualtrics.com/support/su...feel-overview/
The menu listing on the left used a clean and sleek looking font. It gives a sharp look and very easy to read.

You don't have to choose WHITE(255,255,255), try off whites to make the background less outstanding. Read this http://www.colourlovers.com/color/FDFDFD/Off_White

Since you are creating a mobile app, introduce some style to it. Instead of "Last Post: ..... by ....", try "Posted by ..... at .....". You can make your application less techie, by not using "KEY: VALUE" approach to show information to your end user. For dates, you can use more friendly information, like "today", "yesterday", "a week ago". All these subtleties makes your app more user friendly and less like a technical app.

import java.io.*; import java.util.regex.*; import static java.util.regex.Pattern.*; public class Test { public static void main(String[] args) { String s = "abc1 def2\r\nghi3 jkl4\r\nabc5 def6 \r\n ghi7 jkl8"; ByteArrayInputStream bis = new ByteArrayInputStream (s.getBytes()); StringBuilder t = new StringBuilder(); int cnt; byte[] buf = new byte[4]; while ((cnt = bis.read(buf, 0, buf.length)) >= 0) t.append(new String(buf, 0, cnt)); System.out.println("HAYSTACK"); System.out.println("======================================"); System.out.println(t); System.out.println("======================================\n"); { System.out.println("NEEDLE = ^abc.*"); System.out.println("======================================"); Pattern p = Pattern.compile("^abc.*", MULTILINE); Matcher m = p.matcher(t.toString()); while (m.find()) System.out.println("[" + m.start() + "," + m.end() + "] " + m.group()); System.out.println("======================================\n"); } { System.out.println("NEEDLE = (?<=[\\r\\n]?)abc.*"); System.out.println("======================================"); Pattern p = Pattern.compile("(?<=[\r\n]?)abc.*"); Matcher m = p.matcher(t.toString()); while (m.find()) System.out.println("[" + m.start() + "," + m.end() + "] " + m.group()); System.out.println("======================================\n"); } } }
Tested in https://www.compilejava.net
HAYSTACK ====================================== abc1 def2 ghi3 jkl4 abc5 def6 ghi7 jkl8 ====================================== NEEDLE = ^abc.* ====================================== [0,9] abc1 def2 [22,32] abc5 def6 ====================================== NEEDLE = (?<=[\r\n]?)abc.* ====================================== [0,9] abc1 def2 [22,32] abc5 def6 ======================================
~Dragonite~ likes this.

Last edited by davidktw; 10-07-2017 at 10:31 AM..
davidktw is online now  
Old 10-07-2017, 12:15 PM   #85
Great Supremacy Member
 
BlackCube's Avatar
 
Join Date: Jul 2003
Posts: 68,704
hi,

sry late reply, yest off day haha. okay did you use the jump to page function? or scroll normally?
normal scrolling..
~Dragonite~ likes this.
BlackCube is offline  
Old 10-07-2017, 07:06 PM   #86
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
It's not your choice of colours that make the UI looks less appealing. It's the fonts. Appropriate fonts gives the most obvious look and feel to an interface.

Don't use such thick fonts unless you are trying to emphasise on something. Lighter fonts makes the fonts less obtrusive. It gives more whitespace to the surround and make the glyphs less cluttered. Also "Created By:" is not critical to the topics. Right align them and put them to the bottom right. Don't use so much Capitalisation. "Created by:" will do. In fact, I will recommend use a simple "By:"

Take a look at this page https://www.qualtrics.com/support/su...feel-overview/
The menu listing on the left used a clean and sleek looking font. It gives a sharp look and very easy to read.

You don't have to choose WHITE(255,255,255), try off whites to make the background less outstanding. Read this http://www.colourlovers.com/color/FDFDFD/Off_White

Since you are creating a mobile app, introduce some style to it. Instead of "Last Post: ..... by ....", try "Posted by ..... at .....". You can make your application less techie, by not using "KEY: VALUE" approach to show information to your end user. For dates, you can use more friendly information, like "today", "yesterday", "a week ago". All these subtleties makes your app more user friendly and less like a technical app.
hi david,

im listening to your advice, try to make the fonts, the background colours, less outstanding, so that its easier on user eyes. and also the typography. i might not follow everything though, i see which looks better then i will use that.

i see that you have provided me the code for the input stream data if im the correct? the one u said to get bytes instead of line by line. thanks i will look into it. waa u have help me so much, i see what i can do
~Dragonite~ likes this.
kuma-mon is offline  
Old 10-07-2017, 07:17 PM   #87
Arch-Supremacy Member
 
davidktw's Avatar
 
Join Date: Apr 2010
Posts: 11,050
hi david,

im listening to your advice, try to make the fonts, the background colours, less outstanding, so that its easier on user eyes. and also the typography. i might not follow everything though, i see which looks better then i will use that.

i see that you have provided me the code for the input stream data if im the correct? the one u said to get bytes instead of line by line. thanks i will look into it. waa u have help me so much, i see what i can do
I'm just giving you idea, after all, it is your app, so you make the final call how you want it to be.

Yes, I gave you some codes to show you how to slurp in response efficiently and how to use regex, perform search and match across your html response.

If you are adventurous enough, choose SAX approach to extract information out of your DOM. Document approach normally requires a lot of memory, which is not the best option for mobile device. However SAX parser requires more states control.

You can take a look at this.
http://www.attoparser.org

Actually JSOUP can also be operating in SAX manner, you will need to override the HTMLTreeBuilder and put in your own implementation.

When I have more time, will get you more insight to using SAX Parsing technique to parse HTML codes and formulate your own data model.
~Dragonite~ likes this.
davidktw is online now  
Old 10-07-2017, 07:18 PM   #88
Great Supremacy Member
 
amazingone's Avatar
 
Join Date: Jan 2015
Posts: 55,466
hope that PCWX can be better as time goes~

~Dragonite~ likes this.
amazingone is offline  
Old 10-07-2017, 07:18 PM   #89
Supremacy Member
 
kuma-mon's Avatar
 
Join Date: Apr 2017
Posts: 5,587
anyway, there will be a huge update coming. it's focused on UI aspects, the one you guys have been asking for. will let you guys know again once the update is pushed out. stay tuned

Changelog:

v2.0

Introducing themes for PCWX
Change to many different types of colors and modes based on your liking

EDMW Gallery
View all the photos uploaded to EDMW

Other UI Tweaks & Settings
Enable/Disable Pager in settings
Enable/Disable Avatar in settings
Hide username details from left navigation in settings
Users can now view full quote content with a button when he quote a user's post
Added refresh button in subscribed threads
Added signature, users can choose to enable/disable it in their post
miyamiya and ~Dragonite~ like this.

Last edited by kuma-mon; 10-07-2017 at 07:31 PM..
kuma-mon is offline  
Old 11-07-2017, 09:32 AM   #90
High Supremacy Member
 
Azzizz81's Avatar
 
Join Date: May 2001
Posts: 43,257
looking forward to new updates
~Dragonite~ likes this.
Azzizz81 is offline  
Closed Thread
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ. Forum members and moderators are responsible for their own posts.

Please refer to our Terms of Service for more information.


Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On