I am using Couchbase java sdk client 2.7.11 with Couchbase 6.0 community addition. While performing upsert it gives me success response, but when I fetch the document or see through Couchbase UI, it’s not available.
//getClient returning me "api com.couchbase.client.java.Bucket" instance
private static final RetryWhenFunction RETRY_POLICY =
RetryBuilder.anyOf( TimeoutException.class,
TemporaryFailureException.class,
RequestCancelledException.class,
BackpressureException.class,
CASMismatchException.class)
.delay(Delay.exponential(TimeUnit.MILLISECONDS, 50))
.max(3)
.build();
int expiryTime = Instant.now().getEpochSecond() + (10 * 60);
StringDocument document = StringDocument.create("ABC_Test",expiryTime , "SomeValue");
StringDocument savedDocument = getClient().async().upsert(document).retryWhen(RETRY_POLICY)
.doOnError(exception -> {
String msg = "Unable to update a document = " + exception.getMessage();
LOGGER.error(()->msg);
})
.doOnCompleted(() -> LOGGER.debug(()-> "Succesfully saved document with key \"" + key))
.doAfterTerminate(() -> LOGGER.debug(()-> "Processing save document with key \"" + key + "\" Completed."))
.toBlocking()
.singleOrDefault(null);
if(savedDocument==null) {
LOGGER.error(()-> "Document with id couldn't be saved: " + key);
} else {
LOGGER.debug(()-> "Saved document: \n" + savedDocument);
}
I faced the similar issue when trying to use QueuePush. The Queue push gave me the success response but Queue pop says queue itself doesn’t exist. I intend to use both of the saving within next 5 sec for say. I do not have any load test running that could indicate towards Async delay behavior.
//expirationTime is quiet ahead in future.
getClient().async()
.queuePush(queueName, queueElement, MutationOptionBuilder.builder().createDocument(true).expiry(expirationTime))
.retryWhen(RETRY_POLICY)
.doOnError(exception -> LOGGER.error(() -> “Unable to add element '”+ queueElement +"’ in queue ‘" + queueName +
"’ Exception = " + exception.getMessage()))
.doOnCompleted(() -> LOGGER.debug(()-> "Succesfully saved document in queue “” + queueName))
.doAfterTerminate(latch::countDown).subscribe();
Both of above scenario have been noticed intermittently. Could you please suggest to diagnose this one? Does Community Version has a way to enable Document Level Auditing?
I have posted the similar question on Couchbase forum too, trying to bring it for bigger audience https://forums.couchbase.com/t/intermittently-couchbase-save-not-happening/28006 and get the right direction.
Thank you in advance.
Regards
i'm working on a web application with laravel and i made a "project space" for users. in this "project space" i have to display a table of files for each folder of the "project" so i used Ajax to change the content of the table,but this work fine on my localhost but it doesn't on online server.
i made a controller that returns data in json and the Ajax code will change the html and display files of the selected folder. so this is the ajax code:
$.ajax({
type :"get",
url :"/bibliotheque/Projet/ajax_liste_maquettes /"+id_projet,
data: { id_projet:id_projet },
success :function(data) {
var b="1";
// document.getElementById('titreid').text = tableau[4];
$('#records_table').empty();
document.getElementById("records_table").innerHTML = "<table border = '1'>" +
'<tr>' +
'<th width="13%">Action</th>'+
'<th>Nom</th>'+
'<th>Date</th>'+
'<th>Ajouter par</th>' +
'<th>Fonction</th>' +
'</tr>';
$.each(data.response, function(i, item) {
chaine = ""+data.response[i].id_projet+"-"+data.response[i].id+"-"+data.response[i].url+"-"+ data.response[i].nom_fichier;
$('<tr>').html(
"<td>" +
'</i> '
+' <i class="fa fa-download" aria-hidden="true"></i>'
+' <i class="fa fa-remove" aria-hidden="true"></i>'
+ "</td>"+
"<td onclick=\"fichierTaches('"+chaine+"')\">" + data.response[i].nom_fichier +"."+data.response[i].format +"</td><td>" + data.response[i].created_at + "</td><td>" + data.response[i].nom_collaborateur +"</td><td>"+data.response[i].collaboration + "</td>").appendTo('#records_table');
});
this code display the file's table and it work fine in localhost but in the web server online it doesn't when i check the network section i see this error:
SyntaxError: JSON.parse: unexpected character at line 2 column 1 of
the JSON data
Standard way of including manifest.json :
<link rel="manifest" href="manifest.json">
Is there a way to include the content of manifest.json directly in the HTML document ?
(The reason for this is to avoid a HTTP request, and make an automatic generation of the file based on tags available only directly in my html template)
To be more precise, here is a non-working example of what I'm trying to do, just for the idea :
<link rel="manifest" content="{"name": "Web Starter Kit", "other options": "directly here"}">
First of all, don't use the same quotes.
HTML thinks it is
content=
"{"
name
": "
Web Starter Kit
", "
other options
": "
directly here
"}"
Plus link cannot have a content attribute so use <script type="application/json">
Next, to use dot notation you should exclude spaces as manifest.other options can confuse programs.
Now to read JSON use
var manifest= document.getElementById('myJSON').innerHTML; //sets manifest to the text in #myJSON
manifest= JSON.parse(manifest) //Converts it into JSON
The following is a working example of what you want.
//var manifest= JSON.parse(document.getElementById('myJSON').innerHTML); /*Shortend of 2&3*/
var manifest= document.getElementById('myJSON').innerHTML; //sets manifest to the text in #myJSON
manifest= JSON.parse(manifest) //Converts it into JSON
document.getElementById('test').innerHTML= manifest.name+ '<br/>'+ manifest.otherOptions; //Displays it
console.log('manifest')
console.log(manifest);
<head>
<script type="application/json" id="myJSON">
{"name":"Web Starter Kit", "otherOptions":"directly here"}
</script>
</head>
<body>
<p id="test"></p>
</body>
And yes you can use <script> for javascript and also have global variables (variables not in functions)
How to inline dynamically generated manifest.json documents with standard JavaScript
I included the following link rel like this one in the html header, WITHOUT a valid href property, yet:
link rel="manifest" id="my-manifest-placeholder"
(see also "How to Setup Your Web App Manifest Dynamically Using Javascript" https://medium.com/#alshakero/how-to-setup-your-web-app-manifest-dynamically-using-javascript-f7fbee899a61 which unfortunately did NOT work for me!)
(or "Inline Web App Manifest", Inline the Web App Manifest? which inspired my solution very much)
Later, I ran the following javascript:
thisHostUrl = "http://localhost/";
// json manifest, escaped as a string
var myManifest = '{\"short_name\": \"ungravel\",\"name\": \"Ungravel:%20Cofounder%20GroupWallet\",\"icons\": [{\"src\": \"' + thisHostUrl + 'icon192x192.png\",\"type\": \"image\/png\",\"sizes\": \"192x192\",\"purpose\": \"any%20maskable\"},{\"src\": \"' + thisHostUrl + 'icon512x512.png\",\"type\": \"image\/png\",\"sizes\": \"512x512\",\"purpose\": \"any%20maskable\"}],\"start_url\": \"' + thisHostUrl + '\",\"background_color\": \"rgb(225,230,233)\",\"display_override\": [\"window-control-overlay\", \"standalone\"],\"display\": \"fullscreen\",\"orientation\": \"landscape-primary\",\"scope\": \"' + thisHostUrl + '\",\"theme_color\": \"rgb(179,231,253)\",\"shortcuts\": [{\"name\": \"Ungravel:%20Cofounder%20GroupWallet\",\"short_name\": \"ungravel\",\"description\": \"Create%20co-founder%20group%20with%20shares%20and%20GroupWallet\",\"url\": \"' + thisHostUrl + '\",\"icons\": [{ \"src\": \"' + thisHostUrl + 'icon64x64.png\", \"sizes\": \"64x64\", \"type\": \"image\/png\" }, { \"src\": \"' + thisHostUrl + 'icon192x192.png\", \"sizes\": \"192x192\", \"type\": \"image\/png\"}]}],\"description\": \"Co-found%20a%20distributed%20group%20on%20ethereum%20blockchain,%20based%20on%20ERC20-compatible%20GroupToken%20shares%20and%20NameRegistry%20NFTs%20(ENS)\",\"screenshots\": [{\"src\": \"' + thisHostUrl + 'screenshot1.jpg\",\"type\": \"image\/jpg\",\"sizes\": \"842x790\"},{\"src\": \"' + thisHostUrl + 'screenshot2.jpg\",\"type\": \"image\/jpg\",\"sizes\": \"1144x630\"}]}';
const stringManifest = 'data:application/manifest+json,'+myManifest;
document.querySelector('#my-manifest-placeholder').setAttribute('href', stringManifest);
DO NOT forget to escape spaces and special chars, such as / and "".
https://www.tutorialspoint.com/json_simple/json_simple_escape_characters.htm
Be aware of the color codes for background and themeColors: rgb(179,231,253)
DO NOT use hex colors or escape the #-special char.
I tried URL.createObjectURL(xxxxx), but the dynamically href is happy with:
data:application/manifest+json + the dynamically generated manifest, in my case myManifest
Google Version 91.0.4472.77 (Offizieller Build) (x86_64) loads the manifest from my source without any extra network access, thus saving network requests for my single-page PWA. A bit ugly, but it works.
Since the manifest format is yet final and still in development, I assume, properties may change and this solution may NOT work in other Google Chrome browsers.
I'm searching an event in "CalendarID" by "EventID" like this:
var event = CalendarApp.getCalendarById(CalendarID).getEventSeriesById(EventID);
This "event" is a single CalendarEvent. Question: How can I get the next information of this CalendarEvent - isAllDayEvent(), startTime, endTime and startDate? Is it possible to find the way how can I get these tags?
If you have calendarEvent, do this
Logger.log("Is all day? " + event.isAllDayEvent());
Logger.log("Start at: " + event.getStartTime());
Logger.log("End at: " + event.getEndTime());
if(event.isAllDayEvent()) {
Logger.log("Start Date: " + event.getAllDayStartDate())
}
calendarEventSeries, however, is not very straightforward for getting a single event details the way you want. So you probably could add tags with relevant info and call calendarEventSeries.getTag(key) to retrieve the info. To get all the tag keys that are asoociated with the calendarEventSeries, use calendarEventSeries.getAllTagKeys() which returns a string array of keys. Currently, there is no way to getRecurrence of a calendarEventSeries. Here is a request to Google for adding this function. You could reply and up vote the request if you consider it is important feature to consider. https://code.google.com/p/google-apps-script-issues/issues/detail?id=4064
I have download and installed the Adventure Works database to use with the SSAS labs and videos.
However they all seem to make use of a view called vDateFeed that is non existent in the datasource and setup files. So that basically puts an end to using the tutorials. There doesn't seem to be anywhere to download this view definition.
Does anyone have it and if so can you please post it here?
I just went into the virtual lab. If you want a shortcut, the view is defined as
CREATE VIEW [dbo].[vDateFeed]
AS
SELECT
[DateKey],
[FullDateAlternateKey] AS [Date],
CAST([CalendarYear] AS NCHAR(4)) + N' ' + LEFT([EnglishMonthName], 3) + N', ' + CASE WHEN [DayNumberOfMonth] < 10 THEN N'0' ELSE N'' END + CAST([DayNumberOfMonth] AS NVARCHAR(2)) AS [DateLabel],
(([CalendarYear] * 100) + [MonthNumberOfYear]) AS [MonthKey],
CAST([CalendarYear] AS NCHAR(4)) + N' ' + LEFT([EnglishMonthName], 3) AS [MonthLabel],
[MonthNumberOfYear] AS [MonthOfYearKey],
LEFT([EnglishMonthName], 3) AS [MonthOfYearLabel],
(([CalendarYear] * 10) + [CalendarQuarter]) AS [CalendarQuarterKey],
N'CY' + CAST([CalendarYear] AS NCHAR(4)) + N' Q' + CAST([CalendarQuarter] AS NCHAR(1)) AS [CalendarQuarterLabel],
[CalendarQuarter] AS [CalendarQuarterOfYearKey],
N'CY Q' + CAST([CalendarQuarter] AS NCHAR(1)) AS [CalendarQuarterOfYearLabel],
[CalendarYear] AS [CalendarYearKey],
N'CY' + CAST([CalendarYear] AS NCHAR(4)) AS [CalendarYearLabel]
FROM
[dbo].[DimDate];
GO
Please, install SQL Server 2008 R2 Update for Developers Training Kit (May 2011 Update), and try to execute Setup_AdventureWorksDW2008R2.sql from this kit. There are many instances of this script, one of them is in the following folder: {training kit installation folder}\Demos\SQL10R2BYFBI00-DEMO-01\Source\Setup\scripts\Tasks\sql. This script contains code to create vDateFeed.