NIToolBarPhotoViewController to display images from a selected image - image-gallery

I am using Nimbus to display photos. I have a tableviewcontroller displaying list of filenames. When the user select particular file (if an image) , it displays all the image files in viewcontroller extended from NIToolBarPhotoViewController starting fromt the first element of my photo source array i.e. photoFiles which is the first element in list.
I am returning the total count for scrollview pages like this:
- (NSInteger)numberOfPagesInPagingScrollView:(NIPhotoAlbumScrollView *)photoScrollView {
return self.photoFiles.count;
}
However, I am unable to launch the photoview from a particular index as the method:
- (UIImage *)photoAlbumScrollView: (NIPhotoAlbumScrollView *)photoAlbumScrollView
photoAtIndex: (NSInteger)photoIndex
photoSize: (NIPhotoScrollViewPhotoSize *)photoSize
isLoading: (BOOL *)isLoading
originalPhotoDimensions: (CGSize *)originalPhotoDimensions
gets called directly as per the example NetworkPhotoAlbumViewController. How can I get it to take the particular index before launch the photoview?

in viewDidLoad add this line
[self.photoAlbumView setCenterPageIndex:photoIndex];
to set index of displayed photo

Related

How to show and update current page number in an input box palceholder Using Tabulator

I am trying to show the current page number in an input box as a place holder the issue is I can't figure out how to update the value when users go to another page.
Here is what I tried:
<input id="currentPage"/>
document.getElementById("currentPage").placeholder = tabulator_table.getPage();
Here is the first part of the question
Here is sample
You want to use the pageLoaded callback on the table instance.
When creating the table, you need to add a property for pageLoaded as a function with a parameter for the page number. This callback is triggered each time the page is loaded.
Here is a working example, https://jsfiddle.net/nrayburn/w68d75Lq/1/.
So you would do something like this, where #table is the element id for the table and input is a reference to your input element where you keep the page number value.
new Tabulator('#table', {
...tableOptions,
pageLoaded: (pageNumber) => {
input.value = pageNumber
}
});

how to use selenium python to open new chat whatsapp (i need to target the second icon New Chat)

I need to target the second icon New Chat but they have the same class name
from selenium import webdriver
driver = webdriver.Chrome('C:/Users/ka-my/AppData/Local/Programs/Python/Python37-32/chromedriver')
driver.get('https://web.whatsapp.com/')
input('Enter anything after scanning QR code')
user1 = driver.find_element_by_class_name('_3j8Pd')
user1.click()
1.i need to target the second icon New Chat
just like Facebook and google the class names are dynamically generated So the best way around that is to look for something constant which is the icon string
new_chat = driver.find_elements_by_xpath('//div[#title="New chat"]') # return a list
if new_chat:
new_chat[0].click()
To get 2nd icon in new chat, you can use this:
# get the 2nd element in the list
second_icon = driver.find_elements_by_xpath("//div[#class='_3j8Pd']")[1]
Or:
# get the 2nd element in the list
second_icon = driver.find_elements_by_xpath("//div[#class='_3j8Pd'][2]")
In first example, we are getting a list of all the div elements, and picking the 2nd item using the [1] index. In second example, we are using element index in XPath [2] to get the second element in the list. List index is 0-based and XPath element index is 1-based, so that is why we see 1 and 2 here.

Appcelerator adding elements before and after specific elements

Using appcelerator, how do you go about inserting elements before and after specific elements. Such as
<View id='element'>Some Content</View>
Using $.element.add() the new element will be inside it but i need it to go either before or after. In simple terms is there an equivalent to .before and.after in jQuery?
Many thanks
You can use the method insertAt (docs).
If the parent view's layout is horizontal or vertial, then you'll see the children views displayed according to their array positions.
There are 2 workarounds for insert elements before the actual views:
Save the $.elements.children in a array, and unshift the new elements to the array, and add all those views in array to the $.elements;
While you adding the views, set the left or top property (depending on your design), and every time you add a new child, run a loop of the children and increase their left or top property; ex (child views with 200):
$.elements.children[0].left = 0;
$.elements.children[1].left = 200;
$.elements.children[2].left = 400;

XPages getRowCount() giving wrong number based on entries displayed

var component = getComponent("dvwContent");
return component.getRowCount() + " documents have been found";
If I'm placing this code into a computed value outside of a filtered dynamic view (referred to by "dvwContent"), it should return me the number of entries found, referring to this question & answer: Count entries in XPages view
If the number of hits exceeds the page display limit, it is giving me the number of filled rows on the page + 2. So if I display 25 lines per page, it tells me that "27 documents have been found" (if I display 50 docs, it tells me 52) - even if there are a lot more pages. It works correctly if there are less hits than the page display limit.
Does anybody have a solution for displaying/counting the correct number of hits?
As Stefan mentioned in his comment .getRowCount() refers to the rows visible on the page. From what I get you're interested in the entries of the view rather than the rows shown by the redering component.
One option that comes to my mind would be to access the viewEntryCollection object through the Domino view in question and then get the entry count from that:
var vw=database.getView("dvwContent");
var filter=["someFilter"];
var vec=vw.getAllEntriesByKey(filter, true);
return vec.getCount().toString() + " documents have been found";

How to create a LWUIT List screen in j2me?

i want to create a lwuit list screeen ,the list items are coming to my method from Rss Feed in a loop continuosly,but i am able to append 1 title from rss feed and able to display on device,after that 2,3,4,etcc...items are changing ,but finally,i am able to display 1 title and last title only,here is my code:
//method called by the parsing thread
public void addNews(News newsItem,Vector news) {
String newsArray[]={newsItem.getTitle()};
myNewsList = new List(newsArray);
System.out.println(newsItem.getTitle());//Here i am able to display,second title after that,it is not appending adding to myNewsList
//myNewsList.addItem(newsItem.getTitle());
form1.addComponent(myNewsList);
form1.show();
}
Can you help?
You need to read up about using Lists and the model in LWUIT. When using addItem you should invoke it from the EDT using LWUIT's callSerially method.
Regardless, calling addItem one by one is VERY slow. You should use a model to represent your data, see the makeover demo.

Resources