Rectangle 27 3

There's also a simpler way, if the image is loaded as resource in the xaml, and the code in question is the codebehind for that xaml

Here's the resource dictionary for a XAML file - the only line you case about is the ImageBrush with the key "PosterBrush" - the rest of the code is just to show context

Uri iconUri = new Uri("pack://application:,,,/ImageNAme.ico", UriKind.RelativeOrAbsolute);
NotifyIcon.Icon = BitmapFrame.Create(iconUri);
<UserControl.Resources>
        <ResourceDictionary>
            <ImageBrush x:Key="PosterBrush" ImageSource="..\Resources\Images\EmptyPoster.jpg" Stretch="UniformToFill"/>

        </ResourceDictionary>
    </UserControl.Resources>

Now, in the code behind, you can just do this

ImageBrush posterBrush = (ImageBrush)Resources["PosterBrush"];

.net - Setting WPF image source in code - Stack Overflow

.net wpf image
Rectangle 27 17

When you set the BuildAction to Resource it goes as embedded resource in an assembly. Or you can set BuildAction to Content then it will bundled into the resulting .xap file. You can use any one of these BuildActions. By setting BuildAction to Content you can access Image like: "/Resources/Images/darkaurora.png" (must begin with slash). And when you use the BuildAction Resource then you can access image as "YearBook;component/Resources/Images/darkaurora.png" (assemblyname;component/relativepath). Hope this will help.

"Embedded Resource" and "Resource" are different. If you look at the generated assembly in Reflector or ILSpy you will see that they get included in different ways. The author asked how to do it with "Embedded Resource", not "Resource".

@ethicallogics but what if need to bind this resource via viewmodel? Is there any other option, than bind to string path?

You need a leading slash on the assemblyname when BuildAction is Resource: "/YearBook;component....". See stackoverflow.com/questions/347614/wpf-image-resources

I think it should be "pack://application:,,,/Resources/Images/darkaurora.png" in the case of Resource as a BuildAction

c# - How to refer to Embedded Resources from XAML? - Stack Overflow

c# .net wpf xaml embedded-resource
Rectangle 27 3

1) OCR is in general very hard, but (good news for you) for test score processing, I think it is nearly a solved problem. In this vein there are tried and true solutions for such problems. School systems have been doing this to automate grading 'scantron' tests for years, so if you have access to such resources going that route might be your best bet. At least you should check how they do it

2) I am sure there are others, but those are the main free ones I know of

3)a I think if you are trying to do this on a budget and time is less an issue, your 'silly' idea is actually not silly at all. It might be the best way to do it, and it is likely that the scantron test graders use a similar method. You know the exact dimensions of the test form. You can know the direct pixel mapping of where to look. You could use pytesser very easily. Keep in mind that pytesser sometimes needs you to resize the image (sometimes up, sometimes down) to get the best accuracy.

3)b You might want to consider rolling your own solution. You could use the concept of morphological operations (numpy and other image libraries can do this nearly out of the box). You might not even need these operators and simply do a binary threshold of the table rows (assuming you have already cut the image into table rows) and simply look for blobs and mark the score as coming from the column with the most blob values.

Python OCR : Converting Scanned Image Into Text For Processing - Stack...

python python-2.7 python-imaging-library ocr tesseract
Rectangle 27 7

It explains that an Image can only be used in one place at a time. That would explain why it only ended up on the most recent assignment you made in code. Instead, define a BitmapImage and then create a new image using the BitmapImage as the source for each menu item.

To do this, create a BitmapSource as a resource somewhere:

<BitmapImage x:Key="MyImageSource" UriSource="../Media/Image.png" />

Then, in your code, use something like:

<Image Source="{StaticResource MyImageSource}" />

c# - Why only the last menu item has icon? - Stack Overflow

c# wpf
Rectangle 27 1

One likely problem might be that the image file is in your project folder without being copied to the build folder; /bin/Release for example. The application then will not find the file anymore. You can either ensure that the image is being copied when the application is compiled (that alone may not work actually as unqualified URIs make the parser look for resources as far as i know, the designer however does not seem to care) or you can embed the image as a resource. I do not know how to change compile settings in Blend however as i only use Visual Studio...

this was the most helpful but you're an expert in this site so I tick the other answer up just to encourage him/her to participate more, I'll vote you up as soon as I got the privilege to do so... Tnx Sir

wpf - Image in ComboBox only visible in designer - Stack Overflow

wpf xaml combobox expression-blend
Rectangle 27 3

Make sure you have all the resources images under assets directory. I had this problem and it turns out that one of my images is missing. Once I put the image back under assets directory, everything is fine.

java - Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) - PhoneGap - S...

java android eclipse cordova
Rectangle 27 2

Problem in solved!

The problem turned out to be a bug elsewhere in my code and had nothing to do with webstart, jnlp, or JnlpDownloadServlet. There was a flaw in how image resources where being accidentally pre-processed during the build process and as a result getting corrupted.

The correct way to reference resources was how I had it originally as follows:

String icon = "icons/Find.png"; //Notice no leading '/'
URL url = getClass().getClassLoader().getResource(icon);            
ImageIcon imageIcon = new ImageIcon(url);

Above code works fine when the resource is inside a jar in the webstart directory of the webapp. It also works fine if it is found as a local file on the classpath. It works whether the app is running within javaws or as a standalone app outside javaws.

web applications - How to access a resource inside a jar inside websta...

web-applications jnlp java-web-start
Rectangle 27 1

I fixed the problem, i didn't now that webpack will automaticly copy the image in /img folder to /public. So i moved my /img from public/ folder to /resources/assests/. And everything is fine now.

Its all about the path. Sorry i am pretty new with webpack and didn't know about that.

Glad that you managed to solve the problem!

Can not run npm using Laravel-mix - Stack Overflow

laravel laravel-5 webpack bourbon laravel-mix
Rectangle 27 1

The image is being cached by the webbrowser. Resources are cached on a per-URL basis via the cache-related instructions set in the response headers. Your concrete problem is caused because the resource URL is still the same and the webbrowser isn't aware that the resource has changed in the server side. The OmniFaces CacheControlFilter showcase page explains caching in detail (note: the filter is not the solution to this problem).

You basically need to force the webbrowser to re-request the resource by changing the URL. One of most common approaches for this kind of situation, whereby a cacheable resource is suddenly changed and its change needs to be immediately reflected to all clients, is appending the "last modified" timestamp of the image to the query string of the URL. Given that you're using JPA, so this should do:

Add a lastModified column to the brand table:

ALTER TABLE brand ADD COLUMN lastModified TIMESTAMP DEFAULT now();
  • Extend the Brand entity with the appropriate property and a @PreUpdate which sets it: @Column @Temporal(TemporalType.TIMESTAMP) private Date lastModified; @PreUpdate public void onUpdate() { lastModified = new Date(); } // +getter+setter (a @PreUpdate annotated method is invoked by JPA right before every UPDATE query)
  • Append it to the image URL (the parameter name v is a hint to "version"): <p:graphicImage value="#{brandBean.image}" ...> <f:param name="id" value="#{row.brandId}" /> <f:param name="v" value="#{row.lastModified.time}" /> </p:graphicImage> (I would here rename row to brand for clarity and brandId to id to deduplicate)

Finally, if you're using PrimeFaces 5.0 or newer, then you also need to disable server side caching:

<p:graphicImage value="#{brandBean.image}" cache="false" ...>

Design notice: if the image is not necessarily updated on every update of Brand, then split it off to another table Image and let Brand have a FK (@ManyToOne or @OneToOne) to Image. This also makes the property "image" reusable across various entities in the webapp.

jsf - BLOB images are displayed only on refreshing a page after an upd...

jsf tomcat primefaces jsf-2.2 graphicimage
Rectangle 27 12

You should place all of your static web content such as images, css and javascript in a resources directory under the webcontent (root directory) directory.

Then in myServlet-servlet.xml specify the directory as a resources directory. This will tell the dispatcher not to process requests for static resources.

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />

In your jsp files you should then access these resources using a root relative url that relies upon the context path resolved by JSP EL.

<link href="${pageContext.servletContext.contextPath}/resources/My_CSS.css" rel="stylesheet"/>

You sir are a gent, that worked perfectly, I clearly just didn't understand where the resource folder should of been located. much appreciated. I do have a follow up question, I am now getting an error in eclipse on my jsp page javax.servlet.jsp.JspException cannot be resolved to a type index.jsp any advice?

I am now getting an error in eclipse on my jsp page javax.servlet.jsp.JspException cannot be resolved to a type index.jsp any advice?

I have posted anther question as you suggested here

java - Accessing resources in JSP page of Spring MVC app - Stack Overf...

java spring jsp spring-mvc
Rectangle 27 12

You should place all of your static web content such as images, css and javascript in a resources directory under the webcontent (root directory) directory.

Then in myServlet-servlet.xml specify the directory as a resources directory. This will tell the dispatcher not to process requests for static resources.

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />

In your jsp files you should then access these resources using a root relative url that relies upon the context path resolved by JSP EL.

<link href="${pageContext.servletContext.contextPath}/resources/My_CSS.css" rel="stylesheet"/>

You sir are a gent, that worked perfectly, I clearly just didn't understand where the resource folder should of been located. much appreciated. I do have a follow up question, I am now getting an error in eclipse on my jsp page javax.servlet.jsp.JspException cannot be resolved to a type index.jsp any advice?

I am now getting an error in eclipse on my jsp page javax.servlet.jsp.JspException cannot be resolved to a type index.jsp any advice?

I have posted anther question as you suggested here

java - Accessing resources in JSP page of Spring MVC app - Stack Overf...

java spring jsp spring-mvc
Rectangle 27 2

There is a thingy called FileChangesMonitor which has a list of folders to watch and will trigger an app recycle if any of these change. It seems that as soon as a resource (an html page, an image, or, in your case, a pdf) is served through an HTTP request, the folder where it is located becomes an ASP.NET folder, i.e. is added to the list and monitored for changes. And it does not matter whether the resources are located inside or outside the application root. I experienced this problem with folder deletes, but I guess the same thing would occur with renames. This is frustrating, because it makes serving volatile static resources very difficult.

Hmmm... that's a good suggestion, I will look into that. If that indeed is the case, I think there's a pretty simple workaround to not write a file using HttpResponse.WriteFile but instead reading the file manually using a stream and outputting using HttpResponse.WriteBytes. The same can be easily encapsulated in an extension method on HttpResponse.

iis - Does changing any sub-directory or file in an ASP.NET applicatio...

asp.net iis recycling
Rectangle 27 2

The extension has its own target in your Xcode project. In order to access resources in the extension you also need to add them to that target (in the File Inspector also check your extension target in the Target Membership section). Just be aware that those resources also get copied into the extension bundle, which increases your overall app size.

Sidenote: In my extension I didn't add my default image asset catalogue (Images.xcassets) to the extension, but was still able to access the containing images. Maybe that's an exception.

I am following that way only. Yes, the app size is increasing like anything. If i go with shared embedded framework(contains image assets and common code) then it will work right?. It wont increase the app size too.

Sounds about right. But keep in mind that embedded frameworks are only supported in iOS 8.

oh no... then what happened to ios7!!!?. Actually i want to support both ios7 and also ios8. Any other idea?

That's the same problem I have. Since I don't have many resources I stick with duplicating them for now. I guess your extension is not using all the images the app uses. So you can reduce the size by extracting them into another asset catalogue and only add this catalogue to your extension.

sure right now i am going to duplicating the required assets for action extension as you suggests. Thanks for the suggestion :-). But how can i make the common code path to share between containing app and extension app. Any good way to achieve it?.

ios8 - how app extension can access the containing app images/assets/r...

ios8 ios-app-extension
Rectangle 27 0

I see a similar problem with my application with regarding to having loads of resources to copy up on deployment. I'm considering building a file handler that serves up image resources to the browser. I.e. When linking to images you'd having something like /filehandler.ashx?image=/ads/101/o3904838402384.jpg then you can have just have a config setting that points to different or the same filestorage folders for both Test and Live environments.

Here is a link to the fundamentals of how it works.

asp.net - Using IIS virtual directories in Visual Studio Web Applicati...

asp.net visual-studio iis virtual-directory staging
Rectangle 27 0

What you're defining is a Role Based Access Control System (I would suggest looking up resources on this). An RBAC system will have a separate table for users and another table for roles. There will be a many to many relationship between users and roles. Also, you will connect a permissions table to roles in another many to many relationship. The image attached represents how to implement this system:RBAC SYSTEM IN MYSQL

mysql - Efficient way to handle user roles - Stack Overflow

mysql database user theory roles
Rectangle 27 0

The guidance offered here in troubleshooting the problem helped greatly - thank you to everyone. I tested contents of an exported JAR; I used diagnostic code suggested by Kishan to determine if my code could "see" the image. I believe it might have something to do with the way Eclipse works/refreshes if I move images around in the file system instead of the Eclipse import function. Finally, in order to get it to work, I made the following changes: I created a new project and two sub-packages - one for 'resources' and one for my code class. Then I right-clicked > import on the resources package in Eclipse to get the image.

eclipse - Java Swing: Runnable JAR file does not work when including i...

java eclipse swing jar embedded-resource
Rectangle 27 0

Any Resource like image\font comes from path relative to your application URL, if you are configuring your server so that the component folder can be accessed and resources may be served from there, you may very well keep images in the component folder and use it, you just have to give the correct path traversing your project folders to your image.

Having said that is not a good practice, it may cause problems if you move your components, also its usually not a good idea to expose all the folders to the outside world. What you may do is have a assets folder where you can keep images and make them available for use.

Yes, I do have an assets folder. I use the regular angular-cli project structure. I just want to export a component to be used as independent, and having its own background image. This is a third party component that I'll use in different projects.

@csm86: you may also pass along an assets with the components, but you will have to copy them over to projects assets folder , at least now as including assets directly from imported library is not supported check this SO question. Also check this feature request.

angular - Angular2 image relative to component - Stack Overflow

angular angular2-components