How to correctly add resources in a rc file - windows

I'm working on a project I did not start and I added
#define IDS_SELF_UPDATE_EXIT 266
and
IDS_CONFIRM_EXIT "Are you sure you want to quit?"
and I got the following error twice:
error RC2135: file not found
What am I doing wrong?

You seem to be trying to create a stringtable resource. The correct syntax is
STRINGTABLE
BEGIN
IDS_CONFIRM_EXIT "Are you sure you want to quit?"
END

Related

How to get file mode in ruby?

I'm new to ruby file IO. I have a function that takes a File parameter, and I need to make sure that the file is in read-only mode.
def myfunction(file)
raise ArgumentError.new() unless file.kind_of?(File)
#Assert that file is in read-only mode
end
Any help would be appreciated!
If you don't need to raise an error, you can use reopen, I think something like:
file = file.reopen(file.path, "r")
I can't find a way to otherwise verify that there isn't a write stream, but here's a bit of a hack that will work. Although I don't like exception throwing being used in the expected path, you could use close_write:
begin
file.close_write
# you could actually raise an exception here if you want
# since getting here means the file was originally opened for writing
rescue IOError
# This error will be raised if the file was not opened for
# writing, so this is actually the path we want
end
So all you need is 'make sure make sure that the file is in read-only mode', why not just set it as readonly with FileUtils.chmod.
Or if actually you just want to test if it is readonly, use File.writeable?
You can use file.readable?, which returns true or false.
Please check this link.

How to debug `Error while processing function` in `vim` and `nvim`?

TL;DR
How to find where exactly vim or nvim error started (which file?) when I'm interested in fixing the actual issue and not just removing the bad plugin? Anything better than strace and guesswork to find the error origin?
Issue
I often add a plugin to my vim or nvim config and end up getting errors on hooks (buffer open, close, write):
"test.py" [New] 0L, 0C written
Error detected while processing function 343[12]..272:
line 8:
E716: Key not present in Dictionary: _exec
E116: Invalid arguments for function get(a:args, 'exec', a:1['_exec'])
E15: Invalid expression: get(a:args, 'exec', a:1['_exec'])
The problem is, I have no idea where those come from, only get some line number of unknown file and I know it's not my vim/nvim config file.
Somewhere, you have a plugin that has defined a dictionary with anonymous-functions (check the help related to this tag).
For the curious ones, it's done this way:
let d = {}
function! d.whatever() abort
throw "blah"
endfunction
When you execute this function, you'll get the kind of error you're currently observing. That's why I stopped working this way to prefer:
let d = {}
function s:whatever() abort
throw "blah"
endfunction
let d.whatever = function('s:whatever') " a workaround is required for older versions of vim
" At least this way I'll get a `<SNR>42_whatever` in the exception throwpoint, and thus a scriptname.
That's the why. Now, back to your problem, AFAIK, the only things you'll be able to know are the two functions that have been called:
in line 12 of :function {343}, you've called
:function {272} which contains an error at line 8.
Thanks to these two commands (may be prefixed with :verbose, I don't remember exactly), you'll get the source code of the two functions, which you should be able to use in order to grep your plugins to know where it appears.

Expression Expected for Copying to clipboard

My first time being here.
I have a VB Project, and I want it to Auto Copy when the Link is changed. But I don't want it to copy at start. I tried making this, but I got the "Expression Expected" error.
Code:
If txtImgurLink.Text = "Imgur URL" Then
End If
If Else Then
Clipboard.SetText(txtImgurLink.Text)
You put an If followed by an Else, and that's not allowed on VB.
Try this instead:
If txtImgurLink.Text <> "Imgur URL" Then
Clipboard.SetText(txtImgurLink.Text)
End If

XCode: iOS5 localization script - Exit code 1

i'm using the popular pythonscript ( http://code.google.com/p/edim-mobile/source/browse/trunk/ios/IncrementalLocalization/localize.py ) to localize my storyboards in ios5.
I did only some changes in storyboard and got this error:
Please file a bug at http://bugreport.apple.com with this warning
message and any useful information you can provide.
com.apple.ibtool.errors
description The strings
file "MainStoryboard.strings" could not be applied.
recovery-suggestion Missing object referenced
from oid-keyed mapping. Object ID ztT-UO-myJ
underlying-errors
description
The strings file "MainStoryboard.strings" could not be applied.
recovery-suggestion
Missing object referenced from oid-keyed mapping. Object ID ztT-UO-myJ
Traceback (most recent call last): File "./localize.py", line 105, in
raise Exception("\n" + errorDescription) Exception:
* Error while creating the 'Project/en.lproj/MainStoryboard.storyboard' file*
* Error while creating the 'Project/es.lproj/MainStoryboard.storyboard' file*
* Error while creating the 'Project/fr.lproj/MainStoryboard.storyboard' file*
* Error while creating the 'Project/it.lproj/MainStoryboard.storyboard' file*
Showing first 200 notices only Command /bin/sh failed with exit code 1
I can't find a solution..
Maik
I think when you made the changes to the storyboard, you removed an Interface Builder object from the storyboard with the ID ztT-UO-myJ. Hence the error message shown.
Try to search for that ID in MainStoryboard.strings file and remove the whole line. After that try again to run the script.
If ibtool fails with
Interface Builder could not open the document NAME.storyboard because
it does not exist
Execute this in terminal:
killall -9 ibtoold
Found at:
http://oleb.net/blog/2013/02/automating-strings-extraction-from-storyboards-for-localization/
P.S. The link contains a better script. https://github.com/ole/Storyboard-Strings-Extraction
P.S. This answer has links to articles about may be even better scripts

Does clang allow preprocessor ==?

I am trying to compile PHP on my Mac OS X 10.8 and I am getting the following problem:
In file included from /Users/ryan/Downloads/php-5.4.5/ext/phar/util.c:23:
ext/phar/phar_internal.h:223:19: error: invalid token at start of a preprocessor
expression
# if SIZEOF_SHORT == 2
^
I'm not sure why this error is occurring as this looks fine to me. I have opened the header file and could make changes if not or remove the if all together as I know what my system should be, but I was wondering if this is the proper approach to this problem.
It looks like SIZEOF_SHORT expands to no tokens. You should investigate where SIZEOF_SHORT is being #defined (this may be on the command line via -DSIZEOF_SHORT=) and fix that to provide the right value.
Alternatively, you could use this:
#include "limits.h"
/* ... */
#if SHRT_BIT == CHAR_BIT * 2
I didn't really find a solution to this problem, but I removed the if's and left behind the line that would be processed anyway and the program compiled just fine. I really don't know what was wrong with this file.

Resources