I tried use blobstate to list uncommitted blobs. But GetBlobsByHierarchyAsync with BlobStates.Uncommitted return same result as with BlobStates.None.
My code
Console.WriteLine("BlobStates " + blobStates);
await foreach (BlobHierarchyItem blobHierarchyItem in blobContainerClient.GetBlobsByHierarchyAsync(
BlobTraits.None, blobStates))
{
Console.WriteLine("Blob.Name " + blobHierarchyItem.Blob.Name);
Console.WriteLine("Blob.Properties.LastModified " + blobHierarchyItem.Blob.Properties.LastModified);
}
Result
BlobStates Uncommitted
Blob.Name testing_6.bin Blob.Properties.LastModified 25.03.2022 6:30:04 +00:00
Blob.Name testing_7.bin Blob.Properties.LastModified 25.03.2022 6:30:25 +00:00
Blob.Name testing_8.bin Blob.Properties.LastModified 25.03.2022 13:47:46 +00:00
BlobStates None
Blob.Name testing_6.bin Blob.Properties.LastModified 25.03.2022 6:30:04 +00:00
Blob.Name testing_7.bin Blob.Properties.LastModified 25.03.2022 6:30:25 +00:00
Blob.Name testing_8.bin Blob.Properties.LastModified 25.03.2022 13:47:46 +00:00
Do I something wrong? Thanks
You can list blobs in a flat listing structure, or hierarchically
Hierarchical listing returns blobs as though they were organized into folders
To list blob versions or snapshots, specify the BlobStates parameter with the Version or Snapshot field. Versions and snapshots are listed from oldest to newest
Reference Links: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-list#list-blob-versions-or-snapshots
Related
I have an application that runs the old version of the spring application. The application has the function to create date objects using Date.parse as follows
Date getCstTimeZoneDateNow() {
String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
def zonedDateString = new Date().format(dateFormat, TimeZone.getTimeZone('CST'))
Date date = Date.parse(dateFormat, zonedDateString)
return date // Tue Oct 18 20:36:12 EDT 2022 (in Date)
}
However, the code above is deprecated. I need to produce the same result.
I read other posts and it seems like Calender or SimpleDateFormatter is preferred.
And I thought SimpleDateFormatter has more capabilities.
This post helped me understand more about what is going on in the following code
SimpleDateFormat parse loses timezone
Date getCstTimeZoneDateNow() {
Date now = new Date()
String pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
SimpleDateFormat sdf = new SimpleDateFormat()
sdf.setTimeZone(TimeZone.getTimeZone('CST'))
// cstDateTime prints times in cst
String cstDateTime = sdf.format(now) // 2022-10-18T20:36:12.088Z (in String)
// JVM current time
Date date = sdf.parse(cstDateTime) // Tue Oct 18 21:36:12 EDT 2022 (in Date)
return date
}
Here my goal is to return the date object that is in the format of Tue Oct 18 20:36:12 EDT 2022
The format is good. However, like the post says, when I do sdf.parse(), it prints in JVM time.
This means, the format is good but the time zone is off.
How can I get the exact same result as before?
It does not have to use SimpleDateFormatter. Could be anything.
Thank you so much for reading and for your time.
Perhaps the important thing is, that the Date is always neutral to the timezone. Given example shows what is to be expected to work from the Java specs:
def format = new SimpleDateFormat()
format.setTimeZone(TimeZone.getTimeZone("CST"))
println new Date()
def date = format.parse(format.format(new Date()))
printf "parsed to %s%n", date
printf "formatted to %s (%s)%n", format.format(date), format.getTimeZone().getDisplayName()
In the output, notice when using the Format and when the toString(), a different time is shown accordingly, which is perfectly fine, since first we format and then parse again in the same format, thus the same time-zone. Later, we use the Date.toString() to output the date, this time using the system default time-zone which is always used when Date.toString() is called. In the output, the time-zone shift is reflected:
Thu Oct 20 09:22:58 EDT 2022
parsed to Thu Oct 20 09:22:00 EDT 2022
formatted to 10/20/22 8:22 AM (Central Standard Time)
I am running a job where in source, i have oracle sql query to read the rows, followed by sorter transformation. Below are session logs where we can see after the start of sorter transformation [srt] it takes more than 3 hours to process 410516 rows. I am failing to understand if sorter is taking time or source query?
Appreciate your response.
READER_1_1_1> RR_4049 [2022-06-26 23:40:13.888] SQL Query issued to database : (Sun Jun 26 23:40:13 2022)
READER_1_1_1> RR_4050 [2022-06-26 23:49:01.147] First row returned from database to reader : (Sun Jun 26 23:49:01 2022)
TRANSF_1_1_1> SORT_40420 [2022-06-26 23:49:01.148] Start of input for Transformation [srt]. : (Sun Jun 26 23:49:01 2022)
READER_1_1_1> BLKR_16019 [2022-06-27 03:04:51.901] Read [410516] rows, read [0] error rows for source table [DUMMY_src] instance name [DUMMY_src]
READER_1_1_1> BLKR_16008 [2022-06-27 03:04:51.902] Reader run completed.
TRANSF_1_1_1> SORT_40421 [2022-06-27 03:04:51.909] End of input for Transformation [srt]. : (Mon Jun 27 03:04:51 2022)
TRANSF_1_1_1> SORT_40422 [2022-06-27 03:04:52.180] End of output from Sorter Transformation [srt]. Processed 410516 rows (6568256 input bytes; 0 temp I/O bytes). : (Mon Jun 27 03:04:52 2022)
TRANSF_1_1_1> SORT_40423 [2022-06-27 03:04:52.181] End of sort for Sorter Transformation [srt]. : (Mon Jun 27 03:04:52 2022)
WRITER_1_*_1> WRT_8167 [2022-06-27 03:04:52.201] Start loading table
WRT_8035 [2022-06-27 03:09:47.457] Load complete time: Mon Jun 27 03:09:47 2022
I know when an account is created in UTC. If the account is cancelled before 2am PST the next day then the account needs to be removed, otherwise it is not removed until later. I'm having trouble coming up with the actual statements to use in Carbon. For example:
$account->getAttribute('created_at');
returns
Illuminate\Support\Carbon #1597790786 {#3432
date: 2020-08-18 22:46:26.0 UTC (+00:00),
}
Therefore I need to know if now() is >= 2020-08-19 02:00:00.0 PDT/PST.
How should I do that?
Switch your date in the timezone to consider "tomorrow 2am" then re-switch in UTC for the comparison:
$cancellation = $account->getAttribute('cancelled_at');
$creation = $account->getAttribute('created_at');
if ($cancellation < $creation->tz('PST')->modify('tomorrow 2am')->utc()) {
// remove
}
I have timestamp for one of my http sampler in following format
Tue Nov 07 10:28:10 PST 2017
and i need to convert it to in following format
11/07/2017 10:28:10
i tried different approaches but don't know what am i doing wrong.Can anyone help me on that.Thanks.
It's very similar to how you'd do it in Java.
Here's an example:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
String string = "Tue Nov 07 10:28:10 PST 2017";
// Original format to convert from
DateFormat formatFrom = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
// Target format to convert to
DateFormat formatTo = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.ENGLISH);
// Parse original string, using original format
Date date = formatFrom.parse(string);
// Convert to a target format
String result = formatTo.format(date);
// Just to show the output, not really necessary
log.info(result);
One catch: since target format omits the zone, local zone of the computer will be used. So for example original time 10:28:10 PST will be converted to 10:28:10 for computer in PST zone, but for computer in EST zone it will be converted to 13:28:10
I heard Groovy is the new black so given:
Date class in Groovy SDK has format() and parse() methods
It is recommended to use JSR223 Test Elements and Groovy language since JMeter 3.1
you can get the date converted in a single line of Groovy code like:
Date.parse("EEE MMM dd HH:mm:ss zzz yyyy", 'Tue Nov 07 10:28:10 PST 2017').format("dd/MM/yyyy HH:mm:ss", TimeZone.getTimeZone('PST'))
Demo:
I cant seem to get skip_time_zone_conversion_for_attributes or active_record.time_zone_aware_attributes working in my Rails 5 App
in my application.rb I have
config.active_record.default_timezone = :local
config.active_record.time_zone_aware_attributes = false
And in my model I have
self.skip_time_zone_conversion_for_attributes = [:start_date, :end_date]
Yet when the stat date and end date are sent back to the client as JSON, they are always converted into the clients timezone. I dont want that as I need to show the client the server time.
Why is this not working? Do I need to do something else to ensure that the start_date and end_date in my model, do not get translated to the users time zone ?
Thanks
This is occurred due to rails have several pitfalls. Most importantly because Time.now and Time.current are completely different things.
config.time_zone = 'Berlin' # Your local time zone
config.active_record.default_timezone = :local
config.active_record.time_zone_aware_attributes = false
This are fields present within application.rb, make things happen for all your model's time related attributes.
For example -
if you didn't mention any time_zone then it will take 'UTC' by defaults
post = Post.create
post.created_at # => Mon, 22 Apr 2019 06:43:08 UTC +00:00
Time.current # => Mon, 22 Apr 2019 06:43:35 UTC +00:00
Time.now # => 2019-04-22 12:13:40 +0530
In your database and Time.current shows the 'UTC' format but Time.now is picking your local timezone.
Now if you change time_zone,
config.time_zone = 'Berlin'
Then,
post = Post.create
post.created_at # => Mon, 22 Apr 2019 08:45:48 CEST +02:00
Time.current # => Mon, 22 Apr 2019 08:46:05 CEST +02:00
Time.now # => 2019-04-22 12:16:00 +0530
Now in your database, created_at value stored with 'UTC' time zone but when you retrieve that field it shows in set time_zone format means in 'Berlin'. But still your Time.now is in your local timezone.
Now as per your question I am using skip_time_zone_conversion_for_attributes, and changed my model with time_zone is 'Berlin'
class Post < ActiveRecord::Base
self.skip_time_zone_conversion_for_attributes = [:created_at]
end
Then,
post = Post.create
post.created_at # => 2019-04-22 06:56:31 UTC
Time.current # => Mon, 22 Apr 2019 08:56:53 CEST +02:00
Time.now # => 2019-04-22 12:26:46 +0530
As per skip_time_zone_conversion_for_attributes method it's skip for that attributes, when I retried the attribute - created_at it shows it in 'UTC' format instead of my set time_zone 'Berlin', working as expected.
So this could be helpful for you to understand and check your setting before set it in JSON.
For more information you can refer this link -
https://api.rubyonrails.org/classes/ActiveRecord/Timestamp.html
https://makandracards.com/makandra/46009-working-with-or-without-time-zones-in-rails-applications