Post-build event command line; how to level up in path and how to handle spaces - post-build-event

My goal is to copy a XML file from one project to another project in my solution after a succesful build.
copy $(SolutionDir)Xenos.Core.API\XmlDocumentXenosCoreApi.xml $(ProjectDir)App_Data\XmlDocumentXenosCoreApi.xml
This would translate in this.
copy D:\XENOSTFS2015\Sprint Development\Diversification Sprints\Xenos Main\Xenos.Core.API\XmlDocumentXenosCoreApi.xml D:\XenosTFS2015\Sprint Development\Diversification Sprints\Suite\XenosWebAPI\App_Data\XmlDocumentXenosCoreApi.xml
But I want the first argument of copy to be like this, so the solutiondir should go two levels up. A
D:\XENOSTFS2015\Sprint Development\Diversification Sprints\Suite\XenosCoreApi\XmlDocumentXenosCoreApi.xml
Also I'm worried that the spaces will prevent the copy from executing, how can I solve this?
Thx in advance !!

Related

howto watch a rotating file with node.js?

I'm trying to watch log rotated files with node.js and parse each line for keywords. The Problem is: after logrotate I'm still watching the old file because of the opened file discriptor.
I'm new to this and have two questions:
Is it advisable to check after every line the inode and if it's not the same close the fd and read the file 'filename' again?
What's the best way achieving this? Trying to avoid callbacks and use events instead or is there an library already?
Thanks!
When the log file is rotated, it is being renamed.
The fs.watch function in node.js has the ability to notify you when the file changes.
http://www.nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener
Try something like:
fs.watch('filetowatch', function (event) {
if (event === 'rename') {
// close the file descriptor you are reading from and re-open.
}
});

is it possible to obfuscate while using soma.js dependency injection?

While looking at how to make JavaScript source code more secure I came upon a lot of 'solutions'. but most people said the same thing; "It's not possible to make your source code 100% secure", "try obfuscation", "run your code server side", etc, etc. After reading a lot posts here on stackoverflow, and other sites I came to the conclusion that a combination of minifying and obfuscating would do the job (for me).
But here is the problem: we are currently using soma.js with dependency injection, and the way we set it up it does not work well with obfuscation. It's basically this:
var session = function(id, sessionModel){
this._sessionmodel = sessionModel;
}
mapping:
injector.mapClass("sessionModel", project.SessionModel, true);
Obfuscation will then rename the sessionModel in the function to for example 'A', but the mapping that was done on SessionModel by the injector still remains 'sessionModel' and not 'A', this then basically breaks the code.
I've read this post which is about the same subject Dependency Injection and Code Obfuscation, but it does not provide a real answer to my problem so I decided to write my own question.
Any tips/hint/suggestions are welcome.
Thanks in advance.
EDIT
It seems you can tell Yuicompressor to exclude certain identifiers by putting in 'hints' into the files like this: "identifier:nomunge, identifier2:nomunge".
var session = function(id, sessionModel){
"sessionModel:nomunge";
this._sessionmodel = sessionModel;
}
I tested this and it works but that means you'll have to put it in yourself which is a lot of work if you have to do that for every script, especially if you have a very big project..
Gonna look into it further, and update this post if anything new pops up
EDIT 2
It's been a while, I only work 1 day a week on this =S.
As said before you can get it working by telling it which identifiers to exclude.
For that I looked into regular expression to get the "mapped classes" programmatically, since doing it by hand is just insane.
What I basically did was instead of putting every hint in by hand, I made a identifier, for example "#nomunge"; and used a simple replaceregexp task to find it and replace it with a string containing all the identifiers. This string is build by loading the script and going through it with a tokenfilter.
<target name="build hints">
<loadfile property="hints" srcFile="${temp.loc}/all.js">
<filterchain>
<tokenfilter delimoutput=":nomunge,">
<ignoreblank/>
<containsregex pattern="${regexp}"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo message="${hints}"/>
</target>
<replaceregexp file="${temp.loc}/all.js"
match="#nomunge"
flags = "g"
replace = "target:nomunge, dispatcher:nomunge, injector:nomunge,${hints}"
/>
This seems to do the job, for now...
I'm behind the soma.js framework, feel free to ask me questions on the google group, happy to help.
This might help a bit more:
https://groups.google.com/forum/#!topic/somajs/noOX2R4K58g
Romu

How to make jedit file-dropdown to display absolute path (not filename followed by directory)?

All is in the title.
If a have opened the three files:
/some/relatively/long/path/dir1/file_a
/some/relatively/long/path/dir1/file_b
/some/relatively/long/path/dir2/file_a
The file dropdown contains:
file_a (/some/relatively/long/path/dir1)
file_a (/some/relatively/long/path/dir2)
file_b (/some/relatively/long/path/dir1)
And that bother me because I have to look on the right to differentiate the two file_a, and on the left for the others. This happens a lot to me mostly because I code in python, and thus I often have several __init__.py files opened.
How do I get jedit to display
/some/relatively/long/path/dir1/file_a
/some/relatively/long/path/dir1/file_b
/some/relatively/long/path/dir2/file_a
config:
jedit 5.1.0
java 1.6.0_26
mac osx 10.6
Unfortunately this is not easily possible currently, I just had a look at the source and this is not configurable.
You can:
Submit a Feature Request to make this configurable (good idea in any case)
Create or let create a startup macro that
registers an EBComponent with the EditBus that listens for new EditPanes getting created
retrieve the BufferSwitcher from the EditPane
retrieve the ListCellRenderer from the BufferSwitcher
set a new ListCellRenderer to the BufferSwitcher that first calls the retrieved ListCellRenderer and then additionally sets the text to value.getPath()
Try the Buffer List plugin as to whether it maybe suits your needs
Now follows code that implements the work-part of option two, runnable as BeanShell code which does this manipulation for the current edit pane. The third line is not necessary when done in an EBComponent, this is just that the on-the-fly manipulation is shown immediately.
r = editPane.getBufferSwitcher().getRenderer();
editPane.getBufferSwitcher().setRenderer(
new ListCellRenderer() {
public Component getListCellRendererComponent(list, value, index, isSelected, cellHasFocus) {
rc = r.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
rc.setText(value.getPath());
return rc;
}
});
editPane.repaint();

Using Vim as a Javascript Sandbox: How do I write a buffer to node and read the result in another buffer?

I'm attempting to utilise vim as a complex javascript sandbox editor.
The end goal is to have a left window with my code, and a right window with dynamically updating output from the node.js executable.
I'm currently utilising:
map <Leader>r :silent :w !node -p > /tmp/jsconsole<cr>
silent !cat '' > /tmp/jsconsole
botright vnew
e /tmp/jsconsole
set buftype=nofile
set bufhidden=hide
set nobuflisted
setlocal noswapfile
" set nomodifiable " maybe later once i can figure out how to lock/unlock
wincmd h
set buftype=nofile
set bufhidden=hide
set nobuflisted
setlocal noswapfile
autocmd QuitPre * :qa
set autoread
This works, kind of. I find that vim's autoread function is unreliable.
Ideally, I would be able to run a left buffer's contents without saving the file through node -p via stdin, read stdout and stderr into the right hand side buffer, which would not be editable.
I'm aware there are a few ways to do this, but lack the knowledge to glue it together.
Reading the output to a register and showing that register in a chosen buffer
Utilising r!
Utilising quickfix or :make
How can I pass a buffers contents, through stdin to node -p, capture stdout and stderr and pass them to a different buffer?
There are various scripts more or less doing what you want.
AsyncCommand
QuickRun
Others…
I recently came upon the very minimalist pipe2eval that lets you evaluate the current line or visual selection and inserts the result below, in a comment.
Dumb example:
my_array = [1,2,3];
my_array.push(4);
my_array[3];
// 4
Pursuant to Randy's comment, utilising vim-slime on top of tmux with the node REPL in the right hand tmux pane does indeed work. This is a pretty valid way to answer this question specifically, although I'm still interested in the vim-contained answer.
Although I haven't set it up yet, I plan to make this a specific tmux config managed by tmuxinator.
You can use https://github.com/metakirby5/codi.vim just install it and add this lines to your .vimrc
let g:codi#interpreters = {
\ 'javascript': {
\ 'rightalign': 0,
\ },
\ }

How to change program's name in Makefile.am

Currently the code in makefile.am is like this:
performancetestsdir = $(prefix)/tests/#PACKAGE#/performance-test
performancetests_PROGRAMS = eventwindowperformancetest
I would like to make the program 'eventwindowperformancetest' in the name of 'oldeventwindowperformancetest' after building
What should I do?
Thanks
several possibilities:
change the name in the Makefile.am to the one you want (what's the point in building program as XY when you really want to have it as XX?)
use the "--program-transform-name" flag to configure to transform the name of your output program
add a post-build hook that renames your file for you. something like:
all-local: oldeventwindowperformancetest
oldeventwindowperformancetest: eventwindowperformancetest
cp "$^" "$#"

Resources