Skip to main content

Posts

Showing posts from February, 2016

How to remotely connect to Linux Desktop by X11 Forwarding using Xming and PuTTY

Xming is a PC X Window Server. This enables programs being run remotely to be displayed on your desktop. Download and run the installation program from:http://sourceforge.net/projects/xming/ Navigate to the Files section and download:Xming setup from the Xming folderthe fonts package installer from the Xming-fonts folderBy default both programs will be installed into the same location, so don't the worry about over writing files. We cannot work without both packages.Once installed, running All Programs > Xming > XLaunch is a good idea to see what the configuration looks like. In most cases, the default options should be just fine.Finally run All Programs > Xming > Xming to start the PC X Server. The “X” icon should be visible on the Windows Taskbar. The X Server must be started before setting up a SSH connection to a campus machine.Configuring PuTTY
Scroll to Connection > SSH > X11. Check the box next to Enable X11 Forwarding. By default the X Display location is e…

Content loading and conversion rates for your website

According to Kissmetrics, the following issues usually affect the conversion rates for your website:

47 percent of consumers expect a Web page to load in two seconds or less.40 percent of people will abandon a website that takes more than three seconds to load.A one second delay in page response can result in a 7 percent reduction in conversions.

What applys for a Metered Connection in Windows 10

Disables automatic downloading of Windows updates: Windows won’t automatically download updates from Windows Update on metered Internet connections. You’ll get a “Download” button you can click whenever you want to install updates.Disables automatic downloading of app updates: The Windows Store won’t automatically download updates for your installed “Store apps” on metered connections, either. Desktop apps like Chrome, Firefox, and others will continue updating themselves normally.Disables peer-to-peer uploading of updates: On a metered connection, Windows 10 won’t use your upload bandwidth to share updates with PCs over the Internet. Windows 10 does this by default, consuming your potentially limited upload allowance to reduce Microsoft’s own bandwidth consumption.Other apps may behave differently: Apps — particularly apps from the Windows Store — could potentially read this setting and behave differently. For example, a “universal app” BitTorrent client could potentially stop downlo…

How to apply advanced search such as "OR" conditions for Gmail filter

Type into the search field of Gmail:
from:i88.ca OR from goyun.infoThen make a filter from this search: click the little down arrow on the right side of the search field and then click create filter with this search.

Or you can directly put the search terms in the filter's Has the words field when create a new filter.

Other example of search operations:
OperatorDefinitionExamplesfrom:Used to specify the senderExample: from:amy
Meaning: Messages from Amyto:Used to specify a recipient, including "cc:" and "bcc:" fieldsExample: to:david
Meaning: All messages that were sent to David (by you or someone else)subject:Search for words in the subject lineExample: subject:dinner
Meaning: Messages that have the word "dinner" in the subjectORSearch for messages matching term A or term B*
*OR must be in all capsExample: from:amy OR from:david
Meaning: Messages from Amy or from David-
(hyphen)Used to exclude messages from your searchExample: dinner -movie
Meaning: Messages th…

Entity manager in JPA

A EntityManagerFactory is an expensive-to-create, threadsafe object intended to be shared by all application threads. It is created once, usually on application startup.

An EntityManager is an inexpensive, non-threadsafe object that should be used once, for a single business process, a single unit of work, and then discarded. An EntityManager will not obtain a JDBC Connection (or a Datasource) unless it is needed, so you may safely open and close an EntityManager even if you are not sure that data access will be needed to serve a particular request.

An EntityManager should not be static. EntityManager is NOT thread-safe and static makes no sense in the context of JEE/SessionBean.

A database transaction has to be as short as possible, to reduce lock contention in the database. Long database transactions will prevent your application from scaling to highly concurrent load.

Don't use the entitymanager-per-operation anti-pattern, that is, don't open and close an EntityManager for ever…

Project Stages in JSF

Possible Project Stage values are as follows:
DevelopmentUnitTestSystemTestProductionProject Stage is configured through a context parameter in the web deployment descriptor file. Here is an example:

<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>

If no Project Stage is defined, the default stage is Development.

Why WildFly

follows the evolution of Java EE specifications faster than any other vendor;is a continuation of JBoss, which is a rock solid application server with years of expertise on critical business applications;is supported by Red Hat, a consistently growing IT company.

Microsoft has made TypeScript 1.8 available and is hoping to entice developers to migrate their JavaScript projects

In version 1.8, .js JavaScript files now can output to .tsc, accessing the TypeScript compiler and allowing developers to convert JavaScript to TypeScript.

"The TypeScript compiler checks the input .js files for syntax errors, and emits valid output based on the --target and --module flags."

"The output can be combined with other .ts (TypeScript) files as well."

JSF: f:metadata Example

<ui:definename="body">
<f:metadata>
<f:viewParamname="id"value="#{bean.id}"/>
<f:eventtype="preRenderView"listener="#{bean.load}"/>
</f:metadata>
....
</ui:define>You need to put includeViewParams=true to the link.


Your listener should be:
publicvoidload(ComponentSystemEvent event){
// ...
}

Implicit Objects in JSF

Implicit Objects in JSF
Implicit ObjectWhat It IsapplicationScope A Map of the application scope attribute values, keyed by attribute name cookie A Map of the cookie values for the current request, keyed by cookie name facesContext The FacesContext instance for the current request header A Map of HTTP header values for the current request, keyed by header name headerValues A Map of String arrays containing all the header values for HTTP headers in the current request, keyed by header name initParam A Map of the context initialization parameters for this web application param A Map of the request parameters for this request, keyed by parameter name paramValues A Map of String arrays containing all the parameter values for request parameters in the current request, keyed by parameter name requestScope A Map of the request attributes for this request, keyed by attribute name sessionScope A Map of the session attributes for this request, keyed by attribute name view The root UIComponent in the current componen…

Developping / moving application to the cloud

Database: What considerations are there for SQL/NoSQL in PaaS? Is the price, performance within your limit?Asset Hosting: How do you deal with uploaded content (images/videos/music)?Session Management: How do you deal with session data?Caching: How do you incorporate modern caching techniques?Asynchronous Processing: How do you handle long-running processes?

Reserved DNS names

RFC 6761 reserves the following four top-level domain names to avoid confusion and conflict. Any such reserved usage of those TLDs should not occur in production networks that utilize the global domain name system: example: reserved for use in examplesinvalid: reserved for use in obviously invalid domain nameslocalhost: reserved to avoid conflict with the traditional use of localhost as a hostnametest: reserved for use in tests
In addition, RFC 6762 reserves the use of .local for link-local host names that can be resolved via the Multicast DNS name resolution protocol.
Example.com, example.net, example.org, and example.edu are second-level domain names reserved for documentation purposes and examples of the use of domain names.

How to Use Email aliases in Gmail

You can create up to 30 email aliases for an individual, not counting the email aliases created automatically when you add domain aliases.

Gmail doesn't offer traditional aliases, but you can receive messages sent to [email protected] For example, messages sent to [email protected] are delivered to [email protected]

Gmail actually ignores periods that are inserted into your email address, and cuts off anything that appears after a plus sign. So if I sent an email to [email protected], it would be delivered to [email protected], instead. It’s similar with plus signs.

You can set up filters to automatically direct these messages to Trash, apply a label or star, skip the inbox, or forward to another email account.

How to rename buckets on S3 of Amazon AWS

Rename by "cut" or "copy": Create the new bucket with the desired name.Go to the old bucket and select all files: click the first and then shift+click the last.Above the file listing, in the button row, is one marked "Actions", which opens a menu that includes "Cut" and "Copy".  Pick one.Go to the new bucket, click Actions, and Paste your files.You can check the progress of the copying on the "Transfers" tab on the right.

Privacy considerations of Email tracking

If you apply message tracking in your newsletters or email campaigns, it is good practice to inform your subscribers you are doing so, for instance through your (organization's) privacy policy statement.

Keep in mind that including this information in your privacy policy statement is not only good practice, but also a legal requirement in many countries.

Model View Controller Design Pattern

Model View Controller pattern is the core design pattern of web applications.

There are variations based on how actions and events are handled. The popular 2 MVC patterns are:

Request (action) based MVC

This is how among others Spring MVC,Struts and Stripes works. You have more control but You have to gather, convert and validate the request parameters (mostly) yourself.

Component based MVC

This is how among others JSF, Wicket and Play! works. You get a simpler model and view and all the "raw" Servlet API is abstracted completely away. But they allow less fine grained control over the output.
JavaScript and Java are atop the RedMonk programming language rankings for early 2016. PHP and Python are in the third and fourth spots respectively, followed by a three-way tie for fifth place among C#, C++, and Ruby.

JavaScript’s continued strength is impressive, as is Java’s steady, robust performance.

How to enable Blogger API in Google App Script project

Enabling the Blogger APIBefore accessing the Blogger API you need to enable it in the Google Developers Console: Select Resources > Developer Console Project and click on the link that appears in the dialog which is your app script project name.The link of your app script project name should take you to the Google Developers Console for the project where you can click the ‘Enable and manage APIs option. Find Blogger API and enable it.

How to add OAuth2 library to Google App Script project

Adding the OAuth2 libraryOAuth2 library is already published as an Apps Script, making it easy to include in your project. To add it to your script, do the following in the Apps Script code editor: Click on the menu item "Resources > Libraries..."In the "Find a Library" text box, enter the project key MswhXl8fVhTFUH_Q3UOJbXvxhMjh3Sh48 and click the "Select" button.Choose a version in the dropdown box (usually best to pick the latest version).Click the "Save" button.

How to add your own custom search engine to Chrome

Settings -> Search -> "Manage search engines..." -> "Other Search Engines" Try https://job.i88.ca as an example: Add a new search engine: search job - this is only for use here, you won't see this anywhere elseKeyword (shortcut): i88ca — this will be used to trigger a custom search in the Omnibox; for convenience, use an abbreviation of what you'll be searchingURL with %s in place of search: https://job.i88.ca/index.jsp?keys=%s — for most blogs and news sites, you'll use the URL and add search?q=%s, but other sites vary (see below)To find the URL needed to create a custom search outside of a blog or news site, it's quickest to simply Google it, e.g. "Twitter search Chrome custom search". Here's a handy list to start, collected across the web: Social Media Twitter - http://twitter.com/search?q=%sFacebook - https://www.facebook.com/search/more/?q=%sLinkedIn - http://www.linkedin.com/commonSearch?type=people&keywords=%s&sear…

How to create new Object In JPQL Select Statement by Constructor Expression

When you want to retrieve a Data Transfer Object instead of retrieving a full entity or a full graph of objects in a type safe way, then you can create the new Object in the JPQL select statement:
SELECT NEW ca.i88.it.UserModel(u.name, u.phone) FROM User u;Here a constructor is used in the SELECT list to return one or more Java instances. The constructor name must be fully qualified.

Google CLOUD DATAPROC - Managed Spark and Hadoop in the Cloud. Fast, easy to use, and low cost

Google Cloud Dataproc minimizes two common and major distractions in data processing —cost and complexity by providing: Low-cost. using Spark and Hadoop should not break the bank and that you should pay for what you actually use. As a result, Cloud Dataproc is priced at only 1 cent per virtual CPU in your cluster per hour, on top of the other Cloud Platform resources you use. Moreover, with per-minute billing and a low 10-minute minimum, you pay for what you actually use, not a rounded (up) approximation.Speed. With Cloud Dataproc, clusters do not take 10, 15, or more minutes to start or stop. On average, Cloud Dataproc start and stop operations take 90 seconds or less. This can be a 2-10x improvement over other on-premises and IaaS solutions. As a result, you spend less time waiting on clusters and more time hands-on with data.Management. Cloud Dataproc clusters don’t require specialized administrators or software products. Cloud Dataproc clusters are built on proven Cloud Platform se…

"bean- discovery-mode" attribute for Contexts and Dependency Injection

Java EE 7 platform enables default CDI injection for all beans that explicitly contain a CDI scope annotation and EJBs. A new attribute, “bean- discovery-mode” attribute is added to beans.xml:
<beansxmlns=”http://xmlns.jcp.org/xml/ns/javaee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://xmlns.jcp.org/xml/ns/javaeehttp://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd” bean-discovery-mode=”all”>
</beans>This attribute can take the following values:
all: All types in the archive are considered for injection. annotated: Only types with an explicitly declared CDI scope are considered for injection. none: Disable CDIBy default, CDI interceptors are disabled and can be enabled and ordered via the @javax.interceptor.Interceptor.Priority annotation as shown:
@Priority(Interceptor.Priority.APPLICATION+10)
@Interceptor
@Logging
publicclassLoggingInterceptor {
//. . . }This can be done for decorators and alternatives too.

Public API of javax.jms

JMSContext
Main interface to the simplified API

JMSProducer
Simple object used to send messages on behalf of JMSContext

JMSConsumer
Simple object used to receive messages from a queue or topic

JMS Connection Factory
Annotation used to specify the JNDI lookup name of ConnectionFactory

JMS Destination Definition
Annotation used to specify dependency on a JMS destination

QueueBrowser
Object to look at messages in client queue without removing them