Using getBounds on geoJSON feature - leaflet

I've tried map.fitBounds(geojsonFeature.getBounds()); and I get this error:
geojsonFeature.getBounds() is not a function.
Here is the code: http://jsfiddle.net/0aqxktov/
What is going wrong here?
Thanks in advance.

Your variable geojsonFeature is just an object, there is no method named getBounds() there, as you can easily check.
Instead of that, give your geoJSON layer a name...
var feature = L.geoJson(geojsonFeature).addTo(map);
And use that to call getBounds():
map.fitBounds(feature.getBounds());
Here is the updated JSFiddle: http://jsfiddle.net/qofrgm2k/

Related

How to get result from QQuickWebEngineView::runJavaScript

I'm trying to execute javascript on QQuickWebEngineView object in c++ and get returned value. In QML it's easy
view.runJavaScript("document.documentElement.outerHTML", function(result){//do smth})
in c++ method signature for executing js is this:
void runJavaScript(const QString&, const QJSValue & = QJSValue());
and I believe I could use QJSValue to get returned data, but I'm not finding anything on how to use it... maybe someone has an example of how to use QJSValue here. Thanks.

Use of Unresolved Identifier adding second pin MapKit swift

I am trying to add another pin to my map.
It has worked fine with
artworkPin = Artwork(title:"Wind Wand",locationName:"Majestic",discipline:"Statue",
coordinate:windwandcoord)
but now I've tried adding
artworkPin2 = Artwork(title:"Wind Wand2",locationName:" Not Majestic",discipline:"Statue",
coordinate:windwandcoord2)
but this is giving me an error of Use of unresolved identifier 'artworkPin2'
Any thoughts on what might be causing this?
The error means there is no variable named artworkPin2 in the current scope.
So assuming you are creating a new, local variable, you need to use var (or let):
var artworkPin2 = Artwork(title:"Wind Wand2",locationName:" Not Majestic",discipline:"Statue",
coordinate:windwandcoord2)
Or perhaps you need to add a property named artworkPin2 to your class and assign to that property.

Property Mapping Exception in Helhum upload example

I am using helhum File Upload Demo to upload the images. But currently i got below error.
Exception while property mapping at property path "images.0":Property "name" was not found in target object of type "XXXX\XXXXX\Domain\Model\FileReference
Please help here.. How can i move forward.
Thanks in advace.
If you followed the example extension, you are maybe missing the registration of UploadedFileReferenceConverter and ObjectStorageConverter in your ext_localconf.php. Took me a day to find that one:
ext_localconf.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter('Vendor\\EXT\\Property\\TypeConverter\\UploadedFileReferenceConverter');
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter('Vendor\\EXT\\Property\\TypeConverter\\ObjectStorageConverter');
In the initializeUpdateAction (or initializeCreateAction) you have to use the name of the parameter in the updateAction (or createAction) as argument.
If your updateAction looks like this:
public function updateAction(\Classname $yourObject)
You have to call the helhum function with the argument:
$this->setTypeConverterConfigurationForImageUpload('yourObject');
As a small hint for later problems: In the setTypeConverterConfigurationForImageUpload function you should register your own file attributes if they are not named image and/or imageCollection.0 like in the example.

mshtml fireevent onchange not firing

I am unable to fire an "onchange" event in mshtml. Can you please tell me what I am doing wrong here.
HTMLSelectElement element = (HTMLSelectElement)this.HTMLDocument.all.item(controlId, 0);
IHTMLElement e = element as IHTMLElement;
IHTMLDocument4 doc = e.document as IHTMLDocument4;
object dummy = null;
object eventObj = doc.CreateEventObject(ref dummy);
HTMLSelectElementClass se = element as HTMLSelectElementClass;
se.FireEvent("onchange", ref eventObj);
I am getting variable "se" as null. I got this piece of code from another link http://www.itwriting.com/phorum/read.php?3,1507
Can anyone help me with this.
Thanks,
Sam
Runtime Callable Wrapper objects generated by COM calls like HTMLDocument.all.item can translate interface casting to QueryInterface calls. But the RCW does not know how to convert to a managed class like HTMLSelectElementClass, thus it returns null.
Instead of casting to HTMLSelectElementClass, cast to IHTMLElement3 to call fireEvent.
By the way, your code does not work in IE11 mode as document.all is deprecated. Use IHTMLDocument3::getElementById instead.
I had tried all those which Sheng mentioned but didn't work.
This issue was solved by injecting javascript code for "onchange" and executing it. It worked.

Which file contains function of core/session in magento?

I need to customize other's code,
so I found they used
Mage::getSingleton('core/session')->getMyCustomBlockInfo();
in Order.php file for custom order email
so I can't find this function getMyCustomBlockInfo();
Can anyone tell me where this function reside?
Thanks
those are magic functions get() and set() and you are asking a session variable there that is set as
Mage::getSingleton('core/session')->setMyCustomBlockInfo();
somewhere in your code. If you use terminal you can easily find by making a following grep:
grep '>setMyCustomBlockInfo(' . -rsni
and it will list the files where your variable is set to session.
example :
Mage::getModel('catalog/product'); //or
Mage::getSingleton('catalog/product');
the code must be in '../app/core/Mage/Catalog/Model/Product.php' file
then
Mage::getSingleton('core/session');
the code must be in '../app/core/Mage/Core/Model/Session.php' file
because the class Mage_Core_Model_Session's parent::parent is Varien_Object, then you can do all magic functions and you can ->getData() to see the Data inside.
Mage::getSingleton('core/session')->getData();
on your problem when go call ->getData() you can see data : [my_custom_block_info]
you can set it with call
Mage::getSingleton('core/session')->setMyCustomBlockInfo('what');
Mage::getSingleton('core/session')->getMyCustomBlockInfo();
// will return 'what'