Use of nlog.xml - nlog

I just started playing with nlog, and noticed that nlog.xml file is brought along with nlog.dll into the output folder of the application. It's not too clear for me what that file is needed for and whether i should carry it over as a part of my app install or can safely remove it. Any ideas?
Thanks,
Andrey

Yes, you can remove it from the output. The XML file contains the nlog data for the intellisense.

Related

Retrieve contents of a ZIP file on SharePoint without downloading it

I have written a bit of automated code that checks a SharePoint site and looks for a ZIP file (lets call it doc.zip). If doc.zip is found, it downloads it, and then checks for a file (say target.docx). doc.zip is about 300MB, and so I want to only download where necessary.
What I would like to know is that given SharePoint has some ZIP search capability, is it possible to write code using CSOM (c#) to find doc.zip, and then run some code to retrieve the contents of doc.zip without downloading it.
Just to re-iterate, I am comfortable with searching for files in a folder on SP, downloading the file, and unpacking zip entries. What I need is to retrieve a ZIP files content on SP without downloading it.
E.g. is there a SP command:
cxt.Load(SomeZipFileQuery);
cxt.ExecuteQuery();
Thanks in advance.
This capability is not available. I do like the idea. Having the ability to "parse" zip files on the server side and then download the relevant bits would be ideal. Perhaps raise this on uservoice to see if others also find this us https://sharepoint.uservoice.com
Ok, I have proven yet again that stubbornness will prevail.
I have figured out that if I use the /_api/search?query='myfile.zip' web REST API to search for my file, this search will also match ZIP files that contain the file I need. And it works perfectly.
Of course there is added (pain) of parsing an XML response, but it works very nicely for my code example.
At least if someone is looking for this solution here it is. I wont bore anyone with code, as the /_api/search has probably been done to death already on other threads.

Anybody has any ideas what exactly spWeb.Features.Add does?

anybody know what exactly below code does?
SPWeb.Features.Add(Guid, bool)
Does it use the .xmls in Template\Features\<-myFeature-> to install the feature and activate it? Or just activate it? Or something else?
Thanks!
The method you specified activates feature with specified id on specified SPWeb object. It does not install it. Here is MSDN link.
It actually uses xml files in "Template\Features\<-myFeature->" folder when you activate feature.
But if you change file in this folder you won't see any effect momentary because this files are cached. After changing files in feature folder you need to do iisreset and then activate feature in order to see the difference.

a number of log4j config questions

I'm working on a project and we want to handle our logging using log4j. I am running into some issues that I am not able to easily resolve looking at the log4j docs, or other documentation online.
I get the basic idea of putting logging code throughout the codebase and then having the properties file assort the logged data into a hierarchy of appenders and how to write out to a file. That's fine. This basically allows me to create greppable log files in one hard coded folder, such as this:
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log
But I have two basic questions: I want to have the log location be dynamic, such as:
log4j.appender.R.File={$processDir}/example.log
Also, every time the user runs this app, a folder will be created with the output files. I would like to have the log file be placed there, and I'm not sure how to accomplish that.
The other issue (although I think this will be a lot easier once the first issue is addressed...) is about creating a formatted log that does not necessarily reflect the process of how the app ran...for example, a title, followed by a list of all input files, a list of all output files, any warnings encountered.
I think for that I would create an object that implemented ObjectRenderer and write a doRender method that gave me the info I wanted.
Does that sound correct?
Thanks!
You can use variable with this syntax
log4j.appender.R.File=${processDir}/example.log
You must define the variables as system properties (es. -DprocessDir=...) or manually (after creating folder) with
System.setProperty("processDir",logDir);

How to change root directory of J2ME sun emulator?

I need to change the default root directory of sun mobile emulator. I know that you can create and delete roots in the appdb/filesysytem directory, but I need the root to be outside that directory lets say at my hard drive C:/root , is it possible? Thanks, hope you can help me.
I think the root folder is a property of Device configuration.
If you are working with the toolkit that ships with Netbeans looks for an ini file in the same directory where you found the appdb directory.
My best guss is tmp_jwc_properties.ini is the file you need. I haven't yet tried it though.
update
I spent some time trying to do this. But with no success so far.
The property we need to change is probably system.storage_root .
But the ini file gets over written with original values every time the IDE is restarted.
Found the original source of this temporary file in
My-NetBeans-path\mobility\Java_ME_platform_SDK_3.0\runtimes\cldc-hi-javafx\bin\jwc_properties.ini
As far as I could figure out, the IDE loads settings from this file and adds default values for settings that are not specified in this file.
I'm also new to these tool kits. Please leave a response here if you succeed in doing this.

SharePoint: "Failed to extract the cab file in the solution"

I'm receiving a "Failed to extract the cab file in the solution" error when I try to deploy my wsp using stsadm -o addsolution -filename...
I've open the wsp as a cab and checked that there are no duplicate files in there as I understand that can sometimes cause this issue.
The issue only started when I tried to include a custom field type as part of my solution, to do this I added the following to the ddf
..\CustomFields\ShortMonth\ShortMonthControl.ascx ..\CONTROLTEMPLATES\ShortMonthControl.ascx
..\CustomFields\ShortMonth\fldtypes_shortmonth.xml ..\XML\fldtypes_shortmonth.xml
and
<TemplateFiles>
<TemplateFile Location="CONTROLTEMPLATES\ShortMonthControl.ascx"/>
<TemplateFile Location="XML\fldtypes_shortmonth.xml"/>
</TemplateFiles>
to the manifest.
I've tried taking it back to just references to the ascx in both but it doesn't see to help.
Any ideas?
Check that you don't have any special characters in your files. They might have sneaked in as a result of copy-paste. For example, the way your code sample renders on this page, it has the (`), which shouldn't be there.
Do you need the "..\" in your DDF?
The issue is more likely due to invalid names for files you are deploying on SharePoint 14 hive folder. If you are using parenthesis ‘(‘, ‘)’ in file names or special characters like # in file names, this issue will occur.
Remove it and issue should vanish.
I just know I have had the same issues and I think I made a note of it at work somewhere (I´ll check that tomorrow and post back here if I find something). I just can´t remember how I fixed it right now (maybe it was a slash the wrong way / vs. \..hmm).
I did a search for it on google (which I think you have also done). Found this (check it out):
http://www.codeplex.com/wspbuilder/WorkItem/View.aspx?WorkItemId=7385
The List Instance Name I had was "MyListInstance (List Instance)". I removed the brackets from the name and it deployed without issues.
Check the .ddf file for a line that could have been accidentally duplicated. Apparently sharepoint doesn't like that!
A reboot solved my 'Failed to extract cab file' problem. There were some updates installed and an reboot was required. Was not clear that this was related but it helped.
Something would have gone wrong during the build of WSP.
Re build the WSP and Deploy- it should work fine.

Resources