Using qualityOfService instead of threadPriority iOS - ios8

As we know, the threadPriority property of NSOperation is deprecated iOS 8 onwards and it is recommended that we use qualityOfService instead. Since threadPriority was a double type it could be assigned any value from 0 to 1. But qualityOfService conforms to certain discrete values. I am using a third party class named PDFThumbCache/(now known as ReaderThumbCache) which sets threadPriority like this:
[thumbFetch setThreadPriority:(priority ? 0.55 : 0.35)];
where priority is boolean type variable. The link to the .m file on GitHub is: https://github.com/SopJS/cordova-plugin-pdf-viewer/blob/master/src/ios/ReaderThumbCache.m. This class caches thumbnail images to be shown for different PDF pages. In terms of qualityOfService, what should the above statement transform to? I am trying something like this right now:
thumbFetch.qualityOfService = (priority ? NSOperationQualityOfServiceUserInteractive:
NSOperationQualityOfServiceBackground);
Is this the right way to do it?

Related

How to link Dynpro screen elements to program variables?

I am trying to use the elements I made in Screen Painter in my source code but I am not quite sure how to link them. Can you provide steps how I can link my elements in Screen Painter with ABAP variables?
The connection is established via the name.
If you declare a variable in your report like this:
DATA foo TYPE c.
Then you can view it on your screen by adding a field called foo.
A useful feature of the screen painter is choosing dictionary/program fields. You can access it by pressing F6.
The reference is made by the name of global variables.
You may - as already mentioned - use a DATA matnr TYPE MATNR. to create a global variable matnr.
If you use DDIC-structures or tables you may also define them as
TABLES: MARA.
In screen painter you can reference the fields of the table/structure MARA.
(You can replace MARA with any table/structure).
Depending on the complexity of your program you may define your own structure, just as a interface between the report code and the screen-painter.
The variables used in screen painter should be declared in a TOP in order to be accessed from the includes in the program.
For example, in my screen I request for a Business Partner name and map it to GT_NAME. GT_NAME should be declared in the TOP with something like the code below:
DATA: GT_NAME type bu_first.
That automatically creates the link between the global variables and the input parameters in the screen.

Is it possible to instruct a `Gtk::TreeView` to display a custom type?

There is something I don't understand how to do with Gtkmm 3.
I have a custom business type that I have declared like this:
enum class Eurocents : int {};
I would like to render this type into a Gtk::TreeView which has a Gtk::ListStore as model. So I declare a Gtk::TreeModelColumn<Eurocents>, and add it to the model. I then append_column this model column to the Gtk::TreeView with an appropriate title.
I then append_row to the model and set the value corresponding to the column to (Eurocents)100.
The result I get is that the cell is displayed empty. Understandably so, because I would not expect Gtkmm to know how to render my arbitrary type.
I would like to instruct Gtkmm on how to render my type.
I already know how to display Glib types like Glib::ustring and formatting to Glib::ustring for display is possible, but it is not the subject of the question.
Is it possible to code columns that can display arbitrary types like this? And if so, how? What is required for sorting to work?
The most common, and easiest way, is to use a cell_data_func callback. For instance, you can create your own instance of a Gtk::TreeView::Column (the view column), pack a cell renderer (or more) into your Gtk::TreeView::Column, append your Gtk::TreeView::Column to the TreeView with Gtk::TreeView::append_column(), and call set_cell_data_func() on your Gtk::TreeView::Column():
https://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeViewColumn.html#a3469e1adf42e5932ea123ec33e4ce4e1
You callback would then get the value(s) from the model and set the appropriate values of the properties of the renderer(s).
Here is an example that shows the use of set_cell_data_func(), as well as showing other stuff:
https://developer.gnome.org/gtkmm-tutorial/stable/sec-treeview-examples.html.en#sec-editable-cells-example
This link should also be useful:
https://developer.gnome.org/gtkmm-tutorial/stable/sec-treeview.html.en#treeview-cellrenderer-details
If you like, Gtk::TreeView::insert_column_with_data_func() makes this a little more concise: https://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeView.html#a595dcc0b503a7c1004c296b82c51ac54
As for the sorting, you should be able to just call set_sort_func() to specify how the column is sorted: https://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeSortable.html#a3a6454bd0a285324c71edb73e403cb1c
Then this regular sorting advice should apply: https://developer.gnome.org/gtkmm-tutorial/stable/sec-treeview-sort.html.en

Epi server - make content area specific for block

I would like to achieve the following thing-
Build a pagetype which has 3 different ContentArea's and that the user can put only a specific block type in each of these areas.
For example - ContentArea1 can only accept block type of "BlockType1", ContentArea2 can only accept "BlockType2" and so on. (It doesn't need to be generic, I can specify hard coded which type should fit in each Content Area.
Is it possible to achieve?
Maybe there is another way?
(I know you can create a property with the block type, but I want to use the same block in different places)
ps: using EPI-SERVER 8
From version 8.0 of EPiServer there is better support for AllowedTypes.
The feature was also available before version 8, but was more limited.
In short, you decorate your ContentArea property with the AllowedTypes attribute and EPiServer takes care of the rest.
Read more about it here:
http://world.episerver.com/blogs/Ben-McKernan/Dates/2015/2/the-new-and-improved-allowed-types/

How to bind a LabelMorph/TextMorph to a variable so that the Morph reflects changes of the variable?

I have an object with a variable containing a String.
I have a window containing a LabelMorph/TextMorph (or some other Morph that displays Text?).
How do i bind the LabelMorph/TextMorph to the variable, so that the label updates when the String in the variable changes?
classic Smalltalk-80 dependent/change/update mechanism?
Pharo Announcement framework?
something different??
How would i do this? Which Morph should i use?
Simplest is to use an updating String morph:
UpdatingStringMorph on: self selector: #myLabel
This will send #myLabel (or any other message) to self (or any other object) and display it.
This is a solution provided by Benjamin Van Ryseghem on the Pharo Mailinglist:
For this kind of situation, my solution is to use a ValueHolder.
Instead of storing your string directly in an instance variable, store
it into the ValueHolder.
I tried this in a Workspace:
|string label|
string := 'Wait till i change..' asValueHolder.
label := LabelMorph contents: string contents.
string whenChangedDo: [:newValue | label contents: newValue ].
label openInWindow.
[ 5 seconds asDelay wait. string value: 'I changed :)' ] fork.
Depends on what you want to achieve.
You might want to take a look at a way to do it with Glamour in a current Moose image.
In a workspace, do-it:
GLMBasicExamples new magritte openOn: GLMMagrittePersonExample sampleData
That shows how to work with announcements on save. The earlier examples are a better way to start understanding how to work with Glamour (and because of the way the examplebrowser is build, the Magritte example doesn't update the list when it is nested):
GLMBasicExamples open
That has several other examples that update on change.

OS X Data file editor saving to XML: Document based or not?

So I'm trying to make a data editor for an iOS/Android app I've got. There's 3 separate data files that I'd like to be able to edit, and I would like to save them to plist files or xml files. I'm planning on using Core Data in the app. The problems I'm running into:
1). Should this be a Document-Based Application or not?
2). If so, how would I set it up to allow editing of 3 different structures of files?
3). And if so, how would I go about setting the document based app to use regular plist/xml files as the file type instead of some custom file type?
The plan is for the editor to be able to open up and edit the files, and then the saved files can be copied into the project resources of the iOS and Android apps.
1. Should the app be document-based?
Yes.
2. How would one allow editing three different structures of files?
Choose from any of the following:
Create three dictionaries in the document types list, all three of which reference the same document class.
The same as above, but with windowNibName or makeWindowControllers choosing the UI depending on the document type. In other words, shared model code, but different view hierarchies. (I probably would choose either of the alternatives instead.)
Create three document type dictionaries, each of which has its own document class.
Which one you choose will depend on just how different the types are.
You'll probably want to export a UTI for each document type, as well. Xcode will not help you there; you'll need to write each UTI dictionary by hand.
3. How would I set the document based app to use regular plist/xml files as the file type instead of some custom file type?
If you export one or more UTIs, you should set the parent UTI(s) of each UTI appropriately, but that's advisory; all it means is you'll be able to open the documents with generic plist or XML editors/viewers.
Reading in and writing out the data is up to you, in each document class. You will have to use NSPropertyListSerialization, NSXMLParser, PRHXMLParser, NSXMLDocument, or something else, as you see fit; NSDocument does not handle your file format for you.

Resources