How do I take a segment of a image and check if it exists? - sikuli

In Sikuli I have an image where I need to check if the 1/4 of the lower half exists and if it does, use a specific function. Right now I have:
if(image.exists())
click()
The issue with this though is the .exists will either hang the script or function incorrectly. I'm looking for a better way to do this or a solution to this problem. Any help would be appreciated
Example is there's an additional segment, so you have Select All in one version (where it ends) and then Time/Date in a newer version. Want to be able to select the additional option of Time/Date but through images.

This should be what you are looking for:
noteApp = App("notepad.exe")
click("editbutton-1.png")
region = Region(noteApp.focusedWindow())
print(region.text())
You can set the region.text() equal to the string you are looking for such as Date/Time and create a statement to run your function

Related

Google sheets importxml failure - Can't find the correct path to table from the link

I'm trying to retrieve a table which is updating twice per day. On other websites i was able to find the element but i saw that the way i see don't work on all websites where i tried.
In this case the issue is:
In google sheets using importxml, i can't find the correct path to table from the link or identify the element.
The website for this example is: http://lotopolonia.com/tabel/arhiva/index.php
1. I need to retrieve the dates and numbers.
2. They are updated twice per day and being updated in my sheet with adding just the last line at the top of the others. But this one after i solve the first one.
I looked at xpath tutorial from w3c and understood the syntax a bit.
The problem is how to identify correctly the elements and nodes in the inspector to retrieve the data i need.
Also, i've installed a chrome extension (XPath Helper) which shows xpath better that what i got from chrome.
I tried the following:
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[#class='colon2']")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row']/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//*[#class='table_01']/table/tbody/tr[#class='first_row'][1]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[3]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[*]/td[*]")
=IMPORTXML("http://lotopolonia.com/tabel/arhiva/index.php","//table[#class='table_01']/tbody/tr[#class='second_row'][1]/child::td[*]")
The formula looks ok, without errors, but at all above requests i get the same result: imported content is empty
Unfortunately i ran out of ideas and how to interpret that elements...
Any ideea how to go on?
Cheers
How about this answer? I used //table[#class='table_01']/tr[position()>2] as a xpath. "A1" has http://lotopolonia.com/tabel/arhiva/index.php.
=IMPORTXML(A1,"//table[#class='table_01']/tr[position()>2]")
Using table[#class='table_01'], retrieve the table.
Using tr[position()>2], retrieve the dates and numbers.
Result :
Note :
If you want to retrieve the whole table, please use =IMPORTXML(A1,"//table[#class='table_01']/tr").
If this was not what you want, I'm sorry.

Business Objects Generating Unexpected Query

I am having problem with BusinessObject Universum and the way it generates queries and consequently yielding the results.
Here is the background: mechanism that is functioning has already been implemented. I was trying to copy the SAME mechanism just to deliver a different field.
Here is the data model: http://tinypic.com/r/ng524g/8
The mechanism that functions is marked with BLUE color. The mechanism that I tried to implement and that is not functioning is marked with RED color.
On business layer I have defined a dimension with aggregate aware function. This function takes first VWF_Party_Collection_A.Collectionstatus_CD column (at the higher level). If a user selects an attribute from contract level, function takes VWF_Contract_Collection_A.Collectionstatus_CD column.
Problem is when I take all attributes from VWD_Kunde_A table and than add the dimension with the mentioned aggregate aware function (ie Collectionstatus_CD), the constructed query from BO side does not make any sense. Here it is:
SELECT
D_ATA_MV_FinanceTreasury.VWF_Party_Collection_A.Collectionstatus_CD,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Namespace_TXT,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Party_KEY,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Legacy_ID
FROM
D_ATA_MV_FinanceTreasury.VWD_Party_A
LEFT JOIN D_ATA_MV_FinanceTreasury.VWF_Party_Collection_A
ON D_ATA_MV_FinanceTreasury.VWD_Party_A.Party_KEY=D_ATA_MV_FinanceTreasury.VWF_Party_Collection_A.Party_KEY,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A
WHERE
(
D_ATA_MV_FinanceTreasury.VWD_Party_A.Party_KEY=D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Party_KEY )
AND
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Legacy_ID = 102241978
Please notice the strange conctruction in the 'FROM' part (comma has been added). Another strange and unexpected construction is in 'WHERE' part:
( D_ATA_MV_FinanceTreasury.VWD_Party_A.Party_KEY=D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Party_KEY )
The mechanism that is functioning is joining joins VWD_Kunde_A with VWF_Contract_Collection_A table and yields the correct result.
Now, I have tried to define a dimension without the mentioned aggregate aware function that contains only VWF_Contract_Collection_A.Collectionstatus_CD attribute. When I run the same query BO yields CORRECT results and it generates the CORRECT (expected) query.
This is the query I am expecting:
SELECT
D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A.Collectionstatus_CD,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Namespace_TXT,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Party_KEY,
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Legacy_ID
FROM
D_ATA_MV_FinanceTreasury.VWD_Kunde_A LEFT JOIN D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A ON D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Namespace_TXT = D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A.Namespace_TXT AND D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Party_KEY = D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A.Party_KEY AND D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Legacy_ID = D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A.Legacy_ID
WHERE
D_ATA_MV_FinanceTreasury.VWD_Kunde_A.Legacy_ID = 102241978
Furthermore, I suspected that it can something to do with contexts. However, I did not find any context for the mechanism that already functions and that I tried to copy. Therefore, I did not implement any context for the mechanisam I am tring to implement.
At this point I am clueless since I tried everything I knew. I would appreciate help.
Thanks!
A.
UPDATE: it seems as aggragate aware function is not functioning... This is how it is defined:
#Aggregate_Aware(D_ATA_MV_FinanceTreasury.VWF_Party_Collection_A.Collectionstatus_CD,D_ATA_MV_FinanceTreasury.VWF_Contract_Collection_A.Collectionstatus_CD)
(I just copied the code from Kreditklasse and adapted it... That makes me even more confused...)
UPDATE_2: it really seems as if aggragate aware is not functioning in my case because I selected all attributes from contract_context and it still jumps to party context. Very confused because THE SAME mechasism is functioning as expected when I select Kreditklasse...
Check the aggregate navigation.
Setting up Aggregate Awareness requires two steps (in addition to correctly defining the joins between the tables, of course):
Define the objects with the Aggregate_Aware function
Set table-object incompatibilities through Actions > Set Aggregate Navigation.
It sounds like the second part is not properly configured: make sure that any objects which require the second table are marked incompatible with the first.

MySQL Full Text Search not returing all records

First time implementing Full Text Search...
I've run the necessary ALTER TABLE SQL to enable FULLTEXT on the applicable tables/fields.
On the following beta site: http://wtc.betaforming.com/
If I do a search for "leadership", I get normal results except for the Events section at the bottom. I have Events with that word in the event title and throughout the description copy (http://wtc.betaforming.com/events/event/?event_id=10039).
If I do a search for "communications", I get results in the Events section, which makes me think I have everything configured correctly.
I'm using the following basic code for testing purposes:
SELECT *
FROM tblevents
WHERE MATCH(event_title, event_desc_long, event_desc_short, event_tab_one_title, event_tab_one_text, event_tab_two_title, event_tab_two_text, event_tab_three_title, event_tab_three_text, event_tab_four_title, event_tab_four_text) AGAINST ('$site_search_term')
This is the same code I'm using to search Products and Articles (changing the necessary FROM and WHERE information).
Not sure what is happening (since it works for some phrases) or where to start looking in my db to see what is wrong.
Thanks
Brett
The answer to my question can be found here:
http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html
My search term was over the 50% threshold - you have to read all the way to the bottom to find this.
I've implemented the "IN BOOLEAN MODE" for my events search and everything appears to be working correctly. I also used this article for help:
http://devzone.zend.com/26/using-mysql-full-text-searching/

MySQL Spatial Within function gives errors

I have a table of areas which has an AREA_ID column and an AREA column which is a Polygon type.
I am running the following query but I cannot seem to get it to work:
SELECT AREA_ID, AsText(AREA)
FROM networkmodel.sit_area
WHERE Within(AREA, Polygon((
50.913424 -1.420527,
50.915805 -1.391516,
50.898053 -1.390142,
50.895021 -1.428251,
50.913424 -1.420527)))
This query gives me an "Operand should contain 1 column" error.
If I put one less set of brackets around my coordinates I get an "Illegal non geometric '(50.913424 -1.420527)' value found during parsing" error instead. Are my coordinates the wrong format?
I am aware from the MySQL documentation that the Within function has not been implemented properly and falls back to the MBR implementation instead but I am just testing it out at the moment. I have used the Contains function in the past with success to return me records in a similar way by using a Point as the second parameter instead of a polygon and this is supposed to be the opposite of that.
It is my understanding from the documentation that this function takes two parameters and checks whether the first (my areas column in this case) falls within the given Polygon.
Any help is appreciated thanks.
Right I made it work now, Instead of using this function I had to change the Polygon declaration to:
GeomFromText('Polygon((50.913424 -1.420527, 50.915805 -1.391516, 50.898053 -1.390142, 50.895021 -1.428251, 50.913424 -1.420527))')

HTML Search Function

I need a search function for on an intranet , can I do this purely in HTML ? and if so could you possibly point me in the right direction , I tried googeling it but it came up with searching via search engines.
Cheers
EDIT: I only need it to search for text on 1 page , its not a whole website , just one page.
You will need some server-side scripting in order to provide the directory listings.
I recommend using PHP's glob function recursively, but there might be a better option.
Edit:
For one page, using JavaScript, you could get the contents of all of the elements, and use regex or indexOf to determine if the string exists within the text, and if so, where.
If you are to use the indexOf function, as the function only returns the index of the first occurrence of the string, you will need to repeat the search until you've gathered all occurrences.
You may specify the start parameter to snip the front of the searching area, to begin the new search after your last found occurrence.