Show current class file [closed] - objective-c

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I would like to NSLog the current class file that the simulator loads, in order to make sure the class file loaded currently. What parameter should I code?
Is it possible?
Thanks.

You can use the preprocessor directive __FILE__ to access the file path of the currently executing code. This flag is set at compile-time, but for usage in an NSLog, this shouldn't matter.
You can use it like this:
NSLog("Log called from file %s", __FILE__);
==> Log called from file /Developer Projects/Objective-C/Mac/test/test/AppDelegate.m
There are also other preprocessor variables you can use, such as __LINE__ and __PRETTY_FUNCTION__
You can define it in a preprocessor macro, and use it as such:
#define NSFileLog(format, ...) NSLog(#"%s:%d :: " format, __FILE__, __LINE__, ##__VA_ARGS__)
...
NSFileLog(#"Test Log");
==> /Developer Projects/Objective-C/Mac/test/test/AppDelegate.m:20 :: Test Log

Related

Cmake commands as macro arguments [duplicate]

This question already has answers here:
How to call a function in CMake whose name is stored in a variable
(5 answers)
Closed 11 months ago.
I want to use a CMake macro as a text replacement tool to call a command. This is something I am familiar with in C, but I am not sure if this is allowed in CMake.
what I want to be able to do:
MY_MACRO(
MY_COMMAND(ARGS)
)
I have tried a few different variations on this general idea on how to implement this, but I am not sure it is possible.
MACRO(MY_MACRO)
# do stuff
${ARGN} # Call MY_COMMAND
# do stuff
)
I figured this out based on this thread:
https://gitlab.kitware.com/cmake/cmake/-/issues/20800#note_951424
I haven't tested very thoroughly, but this is the gist at least:
MACRO(MY_MACRO)
#stuff
CMAKE_LANGUAGE(EVAL CODE ${ARGN})
#stuff
ENDMACRO(MY_MACRO)

I need convert UTF-16 to ANSI [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How i can convert UTF-16 to ANSI in a .cmd file?
Your code has a UTF-16 LE byte-order-marker at the beginning of it, which an obfuscation technique developed on DosTips. Either remove it via a hex editor, or save this code as deobfuscate.bat and drag your script onto it:
#echo on &setlocal
if "%~1"=="" exit /b
if /i "%~x1" neq ".bat" if /i "%~x1" neq ".cmd" exit /b
<"%~1" ((for /l %%N in (1 1 8) do pause)>nul&findstr "^">"%~n1___%~x1")

Numpy cannot save with certain name(s) [duplicate]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Why in Windows, can't you name a folder 'con'?
Whenever I try to name a folder as "con" (without the quotes) it defaults to its original name.
Why does it do this?
Back in the MS-DOS days, "con" had a special meaning. It referred to the console, and allowed you to treat it like any other file. For example, you might create a new text file by typing copy con new.txt. Then you could enter your text and hit ^Z when finished.
The thing is, you can still do that. Therefore, as far as the file system is concerned there is already an object out there named con. There are other reserved names as well, but I see that while typing this those names have been provided already in other answers.
Do not use the following reserved device names for the name of a file:
CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
Source: MSDN
Other names, such as drive names, cannot be used as well:
CLOCK$, A:-Z:
Source: Microsoft support
Actually you can rename the folder to con
use this in the command prompt and this creates a system folder named con on your C: Drive
md \\\\\.\\\C:\con
to remove this folder you need to use this in the command prompt
rd/s \\\\.\\\C:\con
And just for those that are wondering "so why would you?" - my name is CON and if I wish to use that as my folder I WILL so "bugger you MS"
Con "OzDing"
This dates back to MS-DOS. Reading or writing to a file named "CON:" read/wrote from the console. I imagine Windows is still supporting this for backwards compatibility.
From Microsoft TechNet:
Several special file names are reserved by the system and cannot be used for files or folders:
CON, AUX, COM1, COM2, COM3, COM4,
LPT1, LPT2, LPT3, PRN, NUL

Asp.net with c# file upload from excel using sql server 08 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Exception Details: System.Web.HttpException:
'c:/users/agaabhis/documents/visual studio
2010/Projects/WebApplication4/WebApplication4/Files/' is a physical
path, but a virtual path was expected.
Source Error:
Line 23: Line 24: //Upload and save the file Line 25:
string excelPath = Server.MapPath("c://users/agaabhis/documents/visual
studio 2010/Projects/WebApplication4/WebApplication4/Files/") +
Path.GetFileName(FileUpload1.PostedFile.FileName); Line 26:
FileUpload1.SaveAs(excelPath); Line 27:
Source File: c:\users\agaabhis\documents\visual studio 2010\Projects\WebApplication4\WebApplication4\Default.aspx.cs Line: 25
If you read the documentation for Server.MapPath on msdn, you'll find that you cannot hand it physical paths (which have a drive as a root). You need to give it paths relative to the server. For example:
string excelPath = Server.MapPath("Files/") + ...;

How to import dbpedia into neo4j? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to import dbpedia into neo4j.
I download the dbpedia from here: http://wiki.dbpedia.org/Downloads37
Any idea?
I am currently doing the same thing. I found that the biggest problem for this is the indexing so the best solution is to write a java program that extracts the statements with md5 hashes into a triple file like follows:
subjectHash \t predicateHash \t objectHash \t subject \t predicate \t object \n.
In another file you will need to store the nodes (aka subjects and objects of statements):
nodeHash \t nodeValue
The code for this procedure can be downloaded from my github:
https://github.com/eschleining/DbPediaImport.git
Compile it with mvn package and it creates a jar file in target that takes the gzipped dbpedia files as arguments. If you only have the bz2 files you can transform them like follows:
for i in *.bz2 ; do bzcat "$i" | gzip > "${i%.bz2}.gz"; done &
Now run:
java -jar ConcurrentDataTableWriter-0.0.1-SNAPSHOT.jar yourdbpediaFolder/*.gz
Then you sort the newly created files manually with the sort utility of linux:
gunzip -c nodes.gz | sort -k2 -u | gzip > nodes_unique.gz
And the triples file:
gunzip -c triples.gz | sort -k1,3,2 -u | gzip > triples_unique.gz
Now you can compile the batch inserter of my repo with maven3 (mvn package) and run it in the same directory as the nodes_unique.gz and triples_unique.gz files it creates a Neo4J database directory named "DbpediaNe04J" (mind the typo "0 instead of o).
I found this to be the fastest way since it only looks up an index once for each subject/object pair in a triple.
Feel free to add datatype nodes as properties and so on. I currently have implemented each triple as a relationship between two nodes.