Labels

Android (1) Apache (1) bash (2) boost (2) C (36) C++ (4) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (3) Dreamweaver (2) Eclipse (3) fail2ban (5) git (6) GitHub (5) Hacking (4) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (33) javascript (3) Linux (181) Mac (21) Machine Learning (1) mySQL (52) Netbeans (6) Networking (1) Nexus (1) OpenVMS (6) Oracle (3) Pandas (3) php (17) Postgresql (8) Python (9) raid (1) RedHat (15) Samba (2) Slackware (52) SQL (14) ssh (1) svn (1) tar (1) ThinkPad (1) Virtualbox (4) Visual Basic (2) Visual Studio (1) Windows (5) wire (1)

Saturday, 27 October 2018

Compile C C++ in Linux

gcc source.c -o executable.o

Samba

Users must be added to system in normal way and then also added to samba as follows:

smbpasswd -a user

Wednesday, 13 June 2018

Change Form component from other class

To change a component on a form from another class, for example if we have a GUI which is the startup component and we have a slave class that does a lot of work, calculations, searching and such and we wish to update a coomponent on our form from within this slave class.



In the form class, which we’ll call GUI


slave s = new slave(this);// slave is the other class and “this” is a reference to itself, the GUI


In the other class, which we’ll call slave

GUI form; // where GUI is the name of the form class


    public slave(GUI formObject)//formObject is a reference to the GUI form passed by “this”.


    {
        form = formObject;
        //form.setVisible(true); // not needed as it’s already visible
    }

void changeButton()
    {
        form.setButtonText("hello"); // The setButtonText method is an accessible method in the GUI form
    }

Friday, 9 March 2018

GitHub - Pushing to remote is rejected as a result of email address being exposed

Problem with PyCharm & Clion and gitHub on Mac specifically…

Also found on Debian, probably affects all applications pushing to GitHub


Pushing to remote is rejected as a result of email address being exposed.

Check;

git config --global user.email

If this shows email address, change is as per below;

git config --global user.email “plisken1@users.noreply.github.com”

Tuesday, 30 January 2018

ECC Memory

WINDOWS 7 
wmic MEMORYCHIP get DataWidth,TotalWidth

LINUX
dmidecode -t 17

Friday, 6 October 2017

Python misc

def myFunction(prices, credit):
    for a in range(len(prices)):
        for b in range(a+1,(len(prices))):
            if(prices[a]+prices[b]==credit):
                if (prices[a]>prices[b]):
                    myT=[prices[b],prices[a]]
                    return(myT)
                else:
                    myT=(prices[a],prices[b])
                    return(myT)



prices=(10, 6, 3, 4, 5, 6, 7, 8, 9, 10)
credit=16
print(myFunction(prices,credit))

Saturday, 6 May 2017

Pre condition, post condition and Invariants

  1. Pre-conditions are the things that must be true before a method is called.The method tells clients "this is what I expect from you".
  2. Post-conditions are the things that must be true after the method is complete. The method tells clients "this is what I promise to do for you".
  3. Invariants are the things that are always true and won't change. The method tells clients "if this was true before you called me, I promise it'll still be true when I'm done".

Friday, 28 April 2017

Functions in VB

Public Function addSlash(ByVal temp As String)
        If Microsoft.VisualBasic.Right(temp, 1) <> "\" Then
            Return temp & "\"
        Else
            Return temp
        End If
End Function


'VB6
Public Function addSlash(temp As String)
    If Right(temp, 1) <> "\" Then
        addSlash = (temp + "\")
    Else
        addSlash = temp
    End If
End Function

Friday, 10 March 2017

Java Class EASY MODE

package somePackage;
import java.*;

public class someClass
{
   public someClass()
   {
   //Constructor
   }
   public void someMethod()
   {
   //do stuff
   }
}