Avalonia: How to display PNG as image? - f#

I haven't seen an F# example of accomplishing this, or any examples similar enough to what I am trying to do, so hopefully a solution here will be helpful to others.
I am using Avalonia with F# to build a simple UI. I want to include images in my UI, but have spent hours looking at documentation and examples and everything I've seen looks to be overcomplicated (maybe it really is just that complicated?).
I am creating an image like:
let b = (Avalonia.Media.Imaging.Bitmap #"C:\Images\icon.png")
Image.create [
Image.source b
]
This just displays nothing. What am I missing here?

To add more detail to my comment above, here's what works for me:
let view =
Component(fun ctx ->
let b = new Avalonia.Media.Imaging.Bitmap("Small.png")
Image.create [
Image.source b
]
)
Result is:

Related

Process Maker default tables

I am new to process maker.while I am exploring the process maker I got an employee on boarding process.while understanding the process I understood the dynaforms but I faced problem with trigger forms. In trigger forms they mentioned tables to get data but i didn't find the tables in my work space. Please let me know if anyone know the answer.
Thanks.
##hrUser = ##USER_LOGGED;
//Get image
$sqlSdocument = "SELECT *
FROM APP_DOCUMENT D, CONTENT C
WHERE APP_UID = '".##APPLICATION."'
AND D.APP_DOC_UID = C.CON_ID
AND C.CON_CATEGORY = 'APP_DOC_FILENAME'
ORDER BY APP_DOC_CREATE_DATE DESC";
$resSdocument = executeQuery($sqlSdocument);
$dirDocument = $resSdocument[1]['APP_DOC_UID'];
$httpServer = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
##linkImage =
$httpServer.$_SERVER['HTTP_HOST']."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."
/cases/cases_ShowDocument?a=".$dirDocument;
Judging by the your code, you want to query the uploaded file but base on the commend, you want to get the image?
Well if employee onboarding is what you want, I am guessing that you uploaded the picture on the first dynaform and you want it to be shown. Well this is your luck because ProcessMaker Documentation already have that
If you want a code that let you see the image immediately after upload, you might want to signup for a enterprise trial and test their Employee Onboarding.

Maxscript Material/Slate editor?

Hey guys is there a way to access "Material Editor: Manual Update Toggle" for both Slate editor and compact in maxscript?? was looking through the docs but cant seem to find much. any help is appreciated, thanks!!
Doesn't updating materials happen automatically? or do you maybe mean "update preview"?
I know that when you do a loop for all your materials, you can via code update the loop and all of its functions by deciding when to trigger the function.
You can acces those materials + all of its functions with something like:
(libile can be external file of internal from your editor)
local tempLib = loadTempMaterialLibrary libFile
for m in tempLib do (
global materialName = #(m)
)
local materialcount = templib.count
for iterations = 1 to materialcount do
(
-- whatever you like to do
)

WoW API / Lua - Math.Random(#,#)

Always feel like I'm making something far more complicated than it has to be. I'm currently playing around with the WoW addon, Tongues, in hope of make a custom dialect filter - which is quite easy of course, very noob-friendly. At this point, there is one thing I want to accomplish-- something of which feels to have the implications far beyond this -- that is just novelty, but before I give up completely (lots of hours trying different things with no headway) I was hoping someone could come by, get a cheap laugh and perhaps help me fix this if they understand my point. And who knows, posting this new helpless questions might bump me up to being able to finally upvote!
Tongues.Affect["Drunk"] = {
["substitute"] = {
[1] = merge({
{ ["([%a]+)(%A*)$"] = "%1 ...hic!"},
Tongues.Affect["Slur"]["substitute"][1]
});
};
["frequency"] = 100;
};
What this does is simply add on the "...hic!" to sendchatmessage(); I believe it is. The frequency part seems completely broken and only the GUI slider in the game matters for that. What I was hoping to accomplish was to repurpose this and make the "...hic!" an actual randomized word. Since the mod itself handles the chance that it happens, I figured all that is needed left is to replace the string with a function=X. It's, of course, intensely way over my head, but despite checking the Lua of several mods, nothing feels like "it will fit."
The best I could come up with,
Tongues.Affect["TESTAFFECT"] = {
["substitute"] = {
[1] = merge({
{ ["([%a]+)(%A*)$"] = function(b)
local rand = Math.Random(1,2)
if (rand == 1) then
b = "test1"
return b
elseif (rand == 2) then
b = "test2"
return b
end
end
Leaves a gloriously useless message in the error mod BugSack - of course my attempt is wrong, but there's no way to know how!
I'm assuming this is enough information - as I said, very user friendly mod without any need to understand how it really works (Although I'd love to ready study it after this "project")
Anyone? Regardless, thank you for your time in simply even reading this far.
Update: Downvotes, okay! That's cool too. A little unpredictable, but sure. The error is as follows
15x Tongues\Core\dialects.lua:172: attempt to index field 'Affect' (a nil value)
Tongues\Core\dialects.lua:172: in main chunk
Locals:
175 in dialects.lua is
Tongues.Affect["Wordcut"]["substitute"][1],
Which has nothing to do with what I'm trying to accomplish, and works just fine.
Sorry that my question was an inconvenience. I asked to the best of my ability and the best of my ability to articulate the question proved to be less then stellar. The example codes I had provided were the only way I could articulate showing what I was trying to do.
I was misinterpreting the error frame and discovered that behind the useless stack that calls an error where there is, in fact, none, is a stack that calls the error in syntax at the time that broke it.
I'm sharing my results, regardless if the community finds this useless. I learned a tremendous amount from this personally, which is the only incentive in that I asked for help.
Tongues.Affect["TEST"] = {
["substitute"] = {
[1] = {
["([%a]+)"] = function(a)
return a
end;
["(%A*)$"] = function(a,b)
local rand = math.random(1,2)
if (rand == 1) then
b = "test1"
return b
end;
if (rand == 2) then
b = "test2"
return b
end;
end;
};
};
};
Hope it helps someone out there - as expected, I made it more complicated than it had to be. Simply "jiggling" the symbols is all that was needed.

Ogre::SceneManager::setAmbientLight doese not work

i am building the wiki Advanced Ogre Framework,
then i find that the Ogre::SceneManager::setAmbientLight() does not work at all.
i find nothing useful after google, anyone can give me some idea?
the code is like this:
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "GameSceneMgr");
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7f, 0.7f, 0.7f));
finally i figure it out bymyslef,
in the framework, i call setAmbientLight() before these code:
DotSceneLoader* pDotSceneLoader = new DotSceneLoader();
pDotSceneLoader->parseDotScene("CubeScene.xml", "General", m_pSceneMgr, m_pSceneMgr->getRootSceneNode());
delete pDotSceneLoader;
there is a node in the CubeScene.xml set the ambient color again, which is (0,0,0), so my call can not work then.

MiniMagick (+Rails): How to display number of scenes in an image

I have a Rails app that uploads images for image processing, and I want to be able to 1) See how many pages/frames/scenes there are in an image, and 2) split multi-page images into single-page jpegs.
I'm having no trouble converting image types for single-scene images, but I can't quite puncture the ImageMagick documentation to understand exactly what I'm to do. The doc page I'm using is here:
http://www.imagemagick.org/www/escape.html
For the most part, I would like the code to be as simple as
def multiPage?( image )
img = MiniMagick::Image.open(image.path)
numPages = img.format("%n") #This returns Nil
count > 1 ? true : false
end
Does anyone have a better idea of what to do than I do? Thanks in advance!
Ok, well this is a bit of a hack, but when I did:
numPages = img[:n]
I would get numPages resulting in a string of the letter 'n' as many times as there are pages in an image, so:
#img -> 4-page image
numPages = img[:n] # => 'nnnn'
Probably not the best answer, but at least it works.
UPDATE:
Found a better way
numPages = Integer(img["%n"])

Resources