William Ng

Ranch Hand
+ Follow
since Jul 11, 2015
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
1
Total given
14
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by William Ng

I'm planning on getting my Java OCAP and OCP certifications then i'm not sure whether I should specialize in AWS or JEE. Which would you recommend. Can I do both?
3 hours ago
Software development is software development. There are all kinds of development, and while they have there differences, the underlying concepts and processes are equal if not similar. Wheather your a mobile developer or web app developer, they will consider it within software development experience. But you'll probably have to prove that you know mobile dev and not just whatever your transitioning from.
3 hours ago
I'll give those suggestions a try, and can you give me your thoughts on using the FA? I think it is the next simplest approach, and probably more efficient also.
3 hours ago

Rob Spoor wrote:Side note: since $ matches the end of the string, $[.]+ will never match anything.


I know that. That is why I use [tt]$[\\.]+[tt].
3 hours ago

Campbell Ritchie wrote:
You can pass the entire line to a Scanner object, then you can get a Stream of matches from a regex. Look at this method. (Java9 only.) Use its return result's group() method to get a String, and the last line simply calls System.out.println():-


Thank you for reminding of the quote. I've heard it before, and I there is all truth in that saying.
Yes, I have tried to verify that it finds full stops. And it does not.
I have decided to abandon this method, and chose to write my own finite automaton to handle the splitting.
The goal of the FA is to find words in ill formed text. For example

abab'a, baba baba babbab. "a abab baba baba"     baba-abababa aabab...., ababab???

Should produce the following words

abab'a
baba
baba
babbab
a
abab
baba
baba  
baba-abababa
aabab
ababab

I have already come up with an FA diagram that I will implement soon.

1 day ago
I have posted the original, before I made the changes in attempt to fix it.
2 days ago

Campbell Ritchie wrote:There must be easier ways to do that, even with a regex. Have you come across the predefined character class \w?


I don't doubt that there is. But this is the most simple way that I have come up with, and I have tested its correctess at regexpal.com. But when I use it in replaceAll, it does nothing.
2 days ago

Paul Clapham wrote:Well, in line 11 of that code you apply replaceAll to the input string (variable name w) and assign the result to a new variable named wnew.

Then at line 12 you apply replaceAll to the input string again, only with a different regex, and assign that result to the variable named wnew. This has the effect of discarding the result of line 11.

Anyway, with regex there's all kinds of unexpected things which can happen if you get it a bit wrong. So it would help if you showed us an example of an input string and the result of line 12. Also it would help if you told us what you expected instead.



Sorry, I forgot I made those changes. The 'wnew' is supposed to be a w. I did that to so if that would solve the problem. It's the same regardless of whether i create a new variable or not.
An example of I/O would be the following

Input: "This a test...."
Output:
w before replacement: This
w after: This
w before replacement: a
w after: a
w before replacement: test....
w after: test....

The last line should be
w after: test



2 days ago
I am trying to tokenize a string. Given a string I want this method to return the output as words. The words have to be words that do not contain superfluous or redundant punctuation that do not add meaning to the word, excluding syle and sacasm. This string may not be well formed, and so, may include edge cases like "awesome!!!", "what??", or "Bye.". To deal with this, i'm trying to see if regular expression will do the job. My problem, here, is that the replaceAll method puzzles me to death. It absolutely does not seem to have an affect on the output. Can you help? Thanks.

2 days ago

Campbell Ritchie wrote:Don't know. Please give us some more details about the code in question.



Here I seek to provide you more information about my problem.

This is a link to the method in question
https://developers.google.com/resources/api-libraries/documentation/youtube/v3/java/latest/com/google/api/services/youtube/model/CommentThread.html#getReplies()
link

I tested it on this video: https://www.youtube.com/watch?v=m4Jtj2lCMAA

Initially, I could not get all the comments, but as, Rob Spoor, stated it returned them in pages, and I soon figured that out. However, on one of the top level comments who replies were copious, it become apparent what the term "limited", stated by the documentation meant. No easy solution as revealed itself to me. I'm wondering what reason they have to limit the replies. Maybe its storage, but then again they are Google, so should have no problem with that!
Why does getReplies() in CommentThread return only a limited number of replies? At first i didn't really understand, but having tested it, it doesn't return all the replies, and I guess that what it meant. Is there anyway to get all the replies?

Tim Moores wrote:It sounds like you're looking for a client-side HTTP proxy with filtering capabilities. http://paw-project.sourceforge.net/ is one such (very old) project; you are bound to find more if you search for something like "java http filtering proxy".


Thanks, i'll update you on my research.
2 weeks ago
Hi everyone,

I'm interested in making a java program that can filter incoming traffic to a computer. I know that is a crucial part, but I've tried, several searches, but the results are just not suited to what a i'm looking for, at least to my own knowledge. So, i'm obliged to ask you guys if you know where to get started. In particular, is there a way to intercept network traffics as it enters my endpoint. Maybe an API? Thanks.
2 weeks ago
Due to the expensiveness of upgrading legacy code bases, there are still way more projects that still use versions of Java older that version 8. I bet it will still be relevant for sometime. The versions are just updates that provide new features, but there is nothing that prohibits a developer from using older versions. Besides like I said, they are just extensions. If you know Java 1, than you would probably know a good chunk of version 8 already, and it only gets higher the more recent the version.
Hi everyone.

I don't think there is a hobby that is more enriching for one's mind than reading,a hobby that many people neglect in favor of video games and the Internet. Of course, reading material in your own field is beneficial, but if you want to have a broader view of the world than you should read all sorts of books. If we all read a little more we can, someday, eradicate ignorance and create a world with a brighter future.

Reading takes care of the mind, but one still has the body to tend to as well. There are many ways to tend to the body, but I personally decided upon bodybuilding for not only do you obtain health but you also obtain a body worth envying. One of the foundations of a successful life, besides a good mind, is health.

These two are my 'pinned' hobbies, as they hold a nearly indelible place in my schedules. They are pretty much a law to me. After these, I don't really have one that I am actively pursuing. Some former hobbies are juggling and video games.
1 month ago