Kirill Varivoda

Greenhorn
+ Follow
since Aug 25, 2014
Kirill likes ...
Eclipse IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kirill Varivoda

Karthik Shiraly wrote:Wordpress exposes an XML based API to post blogs or comments. This is inbuilt and does not need any plugins to support it.
A JSON interface would require some kind of 3rd party plugin (I had a quick look in Wordpress 4 source code, and I could find no inbuilt JSON API).

If XML is ok with you, then I can give you information on how to do so from Java, since I've written a java desktop application for my own use that does exactly that.



Actually in my blog there is a Json plugin but if you can share how to do without it, it would be good!
9 years ago
Ibrahim Yener, thank you! I'll try that.
9 years ago

Paul Clapham wrote:Well, there's a WordPress app for Android so it must be possible. I don't know if it has a published API though.

I also haven't tried the app.



Oh, there is. There is a source code too, but it's really messy as for beginner.
9 years ago
Hi, guys. Is there is a way to post comments (or even posts) in Wordpress blog using Json, for example?
Now I know how to retrieve data using json, but not to post.

Can't find any useful example.
9 years ago

Brian McGowan wrote:I'm currently using jsoup to parse a HTML document. I've loaded it into a Document by using



This in itself returns three elements in the ele list
<li class="second-col"> <label for="ctl00_Content_ctl00_ddlAirline" id="ctl00_Content_ctl00_lblAirline">Airline</label> <select name="ctl00$Content$ctl00$ddlAirline" id="ctl00_Content_ctl00_ddlAirline"> <option selected="selected" value="">Any</option> <option value=""></option> <option value="Aer Lingus">Aer Lingus</option> <option value="Air Canada Aca">Air Canada Aca</option>...............

and so on.

I'm looking to select the first element of the list, and parse the <option value> into an ArrayList<String>.

Anyone know how I can do this?



You need something like this?

Look at jsoup manual, maybe you can find something.
http://jsoup.org/cookbook/extracting-data/attributes-text-html

chris webster wrote:Remember you can use a WHERE clause to include/exclude the records you count. Try "WHERE ... IS NOT NULL".



Oh, finally! I did it. With this stuff I count what I need, it seems:

chris webster wrote:Remember you can use a WHERE clause to include/exclude the records you count. Try "WHERE ... IS NOT NULL".



Thanks for pointing out. Actually this worked:

So this is solved, but I still do not know how NOT to count empty values.

Although I tried to avoid it but I still do not know why # appears in my table. As I understand from output it means that I have empty values. I set Default value (while creating a table) as null but I still got this.
So, I've got a table like this


So I either do so that sql will not count empty values or make impossible for empty value to appear in my table.

This is the key code for saving data to the talbe. allInnerLinks - this is the second column, which I need to count afterwards). Probably here I've made a mistake. Instead of # should be null.


Appreciate for any help!

chris webster wrote:You can use the SQL aggregate function COUNT with a GROUP BY clause, plus a WHERE clause to restrict the search to the URLs you are interested in. More generally, you need to learn some SQL if you are going to work with databases. SQL is immensely powerful and flexible and is designed for relational databases. Learn how to use the right tool for the job and you will find it much easier to achieve your goals.



Thanks for advice. I've found a solution.

I have another problem. How NOT to count Null and Emtpy values?

I tried to add into the query "having externalUrl not null" but it doesn't work.

The error is:
I'm working with embedded Derby and I'm new in databases.
I have a table SaveSites in a database like this:



I need to count all INNERURL for http://hostingmaks.com/ and all INNERURL for http://hostingmaks.com/category/news/

So result should be like this:
http://hostingmaks.com/ 3 INNERURL
http://hostingmaks.com/category/news/ 2 INNERURL

And finally save these results in another database.

Is there is a way to do it? I can't solve it yet.

Campbell Ritchie wrote:I think this would fit better in our databases forum: moving.

Why have you got so many static methods?



Ok. I don't know actually. Big part of this code was found on internet, I just use it.

Dave Tolls wrote:

Ron McLeod wrote:Take a look at this line and pay attention to the how you are quoting the string values:

stmt.execute("insert into " + tableName + " values (" + page + ",'" + inner + "','" + external + "')");



And then use a PreparedStatement...



Ok! I study what you've send. Thank you.

Ron McLeod wrote:Take a look at this line and pay attention to the how you are quoting the string values:

stmt.execute("insert into " + tableName + " values (" + page + ",'" + inner + "','" + external + "')");



Thank you! I've found a mistake:
stmt.execute("insert into " + tableName + " values ('" + page + "','" + inner + "','" + external + "')");

Ron McLeod wrote:Your database table is probably not getting created because inner is a reserved word - if you want to use it as a column name, you will need to enclose it in back-ticks.

stmt.execute("create table " + tableName + "(page varchar(2083), `inner` varchar(2083), external varchar(2083))");



Thanks for this, I changed a line



but now I got a new error.

Paul Clapham wrote:It would help if you posted both the error message and the code which caused the error message. As it stands now, we have to click on a link to an external site to find out that neither of those two are available. Post them both here, that would be easier both for you and for anybody interested in helping.



Ok, I've changed my post.

Guys, I want to save URL's in a table in a Derby database.

I'm using embedded derby in this code.
This is it:



Main Sql statement from above code:
"create table SITES(page varchar(2083), inner varchar(2083), external varchar(2083))"

But I got an error:


Maybe there is some other way?

My goal is to create page_URL and put INNER and EXTERNAL URL's associated with page_URL from my Java program to this table.
For example:
Column1: Main page URL.
Column2: inner URL's ,
Column3: external_URL's.
and so on for another URL.

I'm new to this.