What do I need for CellRange to be recognized (Aspose Cells)? - aspose

I need to define a range of cells using Aspose. I found the following example here:
CellRange range = new CellRange(6, 1, 6, 4);
However, with this code:
using Aspose.Cells;
. . .
CellRange unitNameRange = locationWorksheet.Cells[1, 1, 1, 4];
...I get, "Cannot resolve symbol 'CellRange'"
Why not? What am I missing? The project has a reference to Aspose.Cells, Runtime Version 4.0.30319, Version 16.11.0.0

Yes, you got it right. Actually you were using CellRange class which resides in Aspose.Cells.GridDesktop control's APIs (Aspose.Cells.GridDesktop is an independent windows based (desktop) .NET grid control which is used to simply display, manipulate or save/re-save Excel files in WYSIWYG (visual) manner there are some other useful features which are supported too). You should be using Range object and use Worksheet.Cells.CreateRange() method instead for your needs.
I am working as Support developer/ Evangelist at Aspose.

From here:
...I see that that other link was misleading (used for a different purpose/in different circumstances); this is the way to do it:
Range unitNameRange = locationWorksheet.Cells.CreateRange("A1", "A4");

Related

Implement custom Postgres index as extension

I was wondering if it is possible to implement a custom index as a postgres extension? I tried to find an answer via Google, but was not very successful (mainly because of the ambiguity of the search query).
Maybe someone has already implemented a custom index and can point me to some literature or code.
According to the documentation:
The core system knows nothing about indexes beyond what is specified here, so it is possible to develop entirely new index types by writing add-on code.
To add a new index method, you create a new index access method.
An example of that is available as the “contrib” module bloom, which implements Bloom filters as a PostgreSQL index type. The source code of that module will server as guidance how to create your own index access method.

MURA CMS: how to add a page programmatically

So, what can I say? How do I go about adding a page programmatically in MURA CMS? Preferably version 6.1.
I am building a plugin that needs to create a couple of pages in the Site Manager. I want to add this routine in the 'install' method of the 'plugin/plugin.cfc' component.
I have been unable to find any pointers to this on line, which, perhaps, means this particular issue cannot be resolved. But, I live in hope.
Thanks people, in advance, for any help on this one.
When you add content to Mura, the key is that you'll need to know the parentid of where you wish the new content item(s) to live. Other than that, Mura offers an easy way perform CRUD operations on content items. You can read more about it at http://docs.getmura.com/v6/back-end/base-mura-objects-beans/loading-beans/ (based on the version you've specified). I'd also like to point out that the documentation has been greatly expanded in the latest version which can be found at http://docs.getmura.com/v7/mura-developers/mura-beans-objects/common-bean-objects/content-bean/. While the concepts and syntax still apply to older version, some newer methods for working with Mura content objects have been added since v6.1. I also highly recommend upgrading soon, as v7.1 is about to be released as well (as of Feb. 2018).
That said, the only two required fields/attributes are title and parentid. Here's the basic code for being able to do what you need:
// load the parent content item
parentBean = $.getBean('content').loadBy(title='Home');
// you may want to verify the `parentBean` actually exists before proceeding
if ( parentBean.getIsNew() ) {
Throw(message='parentBean does NOT exist!');
}
// v6.1 syntax
newBean = $.getBean('content')
.setValue('title', 'Some Title')
.setValue('parentid', parentBean.getContentID())
.save();
// v7.0+ syntax
newBean = $.getBean('content')
.set('title', 'Some Title')
.set('parentid', parentBean.get('contentid'))
.save();
// after saving, you can check for errors
if ( !StructIsEmpty(newBean.getErrors()) ) {
WriteDump(var=newBean.getErrors(), abort=true);
}
You could clearly set other attributes (as defined in the earlier links) as well, if desired.
Cheers!

Does Qt5 accept Numpy float64?

I'm making a QTableView based on a QStandardItemModel. I add data in the following fashion:
def addTableXYData(self,row):
label = 'Point '+str(row)
data = [label, self.x[row-1], self.y[row-1]]
for index, item in enumerate(data):
self.tableModel.setData(self.tableModel.index(row-1,index), item)
self.tableModel.layoutChanged.emit()
The strings for the label show up fine in the table, however it doesn't show the numbers. The numbers come from clicking points on a Matplotlib Qt Canvas, and are naturally numpy.float64 dtypes.
Is Qt5 capable of handling numpy.float64 datatypes? Or must I change it in to something else? I assume it may have something to do with PyQt5 using bindings to the C++ language, and maybe that can't handle it?
I've tried reading the docs on QVariant but it doesn't seem to tell me that I can't use floats.
Edit Instead of down-voting me without saying anything how about laying some wisdom on me and helping me out?
It turns out that PyQt5 does not possess the capability of sending numpy datatype classes to Qt5. It does native python classes like int(), float() etc. but not numpy.int32() etc. I assumed that would have been built-in functionality but, there ya go. The more you know.

GTK+ 3, C, C++ - Create button with stock image

I was reading the GTK+ 3 reference about the function gtk_button_new_from_stock. There is this part:
gtk_button_new_from_stock has been deprecated since version 3.10 and
should not be used in newly-written code. Use
gtk_button_new_with_label() instead.
Then, I read the reference about gtk_button_new_with_label(), but there is no word about the possibility of creating a button from stock.
I've tried using
gtk_button_new_with_label("gtk-media-play");
but I only get a button with the label gtk-media-play.
Any way, when I use
gtk_button_new_from_stock("gtk-media-play");
I obtain what I want but I have also a lot of warnings about deprecation.
How do I use the suggested function gtk_button_new_with_label in order to obtain a button with stock image?
How can I solve this situation without using deprecated functions?
Stock items in general have been deprecated. You probably want new_from_icon_name() instead (I think the documentation should actually refer to that). There's a standard for icon names.

How do you access/configure summaries/snippets in Django Haystack

I'm working on getting django-haystack set up on my site, and am trying to have snippets in my search results roughly like so:
Title of result one about Wikis ...this special thing about wiki values is that...I always use a wiki when I walk...snippet value three talks about wikis too...and here's another snippet value
about wikis.
I know there's a template tag that uses Haystack code to do the the highlighting, but the snippets it generates are pretty limited:
they always start with the query word
there's only one snippet value
they don't support asterisk queries
and other stuff?
Is there a way to use the Solr backend to generate proper snippets as shown above?
Bottom line is that the Solr highlighting can't really be used by Haystack in a flexible way. I spoke to the main developer for Haystack on IRC, and he said basically, if I want to have the kind of highlighting I'm looking for, the only way to get it is to extend the Solr backend that Haystack uses.
I dabbled in that for about half a day, but couldn't get Haystack to recognize my custom back end. Haystack has some magic backend loading code that just wasn't working with me.
Consequently, I've switched over to sunburnt, which provides a lighter-weight and more extensible wrapper around Solr. I'm hoping it will fare better.
from haystack.utils import Highlighter
my_text = 'This is a sample block that would be more meaningful in real life.'
my_query = 'block meaningful'
highlight = Highlighter(my_query)
highlight.highlight(my_text)
http://docs.haystacksearch.org/dev/highlighting.html