Categories
Development

Scrape all youtube search results

I am trying to collect data from youtube search result. Search term is “border collie” with a filter for videos that were uploaded “Today”. 52 videos appear in the search result. However, when I try to parse the page, I only got 20 entries. How do I parse all 52 videos? Any suggestions is appreciated. […]

Categories
Development

How to preserve shell script line spacing when reading stdout?

I am executing a shell script on Windows 10 via Cygwin, reading stdout and stderr to a string, and passing that string to a struct that is used to execute an html template. The issue is that the spacing of the output is not preserved after executing the template. Here is how I am executing […]

Categories
Android Development

Android two way data binding on custom View. Cannot find getter

I am implementing two way data binding on custom View. I followed the official android developers but still can’t make it work. I have a knob that controlls integer value inside the value property. class ControlKnob(context: Context, attributeSet : android.util.AttributeSet) : RelativeLayout(context, attributeSet), IUIControl { companion object { @JvmStatic @BindingAdapter(“value”) fun setValue(knob : ControlKnob, value […]

Categories
Development Java Javascript

Did my Javascript run out of asyncIds ? (RangeError in inspector_async_hook.js)

First i use async and await very often and i get this error: RangeError: Value undefined out of range for undefined options property undefined at Set.add (<anonymous>) at AsyncHook.init (internal/inspector_async_hook.js:19:25) at PromiseWrap.emitInitNative (internal/async_hooks.js:134:43) And i dont know how i can fix this, i write my code completly in Typescript and i dont created any file […]

Categories
Development

Which simplest evaluation model explains call/cc?

TL;DR: What does call/cc do, (semi-)formally speaking? The long version: I’m vaguely familiar with continuations and call/cc, but I don’t have a strong formal understanding. I would like one. In the SICP video lectures we are presented with the substitution model and a metacircular interpreter. In Shriram Krishnamurti’s programming language course we are shown an […]

Categories
Development

How to round off gap between some arbitrary numbers?

I’m trying to find an algorithm to round off gap between some semi-random numbers such that if for example there are gaps with the close value they will be the same. for example, if we have “109 102 212 198 99 802” as gaps, they round to “100 100 200 200 100 800”. Assume that […]

Categories
Development MySQL SQL

MySQL execution time of subquery

When I am executing the bellow sql query the execution time is 0.0009 seconds SELECT min(step_number) as min_sn, request_id as rid from request_step where state = ‘pending’ GROUP BY request_id But when I am executing the next one the execution time is 0.6511 seconds select rs0.* from (SELECT min(step_number) as min_sn, request_id as rid from […]

Categories
Development

Passing `this` to child object

Is this method of passing and storing this to a child object still considered ‘acceptable’ when using C++17, or is there a more appropriate method, in line with the language and standard? I am specifically asking regarding passing and storing the Parent object as a plain pointer. class Child { public: void SetParent(Parent* p) { […]

Categories
Development

Does oracle sort stable?

Oracle version is Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production Inserted 10000 records with the same name value, then order by name, pageSize is 1000 and eventually could get 10000 id successfully. So it seems the sort is stable. Insert sql: @Insert(“insert into org_info(isvalid, update_time, org_uni_code,ORG_CHI_NAME) values(#{isvalid}, TO_TIMESTAMP(#{updateTimeStr}, ‘yyyy-mm-dd hh24:mi:ss.ff’), #{orgUniCode},#{name})”) void […]

Categories
API Development Python Windows

How to use unicode version Windows API: mciSendString(), Python

I’m testing a Python package on Windows 10: playsound It seems have problem with some characters of pathnames, like “c:\sauté” and wide characters. So It can’t find the files. Error 275 for command: open “C:\sauté.wav” alias playsound_0.4091468603477375 Cannot find the specified file. Make sure the path and filename are correct. I tried to use the […]