Can’t set ticks in octave - octave

It has been over a decade since I last used octave. I thought I still remembered some things. I confidently typed:
x = [1961,1962,1963, 1964, 1965,...
1966, 1967, 1968, 1969, 1970,...
1971, 1972, 1973, 1974, 1975,...
1976, 1977, 1978, 1979, 1980,...
1981, 1982, 1983, 1984, 1985,...
1986, 1987, 1988, 1989, 1990,...
1991, 1992, 1993, 1994, 1995,...
1996, 1997, 1998, ...
1999, 2000, 2001, 2002, 2003, ...
2004, 2005, 2006, 2007, 2008, ...
2009, 2010, 2011, 2012, 2013, ...
2014, 2015, 2016, 2017, 2018];
y = [1, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 1, 0, 2, 0,...
1, 0, 1, 0, 1,...
2, 1, 0, 0, 0,...
0, 2, 2, ...
14, 21 ,23, 7, 7,...
1, 3, 5, 4, 3, ...
5, 5, 3, 7, 4, ...
7, 3, 3, 4, 4];
plot(x,y)
set(gca, 'xtick', 1960:5:2020);
But I just don’t get the tick spacing - one tick every 5 units - I desire. This is what comes out:
It must be some beginner‘s mistake. So I checked here and on numerous other pages, but I just don’t see it!
I am using the app Anoc for iPad, though I greatly doubt it is the app’s fault. ;)

(Disclaimer: I'm the developer of the Anoc app)
Anoc itself is only an editor (as the name Anoc Octave Editor says). Please keep in mind that there is no plot generation on the device.
As for your question: Please write a draw_plot command after the set() function and wrap the plot calls inside a hold on and hold off. This will fix the tick-issue.
x = [1961,1962,1963, 1964, 1965,...
1966, 1967, 1968, 1969, 1970,...
1971, 1972, 1973, 1974, 1975,...
1976, 1977, 1978, 1979, 1980,...
1981, 1982, 1983, 1984, 1985,...
1986, 1987, 1988, 1989, 1990,...
1991, 1992, 1993, 1994, 1995,...
1996, 1997, 1998, ...
1999, 2000, 2001, 2002, 2003, ...
2004, 2005, 2006, 2007, 2008, ...
2009, 2010, 2011, 2012, 2013, ...
2014, 2015, 2016, 2017, 2018];
y = [1, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 0, 0, 0, 0,...
0, 1, 0, 2, 0,...
1, 0, 1, 0, 1,...
2, 1, 0, 0, 0,...
0, 2, 2, ...
14, 21 ,23, 7, 7,...
1, 3, 5, 4, 3, ...
5, 5, 3, 7, 4, ...
7, 3, 3, 4, 4];
hold on
plot(x,y)
set(gca, 'xtick', 1960:5:2020);
draw_plot
hold off

Related

Azure Stream Analytics - JSON

I am trying to pass the below json through Azure Stream analytics to an Azure SQL server. The data is coming from the Azure IOT HUB and data is coming through happily.
nodes": {
"SN0013A20041E23697": {
"firmware_version": 5,
"transmission_count": 42,
"reserve_byte": 0,
"battery_level": 3.29406,
"type": 32,
"node_id": 0,
"rssi": 9,
"mass_concentration_pm_1_0": 0.88,
"mass_concentration_pm_2_5": 1.04,
"mass_concentration_pm_4_0": 1.13,
"mass_concentration_pm_10_0": 1.17,
"number_concentration_pm_0_5": 5.73,
"number_concentration_pm_1_0": 6.92,
"number_concentration_pm_2_5": 7.07,
"number_concentration_pm_4_0": 7.09,
"number_concentration_pm_10_0": 7.09,
"typical_particle_size": 0.48,
"humidity": 45.35,
"temperature": 20.84
},
"SN0013A20041E2367B": {
"firmware_version": 5,
"transmission_count": 43,
"reserve_byte": 0,
"battery_level": 2.99782,
"type": 32,
"node_id": 0,
"rssi": 16,
"mass_concentration_pm_1_0": 1.35,
"mass_concentration_pm_2_5": 1.43,
"mass_concentration_pm_4_0": 1.43,
"mass_concentration_pm_10_0": 1.43,
"number_concentration_pm_0_5": 9.13,
"number_concentration_pm_1_0": 10.77,
"number_concentration_pm_2_5": 10.83,
"number_concentration_pm_4_0": 10.83,
"number_concentration_pm_10_0": 10.83,
"typical_particle_size": 0.41,
"humidity": 45.72,
"temperature": 20.2
I can use a query like this and it will pass through one of the devices but not the other.
SELECT
"nodes"."SN0013A20041E23697"."temperature" as Temperature
, "nodes"."SN0013A20041E23697"."humidity" as Humidity
From input
Is there a way to pass through both devices in the same query?

set_layout settings in Sublime Text 3

I just changed my OS from W10 to a Linux distro. I installed Sublime Text 3 and started to configure everything as I had in my other OS so I could start programming. Right now I am trying to include some custom layouts but I'm having a problem.
This is a layout I wanted to make:
So I wrote this:
{
"keys": ["alt+shift+5"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.33, 0.5, 0.66, 1.0],
"cells": [
[0, 0, 2, 1],
[2, 0, 4, 1],
[0, 1, 1, 2],
[1, 1, 3, 2],
[3, 1, 4, 2]
]
}
}
But this is not working for me right now.
Trying to apply that layout generates an error message in the Sublime console (View > Show Console):
invalid cell: (2,0 4,1)
That sort of catches me by surprise because generally the set_layout command takes what you give it without doing any error checking, which can get you into sticky situations like weird rendering errors or putting panes outside of the visible area of the window.
In any case, modifying the layout to something like the following solves the problem, which re-orders the cell layouts.
{
"cols":[0.0, 0.5, 1.0],
"rows":[0.0, 0.33, 0.5, 0.67, 1.0 ,
"cells":[
[0, 0, 1, 2],
[1, 0, 2, 1],
[0, 2, 1, 4],
[1, 1, 2, 3],
[1, 3, 2, 4]
]
}

Export (::Array{Expr,1} to .csv

Does anyone know a good way to export the type:
(::Array{Expr,1}
To a .csv?
Here is an example of the Expression that I have in exp_out:
Expr[3]
[Decycler(es_close; n=224), 263, 262, 0.04, 62, 147, 104, 201, -3.5, 6.0, 4, 6, "Next_bar_open", "This_bar_on_close", 4.5, 1, 10, "short", 11, 14.0]
[HurstCoefficient(es_close; n=152, LPPeriod=131), 291, 130, 0.68, 6, 261, 243, 183, -2.0, 4.0, 6, 5, "Next_bar_open", "Next_bar_open", 3.0, 1, 1, "long", 23, 12.5]
[broadcast(/, ModifiedStochastic(es_close; n=293, HPPeriod=95, LPPeriod=139), RoofingFilterIndicator(es_close; LPPeriod=224, HPPeriod=57)), 222, 134, 0.42, 267, 156, 43, 112, -4.5, 1.0, 3, 2, "Next_bar_open", "This_bar_on_close", 17.5, 8, 1, "long", 26, 4.5]
My goal is to export the expresison to a .csv file so that full expression above is contained to one column on export.
using CSV
CSV.write("C:/Users/yoohoo/expr.csv", exp_out;delim=',')
It expands multiple columns on output as its separating by delim=',' Any ideas how to effectively export this cleanly to 1x column?
Output:
You see the delim=',' is separating so that my Expr encroaches on the other columns.
Expected output would not to have it splitting on delim=',' and have the full Expr in the first ID column.

How to Mysql ASC order 1,2,3,4,5 not 1,10,11,12?

Here is my query
$sql=executeQuery("select * from ".PREFIX."frame_info
where Id='".$Id."' $where_clause
order by left(FName, 2), substr(FName, 3) + 0, FName");
PS. I have tried the following but nothing worked
cast(FName as unsigned) ASC
FName + 0
LENGTH(FName), FName
Here is the sample data:
Rayban Slim Fit 5,
Rayban Slim Fit 6,
Rayban Slim Fit 7,
Rayban Slim Fit 3,
Rayban Slim Fit 2,
Rayban Slim Fit 1,
Rayban Slim Fit 9,
Rayban Slim Fit 8,
Rayban Slim Fit 10,
Rayban Princess 149,
Rayban Princess 146,
Rayban Princess 118,
Rayban Princess 147,
Rayban 3141,
Rayban 3143,
Rayban 3153,
Rayban 3152,
Rayban 3130,
Rayban 3128
Expected result:
Rayban 3128,
Rayban 3130,
Rayban 3141,
Rayban 3143,
Rayban 3152,
Rayban 3153,
Rayban Princess 118,
Rayban Princess 146,
Rayban Princess 147,
Rayban Princess 149,
Rayban Slim Fit 1,
Rayban Slim Fit 2,
Rayban Slim Fit 3,
Rayban Slim Fit 5,
Rayban Slim Fit 6,
Rayban Slim Fit 7,
Rayban Slim Fit 8,
Rayban Slim Fit 9,
Rayban Slim Fit 10
We can use Substring_Index() function with Delimiter as a single space character (' '). -1 will allow us to get the susbtring from end of the FName to the first occurence of space (right to left).
Now, we can use CAST(.. AS UNSIGNED) to convert the number substring to integer.
Use Replace() function with Trim(), to get the base name (string without the number suffix).
Now, just Order By base name first and then the suffix number ("serial number")
Try the following query (DB Fiddle DEMO):
SELECT Cast(Substring_index(fi.fname, ' ', -1) AS UNSIGNED) AS serial_number,
Trim(REPLACE(fi.fname, Substring_index(fi.fname, ' ', -1), '')) AS
FName_without_serialno,
fi.*
FROM frame_info AS fi
ORDER BY fname_without_serialno,
serial_number

Looping through all json elements using Unity Boomlagoon Json

I'm using Boomlagoon Json in my Unity project. My Json file has several lines in it, and so far I can only get Boomlagoon to read the first one only. Is there a way I can make a loop where it will go through all parse the entire json file?
Here is my json:
{"type": 1, "squads": [{"player_id": 1, "squad": [1, 2, 3, 4]}, {"player_id": 2, "squad": [6, 7, 8, 9]}], "room_number": 1, "alliance_id": 1, "level": 1}
{"type": 2, "squads": [{"player_id": 2, "squad": [1, 2, 3, 4]}, {"player_id": 3, "squad": [6, 7, 8, 9]}], "room_number": 2, "alliance_id": 1, "level": 1}
{"type": 3, "squads": [{"player_id": 3, "squad": [1, 2, 3, 4]}, {"player_id": 4, "squad": [6, 7, 8, 9]}], "room_number": 3, "alliance_id": 1, "level": 1}
And when I do a loop like this:
foreach (KeyValuePair<string, JSONValue> pair in emptyObject) { ... }
it only gives me results for the first entry (in this example type:1). Thanks.
Your file actually contains 3 JSON objects, and what happens when you parse it is that the parsing stops once the first object ends. You need to parse each line separately to get all of the data.
As an aside, you'll notice that if you paste your JSON into the validator at jsonlint.com it'll give you a parsing error where the second object begins.