AsyncTask in DBHelper select?

Question: I'm trying to make my Android app be more efficient and faster, so I wanted to make the db calls asynchronous (using asynctask), but I can't figure out how.
Below is my code snippet:

public List<POI> todosPOIs() {
    List<POI> POIs = new ArrayList<POI>();

    SQLiteDatabase db = getWritableDatabase();
    Cursor cursor = db.rawQuery("SELECT * FROM " + NOME_TABELA, null);

    if (cursor.moveToFirst()) {
        do {
            POIs.add(new POI(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4),cursor.getString(5),cursor.getString(6),cursor.getString(7),cursor.getString(8),cursor.getString(9),cursor.getString(10),cursor.getString(11)));
        }
        while (cursor.moveToNext());
    }
    cursor.close();
    db.close();
    return POIs;
}

EDIT:
I've did what you said and it worked but the app keeps being slow.                 Ive enabled strictmode so i could see why is it slow and this is my logcat. Any thoughs??

03-12 09:07:02.385  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=29 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:592)
            at android.database.sqlite.SQLiteConnection.setPageSize(SQLiteConnection.java:244)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:213)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.385  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=28 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:592)
            at android.database.sqlite.SQLiteConnection.setForeignKeyModeFromConfiguration(SQLiteConnection.java:274)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:214)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.386  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=25 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:635)
            at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:313)
            at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:287)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.386  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=23 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:635)
            at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:316)
            at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:287)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.387  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=21 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:635)
            at android.database.sqlite.SQLiteConnection.setSyncMode(SQLiteConnection.java:294)
            at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:288)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.388  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=19 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:592)
            at android.database.sqlite.SQLiteConnection.setJournalSizeLimit(SQLiteConnection.java:264)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:216)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.388  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕ StrictMode policy violation; ~duration=18 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
            at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1118)
            at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1038)
            at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:592)
            at android.database.sqlite.SQLiteConnection.setJournalSizeLimit(SQLiteConnection.java:266)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:216)
            at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
            at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
            at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
            at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
            at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
            at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
            at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:972)
            at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at roteiro.pap.pedro.roteiro.DBHelper.todosPOIs(DBHelper.java:135)
            at roteiro.pap.pedro.roteiro.DBHelper$getData.doInBackground(DBHelper.java:128)
            at roteiro.pap.pedro.roteiro.DBHelper.getTodosPOIs(DBHelper.java:115)
            at roteiro.pap.pedro.roteiro.Lista.onCreate(Lista.java:60)
            at android.app.Activity.performCreate(Activity.java:5122)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2446)
            at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3953)
            at android.app.ActivityThread.access$700(ActivityThread.java:165)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1382)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5434)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
03-12 09:07:02.389  28028-28028/roteiro.pap.pedro.roteiro D/StrictMode﹕

......

Thanks
Comment: http://stackoverflow.com/a/16293261/1576416
Comment: Having parallel AsyncTasks with db-access is not good. From personal experience I'd recommend builing a service for db access and have db-access async but sequential and from one thread, only.
Comment: @Fildor can you explain that better? If possible with an example? Thanks
Answer: You can do something like:
 private class getData extends AsyncTask<Void, Void, List<POI>>{
            @Override
            protected List<POI> doInBackground(Void... params) {
                return todosPOIs();
            }

            @Override
            protected void onPostExecute(List<POI> result) {
                if(result.size > 0){
                    //Do with the result whatever you want
                }
            }

and execute this with new getData().execute(); wherever you want to call this async method
Comment: @hkskrs It helped but didnt solved it, please take a look at the main post :)

AsyncTask in DBHelper select?


Controlling movement direction in isometric view

Question: In an isometric view, floor tiles would be aligned diagonally.

On this view, an entity can be moved to adjacent tiles, as illustrated by the green arrows.
Since the movement is diagonal (to the rendering on the monitor), using the arrow keys to navigate seems counter-intuitive to me. Without being told, you have no idea which way the entity moves when you press the up key.
How could the movement-controls via keyboard be implemented intuitively?
Comment: Turn your keyboard round by 45 degrees.
Comment: After pressing the first arrow key, people get used to the key layout and  know it for the rest of the session.
Comment: I agree with Kasper and Izkata above. As long as there is immediate feedback and "nothing crazy" (lol) the player will quickly understand the controls. Its similar to the angled mouse cursor: & just like initialisation-action most users go through with the mouse (i.e. shaking it to find it on screen), most gamers use the first few movement in a control-driven game to orientate themselves. This book provides more cognitive insight: Psychology, Pedagogy, and Assess* in Serious Games by Connolly, Thomas M. [Google Books Link](https://books.google.co.za/books?id=V-BGAwAAQBAJ&source=gbs_navlinks_s)
Comment: In many flash games, there's a north arrow (like on a map) that indicates which direction the up arrow key will take you. Granted, it's still not the most natural, but most users will notice it, allaying their confusion.
Comment: I agree with @KaspervandenBerg - it doesn't matter, as long as it's close.  Control schemes are transparent and give immediate feedback, so as long as it's a simple rotation of 45 degrees (that is, nothing crazy like mirroring, or a complete 180 where up=down), players will understand "this direction is 'up'" and adapt within a couple seconds.  From then on there's no thought involved.
Comment: diagonal squares count as adjacent? (the possible movements are 8? or just 4?)
Comment: @rewobs: Just four possible movements. The entity can be moved only to tiles that share a *side* with the current tile.
Comment: not going to right a new answer as it has already been answered, number keys are a useful way. Also a common way in the olden days (e.g. little big adventure) is to have your character controlled like a vehicle, forward moves him forward, back backwards and left and right turns him. Sounds pretty awkward and does take some getting used to but it sometimes worked quite OK.
Answer: Very few isometric games have a keyboard control scheme.
The few I remember playing that used the arrow keys to move treated a single key as an orthogonal direction. To get diagonal movement you needed to press two keys like down and right. Some even mapped all 8 surrounding squares to the numbers on the keypad (except 5) so you had a full range of motion. (This was mostly in turn-based games like Civilization before it switched to hexes.)

Any real-time or reflex-oriented game uses a mouse. It's more precise, you can move more than one square per interaction, and you don't have to worry about what direction maps to which key. There is a reason the original Diablo called out requiring a mouse as a system requirement.

If a mouse or touch input isn't an option, you may want to consider moving away from an isometric perspective and go with more of a 2.5D view like older Zelda or Pokémon games. Most players won't notice the difference, and everything conforms to a grid more easily, which is great when movement is limited to a D-pad or arrow keys.

(Image from http://www.eurogamer.net/articles/2013-12-09-a-link-to-the-past-awakens-on-the-wii-u-eshop)
Comment: +1 Civilization example. I remember that this was also a problem and later versions are using hexagon model instead of squares, which completely takes out keyboard input too.
Answer: An isometric view of a game doesn't have to be presented as a symmetric view.
For example PacMania is pacman with a pseudo-3D isometric view, but still lets you use the left-right, up-down keys without ambiguity in their direction.
Comment: *Technically*, this is no longer an isometric projection. But +1, it might very well be useful for the OP.
Answer: If you want it to be intuitive then you could be a bit clever about it.
Add an item into the level a few squares away from them, and tell them to "Using The Arrow Keys, Move Forward Towards The Macguffin"
Then whatever button they use to do this is the one you map to that direction.

That way you're matching their own mental model of how the navigation works.
It's a similar approach that FSP games use - some gamers prefer to push thumbstick up to look up, others prefer to push down for the same action. Games will often state "Look up" and will use that instruction to map the thumbstick controls automatically.
Of course you could also add an option for them to map their own controls should they desire.
Comment: What happens if I press both Up and Right to go diagonally? You'd have to make the game smart enough to adapt to that or I'll be stuck with either Up or Right not doing what I expect and I'll need a way to remap later.
Comment: I have to admit, that solution is pretty nice. Just three things. 1: Doesn't the phrase "Move Forward Towards" imply using the up key? 2: When I thought about it, I would have had no idea which key I would use. 3: To me, it still feels like I have to *bend* my mind to align the arrow keys with diagonal movement. I was hoping for a more *natural feeling* solution.
Comment: Yeah, maybe my wording is a bit clunky (and I went with Camel Case too for some crazy reason) but perhaps just "Use the cursor keys to move towards the mcguffin" would work too.
Comment: @NathanRabe True. That's why FPS games have in-game options screen where you can flip with Y axis controls. Something similar should be added to this game too.
Answer: History shows a few approaches of handling isometric controls.
The oldest game to use absolute isometric controls I can think of is Q Bert:

This was usually played on the joystick - which had 8 directions, not just the 4 arrow keys. Interestingly, though, instead of using diagonal movement on the joystick. you were supposed to tilt the whole joystick, enabling a far more comfortable control experience. Up, left, etc. mapped well to the screen this way.
Of course, doing this with the keyboard is rather clunky - even more so when you realize that the arrow keys actually aren't symmetric - the down key is usually between left and right, making this even more clunky. However, the numeric keyboard is commonly used for navigation as well. In fact, when you turn your numeric keyboard off, provided you have a desktop keyboard, 4 is left etc. This allows you to control isometric movement quite easily using 7, 9, 1 and 3.
And again, the numeric keys for that also map to other keys on the keyboard - Home, Page up, End and Page down. On traditionally layouted keyboards, those can also be used, even when not using the numeric keyboard - they form a nice square that maps perfectly into isometric controls. If you only allow isometric movement, this is incredibly easy to use - if you also want to allow movement accross (i.e. straight up/down etc.), I'd suggest using the numeric keyboard instead - but of course, if you go by virtual keys, there's no difference between Home on the numeric keyboard and the other Home key. If numlock is off, of course :)
Of course, the old trick with a joystick can just as easily be handled with gamepads on modern computers - although it usually isn't necessary (or worth the worse ergonomics), since modern gamepads are usually quite easy to with diagonals.
The last option would be the mouse - this is most useful in games where the world is isometric, but not a fixed movement grid - you're moving in any direction you want, and it's just the rendering (and terrain etc.) that's actually grid-like.
Notebook keyboard are usually the trickiest. Even if you do have some nice cluster of keys that could be used comfortably, they usually aren't aligned in a perfect square, which hurts a bit. In the end, make the controls configurable - different keyboards have different ergonomics.
Answer: I can imagine two more ways (apart from the ones already presented) for this:
Separating direction change from position change

Left-Right for direction: The first consist in using left/right arrows to turn the character left/right without leaving the square.
Forward-Backward for changing position/step: Then using forward/backward arrows to move to the square the character is facing or giving
his/her back.

A lot of 3rd person games works this way (Silent Hill, Resident Evil, Dino Crisis, etc) so the controls will be familiar. I think this could work really well and consistently if the squares the character can move to are just 4, specially if the animations are not slow.
Squared Mapping
As the possible outputs maps with the corners of an rectangle, you could use a group of four keys like (4,5) for upper corners, and (1,2) for bottom corners.

 EDIT: Deprecated after OP owner clarification of just 4 possible movements
Using 2 arrows to indicate diagonals
This would be the same as Nathan's approach but replacing the numbers in the corners of the numpad for arrow combinations.

You'll have more work processing the input, but at least for me it will be more comfortable as a user compared with the numpad-numbers approach, since the distance between keys is the minimum, which gives provides more speed (the finger movement required is less) and also reduce the chance of pressing a key that you didn't want to.
Comment: This is just such a great answer!
Comment: The games you describe are played from the character's point of view (or at least, largely pointed in the same direction as the character), so the primary actions are as you describe.  But in an isometric game, the PoV is from above and doesn't rotate, so when the player thinks "I want this character here", they now have to translate that into "turn left, turn left, forward" instead of "go this way" - it's not much extra thought, but it's definitely more than necessary (and more likely to break the immersion)
Answer: Using the up arrow for either northeast or northwest seems fine to me. Which?
It doesn't matter
As others have mentioned, the feedback loop is so fast that the user will figure it out quickly. But:
Up arrow = northeast
This seems the most intuitive, because (English speakers at least) associate forwards with right. And if you're still worried:
Make the first level very directional
Start out on a street or something with a very clear "forward" direction, perhaps with an arrow painted on the ground - all oriented to the northeast. The user will have a really strong sense that they should go "forward" and "northeast" at the same time.
Answer: For completeness`s sake, here is one possible solution to communicate the controls to the user I played around with.

By showing the user the control keys directly in the level, I try to minimize the confusion, as the user is reminded of the control scheme at all times.
It is noteworthy that this seems not to work as well with the arrow-keys, as an up-arrow in the upper-right corner representing up-right movement still is a conflict. This is prevented by using W, A, S and D, which are not associated as closely to direction as the arrow keys.
Answer: I think the Pacman example shows the answer. The confusion is in the way the figure is standing. If you set the figure in a three-quarter view, and give the figure a (three-quarter) face, it then becomes obvious which way is forward, left, right, etc.
Answer: You can also try other keys than the "traditional" Arrow/WASD, like:

QWAS
1245 (Numpad)


If $u:[0,\infty)\times\mathbb R\to\mathbb R$ is a $C^\infty$ solution of $u_t(t,x)-u_{xx}(t,x)=0$ then $\frac{d}{dt}\int_\mathbb R u(t,x)\,dx\equiv0$

Question: Problem: Suppose $u:[0,\infty)\times\mathbb R\to\mathbb R$ is a smooth solution to $u_t(t,x)-u_{xx}(t,x)=0$ such that $u$ and its derivatives are integrable. Show that
$$\frac{d}{dt}\left[\int_\mathbb R u(t,x)\,dx\right]\equiv0.$$
My Attempt: Differentiating under the integral and applying the hypothesis we get
$$\frac{d}{dt}\left[\int_\mathbb R u(t,x)\,dx\right]=\int_\mathbb{R}u_t(t,x)\,dx=\int_\mathbb{R}u_{xx}(t,x)\,dx=u_x(t,x)\bigg\vert_{x\to-\infty}^{x\to\infty}.$$
But I cannot see how the above limits converge to zero. I also thought about applying some energy estimate, using the energy
$$E(t)=\int_{\mathbb R}u(t,x)^2\,dx,$$
but I could not see a way to go with this either.

Could anyone point me in the right direction, with a hint only.
Thank you for your time and appreciate any help.
Answer: Hint: if $f$ and $f'$ are both integrable then
$$\lim_{x\rightarrow\pm\infty} f(x)=0$$
(use the mean value theorem)


MS Access - Joining GUID and String columns

Question: I'm having trouble with Access, when joining two tables where one of the join columns is of varchar and the other of guid type.
The generated SQL statement looks as follows:
INSERT INTO adnVFD
SELECT dbo_adnVFD.*
FROM PRC INNER JOIN dbo_adnVFD ON PRC.PrcId = dbo_adnVFD.VarType;

I tried to convert the PRC.PrcId column using the StringFromGUID function, so that both columns should be of the same type. But without success.
Any ideas about how to solve this issue?
Answer: How about using a derived table, for example:
SELECT  b.*
FROM Table2 b
INNER JOIN (SELECT StringFromGUID([ID]) As Expr1 FROM Table1) a
ON b.Expr1=a.Expr1

Comment: I tested before I posted. Are your tables both MS Access?
Comment: No, actually I'm importing rows from SQL server with the help of linked tables. I link a couple of tables from SQL server. In the first query I add a where clause, while for the subsequent queries I simply join on the (not linked) tables in order to select only related data.
Comment: Can you use a passthrough query and , say, http://stackoverflow.com/questions/6299918/sql-server-converting-uniqueidentifier-to-string-in-a-case-statment? I do not think you are going to get this to work with MS Access functions.
Answer: If I
(1) Create a new table that has two fields -- (a) ID, set as an autonumber, field size replication ID (aka Guid), and (b) ID2, text(255)
(2) Add a row, let it create the autonumber, and copy and paste that from ID into ID2
(3) SELECT Table1.ID, Table1.ID2 FROM Table1 where ID = ID2
I get back my row. Note that the pasted string does contain braces. You may want to make sure the comparison isn't dropping them somehow.
I then created a second table, with two text fields, both text(255), and joined on:
SELECT Table1.ID, Table1.ID2, Table2.Field1
FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID;

Which worked fine and brought me back my row. My money's on missing braces in your case.
I didn't need to use StringFromGUID() at all.


In javascript, whether Bitwise OR use iee-754 as storage format during calculation nor not ?

Question: if Bitwise OR was used ieee-754 to calc the result in Javascript,i can't understand the result.
for example:
2|1 =>3

In ieee-754,
2 is stored as 0 10000000000 0000...0000,and
1 is stored as 0 01111111111 0000...0000
if exec bitwise or,i think the result is 0 11111111111 0000...0000,but why does it output 3?
As same as above,
example:
0.1|0 =>0

0 is stored as 0 00000000000 0000...0000,and
0.1 is stored as 0 01111111011 1001100110011001100110011001100110011001100110011010
if exec bitwise or,i think the result is 0 01111111011 1001100110011001100110011001100110011001100110011010,but why does it output 0,and lose decimal?
example:
2|-1 =>-1

2 is stored as 0 10000000000 0000...0000,and
-1 is stored as 1 01111111111 0000...0000
if exec bitwise or,i think the result is 1 11111111111 0000...0000,but why does it output -1?
Comment: in javascript the number is converted to a 32 bit integer number, then the bitwise operation is made and the result is converted back to the standard format of 64 bit float..
Comment: you miss the integer part.
Comment: Have some spec or document indicate that ? @NinaScholz
Comment: here you go: [Bitwise Operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators)
Comment: [How do I convert a float number to a whole number in JavaScript?](//stackoverflow.com/a/12837315)  Also [Read/Write bytes of float in JS](//stackoverflow.com/a/35748581) for actually type-punning so you could bitwise OR the bit-patterns of floating-point numbers.  Not exactly a duplicate, though.
Comment: Possible duplicate of [~ bitwise operator in JavaScript](https://stackoverflow.com/questions/32527807/bitwise-operator-in-javascript) (The answers there state that bitwise operators convert from `Number` (double) to 32 bit integer)
Comment: but why 0.1|0 is output 0? As the document,number will convert to 32bit,but after bitwise or,the result should be `0 01111011 10011001100110011001101`
Comment: 1.1|0 is output 1,also lose the decimal,i wonder that why the decimal was email@example.com javascript lose decimal in 32-bit,not use ieee-754 binary32
Comment: @HanQ again, bitwise operations first convert the number to a 32 bit ***integer*** so `0.1` would be converted into `0b0` while `1.1` would be converted to `0b1` before the operation is even calculated.
Comment: what is mean `0b0`?what's the `b`?@VLAZ
Comment: `0b` - prefix meaning "binary number" `0b0` - zero in binary, `0b10` is the binary number for the decimal `2`.
Answer: JavaScript is an implementation of ECMAScript. The ECMAScript 2018 Language Specification (9th edition, June 2018) specifies the binary bitwise operators in clause 12.12. The evaluation steps in 12.12.3 include (using "@" to stand for one of the bitwise operations):

Let lnum be ? ToInt32(lval).
Let rnum be ? ToInt32(rval).
Return the result of applying the bitwise operator @ to lnum and rnum. The result is a signed 32-bit integer.

Thus, the bitwise operation is not performed on the bytes that represent a Number. The value of the Number is converted to a 32-bit two's complement representation of an integer, and the operation is performed on those bits. Then resulting bits are then interpreted as a 32-bit two's complement representation, so the value they represent becomes the value produced by the operation.

In javascript, whether Bitwise OR use iee-754 as storage format during calculation nor not ？


Fancybox does not work when thumbnails contain an overlay div

Question: I prepared a list of thumbnails that should work with Fancybox. However I want also that, on mouse hover the thumbnail changes color and a title appears (this should happen before clicking).
I prepared my HTML as follows:

<link href="css/jquery.fancybox.css" rel="stylesheet" media="screen">

The house

                    The garden

The house

                    The garden

and the relative CSS as follows
.gallery {
  margin: 60px 0 0 0;
  padding: 0;
}
.gallery-item {
  width: 25%;
  min-height: 100px;
  margin: 0;
  display: inline-block;
  float: left;
  overflow: hidden;
  position: relative;
}
.gallery-item .hover-wrap {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
.gallery-item img {
  width: 100%;
}
.gallery-item img {
  -webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
  -o-transition: all 0.4s ease;
  transition: all 0.4s ease;
}
.gallery-item:hover img {
  -webkit-transform: scale(1.1);
  -moz-transform: scale(1.1);
  -ms-transform: scale(1.1);
  -o-transform: scale(1.1);
   transform: scale(1.1);
}
.gallery-item .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  opacity: 0;
  filter: alpha(opacity=0);
  background-color: rgba(1, 188, 158, .75);
  background-image: url(../Images/icon-magnifier.png);
  background-position: center 40%;
  background-repeat: no-repeat;
  -webkit-transition: opacity 0.15s ease-in-out 0s;
  -moz-transition: opacity 0.15s ease-in-out 0s;
  -o-transition: opacity 0.15s ease-in-out 0s;
  transition: opacity 0.15s ease-in-out 0s;
}
.gallery-item:hover .overlay {
  opacity: 1;
  filter: alpha(opacity=1);
  cursor:pointer;
}
.gallery-item .overlay-text {
  position: absolute;
  bottom: 20px;
  left: 20px;
}
.gallery-item .overlay-text h3 {
  font-size: 1.4rem;
  color: #fff;
  font-weight: normal;
  margin-bottom: 0;
}
.gallery-item .overlay-text .caption {
  font-family: 'OpenSans', serif;
  font-style: italic;
  color: #fff;
  font-size: 1.6rem;
  line-height: 28px;
}

It seems that, by having a div (.overlay) over the thumbnail the Fancybox doesn't work.Am I doing something wrong? Consider that I have written here only the basic CSS involved in the problem, thus the overall effect of the container is not as it should be.
Thank you for helping!
Comment: As you suspected, the issue is more than likely the overlay.
Since the overlay element sits on-top of your fancybox element, the user is clicking on the overlay element, not the fancybox element. Maybe target the fancybox element itself with your hover action for the opacity. You can put the text element in as a child to the fancybox to have it react to a fancybox hover action.
Answer: As pointed out in the comments, when you click on the .gallery-item element, the actual target is the .overlay selector and not the .fancybox selector so the latest never gets fired.
You may need to add a click event handler for the .overlay that triggers its .fancybox sibling selector like :
var tpj = jQuery;
tpj.noConflict();
tpj(document).ready(function () {
    /*
     *  Simple image gallery. Uses default settings
     */
    tpj('.fancybox').fancybox();
    tpj(".overlay").on("click", function (event) {
        event.preventDefault();
        tpj(this).siblings(".fancybox").trigger("click");
    }); // on
});

See JSFIDDLE


How to write XML tags of GRPO which has more than one document rows, SAP B1?

Question: I have a question related to XML.
I'm not good in XML, but according to my example of tags and screenshots I can write XML tags which have CardCode and Dates of GRPO.
The problem I have now is I do know how I can include document rows in my tags
Example of tags
<?xml version="1.0" encoding="utf-8"?>
<GRPO>

<Goods>
<CardCode>V10000</CardCode>
<DocDate>07/11/2016</DocDate>
<DocDueDate>07/11/2016</DocDueDate>
<TaxDate>07/11/2016</TaxDate>
</Goods>

<Goods>
<CardCode>V1010</CardCode>
<DocDate>07/11/2016</DocDate>
<DocDueDate>07/11/2016</DocDueDate>
<TaxDate>07/11/2016</TaxDate>
</Goods>

</GRPO>

1st screenshot

2nd screenshot

I want to have the above data in XML,
How can I include document rows data in my XML tags?
Please anyone can help me.
Answer: If I understand your question correctly, you're unsure how to configure the Lines in your custom XML layout, correct?
If that's your question then you can do something like this:
<?xml version="1.0" encoding="utf-8"?>
<GRPO>
<Goods>
<CardCode>V10000</CardCode>
<DocDate>07/11/2016</DocDate>
<DocDueDate>07/11/2016</DocDueDate>
<TaxDate>07/11/2016</TaxDate>
<GoodsLines>
   <Line>
      <LineNum>0</LineNum>
      <ItemNo>A00003</ItemNo>
      <ItemDesc>J.B Officeprint 1186</ItemDesc>
      <Quantity>4</Quantity>
   </Line>
   <Line>
      <LineNum>1</LineNum>
      <ItemNo>A00004</ItemNo>
      <ItemDesc>Rainbow Color Printer 5.0</ItemDesc>
      <Quantity>5</Quantity>
   </Line>
</GoodsLines>
</Goods>
</GRPO>

Another alternative is to use Attributes instead of Elements for the Line Definitions, so same as above, but something like this:
...
<GoodsLines>
   <Line LineNum="0" ItemNo="A00003" ItemDesc="J.B. Officeprint 1186" Quantity="4" />
   <Line LineNum="1" ItemNo="A00004" ItemDesc="Rainbow Color Printer 5.0" Quantity="5" />
</GoodsLines>
...

Comment: Thank you so much Overhed, that's what I wanted.


Under Tensorflow 2.0, how to use tf.summary?

Question: It seems the use of tf.summary under TF2.0 is different from TF1.x. If I want to visualize multiple scalars (e.g., train_loss, val_loss, etc.) in TensorBoard, how to implement tf.summary in the code. I thought it might be:
writer = tf.summary.create_file_writer('summaries')
for epoch in range(epochs):
    ...
    train_loss = ...
    val_loss = ...
    tf.summary.scalar('train_loss', train_loss)
    tf.summary.scalar('val_loss', val_loss)
    writer.flush()

But it doesn't work. I think the problem may be from the use of write.flush().
Answer: In tensorflow 2.0, you need to set default writer via .as_default(). Also, step argument must be passed in summary ops. More details can be seen here.
writer = tf.summary.create_file_writer("summaries")

for epoch in range(epochs):
    train_loss = ...
    val_loss = ...
    with writer.as_default():
      tf.summary.scalar('train_loss', train_loss, step=epoch)
      tf.summary.scalar('val_loss', val_loss, step=epoch)
    writer.flush()


snap is broken because of moving files

Question: I had a nearly full / drive.
Thats the reason why I moved the content of /snap on a own partition.
I stopped snap, moved the content, mount the new partition and started snap.
/etc/fstab
/dev/HDD/snap /snap ext4 defaults 0   1

When i try to install Chromium i get this error:
sudo snap install chromium
Fehler: cannot perform the following tasks:
- Den Konfigurationshook von Snap "chromium" ausführen, falls vorhanden (run hook "configure": cannot locate base snap core18: No such file or directory)

ll /snap
insgesamt 56
drwxr-xr-x 13 root         root         4096 Jan  4 10:27 ./
drwxr-xr-x 20 root         root         4096 Dez 29 10:02 ../
drwxr-xr-x  3 root         root         4096 Dez 18 00:30 anbox/
drwxr-xr-x  2 root         root         4096 Jan  4 10:27 bin/
drwx------  4 jokergermany jokergermany 4096 Dez 18 00:24 carnet/
drwx------  4 root         root         4096 Dez 18 00:25 core/
drwx------  4 root         root         4096 Dez 18 00:26 core18/
drwxr-xr-x  4 root         root         4096 Dez 18 00:26 gnome-3-28-1804/
drwxr-xr-x  4 root         root         4096 Dez 18 00:27 gtk-common-themes/
drwx------  2 root         root         4096 Dez 18 00:27 lost+found/
-r--r--r--  1 root         root          548 Dez 18 00:16 README
drwxr-xr-x  4 root         root         4096 Dez 18 00:27 snapd/
drwxr-xr-x  3 root         root         4096 Dez 18 00:27 software-boutique/
drwxr-xr-x  3 root         root         4096 Dez 18 00:27 ubuntu-mate-welcome/

snap list
Name                 Version                     Rev    Aufzeichnung     Herausgeber       Hinweise
anbox                4-56c25f1                   186    latest/beta      morphis           devmode
carnet               0.22.1                      16     latest/stable    alexandre-roux-m  -
core                 16-2.48                     10577  latest/stable    canonical✓        core
core18               20201210                    1944   latest/stable    canonical✓        base
gnome-3-28-1804      3.28.0-19-g98f9e67.98f9e67  145    latest/stable    canonical✓        -
gtk-common-themes    0.1-50-gf7627e4             1514   latest/stable    canonical✓        -
snapd                2.48.1                      10492  latest/stable    canonical✓        snapd
software-boutique    0+git.f633ffb               54     latest/stable/…  flexiondotorg     classic
ubuntu-mate-welcome  20.10.0-bb92cef1            575    latest/stable    flexiondotorg     classic

How can i fix this?
Comment: You will probably need to do a bit more work with mount points. Take a look at the third option in [this answer](https://askubuntu.com/a/1070635/1091774), and you'll see the mount points that need to be managed. I'd say you're more than halfway there, though
Comment: You mean that i should change the mount point for /var/lib/snapd aswell?
Do i have to?
Comment: /dev/HDD/snap seems to be non-existent.
Comment: my /snap directories have drwxr-xr-x permissions and are all owned by root - maybe a chmod and chown is needed   ---- drwxr-xr-x 2 root root 4096 jan  5 16:53 bin
drwxr-xr-x 4 root root 4096 jan  5 21:16 core
drwxr-xr-x 4 root root 4096 jan  5 11:51 core18
drwxr-xr-x 3 root root 4096 jan  4 19:55 core20
Comment: Thansk for your help. Setting the permissions didn't work.
dev/hdd/snap exists:
mount | grep snap
```
/dev/mapper/HDD-snap on /snap type ext4 (rw,relatime)
```
I will purge snap now...
Comment: It doesn't make sense to move the contents of `/snap` to a different partition. The directory contains a README file, read it: `The disk space consumed by the content under this directory is
minimal as the real snap content never leaves the .snap file.
Snaps are *mounted* rather than unpacked.`
Answer: Okay, i gave up.
sudo apt-get purge snapd snap
sudo apt-get install snapd snap

and everything is working
Comment: if you remove snap and snapd system may broke !
Answer: Finally! After reboot:
sudo apt-get purge snapd snap
sudo apt-get install snapd snap
sudo snap install snap-store

Answer: Same problem on me when reinstall snap-store on Ubuntu 22.04
Run configure hook of "snap-store" snap if present (run hook "configure": cannot locate base snap core20: No such file or directory)
I solved it by reinstalling "core20":
sudo snap remove core20
then
sudo snap install core20
Cannot locate base snap core20: No such file or directory

snap is broken because of moving files


Use TRIM in JOIN

Question: I have the following SQL code
SELECT      State.CODE                    Code,
            State.CODE1                   Code1,
            State.CODE2                   Code2,
            YYY.1003."BRANCH"            "Branch"
     FROM   XXX.1002 State
            LEFT JOIN YYY.1003
                   ON State.CODE= YYY.1003.CODE

Now I need a new column that shows me the field/ column "Country" from table ZZZ.100.
The key is 1002.CODE1 - ZZZ.100.CODE1
Unfortunately, ZZZ.100.CODE1 has spaces before the values (4 spaces).
How can I use the trim function (is this the right one) to get a join on 1002.CODE1 - ZZZ.100.CODE1
Comment: I just find the code so hard to read with numeric table names and aliases.  I'm a bit lost on what `ZZZ.100` is.  It is not part of your query.
Comment: Like `1002.CODE= Trim(YYY.1003.CODE)`?
Comment: Thanks @JNevill: How would you combine that join with the join above?
Answer: It looks like you want:
select x.code, x.code1, x.code2, y.branch, z.country
from xxx.1002 x
left join yyy.1003 y on x.code= y.code
left join zzz.100  z on trim(z.code1) = x.code1

trim() removes spaces on both ends of the string. If you want to remove only leading spaces, you can do: trim(leading ' ' from z.code1).
Note that I used more meaningful table aliases, in order to make the query easier to write and read.
I would also reommend against using all-digits table names: in Oracle, non-quoted identifiers must begin begin with an alphabetic character.
Answer: First thing is why a Key column contains spaces on it? A key column should never contain spaces, it is terrible for performance.
The point to think about here is to remove those spaces from this column
The use of TRIM, considering you are using SQL Server
In SQL Server you can use LTRIM (for left trim, remove left spaces) and/or RTRIM (for right trim, remove right spaces)
Ex:
Select
LTRIM(RTRIM(Table.Column))
from Table
I hope this can help you

Use TRIM in JOIN


dpkg and equivs

Question: i am trying to make a metapackage with equivs, creating the package is working perfect, but installing it is giving me an error:
<code>Selecting previously deselected package testdeb.
(Reading database ... 219619 files and directories currently installed.)
Unpacking testdeb (from testdeb_1.0_all.deb) ...
dpkg: dependency problems prevent configuration of testdeb:
testdeb depends on apache2; however:
Package apache2 is not installed.
dpkg: error processing testdeb (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
testdeb
</code>
to fix that i have to run: apt-get install -f
is there a way around this ?
Comment: Are you installing with `dpkg -i`? AFAIK `dpkg` doesnot resolve dependencies `apt` does. `dpkg` just refers to missing dependencies if any.
Comment: yes i tried that for testing on my local machine, installing via apt is working, thanks !
Comment: @sagarchalise can you post that as an answer? :)
Answer: Posting comment as the answer:
Are you installing with dpkg -i? AFAIK dpkg doesnot resolve dependencies apt does. dpkg just refers to missing dependencies if any. – sagarchalise Dec 1 '11 at 2:19

dpkg and equivs


Assigning a nested interface in typescript

Question: I am trying to assign a value to a nested interface in typescript but the compiler seems to throw an error even though the format matches correctly

type wheelT = [contemp: number, motemp: number, error: string];

interface getData {
  frontLeft: wheelT[];
  frontRight: wheelT[];
  rearLeft: wheelT[];
  rearRight: wheelT[];
  voltage: number;
  amps: number;
  mode: string;
  FWD: string;
}

initjson: getData = {
    frontLeft: [0, 0, "000"],
    frontRight: [0, 0, "000"],
    rearLeft: [0, 0, "000"],
    rearRight: [0, 0, "000"],
    voltage: 0,
    amps: 0,
    mode: "--",
    FWD: "--",
  };

essentially throws an error at frontLeft, frontRight, rearLeft, rearRight saying it is not assignable.
Answer: Your type does not match correctly. Your wheelT type is a tuple with 3 entries. frontLeft (as well as frontRight, rearLeft, rearRight) is of type wheelT[] - so an array of tuples. Change this to wheelT (without the array brackets) and it should work.
Without the array brackets, getData looks like this:
interface getData {
  frontLeft: wheelT
  frontRight: wheelT;
  rearLeft: wheelT;
  rearRight: wheelT;
  voltage: number;
  amps: number;
  mode: string;
  FWD: string;
}

Here the working TS Playground.


Recommended size in percentage for each partition

Question: I have seen most of dedicated hosting companies servers always have multiple partition for various folders. I have tried to follow some guide lines on my own on virtual box. I always use swap space as double the ram. let's say
TS = total Size
SS = Swap Size
MS = Main Size

MS = TS - SS

What is bellow is percentage on MS.
/         20%
/boot     100M
/var      25%
/home     24%
/usr      10%
/tmp      200M
/opt      10%

it looks like I still need some key places I should give more space and some other places I should reduce space for example /usr and /var.
Your contribution would be greatly.
Answer: /  100%

I'm serious.
The only reason I could find for doing this in a hosting capacity is that it makes it easier to do partial backups. The host can just take live snapshots of the bits that change (/var/, /home/) and take slower backups of /etc/ and pretty much everything else can be restored at install time.
It's by no means standard practice and you can do the same thing intelligently if you know where the data churn is... But to a big host this could mean terabytes of savings. With one virtual host, you're not saving anything. You're just giving yourself a headache.
Let the installer do what it wants to do unless you've got a really good reason.
Comment: I think that a personal workstation is quite different from a multiuser server... in the latter, for example, splitting out /tmp avoid users filling the system disk (maliciously or not). The same for the /var files. For a personal installation, I still advise for [`/` and `/home`](http://askubuntu.com/a/379019/16395) (for easy re-installations).
Comment: "For a personal installation, I still advise for / and /home (for easy re-installations)." I agree entirely and my / takes up remarkably little space, under 10GB, and I have lots of stuff installed. I wouldn't use 20% for / on, for example a 500GB HDD because that would leave a _lot_ of wasted space.
Comment: My `$HOME` lives on / proper and I just move the stuff I'd like to keep out to a RAID5 array and symlink it back. This is fairly trivial and means I'm not constrained to arbitrary limits... But I agree that it's okay for some people... But in the case of a VM?
Comment: Thanks for the input guys, but if any one you were to setup a server, how would you do it?


Ubuntu 18.04 iso without desktop environment

Question: I was wondering if anyone knows any link to an iso of 18.04 Desktop (not server) without a desktop environment. Sure i could install ubuntu and uninstall the desktop environment, but that would be too much work.
Comment: Desktop "without a desktop environment" is a server. :-))
Answer: You can use the mini iso.  https://help.ubuntu.com/community/Installation/MinimalCD
It basically includes nothing except the base system by default, you have to specify all packages to install.  If you don't want a desktop, simply don't install one.


ruby nokogiri parse within parsed

Question: I'm just learning how to program in ruby using nokogiri gem.
doc.xpath("//*[@class='someclass']//@href")

will return all href values under "someclass" class somewhere in the HTML.
doc.xpath("//*[@class='someclass']").xpath("//@href")

will return all href in entire HTML.
Could someone explain to me how would someone go about using //@ equivalent in xpath for instance, within parsed data so something like:
doc.xpath("//*[@class='someclass']").xpath(grab all the href within previously parsed)

is possible?
using the *, @ seems to be quite powerful but I can't seem to be able to narrow that down, other than searching through entire HTML, whereever I use it..
as a beginner, I just thought it would be.. intuitive? to be able to use "grab from everywhere" type of syntax limited to what has been parsed previously to narrow down my target, so I can do something like
xpath(whatever).css(whatever).xpath(whatever)

maybe this is not a good practice? maybe with more understanding of parsing concept I would never have to do this? sometimes I find using both xpath and CSS easier..
hopefully someone can enlighten me..
Answer: Try changing your second expression from
doc.xpath("//*[@class='someclass']").xpath("//@href")

to
doc.xpath("//*[@class='someclass']").xpath(".//@href")

// at the beginning of an XPath expression means "descendants of the root of the document," whereas .// means "descendants of the context node(s)."
You're right that XPath is powerful, and some major aspects of it are intuitive... but there are significant pieces that aren't intuitive, or depend on how your intuition is trained. Careful study reaps dividends, especially if you are going to use XPath much!
Comment: thank you very much for your quick answer & feedback. My main source was w3school. Do you care to recommend any books or resources for studying XPath? Would be appreciated.. I do plan to use XPath much!
Comment: @Rok: Good question. In the past I have found w3schools to be over-simplistic and often misleading, but by some accounts it has improved (http://www.w3fools.com). Anyway, http://stackoverflow.com/questions/5372312/what-is-an-excellent-xpath-reference-for-learning-correct-usage-of-the-syntax gives some good places to look.
Comment: @Rok: for an example of the low quality of w3schools: what http://www.w3schools.com/XPath/xpath_nodes.asp says about atomic values is almost completely wrong.

ruby nokogiri parse within parsed


Find probability of a situation

Question: John and Mary agreed to meet between 3 and 4 pm to study. Let X be the moment of John's arrival, and Y, the moment of Mary's arrival. These random variables are independent, with density functions,
\begin{align}
f_{X}(x)=1, \qquad(3<x<4)
\end{align}
\begin{align}
f_{Y}(y)=1, \qquad(3<y<4)
\end{align}
If the first to arrive wait only 15 minutes for the other, how likely are they to study together that day?
I tried this but I think it is wrong:
\begin{align} P(X-Y<0,25) \end{align}
Comment: On this site, you are expected to show what effort you have put in. Please show what you have tried,  else you may soon be downvoted and the question closed.
Comment: You want to say $P(|X-Y|<0.25)$? This would be better.
Comment: I tried this: \begin{align} \int_{15}^{15.75}\int_{y}^{y+\frac{1}{4}} 1\,\mathrm dx\,\mathrm dy+\int_{15.75}^{16}\int_{y}^{16}1\,\mathrm dx\,\mathrm dy \end{align}
Comment: @AndriyRussu You are on the right track, except: [1] All your times are P.M. ;) , [2] You only consider $X>Y$ i.e. you imply John will be later than Mary, so please apply my advice from the comment above.
Comment: Yes, sorry: \begin{align} \int_{3}^{3.75}\int_{y}^{y+\frac{1}{4}} 1\,\mathrm dx\,\mathrm dy+\int_{3.75}^{4}\int_{y}^{4}1\,\mathrm dx\,\mathrm dy +\int_{3}^{3.75}\int_{x}^{x+\frac{1}{4}} 1\,\mathrm dy\,\mathrm dx+\int_{3.75}^{4}\int_{x}^{4}1\,\mathrm dy\,\mathrm dx \end{align}
Comment: Now, when you calculate those integrals, what do you get?
Comment: \begin{align} \frac{7}{16}=0,4375 \end{align}
Answer: Because $X$ and $Y$ are independent, the joint density is $f_{(X,Y)}(x,y)=1$ in the square $C=[3,4]\times[3,4]$ (and 0 else)
Now, you want calculate $\mathbb{P}(\mid X-Y\mid<0.25)=\mathbb{P}(0<X-Y<0.25)\cdot\mathbb{P}(X>Y)+\mathbb{P}(0<Y-X<0.25)\cdot\mathbb{P}(X\leq Y)$, where the last equality works by total probability law.
Observe the symmetry in the problem, and then $\mathbb{P}(X>Y)=\mathbb{P}(X\leq Y)=\frac{1}{2}$.
Now, for $\mathbb{P}(0<X-Y<0.25)$ use the joint density and:
$\mathbb{P}(0<X-Y<0.25)= \mathbb{P}((X,Y)\in B)=\iint_{B\cap C} 1dxdy$, where $B=\{(x,y)\in \mathbb{R}^2: 0<x-y<0.25\}$.
So, $\mathbb{P}(X-Y<0.25)=area (B\cap C)=\frac{1^2}{2}-\frac{0.75^2}{2}=0,21875$
By symmetry, the solution is $0,21875\cdot 0.5\cdot 2=0,21875$

Find probability of a situation


Weird looking text and icons in top bar

Question:
Look at "Google - Mozilla Firefox"
There are ugly pixels around text and icons in top bar and it's very annoying. It looks like bad antialiasing or something like that.
Answer: This is an antialiasing bug only in the top bar of the Unity environment when using the Radiance theme instead of the default theme Ambiance. In all other places the text will be fine. You can install gnome-tweak-tool and try different fonts for using in the titlebar, change antialiasing, hinting, etc. to see better results.
Comment: Why not include [a link](https://apps.ubuntu.com/cat/applications/gnome-tweak-tool/), or an image: `![image](http://i.stack.imgur.com/U4mKR.png)` ;-)

Weird looking text and icons in top bar


Integration of back-end webpack with Vue-CLI 3

Question: I'm developing a full-stack application using Vue-CLI 3. The backend is written in TypeScript and so requires compilation etc. Currently I'm just using ts-node to run the backend app directly which works, but it would be much cleaner if I could also webpack the backend app to give a single server.js rather than multiple sprawling typescript files all over the place.
The problem is that the way I'd do this normally is have a single webpack.base.js and then include that in different webpack config files. I can't really do that because a lot of the webpack configuration is hidden away in vue-cli-service
Answer: Ended up pretty much having a base webpack config and extending client and server webpack configuration.
My app root webpack.config.js looks like this:
const { config: client } = require('./src/client/webpack.config');
const { config: server } = require('./src/server/webpack.config');

/**
 * Webpack Build File
 *
 * This webpack configuration is used for only building the client and server
 * bundles. It imports both of these from their respective directories, but
 * allows for overrides if required.
 *
 * Other dev tools such as watching, hot module reloading etc. has been split
 * out into other config files
 *
 * @param {object} env Webpack `env` object
 */
module.exports = ({ mode = 'development' } = {}) => ([
  {
    ...client({ mode }, process.env),
  },
  {
    ...server({ mode }, process.env),
  },
]);

My src/client/webpack.config.js looks like this:
const { resolve: _resolve, sep } = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TSConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackRootElementPlugin = require('html-webpack-root-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const { DefinePlugin } = require('webpack');

const paths = {
  src: {
    rootDir: _resolve(__dirname) + sep,
    app: _resolve(__dirname, 'app') + sep,
  },
  dist: {
    rootDir: _resolve(__dirname, '..', '..', 'dist'),
    app: _resolve(__dirname, '..', '..', 'dist', 'public'),
  },
};

/**
 * Client webpack build configuration.
 *
 * This webpack config produces a bundle for the client-side application only.
 *
 * @param {object} webpackEnv Webpack env object (basically any/all options passed in via the CLI)
 * @param {object} processEnv Process env object (environment variables from process.env)
 */
const config = ({ mode = 'none' }, { APP_NAME = '', BASE_URL = '/' } = {}) => ({
  name: 'client',
  target: 'web',
  mode,
  entry: {
    app: paths.src.app + 'main.ts',
  },
  output: {
    path: paths.dist.app,
  },
  optimization: {
    runtimeChunk: 'single',
  },
  resolve: {
    extensions: ['.ts', '.js', '.vue'],
    plugins: [
      new TSConfigPathsPlugin({
        configFile: paths.src.rootDir + 'tsconfig.json',
      }),
    ],
  },
  context: paths.src.rootDir,
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        include: paths.src.rootDir,
        exclude: /node_modules/,
        use: [
          {
            loader: 'ts-loader',
            options: {
              happyPackMode: true,
            },
          },
        ],
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader',
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
        },
      },
      {
        test: /\.s?[ac]ss$/,
        use: [
          'style-loader',
          'css-loader',
          'sass-loader',
        ],
      },
      {
        test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
        loader: 'file-loader',
        options: {
          name: 'assets/[name].[hash].[ext]',
          esModule: false,
        },
      },
    ],
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      favicon: paths.src.app + 'assets/logo.png',
      title: APP_NAME,
    }),
    new HtmlWebpackRootElementPlugin('app'),
    new VueLoaderPlugin(),
    new DefinePlugin({
      'process.env.BASE_URL': JSON.stringify(BASE_URL),
    }),
  ],
});

module.exports = {
  config,
  paths,
};

and my src/server/webpack.config.js looks like this:
const { resolve: _resolve, sep } = require('path');
const TSConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const { IgnorePlugin } = require('webpack');

const paths = {
  src: _resolve(__dirname) + sep,
  dist: _resolve(__dirname, '..', '..', 'dist'),
};

/**
 * NestJs uses a custom wrapper around require() that allows it to show a
 * warning when some extra package needs to be installed. This causes problems
 * with webpack, so we're blacklisting packages we're not using with the
 * IgnorePlugin below.
 *
 * To de-blacklist a package, just remove it from this array.
 */
const nestBlacklist = [
  '^cache-manager$',
  '^@nestjs/microservices$',
  // packages below are required from microservices
  '^amqp-connection-manager$',
  '^amqplib$',
  '^grpc$',
  '^mqtt$',
  '^nats$',
  '^redis$',
];

/**
 * Server webpack build configuration.
 *
 * This webpack config produces a bundle for the server-side application only.
 *
 * @param {object} webpackEnv Webpack env object (basically any/all options passed in via the CLI)
 * @param {object} processEnv Process env object (environment variables from process.env)
 */
const config = ({ mode = 'none' }) => ({
  name: 'server',
  mode,
  target: 'node',
  entry: paths.src + 'main.ts',
  externals: [nodeExternals()],
  output: {
    path: paths.dist,
    filename: 'server.js',
  },
  resolve: {
    extensions: ['.ts', '.js'],
    plugins: [
      new TSConfigPathsPlugin({
        configFile: './tsconfig.build.json',
      }),
    ],
  },
  context: paths.src,
  optimization: {
    minimize: false,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
        },
      },
      {
        test: /\.ts$/,
        include: paths.src,
        exclude: /node_modules/,
        use: [
          {
            loader: 'ts-loader',
            options: {
              happyPackMode: true,
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new IgnorePlugin({
      contextRegExp: /@nestjs/,
      resourceRegExp: new RegExp(nestBlacklist.join('|')),
    }),
  ],
  node: {
    __dirname: false,
  },
});

module.exports = {
  config,
  paths,
};

This allows me to have distinct server and client side compilation configuration, but in such a way that's re-usable in other configurations. So, for webpack dev server - I have webpack.dev.config.js which contains the following:
const client = require('./src/client/webpack.config');
const server = require('./src/server/webpack.config');
const { HotModuleReplacementPlugin } = require('webpack');

const {
  SERVER_PORT = 3000,
} = process.env;

/**
 * Watch settings are the same between client and server, so we're keeping them
 * here for consistency
 */
const watchConfig = {
  watch: true,
  watchOptions: {
    ignored: /node_modules/,
  },
};

/**
* Development Webpack Build File
*
* This webpack configuration extends `webpack.config.js` and builds on it to
* provide hot module replacement, watch moide and a dev server for the
* client-side code
*
* Other dev tools such as watching, hot module reloading etc. has been split
* out into other config files
*
* @param {object} env Webpack `env` object
*/
module.exports = ({ mode = 'development' } = {}) => ([
  {
    ...client.config({ mode }, process.env),
    ...watchConfig,
    devServer: {
      contentBase: client.paths.dist.app,
      historyApiFallback: {
        rewrites: [
          { from: /./, to: '/index.html' },
        ],
      },
      port: 8000,
      host: '0.0.0.0',
      hot: true,
      hotOnly: true,
      proxy: {
        '/api': `http://localhost:${SERVER_PORT}/`,
      },
    },
  },
  {
    ...server.config({ mode }, process.env),
    ...watchConfig,
    plugins: [
      ...server.config({ mode }, process.env).plugins,
      new HotModuleReplacementPlugin(),
    ],
  },
]);

This config provides a setup that produces a server.js which then serves up a directory (in this case '/public'`) as it's static files dir.


Visually distinguish cards in a list

Question: I made an LMS webapp which, in the main page, shows a list of courses.
The page looks like this:

The goal of the app, from a graphical interface standpoint, is to keep an elegant material design look.
However, while I personally don't dislike the minimalistic look of the page above, I would like something that differentiates the courses visually to the user.
For example, Google Classroom solves this issue by giving custom illustrations & graphics to each course, which end up looking pretty different from one another.

I would like to add an element that visually distinguishes one course from another in an immediate way, thus reducing the cognitive load of the user having to look for the course they want to access. The important thing is that it must not "break" the design of the application, so to speak, so it has to fit in well with the rest of the interface, which is pretty minimalistic.
Currently, it's possible to bookmark courses in my application, which makes them appear at the top of the page.
One way I've thought is to show a bookmark on the card of the bookmarked courses, each of a different color. The color is always the same for a course (for example, it could be generated from the course name).
This is what my experiment looks like:

Could this be a good way of achieving my goal? Is there anything better to try?
Comment: use different logos/icons for different courses.
Answer: It's important to understand the role of a framework like Google's Material: The goal is to get the designer off the ground as quickly as possible without them having to spend time on basic things like buttons and icon sets.
There is a point where every design system has to stop and let the designer take over.
This is where you are right now - the design system has reached its limit and you need to step in to fill the gaps.
You mentioned "Cognitive Load" but your proposed solution is likely to increase cognitive load as the user tries to understand the significance of the colour. Try to imagine that you've been presented with this page for the first time. You can see these little splashes of colour that obviously break from the basic colour pallet of the page but there's no key to tell you what they mean. What do you understand from those colours at that point?
If you have to explain to your users what the colours mean, then your attempt to make their journey easier has failed.
A better solution may be to colour code the courses by subject OR by level depending on the needs of your particular users. This colour coding will be much easier for users to learn and utilise in their search for any specific card.
However, you should never rely on colour alone to impart any kind of information - colourblind users, users with low vision, users working with low-light screens, or users working under unusual lighting conditions may not be able to distinguish between certain shades.
Having worked with LMSs before, I would suggest you find some icons and colours to represent the different core subjects ('coding', 'mathematics', 'Data Science', etc.) AND find some visual system for indicating the course level. You might also want to consider indicating the completion status of each course too ('unstarted, 'in progress', 'completed', etc.).
Between each of these facets of information, your users will be able to find what they are looking for much more easily.
As for style; be sensitive to the aesthetics of your design system but don't let it stop you from making life easier for your users. Material works well with illustrations, iconography, and photography. Just try not to make the page look too busy!
Comment: You currently have three icons on each card - The bookmark and share icons and one next to the title - What purpose does this last icon serve? Could that be repurposed to add a core subject icon without adding extra elements? If you were planning on using a photo then I would suggest placing the photo far from any text - text over photos is always problematic. I can't give you a direct design decision because that's your job! ;) - Make a few versions and then imagine yourself as a first-time user and see how you feel about the page you're looking at.
Comment: Thank you for your feedback. The term course might be misleading, but this LMS is meant to be used directly in schools, so they're more like "classes" or "subjects" than like udemy courses, so there's not a clear concept of completion, also because that depends heavily on how the teacher uses it. If you were to add illustrations or iconography to the current cards I posted, where would you do it? I like to idea of having icons that signify the type of subject, but aside from letting the teacher choose them I would need to kind of infer the right icon from the name given to the course maybe
Comment: That would be something specific to your users/market - an image for mathematics might be a calculator, it might be geometry equipment, or something else depending on the level, focus, and audience - You'll have to discover that on your own - Your relationship with your client should not be limited to kick-off and delivery. Don't ask them what you should do but do have conversations with them about what you're thinking and see if they agree.
Comment: I agree - as a matter of fact, I will investigate the issue with my users. However, although I realize I probably phrased the question in a confusing way, what I was trying to understand is: where would you place an illustration or icon in the course card that currently exist? I'm trying to understand if there's something that I would need to remove to make place for it, or just put it somewhere that's currently empty. *What* to put, as you mentioned, is a topic of its own.

Visually distinguish cards in a list


What does it mean to play for picks?

Question: Just played a competitive match where I was outnumbered 4 - 1, and someone on my team said "Play for picks, don't play for objective".
I didn't really understand what he meant by that, so I still went for the objective since I didn't know what pick meant and I ended up getting kicked.
Anyways I want to know what playing for picks means? I looked it up online and searched it up and can't find anything.
Comment: Were you CT or T side?
Answer: Playing for picks means focussing on easy kills- picking off enemies one by one. This would even the numbers so you can actually go for the objective effectively.
Comment: I'd say the majority of the time, when in a heavily disadvantaged situation in CSGO, you "play for picks" to damage the other teams economy (and improving or saving your own), rather than even the numbers to play the objective effectively. I do agree though, if you sit back and they hand you two quick kills, it could potentially become a very winnable scenario.
Comment: @Lyrical I'm answering from experience with other games. You probably know more about the specific situation here than I do so go ahead and post your own answer.
Answer: The idea behind playing for picks is to play safe and stay alive whilst attempting to inflict some damage on the opposing team. Inflicting damage on the opposing team, would be killing a player or 2, which means they would need to buy in the next round, thus affecting their team economy.
If the opposing team's overall economy is low, it means they may only be able to buy low power weapons if you kill any of their players. Take an example of if you only have a pistol or an SMG and you kill a player carrying an AWP, in game cost $4750. By killing the player, firstly  you can take that weapon for yourself or a team mate and save spending that money yourself, and secondly they may be forced to buy a much less powerful weapon unless they have a massive lead in the game and economy isn't an issue.
Team wise there are a few scenarios that this would probably get called:
Counter Terrorist:
Bomb is down and it's 4v1
If the T's have planted the bomb and have control of the site, the chances of retaking it alone are very slim. Meaning you'd probably die and need to re-buy next round. In this scenario, you could position yourself at one of the exit routes from the site, as the T's would have to exit the site before the bomb explodes.
Example: On de_dust_2, if the bomb is planted at A, I would probably play for picks at Long A gates or somewhere B side of CT spawn. Possibly even upper  mid (Suicide), but there are less chances in this position. The position would depend largely on the weapon I had. If I had a sniper rilfe, I would take up long range positions like Long A, perhaps have a few peeks to get a pick and then fall back. With an SMG or pistol, you would want shorter positions, possibly mid doors area, where you can catch them as they run round the corner.
Here's a view of some of the positions you could take up (with the angles to watch) to get exit frags. The red dot is where you position, and the dotted lines show the angles to aim for kills.

It all depends if they have intel on your position though. If they do, they're likely to try to push and kill you. If not, I'd say A long and B boxes are the safest 2 if you have a rifle as you have cover and can fall back if you get pushed after a few shots.
Terrorist:
T-Side is much the same if you're heavily outnumbered. To save money/weapons, you can try to hide somewhere or take up positions around the map where you might catch a player rotating or peeking. If you get a pick or 2, again you have a chance to hurt their economy and salvage a better weapon for you or your team.
A situation where you might be asked to play for picks is in a B rush scenario where the team get mowed down and the bomb is dropped on site. If you had a bad spawn (hence you hadn't reached the site), or were playing sniper watching mid, or you playing lurk on A side, you might be a long way back.
If there are 2 or 3 players covering the bomb, your chances of killing them all and planting the bomb are slim.
Health
If you have low health/armour, you're more likely to die if you engage alone against multiple enemies, which is often a good indicator you should save.
The Clutch:
If you manage to get some picks, have a lot of health and are well equipped with weapons and nades, you could go for the clutch. It would depend on how long you have on the clock and any intel you may have on the opposing teams weapons, positions and health. If for example, you get 2 quick picks and have intel to say another player was on the other side of the map with a pistol, you could push for the objective as your engagement has become a 1 v 1 (until the rotating player arrives.
Good team communication is always helpful, but after they've given you all the information they have and you're at the clutch point, you should request they are quiet as you would want to hear any footsteps to locate enemies.
You can actually bind a key to disable team chat in clutch situations, as shown in this post:
Read (Console) Variables and print them
Note:
If it's last round or you have no money as you spent it all, you risk getting no income for surviving as a terrorist, sometimes it's better to die so you get income. You'd have to evaluate how much you're saving in terms or armor, weapons and grenades when saving on a round where you're going to lose.
Comment: Where did you get this Picture with all those spot names? And is there more ?
Comment: @FlowX just did a google image search with the map name. You can find more here: http://www.tobyscs.com/csgo-map-callout-overviews/

What does it mean to play for picks?


Make a set of 3D points rotate around a point

Question: What is the formula for calculating the position of 3D point after it has been rotated around another 3D point a certain radians/degrees? I am using Java / LWLJGL.
Could someone just fill in the blanks in the following?
public Vector3f rotate(Vector3f origin, Vector3f rotation)
    {
        Vector3f ret = new Vector3f();
        ret.x = __________;
        ret.y = __________;
        ret.z = __________;
    }
Comment: Rotation in 3D requires two angles and is not commutative. Before we answer, can you confirm that you have both of the paramters avaiable?
Comment: @hexafraction - Well, I was going to have 3 rotation parameters - the x, y, and z rotations (and the point to rotate around)
Comment: There's no such thing as x, y, and z rotations. There are only two angles involved, just like in two dimensions only one angle is involved. To informally prove this, take a point in 2D and try to rotate it in two different *independent* ways.
Comment: @hexafraction what about pitch, yaw, and roll?
Comment: That can't be done with a point. A point has no internal orientation.
Comment: That makes sense. So What would the formula be? Or is it not that simple?
Comment: Use vector mathematics. You'll also need to work with matrices quite a bit. Refer to https://en.wikipedia.org/wiki/Rotation_(mathematics)#Three_dimensions. You'll need to construct a matrix with a certain discriminant and mutliply it by another.
Comment: I don't know vector mathematics, that's why I'm here...
Comment: 3D rotation is quite complex and twisted(no pun intended). You'll find that a lot of mathematics becomes immensely complex in the third dimension.
Answer: Consider your fixed point has coordinates (a,b,c) and moving object (x1,y1,z1) at time t1 and at (x2,y2,z2) at time t2.
option 1
you can consider projection on x-yplane and projection on y-z plane and calculate angle in that 2D space.
option 2
you can consider two vectors. say vector A and B
A=(x1-a)i+(y1-b)j+(z1-c)k
B=(x2-a)i+(y2-b)j+(z2-c)k

Now use dot product of A and B
 A . B = |A||B|cos(angle)

Comment: I am confused now. What are t1, t2, A, and B? Can't you just write a method like:`public Vector3f rotate(Vector3f origin, Vector3f rotation){  float x=...  float y=...  float z=...  }`
Comment: @user2529202 Rotation is only two angles. The mathematics in this post is sound, now you can construct a method that uses the mathematics here.
Comment: @user2529202 you no need to worry about t1 and t2. I used them to explain. you only want to know three points(fixed point and two location of rotating point). you can find A and B from those. I suggest you to learn about vectors.refer this http://www.mathsisfun.com/algebra/vectors.html. if there any thing unclear, leave a comment here.


Is Neighborhood an open set?

Question: I am reading a book where it is written that ,

Let $(X,d)$ be any metric space $a \in X$ then for any $r \gt 0$  the set $S_r(a)$ ={$x \in X$ : $d(x,a) \lt r$} is called an open ball of radius $r$ centered at $a.$
  &
  Let $(X,d)$ be any metric space and $x \in X$. A subset $N{(a)}$ of $X$  is called a neighborhood of a point $a$ , if there exist an open ball $S_r(a)$ centered at $a$ and contained in $N{(a)}$ i.e $S_r(a)$ $\subseteq$ $N{(a)}$.

But in Rudin ,it is given that in a metric space $X$
a neighborhood of $a$ is a set $N_r(a)$ containing of all q such that $d(a,q) \lt r$, for some $r \gt 0$ ,the number $r$ is called the radius of $a$ .
According to the definition of Rudin every neighborhood is an open set.
But according to  the text which I am reading,  does it tell that every neighborhood is an open set?
Comment: There tend to do be two definitions of "neighborhood of $a$." I believe the older older one has this connotation - just *any*set containing an open ball around $a.$ The newer one, as per Rudin, has neighborhoods being open and containing $a.$ The older form has more use when discussing "continuity at a point," rather than continuity on a whole space. But it also turns out that continuitity at a point can be made into continuity on the whole space under a different topology, so it is less relevant. Hence, I believe Rudin's approach is now preferred.
Comment: I might be missing something but Rudin's definition, as stated in the question, does not require $N_r(a)$ to be open, but merely to contain $B(a, r)$.
Answer: There are different notions of neighbourhoods floating around. Usually one calls Rudin's approach open neighbourhoods to avoid confusion. Whereas the one you just cited is just the ordinary neighbourhood definition (if people use open neighbourhoods instead of neighbourhoods always, they usually say that in the introduction). Generally speaking a neighbourhood of $x$ is just a set $X$ such that it contains an open set $U$ with $x \in U$.
In particular every neighbourhood contains an open neighbourhood, and so passing from general neighbourhoods to open ones contained in them is not too hard. Passing to closed neighbourhoods in a given neighbourhood however is more difficult and is one of the reasons one likes to have a regular Hausdorff (also known as $T_3$) spaces.
Comment: I'm curious - if you define neighborhoods to necessarily be open, then what do you do once you get into the topic of filters and want to define the neighborhood filter?  With the more permissive definition, you just say the set of all neighborhoods of $a$ forms a filter, end of story.
Answer: Clearly not. Take $X = \mathbb R$ with the usual metric, then $(-1, 1]$ contains a ball $(-1/2, 1/2)$ centered at $0$, so $(-1, 1]$ is a neighborhood of $0$, but itself is not open.

Is Neighborhood an open set?


Realtek RTL8723be Wifi and Bluetooth 14.04

Question: I just installed the OS on my laptop and at first wifi didn't work. After connecting to ethernet and updating everything, the wifi is working. But it disconnects here and there and requires me to reload the service or reboot. The bluetooth on the card does not work at all. It is seen and hciconfig shows an address for it. However, I cannot find bluetooth devices with it. I have seen a lot of different posts with this card but most of them are older. Where can I go from here.
Answer: I made a ppa with bluetooth driver for this chip.
It is tested and works. It can be installed by
sudo add-apt-repository ppa:hanipouspilot/rtlwifi
sudo apt-get update
sudo apt-get install rtl8723au-bt-dkms linux-firmware

It will stay after kernel updates.
Answer: For the WiFi disconnection problem the following fix worked for me:
Open a terminal and type:
sudo gedit /etc/modprobe.d/rtl8723be.conf

A window will open, add the following lines
#Prevents the WiFi card from automatically sleeping and halting connection
options rtl8723be fwlps=0 swlps=0

As for the bluetooth not finding devices I haven't find a solution yet. Hope that helps.


get age in years for month of july

Question: I have a table that stores the date of birth of patients in DateTime format(2022-06-22).
How can I get the age in years for people born in July?
I have tried the below:
select sFirstName,
sLastName,
dDateOfBirth,
DATEDIFF(yy,dDateOfBirth,GETDATE()) as Age,
ifkMedicalAidID
from Patients
where DATEDIFF(month,dDateOfBirth,GETDATE()) between 5 and 5

Although I get only all the records for July(which is correct) all the ages are 0, I see the problem with the above query but I don't have the SQL knowledge to resolve it...
Answer: SELECT
FLOOR((DATEDIFF(DAY,0,GETDATE()) - DATEDIFF(DAY,0,dDateOfBirth)) / 365.2425) AS AgeYears

Answer: this did the trick   thanks John
select sFirstName,
    sLastName,
    dDateOfBirth,
    DATEDIFF(yy,dDateOfBirth,GETDATE()) as Age,
    ifkMedicalAidID
    from Patients
    where   datepart(month,dDateOfBirth)=7

Comment: `DATEDIFF(yy,dDateOfBirth,GETDATE()` doesn't give you someone's age. Someone born on `2021-12-31` is not `1` year old today. People age on their birthday, not when the year changes.

get age in years for month of july


If $(A/I)^n$ $\cong$ $(A/I)^m$ as modules, why does it follows that $m=n$?

Question: can anyone explin to me why if $(A/I)^n$ $\cong$ $(A/I)^m$ (isomorphic according to modules) with I being a maximal ideal and (thus $A/I$ is a field) then m=n?
Comment: What is $A$? An arbitrary ring?
Comment: Sorry @JohnM.Campbell. It is a ring with 1, but other than that, yes is is an arbitrary ring.
Comment: i have to show that if i have an Isomorphism between $A^m$ and $A^n$, then it means that n=m. The proof ends by saying that f I is an maximal ideal and $(A/I)^n \cong (A/I)^m$, then n=m because A/I is a field.
Comment: Do you recognize that $\text{some field}^n$ is a vector space and we know a lot about dimensional invariance of vector spaces?
Answer: To expound on the comments:
Presuming $A$ is a commutative ring with $1$ (if not commutative, you have to fuss about $I$ being a two-sided max ideal) then $A/I = k$, a field, and for $n \neq m$, $k^n \not\simeq k^m$ (this is simple in terms of vector spaces to prove), so if $k^n \simeq k^m$, then $n = m$, as required.
To see $k^n\not\simeq k^m$ for $m\neq n$, note an isomorphism of vector spaces takes a basis to a basis. Any basis of $k^n$ has $n$ elements, and similarly for $k^m$, and so if $n\neq m$, there can be no bijection between sets of $n$ elements and $m$ elements. Isomorphisms are bijections. QED.
Comment: Hello @Walkar, can you please explain to me why is A/I=k is a field, then $k^n$ is not isomorphic to $k^m$ is n does not equal m? Thanks.
Comment: Sure, let me edit.
Comment: why does this only work with fields? Why can't I just say that if i have an isomorphism between $A^n$ and $A^m$ with A being a comm ring with 1, then n=m using the same argument u wrote?
Comment: This is the only case you need at this point. Maybe it works in greater generality, but since $I$ is a max ideal, $A/I$ is a field. So this proof works. In other scenarios, you might have to use the property @goblin mentions in his post, but I was just using the case I knew (and you needed).


whit criteria builder who to find whit a key in key array on postgresql

Question: Hello everybody and thanks for the time you take to answer me .
in my job i supose to implement a way find one id in array of id
i try to reproduce someting like this but in java hibernate + criteria in postgreSQL i don't understand the documentation and im do java for only 3 month
The sql request i try to reproduce look like this: .
SELECT * FROM commercial_information ci WHERE 'f93064da-5089-4591-a2ed-5f86786daba3' = ANY (ci.prescriber_ids);
and one of my filter is describe like this :
protected Predicate simpleUuidCriteria(SimpleFilter<UUID> simpleFilter, Path<UUID> path, CriteriaBuilder builder) {
    if (getSimpleFilterValue(simpleFilter) != null) {
        if (EQUALS.equals(simpleFilter.getMatchMode())) {
            return builder.equal(path, getSimpleFilterValue(simpleFilter));
        }

    }

    return null;
}

One of my idea was to change every array entry in string and find on it like sql function
but isn't working to .
i think i don't understant this langage
i try to filter on id in sql column where i have an array of id .
but i don't understand who to use  keyword ANY in my case
Comment: *but isn't working* is not an error description. Please describe yor problem in detail.
Comment: Also add sample data and expected rsult
Answer: For anyone who encounters the same type of problem here is a nice tutorial by Arnau Aregall.
This helped me a lot


Is it possible to win in Project Zomboid?

Question: I would like to know if it's possible to win in Project Zomboid? Or is it just the matter of how long until you die?
Answer: It's not possible to win.
The intro even says: this is how you died...
Answer: It is about how long you will survive, but you will still die in the end. Starvation, illness or zombies will get you eventually.
But when you die and load your old save, the world keeps the changes, so you can see the safe-houses your old character prepared, your stashes of weapons and ammo, and use them with new character.
And you can even meet your old self wandering around as a zombie.
But you cannot win.