Skip to content

Instantly share code, notes, and snippets.

View devmnj's full-sized avatar
💭
Exploring Algos

Manoj AP devmnj

💭
Exploring Algos
View GitHub Profile
@devmnj
devmnj / ListPrinters.cs
Created April 25, 2018 07:34
List all Printers installed on a system in C#.Net Windows Application
PrinterSettings setting = new PrinterSettings();
listBox1.Items.Clear();
foreach (string prntr in PrinterSettings.InstalledPrinters)
{
System.Console.WriteLine(prntr);
listBox1.Items.Add(prntr);
}
@devmnj
devmnj / propertybinding.cs
Created July 8, 2018 05:33
Property Binding C#
public partial class Master: Form,INotifyPropertyChanged{
public Master()
{
InitializeComponent();
lbl_company.DataBindings.Add("Text", this, "Company");
}
private void pictureBox16_Click(object sender, EventArgs e)
{
@devmnj
devmnj / JSON_SERIALIZE_DESERIALIZE
Created July 8, 2018 06:43
Serializing and deserialize JSON Objects in C#
//Please add reference to System.Web.Extention
class Accounts
{
string acname;
string code;
public Accounts(string a,string c )
{
acname = a; code = c;  
}
@devmnj
devmnj / json_toList_android
Created July 8, 2018 07:22
Deserialize JSON string in Android Studio with HASH MAP
//The JSON FILE
{
"users": [
{
"id": "1087",
"name": "Abhishek Saini",
"email": "[email protected]",
"gender" : "male",
"contact": {
"mobile": "+91 0000000000",
@devmnj
devmnj / INSERT_SQL_IF_NOT_EXIST
Created May 14, 2019 17:07
Insert new row if not exist - MSSQL
# This example SQL statement will allows to insert values only if not exist
# So that you can avoid duplication of data
If Not Exists(select * from emp where empcode='JA089')
Begin
insert into emp (empcode,name) values ('JA089','Jaseon Bourne')
End
@devmnj
devmnj / python_sqlite_and_tuples
Created July 2, 2019 16:37
Python SQlite - insertion with tuples and List
import sqlite3
con = sqlite3.connect('mydb.sqlite')
con.execute("CREATE TABLE IF NOT EXISTS users(id INTEGER ,name TEXT, ecode TEXT);")
con.execute("CREATE TABLE IF NOT EXISTS employees(id INTEGER PRIMARY KEY,ename TEXT, eid INTEGER);")
empnames = [
('jhon', 1),
('martin', 2),
@devmnj
devmnj / python_list_into_tuple_list
Last active July 5, 2019 08:33
Python : Converting List into Tuple List
# This code will show how you can convert a list into tuple list
print('Touple meet List')
l1=['Python','C','C++','C#','GO','Dart','Kotlin'] # the list
# List elements to touples
x=[(x,) for x in l1]
print(x)
@devmnj
devmnj / random_rows_sqlite
Last active July 5, 2019 08:32
Generating sqlite random() rows
select * from usedes order by random() limit 5
# each time you run the query will swap rows
@devmnj
devmnj / Encoding Examples -Python.md
Created July 5, 2019 08:26
Encoding Examples -Python

Encoding Examples -Python

myuTuple=(u'USER', u'NODE', u'HASH', u'IDNBR') mysTuple=[str(x) for x in myuTuple]

(u'USER', u'NODE', u'HASH', u'IDNBR')

sudo /sbin/ldconfig -v
ldconfig creates the necessary links and cache to the most recent shared
libraries found in the directories specified on the command line,
in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib).
The cache is used by the run-time linker, ld.so or ld-linux.so.
ldconfig checks the header and filenames of the libraries it encounters when
determining which versions should have their links updated.