Eclipse ADT 'Couldn't resolve resource' but works fine - eclipse-adt

I realised today that you don't have to have string values in 'strings.xml', dimensions in 'dimens.xml', etc and you can put them in any xml file or indeed combine them all into one. As long as they are findable in the res folder and match the correct xml element format.
However, while this works fine and runs, Eclipse gives me an error 'Couldn't resolve resource' in the activity view when I try and use a value from the above, but it works just fine. Does Eclipse only search known file names or am I not doing something to get it to work.
I appreciate this may not be the recommended approach but I actually found this method in Reto Meier's Android development book, and I figured if he is one of the engineers it must be ok to do so :)

Solved it, in the #prefix/varname you put the name of the file as the prefix, e.g. if the file was called bob.xml and the variable was called name it would be #bob/name.

Related

how to download source jar file for org.gradle.kotlin.dsl

Is there any way to download gradle-kotlin-dsl-6.6.1.jar source file by idea or manually with a link?
I wanted to read the source code of the functions in this dependency, I couldn't find the source code also.
I reasoned that, since the plugin is working for me, the code must've been downloaded. What I've found is that (in Android Studio under Linux), if I ctrl-click on a keyword in (anything, I think, but in this case) a build.kts file it takes me to the definition.
Doing this, I can then hover my cursor on the tab name and it shows me where the file is. Mine is way down under /.gradle, but the point is it does tell me where.
So, while I haven't found the jar file itself, I'm thinking that each of the files found like this are part of it. Does that help enough, or at least a bit?

How to Rename Complete Xcode Project using command line?

I am trying to rename my xcode project using command line but some how it's not renaming entire project. My project structure is bit more nested and I need to replace one string which is even a sub string of Project name and some files names I tried http://stackoverflow.com/questions/29824737/xcode-6-3-1-crashes-while-renaming-project/29830195#29830195, but it's not worked for me with this project but for some other project(which is sample app with not much nested structure) it worked well. . Any suggestions will be appreciated.
Here is a quick and nice solution for my question. By following this link I achieved what exactly I want , It saved my most of time, https://www.reddit.com/r/Python/comments/32r8i6/findreplace_string_in_files_filenames_and/

CoreData NSManagedSubClass files generating duplicate files?

I recently had to move my project to a different folder, and now when I run for some reason when I create the NSManagedSubclasses it seems to be making two copies. One in the correct location I tell it to save and another in Library->Developer->Xcode->DerivedData->WorkOrders-eamzgsjrwlhqoohhbyqilrvnbskh->Build->Intermediates->Workorders.build->Debug-iphoneos->WorkOrders.build->DerivedData->CoreDataGenereated->Workorders-> (NSSubclassed files here)
My problem is it won't compile now with the error below.
<unknown>:0: error: filename "Uploads+CoreDataClass.swift" used twice: '/Users/josephastrahan/Documents/Distribution.Tech/Work_Orders_iPhone/WorkOrders/Uploads+CoreDataClass.swift' and '/Users/josephastrahan/Library/Developer/Xcode/DerivedData/WorkOrders-eamzgsjrwlhqoohhbyqilrvnbskh/Build/Intermediates/WorkOrders.build/Debug-iphoneos/WorkOrders.build/DerivedSources/CoreDataGenerated/WorkOrders/Uploads+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Uploads+CoreDataProperties.swift" used twice: '/Users/josephastrahan/Documents/Distribution.Tech/Work_Orders_iPhone/WorkOrders/Uploads+CoreDataProperties.swift' and '/Users/josephastrahan/Library/Developer/Xcode/DerivedData/WorkOrders-eamzgsjrwlhqoohhbyqilrvnbskh/Build/Intermediates/WorkOrders.build/Debug-iphoneos/WorkOrders.build/DerivedSources/CoreDataGenerated/WorkOrders/Uploads+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
For some reason it thinks the same file is being declared twice, very bizarre and not sure how to fix this. I looked at other answers here (How to resolve error showing like filename used twice), but none of the answers solved my issue.
Note:: Also, If I delete the files they just come right back in the derivedData location you see in the attached image upon recompilation.
Even stranger, I was doing some tests, and I created only the workorder object but not the upload object and it compiles fine! I look in my build phases and don't see upload anywhere even though workorder has a relationship to it in code! It must be accessing the file from that derivedLocation for some reason.
Any help why is appreciated.
I think I found the solution but not sure why, so anyone that can elaborate would be appreciative.
I was reading a post here (XCode 8 generates broken NSManagedObject subclasses for iOS 10), and after reading the answer by Ryan H. I figured to give it a try.
By setting the codegen option to manual and setting the global space to my current project (see attached image), I deleted the files in the derived location and now they don't reappear and I don't get the duplicate error and everything compiles. I'm not sure how the codegen option even changed in the firstplace but something to watch out for sure.

Accessing an external file from MacRuby

I have done several small scripting/automation projects before but this is my first time using MacRuby and I couldn't find out at all why my project is not working.
This task would have been easy to fix if it was just a plain Ruby script. However, it needs a Mac GUI so I decided to use MacRuby for its Cocoa bindings.
The app itself is a simple form that will perform a calculation based from some data from an external CSV and some text fields and then show the results of the calculation.
My problem is that this code does NOT seem to work:
#arr_from_csv = CSV.read("data.csv")
Upon building the file, I get the following error:
[...]/ruby/1.9.2/CSV.rb:1335:in `open': No such file or directory - open() failed (Errno::ENOENT)
At first, I thought that I must have put the CSV file into the wrong directory inside XCode project's folder structure. I tried putting on the same folder as the script itself (app_delegate.rb). Didn't work. I tried putting it in the Resources folder, still didn't work.
Then, I decided to just use an absolute file path. So, I changed to code into:
#arr_from_csv = CSV.read("~/data.csv")
and copied the file into my home directory. It still can't read the CSV file.
Am I missing something? I'm sorry, this is my first time using MacRuby.
Thanks.
You should change the code to "/Users/xxx/data.csv".
Ruby does not expand "~" to "/Users/xxx".
Notice: xxx represents your login id.
I was able to solve my problem by using:
#arr_from_csv = CSV.read(File.expand_path("~/data.csv"))

VS2010 not embedding files into assembly

For some reason in VS2010 I can't embed any file into an assembly. These files have their Build Action property set to Embedded Resource as they should, but when the assembly is executed it founds no resources. For example, the following test code:
string[] list = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
string msg = (list.Length > 0) ? "Full" : "Empty";
MessageBox.Show(msg);
always shows "Empty" because GetManifestResourceNames() always returns an empty list.
This issue affects a project using nettiers in which is not convenient for that particular case to include the stored procedures into the DB, so they must be taken from the Procedures.xml file, which BTW is automatically set with Build Action= Embedded Resource after the classes generation, and then of course when a function tries to get any SQL script from it, the program fails.
I also created a couple of test projects where I tried to embed an xml and a gif, always with no success.
Update: The problem seems to be only for C#. I reproduced the test project in VB.Net and there the file does get embedded. I've noticed that in the output window, in the C# case, the compiler command line doesn't include the /resource option (which should be there followed with the name of the file to embed) whereas for the VB case it does appear.
Are there any global settings or configuration files anywhere for C# I should check? (The build options for the project have nothing strange there)
Does anyone have an idea of what may be happening and how to fix this?
Finally, I found the cause:
There was a wrong line inside the Microsoft.CSharp.targets file (located inside c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319). There was a tag written as:
<EmbeddedResourceF Include="#(_Temporary)" />
instead of
<EmbeddedResource Include="#(_Temporary)" />
Writing it right restored the ability to embed files
How that F appeared and why that file got altered in first place, I dont know... Despite being a .NET programmer for several years I just became aware today of the ".targets" files after searching the web about this issue, as never have had the need to look about the MSBuild stuff.

Resources