Tuesday, 9 April 2019

Tech Knowledge

To set file upload size limit through service (java/spring boot):
multipart.max-file-size=20MB
multipart.max-request-size=100MB
#spring.http.multipart.max-file-size=20Mb
#spring.http.multipart.max-request-size=100Mb
-------------------------------------------------------------------------
To give permissions to other machine/person to execute queries on your machine

GRANT ALL privileges ON *.* TO 'root'@'01HW***6' IDENTIFIED BY 'admin';
-------------------------------------------------------------------------

IMPORT:
POST: 
http://10.****.23:8080/alfresco/service/predix/m...{"acpLocation":"C:\\Users\\1****7\\Documents\\dumps\\Suppliers.acp",
"importSpaceNodeId": "55978eda-11d2-4698-a412-7d7b8098f85c"
}

---------------------------------------------------------------
To know total disk space/free space/used space:
df -h

To stop Apache service:
Go to /etc/hosts/conf. Then type:
sudo apachectl -k stop

To confirm that service is stopped:
ps -aef| grep httpd
Output should not show any httpd processes running

To start apache:
sudo apachectl -k start

To confirm that service is started:
ps -aef| grep httpd
Output will show multiple httpd processes running

--------------------------------------------------
cUrl command to hit a HTTP POST url:

curl -X POST <HTTPS-URL> -H 'Authorization: Basic TIRxxxxxxxNza38eUY==' -H 'Content-Type: application/json' -H 'cache-control: no-cache' -d '<JSON_REQUEST_BODY>'


-----------------------------------------------------


If you are not able to send email through code or not even able to telnet on the email hostname, then you need to contact the IT team/infra/network team to get the details of the port, and firewall details:
  • Check through netw/k team if the default port 25 is enabled (not blocked) for use for sending email. 
  • If blocked, mostly port 587 (secured port for sending email on SMTP) should be enabled by raising appropriate request through service-now
  • If you are using IMAP protocol, port 465 should be enabled by raising request
  • Also, confirm with network team that if there is F5 (hardware), then the port needs to be enabled on F5 as well as on the server/host. It can happen that on both (F5 and server/host), the port needs to be unblocked then only sending email will work. So you might require to raise two requests for enabling port on F5 as well as the server/host IP Address.



--------------------------------------------------------------------------------------------

For knowledge:
1) Diff between CV and Resume
Ans: CV is a detailed one and can extend beyond 2 pages. Resume is a short brief summary of your skills and experience over one or two pages

2) Diff between TCP and UDP
Ans: General. Both TCP and UDP are protocols used for sending bits of data — known as packets — over the Internet. They both build on top of the Internet protocol. In other words, whether you are sending a packet via TCP or UDP, that packet is sent to an IP address.
(Transmission Control Protocol) is connection oriented, whereas UDP (User Datagram Protocol) is connection-less. ... UDP does not use acknowledgments at all, and is usually used for protocols where a few lost datagrams do not matter

If the network between the two point have a very high quality, UDP is absolutely faster than TCP, but in some other case such as the GPRS network, TCP may been faster and more reliability than UDP

3) TCP/IP protocol means:
Ans: Means, the IP obtains the address and TCP guarantees delivery of data to that address. → TCP = Transmission Control protocol, a connection oriented and reliable protocol that is present in the transport layer

4) Diff between TCP and HTTP:
Ans: While both TCP and UDP are used to transport other protocols, they have one significant difference; TCP offers guaranteed data transportation, whereas UDP doesn't. ... HTTP (HyperText Transfer Protocol) is a protocol that utilizes TCP to transfer its information between computers (usually Web servers and clients)

5) Diff between web server and application server
Ans.
While Web Server only supports Servlets and JSP. web server is supposed to provide http protocol level service while application server provides support to web service and expose business level service e.g. EJB
Tomcat is a web server and a Servlet/JavaServer Pages container. It is often used as an application server for strictly web-based applications but does not include the entire suite of capabilities that a Java EE application server would supply.
Tomcat is a web server (can handle HTTP requests/responses) and web container (implements Java Servlet API, also called servletcontainer) in one. Some may call it an application server, but it is definitely not an fullfledged Java EE application server (it does not implement the whole Java EE API)
Following are some of the key differences in features of Web Server and Application Server:

Web Server is designed to serve HTTP Content. App Server can also serve HTTP Content but is not limited to just HTTP. It can be provided other protocol support such as RMI/RPC
Web Server is mostly designed to serve static content, though most Web Servers have plugins to support scripting languages like Perl, PHP, ASP, JSP etc. through which these servers can generate dynamic HTTP content.
Most of the application servers have Web Server as integral part of them, that means App Server can do whatever Web Server is capable of. Additionally App Server have components and features to support Application level services such as Connection Pooling, Object Pooling, Transaction Support, Messaging services etc.
As web servers are well suited for static content and app servers for dynamic content, most of the production environments have web server acting as reverse proxy to app server. That means while servicing a page request, static contents (such as images/Static HTML) are served by web server that interprets the request. Using some kind of filtering technique (mostly extension of requested resource) web server identifies dynamic content request and transparently forwards to app server
Example of such configuration is Apache Tomcat HTTP Server and Oracle (formerly BEA) WebLogic Server. Apache Tomcat HTTP Server is Web Server and Oracle WebLogic is Application Server.
Other application servers: Glassfish, websphere, weblogic, jBoss
In some cases the servers are tightly integrated such as IIS and .NET Runtime. IIS is web server. When equipped with .NET runtime environment, IIS is capable of providing application services.
Application server provide services like Connection pooling, Transaction management, messaging, clustering, load balancing and persistence. Now Apache tomcat also provides connection pooling.

6) arrayList will create with size 10 initially. if i added only 3 elements to the list object what will happen for remaining empty elements.will they exist in memory or GC will clean?
Ans:they will exists in memory because it is allocated to underlying array and it cannot be reclaimed in parts.
Until GC frees up the memory, it will remain occupied.

No comments:

Post a Comment