relative path in res:// in resource files - winapi

I use in my win32 application embedded IE (IWebBrowser2)
And I load resources from resorces by res:// protocol
My .res file looks like
index.html HTML "index.html"
foo.js HTML "foo.js"
And it works.
But I need add resource with relative path, something like
? HTML "img\logo.jpg"
Is it possible to add such resource? And how?
In my index.html I user code like
<img src="img/logo.jpg">

Related

Codeigniter: Make uploads accessible

I'm using the upload class to allow users uploading file to the server.
Those files (e.g. profile images) should be accessible in the browser. Right now, the files stored under /application/uploads which of course cannot be accessed via browser.
Is there a way to make those uploaded files accessible via htaccess?
The only way I can think of, would be moving the files into the /public folder after being uploaded to /application/uploads
What's the best case to handle this?
your folder structure should be like :
---application
--- controllers
--- helpers
--- views
---asset
---system
---uploads
And Whenever you want to fetch/show image use
<img src="<?php echo base_url('uploads/'); ?>" >
Save the files in outside i.e. in public/uploads folder
Create .htaccess file in that folder
Add following line to .htaccess to secure the folder
Options -Indexes

Spring MVC resources not being mapped

my folder structure
enter image description here
And my code in the JSP page is
<script src='${pageContext.request.contextPath}/AppNameController.js'/>
I'm still getting 404 error
You have the prefix set to /WEB-INF/jsp but looking at your project structure your index.jsp is only within the /WEB-INF folder rather than inside the /WEB-INF/jsp folder.
Also change to:
${pageContext.request.contextPath}/resources/scripts/AppNameController.js

keeping safe assets folder in codeigniter

Hi i have this assets folder which has the following folder inside of css, images, uploads, and js folder i put the assets folder outside application. Im wondering that how could i keep it safe so that when users tried to type in the url like for example http:/test.com/assets it will redirect to application folder or somewhat it will says page not found. Cause ive noticed that when i type in the url http://test.com/assets it will go to the assets folder and which is vulnerable and people could see all the folders in the assets folder. can someone help me figued this thing out? Any help is muchly appreciated.
if you want to secure you folder then do one this create html file like this
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
and save it as index.html and put it on your assets folder whenever some try to access your url http://test.com/assets then this index file will execute and its shows Directory access is forbidden.

Including jquery in .js file

I am trying to clone an object using
var newObject = jQuery.extend(true, {}, oldObject);
as per John Resig's answer to What is the most efficient way to deep clone an object in JavaScript? .
All the information I can find on using libraries in javascript only show how to use a library within an html file... as in:
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
My code is in a .js file and i get the error that jQuery is not defined. How do I use jQuery within my .js file?
EDIT: I'm running this code in a server.js file on a node server. The server.js has an event handler that gives back the index.html file upon getting the "/" url. So the server.js file isn't included in the index.html file and therefore including jquery in the html file doesn't help me, if my understanding is correct.
You can't include it or link to it from within your .js file. You have to include it on the HTML page (<script src="/path/to/jquery"></script>), before you include your .js file.
Technically you could just copy and paste the jquery code above the code in your .js file, but it is usually a better idea to just include it on the page to avoid conflicts.

Spring web development images

Can anybody tell me or give me a link to go to which can tell me how to implement and display images step by step (I'm only beginning) on a webpage from a spring project
I'm using IntelliJ
Thanks
What's the URL of the page? The one that appears in the location bar of your browser?
That is the URL to which relative locations are resolved in the HTML code. So, if the URL is http://localhost/MyApp/foo.html, and the URL of the CSS inside the HTML code is ../../css/style.css, the absolute URL where the browse will try to find the CSS will be http://localhost/MyApp/../../css/style.css, which doesn't make sense.
I prefer always using absolute paths for images and CSS files (and other resources). Using JSTL, that makes it like
<link href="<c:url value='/css/style.css'/>" ...
The <c:url> tag takes care of prepending the application context (/MyApp) to the path.
Note that relative paths inside CSS files are not resolved relative to the page URL, but relative to the location of the CSS file itself. So the path in your CSS file is correct.

Resources