new BitmapImage from Imagelist.images - vb.net

Im trying to change the source of windows.media.imagesource
I store all my images in a windows.forms.imagelist
my code is: Source = New BitmapImage((MyImageList.Images(2)))
a system.uri is expected but I cannot find the conversion method

ok i dont know the rest of your code but i asume that for adding the images to the image list you first look for an uri, save the uri's in an Array and then call them from there.
Note:there is no method for getting an Uri from a Bitmap.

Related

SenseNet Newly created content not showing up when querying for it

I have initialized the DefaultDatabase
When I create any new content anywhere it does not show up when I'm querying for it.
I can access it when I know the exact path.
Any ideas what I might be missing?
Thanks for your help
Edit1:
I'm using 7.7.8
Used for example this code
await Tools.EnsurePathAsync("Root/IMS/ImsTestDomain", "Domain").ConfigureAwait(false);
await Tools.EnsurePathAsync("Root/ImsTestDomains", "Domains").ConfigureAwait(false);
await Tools.EnsurePathAsync("Root/ImsTestDomains/ImsTestDomain", "Domain").ConfigureAwait(false);
then I'm using GET Request like these
/odata.svc/Root
/odata.svc/Root/IMS
/odata.svc/Root/ImsTestDomains
or like these
notice the "query=Type" - filtering for Domains or Domain
taken from https://admin.sensenet.com/
/odata.svc/Root?%24orderby=DisplayName%20asc&%24select=Id%2CPath%2CName%2CType%2CDisplayName%2CIcon%2CIsFolder%2CParentId%2CVersion%2CPageCount%2CBinary%2CCreationDate%2CAvatar%2CActions&%24expand=Actions&query=Type%3ADomains%20.AUTOFILTERS%3AOFF&metadata=no&%24inlinecount=allpages&%24top=10000
/odata.svc/Root?%24orderby=DisplayName%20asc&%24select=Id%2CPath%2CName%2CType%2CDisplayName%2CIcon%2CIsFolder%2CParentId%2CVersion%2CPageCount%2CBinary%2CCreationDate%2CAvatar%2CActions&%24expand=Actions&query=Type%3ADomain%20.AUTOFILTERS%3AOFF&metadata=no&%24inlinecount=allpages&%24top=10000

Displaying jpegPhoto attribute from LDAP in Websphere Portal

I have a requirement wherein I need to display details of users after searching from LDAP using PUMA API.
I'm having troubling displaying the jpegPhoto of the user.
Here's what I'm doing:
First I'm querying the user by using:
PumaLocator.findUsersByAttribute(uid, user);
After that we get a User list Object.
For each user, we fetch all the attributes which is in the form of a Map.
I'm getting the following value for while retrieving the jpegPhoto:
map.get("jpegPhoto") --> [B#7a2f8a54
It seems that the Puma API returns a Binary string. Does anyone know how to display this in the portlet?
Any help would be greatly appreciated. Thank you
I think it more likely this is a byte[] array than a string.
You can probably base64 encode this binary into an encoded string and use it in an HTML image tag.
byte[] photoBytes = (byte[]) map.get("jpegPhoto");
String encodedPhoto = org.apache.commons.codec.binary.Base64.encodeBase64(photoBytes);
Then later, perhaps in a JSP (example assumes JSTL variable in scope named encodedPhoto):
<img src="data:image/jpeg;base64,${encodedPhoto}"/>
A way of doing this is to access the image through the portal service servlet instead of using your own servlet: /wps/um/secure/users/profiles/[oid]/jpegPhoto, in which you replace [oid] with the ObjectID of the user. This ID string can be obtained using IdentificationMgr.getIdentification().serialize(user.getObjectID())
The photo of the current user you can access using: /wps/um/secure/currentuser/profile/jpegPhoto
Portal is giving you data as byte array. It will never give you as URL.
You can write a servlet which will write this byte array to output stream.
Use that servlet URL as src of tag. It will start rendering on browser.
FYI, you can't print byte array to browser and expect it to treat as image.
Image or any other files has to come as a resource not as content.

Normalize string from HtmlAgilityPack document

I'm trying to get a web page using vb.net and HtmlAgilityPack with this code:
Dim mWPage As New HtmlAgilityPack.HtmlDocument
Dim wC As New WebClient()
mWPage.Load(wC.OpenRead(mUrl))
My problem is to get text from a table but, when I extract InnerText, i get something like this:
Modificat<!--span-->i dati
instead of (Note that I wrote the same string and below it's displayed correctly):
Modificati dati
I've tryed to use the answer here but it doesn't work in this case (or I wasn't able to make it works)
I noticed that contents changes when I change "User-Agent", so I tryed various "User-Agent" but I never got a perfect text.
So my questions are:
can I use the code that is indicated in the answer to solve the problem?
if not, can I get a perfect text using the right "User-Agent"?
If so, how can I find the right "User-Agent"?
If not, how can I fix the receivedstring?
The response from the server based on a new User-Agent is fully dependent on the server so we will not be able to predict which one will yield the response you're looking for.
But... You will be able to use the HttpUtility.HtmlDecode method to get rid of the encoded HTML and turn it into teh string you're looking for.
To filter out the HTML comment you may need to change the XPath you're using. If you append //text(), you should get only the text elements that match the rest of your expression.

HTML File API: getting the text 'onprogress'

Using the HTML5 File API, I wonder if I can process the content of a file on the fly.
I know I can get the content of the file when onload is called:
function fileLoaded(e)
{
alert("content is "+e.target.result);
}
but can I get the current content when onprogress is called ?
Thanks.
Seems like yes, according to the spec. The onprogress event will fill the result property of your FileReader as more data is read in. However, as Matt pointed out, if you're only interested in a portion of the file in the first place, only read that section:
var blob = file.webkitSlice|mozSlice(startByte, stopByte, contentType);
reader.readAsBinaryString(blob);
I don't think so, but look at this example which shows you how to read slices of files.

What does visibleContentsAsDataURL exactly do?

I am currently trying to build my first Safari extension. The SafariBrowserTab Class has a Method called "visibleContentsAsDataURL".
I don't exactly understand what it does and can't get it to work.
The docs just say: "Returns a data URL for an image of the visible contents of the tab."
What does it mean? That I get the URL of a screenshot of the tabs' content back? Can someone explain me?
Thanks!
I think it returns what is effectively a screenshot of the tab. The format is explained here
http://en.wikipedia.org/wiki/Data_URI_scheme
According to Apple's Safari reference documentation the return value is "a base-64 encoded PNG."
A data URL is a specal type of url basically consisting of a mimetype and data, in the case of png you'll get something along the lines of:
data:image/png;base64;lotsofstuff
You can then do whatever you want with it (it's just a string), or if you want to display the content:
img = new Image();
img.src = someTab.visibleContentsAsDataURL();
someElement.appendChild(img);
or
someCanvasContext.drawImage(img);
etc