What are the key differences between JavaScript and ActionScript 3?

First of all ActionScript 3 and JavaScript are both defined in ECMA-262 so they have a lot in common. Both languages feature prototype inheritance for instance. It is however not correct that ActionScript fully implements ES4. ActionScript implements a couple of features that are not defined in ECMA-262 and some — but definitely not all … Read more

WaitForSingleObject and WaitForMultipleObjects equivalent in Linux?

Stick to pthread_cond_timedwait and use clock_gettime. For example: struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 10; // ten seconds while (!some_condition && ret == 0) ret = pthread_cond_timedwait(&cond, &mutex, &ts); Wrap it in a function if you wish. UPDATE: complementing the answer based on our comments. POSIX doesn’t have a single API to wait for … Read more

Port of Random generator from C to Java?

Most of the time there is no need to use larger numeric types for simulating unsigned types in Java. For addition, subtraction, multiplication, shift left, the logical operations, equality and casting to a smaller numeric type it doesn’t matter whether the operands are signed or unsigned, the result will be the same regardless, viewed as … Read more

SQL Server equivalent of substring_index function in MySQL

Try this solution based on T-SQL and XQuery((root/row)[position() <= sql:variable(“@count”)]): T-SQL Scalar function: CREATE FUNCTION dbo.SUBSTRING_INDEX ( @str NVARCHAR(4000), @delim NVARCHAR(1), @count INT ) RETURNS NVARCHAR(4000) WITH SCHEMABINDING BEGIN DECLARE @XmlSourceString XML; SET @XmlSourceString = (SELECT N'<root><row>’ + REPLACE( (SELECT @str AS ‘*’ FOR XML PATH(”)) , @delim, N'</row><row>’ ) + N'</row></root>’); RETURN STUFF ( … Read more