Click here to Skip to main content
15,893,594 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Eureka! regex matching with stored procedures Pin
Marc Clifton30-Oct-21 11:43
mvaMarc Clifton30-Oct-21 11:43 
GeneralRe: Eureka! regex matching with stored procedures Pin
honey the codewitch30-Oct-21 12:00
mvahoney the codewitch30-Oct-21 12:00 
GeneralRe: Eureka! regex matching with stored procedures Pin
Marc Clifton30-Oct-21 14:37
mvaMarc Clifton30-Oct-21 14:37 
GeneralRe: Eureka! regex matching with stored procedures Pin
PIEBALDconsult30-Oct-21 14:12
mvePIEBALDconsult30-Oct-21 14:12 
GeneralRe: Eureka! regex matching with stored procedures Pin
honey the codewitch30-Oct-21 14:23
mvahoney the codewitch30-Oct-21 14:23 
GeneralRe: Eureka! regex matching with stored procedures Pin
PIEBALDconsult30-Oct-21 15:26
mvePIEBALDconsult30-Oct-21 15:26 
GeneralRe: Eureka! regex matching with stored procedures Pin
honey the codewitch30-Oct-21 15:37
mvahoney the codewitch30-Oct-21 15:37 
GeneralSunshine, something that simple could never work. Pin
Cp-Coder30-Oct-21 6:01
Cp-Coder30-Oct-21 6:01 
I am working on a Kotlin app that needs to load a large file at startup. Because it can take up to 20 seconds it must be done in a separate thread so it won't block the UI thread. When it is loaded I need to send a signal to the main UI thread, so that the main thread will know the file is ready for further processing.

Being a Kotlin greenhorn, I battled for hours to send a signal from the background thread to the main thread, with no luck. Then I remembered reading something about a built-in Kotlin method :
runOnUiThread()
. "Surely it cannot be that simple", I thought. But in desperation I tried adding this statement to the end of the background thread:
runOnUiThread { someMethodOnUiThread() }
And voila! it worked. Apparently this little gem inserts the requested method into the execution queue of the UI thread.

Sometimes we look for complicated solutions when a perfect simple solution is right under our noses.

By the way: Please don't tell me I should have used a Kotlin coroutine. I tried that, but when you use a file reading class like ObjectInputStream the coroutine starts blocking the UI thread.
Get me coffee and no one gets hurt!



modified 30-Oct-21 15:09pm.

GeneralRe: Sunshine, something that simple could never work. Pin
Marc Clifton30-Oct-21 11:54
mvaMarc Clifton30-Oct-21 11:54 
GeneralRe: Sunshine, something that simple could never work. Pin
Cp-Coder31-Oct-21 2:26
Cp-Coder31-Oct-21 2:26 
GeneralRe: Sunshine, something that simple could never work. Pin
GuyThiebaut30-Oct-21 23:37
professionalGuyThiebaut30-Oct-21 23:37 
GeneralRe: Sunshine, something that simple could never work. Pin
Cp-Coder31-Oct-21 2:30
Cp-Coder31-Oct-21 2:30 
GeneralRe: Sunshine, something that simple could never work. Pin
GuyThiebaut31-Oct-21 2:43
professionalGuyThiebaut31-Oct-21 2:43 
RantIf you can't match UTF32 codepoints, you don't support unicode! Pin
honey the codewitch30-Oct-21 6:01
mvahoney the codewitch30-Oct-21 6:01 
GeneralRe: If you can't match UTF32 codepoints, you don't support unicode! Pin
User 1537592230-Oct-21 6:39
User 1537592230-Oct-21 6:39 
GeneralRe: If you can't match UTF32 codepoints, you don't support unicode! Pin
honey the codewitch30-Oct-21 6:59
mvahoney the codewitch30-Oct-21 6:59 
GeneralRe: If you can't match UTF32 codepoints, you don't support unicode! Pin
Dan Neely1-Nov-21 3:02
Dan Neely1-Nov-21 3:02 
RantAargs!!!!!! Pin
David O'Neil29-Oct-21 14:22
professionalDavid O'Neil29-Oct-21 14:22 
AnswerRe: Aargs!!!!!! Pin
Randor 29-Oct-21 15:18
professional Randor 29-Oct-21 15:18 
GeneralRe: Aargs!!!!!! Pin
David O'Neil29-Oct-21 15:31
professionalDavid O'Neil29-Oct-21 15:31 
GeneralRe: Aargs!!!!!! Pin
David O'Neil29-Oct-21 15:33
professionalDavid O'Neil29-Oct-21 15:33 
GeneralRe: Aargs!!!!!! Pin
CodeWraith29-Oct-21 17:50
CodeWraith29-Oct-21 17:50 
GeneralRe: Aargs!!!!!! Pin
Sander Rossel30-Oct-21 3:34
professionalSander Rossel30-Oct-21 3:34 
GeneralRe: Aargs!!!!!! Pin
David O'Neil30-Oct-21 4:44
professionalDavid O'Neil30-Oct-21 4:44 
Newsjobs-- Pin
Kent Sharkey29-Oct-21 11:54
staffKent Sharkey29-Oct-21 11:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.