PCWX App Discussion...

Status
Not open for further replies.

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
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.
 

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
implementing the themes, dont know why white background make everything so ugly
:s13:
:s13:



4G5Cu2Q.jpg




Uct87Hl.jpg
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,396
Reaction score
1,186
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.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,396
Reaction score
1,186
implementing the themes, dont know why white background make everything so ugly
:s13:
:s13:

4G5Cu2Q.jpg

Uct87Hl.jpg

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/survey-platform/survey-module/look-feel/look-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.

Code:
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
Code:
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 
======================================
 
Last edited:

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
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/survey-platform/survey-module/look-feel/look-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 :o:o
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,396
Reaction score
1,186
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 :o:o

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.
 

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
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
 
Last edited:

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
after receiving timeout error loading the thread. then go back then click on the thread again. it will load from post 1 instead of resuming from the last read.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
a6s7Skv.jpg


some Unicode or stuff not handled? got the ????






5oKvaz7.jpg


someone quoted me but no notification. the thread is in edmw.

update. I know Liao. cause I still within the app so never notify me.

update 2. I was out of app and someone quoted me but I didn't receive it.

update 3. think I know what happened. I logged into another phone of mine. all the notification went to the other phone. just saw it. so notification goes to a single device for a user?

Should moi visit Kanchanburi the dead railway again?
 
Last edited:

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
IBz4gci.jpg


I think the code shouldn't be there right. think saw it twice for those post with spoiler Liao.

browser show this.


d9sSx0q.jpg
 
Last edited:

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
BhOPF0X.jpg


xRa4Upf.jpg


repeated thread at the listing. see first image.
i scroll down. went into some thread. press back.
scroll. then saw duplicated thread as seen in second image.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
28Ye9OC.jpg



-2837838373637383 of 1 . hahahaha

http://forums.hardwarezone.com.sg/eat-drink-man-woman-16/do-you-realise-most-software-engineer-arrogant-5653577.html
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
eh. if I edit the post (with quote) that I have submitted. the quote in the post will be editable even if I turn off in the setting page.

if I were to quote and reply. then it's fine.
 

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
thanks blackcube for spotting all the minor bugs...

i take note of those and will fix them. some of them i'm aware like the code content supposed to be inside the spoiler but it shows outside. that's because i didnt include code tag for spoil, only quote, image and youtube.

update 3. think I know what happened. I logged into another phone of mine. all the notification went to the other phone. just saw it. so notification goes to a single device for a user?

yup only a single device can be registered to the server for the edmw pager. if u login with another phone, it will reset the token ID tagged to your username. the notifications will be sent to the latest token ID registered under your username.

eh. if I edit the post (with quote) that I have submitted. the quote in the post will be editable even if I turn off in the setting page.

if I were to quote and reply. then it's fine.

yup the quote are meant to be editable because you are editing your post.
 

BlackCube

Great Supremacy Member
Joined
Jul 18, 2003
Messages
71,188
Reaction score
836
i take note of those and will fix them. some of them i'm aware like the code content supposed to be inside the spoiler but it shows outside. that's because i didnt include code tag for spoil, only quote, image and youtube.

eh i dont think those are actual code tag. i think is your app display those code content. not by the user.

see this thread - http://forums.hardwarezone.com.sg/eat-drink-man-woman-16/what-good-tv-brand-can-last-5653291.html post #15. and see my screenshot..

yup only a single device can be registered to the server for the edmw pager. if u login with another phone, it will reset the token ID tagged to your username. the notifications will be sent to the latest token ID registered under your username.

okay, understand. like that means i have to logout and in so that the latest device will be the "main" device.

yup the quote are meant to be editable because you are editing your post.

yeah.. but still, im editing my post. not editing the post of the person that i quote. so when im editing my post, and the setting of the "editable quote" is turned off. then it should display with the green box thingy instead of showing the entire text of the person that i quoted to edit.
unless if my setting for editable quote is turned on, then ok.

get what i mean?
 

kuma-mon

Supremacy Member
Joined
Apr 16, 2017
Messages
8,688
Reaction score
3,005
eh i dont think those are actual code tag. i think is your app display those code content. not by the user.

see this thread - http://forums.hardwarezone.com.sg/eat-drink-man-woman-16/what-good-tv-brand-can-last-5653291.html post #15. and see my screenshot..



okay, understand. like that means i have to logout and in so that the latest device will be the "main" device.



yeah.. but still, im editing my post. not editing the post of the person that i quote. so when im editing my post, and the setting of the "editable quote" is turned off. then it should display with the green box thingy instead of showing the entire text of the person that i quoted to edit.
unless if my setting for editable quote is turned on, then ok.

get what i mean?

1) waa i see, i thought it was actual code tag inside spoiler. thanks for highlighting and also specially sending the specific thread, will see why it shows that.

2)i see okay, i think i understand. the editable quote should be consistent among everything. even when editing your post. will change this.

okay sorry for now im gonna focus solely on the themes aspect for the next update, so all these new bugs highlighted, those that are critical will be release together. other than that, i will try fix it after the next update.
 
Last edited:
Status
Not open for further replies.
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 Community Guidelines and Standards, Terms of Service and Member T&Cs for more information.
Top