Fullcalendar columnheaderformat attribute - fullcalendar

I'm using fullcalendar (v3) and I can't configure properly the columnheaderformat attribute. Thanks in advance.
$('#calendar').fullCalendar({
locale: 'es',
firstDay: 1,
defaultView: 'agendaWeek',
header: false,
footer: false,
allDaySlot : false,
slotEventOverlap: false,
columnHeaderFormat: 'ddd'
});

I've checked my fullcalendar version and it's v3.5.1. I changed columnHeaderFormat with columnFormat and it works ok. Thank you

for fullcalendar v5.8.0+
dayHeaderFormat
initialView: 'timeGridWeek',
views: {
timeGridWeek: {
dayHeaderFormat: { weekday: 'long' },
}
},

If you are using v4, place this code before the calendar.render():
moment.updateLocale('es', {
monthsShort : [ "Ene", "Feb", "Mar", "Abr", "May", "Jun","Jul", "Ago", "Sep", "Oct", "Nov", "Dic" ],
months: [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio","Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ],
weekdays: [ "Domingo","Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
weekdaysShort: [ "Dom","Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
});

Related

How can I get the translated only products with translation from WooCommerce Multilingual & Multicurrency with Rest API?

The problem is that I get this excerpt of a product from Woocommerce:
[
{
"id": 73,
"name": "cBox",
"slug": "cbox",
"sku": "",
"price": "169",
"regular_price": "169",
"sale_price": "",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"stock_status": "instock",
"has_options": true,
"translations": {
"de": "73",
"en": "76"
},
"lang": "de",
}
]
You can see the translations, at least the ID's of the translated products. My question is how can I get directly via rest-api only the translated products?
Because with the property "lang=en" it does not work in the url
What does your request look like?
It should work with the lang parameter, you can read more here: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Unable to transcode telegram voice message using IBM Watsown Speech to Text with Node-Red

Trying to transcript audio from Telegram voice message but I got "unable to transcode data stream audio/opus -> audio/x-float-array" error from watson's speech to text node.
I'm using Node-Red on Raspberry to simply transcript audio from Telegram voice message with node-red-contrib-telegrambot and node-red-node-watson.
With text messages, my code works as a charm.
With Voice Messages, I got "unable to transcode data stream audio/opus -> audio/x-float-array" error from watson's speech to text node.
node-red flow images I don't have enough reputation point to post images :(
JSON flow export
[
{
"id": "b4106ec1.63dd58",
"type": "tab",
"label": "Telegram",
"disabled": false,
"info": ""
},
{
"id": "d1198164.e38f68",
"type": "telegram receiver",
"z": "b4106ec1.63dd58",
"name": "FMWatsonBot",
"bot": "5f347711.7876d8",
"saveDataDir": "",
"x": 110,
"y": 100,
"wires": [
[
"f4b4ab25.5dde18",
"f5d126df.5b6928"
],
[]
]
},
{
"id": "c6ec445d.0840d8",
"type": "telegram sender",
"z": "b4106ec1.63dd58",
"name": "Send2Telegram",
"bot": "5f347711.7876d8",
"x": 780,
"y": 80,
"wires": [
[]
]
},
{
"id": "f4b4ab25.5dde18",
"type": "debug",
"z": "b4106ec1.63dd58",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 290,
"y": 60,
"wires": []
},
{
"id": "f5d126df.5b6928",
"type": "function",
"z": "b4106ec1.63dd58",
"name": "Save chat context",
"func": "msg.chatId = msg.payload.chatId;\nmsg.type = msg.payload.type;\nmsg.content = msg.payload.content;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 230,
"y": 160,
"wires": [
[
"c3d1a92d.227568"
]
]
},
{
"id": "276cfad7.cef62e",
"type": "function",
"z": "b4106ec1.63dd58",
"name": "Set Chat Context",
"func": "msg.payload = {\n chatId : msg.chatId,\n topic : msg.type,\n type : \"message\",\n content : msg.payload};\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 730,
"y": 220,
"wires": [
[
"c6ec445d.0840d8"
]
]
},
{
"id": "c3d1a92d.227568",
"type": "switch",
"z": "b4106ec1.63dd58",
"name": "Check msg type",
"property": "type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "message",
"vt": "str"
},
{
"t": "eq",
"v": "voice",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 300,
"y": 240,
"wires": [
[
"e8452a44.f967c8"
],
[
"6aea6224.578d8c"
],
[]
]
},
{
"id": "e8452a44.f967c8",
"type": "function",
"z": "b4106ec1.63dd58",
"name": "Echo message",
"func": "msg.payload = {\n chatId : msg.chatId,\n topic : \"Text Echo\",\n type : msg.type,\n content : msg.content};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 540,
"y": 80,
"wires": [
[
"c6ec445d.0840d8"
]
]
},
{
"id": "6aea6224.578d8c",
"type": "change",
"z": "b4106ec1.63dd58",
"name": "Set voice URL",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.weblink",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 440,
"y": 300,
"wires": [
[
"fc7b1590.557c"
]
]
},
{
"id": "493d1bac.216d3c",
"type": "change",
"z": "b4106ec1.63dd58",
"name": "Set transcription",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "transcription",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 300,
"wires": [
[
"276cfad7.cef62e"
]
]
},
{
"id": "fc7b1590.557c",
"type": "watson-speech-to-text",
"z": "b4106ec1.63dd58",
"name": "S2T",
"alternatives": 1,
"speakerlabels": false,
"smartformatting": false,
"lang": "en-GB",
"langhidden": "en-GB",
"langcustom": "NoCustomisationSetting",
"langcustomhidden": "",
"custom-weight": "0.5",
"band": "BroadbandModel",
"bandhidden": "BroadbandModel",
"keywords": "",
"keywords-threshold": "0.5",
"word-confidence": false,
"password": "",
"apikey": "#########CHANGED VALUE TO POST###########",
"payload-response": false,
"streaming-mode": false,
"streaming-mute": true,
"auto-connect": false,
"discard-listening": false,
"disable-precheck": false,
"default-endpoint": true,
"service-endpoint": "https://stream.watsonplatform.net/speech-to-text/api",
"x": 530,
"y": 360,
"wires": [
[
"493d1bac.216d3c"
]
]
},
{
"id": "5f347711.7876d8",
"type": "telegram bot",
"z": "",
"botname": "FMWatsonBot",
"usernames": "",
"chatids": "",
"baseapiurl": "",
"updatemode": "polling",
"pollinterval": "300",
"bothost": "",
"localbotport": "8443",
"publicbotport": "8443",
"privatekey": "",
"certificate": "",
"verboselogging": false
}
]
Any hint?
Thanks in advance
Ferruccio
It boils down to how you are fetching the audio from Telegram. Check the answer to this related question - https://developer.ibm.com/answers/questions/424777/help-how-do-i-use-speech-to-text-with-my-telegram/
which shows how to build the url to send through to the Speech to text node.
Update: Flow perfectly works with telegram node v4.4.0, but fails with new version 5.1.5
So, it's not a problem regarding Speech to Text node.

Traffic Flow Data response description in documentation

I see examples with flow data in documentation, but I can't find what does means all it fields:
{
"RWS": [
{
"RW": [
{
"FIS": [
{
"FI": [
{
"TMC": {
"PC": 6467,
"DE": "Gladenbach",
"QD": "+",
"LE": 12.52997
},
"CF": [
{
"SP": 55.2,
"CN": 0.73,
"TY": "TR",
"JF": 0,
"SU": 55.2,
"FF": 52.6
}
]
}
]
}
],
"LI": "D01-06464",
"DE": "L3048",
"PBT": "2015-08-20T08:27:45Z",
"mid": "ff3e7aab-eece-438c-818b-5920e4581330|"
},
{
"FIS": [
{
"FI": [
{
"TMC": {
"PC": 6468,
"DE": "Fronhausen",
"QD": "-",
"LE": 12.55204
},
"CF": [
{
"SP": 56.95,
"CN": 0.7,
"TY": "TR",
"JF": 0,
"SU": 56.95,
"FF": 53.6
}
]
}
]
}
],
"LI": "D01+06464",
"DE": "L3048",
"PBT": "2015-08-20T08:27:45Z",
"mid": "77ede063-8d38-409a-a986-c8d91cdf3eb2|"
}
],
"TY": "TMC",
"MAP_VERSION": "201503",
"EBU_COUNTRY_CODE": "D",
"EXTENDED_COUNTRY_CODE": "E0",
"TABLE_ID": "1",
"UNITS": "metric"
}
],
"MAP_VERSION": "",
"CREATED_TIMESTAMP": "2015-08-20T08:27:43.000+0000",
"VERSION": "3.1",
"UNITS": "metric"
}
Where is this documents?
There is an XSD with description for that particular request
https://traffic.cit.api.here.com/traffic/6.0/xsd/flow.xsd?app_id=xxx&app_code=yyy
You can use your credentials to access it.
You can also obtain another XSDs for different types of request https://developer.here.com/rest-apis/documentation/traffic/topics/additional-parameters.html

jqGrid Odd rows ui.state.highlight not working

I have created jqGrid in which i have to give color on row select but when i am trying to give for even rows, it's working fine but for odds rows it's not working.
I don't want to use jQuery or JavaScript i just want to do it from CSS. Is there way to achieve it?
Below is my sample code which is working for even rows:
.ui-jqgrid .ui-state-highlight:nth-child(even) { background: #d0e5f5; }
For odd rows its not working:
.ui-jqgrid .ui-state-highlight:nth-child(odd) { background: #d0e5f5; }
Sorry, but all works without any problem at me. Press "Run code snippet" button below and highlight odd or even rows on the demo
$(function () {
"use strict";
var mydata = [
{ id: "1", invdate: "2007-10-21", name: "test", note: "3note note note", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "2", invdate: "2007-10-22", name: "test2", note: "3note2 note2", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "3", invdate: "2007-09-01", name: "test3", note: "3note3 note3", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
{ id: "4", invdate: "2007-10-14", name: "test4", note: "3note4", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "5", invdate: "2007-10-31", name: "test5", note: "3note5", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "6", invdate: "2007-09-06", name: "test6", note: "3note6", amount: "400.00", tax: "30.00", closed: false, ship_via: "FE", total: "430.00" },
{ id: "7", invdate: "2007-10-04", name: "test7", note: "3note7", amount: "200.00", tax: "10.00", closed: true, ship_via: "TN", total: "210.00" },
{ id: "8", invdate: "2007-10-03", name: "test8", note: "3note8", amount: "300.00", tax: "20.00", closed: false, ship_via: "FE", total: "320.00" },
{ id: "9", invdate: "2007-09-22", name: "test9 test9 test9 test9 test9", note: "3note9", amount: "400.00", tax: "30.00", closed: false, ship_via: "TN", total: "430.00" },
{ id: "10", invdate: "2007-09-08", name: "test10", note: "3note10", amount: "500.00", tax: "30.00", closed: true, ship_via: "TN", total: "530.00" },
{ id: "11", invdate: "2007-09-28", name: "test11", note: "3note11", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" },
{ id: "12", invdate: "2007-09-10", name: "test12", note: "3note12", amount: "500.00", tax: "30.00", closed: false, ship_via: "FE", total: "530.00" }
],
initDatepicker = function (elem) {
$(elem).datepicker({
autoSize: true,
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true
});
},
numberTemplate = {formatter: "number", align: "right", sorttype: "number",
editrules: {number: true, required: true},
searchoptions: { sopt: ["eq", "ne", "lt", "le", "gt", "ge", "nu", "nn", "in", "ni"] }},
$grid = $("#list");
$grid.jqGrid({
datatype: "local",
data: mydata,
colNames: ["Client", "Date", "Amount", "Tax", "Total", "Closed", "Shipped via", "Notes"],
colModel: [
{ name: "name", editrules: {required: true} },
{ name: "invdate", align: "center", sorttype: "date",
formatter: "date",
searchoptions: { sopt: ["eq", "ne", "lt", "le", "gt", "ge"], dataInit: initDatepicker } },
{ name: "amount", template: numberTemplate },
{ name: "tax", template: numberTemplate },
{ name: "total", template: numberTemplate },
{name: "closed", align: "center", formatter: "checkbox",
edittype: "checkbox", editoptions: {value: "Yes:No", defaultValue: "Yes"},
stype: "select", searchoptions: { sopt: ["eq", "ne"], value: ":Any;true:Yes;false:No" } },
{name: "ship_via", align: "center", formatter: "select",
edittype: "select", editoptions: { value: "FE:FedEx;TN:TNT;IN:Intim", defaultValue: "FE" },
stype: "select", searchoptions: { sopt: ["eq", "ne"], value: ":Any;FE:FedEx;TN:TNT;IN:Intim" } },
{ name: "note", sortable: false, search: false, edittype: "textarea" }
],
rowNum: 10,
rowList: [5, 10, 20],
pager: "#pager",
gridview: true,
rownumbers: true,
autoencode: true,
ignoreCase: true,
sortname: "invdate",
viewrecords: true,
sortorder: "desc",
shrinkToFit: false,
height: "auto"
});
});
.ui-jqgrid-hdiv { overflow-y: hidden; }
.ui-jqgrid .ui-state-highlight:nth-child(even) { background: #CCCCFF; }
.ui-jqgrid .ui-state-highlight:nth-child(odd) { background: #B2EC5D; }
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/redmond/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/css/ui.jqgrid.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/i18n/grid.locale-en.js"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/jquery.jqGrid.src.js"></script>
<table id="list"><tr><td></td></tr></table>
<div id="pager"></div>

Sort value from nested object using c#

I am trying to sort an object by SpaceType, TimeInterval and Price. It's a nested object as shown below. Can someone suggest me a sample on how to sort it in an efficient way using c# 4.0
ParkingFacility -> Cost -> TimeInterval
"VendorID": 1200,
"FacilityID": 931,
"ParkingType": "Garage",
"Price": null,
"BARTValidationRequired": null,
"LotName": "Civic Center Garage",
"City": "San Francisco",
"Street": "355 McAllister Street",
"Neighborhood": "Hayes Valley/Civic Center",
"Latitude": "37.780200",
"Longitude": "-122.417800",
"Distance": "",
"Availability": "Space Available: <b>62%</b> (515/843) <br/>Current Price: <b>N/A</b><br />6:00 AM-12:00 AM",
"Details": null,
"Hours": "Sunday : 9:00 AM-10:00 PM <br />Monday : 6:00 AM-12:00 AM <br />Tuesday : 6:00 AM-12:00 AM <br />Wednesday : 6:00 AM-12:00 AM <br />Thursday : 6:00 AM-12:00 AM <br />Friday : 6:00 AM-12:00 AM <br />Saturday : 8:00 AM-12:00 AM <br />",
"Entrance": null,
"Contact": "",
"TodayTimings": "6:00 AM-12:00 AM",
"TotalParkingSpace": 843,
"AvailableParkingSpace": 515,
"OccupiedParkingSpace": 328,
"PercentFull": 38,
"Rendering": 3,
"ZoneID": 0,
"OwnershipAgencyType": null,
"Cost": [
[
{
"DayType": "Thursday",
"SpaceType": "Motorcycle",
"Description": "Motorcycle: Flatrate",
"TimeInterval": 0,
"Cost": "$5.00",
"FaciltyID": 0
},
{
"DayType": "Thursday",
"SpaceType": "Auto",
"Description": null,
"TimeInterval": 0,
"Cost": "$5.00",
"FaciltyID": 0
}
],
[
{
"DayType": "MondayToFridayExceptHolidays",
"SpaceType": "Auto",
"Description": "Early Bird: Flat rate. Mon-Fri (excl. Tue): In by 9AM/Out by 7PM;No Tues Early Bird",
"TimeInterval": 0,
"Cost": "$15.00",
"FaciltyID": 0
}
],
[
{
"DayType": "Thursday",
"SpaceType": "Auto",
"Description": "Per hour",
"TimeInterval": 60,
"Cost": "$3.00",
"FaciltyID": 0
},
{
"DayType": "Thursday",
"SpaceType": "Auto",
"Description": "12-Hour Max",
"TimeInterval": 720,
"Cost": "$24.00",
"FaciltyID": 0
},
{
"DayType": "Thursday",
"SpaceType": "Auto",
"Description": "24-Hour Max/Lost Tkt",
"TimeInterval": 0,
"Cost": "$30.00",
"FaciltyID": 0
},
{
"DayType": "Thursday",
"SpaceType": "Auto",
"Description": null,
"TimeInterval": 0,
"Cost": "$30.00",
"FaciltyID": 0
}
]]
}
So assuming you have it in a structure in c# you can use linq to order by multiple items.
e.g.
listOfPeople.OrderBy(person => person.LastName)
.ThenBy(person => person.FirstName)
.ThenBy(person => person.DOB)
This is a trivial example of course but depending on how you wanted them sorted - if inside their own container or all as one - you could run this iterator. It is quite efficient - better programmers than you and I made it so.
Probably tougher is how to sort the spaceType - as just doing it like that would do it alphabetically which might not be what you want.

Resources