I try to write a String in a file with Node.js but the result is not what I'm expected and I don't understand what is wrong :/
For example :
const fs = require('fs');
c = '€'
fs.writeFileSync("ascii.txt", c, {encoding: "ascii"});
fs.writeFileSync("utf8.txt", c, {encoding: "utf8"});
In this exemple I try to write the 128th char in the extended ascii table. In ascii Node write 0xAC(172) instead of 0x80(128)... For UTF-8 the result seem ok.
For the normal ascii table char (0 to 127) it is ok with the two encoding.
It is because ascii encoding don't support extended ascii ? In this case what should I use for simple byte to byte copy ?
Edit :
ASCII char
Node write
remarque
128
172
129
129
130
26
131
146
132
30
133
38
134
32
135
33
136
198
137
48
138
96
139
57
140
82
141
141
non-printable
142
125
143
143
non-printable
144
144
non-printable
145
24
Related
I'm trying to merge 2 date columns (contains blanks cells) and extract the non-duplicates excluding the blank cells while sorted in ascending order.
However, I'm encountering error trying to do so. As excel took in the blank cells as data and extracted data in the end contains invalid info that were not found in either columns. The extracted data were not sort correctly too.
S1 Date
S1 Count
S2 Date
S2 Count
Overall Date
Overall Count
01/10/2021
56
01/10/2021
127
01/10/2021
183
02/10/2021
98
02/10/2021
125
02/10/2021
223
03/10/2021
122
03/10/2021
51
03/10/2021
173
04/10/2021
45
04/10/2021
54
04/10/2021
99
05/10/2021
81
05/10/2021
64
05/10/2021
145
06/10/2021
21
06/10/2021
87
06/10/2021
108
07/10/2021
84
07/10/2021
63
07/10/2021
147
08/10/2021
12
08/10/2021
79
08/10/2021
91
09/10/2021
63
09/10/2021
45
09/10/2021
108
10/10/2021
79
10/10/2021
81
10/10/2021
160
11/10/2021
65
11/10/2021
21
11/10/2021
86
12/10/2021
81
12/10/2021
121
12/10/2021
202
20/10/2021
71
14/10/2021
54
20/10/2021
204
21/10/2021
83
15/10/2021
97
21/10/2021
151
22/10/2021
127
16/10/2021
67
22/10/2021
205
23/10/2021
84
17/10/2021
98
23/10/2021
137
24/10/2021
121
18/10/2021
54
24/10/2021
144
25/10/2021
54
19/10/2021
62
25/10/2021
54
26/10/2021
58
20/10/2021
133
26/10/2021
58
27/10/2021
87
21/10/2021
68
27/10/2021
87
28/10/2021
64
22/10/2021
78
28/10/2021
102
29/10/2021
34
23/10/2021
53
29/10/2021
109
30/10/2021
120
24/10/2021
23
30/10/2021
184
31/10/2021
78
28/10/2021
38
31/10/2021
78
29/10/2021
75
00/01/1900
0
30/10/2021
64
14/10/2021
54
15/10/2021
97
16/10/2021
67
17/10/2021
98
18/10/2021
54
19/10/2021
62
Excel image- Error highlighted in yellow
The formula used was =SORT(IFERROR(IFERROR(INDEX(DateS1,MATCH(0,COUNTIF($F$3:F3,DateS1),0)),INDEX(DateS2,MATCH(0,COUNTIF($F$3:F3,DateS2),0))),""))
Really appreciate if anyone could help.
If you have Windows Excel, I suggest a different formula:
Data Range: G1:J100
L1: overallDate
L2: =SORT(UNIQUE(FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,INDEX(G2:I100,SEQUENCE(99),{1,3}))&"</s></t>","//s")))
M2: =IF(L2="","", SUMIF($G$1:$G$100,L2,$H$1:$H$100)+SUMIF($I$1:$I$100,L2,$J$1:$J$100))
Results from L2 will SPILL down as far as needed
In L2 adjust the range reference and SEQUENCE count as appropriate for your data, or make them dynamic
Formula in M2 will need to be copied down
Edit: If you want an inclusive list of dates in the OverallDate column, consider:
L2: =LET(dates,INDEX(G2:I100,SEQUENCE(99),{1,3}),MIN(dates)-1 + SEQUENCE(1+MAX(dates)-MIN(dates)))
So I want to fit a function with a dataset using gnuplot. In the file "cn20x2012", at the lines [1:300] I have this data:
1 -7.576723949519277e-06
2 4.738414366971162e-05
3 2.5908117324519247e-05
4 7.233786749999952e-06
5 4.94720225240387e-06
6 -1.857620375000113e-06
7 5.697280584855734e-06
8 -1.867760712716345e-05
9 6.64096591257211e-05
10 2.756199717307687e-05
11 4.7755705550480866e-05
12 6.590865376225963e-05
13 4.1522206877403805e-05
14 3.145294946394234e-05
15 5.9346948090625035e-05
16 5.405458204471163e-05
17 0.0001484469089218749
18 0.00011236895265264405
19 0.00010798644697620197
20 8.656723035552881e-05
21 0.00019917737876442313
22 0.00022625750686778835
23 0.00023183354141658626
24 0.0003373178915148073
25 0.00032313619574999994
26 0.0003451188893915866
27 0.0003303809005983172
28 0.0003534148565745192
29 0.00039690566743750015
30 0.0004182810016802884
31 0.00045198626877403865
32 0.00047311462195192373
33 0.0004962054400408655
34 0.0004969566757524037
35 0.0005561838221274039
36 0.0005353567324539659
37 0.00052834133201923
38 0.0005980226227637016
39 0.0005446277144831731
40 0.0005960780049278846
41 0.0006076488594567314
42 0.000710219997610289
43 0.0006714079307259616
44 0.0006990041531870184
45 0.000694646402266827
46 0.0006910307645889419
47 0.0007918124250492787
48 0.0007699669760728367
49 0.0007850042712259613
50 0.0007735240355776444
51 0.0008333605652980768
52 0.0007914544977620185
53 0.0008254284036610573
54 0.0008578590784536057
55 0.0008597165395913466
56 0.0009350752655120189
57 0.0009355867078822116
58 0.0009413161534519229
59 0.001003045837043269
60 0.0009530084342740383
61 0.000981287851927885
62 0.000986143934318509
63 0.00096895140692548
64 0.0010671633388319713
65 0.0010884129846995196
66 0.0010974424039567304
67 0.0011198829067163459
68 0.0010649422789374995
69 0.0010909547135769227
70 0.0010858300892451934
71 0.00114890178018774
72 0.0011503018930817308
73 0.0012209814370937495
74 0.001264080502711538
75 0.0012453762294132222
76 0.0012725116258625
77 0.0012649334953990384
78 0.0012195748153341352
79 0.0013151443892213466
80 0.0013003322635283651
81 0.0013099768888799042
82 0.0013227992394807694
83 0.0013325137669168274
84 0.001356943212587259
85 0.0014541924819278852
86 0.0014094004314177883
87 0.0014273633669975969
88 0.0014393176087403859
89 0.0014372794673365393
90 0.0015051545220959143
91 0.0015432813234807683
92 0.0015832276965293275
93 0.001540622433288461
94 0.0016007491118125
95 0.0016195978358533654
96 0.0016447077023067317
97 0.0016350138695504803
98 0.0017352804136629807
99 0.001731106189370192
100 0.0017407015898704323
101 0.0017367582300937506
102 0.0018164239404875008
103 0.0017829769448653838
104 0.0018303930988165871
105 0.0017893320000211548
106 0.0018727349292259614
107 0.0018745909637668267
108 0.0018425366172147846
109 0.0019053739892581727
110 0.0018849885474855762
111 0.0018689524590103368
112 0.0019431807910961535
113 0.001951890517350962
114 0.0019308973497776446
115 0.0019990349471177894
116 0.002009245176572116
117 0.0020004240575882213
118 0.002020795320423557
119 0.0020148423748725963
120 0.002070277553975961
121 0.002112121992170673
122 0.002081609846093749
123 0.0020899822853341346
124 0.002214996736841347
125 0.002210968677028846
126 0.002204230691923077
127 0.0022059340675168264
128 0.002244672249610577
129 0.002243725570633895
130 0.002198417606970913
131 0.002326686848007212
132 0.002298981945014423
133 0.002412905193465384
134 0.0023317473012668287
135 0.0023255737818221145
136 0.0024042900543605767
137 0.0023814333208341345
138 0.002414946342495192
139 0.002451134140336538
140 0.002435468088014424
141 0.002541540709086779
142 0.0024759180712812523
143 0.002562872725209133
144 0.002554363054353367
145 0.002525350243064904
146 0.0026228594448966342
147 0.002640361090600963
148 0.0026968734518557683
149 0.002687729582449518
150 0.0026799173813848555
151 0.002751626483175481
152 0.0026916526068317286
153 0.002682602742860577
154 0.0027658840884567304
155 0.0028385319315024035
156 0.002733288245524039
157 0.002805041072350961
158 0.002798724552451201
159 0.00284738398885577
160 0.002833892571264423
161 0.0028506943730673084
162 0.0028578405825413463
163 0.0028141271324870197
164 0.0029047532288887
165 0.002916689246838943
166 0.003006111659274039
167 0.0030388357088942325
168 0.0030117903270181707
169 0.003023639132084136
170 0.0030182642660336535
171 0.0029788478969250015
172 0.003086049268993511
173 0.0030530940010240377
174 0.00309287048297596
175 0.0030892688902187473
176 0.0032070964353437493
177 0.0031308958387163454
178 0.003262165689711538
179 0.0032348496648947093
180 0.003334092027257212
181 0.0032702121678230764
182 0.0032887867663149036
183 0.00333782536743269
184 0.0033132179587812513
185 0.003400563164048078
186 0.003322215536028365
187 0.0033691419445264436
188 0.00340692471343654
189 0.003370118822997599
190 0.003414042435545674
191 0.003460621729710913
192 0.003487680921019232
193 0.0034814484875360595
194 0.003528280852358173
195 0.0035260558732403864
196 0.0035947047098653846
197 0.003583761358336538
198 0.003589446784643749
199 0.0035488957604610572
200 0.0036106514596322115
201 0.003633161542855769
202 0.003596668943564904
203 0.003621647520017789
204 0.0037260161142259616
205 0.0036873544761057684
206 0.003693311409786057
207 0.0037485618958747594
208 0.0037277801700697126
209 0.003731768419286058
210 0.0037200943660144225
211 0.0037368698886754786
212 0.0038266932486634626
213 0.003786905602120193
214 0.0038484308669038464
215 0.003837662506102065
216 0.003877989966946875
217 0.0038711451977908673
218 0.0039796825709810125
219 0.003955763375971154
220 0.003983664920576924
221 0.004019112007471154
222 0.003996646585913461
223 0.004061509550884613
224 0.004015245551199519
225 0.004009779120920672
226 0.004148229009661058
227 0.0040645974335312505
228 0.0041522345293678545
229 0.004216267765944711
230 0.004191517977733654
231 0.004280319721466346
232 0.004210795761447114
233 0.004258393462563462
234 0.004267925011272355
235 0.00427713419340625
236 0.004323331966394231
237 0.004361159201735935
238 0.004351708975694715
239 0.004359997178644953
240 0.00437384325853894
241 0.004375188742463941
242 0.004424559629495192
243 0.004461955226487498
244 0.004489655863850963
245 0.0045503420149230756
246 0.0045185560829999975
247 0.004506067166336778
248 0.004585396025798076
249 0.004530840472406252
250 0.0045934151490120215
251 0.004602146584228363
252 0.004643262102497593
253 0.004707265035608172
254 0.004766505116052884
255 0.004744165929896635
256 0.0047756718030625015
257 0.004802170611427885
258 0.004896239463478368
259 0.0048845448341901425
260 0.004845213594302884
261 0.004915008781204327
262 0.004838528640802884
263 0.0048121374747617796
264 0.004895357859576925
265 0.0048793476575266816
266 0.004958465852682693
267 0.005007965180538941
268 0.0049839032653341345
269 0.005068383734646637
270 0.00498556504900495
271 0.005014623260019232
272 0.005066327855785335
273 0.0050290740743365375
274 0.005152934708140861
275 0.005174238921781968
276 0.005123581464772355
277 0.005155969777822114
278 0.005169396608004327
279 0.00516497090489663
280 0.005145110646115385
281 0.005209611399110575
282 0.005163211771749997
283 0.005181044847507209
284 0.005281641245183894
285 0.005323840847189907
286 0.005230924322329326
287 0.005256136984014422
288 0.005374876757439424
289 0.0053137727444009615
290 0.005468482116127402
291 0.005453857539401205
292 0.005417081656274039
293 0.005393994523838937
294 0.005506909240446873
295 0.005449365350307692
296 0.005551215606367787
297 0.005505932791992786
298 0.0055918512302572145
299 0.005663100163579326
300 0.0056382443690432705
When I do
f(x) = a/b*(1-exp(-b*x))
fit[1:300] f(x) "cn20x2012" using 1:2 via a,b
The curve fits perfectly. But when I try to fit the curve with
a/b*(1-exp(-b*x/(3e-26))
I get the error message. Note that I've only added a constant to the exponential part of the function.
What can I do to fit the function with the constant 3e-26?
I'm using gnuplot 5.2 patchlevel 8 on linux
Adding that constant makes the values of exp(-b*x/(3.e-26) so close to zero that the term (1-exp(-b*x/(3e-26)) differs from 1 by less than the precision available for IEEE double precision floating point numbers. So you are essentially fitting the function g(x) = a/b, which is a very poor fit to your data.
Since you already have a good fit using your original function f(x), perhaps you can explain what your goal is to change the function to something else? What question are you trying to answer?
I need to place a zero-width space after each character within the texts in MS Excel document.
Two important conditions:
The target text is in Japanese and Chinese.
Text with Latin characters and numbers should not be affected. I.e. in mixed Asian\Latin cell only Asian characters have to be separated by those spaces.
Amount of texts is huge so it's a pain to put them in manually.
I tried to find any suitable VBA-module out, but with no success.
Maybe it's possible to perform such action in another application and then import the texts back to Excel? That's solution is also acceptable.
Thanks in advance.
P.S. Exceptions (Latin characters):
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Assuming:
U+200B
This little macro:
Sub dural()
Dim zws As String, A1 As String, L As Long, i As Long
Dim temp As String
zws = ChrW(8203)
A1 = Range("A1").Text
L = Len(A1)
For i = 1 To L
temp = temp & Mid(A1, i, 1) & zws
Next i
temp = Mid(temp, 1, Len(temp) - 1)
MsgBox A1 & vbCrLf & temp
Range("A2").Value = temp
End Sub
will produce:
NOTE:
The character may be zero-width, but not zero-length!
I have a .txt file with information as following:
...
353 48 338 48 338 9 353 9 **personperson走** 281 64 259 64 259 4 281 4 person
353 48 338 48 338 9 353 9 **personabc** 281 64 259 64 259 4 281 4 person
353 48 338 48 338 9 353 9 **persondef** 281 64 259 64 259 4 281 4 person
...
I want to replace all those bold type words to person
(The original words with normal type, not in bold)
like this:
...
353 48 338 48 338 9 353 9 **person** 281 64 259 64 259 4 281 4 person
353 48 338 48 338 9 353 9 **person** 281 64 259 64 259 4 281 4 person
353 48 338 48 338 9 353 9 **person** 281 64 259 64 259 4 281 4 person
...
I tried use the following command to replace, but the old_string part is different.
%s/old_string/new_string/g
Is there any way to use grep in (old_string) part to replace person*(stop at blank) to person
You can use the following in vim:
:%s/person\w\+/person/g
This will replace all words contining person followed by word characters by person
More informations about the substitue function in vim you can find here: http://vim.wikia.com/wiki/Search_and_replace
I would do:
%s/\<person\zs\S\+//g
This won't replace foopersonbar by fooperson
This will replace the Chinese word 走 (OP meant "stop at blank )"
i need help with some homework. they want me to make a 10x10 multiplication tables using multiple while loops and nesting. they want the user to be prompted for the first number for the row and column. so if the you give 3 for column and 12 for the row it would look like this:
3 4 5 6 7 8 9 10 11 12
--------------------------------------------------
12| 36 48 60 72 84 96 108 120 132 144
13| 39 52 65 78 91 104 117 130 143 156
14| 42 56 70 84 98 112 126 140 154 168
15| 45 60 75 90 105 120 135 150 165 180
16| 48 64 80 96 112 128 144 160 176 192
17| 51 68 85 102 119 136 153 170 187 204
18| 54 72 90 108 126 144 162 180 198 216
19| 57 76 95 114 133 152 171 190 209 228
20| 60 80 100 120 140 160 180 200 220 240
21| 63 84 105 126 147 168 189 210 231 252
this is what i found with the internet search help:
row = int(input("Enter the first row number: " ))
while(row <= 10):
column = int(input("Enter the frist column number: "))
while(column <= 10):
if(row+column==0):
print('{:4s}'.format(''),end = '') #corner
elif(row*column==0):
print('{:4d}'.format(row+column),end = '') # border
else:
print('{:4d}'.format(row*column),end = '') # table
column=column+1
print()
row=row+1
if anyone could help me i would be very thankful
It should look something more like this:
row1 = int(input("Enter the first row number: " ))
column1 = int(input("Enter the first column number: "))
# TODO: print header
for row in range(row1, row1 + 10):
for column in range(column1, column1 + 10):
# TODO
That is, you only prompt for input twice, not (1+N) times, and you use the built-in function range() to generate the lists of rows and columns to iterate over.