resources

RAII and system resource cleanup

℡╲_俬逩灬. 提交于 2019-12-24 01:25:40
问题 RAII is a good solution for resource cleanup. However, RAII is based on stack unwinding. If process terminates abnormally, the stack won't be unwinded. It means RAII won't work in this situation. For process life-time's resource, it's nothing to worry about, but for file system life tiem or kernal life time resource, such as file, message queue, semaphore, shared memory, it will be a problem. How can I cleanup the system(fs and kernal) resource in a reliable way? Example: A shared file will

Binding from resources inside a DataTemplate

假装没事ソ 提交于 2019-12-24 01:04:53
问题 Is there some way to get the DataContext of a DataTemplate to use in bindings within its resources? <DataTemplate x:Key="History"> <ItemsControl ItemsSource="{Binding History}"> <ItemsControl.Resources> <app:BitmapProvider x:Key="Converter" ShowDetails="True" Type="{Binding Model.Type}" /> </ItemsControl.Resources> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" IsItemsHost="True"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate

Android animation while switching imageview resource

无人久伴 提交于 2019-12-24 00:46:00
问题 Well this is the code I use to animate the view so that old image disappears (black background) and new one slides in from outside (from left to right). this.imgView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right)); this.imgView.setImageResource(imageArray[next]); How do I make it that old image slides out of the screen before new one shows up. Would be great if both were visible but I guess that would require 2 views to switch, so for now I could stick to one on screen at

WPF Style Resource not Working

孤街浪徒 提交于 2019-12-24 00:08:07
问题 All, I want to inherit a generic style for all DataGrid/ResourceDataGrid s in my application. To do this I have created a resource file called ResourceControl.xaml , in which I have <UserControl x:Class="ResourceStudio.Views.ResourceControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

How could I read a JSF session bean from a filter?

大憨熊 提交于 2019-12-23 23:22:13
问题 I'm searching but I can't find the answer, I need secure resources based on permissions, I can't use a filter because FacesContext is not initialized before and I need load the permissions in my session bean. Some solution avoiding use a filter? PhaseListener, ViewHandler and ResourceHandler can't capture an URL resource request, for example I need denied this direct access: http://127.0.0.1:8080/test/resources/images/image.jpg Thx in advance... 回答1: JSF stores session scoped managed beans as

Accessing wrong raw resource in Android

天涯浪子 提交于 2019-12-23 22:55:56
问题 I have the following code. My idea is in OnCreate, I'll populate some categories from a text file in /res/raw to my database. First a tokenize the read file by lines (myCatToken), then each of these I split again to get the id and name. For some reason, instead of reading rat.txt I'm getting a totally different file and I have no idea why. The file that is actually read does exist in the /res/raw folder, however its named different. It seems that it has something to do with the resource it

Resource mange external nodes in Jenkins for tests

亡梦爱人 提交于 2019-12-23 22:23:56
问题 My problem is that I have code that need a rebooted node. I have many long running Jenkins test jobs that needs to be executed on rebooted nodes. My existing solution is to define multiple "proxy" machines in Jenkins with the same label (TestLable) and 1 executor per machine. I bind all the test jobs to the label (TestLable). In the test execution script I detect the Jenkins machine (Jenkins env. NODE_NAME) and use that to know what physical physical machine the tests should use. Do anybody

Creating a CroppedBitmap at runtime - won't load from resource

亡梦爱人 提交于 2019-12-23 20:27:01
问题 I'm trying to write code that will load an image from a resource, and then crop it. This code works when I do all, or part, of it in XAML. I want to switch from all-XAML to all-code, so I can reuse this more than one place, with different Uris. But when I try to do the same thing in code, I get a DirectoryNotFoundException, because suddenly it starts trying to look for a folder on disk, instead of loading the image from the resource. If I load the BitmapImage in XAML, and then create a

Can't find “Resources” file in wpf

我只是一个虾纸丫 提交于 2019-12-23 19:02:00
问题 I'm newbe in WPF. I need to add reference on the resources file resx and get strings from it. <Window x:Class="SelectObjectsWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:res="clr-namespace:SelectObjectsWindow.Properties" Title="{x:Static res:Resources.Res1}" Height="350" Width="525"> <Grid> .... </Grid> I got an error: The name "Resources" does not exist in the namespace "clr-namespace

Localize application on button click

白昼怎懂夜的黑 提交于 2019-12-23 18:30:38
问题 I have in my project mainMaster page were locates imageButtons: <asp:ImageButton ID="RU" ImageUrl="/Images/RU.png" runat="server" onclick="RU_Click"> <asp:ImageButton ID="USA" ImageUrl="/Images/USA.png" runat="server" onclick="USA_Click" /> here's OnClick functions: protected void RU_Click(object sender, ImageClickEventArgs e) { Session["MyCulture"] = CultureInfo.CreateSpecificCulture("ru-RU"); Server.Transfer(Request.Url.LocalPath); } protected void USA_Click(object sender,