Using ContainerList with ImageDownloadService - java-me

I was referring to this code here. This suffices my need but I need to display the contents in 2 columns instead of 1. Hence, I thought of using a ContainerList with grid layout. The problem here is that the boolean initListModel(List cmp) is not getting called for the containerList.
I also tried to dynamically add the ContainerList but am having problems while using it with ImageDownloadService, the way it was used in case of List. It would be great if anyone could provide me with any sample code to get along

Related

Flexible column layout does not work when Two Way binding

My app has a flexible column layout with the list report displayed initially, and then switch to two columns when I click on an entry in the list report. This works fine so far with one way binding with backend model. But when I switch to two way binding then the click on entry does not show the second column. I am using the following code to switch the layout to two-column.
this.byId("flexibleColumnLayout").setLayout(sLayout);
Inside the setLayout() , I see some code that speaks about two-way binding. I am not an expert though to understand that level.
Anyone has fixed such an encounter? Appreciate your help. Thanks...
this.byId("flexibleColumnLayout").setLayout(sLayout);
This is resovled. The setLayout method is triggering some code where is going through some two way binding check and did try property binding checking against backend model, which is not correct. Instead binding the control to local json model did work. Thank you all!

Accessing Area.Name Throws Error

I'm just trying to find a way to access the name property of an Area element inside Revit Python Shell, tried looking on Jeremy Tammik's amazingly informative blog, tried AUGI, Revit API docs, been looking for 2 days now...
Tried accessing via a bunch of ways, FilteredElementsCollector(doc).OfCategory(BuiltInCategory.OST_Areas), tried by Area class, tried through AreaTag, every single time I get an error under every circumstance and it's driving me nuts, it seems like such a simple issue that I can't seem to grasp!
EDIT: Also tried by element id, through tags, through area schemes, nada, no go...
Can anyone please tell me how to access this property via RPS?
I would say two things:
areaObject.LookupParameter("Name")
areaObject.GetParameters("Name")
...are valid methods. Please notice how I used GetParameters() NOT GetParameter(). There are some drawbacks to using either one of the two. The lookup method will return FIRST parameter that matches the name which in many cases might be a different parameter for different elements. It's not very reliable.
GetParameters() method will return them all if there are multiple so then you have to deal with a List<Parameter> rather than a single object that you can extract your value from.
I would personally recommend to use areaObject.get_Parameter(BuiltInParameter.ROOM_NAME) method to extract a Name value from Area object. The BuiltInParameter always points at the same parameter, and will reliably return just that one parameter. Here's a little more details about these methods:
http://www.revitapidocs.com/2018/4400b9f8-3787-0947-5113-2522ff5e5de2.htm
To answer my own question, I actually never thought of looking through the code of other Revit Python scripts... in this case of PyRevit, which is in my opinion far more eloquently written than RPS, raelly looking forward for their console work to be done!
Basically, I had mistakenly used GetParameter('parameter') instead of LookupParameter('parameter').
As I said, it was something stupidly simple that I just didn't understand.
If anyone has sufficient knowledge to coherently clarify this, please do answer!
Many thanks!
Maybe your issue is the same as this one ? :
https://groups.google.com/forum/#!searchin/RevitPythonShell/name|sort:relevance/revitpythonshell/uaxB1FLXG80/sdJNrTfoPuUJ
Your_Area.Name # throws error
Element.Name.GetValue(Your_Area) # works great

Python - Two Classes's Variables Are Linked

I noticed this problem in something I was making, and managed to reproduce it in a simpler form.
The problem is that I have two players - both of a Person class - and they each have their own grid. I start off with a global grid variable and assign each Person's grid to that global variable. However, when I change one Person's grid, the other Person's grid changes, too!
Here's the code and output:
Anyone have any suggestions as to why this happens?
EDIT:
I tried the list() suggestion. This worked in one program, but in my main program it didn't do anything.
Players[1].Grid = list(Grid)
Players[0].Grid = list(Grid)
This outputs the same thing when I changed on of the lists.
You're sharing the grid between both objects, so when you change it, they both see it. If you want each to have a copy of it, use list() to make a copy of it.
People[a].grid = list(Grid)
Although Scovetta's answer did work for the example I provided, the code in which I found the problem actually used a 2-Dimensional list, rather than the 1-Dimensional one in the sample.
I have found out from here that more complex objects need
copy.deepcopy
to copy everything, without being just a reference to the old variable.

Correct way to override content being displayed?

I want to enable the use of codes inside of content on a Drupal website. For example, when creating a block or a node, i want users to be able to insert code like this:
[[EMAIL]]
Depending on what the current language is, it might display a different value. The tricky part is not retrieving the value I want to replace it with, but figuring out at what point I replace it?
What hook or function would I use, to replace any node content that has the specific code in it, with another value? And the same for a block or any other content that is going to be displayed?
I solved this by creating my own input filter. I copied this example.

GPUImageHistogramFilter with GPUImageFilterPipeline

I am using GPUImage in my photo app to make some image filter options. In the app, there is an option to add multiple filters while capture an image, so to handle multiple filters, I have used GPUImageFilterPipeline. Every filter effect, those I have added, works well on pipeline except GPUImageHistogramFilter. I know that GPUImageHistogramFilter need more steps when compare to other filters(as mentioned here). But this is not working on pipeline. How to make histogram with GPUImageFilterPipeline?
A GPUImageHistogramFilter doesn't operate like a normal filter, and you can't use its output directly. It sends out a 3x256 texture containing the RGB channel histogram, but you need some way of parsing that for display. You won't be able to set that up in a GPUImageFilterPipeline construct.
Instead, you'll want to set up your filter pipeline manually, following the example provided in the FilterShowcase sample application (or my steps in the answer you link above). I use a histogram generator to create the overlay you see in the example there, and there's no easy way to set that up with a GPUImageFilterPipeline.
Also, I'd personally recommend not using the GPUImageFilterPipeline, since I don't maintain that class. It was contributed by a couple of other people, but I don't use it for anything myself and it has a tendency to break. I'd instead just create your filter chain yourself or place things within a GPUImageFilterGroup if you need to organize filter subunits.

Resources