I'm trying to build a static site with stasis and serve my assets with Optimus. Pictures reside under /resources/public/imgs/ . I can serve individual pictures after loading them as follows:
(optimus.assets/load-assets "public"
["/imgs/pic1.jpg"
"/imgs/pic2.jpg"])
The following attempt to serve pictures by regex does not work though:
(optimus.assets/load-assets "public"
[#"/imgs/.*\.jpg"])
I'm getting No files matched regex /imgs/.*\.jpg, which seems implausible.
I've done some digging around the Optimus code and may have found the culprit. When called with a regex the optimus.assets/load-assets function starts building the paths from the return value of (optimus.class-path/file-paths-on-class-path), which – in my case – consists of only the following:
optimus.class-path/file-paths-on-class-path
=> ("boot/" "boot/tag-release.properties" "boot/bin/" "boot/bin/ParentClassLoader.class" "Boot.class" "META-INF/" "META-INF/MANIFEST.MF")
Since resources isn't a subdir of any of these directories I'm not surprised that I don't get a match. So maybe my question ultimately is why I'm getting only these directories here? Is it because I'm using Boot rather than Leiningen which is presupposed by the tutorials on Optimus?
EDIT:
It has definitely something to do with Boot or at least the way I've set it up. Following Alan Thompson's advice I've created a minimal Leiningen project – load-assets worked flawlessly. The very same setup with Boot however does not. Ultimately it boils down to (System/getProperty "java.class.path" ".") returning wildly different things: Boot gives me "/home/phylax/bin/boot", i.e. my boot binary, whereas in Leiningen it gives me a plethora of directories in my actual project… any idea as to what I'm doing wrong? How can I setup Boot to work with Optimus?
Many thanks for any guidance you may give me on this
Oliver
Related
I am new to Taffy API framework. Trying to run the examples with Lucee but I get this error
invalid component definition, can't find component [resources.throwsException]
But it works all fine with ColdFusion.
May I miss something that it's very obvious. Or some mappings are required in Lucee but not in ColdFusion.
Thanks.
Below are the screen caps for additional details.
The webroot is folder name is play_taffy, under webroot, it is taffy with the lib and examples folder.
There are a lot of things going on here, so let me unpack them one by one. Taffy is very powerful and has a lot of functionality. It is worth the time. The examples on the other had also try to cover a lot of stuff. They kind of use a non standard approach to the directory structure.
Short answer
Based on your error message, one of two thing are happening, either ./Taffy/examples/api_LogToEmail/resources/savesLog.cfc does not exist or it has a path mapping in <cfcomponent extends="taffy.core.resource" taffy_uri="/foo"> that is not resolving.
Long answer
I see that you are using Ortus CommandBox. (Shameless plug follows). I have written code and have code on how to do this. If you go to https://github.com/jmohler1970/Taffy_video , You can find the first video.
If you go to https://coldfusion.adobe.com/profile/jamesmohler and click on blog, you will find eight videos on this very topic.
Some code
Over on, https://github.com/jmohler1970/Taffy_video Taffy,
Consider the following directory structure:
box.json has
{
"dependencies":{
"taffy":"git://github.com/atuttle/Taffy.git",
"formutils":"git://github.com/jmohler1970/FormUtils.git",
"northamerica":"git://github.com/jmohler1970/NorthAmerica.git"
},
"installPaths":{
"taffy":"taffy",
"formutils":"formutils",
"northamerica":"db_setup"
}
}
Note in the code that Taffy is no where to be seen. We have a very clean structure. Taffy has not been applied to it yet. This is a good thing. Because I know where Taffy in a more normal way. I don't have to wonder why the examples are the way the are. I can just worry about my own code.
application.cfc
component extends="taffy.core.api" {
...
this.mappings['/resources'] = expandPath('./resources');
this.mappings['/taffy'] = expandPath('./taffy');
This is where I get the mappings to work. This is likely different from the Taffy examples, but is much closer to what you might use in a production environment
I need help, I have tried to find the solution but until now all I have found is stuff related to regex but I think the problem might be in another place.
I have a project locally (Windows 10 --> Xampp Latest version [Apache & Mysql], I use CodeIgniter as Framework, I developed a function which searches in my database using REGEXP (I use query builder)
It works fine and everything. Here I searched for saltarín <-- Note the accent on the letter i
So now that it works I have decided to update the online website but as soon as I was testing the online project I noticed an error jumps when I search something with accented characters or in this case the letter ñ which also works locally.
I checked my database configurations, in database.php I have dbcollat set to utf8_spanish_ci and my online database and tables are set to utf8_spanish_ci too, I think this must be a server configuration but I don't have an idea of what it really could be
In case you need it this is the piece of code which uses regexp
$this->db->where("lower(secret_colum_name) REGEXP", $this->secret_hehe);
Thanks a lot for your time, I really appreciate your help.
EDIT: I forgot to mention I'm using hostinger to host my website
It's me again. It was just as I suspected it was something about the server, After some hours of research I found out that my server didn't have the same extensions and configurations, you can use php -m command to find out your local extensions so you can then enable them on your remote server which in my case I had to do by c-panel but your case could be different.
I also changed my php version in the remote server and I'm not really sure about the next thing but it might have helped.
I had a setter defined in my model which did the next thing
$this->my_var = strtolower($my_var);
I removed strtolower and after all the steps previously mentioned I reloaded my site and now it works
This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.
Being new to unicorn I'm facing an interesting problem. Which raises a couple of questions. Number one is where can I review my predicate configuration?
Number two do I need to view this predicate configuration or is there some other way to resolving my valid root item.
Thanks
#Kamsars slightly unusual use of the word predicate; "Logic. that which is affirmed or denied concerning the subject of a proposition." might not be helping much either ;-)
Anyway. Unicorn 3 does come with a number of .config files, but as far as I can tell, no predicates are defined by default.
Look in App_Config\Include\Unicorn and find "Unicorn.Configs.Default.example". You can probably just remove the .example extension and fire up Unicorn with the default settings - that should get you started.
I also faced same issue recently and after spending around 2 hours found that Serialization folders was empty (No Serialization files was present under folder) for features and foundation projects.
After copying serializations files in features and foundations it start working for me.
Recently, I changed the output path of my project (a class library) from the default (../bin/debug) to:
$(OURDIRECTORY_BUILD)\Debug\
where OURDIRECTORY is an environmental (System) variable).
I also changed the UnitTest project (that was in the same solution) to reference the class library like this:
Reference Include="MyLibrary">
$(OURDIRECTORY )\Debug\MyLibrary.dll
Previously, I had just referenced it as a project reference. I made the change from project reference to the above as I was having build problems once I changed the Output Path.
Anyhow, now all is building and the unit tests are all passing BUT when I look at the NCrunch metrics, they are all at 0.00% AND the code coverage markers are all white (no coverage). Obviously, I do have coverage (very close to 100%) and something about changing the output path has confused NCRUNCH. How should I be handling this?
I am somewhat constrained to use this idea of a environmental variable for the output path as my boss is suggesting it. We have multiple libraries being built (not all in same solution) and are trying to make everything build-able on multiple machines. This scheme lets each engineer pick his own path for the environmental variable and even have a couple of code bases that he can switch between by changing the environment variable value.
Let me know if I can provide more details or if there is a more appropriate place to post.
Thanks,
Dave
I got no comments/answers here, perhaps this question was too product specific for StacKOverflow. My apologies. After I posted here, I came across a dedicated NCrunch forum site and posted there. I got some useful info. So for those of you looking deparately looking for an answer (as I was) I refer you to:
http://forum.ncrunch.net/yaf_postsm5457_NCRUNCH-code-coverage-markers-are-all-white-after-changing-output-path-of-project-under-test.aspx#post5457
If that link doesn't work in the distant future, search for the title,
"NCRUNCH code coverage markers are all white after changing output path of project under test", and if that doesn't work, the brief (and most important part of) answer is to use two paths like so:
<OutputPath Condition="'$(NCrunch)' == '1'">bin\</OutputPath>
<OutputPath Condition="'$(NCrunch)' != '1'">$(OUTDIRECTORY)</OutputPath>
This worked for me.
Dave