Upload a single file with FineUploader in basic mode, error after second upload - fine-uploader

I am working on allowing only a single file to be uploaded via FineUploader in basic (Non-UI mode). I have set the 'itemLimit: 1' inside the validation options. This works fine and I see the error message: "Too many items (3) would be uploaded. Item limit is 1." if I select 3 files instead 1 file.
Now, when I select 1 file, and upload it, I click the upload button again and try to select 3 files again, but this time it says "Too many items (4) would be uploaded. Item limit is 1." even though I have selected only 3 files. So, now if I select only 1 file, it gives me an error saying: "Too many items (2) would be uploaded. Item limit is 1." even though only 1 file was selected. Is this a bug?
I guess what I am really asking, is, how do I make FineUploader accept only 1 file for upload at any given time when FineUploader instance has been constructed in basic (non-UI) mode?
Thanks.

I'm fairly certain that I already answered this concept in a very similar question:
In the case of itemLimit, the "session" is simply the current
instance of Fine Uploader. To start a new "session", you would
construct a new instance of that Fine Uploader object, either by a
page refresh or programmatically.

Related

Outlook.MailItem.DownloadState What it is and what it is used for?

I have seen the property Outlook.MailItem.DownloadState which is explained here.
Anyway I am not able to understand what is it and what is it used for. Some can explain me that?
To decrease the capacity of the local storage and save the bandwidth users may not download large emails getting only a small subset of data (metadata) which contains the headers describing the email.
There are possible states for the MailItem.DownloadState property:
The olHeaderOnly means only the header has been downloaded.
The olFullItem value means the full item has been downloaded.
If the message was not fully downloaded in Outlook you can set the MailItem.MarkForDownload property. It returns or sets an OlRemoteStatus constant that determines the status of an item once it is received by a remote user.
if(obj.DownloadState == olHeaderOnly)
{
'Mark the item to be downloaded
obj.MarkForDownload = olMarkedForDownload;
}
Outlook has header-only mode when it downloads headers first and full item (body and attachment) only when the message is selected - see https://www.officetooltips.com/outlook_2016/tips/how_to_set_outlook_to_download_only_e-mail_headers.html

How would I go about preventing the user from going into nonexistent records in a database (Visual basic 6.0 using Microsoft DAO 2.5/3.51)

Firstly, I am using visual basic 6 because that is what my school teaches.
We are meant to do a practice project for a supposed client that wants a program that allows employees to interact with a database.
I have made the First, prev,next and last button for record navigation, however, the issue is that the user is allowed beyond existing records using prev or next and it crashes the program with the error that there is no value
I have tried things like:
Making 2 counters, one for the current record that you are on and one for how many records are in the selected recordset. What I thought it would do is that if your current record tries to surpass the recordcount, it will cancel the action, but in the end the recordset.recordcount always returned 1 or 0 for some reason
I have also tried testing for if the primary key field is blank, but it returns the error that there is no such record
So how would I go about limiting the user from going beyond the records?
In the end, I was able to use an error handler for my problem to handle the error of the user trying to go beyond existing records.
What I did was:
On Error GoTo ErrHandler 'If any error happens go to ErrHandler
recordset.movenext
setFields 'Subroutine for setting the text boxes to their values
ErrHandler:
recordset.movelast 'If the user tries to go beyond the last record move him back
Update 2: I have also tried using the BOF and EOF people have been saying in the comments. I first had some confusion regarding them because I thought these properties were checking if it was the first record or the last record, but actually it was checking if you were outside of the file.
recordset.movenext 'move to the next record
If recordset.EOF = True Then 'If the user is outside the file
recordset.moveprevious 'Move him back
Else 'If he is not
setFields 'Set the fields
End If 'End the if
This is much simpler than the error handler.

Drupal 7 ignoring $_SESSION in template

I'm working on a simple script in a custom theme in Drupal 7 that is supposed to just rotate through different background image each time a user loads the page. This is my code in [view].tpl.php that picks which image to use.
$img_index = (!isset($_SESSION["img_index"]) || is_null($_SESSION["img_index"])) ? 1 : $_SESSION["img_index"] + 1;
if ($img_index > 2) {
$img_index = 0;
}
$_SESSION["img_index"] = $img_index;
Pretty simple stuff, and it works fine as long as Drupal starts up a session. However, if I delete my session cookie, then always shows the same image, a session is never started.
I'm assuming that since this code is in the view file that the view code is being cached for anonymous users and hence the session is never started, but I can't figure out how to otherwise do what I want.
Don't mess with session like /u/maiznieks mentioned on Reddit. It's going to affect performance.
I've had to do something similar in the past and went with an approach like /u/maiznieks mentions. It's something like this,
Return all the URLs in an array via JS on Drupal.settings.
Check if a cookie is set.
If it's not, set it and set it's value to 0.
If it's set, get the value, increase the value by one, save it to the cookie.
With that value, now you have an index.
Check if image[index] exists
If it does, show that to the user.
If it doesn't, reset index to 0 and show that. Save 0 to the cookie.
You keep caching. You keep showing the user new images on every page load.
You could set your current view to do a random sort every 5 mins. You would then only have to update the logic above to replace that image. That way you can keep something similar working for users with no JS but still keep this functionality for the rest.
You can replace cookies above with HTML5 local storage if you'd like.
#hobberwickey, I will suggest to create a custom module and implement hook_boot() in module. As per drupal bootstrap process session layer will call after cache layer everytime. hook_boot can be called in cache pages and before bootstrap process also. You can take more information here.

UiPath - slow opening Word & Excel

I'm working with Word & Excel within UiPath.
But opening these applications takes approximately 20 seconds ?
I created a test XAML file with just 2 activities
Open App
Message box
Properties for Open App
File Name : "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"
Selector :
It takes about 20 seconds ... no error message ... just a 20 second wait ?!?!
I have tested opening Word using the Windows Run command ... it opens immediately !
I am not sure what is the value of your Selector property but I think it's because of it. Open Application does two steps: first it opens the application, second it will search for the selector to create a Target Element for further use. The timeout for finding an element is 30 seconds by default, thus the slow response.
If you do not need the scope activity you can simply use Start Process activity.
If you are not sure what the selector should be you can set up a general one:
<wnd app='excel.exe' />

Codeigniter output cache: what parts of the called controller function get executed?

One of the main purposes of caching is to save resources and not do things like hit your database every request. In light of this, I'm confused by what all Codeigniter does in a controller when it encounters a cache() statement.
For example:
$this->output->cache(5);
$data=$this->main_model->get_data_from_database();
$this->load->view("main/index", $data);
I realize that the cached main/index html file will show for the next 5 minutes, but during these 5 minutes will the controller still execute the get_data_from_database() step? Or will it just skip it?
Note: the Codeigniter documentation says you can put the cache() statement anywhere in the controller function, which confuses me even more about whats getting executed.
I can answer my own question. NOTHING in the controller function other than the cached output gets executed during the time in which the cache is set.
To test this yourself, do a database INSERT or something that would be logged somehow (e.g. write to a blank file).
I added the following code below my cache() statement and it only inserted into the some_table table the first time I loaded the controller function and not the 2nd time (within the 5 minute span).
$this->db->insert('some_table', array('field_name' => 'value1') );
I think this can be verified enabling the Profiler in your controller and check if any query is done. Make sure this is enabled only for your IP if you're using it in Production environment.
$this->output->enable_profiler(TRUE);
-- EDIT 1 --
This will be visible only once. Soon after the cached page is stored, the profiles result won't be visible again (so you might wanna delete the file and refresh the page).
-- EDIT 2 --
You might also use:
log_message('info', 'message');
inside your model, then change in config.php, $config['log_threshold'] to 3 and check the log file.
-- EDIT 3 --
For sure the selection will be done unless you have enabled the database cache. In this case, in the cache folder you'll see the database selection cached.

Resources