Wednesday, September 30, 2015

Setup Printer Server in Window Enviroment

Recently company performing upgrading the printer due to the contract of leasing is end. So i have these opportunities to re-setup the entire print server and all the printer in the company. But here I to record down the very small request that requested by end user in my company.

So before you setup print server, you need few parameters in order to make sure the installation is going smooth.
  1. A server with complete setup and with fix ip.
  2. IP addresses for printer.
  3. AD server IP address or name for user authentication.
  4. SMTP server name or IP and account for scan to email (may vary to different setup)
  5. And the printer driver.

The request of the end user always very strange and picky. So have to really do a lot of home work. 

When the user is printing, he/she dun not want to see the notification appear as they consider it is an interference for them. So to disable the notification during printing, you have go to Device and Printers (You can locate this in control panel too). At the top of the device and printer window, at the top bar there is a menu with the name of Printer server properties. As shown at below picture.

While for Window XP you may locate it On the File menu, click Server Properties.





Then another small window menu will pop up and go to last tab to the menu. You will see there is a check box with the description. Select the setting as you wish and save it.To disable the notification when printing, uncheck Show informational notification for network printers. Please take note that the menu may vary according to the printer driver.


Monday, September 28, 2015

Setup NTP Server in Ubuntu

In order to ensure the LAN client all time is same and reduce the network usage, you may implement a local NTP server rather than each of the PC in LAN get update from internet.

If you are using terminal only you can use date command to check the system date time.

So here we going to install NTP server.

sudo apt-get install ntp

As usual after install the ntp server, we may proceed with doing the configuration by using the below configuration to do the change.

sudo nano /etc/ntp.conf
After open up the ntp.conf file with nano, you will see some show as below. Here is the list of NTP server that you get update from it. So by default is Ubuntu server, if you wish to change the NTP server as your preference you may delete and change it to your preferred server.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

After change the conf, please do not forget to save it. To ensure the change is made, you may verify it by using command below to check the performance or summary of the NTP server.

sudo ntpq -p
Here is an example output after assign the command.
# sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+stratum2-2.NTP. 129.70.130.70    2 u    5   64  377   68.461  -44.274 110.334
+ntp2.m-online.n 212.18.1.106     2 u    5   64  377   54.629  -27.318  78.882
*145.253.66.170  .DCFa.           1 u   10   64  377   83.607  -30.159  68.343
+stratum2-3.NTP. 129.70.130.70    2 u    5   64  357   68.795  -68.168 104.612
+europium.canoni 193.79.237.14    2 u   63   64  337   81.534  -67.968  92.792

After change the ntp server in the ntp.conf file, you have to remember to reload the file or restart the service in order to apply the change.

You may reload the service by command below.
sudo service ntp reload
or you can restart the service as command below.
sudo service ntp restart
Stop the service by using command below.
sudo service ntp stop
Start the service by using command below.
sudo service ntp start


Saturday, September 26, 2015

Install FTP Server on Ubuntu

Here we go to install the very secure FTP on Ubuntu.

sudo apt-get install vsftpd
After finish install vsftpd, you may think of change the configuration for the application.

sudo nano /etc/vsftpd.conf

Once you open up the conf file with nano, you may see all the configuration available in this file and all the configuration name is identical. Change the setting as you need. For an example, the most important thing is to restrict the anonymous access we disable it. In the vsftpd.conf look for below parameters and change YES to NO.

anonymous_enable=NO

So now you may able to transfer file using your favorite FTP software. For me I am using WinSCP for a reason that it is really light weight.



Friday, September 25, 2015

Unable to Update & Install via apt-get command

When trying to update or install software on Ubuntu server, below message if display as unable to fetch the source. There are few possibility where the mirror server is unreachable, outdated, or the host unable to be resolve. In my case is the host name is unable to resolve.


.......
Err http://extras.ubuntu.com precise Release.gpg                        
  Unable to connect to extras.ubuntu.com:http:
Err http://security.ubuntu.com precise-security InRelease

Err http://security.ubuntu.com precise-security Release.gpg
  Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
Reading package lists... Done
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/InRelease  

W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease  

W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease  

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/InRelease  
......

Once you think of host name unable to resolve, then the DNS is play important roles in this case. So here we go to configure the DNS.

sudo nano /etc/resolvconf/resolv.conf.d

So we going to use the Google DNS, key in the parameters as below.
nameserver 8.8.8.8
nameserver 8.8.4.4

Save and exit the file then try to update the Ubuntu server again.

sudoapt-get update



Tuesday, September 15, 2015

SharePoint People Picker

There is a quite new control for me in development in SharePoint which is people editor and i usually name is as people picker. Below is how the people picker look like.



Below is the front end code for people editor.

<SharePoint:PeopleEditor
                            AllowEmpty="true"
                            ValidatorEnabled="true"
                            ID="peEngineer" Width="250px"
                            runat="server" MultiSelect="false"
                            ShowCreateButtonInActiveDirectoryAccountCreationMode="false"
                            SelectionSet="User" />


Below is the code behind for get the user name from

//for SharePoint people picker
                    ArrayList resolvedEntities = peEngineer.ResolvedEntities;
                    SPUser engineer = null;
                    string engineerName = string.Empty;
                    foreach (PickerEntity entity in resolvedEntities)
                    {
                        engineer = SharePointUtil.GetCurrentSharepoinSite().RootWeb.EnsureUser(entity.Key);
                        engineerName = engineer.LoginName;
                    }


After you get the name from the AD, now show how to bind the value to the people picker. You may trigger any action such as button click or page load to run below code so that able to bind data into the people picker.

peEngineer.CommaSeparatedAccounts = "i:0#.w|contoso\testid";

cs

Report Viewer on SharePoint

Here is the way to resolve the report viewer on SharePoint Server.

1. This line must be commented out
<add key="ReportViewerMessages" value="Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

2. Also comment out the older version 8.0
<!--<add name="ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />-->

3. Add this line below
<add name="ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />


4. Confirm that Report Viewer retributable 2008 sp1 is installed


5.Enable session on SharePoint using Enable-SPSessionStateService

6. set enableSessionState="true"


Tuesday, August 25, 2015

Execute java Code in Ubuntu

One thing about Java is cross platform where it able to run at any machine with Java environment installed wile for VB and C# that mainly run in window environment. So now I here to record how to execute java code in Ubuntu.

Open up your terminal in Ubuntu.

Make sure your machine is install with Java. To check the version of Java you may use below command.

java -version

If there is no respond of Java version from the show version command, you may need to install Java.
Below is the command install Java version 1.8. Execute below command line by line, It take few minutes to download the Java and it based on your network connection.

sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
Once finish install, verify it by using java -version. So you may get to know the version of Java installed in the machine.

Create a java code in any directory that is accessible with read write access. Below is Hello world sample code for testing purpose and save the file name as myFileName.java while the Class name is TestJavaProgram.

//First Java Program class TestJavaProgram
{ 
    public static void main (String[] args)  
   {  
       System.out.println ("Hello, world."); 
   } 
}  
So after save the java file in a directory, using terminal dir command navigate to the particular folder/directory. After in the level of the directory, using below code to compile the java.

javac myFileName.java
After the compilation, you need to run the java code by using below command and make sure the class name is correct.

java TestJavaProgram
Alternative way some people may make the java code as a jar file. You may execute the jar file by using below command.

java -jar yourjarfilename.jar