I don't know when this started happening or if things have changed but the _host_Info param is not being passed by the framework to my Excel Add-In in Excel Online.
It passes an empty "et=" parameter which is OK in this case since I'm in dev mode. The Excel desktop client is still passing it.
This is required by my add-ins to switch functionality between Excel Online and Excel for Windows.
I've checked the docs and can't find that anything has changed.
To append to Sudhi's answer: with the official API coming as per the link in Sudhi's answer, we've gone ahead and also added a "shim" for the API in the OfficeJsHelpers library.
The shim still uses the workaround code that Sudhi mentions -- window.sessionStorage['hostInfoValue'] -- but it wraps it in an API very similar to what is coming in the official Office.js. Once the official API is available, we'll switch the shim code to make use of that instead. The beauty of this approach is that if you use OfficeJsHelpers via an NPM package, all you have to do is update your package dependency, and you'll suddenly go from an unofficial and potentially-fragile workaround to an API that relies on 100% officially-exposed properties -- all without changing your own code! Likewise, if at that time you decide to switch back to using the official Office.js version, the similarity of the APIs (essentially just namespace differences) should make it trivial to switch over the implementations.
The helper APIs are OfficeHelpers.Utilities.host (which will return WORD, EXCEL, etc.) and OfficeHelpers.Utilities.platform (which will return IOS, PC, OFFICE_ONLINE, or MAC). The constants are defined in OfficeHelpers.HostType and OfficeHelpers.PlatformType.
You can find the NPM package at https://www.npmjs.com/package/#microsoft/office-js-helpers, and either install it via NPM, or use a CDN like Unpkg to quickly try it out: https://unpkg.com/#microsoft/office-js-helpers#0.4.2/dist/office.helpers.min.js
console.log(OfficeHelpers.Utilities.host);
console.log(OfficeHelpers.Utilities.platform);
if (OfficeHelpers.Utilities.platform === OfficeHelpers.PlatformType.OFFICE_ONLINE) {
console.log("Yep, I'm on the web client");
}
I hope you find the above helpful as an interim measure, and we'll be sure to update this StackOverflow thread (and the OfficeJsHelpers code) once the official API is released.
Jim and others who may be affected by this change: it is unfortunate that an unrelated change meant to improve the add-in experience caused the query string parameter in online platform to be removed. Note that URL query parameters and session storage settings are used to launch and setup the add-in environment and are not meant for developer consumption. However, we understand the importance of this to the developers as described in this thread.
Hence, we are adding formal APIs to make this information available. Please see the specs that describes upcoming APIs: https://github.com/OfficeDev/office-js-docs/tree/ContextAdditions_OpenSpec
Until the APIs become available (should be very soon), you could use the following temporary workaround. The same query host_info_ parameter value is available in the following variable: window.sessionStorage.hostInfoValue. Please note that this should be considered a temporary measure and you should switch to using the formal API as soon as they are made available. I'll update the this thread when the API is released, which should be available for all supported Office versions.
If you have any comments, please leave your comments on the specs directly in Github specification branch using the links provided.
UPDATE:
Please see my answer above, instead (https://stackoverflow.com/a/40963500/678505), as the scenario is now possible.
[Old response:]
Jim, could you describe your scenario more? Why is it that you need to distinguish between Online and Desktop?
For the disappearance of host_info_: you won't find it in the docs, because host_info_ was never in the docs. Anything not documented is an internal API, which might change as needed by the internal workings of Office.js. We take back-compat very seriously, but only for actual official documented APIs.
Without an API, there's not much you can do to tell the two apart (or rather, not without relying on other bits of internal workings which might also change over time). We've discussed this internally before, but found it surprisingly difficult to point to a particular scenario where the platform information was necessary and legitimate ("legitimate" in the sense that if you're using platform information to check whether an API is available, for example, that's precisely what we don't want you to do; we want you to use Office.context.requirements.isSetSupported instead).
If you can share your scenario details, I might be able to advise an alternate way of determining whatever you need, or have a solid scenario to bring back to the team.
I am planning to upgrade my company's intranet from liferay 6.0.6CE to 6.2CE. I have done some research on it but I am still confused on API part. Will my custom portlets need only recompilation or would they need a complete rewriting. I am also concerned about my Theme and Exts. I have a lot of customization in my exts and my theme. What would be the best way to move ahead?
Also I have a NFS file server and SOLR search server configured with my current deployment. Need suggestions on that too.
I've heard recently, that the Migration Tool (6.1 to 6.2) now also supports themes. It won't be pixel perfect though. Check what it can do for you.
There have been some APIs that changed. Contrary to the comments given to your question, I'd say "It depends": I don't know how much of Liferay's API you use or if you just add functionality on top. You'll have to find out for yourself. The migration tool might help you.
The things that have changed the most are: Themes (using Bootstrap, as of 6.2) and Document Library (now including ImageGallery, which was still available in 6.0). Migration of data should be smooth if you follow the documented upgrade path. Migration of your portlets and plugins will definitely require recompile (within the new plugins sdk or updated maven dependencies) and probably adaptation to some changed API calls. I've seen instances where this was simple, but I've also seen hard cases.
As there have been no more updates for 6.0 CE for quite a while, I'm recommending to upgrade though (other than #FeinesFabi in the comment). If you want to have a long-term stable platform that you don't need to maintain for yourself, EE would be the way to go (supported for ~7 years after release)
For ext changes, you'll have to be aware that there are no guarantees: Ext allows you to change the inner implementation of Liferay, and that's what nobody strives to keep stable, even in minor updates. If you're using ext, you'll always have to be aware of incompatible changes. Ext allows you to keep your changes out of the official sourcecode - so they're well isolated. It doesn't say anything about the underlying implementation to be stable. With great power (ext) comes great responsibility. Keep your ext as small as possible - whatever you can do outside of ext should be done outside and use the public API.
The basic upgrade path (for Liferay itself, not your plugins) is quite well documented in the User's Guide.
I want to identify the current profile of windows phone.Is it is silent/ring.How can I check it.Please give suggestion.
This is not possible with the current Windows Phone SDK.
You can vote for this API to be added to a future version of the SDK here: Extend the API to query phone volume and vibration settings, maybe even set them.
As of wp SDK 8 you can't, nor can you adjust the volume or view/change current profile.
see this link
You can do these sort of things with windows store apps so perhaps it will come with the blue.
Humm seems I took to long to post but as olivier stated its high on the wanted list
user1021583 have you thought about running back over your questions and marking answers? you seem to have a lot of questions and none are marked as answers
Does anyone know if there are any WiX standard UI dialouges out there that you can use to integrate into your own WiX msi package?
For example:
Editing Connection Strings to database
Editing paths to log files in web.config/app.config
Setting up users for a Windows Service
Setting up WCF Endpoint addresses and other parameters
This would be very helpful!
I've haven't seen any UI dialog package either.
WixEdit has a dialog editor which I've heard is pretty useful, but I haven't used.
War Setup is a pretty good utility. It's been about a year since I've used it, so I don't remember if it has a dialog editor or not.
Edit: I couldn't think of the one I really loved, but I just found it: WixAware. It has probably the best dialog editor. The only thing is that it's trialware and the full version is $800.
Not today no. They aren't that hard to write though.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Anyone have experience for both? How do they stack up against each other?
We are planning on using one of them for logging in an enterprise application.
References:
log4net
nlog
EDIT: We have no existing dependencies to either nlog or log4net.
I was recently tasked to "prototype up some loggin'" for an upcoming project. I didn't have any logging framework experience. I researched, ran through tutorials, made toy apps, etc. on Log4Net, NLog, and Enterprise Library for a few days. Came back 3-4 weeks later and put them together into a cohesive demo. Hopefully some of this is useful to you.
My recommendation for our project is this:
Use a logging facade (e.g. Common.Logging, SimpleLoggingFacade) to avoid direct dependencies.
If we end up using Enterprise Library for other facilities, then use it for Logging, too.
If we end up using something with a dependency on Log4Net, use Log4Net.
If none of the above, use NLog. Which I'd prefer.
That's based on these findings (opinions!):
All 3 frameworks are capable and can do some sophisticated things. We want a quality solution, but frankly don't need ultra high performance or 60 types of event sinks.
All 3 have very similar basic concepts.
Each has its own cool tricks, like really advanced routing, or dynamic log filenames, file truncating, etc.
All 3 are pretty well documented in their own way.
For a complete newb like me, they were all a little awkward initially. No drastic differences here for the basics. I got over it.
When revisiting things a few weeks later, NLog was clearly the easiest to resume. I needed very little brush up on it. With Log4Net, I had to revisit a few online examples to get going. With EntLib, I gave up and did the tutorials all over again from scratch - I was totally lost.
I couldn't figure out how to get EntLib to do some things like log to the database. It might be easy, but it was beyond my time limit.
Log4Net and NLog have a small in-code footprint. EntLib is spammy, but I'd use a facade over it anyway.
I accidentally mis-configured EntLib and it told me at run time. Log4Net didn't. I didn't have an accidental mis-config with NLog.
EntLib comes with a nice looking app.config editor, which you 100% need. NLog has a config file schema so you get "intellisense". Log4Net comes with nada.
So obviously I like NLog so far. Not enough to use it in spite of having another solution available, though.
A key consideration that hasn't been much discussed is support and updates.
Log4Net hasn't been updated since version 1.2.10 was published April 19, 2006.
In contrast, NLog has been actively supported since 2006 will soon release NLog 2.0 supporting many platforms that didn't exist when log4net was last updated such as:
NET Framework 2.0 SP1 and above, 3.5 & 4.0 (Client and Extended profiles)
Silverlight 2.0, 3.0, 4.0
.NET Compact Framework 2.0, 3.5
Mono 2.x profile
Having had an experience with both frameworks recently, I thought I can share my views on each frameworks.
I was asked to evaluate the logging frameworks for an existing web application, I narrowed down my choices to NLog (v2.0) and log4net (v1.2.11) after going through various online forums. Here are my findings:
Setting/starting up with NLog is dead easy. You go through the Getting started tutorial on their website and you are done. You get a fair idea, how thing might be with nlog. Config file is so intuitive that anyone can understand the config. For example: if you want to set the internal logging on, you set the flag in Nlog config file's header node, which is where you would expect it to be. In log4net, you set different flags in web.config's appSettings section.
In log4net, internal logging doesnt output timestamp which is annoying. In Nlog, you get a nice log with timestamps. I found it very useful in my evaluations.
Filters in log4net - You better check my this question - log4net filter - how to write AND filter to ignore log messages and if you find an answer/solution for this, please let me know.
I understand, there is a workaround for this question, as you can write your own custom filter. But something which is not easily available in log4net.
Performance - I logged around 3000 log messages to database using a stored procedure. I used simple for loop (int i=0; i<3000; i++... to log the same message 3000 times. For the writes: log4net AdoAppender took almost double the time than NLog.
Log4net doesnt support asynchronous appender.
It was sufficient comparison for me to choose NLog as the logging framework. :)
For anyone getting to this thread late, you may want to take a look back at the .Net Base Class Library (BCL). Many people missed the changes between .Net 1.1 and .Net 2.0 when the TraceSource class was introduced (circa 2005).
Using the TraceSource is analagous to other logging frameworks, with granular control of logging, configuration in app.config/web.config, and programmatic access - without the overhead of the enterprise application block.
.Net BCL Team Blog: Intro to Tracing - Part I (Look at Part II a,b,c as well)
There are also a number of comparisons floating around: "log4net vs TraceSource"
For us, the key difference is in overall perf...
Have a look at Logger.IsDebugEnabled in NLog versus Log4Net, from our tests, NLog has less overhead and that's what we are after (low-latency stuff).
Cheers,
Florian
First look at the rest of your stack.
If you are using NHibernate, it utilizes Log4Net directly.
Other frameworks might have other specific loggers they need.
Other than that: both work fine.
I've settled on Log4Net myself. It can be a pain to configure, and if it isn't configured correctly it is a pain to figure out what went wrong. But you can make it do almost anything you would want from a logger.
If you don't have a standing issue with Log4Net, here is an article I wrote on how to get started with it:
http://elegantcode.com/2007/12/07/getting-started-with-log4net/
Well .. I used Enterprise library for database logging tasks
and now I switched to NLog due to performance bottleneck.
some comparison info :
http://pauliusraila.blogspot.com/2010/10/solving-database-logging-bottlenecks.html
I echo the above and do prefer nLog. Entlib is needlessly bloated.
Re:Log4net One thing that ALWAYS gets me with log4net is forgetting to add the following to the global.asax to init the component:
log4net.Config.XmlConfigurator.Configure();
If you go here you can find a comprehensive matrix that includes both the NLog and Log4Net libs as well as Enterprise Lib and other products.
Somebody could argue that the matrix is done in a way to underline the features of the only commercial lib present in the matrix. I think it's true but it was useful anyway to drive my choice versus NLog.
Regards
As I noticed, log4net locks their output files the whole time application is running, so you can't delete them. Otherwise they are similar.
So I prefer NLog.
Shameless plug for an open source project I run, but given the lively discussion about which .NET logging framework is more active I thought I'd post an obligatory link to Serilog.
To use within an application, Serilog is similar to (and draws heavily on) log4net. Unlike other .NET logging options, however, Serilog is about preserving the structure of log events for offline analysis. When you write:
Log.Information("The answer is {Answer}", 42);
Most logging libraries immediately render the message into a string. Serilog can do that too, but it preserves the { Answer: 42 } property so that later on, using one of a number of NoSQL data stores, you can properly query events based on the value of Answer.
We're close to a 1.0 and support all of the modern (.NET 4.5, Windows Store and Windows Phone 8) platforms.
I second NLog too because it works with unmanaged code too.
I suppose it could be possibe to use log4net and log4cxx together, but NLog handles both managed and unmanaged code out of the box.
I also looked at Common.Logging, a facade that makes abstraction of the logging api, it supports log4net, NLog and Entreprise Library. I don't think i'll use it, but i like how they use lambdas to improve performance when logging is disabled (a feature shared with NLog and probably others).
You might also consider Microsoft Enterprise Library Logging Block. It comes with nice designer.
I think the general consensus is that nlog is a bit easier to configure and use. Both are quite capable, though.
Based on my experience, SmartInspect beats both NLog and log4net.
Its extremely easy to use, documentation is great, and you can view and filter previously logged messages with their interactive log viewer, which is a huge real world advantage.
One thing I like is the tabbed views of data, like the browser tabs in Chrome. Each tab can provide a different filtered view of the log.