How to add some styling to log file in CI - codeigniter

I am using CodeIgniter for a little while and I want to add some styling to the CI log system.
Why did I need to add some styling in the log file?
1. CI log messages system is very congested.
2. message formats are not tidy enough.
What do I want to add in CI log file?
1. Different indication for different log messages.
2. Align the log messages so we can see and understand properly.
3. Highlight some messages for references.
So, What the changes should I have to do in the log file or maybe I should drop this idea of changing the log messages formats and styling.

Related

Slack: Updating the same image URL that changes daily to show all the changes

I have a Slack channel that I send an image to on a daily basis from a third party service.
The issue is that they do not change the image url so it is always:
http://website.com/image.url
even though the image itself changes, as in it shows different information.
In Slack it recognises the URL and changes all the previous days image to match today.
I tried adding a query to the end of the image eg:
http://website.com/image.url?timestamp=12345678
but Slack is clever enough to ignore that.
Does anybody know of a way to get around this other than make a copy of the image and save it as a different URL?
Thanks.
Slack probably caches the image, either locally on your device or on their servers (the former seems more likely). You might want to try fully closing and reopening Slack if you haven't already. Several other questions describe different behavior (i.e., Slack dynamically retrieving the image so that it is updated to reflect the newest version), so this may be due to something they have changed or a temporary issue on their end. I would try refreshing and/or logging out and back in again, then re-uploading the image if this doesn't work.

analysis is not showing on OBIEE12c?

After uploading RPD, when I'm trying to create report nothing in UI is showing except report job and action, why it's happening like that?
That can't happen after a simple RPD upload since the RPD doesn't control permissions and you clearly lost permissions.
You must have used a BAR file or done something to the security.

Display File contents on the Web Browser UI

I am looking to deploy a Web Interface to display file that has log contents. I am collecting the log details and storing them on my WebServer. I have an Apache interface that lets user download/view the file from the browser.
However, the challenge here is that they don't look pretty. I want to show them in a UI that can highlight/color contents. I tried to simply pull the contents of the file and display in a Text Area which works but that would mean doing a lot of manual work to make it fancy. Wondering if something already exist that i could re-use ?
As a future enhancement I was also hoping that the UI would find for patterns in the file and highlight them in the UI. For example, If the file contains connection refused messages just highlight them in red etc..
I am not sure if I should build something from scratch or something already exist that i can re-use ?
I would use CKEditor and set to read-only or completely hide the editor controls.

Best practice for multiple (single) file uploads in JSF 2.2

Our JSF 2.2 web application may have the situation, that users have to fill in a formular where they have to upload multiple files.
Example
First Name: [ John ]
Last Name: [ Doe ]
Photo: [ choose File ] (no file chosen)
Passport: [ choose File ] (no file chosen)
I know that there is multiple upload forms like Primefaces but this doesn't fit to my requirement, since I want to know which file is either the photo or passport, and I need to validate the input, because the files are mandatory.
Option 1: Multiple single file uploads
The first option would be like in the example above. Just use multiple single <h:inputFile> tags.
Pros:
users select files when they are asked for
users know this kind of file uploads
Cons:
since there are more <h:inputFile> tags, every file upload will be processed during the form submit: so we might have to limit filesizes so that users won't run into problems
I did not try this: is it even possible to use multiple single file uploads in the same <h:form>?
Option 2: Upload in popup + callback
I have seen this sometimes and wondered why it was implemented that way. When you have to upload a file it opens a popup with a file upload. After the upload, the popup is closed and the form has selected the uploaded file.
Are there any hints/tutorials for this technique? Especially the between-window-communication is unclear for me.
Pros:
nearly the same as the standard way
Cons:
problems with popup-blockers
for this approach, fallback mechanics have to be implemented: what if the user cancels the form? when are uploaded files deleted, so that there are no garbage files?
Option 3: Upload in modal dialog + callback
To eliminate the popup blocker problem we could use a modal dialog for an upload. So we choose to upload a file, a new modal <p:dialog modal="true"/> opens and there inside the <h:inputFile> handles your upload.
I did try this and found out that AJAX uploads are not possible with <h:inputFile> or <p:inputFile mode="simple"> (can't find the source of BalusC's comment, but there is a similar one). My whole site got rerendered and my formular input was lost.
Pros:
nearly the same as the standard way
no problems with popup blockers
Cons:
even possible?
Option 4: "Upload Manager"
My last idea was to provide an upload manager. This is a view where users can see their uploaded files in a list/table and add files with a single <h:inputFile>, add descriptions, and so on. So the files are already in the system and get deleted after (say) 72 hours if they are not referenced.
Users then click on a link when they have to input a file, and choose the corresponding file from a list/table in a modal dialog. Therefore users have to upload their files first, before even filling a form, which is quite a pain, so it would be nice if they could also upload files in the modal dialog. (this would look like a view, where they have a single <h:inputFile> and a list of their already uploaded files). But there we have the same AJAX problem like in Option 3...
The only way I see to get around this, is to write something at the beginning of a form like:
For this form you need the following files in your upload manager:
- Photo
- Passport
Pros:
technically: good because it's always only one file in a submit (AJAX?)
no specific fallback mechanisms (except a 72hrs cronjob deleting unused files)
users can upload multiple files for the (say) next 20 forms - this is good in our web application
Cons:
users are not used to this technique
even possible?
Do you have any other ideas to handle with this situation? I can't be the only one with this.
Or are multiple file uploads like Primefaces good to configure for validations?
I hope you can help me out with this brainstorming

Logging image downloads

I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either PHP or JavaScript.
Yes, my preferred way of doing this would be via PHP. You'd have to set up a script which would load up the file and send it to the user browser. This script would also be able to log the download somewhere (e.g. your database).
For example - in very rough pseudo-code:
download.php
$file = $_GET['file'];
updateFileCount($file);
header('Content-Type: image/jpeg');
sendFile($file);
Then, you just have your download link point to download.php instead of the actual file. (Note that updateFileCount and sendFile are functions that you would have to provide, of course - this script is an example of a download script which you could use)
Note: I highly recommend avoiding the use of $_GET['file'] to get the whole filename - malicious users could use it to retrieve sensitive files from your web server. But the safe use of PHP downloads is a topic for another question.
You need a gateway script, like ImageDownload.php?picture=me.jpg, or something like that.
That page whould return the image bytes, as well as logging that the image is downloaded.
Because the images being saved are on their computer locally there would be no way to get that kind of information as they have already retrieved the image from your system. Even with javascript the best I know that you could do is to log each time a user presses the second mousebutton using some kind of ajax'y stuff.
I don't really like the idea, but if you wanted to log everytime someone downloaded an image you could host the images inside a flash or java app that made it a requirement to click a download image button. That way the only way for them to get the image without doing that would be to either capture packets as they came into their side or take a screenshot.
Your server access logs should already have the request for the non-thumbnailed version of the file, so you just need to modify the log format to include the sessionid, which I presume you can map back to a user.
I agree strongly with the suggestion put forward by Phill Sacre. For what you are looking for this is the way to go.
It also has the benefit of being potentially able to keep the tracked files out of the direct web path so that they can't be direct linked to.
I use this method in a client site where the images are paid content so must be restricted access.

Resources