Viewclient touch() is working as a long tap , it should work as click? - monkeyrunner

I am testing a Gallery application of android 4.0.3 using monkeyrunner with androidviewclient and when I am trying click on any album with touch() function of AVC it is selecting the album . It should open a album.
My code for opening a album is
MonkeyRunner.sleep(3)
vc=ViewClient(device,serialNo)
firstAlbum = vc.findViewById('id/no_id/1')
firstAlbum.touch(MonkeyDevice.DOWN_AND_UP)
please let me know if i am doing something wrong?

It's very unlikely that your album has uniqueId 'id/no_id/1'. You can verify it using dump.py. If I run dump.py --uniqueId on 4.0.3 Gallery I obtain
com.android.internal.policy.impl.PhoneWindow$DecorView NO_ID None id/no_id/1
android.widget.LinearLayout NO_ID None id/no_id/2
android.view.ViewStub id/action_mode_bar_stub None id/action_mode_bar_stub
android.widget.FrameLayout NO_ID None id/no_id/3
android.widget.TextView id/title Gallery id/title
android.widget.FrameLayout id/content None id/content
android.widget.RelativeLayout id/root None id/root
android.widget.GridView id/albums None id/albums
android.widget.LinearLayout NO_ID None id/no_id/4
com.android.camera.GalleryPickerItem id/thumbnail None id/thumbnail
android.widget.TextView id/title All pictures (3) id/title/1
android.widget.LinearLayout NO_ID None id/no_id/5
com.android.camera.GalleryPickerItem id/thumbnail None id/thumbnail/1
android.widget.TextView id/title Download (3) id/title/2
so, I guess you want the first album, then I would use:
vc = ViewClient(*ViewClient.connectToDeviceOrExit())
firstAlbum = vc.findViewWithTextOrRaise(re.compile('All pictures \(\d+\)'))
firstAlbum.touch()
or (as oneliner):
ViewClient(*ViewClient.connectToDeviceOrExit()).findViewWithTextOrRaise(re.compile('All pictures \(\d+\)')).touch()
using a regular expression you can select the album, the one with All pictures title independently of the number of pictures listed in the title.

Related

Why WP creates multiple duplicated images for products from import

Setup:
WordPress 6.0
Template: Electro Version: 3.3.0
Plugin:
AllImport
In WP I have WooCommerce for shop and plugin AllImport for importing products from XML. With products we also import images. We noticed that we have spikes in disk usage at random points in time, for instance in uploads
2021/04 and then again in
2022/05
2022/07
Previous folders per month are usually around 300-500Mb, and in these folders size is around 2-3Gb.
Looking into files I noticed that the same file (image) is multiplied up to 300 times:
Example:
The filename is: 0001244766_505534_huge.jpg and from that thumbnail versions are generated, and what should be something like this:
0001244766_505534_huge-100x100.jpg
0001244766_505534_huge-1024x857.jpg
0001244766_505534_huge-300x300.jpg
0001244766_505534_huge-150x150.jpg
First set of numbers is product code, second is image variation (one product can have multiple images), and third is size (big, small, huge...), and last are dimensions for thumbnails that I expect WP creates.
and instead I get this:
0001244766_505534_huge-189-100x100.jpg
0001244766_505534_huge-19-1024x857.jpg
0001244766_505534_huge-190-1024x857.jpg
0001244766_505534_huge-190-300x300.jpg
0001244766_505534_huge-191-150x150.jpg
0001244766_505534_huge-192-100x100.jpg
0001244766_505534_huge-192-768x643.jpg
0001244766_505534_huge-193-300x251.jpg
0001244766_505534_huge-194-300x300.jpg
0001244766_505534_huge-195-768x643.jpg
0001244766_505534_huge-197-1024x857.jpg
0001244766_505534_huge-197-768x643.jpg
0001244766_505534_huge-199-100x100.jpg
0001244766_505534_huge-199-1024x857.jpg
0001244766_505534_huge-2-150x150.jpg
0001244766_505534_huge-2-768x643.jpg
0001244766_505534_huge-20-100x100.jpg
0001244766_505534_huge-20-300x251.jpg
0001244766_505534_huge-20-768x643.jpg
0001244766_505534_huge-200-300x251.jpg
0001244766_505534_huge-201-600x502.jpg
0001244766_505534_huge-202-300x251.jpg
0001244766_505534_huge-202-600x502.jpg
0001244766_505534_huge-203-1024x857.jpg
0001244766_505534_huge-203-600x502.jpg
0001244766_505534_huge-204-768x643.jpg
0001244766_505534_huge-205-150x150.jpg
0001244766_505534_huge-205-300x251.jpg
0001244766_505534_huge-206-150x150.jpg
0001244766_505534_huge-207-300x300.jpg
Notice that after "huge" comes incremental number while product code and variation repeat.
Can anyone explain why this is happening, or has anyone had experience with this before?

Atom editor - alt + tab?! Is it working?

I have a problem with the shortcut settings in Atom (Ubuntu 16.04). I'm looking for an option of switching between the tabs using "alt + tab". Somewhere I saw an info that it's already "packed in" but it's not true. So I've been told that I have to change the Keymap. I did it a couple of times using different instructions for example:
'body':
ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'
but it failed...I mean - it is working only as long as the tab with the Keymap is open!?! (I've saved it of course before closing!)
and it is not working when I use the tab option "Split left, right or down" to get double or more views at one time.
Does anyone from You know how to solve this?
Thanks in advance!
Paweł

MovableType: Is it possible to have an RSS that excludes two categories?

I have an RSS feed that should include any posts that do not have any of these attributes:
A tag "conferencebox"
A category "Appearances"
A category "Appearances_Archive"
That is... any one of those qualities means it shouldn't be in the RSS feed.
I tried this:
<MTEntries category="NOT Appearances AND NOT Appearances_Archive" tag="NOT #conferencebox" lastn="15">
but I get this error:
Publish error in template 'RSS': Error in <mtEntries> tag: You have an error in your 'category' attribute: NOT Appearances AND NOT Appearances_Archive
When I reduce it to:
<MTEntries category="NOT Appearances" tag="NOT #conferencebox" lastn="15">
it works as expected (I get the Appearances_Archive posts) but the others are excluded.
I've tried renaming the category so that it doesn't have a "_" in it, but that doesn't fix the problem.
If I change it to:
<MTEntries category="NOT Appearances AND NOT appearancesarchive" tag="NOT #conferencebox" lastn="15">
I don't get an error, but the RSS feed still includes the "appearancesarchive" posts.
This also doesn't get an error, but doesn't not produce an RSS feed as I want:
<MTEntries category="NOT (Appearances OR appearancesarchive)" tag="NOT #conferencebox" lastn="15">
I've tried various combinations of CamelCase, lowercase, with and without "_". No luck.
Versions: Movable Type Pro version 5.2.3 with: Community Pack 1.92, Professional Pack 1.72
Yes, this is possible, and I believe your first attempt should have worked.
One install I tested using 4.37. This works fine:
<mt:Entries lastn="10" categories="NOT Personal AND NOT Conversations">
Then I used a 5.2.6 Pro install to rename two categories and a tag to match yours. I changed the labels to match yours but made the basenames random characters to make sure it didn’t have to do with basenames. I was able to publish your exact snippet, and the returned entries seem as expected:
<MTEntries category="NOT Appearances AND NOT Appearances_Archive" tags="NOT #conferencebox" lastn="15">
<mt:EntryIfCategory><mt:EntryIfTagged><mt:EntryID> CATS: <mt:EntryCategories glue=","><mt:CategoryLabel></mt:EntryCategories> TAGS: <mt:EntryTags glue=","><mt:TagName></mt:EntryTags></mt:EntryIfTagged></mt:EntryIfCategory></mt:Entries>
I checked if 5.2.3 might be the problem, but I don’t think so. A diff of lib/MT/Template/Tags/Entry.pm between 5.2.3 and 5.2.6 shows no substantial changes:
➜ Projects git clone https://github.com/movabletype/movabletype.git
Cloning into 'movabletype'...
remote: Counting objects: 91433, done.
remote: Compressing objects: 100% (27561/27561), done.
remote: Total 91433 (delta 63969), reused 89691 (delta 62257)
Receiving objects: 100% (91433/91433), 41.49 MiB | 811 KiB/s, done.
Resolving deltas: 100% (63969/63969), done.
➜ Projects cd movabletype
➜ movabletype git:(master) git diff 122a610d87e8fcc95b3534970d3d2346b88f8256 master -- lib/MT/Template/Tags/Entry.pm > diff.txt
➜ movabletype git:(master) ✗ cat diff.txt
diff --git a/lib/MT/Template/Tags/Entry.pm b/lib/MT/Template/Tags/Entry.pm
index c431b1a..89d5caf 100644
--- a/lib/MT/Template/Tags/Entry.pm
+++ b/lib/MT/Template/Tags/Entry.pm
## -1,4 +1,4 ##
-# Movable Type (r) Open Source (C) 2001-2012 Six Apart, Ltd.
+# Movable Type (r) Open Source (C) 2001-2013 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
So I’m currently at a loss as to why you got the error, but I’m posting this as an answer because it answers the question in your title!
Could you provide a link to the text of the full template? Perhaps a list of any nonstandard plugins you might have installed?

Writing several texts which follows same link with reST

the following reST don't work as expected. How can I do it right?
Only the word python_ in this text is linked. What to do if
I want using other words such as `like it <python_>`_ to jump
to the same link?
.. _python: http://www.python.org
Thanks for any help!
mutetella
This isn't a really well documented as far as I have been able to read but the OP's method should work. I've tested the following input with rst2html.py (v 0.11) and Sphinx (v 1.2b1) on cygwin. Both generate the correct hyperlinks to the CNN site.
* According to `CNN <http://www.cnn.com/>`_ the economy...
* According to `The Amazing Cable News Network`_ the economy...
* According to the `Cable News Network <CNN_>`_ the economy...
.. _The Amazing Cable News Network: CNN_
.. CNN: http://www.cnn.com/
The second form was suggested by #Ajay, although it seems odd to me to have to create another alias to get the text you want, but the third form seems to be what the OP was looking for and as far as I can tell it works fine. The third form also works for internal links within the document.

Trying get the price of products with RCurl

Im scrapping the price of some products from a website . In Python I used the urllib2 without problems, but when I tried using RCurl in R I couldn't donwload the source code.
I have to paste the source code with the product code, then I catch the price. The path of a product is: http://www.americanas.com.br/produto/code_of_product.
Actually, I can't download the source code of a product with RCurl. When I try for example getURL('http://www.americanas.com.br/produto/111467594') it returns "".
I tried using getURL('.../produtos/111467594') and I could download the source, but in this way I'm unable to get the price. :(
Anyone know how could I get the price of the products?
Thanks.
Ps.: Sorry for my bad english. :)
welcome to StackOverflow.
It's hard to say for me why it doesn't work, could you include a verbose=TRUE in the getURL? Also, I notice there's different prices on the webpage you linked. You want all or just the first? How about this to get the "Por price":
library("stringr")
productwebpage<-readLines("http://www.americanas.com.br/produto/111467594")
pricerow<-productwebpage[grep("p class=\"sale price\"",productwebpage)]
price<-str_extract_all(pricerow,"\\(?[0-9,.]+\\)?")[[1]]
You could also substitute the grep("p class=\"sale price\"",productwebpage) to either grep("<p><span class=\"regular price\">",productwebpage) (to get the "de price" / old price) or grep("<span class=\"p-v interest\">",productwebpage) (which will give you the "sem jouros" price / per month payment). For the last example you will get the months first and the payment after so it will be:
> price
[1] "12" "83,25"
This should hopefully work for other products as well (just tried 5 and seemed to work for all of them).

Resources