WPF Built-in Commands

It is easy to display a complete list of all commands in all loaded assemblies: public string[] GetAllCommands() { return ( from assembly in AppDomain.CurrentDomain.GetAssemblies() from type in assembly.GetTypes() from prop in type.GetProperties() where typeof(ICommand).IsAssignableFrom(prop.PropertyType) && prop.GetAccessors()[0].IsStatic orderby type.Name, prop.Name select type.Name + “.” + prop.Name ).ToArray(); } With PresentationFramework loaded I get the list … Read more

Unix Command to List files containing string but *NOT* containing another string

Try this: grep -rl <string-to-match> | xargs grep -L <string-not-to-match> Explanation: grep -lr makes grep recursively (r) output a list (l) of all files that contain <string-to-match>. xargs loops over these files, calling grep -L on each one of them. grep -L will only output the filename when the file does not contain <string-not-to-match>.

Execute CMD commands using C++

You can execute Windows Command prompt commands using a C++ function called system();. For safer standards you are recommended to use Windows specific API’S like ShellExecute or ShellExecuteEx. Here is how to run CMD command using system() function. You should place the CMD command like shown below in the program source code: system(“CMD_COMMAND”); Here is … Read more

Create database from command line in PostgreSQL

Change the user to postgres : su – postgres Create User for Postgres (in the shell and NOT with psql) $ createuser testuser Create Database (same) $ createdb testdb Acces the postgres Shell psql ( enter the password for postgressql) Provide the privileges to the postgres user $ alter user testuser with encrypted password ‘qwerty’; … Read more