Log4net - Change file name based on logged user data - asp.net

I am trying to use this pattern to create a dynamic file name: "Debug_%property{LogUserName}.txt"
The value of %property{LogUserName} is retrieved from log4net.LogicalThreadContext.Properties["LogUserName"], which is filled when the user logs in.
In the first time, it works perfectly. The file gets named like Debug_user1.txt (for example).
If user1 disconnects, and the user2 logs in (at the same browser) a new file should be created, but it's not happening.
It seems that the LogicalThreadContext.Properties are final variables, and can't be changed at runtime.
I tried to change the FileAppender.File property, but it doesn't work too.

Resolved this problem with stuartd's tip: calling ActivateOptions().

Related

Access 2013 unable to add new line to form and runtime error 2105 when trying to a new record

I am migrating several adp files to accdb so that it can work under access 2013 but one problem is driving me nuts:
I have a form on which I cannot see an empty line to add new data.
the form property allowaddition is on
the recordsource of the form is an sql View to which I can add a new line directly from access (so it is not readonly)
I am forcing the AllowAddition on the code when initializing security with me.allowadditions = true (this used to be enough to make it work in the old adp)
I have a button to add a new line to the form that runs on_click and gives me a runtime error on this line of code Docmd.gotorecord , , AcNewRec
The runtime error is "2105 : you can't go to the specified record".
This tells me that there is something that is still read only.
the SQL View has an index as well as all the table used in it.
I tried to replace the view in the recordset of the form by a table and still not working.
Am I missing something? What else can I do to be able to add a new record to my form (or view)?
Thank you
Try setting focus to one of the textbox controls in your form before calling the new record, something along the lines of
me.txtControl.SetFocus
The reason is, SQL Server backend allocates new records differently than Access backend, and Access does a bit of magic for you in the interface, so I've found sometimes explicitly setting focus to a text control will fix this issue.
Depending on how things are structured with your Access app, if that suggestion doesn't work, then you might need to go the extra step of programatically creating the new record (blank fields except for primary key) in SQL Server first and then refresh the Access form and then setfocus to the newly created record (e.g. either the last or first record depending on your recordsource sort order)

firebase doesn't showing realtime data inserting and not able to remove data [duplicate]

Read-only & non-realtime mode activated to improve browser performance
Message pops up in my project and I'm unable to delete the nodes as well
Also I read this https://groups.google.com/forum/#!topic/firebase-talk/qLxZCI8i47s
Which states :
If you have a lot of nodes in your Firebase (say thousands), we need to create a new element for each node and modern browsers simply have limitations of how many DOM elements you can add to a page
It says:
To resolve this problem, don't load your Firebase Dashboard at the root of your Firebase, but instead load it lower down in the hierarchy
I do not get what it means
How do I get back to my Realtime Dashboard?
If you want to delete a high level node when this is activated, I recommend doing this.
Open up a text editor and type in { }. Save this file as "blankJSON.json".
Go to high level node you want deleted and select it, once it opens up and shows you all the nodes that need to be removed, select the three bars at the top right and select "Import JSON", (It would be safe to first "Export JSON" If you don't have backups, in case you make a mistake here). Import the JSON file we created earlier titled "blankJSON".
This will delete all of the data inside.
Once again, I highly suggest you make a backup before doing this, It's extremely easy to make a backup and also it is much easier than you would think to upload this blankJSON to the wrong node and then erasing a bunch of important data.
When it detects that it's downloading too many nodes from your database, the Firebase Console stops using real-time mode and switches to read-only mode. In this mode it requires less work from the browser, so it is more likely that the browser will stay performant.
To get back to realtime mode, you have to go to a location that has fewer nodes. So say that you start loading the database at the root, that means that "pseudo address bar" at the top of the data tree will say:
https://<your-project>.firebaseio.com/
And then will show the list of items. Now click on the URL in that pseudo address bar and change it to:
https://<your-project>.firebaseio.com/<one-of-your-keys>
And hit enter. The data tree will reload with just the node from one-of-your-keys and down and will likely switch to realtime mode again.
Every node key in firebase is a link, you can open a sub-node in a new tab and then edit that sub-node and its children.
Right click on a sub-node you want to edit or delete
Select open link in a new tab
Edit the sub-node in the new tab
1) Click on the Node you want to mass delete
2) Import an empty .json file (just containing curly braces, {} )
3) The node value will be set to null, in other words it is deleted or rather overridden with an empty node!
What you can do is to have an OnClickListener and call the remove value method to your DatabaseReference, like this:
mCart.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
mDatabaseReference.removeValue();
}
});
I have the same problem... I'm a bit surprised because I though Firebase could easily scale to support huge amount of data (example million users, etc.).
I have a node with 80000 sub-nodes (each object has his own push-id) and I cannot delete or perform any action on it because the real-time doesn't work in Firebase console.
I think the only way to udate or delete the data it's to do it via JAVA code :(
Multiple times trying to load the specific keys can be tiresome. There is a python library that could do this for you easily.
http://ozgur.github.io/python-firebase/
I needed to delete a lot of keys and this helped me do that in one go.
What I do is export the entire tree, edit/add the node I want using an editor, then import the JSON and overwrite the previous node/tree. Problem solved! Risky though 😁

Change URL in new Firebase (from May 2016)

Earlier when using Firebase, there was an option to use our own url like myapp.firebaseapp.com (including firebaseapp.com part). But from May 2016, when I create a project, it gets an auto-generated URL like my-app-1c75b.firebaseio.com, and I cannot find place to edit that (because 1c75b part in URL is not nice). I want to know is there any way to edit that like before?
Note - I don't want to use a paid domain like www.example.com. I just want to customize my Firebase URL as myapp.firebaseapp.com
When you create a project in the new Firebase console, it will indeed add a "random" code to the project name. There is currently no way to prevent this code in the new console.
When you upgrade an existing project from firebase.com into the new console, the app name will remain unchanged. So if you already have myapp.firebaseapp.com on a firebase.com project, you will keep that URL after importing/upgrading.
When creating a new project, you get an screen where you can enter the name.
In the textfield for project-id ou can enter a project-id.
your project-id needs to include a dash
when it doesn't, it will say something like, it is already used or it places the dash itself, with some custom characters.
The project-id itself is fixed, so you should create a new project and copy everything.
When you create your project the url is based on the project name you give. If your project name is "Foo Bar", your url will be https://foo-bar.firebaseapp.com (assuming it isn't already taken).
Last week Create Project window was showing possible firebase.com subdomain that will be assigned while you were typing project name. It's first come - first served basis so if you type a name already taken it automatically adds some character-number combination at the end.
Today same window doesn't show that while typing, you can only see it after you create your project and go to settings dashboard, there is no way to change given subdomain on the same dashboard.
Update 10.07.2017
I'm getting random hex number added from time to time, I can't always get plain name even if name is supposedly original one.
If you choose a name unique enough within Firebase, they will give you a domain for your app as in https://myapp.firebaseio.com.
I tried several times, sometimes it gives something like https://project-(long-random-number-sequence).firebaseio.com and other times something like what you've encountered. My personal experience shows if you give your app a name suffixed with "app" then you have a higher chance of being unique and getting the "nice" URL.
Scroll down in 'Manage Site' and create a new site, then deploy there.
You can't change your domain, but you can change the host! You can make as many sites as you want.

Keep a log of user actions in Symfony2

I'm working on a project where I'm using Symfony2 (latest) and SonataAdmin. I need to keep log of users actions by logging:
action/event date/time (when and at which time the user did something)
the user himself (the id of the user who did the action/event)
affected rows (which rows was affected by for example changing some data in a form)
I find in KnpBundles and over Google without success, can any give me some tips or ideas? Or if someone did this before give me some code as start point? Take in mind that I'm using SonataAdmin and this is a bit complicated.
The stofDoctrineExtensions (a Symfony wrapper for Gedmo's DoctrineExtensions) Loggable extension would do this for you.
This extensions can be set to log a username, changed (create, updated & remove) and the data changed (if specified) in a table that can then be used to log and/or revert changes.
StofDoctrineExtensions (Wrapper of below)
Gedmo\DoctrineExtensions (Loggable)

No error message available, result code: E_FAIL(0x80004005)

My application uses windows authentication. user login with their username/password and upload an excel sheet.
The issues is while uploading the excel ,one user able to upload the excel file but another user get an error:
No error message available, result code: E_FAIL(0x80004005)
The code is same. I don't know what's the actual problem is? Please Help?
Not 100% sure, but can you check:
The user has permissions on the folder where the excel is uploaded.
If you are using OleDBCommand, and the file name is invalid then too you might get same error.
// User was neither granted nor denied read access.
// Pass the callback method the integer
/// value of E_FAIL.
hr = unchecked((int)0x80004005);
This is how the implementation of return value usually goes. The comment may point you the possible problem.
Only Temporary solution:- 1) If you try to upload same file name multiple times this problem will raise. So try to upload distinct file name every time.
I had same problem now got the solutions,
1 => Timeout
(try to insert or update part by part)
2 => Cannot Overwrite
if you trying to create a sheet with same name...

Resources