How to set a custom location as SuggestedStartLocation of filepicker/folderpicker - windows-8

As windows store apps runs in so called sand-boxed environment,I decided to use folderpicker to get access to files.
I wanted to show the user his %localappdata% folder when file/folder picker is launched(C:\Users\Admin\AppData\Local)
I couldn't find a way to do this or to set any custom location ("C\testFolder") instead of through setting predefined PickerLocationId enumeration.
Any help would be really appreciated.

It is not possible. WinRT doesn't have any provision to set ANY folder as SuggestedStartLocation.

Related

The location of .config for geotiler on Windows

I'm working in jupyter notebook on Windows with matplotlib basemaps and I want to use geotiler with the basemaps. I'm writing a program and as part of it, it will generate a map and plot data points on it. However, the maps that my code generates often are over a small part of the world and have no defining features. My solution was to import the geotiler library and display it over the map with an alpha so the maps generated would be identifiable. However, when I use the geotiler.Map() function, I get a message saying that the configuration file does not exist.
The code and the error message
How do I locate the .config folder on Windows, if it exists, and where should I create it if it doesn't? I already tried my user folder but that didn't seem to work. Thanks in advance.
Figured it out.
The read_config() method in the source code tries to get the HOME environment variable, which for Windows is blank, and appends the path for the config to that. Importing os and manually setting the HOME variable to wherever you placed your .config folder seems to do the trick. You can do this with os.environ['HOME'] = 'C:\Users\YourName'.

Visual Basic 2010- Retrieving images using code

I am making a card game. I have 53 images for the cards and one for the back of the cards. Is there a way I can use the resource file or is there a way I can reference the folder where the program is being held with it still being relatively portable so I can move the folder and the program will still work perfectly. I thought about using a case statement and using the
My.Resources._8Hearts 'For Example
but that would take up a lot of space that I am sure can be avoided. I know this can be used to grab an image:
card1.image = System.Drawing.Image.FromFile("C:\" & variable_so_I_can_get_multiple_cards & ".png")
And using a 'for' statement to place each card in a different slot on the form
Thank you for the help
PictureBox1.Image = Image.FromFile(picPath) can retrieve an image for you,no need to add to resources in VB,and im sure u have worked with Strings so you can dynamically attach the name of each picture name (and I think also extension,.PNG seems to work best for me).
If you need it to move with the installation folder find out what your application path is using MessageBox.Show(Application.StartupPath) and then place a folder of your pictures in there and when publishing don't forget to include the folder yah? And Inno Setup (http://www.jrsoftware.org/isdl.php) is a good publishing tool...so I hear,never used it before.
If this answer works for you please dont forget to accept it as the right answer

Capture and save a photo in XAML/C# for a Windows store application

I'm trying to take and save a photo using a windows surface device.
I'm using the code below to take a photo and this work but I'd like to automatically create a directory on the device's local drive and save this photo there without any dialog prompts.
So the code I use to capture to photo is as follows:
CameraCaptureUI camera = new CameraCaptureUI();
StorageFile file = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file!=null)
{
using (IRandomAccessStream ras=await file.OpenAsync(FileAccessMode.Read))
{
BitmapImage source = new BitmapImage();
source.SetSource(ras);
imageBuildingPhoto.Source = source; // this is just an image control.
}
}
So after this I'd like to automatically save the photo to a new directory. e.g.
My Pictures\NewDirectory\Photo1.jpg
Anybody got any idea how I can do this?
This is a windows store application written using C#4.5 and XAML.
Thanks in advance
Use the CopyAsync method on the StorageFile object you get back (file). You can specify a directory and file name. If you need to create your own directory structure, you will need to enable access to the appropriate library in the Package Manifest then create it in code. You will then use the StorageFolder class and its CreateFolderAsync method to create folders.
http://aka.ms/30Days has some great resources for learning about scenarios like this. Might be worth checking out.
Your code will need to look to see if that folder exists and create it if it does not. Your app will need to declare the capability to access the user's Photos library in the app manifest, too.
To take a picture, your code is correct. I have a walkthrough in case you want to verify it against some other code: http://blog.jerrynixon.com/2012/10/walkthrough-capturing-photos-in-your.html
To interact with the file system, this can be tricky, but I have a longer write up on that if you want to reference it: http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html
The answer to your question is, yes you can. I have done it in my own apps. Now, it's just a matter of you implementing it in yours. You will find it to be pretty easy.

how to modify luntbuild mail notification template?

We are using luntbuild-1.6.2 for build automation. We would like to add a couple of variables in the email notification sent via luntbuild like subversion location etc.
Is it possible to modify the email template for luntbuild?
After reading the manual once again I was able to locate the files where the template resides.
Simple edit
<luntbuild installation path>/templates/email/simple-build.vm
file and you can customize the template using a set of predefined variables.

Liferay 6.0.5 - hide IGFolders from owner on private/public layout of his private community

We need to create hidden "system" subfolders in every IGFolder an normal user creates.
The image gallery portlet resides mainly on the private community layouts of all normal users. The portlets and their configuration is pregenerated so the normal users can't change them (layout.user.[public|private].layouts.modifiable=false).
Why we want to do this
In those system folders we'll store automatically generated size versions of the uploaded images. This is because we also import WebContent/JournalArticle representing image galleries which provide different sizes of the images themselves. In the end we want to display both the IGFolders and the JournalArticle content the same way without to much special code.
What i have tried already
I tried to do this via permissions (resource-actions/imgallery.xml =>
owner-defaults) but on his own community pages the user is also
CommunityAdmin which gives him the rights to do & see almost whatever
he wants. (PermissionCheckerBagImpl.isCommunityAdminImpl)
I thought of creating the layouts that don't belong to the user/his
private Community, but testing this on a public page of another
community that the users belongs to didn't work. I can't get the
system to display the IGFolders of the current user at all, instead
the folders of the community are displayed.
Using another user and group for the subfolders didn't work either,
if the groupId does not match the one of the parent folder the parent
folder id is set to 0, so they are longer subfolders at all
(IGFolderLocalServiceImpl.getParentFolderId).
What might work and i probably just don't get right
changing the owner of the image gallery portlet/the layout
fiddling with the permission in a way i haven't thought of
adding another layer of groups/communities
putting the system folders somewhere else (which of course leads
to more code for maintaining the relation between them and their
parent folder)
Of course i could use expandos to flag the system folders - which i have to do anyway - and hide them after retrieval in the view but then i also would have to fiddle with the folder count, which i would like not to, since i feel this is not the way to do things.
Any ideas are appreciated, please don't feel shy to elaborate, I'm quite new to Liferay
You could create hook plugin and override in it (probably this file)
/portal/portal-web/docroot/html/portlet/image_gallery/view_folders.jsp
There you could add code to ignore your "system" folder if it exists. Perhaps all "system" folders could have same name (for example "_SYSTEM_FOLDER_") that you can test against.
Take note that this just hides folders, so if someone knows folderId and has permission to see/edit it they could craft URL to access it.