Can I adapt from XMLEventWriter to XMLStreamWriter? - xml-parsing

In order to support a StAXResult as input, I'd like to be able to adapt from XMLEventWriter to XMLStreamWriter. Its possible to go in the other direction via XMLOutputFactory2.createXMLEventWriter(XMLStreamWriter).
There's a similar asymmetry for readers as XMLInputFactory only has a method to adapt from XMLStreamReader to XMLEventReader.
Is there a way to do this?
NB: My code currently uses an XMLStreamWriter internally so it would be trivial to support an XMLStreamWriter. To support XMLEventWriter I either need to adapt the writer or change all the internal code to use XMLEventWriter (given that I can adapt from XMLStreamWriter to XMLEventWriter).

To answer my own question, you can use XMLEventStreamWriter from stax-utils.

Related

(Roblox scripting) help needed for "GetMaterialColor" or "SetMaterialColor"

I am new to roblox scripting, and I am working on a game. I am trying to make an exploration game with multiple planets. I want the colors on the surfaces of the planets to vary, but I also wish to use smooth terrain, as it is easier to use and looks nice. from reading a bit online, i have figured out i need to use "GetMaterialColor" or "SetMaterialColor". however, "SetMaterialColor", the one i needed specifically, requires two bits of information- the material and the color.
The issue comes from the "Material" part of this, as I have no idea how to make the script recognize what material I want to change. i tried multiple things, including but not limited to:
(grass, #,#,#)
(grass) (#,#,#)
("Grass"), (#,#,#)
("Grass", #,#,#)
or even just (#,#,#), without trying to get a specific material at all
so yeah, I need some help
here is the code:
local function onTouch(hit)
game.Workspace.Terrain:SetMaterialColor
end
script.Parent.Touched:connect(onTouch)
(there should be stuff after SetMaterialColor, that is what i need help with)
If you read the documentation on Terrain:SetMaterialColor(), you'll see that the first argument is a Material type, which is an Enum. So the method expects an Enum (or number to be more accurate), not a string denoting the material.
At the same time the second argument is a Color3, so (#,#,#) isn't apt, using it with the constructor Color3.fromRGB(#,#,#) is. If you are ever confused about what a method returns or expects, try referring to its documentation on https://developer.roblox.com/.
Here's an example of correct usage:
workspace.Terrain:SetMaterialColor(Enum.Material.Grass, Color3.fromRGB(123,123,123))
And ofcourse, Event:Connect() instead of Event:connect()

OpenLayers 4 webmapcontext

In one of my projects i want to use OL-4.6.5 instead of OL-2. But one key feature that we are using is the OpelLayers.Format.WMC().
Is this functionallity available in OL-4.6.5.
Regards
Magnus
It is not, and it probably will never be, but you should be able to use JSONIX with ogc-schemas for this.

Ranorex Spy - The recognition elements on the page (prioritizing attributes)

I have question related to the Ranorex Spy.
Is it possible to recognize (by default) elements of the page by attribute other than id, e.g. data-id
I know that I can modify this later manually for each element (but it is time consuming)
Currently:
\input[#id='..."]
Expected (automatically, by Ranorex Spy):
\input[#data-id='..."]
I personnally did not bother using this (because we use many frameworks and whats desired in one framework is not necessarily whats desired in another one) but I think you can achieve priorisation of XPath rules using the RanoreXPath Weight Rules.
Following is a Ranorex article describing how to do this: http://www.ranorex.com/support/user-guide-20/ranorexpath-weight-rule-library.html
Good luck!

gmaps4rails v2 methods / functions / variables

I was hoping for some clarification on when and where you can call certain methods.
clusterer (Do you access this through the handler? Do you clear the clusterer as a whole, or do you clear individual markers from the clusterer?)
addListener (I see this sitting in base_builder.coffee, but have no idea how to interact with it)
#hash = Gmaps4rails.build_markers(#events) do |event, marker| (Do all of the builders work here?)
primitives (when, maybe why, would I need to use these? I see it in the common.coffee, which is why I ask. I don't want to be missing anything.)
I'm sure I'll have more, as I keep using it... but these should get me moving nicely.
update
new question...
clusterer (Do you access this through the handler? Do you clear the clusterer as a whole, or do you clear individual markers from the clusterer?)
In 2.0.4 you can do handler.removeMarkers(array) and handler.removeMarker(marker)
addListener (I see this sitting in base_builder.coffee, but have no idea how to interact with it)
only useful if you create your own builder, you can access the same method thanks to the primitives, or write it with plain google maps commands: do you really need to abstract on your level?
#hash = Gmaps4rails.build_markers(#events) do |event, marker| (Do all of the builders work here?)
It's just a convenient way to create json. If you need custom json, build it with your own json builder.
primitives (when, maybe why, would I need to use these? I see it in the common.coffee, which is why I ask. I don't want to be missing anything.)
This is an abstraction in the gem: as an injected dependency it lets me test easily. You can use it, but its not required.

Cant update table in using isset

I have a table called settings, when I would change or enter data into the form it did not change the data in the table. In addition on form an image upload file is not running, There may be the wrong code below.
(Solved by me)
Maybe someone can help me Related to this.
What you are doing here is tottaly in secure and your data can be hacked / manipulate really fast.
Why dont you use a framework like codeignighter there are about 100 easy frameworks that will help you manage database a lot easyer.
Are you sure that you are updating the wrond ID? where id = 1, seems to be not dynamic.
Please post your error http://www.w3schools.com/php/func_mysql_error.asp
I know it is not so related to your question, but you should see these light frameworks:
http://kohanaframework.org/
https://github.com/ElbertF/Swiftlet
http://ellislab.com/codeigniter
You're not checking the return status of of your query, so if it's not working you wouldn't know. Do this:
mysql_query("UPDATE settings SET site='$name',keywords='$keys',descrp='$desc',email='$email',fbpage='$fbpage',twitter='$twitter',gplus='$gplus',disclaimer='$disclaimer',template='$template' WHERE id=1")
or die(mysql_error());
Note: mysql_*() is deprecated: you shouldn't use it. Use mysqli_*() or PDO instead.
Also: You are susceptible to an SQL Injection attack. You should escape your input variables with mysql_real_escape_string() (or the equivalent if you switch to mysqli), or consider moving to prepared statements.

Resources