Xcode: Random Contextless Hexadecimal Output to Console - ios

I have an iOS app developed in Xcode. When running my app in the simulator, I'm getting some random hexadecimal output in the console log when navigating to one particular view controller (example below). It does not happen when navigating to other controllers, and I don't see anything jumping out at me that I'm doing differently in this instance, and there are no apparent effects in the simulator of anything being wrong.
Has anyone seen this, can you lend any direction as to what is causing it, or at the very least tell if this is cause for alarm?
The output does not have a timestamp or my app name as a prefix like an NSLog output such as 2020-03-17 14:50:54.387749-0400 AppName. The output is consistent every time with the same information being logged.
0000000A: 0100 4 4 800
00000016: 0101 4 4 800
00000022: 0102 3 6 110
0000002E: 011A 5 8 116
0000003A: 011B 5 8 124
00000046: 0128 3 2 2
00000052: 0131 2 12 132
0000005E: 0132 2 20 144
000000A6: 0100 4 4 256
000000B2: 0101 4 4 256
000000BE: 0102 3 6 266
000000CA: 0103 3 2 6
000000D6: 0106 3 2 6
000000E2: 0115 3 2 3
000000EE: 0201 4 4 272
000000FA: 0202 4 4 4506
0000000A: 0100 4 4 800
00000016: 0101 4 4 800
00000022: 0102 3 6 110
0000002E: 011A 5 8 116
0000003A: 011B 5 8 124
00000046: 0128 3 2 2
00000052: 0131 2 12 132
0000005E: 0132 2 20 144
000000A6: 0100 4 4 256
000000B2: 0101 4 4 256
000000BE: 0102 3 6 266
000000CA: 0103 3 2 6
000000D6: 0106 3 2 6
000000E2: 0115 3 2 3
000000EE: 0201 4 4 272
000000FA: 0202 4 4 4506
0000000A: 0100 4 4 800
00000016: 0101 4 4 800
00000022: 0102 3 6 110
0000002E: 011A 5 8 116
0000003A: 011B 5 8 124
00000046: 0128 3 2 2
00000052: 0131 2 12 132
0000005E: 0132 2 20 144
000000A6: 0100 4 4 256
000000B2: 0101 4 4 256
000000BE: 0102 3 6 266
000000CA: 0103 3 2 6
000000D6: 0106 3 2 6
000000E2: 0115 3 2 3
000000EE: 0201 4 4 272
000000FA: 0202 4 4 4506
0000000A: 0100 4 4 800
00000016: 0101 4 4 800
00000022: 0102 3 6 110
0000002E: 011A 5 8 116
0000003A: 011B 5 8 124
00000046: 0128 3 2 2
00000052: 0131 2 12 132
0000005E: 0132 2 20 144
000000A6: 0100 4 4 256
000000B2: 0101 4 4 256
000000BE: 0102 3 6 266
000000CA: 0103 3 2 6
000000D6: 0106 3 2 6
000000E2: 0115 3 2 3
000000EE: 0201 4 4 272
000000FA: 0202 4 4 4506

Related

KDB combine/join different table

How can i join two different table like
all_order_ask:([]ask:();ask_qty:();exchange_name_ask:())
all_order_bid:([]bid:();bid_qty:();exchange_name_bid:())
and get =====>
final_order:ask:();ask_qty:();exchange_name_ask:();bid:();bid_qty:();exchange_name_bid:()
the two table have the same number of rows
you can use uj:
https://code.kx.com/q/ref/uj/
all_order_ask uj all_order_bid
ask ask_qty exchange_name_ask bid bid_qty exchange_name_bid
-----------------------------------------------------------
q)
If your tables look similar like this:
all_order_ask
ask ask_qty exchange_name_ask
----------------------------------
7.051033 8 bjd
1.497004 3 lln
2.400771 0 edg
1.039355 7 lij
2.353326 6 hon
6.423479 4 ncp
5.778177 6 gee
2.193148 5 ijf
1.66486 4 bbf
4.784272 2 lmi
all_order_bid
bid bid_qty exchange_name_bid
----------------------------------
15.70605 2 pjbke
10.93533 17 epjak
7.040985 11 ekaaj
14.19316 19 mpnan
9.248942 17 nogel
1.615466 18 holpj
1.073589 16 kkfpn
19.85822 13 pegin
14.45499 8 jcgnm
16.47223 0 dlhep
You can try this:
all_order_ask^all_order_bid
ask ask_qty exchange_name_ask bid bid_qty exchange_name_bid
---------------------------------------------------------------------
7.051033 8 bjd 15.70605 2 pjbke
1.497004 3 lln 10.93533 17 epjak
2.400771 0 edg 7.040985 11 ekaaj
1.039355 7 lij 14.19316 19 mpnan
2.353326 6 hon 9.248942 17 nogel
6.423479 4 ncp 1.615466 18 holpj
5.778177 6 gee 1.073589 16 kkfpn
2.193148 5 ijf 19.85822 13 pegin
1.66486 4 bbf 14.45499 8 jcgnm
4.784272 2 lmi 16.47223 0 dlhep
Since your two tables have the same number of rows, you should also be able to join your two tables horizontally using ,' as follows:
q)final_order_ask:all_order_ask,'all_order_bid
q)final_order_ask
ask ask_qty exchange_name_ask bid bid_qty exchange_name_bid
-----------------------------------------------------------

Python3 print formatting

I want to format the output from print function.
def main():
print('1 2 3 4 5'*7)
# Write code here
main()
Required Output:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
Obtained Output:
1 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 51 2 3 4 5
How do I make print function in Python3 to perform this job?
You can set the separator to be a linebreak.
print(*7*('1 2 3 4 5',), sep='\n')
Equivalently, you can add the linebreak at the end of the string and remove the end linebreak from print.
print(7*'1 2 3 4 5\n', end='')
Try this:
print('1 2 3 4 5\n'*7)

torch / lua: retrieving n-best subset from Tensor

I have following code now, which stores the indices with the maximum score for each question in pred, and convert it to string.
I want to do the same for n-best indices for each question, not just single index with the maximum score, and convert them to string. I also want to display the score for each index (or each converted string).
So scores will have to be sorted, and pred will have to be multiple rows/columns instead of 1 x nqs. And corresponding score value for each entry in pred must be retrievable.
I am clueless as to lua/torch syntax, and any help would be greatly appreciated.
nqs=dataset['question']:size(1);
scores=torch.Tensor(nqs,noutput);
qids=torch.LongTensor(nqs);
for i=1,nqs,batch_size do
xlua.progress(i, nqs)
r=math.min(i+batch_size-1,nqs);
scores[{{i,r},{}}],qids[{{i,r}}]=forward(i,r);
end
tmp,pred=torch.max(scores,2);
answer=json_file['ix_to_ans'][tostring(pred[{i,1}])]
print(answer)
Here is my attempt, I demonstrate its behavior using a simple random scores tensor:
> scores=torch.floor(torch.rand(4,10)*100)
> =scores
9 1 90 12 62 1 62 86 46 27
7 4 7 4 71 99 33 48 98 63
82 5 73 84 61 92 81 99 65 9
33 93 64 77 36 68 89 44 19 25
[torch.DoubleTensor of size 4x10]
Now, since you want the N best indexes for each question (row), let's sort each row of the tensor:
> values,indexes=scores:sort(2)
Now, let's look at what the return tensors contain:
> =values
1 1 9 12 27 46 62 62 86 90
4 4 7 7 33 48 63 71 98 99
5 9 61 65 73 81 82 84 92 99
19 25 33 36 44 64 68 77 89 93
[torch.DoubleTensor of size 4x10]
> =indexes
2 6 1 4 10 9 5 7 8 3
2 4 1 3 7 8 10 5 9 6
2 10 5 9 3 7 1 4 6 8
9 10 1 5 8 3 6 4 7 2
[torch.LongTensor of size 4x10]
As you see, the i-th row of values is the sorted version (in increasing order) of the i-th row of scores, and each row in indexes gives you the corresponding indexes.
You can get the N best values/indexes for each question (i.e. row) with
> N_best_indexes=indexes[{{},{indexes:size(2)-N+1,indexes:size(2)}}]
> N_best_values=values[{{},{values:size(2)-N+1,values:size(2)}}]
Let's see their values for the given example, with N=3:
> return N_best_indexes
7 8 3
5 9 6
4 6 8
4 7 2
[torch.LongTensor of size 4x3]
> return N_best_values
62 86 90
71 98 99
84 92 99
77 89 93
[torch.DoubleTensor of size 4x3]
So, the k-th best value for question j is N_best_values[{{j},{values:size(2)-k+1}]], and its corresponding index in the scores matrix is given by this row, column values:
row=j
column=N_best_indexes[{{j},indexes:size(2)-k+1}}].
For example, the first best value (k=1) for the second question is 99, which lies at the 2nd row and 6th column in scores. And you can see that values[{{2},values:size(2)}}] is 99, and that indexes[{{2},{indexes:size(2)}}] gives you 6, which is the column index in the scores matrix.
Hope that I explained my solution well.

how to join two pandas dataframe on specific column

I have 1st pandas dataframe which looks like this
order_id buyer_id caterer_id item_id qty_purchased
387 139 1 7 3
388 140 1 6 3
389 140 1 7 3
390 36 1 9 3
391 79 1 8 3
391 79 1 12 3
391 79 1 7 3
392 72 1 9 3
392 72 1 9 3
393 65 1 9 3
394 65 1 10 3
395 141 1 11 3
396 132 1 12 3
396 132 1 15 3
397 31 1 13 3
404 64 1 14 3
405 146 1 15 3
And the 2nd dataframe looks like this
item_id meal_type
6 Veg
7 Veg
8 Veg
9 NonVeg
10 Veg
11 Veg
12 Veg
13 NonVeg
14 Veg
15 NonVeg
16 NonVeg
17 Veg
18 Veg
19 NonVeg
20 Veg
21 Veg
I want to join this two data frames on item_id column. So that the final data frame should contain item_type where it has a match with item_id.
I am doing following in python
pd.merge(segments_data,meal_type,how='left',on='item_id')
But it gives me all nan values
You have to check types by dtypes of both columns (names) to join on.
If there are different, you can cast them, because you need same dtypes. Sometimes numeric columns are string columns, but looks like numbers.
If there are both same string types, maybe help cast both of them to int. Problem can be some whitespaces:
segments_data['item_id'] = segments_data['item_id'].astype(int)
meal_type['item_id'] = meal_type['item_id'].astype(int)
pd.merge(segments_data,meal_type,how='left',on='item_id')

Ruby script to extract numbers [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a .txt file with characters that look like this:
7 3 5 7 3 3 3 3 3 3 3 6 7 5 5 22 1 4 23 16 18 5 13 34 24 17 50 30 42 35 29 27 52 35 44 52 36 39 25 40 50 52 40 2 52 52 31 35 30 19 32 46 50 43 36 15 21 16 36 25 7 3 5 17 3 3 3 3 23 3 3 46 1 2
I want to extract numbers >10 only if 7 or more of the next 15 numbers are greater than 10 too.
In this case, I would have the output:
22 1 4 23 16 18 5 13 34 24 17 50 30 42 35 29 27 52 35 44 52 36 39 25 40 50 52 40 2 52 52 31 35 30 19 32 46 50 43 36 15 21 16 36 25
Note that in this output there's numbers <10, but they pass the condition of having 7 or more of the next 15 numbers >10.
Sounds like a homework question, but I'll give you an attempted answer just for fun anyway.
numbers = "7 3 5 7 3 3 3 3 3 3 3 6 7 5 5 22 1 4 23 16 18 5 13 34 24 17 50 30 42 35 29 27 52 35 44 52 36 39 25 40 50 52 40 2 52 52 31 35 30 19 32 46 50 43 36 15 21 16 36 25 7 3 5 17 3 3 3 3 23 3 3 46 1 2"
numbers.split.each_cons(16).map{|x| x[0] if x[1..15].count{|y| y.to_i > 10} >= 7}.compact
num_string = "7 3 5 7 3 3 3 3 3 3 3 6 7 5 5 22 1 4 23 16 18 5 13 34 24 17 50 30 42 35 29 27 52 35 44 52 36 39 25 40 50 52 40 2 52 52 31 35 30 19 32 46 50 43 36 15 21 16 36 25 7 3 5 17 3 3 3 3 23 3 3 46 1 2"
num_arr = num_string.split(" ")
def next_ones(arr)
counter = 0
arr.each do |num|
if num.to_i > 10
counter += 1
end
end
if counter >= 7
arr[0]
end
end
def processor(arr)
answer = []
arr.each_with_index do |num, index|
if num.to_i > 10
answer << next_ones(arr[index...(index + 15)])
end
end
answer.compact.join(" ")
end
processor(num_arr)
A bit verbose, and with bad naming, but it should give you some ideas.

Resources