How do I hide particular applications from launcher (taskbar / dock) on Ubuntu 18.04 LTS?

I would like to hide icon, name and other existence of the particular applications from Launcher (taskbar if you wish).

Hence, I’m not able to install other popular desktop widgets like Conky Manager, I’ve installed an application called TZ Clock which allows us to set up multiple timezones, and customize the interface of the application.

The only problem is, it is also appearing in the launcher, which is not pleasing, so how do I hide applications from the launcher menu?.

Inconsistent image colors in different applications after monitor calibration

I have calibrated my monitor using a colorimenter, however I found out that the colors appear different in different applications. I have created two test images and opened them in several applications.

Black to white gradient: https://i.imgur.com/DQClfey.png
Red to 50% gray gradient: https://i.imgur.com/7PSl5qA.png

Both test images are PNG files exported with sRGB profile.

As you can see, the gray levels are different in Photoshop and Lightroom. Then in the web browsers, Chrome and Firefox are quite similar to Lightroom, although Chrome’s gray levels are a bit brighter. Internet Explorer and the Windows Photos app look darker and have more saturated colors.

In Windows Color Management, the ICC profile associated with my monitor device is set to my custom profile from the calibration (screenshot).

Adobe Photoshop RGB working space is set to sRGB (screenshot).

In Firefox, I have associated my ICC display profile and enabled full color management (screenshot).

So I assume the darker/saturated colors are wrong, but I wonder why that happens. Also I don’t know why there are these subtle differences in dark gray levels in the first 4 apps shown in the test images.

Windows Virtual desktop app in Azure enterprise applications deleted

I’m trying out the new Windows Virtual Desktop (preview) and I’ve been having some trouble. Thought I’d start again form scratch and managed to delete the Windows Virtual Desktop application under Enterprise applications in Azure AD.I thought it was just to add again but now it is gone.

Does anyone know how to re-add it?

Thanks!

Seperate different applications running in different workspaces?

This might me quite easy, but please …

How to set the taskbar to show applications running in the current workspace only ? Currently clicking on it shows all the different locations where the application is running.

enter image description here

Here, 2 Firefoxes are running in different workspaces, so I do not want all of them being displayed in all workspaces.

Visual Basic For Applications – Array – Push | Pop | Shift | Unshift

I want to write my snake game procedurally, using as much windows call as I can so as to practice. Looking into GetAsyncKeyState to capture keyboard inputs and play sound functions. Also making a sweet user interface. Fun!

Also shout to bytecomb for providing example as to how to traverse the array structure, used his code function to find ptr to element in array!!

Wrote this to practice!

DECLARATIONS AND FUNCTIONS

Option Explicit  Private Declare PtrSafe Function VarPtrArray Lib "VBE7" Alias "VarPtr" _         (ByRef Var() As Any) As LongPtr  Private Declare PtrSafe Sub CopyMemoryI Lib "kernel32.dll" Alias "RtlMoveMemory" _         (ByVal dst As LongPtr, ByVal src As LongPtr, ByVal Length As Long)  Private Declare PtrSafe Sub CopyMemoryII Lib "kernel32.dll" Alias "RtlMoveMemory" _         (ByRef dst As SAFEARRAY, ByVal src As LongPtr, ByVal Length As Long)  Private Type SAFEARRAY_BOUND     cElements    As Long     lLbound      As Long End Type  Private Type SAFEARRAY     cDims        As Integer     fFeatures    As Integer     cbElements   As Long     cLocks       As Long     pvData       As LongPtr     rgsabound(0) As SAFEARRAY_BOUND End Type  Private Type SnakePart     Column       As Long     Row          As Long End Type  Private Const SNAKEPART_BYTELENGTH = 8 Private SnakeParts() As SnakePart  Private Function ArrayPush(ByRef ArrayOriginal() As SnakePart, ByRef ElementToAdd As SnakePart) As SnakePart() Dim NewLength      As Long Dim CopiedBytes    As Long Dim NewBytes       As Long      NewLength = UBound(ArrayOriginal) + 1     ReDim ArrayPush(NewLength)      CopiedBytes = UBound(ArrayOriginal) * SNAKEPART_BYTELENGTH     NewBytes = SNAKEPART_BYTELENGTH      CopyMemoryI ArrayElementGetPointer(ArrayPush, 0, SNAKEPART_BYTELENGTH), ArrayElementGetPointer(ArrayOriginal, 0, SNAKEPART_BYTELENGTH), CopiedBytes     CopyMemoryI ArrayElementGetPointer(ArrayPush, UBound(ArrayPush) - 1, SNAKEPART_BYTELENGTH), VarPtr(ElementToAdd), NewBytes End Function  Private Function ArrayPop(ByRef ArrayOriginal() As SnakePart) As SnakePart() Dim NewLength      As Long Dim CopiedBytes    As Long      NewLength = UBound(ArrayOriginal) - 1     ReDim ArrayPop(NewLength)      CopiedBytes = NewLength * SNAKEPART_BYTELENGTH      CopyMemoryI ArrayElementGetPointer(ArrayPop, 0, SNAKEPART_BYTELENGTH), ArrayElementGetPointer(ArrayOriginal(), 0, SNAKEPART_BYTELENGTH), CopiedBytes End Function  Private Function ArrayShift(ByRef ArrayOriginal() As SnakePart, ByRef ElementToAdd As SnakePart) As SnakePart() Dim NewLength      As Long Dim CopiedBytes    As Long Dim NewBytes       As Long      NewLength = UBound(ArrayOriginal) + 1     ReDim ArrayShift(NewLength)      CopiedBytes = UBound(ArrayOriginal) * SNAKEPART_BYTELENGTH     NewBytes = SNAKEPART_BYTELENGTH      CopyMemoryI ArrayElementGetPointer(ArrayShift, 1, SNAKEPART_BYTELENGTH), ArrayElementGetPointer(ArrayOriginal, 0, SNAKEPART_BYTELENGTH), CopiedBytes     CopyMemoryI ArrayElementGetPointer(ArrayShift, 0, SNAKEPART_BYTELENGTH), VarPtr(ElementToAdd), NewBytes End Function  Private Function ArrayUnshift(ByRef ArrayOriginal() As SnakePart) As SnakePart() Dim NewLength      As Long Dim CopiedBytes    As Long      NewLength = UBound(ArrayOriginal) - 1     ReDim ArrayUnshift(NewLength)      CopiedBytes = NewLength * SNAKEPART_BYTELENGTH      CopyMemoryI ArrayElementGetPointer(ArrayUnshift, 0, SNAKEPART_BYTELENGTH), ArrayElementGetPointer(ArrayOriginal, 1, SNAKEPART_BYTELENGTH), CopiedBytes End Function  Private Function ArrayElementGetPointer(ByRef Arr() As SnakePart, ByVal ElementIndex As Long, ByVal ElementByteLength As Long) As LongPtr Dim ptrToArrayVar  As LongPtr Dim ptrToSafeArray As LongPtr Dim ptrToArrayData As LongPtr Dim ptrCursor      As LongPtr Dim uSAFEARRAY     As SAFEARRAY      ' Get Pointer To Array *Variable*     ptrToArrayVar = VarPtrArray(Arr)     ' Get Pointer To Array Variable *SAFEARRAY* By Directly Reading Array Variable     CopyMemoryI VarPtr(ptrToSafeArray), ptrToArrayVar, 8     ' Read The SAFEARRAY Structure     CopyMemoryII uSAFEARRAY, ptrToSafeArray, LenB(uSAFEARRAY)     ' Get Pointer To Array Data     ptrToArrayData = uSAFEARRAY.pvData     ' Get Pointer To Array Element     ptrCursor = ptrToArrayData + (ElementIndex * ElementByteLength)     ArrayElementGetPointer = ptrCursor End Function 

TESTS

Sub TestFunctions()      Dim Arr(10) As SnakePart     Dim SP As SnakePart     SP.Column = 4     SP.Row = 4     Arr(0) = SP     Debug.Print "Expect 4 x2"     Debug.Print Arr(0).Column     Debug.Print Arr(0).Row      Dim ArrTwo() As SnakePart      SP.Column = 8     SP.Row = 8     ArrTwo = ArrayPush(Arr, SP)      Debug.Print "Expect 4 x2 Followed by 8 x2"     Debug.Print ArrTwo(0).Column     Debug.Print ArrTwo(0).Row     Debug.Print ArrTwo(10).Column     Debug.Print ArrTwo(10).Row      ArrTwo = ArrayPop(Arr)      Debug.Print "Expect 4 x2 Followed by 0 x2"     Debug.Print ArrTwo(0).Column     Debug.Print ArrTwo(0).Row     Debug.Print ArrTwo(9).Column     Debug.Print ArrTwo(9).Row      SP.Column = 7     SP.Row = 7     ArrTwo = ArrayShift(ArrTwo, SP)      Debug.Print "Expect 7 x2 Followed by 4 x2"     Debug.Print ArrTwo(0).Column     Debug.Print ArrTwo(0).Row     Debug.Print ArrTwo(1).Column     Debug.Print ArrTwo(1).Row      ArrTwo = ArrayUnshift(ArrTwo)      Debug.Print "Expect 4 x2 Followed by 0 x2"     Debug.Print ArrTwo(0).Column     Debug.Print ArrTwo(0).Row     Debug.Print ArrTwo(1).Column     Debug.Print ArrTwo(1).Row  End Sub 

How to implement a live purchasing system with client applications

I am creating a website to allow users to purchase products on their account however every purchase needs to be manually confirmed by a user in a remote location where each purchase can be accepted or rejected.

The user in the remote location will be running an existing application (that will require redevelopment) on their machine and each purchase by a user will be handled by a user dialog/alert that will popup on the client and wait for confirmation.

I’d like some suggestions of the technologies/web frameworks and architecture I could use to complete this.

My idea is:

On the remote client machine

  1. User Starts remote application which opens up a random port (Socket) and starts listening on this port.
  2. The user Logs in and the IP address and port in step 1 is stored in the DB on the server.

The user purchasing product

  1. The user clicks buy on the website
  2. The website request posts back to the web server, (or maybe hits an API)
  3. The web server gets the remote machines IP address and port (socket) stored in the DB.
  4. It then streams data to the open socket which the client machine receives and displays the prompt to the user which the user rejects or accepts and streams result back.

I would also like the status be updated to the user who would click buy and are notified on the website by text changing e.g. (buy request sent, client received purchase request, purchase declined/accepted )

Any help would be great.

How can I find a web application’s document root using a path traversal vulnerability?

I am performing a penetration testing on an application hosted on an Ubuntu environment.

So using a path traversal vulnerability, I can download any file.

The API web application runs as root (shadow and brute-force are already my friends). Funny situation: I can not find the web root folder.

What I have tried:

  • Search for logs that can lead me to the path. nginx or apache2 is not there.
  • Search for nginx, apache2 or other configuration files
  • Search for common directories of web roots (https://serverfault.com/questions/144598/where-should-the-web-server-root-directory-go-in-linux)
  • Bash histories of all users

What else should I try?

An approach to writing database applications

I’d like to share my approach to writing database applications for small businesses. It’s possibly unconventional, but it’s something I have been developing for nearly 20 years.

The approach I use is to place ALL the application logic in the database, with only a thin “dumb” layer which passes http requests to a SQL stored procedure (the procedure is selected based on the request path), and sends a response back to the client based on the result sets generated by the stored procedure.

The advantage of this approach is that changes to the application need only be made in one place – the database, and if I need to look for something, I only need to search the database code. I also only have to work in one language, the thin “dumb” layer very rarely needs to be modified, and is only a couple of hundred lines of code.

In addition, most of the handling SQL procedures are not coded by hand, instead they are compiled from a simple database specification, this handles adding, editing, listing, showing and finding database records.

I’d be interested to know if anyone else uses this approach, whether it is a recognised technique with a name.

Are “I’m writing android applications” and “follow open-closed principles” reasons to allow global state?

For example, suppose I have an android application, in simple, there are 3 activities :

MainActivity -> Main2Activity -> Main3Activity 

,which user can visit them in sequence (eg: by button click), also there is some global data to show:

public class GlobalData{     public static String userId; }  public class MainActivity extends AppCompatActivity {     //button click listener     public void toMain2Activity(View view){         Intent i = new Intent(this, Main2Activity.class);         this.startActivity(i);     } }  public class Main2Activity extends AppCompatActivity {     //button click listener     public void toMain3Activity(View view){         Intent i = new Intent(this,Main3Activity.class);         this.startActivity(i);     } }  public class Main3Activity extends AppCompatActivity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main3);     } } 

One day, Main3Activity needs to display userId in GlobalData, so I modify Main3Activity:

public class Main3Activity extends AppCompatActivity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main3);          Toast.makeText(this,GlobalData.userId, Toast.LENGTH_LONG).show();     } } 

But according to Why is Global State so Evil?, I should avoid global state, so I try to pass the original data object instead of allowing global state, so I try to pass the global object to Main3Activity instead of share it everywhere:

public class GlobalData implements Serializable {     public String userId="user_67890"; }  public class MainActivity extends AppCompatActivity {     private GlobalData globalData=new GlobalData();      public void toMain2Activity(View view){         Intent i = new Intent(this, Main2Activity.class);         i.putExtra("global",this.globalData);         this.startActivity(i);     } }  public class Main2Activity extends AppCompatActivity {     private GlobalData globalData;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main2);          this.globalData=(GlobalData)this.getIntent().getSerializableExtra("global");     }      public void toMain3Activity(View view){         Intent i = new Intent(this, Main3Activity.class);         i.putExtra("global",this.globalData);         this.startActivity(i);     } }  public class Main3Activity extends AppCompatActivity {     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main3);         GlobalData globalData=(GlobalData) this.getIntent().getSerializableExtra("global");         Toast.makeText(this,globalData.userId, Toast.LENGTH_LONG).show();     } } 

But I think avoiding global state is less maintainable and more unpredictable in my case because:

  1. With global state, I don’t need to modify Main2Activity, which seems more fit the open closed principle, but if I want to avoid global state, I need to modify all intermediate (eg:Main2Activity) UI from start(source of GlobalData) to terminal (UI that uses GlobalData), which my android application is usually one UI component is included by another UI in depth.

  2. If I pass the GlobalData only when I need it, it means I may have many functions need to add something like “GlobalData globaldata=this.getIntent().getSerializableExtra…” and “Intent i=…” everywhere, which I think it is less readable

  3. In the modified version, it is possible that the this.getIntent().getSerializableExtra is failed because I may forget to put the object into the intent, and I need to handle if I get GlobalData failed, which I think it is less maintainable

  4. Usually the GlobalData is not involved in Unit Test because the GlobalData is usually displayed directly, so I think sharing GlobalData doesn’t make the app harder to test

  5. Using intent let me need to think how to write additional codes to pass data between same level UI components (eg:same Activity, from EditText to error message detail label)

As above, I think avoid global state is more evil than having global state in my case. So my question is, are “I’m writing android applications” and “follow open-closed principles” reasons to allow global state?