ES6 – declare a prototype method on a class with an import statement

You can still attach a method on a class’ prototype; after-all, classes are just syntactic sugar over a “functional object”, which is the old way of using a function to construct objects. Since you want to use ES6, I’ll use an ES6 import. Minimal effort, using the prototype: import getColor from ‘path/to/module’; class Car { … Read more

Scala, importing class

logic.scala code package logic class Logic{ def hello = “hello” } main.scala code package runtime import logic.Logic // import object Main extends Application{ println(new Logic hello) // instantiation and invocation } compile the files with scalac scalac *.scala run your application with scala scala -cp . runtime.Main

How can I insert 10 million records in the shortest time possible?

Please do not create a DataTable to load via BulkCopy. That is an ok solution for smaller sets of data, but there is absolutely no reason to load all 10 million rows into memory before calling the database. Your best bet (outside of BCP / BULK INSERT / OPENROWSET(BULK…)) is to stream the contents from … Read more

All caps constants in JavaScript. And requireds. And imports

Generally speaking it is common practice to capitalize your constants. This is a convention which tells other programmers that the value is fixed. The javascript keyword const, though confusing is not a constant in that sense. I think that is where you got confused. A constant is a concept/construct. Not a primitive type within the … Read more

C# DllImport with C++ boolean function not returning correctly

I found the solution for your problem. Your declaration should be preceded with this marshaling: [return:MarshalAs(UnmanagedType.I1)] so everything should look like this: [DllImport(“Whisper.dll”, EntryPoint=”Exist”, CallingConvention=CallingConvention.Cdecl)] [return:MarshalAs(UnmanagedType.I1)] public static extern bool Exist([MarshalAs(UnmanagedType.LPStr)] string name); I tested it in my very simple example and it worked! EDIT Why this happens? C defines bool as 4 bytes int … Read more

Is it possible to turn off quote processing in the Postgres COPY command with CSV format?

Workaround (thanks to this comment!) COPY <tablename> FROM <filename> WITH CSV DELIMITER E’\t’ QUOTE E’\b’ NULL AS ”; So basically specifying a quote character that should never be in the text, but that’s pretty ugly. I’d much prefer it if there was in fact a way to turn off quote processing altogether.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)