[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

System Programming

40K

Solutions

19K

Contributors

Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.

Share tech news, updates, or what's on your mind.

Sign up to Post

I would like to know if it's possible to retrieve an hashed password from ADAM with Python?

I've seen that DSInternals could allow that, but wouldn't work with ADAM.  Plus we don't need the password in clear text, just the hashed version.

(Using Windows Server 2012 R2, ADAM, Python 3.7)

Thanks
0
Starting with Angular 5
LVL 12
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Hi Experts,
we have a site created in Caspio that has some required fields.
We realized that some of the required fields are coming thru w/o containing data.
So were told by Caspio that is probably due to those users using an old browser.
They created a field named user_agent that will capture which browser were used for each record data entry.
Now I created a list of all records with missing data in required field along with the data captured in this field named user_agent (browser).
See attached.
Wondering what are those values are and how can we sent a message informing this and this browser is not supported...
Thanks
Untitled.png
0
try{
			
			previouslyTaken = new DataDAO().testForPkgPreviouslyTaken(this....., TimeStamp);//gives true or false boolean value
		}
		catch (XYZExceptionException xyze)
		{
			if(xyze.getMessage().contains("999"))
			{
				LOGGER.error("item is PreviouslyTaken due to aa", xyze);
				errorCodes.add(XYZConstants.PREVIOUS_TAKEN_EXISTS);				
			}
			else if(xyze.getMessage().contains("888"))
			{
				LOGGER.error("item is PreviouslyDumped due to bb", xyze);
				errorCodes.add(XYZConstants.PREVIOUSLY_DUMPED);
			}
			else
			{
				throw new XYZException(xyze);
			}	
			return ;
		}
		LOGGER.info("previouslyTaken indicator from DB {}",previouslyTaken); //coming false t me
		
		if(!previouslyTaken){
		processIt();
		else
		LOGGER.info("item taken or dumped so update status to new)

Open in new window


i have above code in a method.

i never saw if else inside a catch in earlier.

why some one use if else inside catch
when the catch is thrown as try block simply return true or false

when it has 999 or 888 etc value in the xyze exception

please advise
0
Hello,
I have a FreeBSD and ubuntu server.
I crate a cronjob to execute in specific time. but the command that I do required a full privilege on system... so how I can make the cronjob work with root for example ?
thanks.
0
Hi

We need to regularly create system restore points on our user computers via command line.

The idea is to automate this process without deploying any 3rd party tools.

Step 1. Check if system restore is enabled on the computer. If it is not, enable it.
Step 2. Check the storage size allocated for system restore. If it is less than 6 GB, configure to to be 6 GB.
Step 3. Create a system restore point with a generic label e.g. "maintenance".
Step 4. Check if the system restore point got created or not by listing existing system restore points and comparing the labels with the generic label used in step3.


So this is the general idea of the script we want to create and I think I can do the other bits myself except for creating system restore point via command line.

I have tried the WMIC method, powershell method and everything else I can find on blogs and google search.

Most commands I run return the "execution successful" message.

But when I check manually if the system restore point got created or not by opening system restore GUI, I don't see the restore point created.

For the life of me I can't figure out what's going on.

So pls help !
0
I tried jsp custom tag example.

custom tag color is not changing even though i changed to blue or some other color it still shows default color as attached.

Index.jsp is

<%--
    Document   : index
    Created on : Nov 6, 2018, 1:41:41 PM
    Author     : saiganesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mytags" uri="/WEB-INF/tlds/my_tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <mytags:formattag colour="blue" font_size="50" is_uppercase="false">
            this is ext hello custom tag
            </mytags:formattag>
    </body>
</html>



my_tags.tld is

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
  <tlib-version>1.0</tlib-version>
  <short-name>my_tags</short-name>
  <uri>/WEB-INF/tlds/my_tags</uri>
 
  <tag>
      <name>formattag</name>
      <tag-class>tags.FormatTag</tag-class>
      <body-content>scriptless</body-content>
      <attribute>
          <name>colour </name>
          <required>true</required>
      </attribute>
        <attribute>
          <name>font_size </name>
          <required>true</required>
      …
0
hi,

I build one stateless session bean example with presentation tier html inddex page and web tier servlet within ejb web project then business tier in the ejb project


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form action="ConverterServlet" method="POST">
              <input type="number" name="value"></br>
              <select name="type">
                    <option value="C2F">celcius to fahrenheit</option>
                    <option value="F2C">fahrenheit  to celcius</option>
              </select></br>
              <input type="submit" value="Convert">
        </form>
            
    </body>
</html>

Open in new window


do i not need to add close tags for input html element
<input type="submit" value="Convert">

also do i not need to ad begin tag for </br>

please advise

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import bean.ConverterBeanLocal;
import bean.ConverterBeanLocal.ConvertType;
import java.io.IOException;
import java.io.PrintWriter;

Open in new window

0
Hi,
What can be reason to the below error, while it only happens when I deployed the same project to https (everything is fine if I deploy it to http)?

Server Error in '/RegRec2' Application.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
   System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +258
   System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +497
   System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100
   System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection 

Open in new window

0
In short, I would say:

A flag is a predefined bit or bit sequence that holds a binary value.

A mode is a distinct setting.

So it's not always possible to replace the term "mode" by "flag". This is only possible if it's about a binary value. I got confused by these terms when reading:

http://man7.org/linux/man-pages/man2/open.2.html

The argument flags must include one of the following access modes:
O_RDONLY, O_WRONLY, or O_RDWR.

The file creation flags are O_CLOEXEC,
O_CREAT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_TMPFILE, and
O_TRUNC.

The file status flags are all of the remaining flags listed
below.

Why they just don't say:

The file access flags are O_RDONLY, O_WRONLY, and O_RDWR.

Why they suddenly use a different term when it's about "access"? Probably behind the scenes it's also just about a binary value, right? Probably all O_VARIABLE's above are 0 or 1.

And see: https://en.wikipedia.org/wiki/File_descriptor

This table records the mode with which the file (or other resource) has been opened: for reading, writing, appending, and possibly other modes.

So Wikipedia uses the term "mode" only (and not flag). At least they are consistent, because they call them all "modes".

Is there a specific reason why sometimes mode is used and something flag (while it's about the same thing)? I would stay, be at least consistent to avoid confusion.
0
By default, the first three rows of a "file descriptor table" consists of:

FD 0 (standard input,  associated with keyboard)
FD 1 (standard output, associated with screen)
FD 2 (standard error,  associated with screen)

Open in new window


These file descriptors point to one or more rows in the "open file table". Imagine we only have these three file descriptors. Then how does the "open file table" look like?

Usually all three file descriptors point to the same file, but that doesn't mean they point to the same entry in the "open file table". So how the open file table looks like?

_ | offset | reference count | permissions | flags | pointers
_ |    ?   |        ?        |      ?      |   ?
possible more rows

Open in new window


The lsof command shows for example:

lsof        721    root    0u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    1u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    2u      CHR              136,1       0t0          4 /dev/pts/1

Open in new window


The file "/dev/pts/1" is CHR (character special file). They all point to the same file.
I'm also wondering why it's for example "0u" and not "0r"? The file descriptor 0 stands for input, so it only has to read something.

r for read access;
w for write access;
u for read and write access;

Open in new window


I would expect something like: 0r, 1w, 2w instead of 0u, 1u, 2u? And what are the offsets et cetera?
0
Become a Certified Penetration Testing Engineer
LVL 12
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

hi,

i have script working.
When it runs it check for files and send email alert if not files and also if has files.
Currently it sending the email alerts text format.
Request experts help, want to send email with htm format.
and for errors it should bold the text and color RED.
can help...


#Requires -version 3.0
$WarningPreference="Continue"
function Send-Mail
{
  param (
    [string] $Email_Subject,
    [string] $Email_Body,
    [string] $Email_Attachment
  )
  Send-MailMessage -SmtpServer 'mailserver.com' `
  -Body $Email_Body `
  -From 'donotreply@mail.com' `
  -To 'admin@mail.com' `
  -Subject $Email_Subject `
  -Attachments $Email_Attachment
}
function Send-Error
{
  Write-Host "Sending Error Alert @ $emaildate"
  $subject = "ACTION REQUIRED : Error Alert @ $emaildate"
  $logcontents = get-content $Logfile | Out-String
  $Body = "Dear All,`n`nThis email sent by system for errors highlighted below."  + $logcontents + "`n Regards,`n Job Process"
  Send-Mail -Email_Subject $subject -Email_Body $Body -Email_Attachment $Logfile }
function send-status
{
  Write-Host "Sending Success Alert @ $emaildate"
  $subject = "INFO : Success Alert @ $emaildate"
  $logcontents = get-content $Logfile | Out-String
  $Body = "Dear All,`n`nThis email sent by system for your information"  + $logcontents + "`n Regards,`n Job Process"
  Send-Mail -Email_Subject $subject -Email_Body $Body -Email_Attachment $Logfile }

  #check if source files exists
0
Constructors are not inherited:
The sub class cannot inherit constructors from its super class. Consider the following example:
1
2
3
4
5
6
7
8
9
10
11
public class Super {
    protected String text;
 
    public Super(String text) {
        this.text = text;
    }
}
 
public class Sub extends Super {
 
}
We can create a new instance of Super like this:
1
Super super = new Super(“Hello”);   //OK
But we cannot do the same for the Sub class:
1
Sub sub = new Sub(“Hello”); //Compile error, since constructor is not inherited
The solution is to write a constructor for the sub class and call the super’s constructor, for example:
1
2
3
4
5
6
public class Sub extends Super {
 
    public Sub(String text) {
        super(text);
    }
}

Open in new window


https://www.codejava.net/java-core/the-java-language/12-rules-and-examples-about-inheritance-in-java

i wrote as below

package SuperSub;
public class Super {
    protected String text;
 
    public Super(String text) {
        this.text = text;
    }
}
 

Open in new window


package SuperSub;
public class Sub extends Super {
	//Super super = new Super(“Hello”);
}

Open in new window


i am getting error in line 2 of Sub class
Implicit super constructor Super() is undefined for default constructor. Must define an explicit constructor
package SuperSub;
public class Sub extends Super {

	public Sub(String text) {
		super(text);
		// TODO Auto-generated constructor stub
	}
	//Super super = new Super(“Hello”);
}

Open in new window

above is fine though not sure why i cannot just have Sub empty class?
Please advise
0
package SuperThis;
public class Sub extends Super {
	/*public static void main(String[] args) {
		  super.bar();
	      this.bar();
	}*/
    public void bar() {
        System.out.println("Sub.bar()...");
    }
 
 
    public void test() {
       super.bar();
       this.bar();
    }
  
    	// Sub sub=new Sub();
    	 //   sub.test();
    
        this.test();
}

Open in new window

why above code is not working
i see error as below at line 21,15
Syntax error, insert "}" to complete ClassBody

Please advise
0
The super keyword:
In Java, the superkeyword is used to access members of the super type from the sub type. For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class Super {
    protected void bar() {
        System.out.println("Super.bar()...");
    }
 
}
 
public class Sub extends Super {
    public void bar() {
        System.out.println("Sub.bar()...");
    }
 
 
    public void test() {
        super.bar();
        this.bar();
    }
}
Here, we can see that both classes have a method called bar() (overriding). Therefore, if we want to invoke the super’s version of the bar() method, the super keyword is used.
 

Open in new window


super with this example not working for me
package SuperThis;
public class Sub extends Super {
	public static void main(String[] args) {
		  super.bar();
	      this.bar();
	}
    public void bar() {
        System.out.println("Sub.bar()...");
    }
 
 
    //public void test() {
       // super.bar();
        //this.bar();
   // }
        
}

Open in new window


above code giving below error
Cannot use super in a static context
Cannot use this in a static context

how to fix this
package SuperThis;

public class Test {
public static void main(String[] args) {
	 Sub sub=new Sub();
	    sub.test();
}
}

Open in new window


Super.bar()...
Sub.bar()...


does it need separate class for this to test
package SuperThis;
public class Sub extends Super {
	/*public static void main(String[] args) {
		  super.bar();
	      this.bar();
	}*/
    public void bar() {
        System.out.println("Sub.bar()...");
    }
 
 
    public void test() {
       super.bar();
       this.bar();
    }
  
    	// Sub sub=new Sub();
    	 //   sub.test();
    
        test();
}

Open in new window

how to test in same Sub class

above gives error at line 20
Multiple markers at this line
      - This method requires a body instead of a
       semicolon
      - Return type for the method is missing
      - Duplicate method test() in type Sub

please advise
0
Remember that Java does not allow a class inherits two or more classes directly. To understand why multiple inheritance is not allowed, consider the following example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class A {
    public void methodA() {
 
    }
 
    public void foo() {
 
    }
}
 
 
public class B {
    public void methodB() {
 
    }
 
    public void foo() {
 
    }
}
Suppose that we want to write a class C that extends both A and B like this:
1
2
3
4
5
public class C extends A, B {
    public void methodC() {
        foo();
    }
}
As you can see, both A and B has a method called foo(), so which foo() method the class C invokes exactly? from A or B? This case is ambiguous hence Java does not allow.

Open in new window


https://www.codejava.net/java-core/the-java-language/12-rules-and-examples-about-inheritance-in-java

i tried as below

package MultipleInheritance;
public class A {
    public void methodA() {
 
    }
 
    public void foo() {
 
    }
}


package MultipleInheritance;
public class B {
    public void methodB() {
 
    }
 
    public void foo() {
 
    }
}


package MultipleInheritance;
public class C extends A, B {
    public void methodC() {
        foo();
    }
}

Open in new window


on C class i get below error

Multiple markers at this line
      - Syntax error on token "extends", delete this token
      - Syntax error, insert "ClassBody" to complete
       ClassDeclaration
      - Syntax error, insert "}" to complete Block

can you please advise what above error means

it did not say "multiple inheritance of state not allowed"

Please advise
0
6. Multiple inheritance of state is not allowed:
Remember that Java does not allow a class inherits two or more classes directly. To understand why multiple inheritance is not allowed, consider the following example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class A {
    public void methodA() {
 
    }
 
    public void foo() {
 
    }
}
 
 
public class B {
    public void methodB() {
 
    }
 
    public void foo() {
 
    }
}
Suppose that we want to write a class C that extends both A and B like this:
1
2
3
4
5
public class C extends A, B {
    public void methodC() {
        foo();
    }
}
As you can see, both A and B has a method called foo(), so which foo() method the class C invokes exactly? from A or B? This case is ambiguous hence Java does not allow.
 
7. Multiple inheritance of type is allowed:
This means Java does allow multiple inheritance between interfaces. For example:
1
2
3
4
5
6
7
8
9
10
11
public interface X {
    public void methodX();
}
 
public interface Y {
    public void methodY();
}
 
public interface Z extends X, Y {
    public void methodZ();
}
This is allowed because interfaces do not have concrete methods, thus there is no ambiguity.
Likewise, we can have a class implements multiple interfaces:
1
2
3
4
5
6
7
public class Sub implements X, Y, Z {
    public void methodX() { }
 
    public void methodY() { }
 
    public void methodZ() { }
}

Open in new window


if both Interface X and Interface Y has same method called methodAB what happens?



Open in new window

0
Let’s look at the constructor of the Truckclass - it can access the protected field numberOfWheels and the default field name. However, it cannot access the private field age. We can write:
1
2
3
Truck truck = new Truck();
truck.start();
truck.move();
But the Java compiler will complain if we try to invoke the private method test():
1
truck.test();   // COMPILE ERROR, since private member is not inherited

Open in new window


https://www.codejava.net/java-core/the-java-language/12-rules-and-examples-about-inheritance-in-java


i supposed to put below code in which class Car or Truck or Moveable?


public class Truck extends Car {
    public Truck() {
        numberOfWheels = 8;
        name = "Truck";
        age=10;
    }
    
    Truck truck = new Truck();
    truck.start();
    truck.move();
    
}

Open in new window




or as below

public class Car extends Vehicle {
	String name;
	protected int age;
    //protected int age;
    protected int numberOfWheels = 4;
    
    public void move() {
        System.out.print("Moving by engine...");
    }

	@Override
	public void start() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void stop() {
		// TODO Auto-generated method stub
		
	}
	
	/*Truck truck = new Truck();
	truck.start();
	truck.move();*/
}

Open in new window


below i cannot put as it is interface

public interface Moveable {
    public void start();
 
    public void stop();
 
    public void move();
}

Open in new window


please advise
0
Don’t use a for loop with an index (or counter) variable if you can replace it with the enhanced for loop (since Java 5) or forEach (since Java 8). It’s because the index variable is error-prone, as we may alter it incidentally in the loop’s body, or we may starts the index from 1 instead of 0.
Consider the following example that iterates over an array of Strings:
1
2
3
4
5
String[] names = {"Alice", "Bob", "Carol", "David", "Eric", "Frank"};
 
for (int i = 0; i < names.length; i++) {
    doSomething(names[i]);
}
As you can see, the index variable i in this for loop can be altered incidentally which may cause unexpected result. We can avoid potential problems by using an enhanced for loop like this:
1
2
3
for (String aName : names) {
    doSomething(aName);
}
This does not only remove potential issues but also make the code cleaner and more succinct. 

Open in new window


how is it possible to do for loop index modifycation?

how enhanced for loop is diferent from for each loop?

is there any case where we still has to use traditional for loop with index
please advise
0
public class CollectionsRef {
 
    private HashSet<Integer> numbers;
 
    public ArrayList<String> getList() {
 
        return new ArrayList<String>();
    }
 
    public void setNumbers(HashSet<Integer> numbers) {
        this.numbers = numbers;
    }
}
Look at the reference types which are collection implementation classes - this locks the code to work with only these classes HashSet and ArrayList. What if we want the method getList() can return a LinkedList and the method setNumbers() can accept a TreeSet?
The above class can be improved by replace the class references to interface references like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class CollectionsRef {
 
    private Set<Integer> numbers;
 
    public List<String> getList() {
        // can return any kind of List
     [b]   return new ArrayList<String>();[/b]
    }
 
    public void setNumbers(Set<Integer> numbers) {
        // can accept any kind of Set
        this.numbers = numbers;
    }
}

Open in new window


can we have generic List as return type to provide more flexibility to future changes to collection implementation?
https://www.codejava.net/coding/10-java-core-best-practices-every-java-programmer-should-know
Please advise
0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Avoid Redundant Initialization (0-false-null)
It’s very unnecessary to initialize member variables to the following values: 0, false and null. Because these values are the default initialization values of member variables in Java. For example, the following initialization in declaration is unnecessary:
1
2
3
4
5
public class Person {
    private String name = null;
    private int age = 0;
    private boolean isGenius = false;
}
This is also redundant:
1
2
3
4
5
6
7
8
9
10
11
public class Person {
    private String name;
    private int age;
    private boolean;
 
    public Person() {
        String name = null;
        int age = 0;
        boolean isGenius = false;
    }
}
Therefore, if you know the default initialization values of member variables, you will avoid unnecessary explicit initialization. See more here:

Open in new window


i am not clear on below

This is also redundant:


does it mean initialization in the constructor as well apart from at class level

public Person() {
        String name = null;
        int age = 0;
        boolean isGenius = false;
    }
}

https://www.codejava.net/coding/10-java-core-best-practices-every-java-programmer-should-know
Please advise
0
It’s a very bad idea to create an interface which is solely for declaring some constants without any methods. Here’s such an interface:
1
2
3
4
5
public interface Color {
    public static final int RED = 0xff0000;
    public static final int BLACK = 0x000000;
    public static final int WHITE = 0xffffff;
}
It’s because the purpose of interfaces is for inheritance and polymorphism, not for static stuffs like that. So the best practice recommends us to use an enum instead. For example:
1
2
3
public enum Color {
    BLACK, WHITE, RED
}
In case the color code does matter, we can update the enum like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public enum Color {
 
    BLACK(0x000000),
    WHITE(0xffffff),
    RED(0xff0000);
 
    private int code;
 
    Color(int code) {
        this.code = code;
    }
 
    public int getCode() {
        return this.code;
    }
}

Open in new window


what is the meaning of color code does not matter and updating like below?

In case the color code does matter, we can update the enum like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public enum Color {
 
    BLACK(0x000000),
    WHITE(0xffffff),
    RED(0xff0000);
 
    private int code;
 
    Color(int code) {
        this.code = code;
    }
 
    public int getCode() {
        return this.code;
    }
}

Open in new window

https://www.codejava.net/coding/10-java-core-best-practices-every-java-programmer-should-know

when we create special AppConstants class?
can there be interface just for constants?
please advise
0
String sql = "Insert Into Users (name, email, pass, address)";
sql += " values ('" + user.getName();
sql += "', '" + user.getEmail();
sql += "', '" + user.getPass();
sql += "', '" + user.getAddress();
sql += "')"[b][u];[/u][/b]

Open in new window

in above StringBuilder example why ; is not in double quotes?
https://www.codejava.net/coding/10-java-core-best-practices-every-java-programmer-should-know
https://www.w3schools.com/sql/sql_insert.asp

same question i have with StringBuilder as well
StringBuilder sbSql
    = new StringBuilder("Insert Into Users (name, email, pass, address)");
 
sbSql.append(" values ('").append(user.getName());
sbSql.append("', '").append(user.getEmail());
sbSql.append("', '").append(user.getPass());
sbSql.append("', '").append(user.getAddress());
sbSql.append("')");
 
String sql = sbSql.toString();


why we need to do toString only in case of StringBuilder

also what it mean by String builder not thread safe and string buffere thread safe

any example or link to prove this theory into practical?
Please advise
0
class Parent {
	//Parent(){}
	Parent(){}
    Parent(int number) {
    }
}
 
class Child extends Parent {
    Child(int a, int b) {
    }
}

Open in new window


for above code do not i need to give  constructor as below with two arguments?


      Parent(int a, int b){}
//if i give constructor like above does it still called default constructor?

what is the meaning of below sentence?
4. The default constructor is only generated by the compiler:
If we explicitly write a constructor that looks exactly the same as the default constructor, it is NOT called the default constructor.
https://www.codejava.net/java-core/the-java-language/9-rules-about-constructors-in-java
Please advise
0
I am trying ssh into a remote server, capturing the process ID, and stopping the app using the process ID.

For some reason I am loosing the value of the variable PROCESS in the SSH session,  all the logic works fine if i run it locally. Below is the code and the execution part where i am loosing the variable (PROCESS) Value. Can someone tell me why i am not able to capture the echo "$PROCESS" and $PROCESS below.

Stoptomcat()
{
. /apps/web/properties/tomcat.props
for server in "${dev_host_Array[@]}"
 do
        echo "connecting to the server $server" | tee -a /tmp/tomcat-App-operation.${now}.txt
        ssh -q "$server" bash -c "'
         PROCESS=`ps -ef | grep $app_name | grep -v "grep" | grep -v "Tom.sh" | awk '{print $2}'`
         echo "$PROCESS"
      if [ ! -x $PROCESS ]; then
         /apps/tomcat/$app_name/bin/catalina.sh stop | tee -a /tmp/tomcat-App-operation.${now}.txt &
         pid=$!
         declare -i elapsed=0
           while ps -p ${pid} >/dev/null; do
            sleep 1
             if ((++elapsed % 60 == 0)); then
               kill -9 $process
                exit
             fi
           done
  else
   echo " TOMCAT $app_name is already in stopped state"
fi
'"
done
}

Execution:

+ for server in '"${dev_host_Array[@]}"'
+ tee -a /tmp/tomcat-App-operation.1536692015.txt
+ echo 'connecting to the server testserver1'
connecting to the server testserver1
++ ps -ef
++ grep -v Tom.sh
++ awk '{print $2}'
++ grep …
0
I have to migrate the FS GPFS (3.4) on AIX server on new NSD disks, under the current configuration.
Which replication procedure is best to use?

[root@crmcas01]/tmp# mmlsconfig
Configuration data for cluster TEST:
---------------------------------------------
myNodeConfigNumber 1
clusterName TEST
clusterId 13882357993337224079
autoload yes
minReleaseLevel 3.4.0.7
dmapiFileHandleSize 32
tiebreakerDisks tiebreaker01
worker1Threads 500
traceRecycle global
tracedevBufferSize 1048576
traceFileSize 300000000
trace all 4 tm 2 thread 1 mutex 1 vnode 5 ksvfs 2 klockl 2 io 3 pgalloc 1 mb 1 lock 2 fsck 3
pagepool 8G
nfsPrefetchStrategy 1
maxMBpS 2048
maxStatCache 256000
maxFilesToCache 64000
adminMode allToAll

File systems in cluster TEST:
--------------------------------------
/dev/SwReport
/dev/fsWBCp
/dev/fsCRMp
/dev/sbsiebCRMp
/dev/sbsiebgCRMp
0

System Programming

40K

Solutions

19K

Contributors

Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.