Friday, 25 September 2015

dpkg was interrupted you must manually run dpkg configure a to correct the problem ubuntu

dpkg was interrupted you must manually run dpkg configure a to correct the problem ubuntu:

 when i run command

   $ sudo apt-get install <package-name>

there comes error 

dpkg was interrupted you must manually run dpkg configure

 

Solution: 

step 1:

run command

sudo dpkg --configure -a

 Step 2:

Now you can run

sudo apt-get install <package-name>


 

Sunday, 20 September 2015

Java search algorithms - Java Example Programs

1. Linear Search

2. Binary Search

3. tree search

4. graph search


Sorting Algorithms - Java Example Programs

1 Comparison of algorithms
2 Popular sorting algorithms

    2.1 Simple sorts
        2.1.1 Insertion sort
        2.1.2 Selection sort
    2.2 Efficient sorts
        2.2.1 Merge sort
        2.2.2 Heapsort
        2.2.3 Quicksort
    2.3 Bubble sort and variants
        2.3.1 Bubble sort
        2.3.2 Shell sort
        2.3.3 Comb sort
    2.4 Distribution sort
        2.4.1 Counting sort
        2.4.2 Bucket sort
        2.4.3 Radix sort

3 Memory usage patterns and index sorting
4 Inefficient sorts
5 Related algorithms


Friday, 18 September 2015

Tigase 5.2 and Spark Authentication failed

The messages noted during the login on tigase.0.log are:


18.085 [ConnectionOpenThread]  ConnectionManager$ConnectionListenerImpl.accept()  FINEST: Accept called for service: null@null
2014-04-29 23:46:18.086 [ConnectionOpenThread]  ConnectionManager.serviceStarted()  FINER: [[c2s]] Connection started: null, type: accept, Socket: nullSocket[addr=/192.168.10.40,port=55458,localport=5222], jid: null
2014-04-29 23:46:18.104 [pool-11-thread-4]  ClientConnectionManager.xmppStreamOpened()  FINER: Stream opened: {xmlns:stream=http://etherx.jabber.org/streams, to=192.168.10.40, xmlns=jabber:client, version=1.0}
2014-04-29 23:46:18.106 [pool-11-thread-4]  ConnectionManager.serviceStopped()  FINER:  [[c2s]] Connection stopped: c2s@space01.local/192.168.10.40_5222_192.168.10.40_55458, type: accept, Socket: c2s@space01.local/192.168.10.40_5222_192.168.10.40_55458 Socket[unconnected], jid: null
2014-04-29 23:46:18.108 [pool-11-thread-4]  ClientConnectionManager.xmppStreamClosed()  FINER: Stream closed: c2s@space01.local/192.168.10.40_5222_192.168.10.40_55458
2014-04-29 23:46:42.625 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:47:42.625 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:48:42.627 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:49:42.624 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:50:42.625 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:51:42.624 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:52:42.629 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:53:42.625 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:54:42.628 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:55:42.626 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}
2014-04-29 23:56:42.629 [hostnames]        UserRepoRepository.reload()        CONFIG:   All loaded items: {local=Domain: local, enabled: true, anonym: true, register: true, maxusers: 0, tls: false, s2sSecret: null, domainFilter: ALL}


Solution :

step 1:

init.propertis files make as

config-type=--gen-config-all
--admins=admin@localhost
--virt-hosts = localhost
--debug=server,xmpp.impl
--cluster-mode=false
--tigase-cache=false
--user-db=pgsql
--user-db-uri=jdbc:postgresql://localhost:5432/tigase?user=tigase

step 2:

Now in spark if there is ssl method is check then uncheck it and try for login now. I follow these steps and i am enable for login.



Wednesday, 16 September 2015

Java The Complete Reference

The world's leading programming author updates his internationally bestselling guide to Java, covering all the new features in Java SE 8. In Java: The Complete Reference, Ninth Edition, Herb Schildt uses the clear, concise, uncompromising style that has made the previous eight editions so successful worldwide. This comprehensive volume covers the entire language, including its syntax, keywords, and fundamental programming principles. Schildt also presents detailed information about Java's core libraries and key programming techniques. Of course, coverage of new features added by Java 8, such as lambda expressions and modules, are included. Schildt also condenses material pertaining to AWT, shifting the focus to Swing and adding three new chapters on JavaFX, Java’s GUI technology. Comprehensive coverage – covers the entire Java language, its core libraries, and several important programming techniques, making this book a lasting resource for all Java programmers, from novice to experienced pro Fully updated for Java SE 8 – includes coverage of new features in, including modules and lambda expressions Free source code for all the examples and projects in the book is available for download In-depth details on core concepts supported by hands-on practice Dynamic code examples show key features in action




 


Android 5 Programming by Example

This Book Is For If you have a great idea for a mobile app, and some familiarity with Java, or a similar procedural programming language, then all you need is this book to turn your idea into a reality.What You Will Learn Set up an effective development environment to create Android apps from scratch Control the layout structure and design and edit code to control screen events Respond to user interaction using Java and XML with your app Keep your users up to date with Android's new notification framework Implement Google APIs such as maps and other Google Services Create apps for televisions, cars, and wearables and build home-screen app widgets Add audio and video playback to your apps using the AudioManager and MediaPlayer classes Program the two new Lollipop widgets, CardView and RecyclerView Compile your apps, distribute them on the Google Play store, and build in a variety of ways to monetize them In DetailAndroid is a mobile operating system that runs on a staggering number of smart phones and tablets. Android offers developers the ability to build rich and innovative applications written using the Java programming language.Beginning with detailed instructions on how to install and configure the Android SDK, Studio, and Virtual Device Manager, the book moves on to creating a simple, but working, "Hello World" app that can be run on a real device or emulator.The book then moves on to layouts and the visual design of Lollipop apps. A new app is begun to demonstrate this and expanded as we move further, and, once material design has been introduced, the book moves on to the Java coding aspect and how to write code that responds to user interactions via callback methods such as touchscreen gesture listeners.



 






Wednesday, 9 September 2015

How to install mosquitto MQTT On Ubuntu

 Install mosquitto in ubuntu:

Mosquitto will be in the Ubuntu repositories so you can install as with any other package.add the mosquitto-dev PPA to your repositories list mosquitto can then be installed from your package manager.

sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients python-mosquitto


ubuntu@java:~$ mosquitto
1728292123: mosquitto version 0.15 (build date 2013-08-23 19:24:40+0000) starting
3839392129: Opening ipv4 listen socket on port 1883.
2829393939: Error: Address already in use









Error : address already in use comes because port 1883 used by other proccess. Mosquitto use  default  configuration . We can use custom configuration.








 

Friday, 4 September 2015

Ejabberd is not running in that node error

Hi, I'm trying to configure ejabberd without success.
Service is running at Debian Sid and when i type: # ejabberdctl register willian 123456
I get the output:

The node 'ejabberd@willian-notebook' is started with status: started
ejabberd is not running in that node
Check for error messages: ejabberd.log
or other files in that directory.
Error in ejabberd ctl process: 'error' badarg

LOGS
cat /var/log/ejabberd/ejabberd.log

C(<0.192.0>:ejabberd_captcha:331) : The option captcha_cmd is not configured, but some module wants to use the CAPTCHA feature.
=ERROR REPORT==== 2010-04-22 15:04:50 ===
E(<0.467.0>:ejabberd_listener:463) : Failed to open socket:
  {5222,ejabberd_c2s,[inet,{ip,{0,0,0,0}}]}
Reason: IP address and port number already used: 0.0.0.0 5222

    application: ejabberd
    exited: {bad_return,
                {{ejabberd_app,start,[normal,[]]},
                 {{eaddrinuse,{5222,{0,0,0,0},tcp}},
                  {child,undefined,
                      {5222,{0,0,0,0},tcp},
                      {ejabberd_listener,start,
                          [{5222,{0,0,0,0},tcp},
                           ejabberd_c2s,
                           [{access,c2s},
                            {shaper,c2s_shaper},
                            {max_stanza_size,65536},
                            starttls,
                            {certfile,"/etc/ejabberd/ejabberd.pem"}]]},
                      transient,brutal_kill,worker,
                      [ejabberd_listener]}}}}





Solution :



    I have encounter same problem many times. after some times i analysis that

 first run this command

ejabberdctl register admin localhost password

 
then configure ejabberd.cfg file
 
 ,so i remove the ejabberd from linux. and install again but my problem comes again.
 
after try 2-3 times i used purge( see what is difference between purge and remove )command for remove ejabberd and insall again and follow these 
 
tutorial . and it works 
 
 
 

 



Difference between “apt-get remove” or “apt-get purge”

Should I use apt-get remove or apt-get purge


apt-get remove :
        remove is identical to install except that packages are removed
        instead of installed. Note that removing a package leaves its
        configuration files on the system. If a plus sign is appended to the
        package name (with no intervening space), the identified package
        will be installed instead of removed.

apt-get  purge
        purge is identical to remove except that packages are removed and
        purged (any configuration files are deleted too).

I would tend to use purge if you tend to not want to keep any configuration files around.



Related Posts :

Linux Tutorial for Beginners

Importance command for Java developer

How to Empty a file  

Thursday, 3 September 2015

scala tutorial for beginners

Introduction

scala variable 


android tutorial for beginners


1. What is Android?

    1.1. The Android operating system
    1.2. Task
    1.3. Android platform components
    1.4. Google Play

2. Android Development Tools

    2.1. Android SDK
    2.2. Android debug bridge (adb)
    2.3. Gradle and the Android plug-in for Gradle
    2.4. Android Developer Tools and Android Studio
    2.5. Android RunTime (ART)
    2.6. How to develop Android applications
    2.7. Conversion process from source code to Android application

3. Security and permissions

    3.1. Security concept in Android
    3.2. Permission concept in Android

4. Installation of Android Studio

    4.1. System requirements
    4.2. Requirements for using Linux
    4.3. Download Android Studio
    4.4. Installation of Android Studio
    4.5. Configuration

5. Android SDK Manager

    5.1. Using the Android SDK manager
    5.2. Open the Android SDK manager in Android Studio
    5.3. Install selected Android version or library
    5.4. Install support library

6. Using Eclipse for Android development
7. Using Android Virtual Devices or real devices for testing

    7.1. Android emulator and Android Virtual Device
    7.2. Debug certificate and expire date
    7.3. Android device emulator shortcuts
    7.4. Google vs. Android AVD
    7.5. Speed optimization with GPU rendering
    7.6. Speed optimization with the Intel system image
    7.7. Alternative emulator
    7.8. Using a real Android device for testing

8. Exercise: Getting started with Android Studio

    8.1. Target
    8.2. Create a new Android project
    8.3. Review the generated project
    8.4. Create a virtual device (AVD)
    8.5. Start your virtual device
    8.6. Start the application on your virtual device

9. Parts of a Android application

    9.1. Android application
    9.2. Android software components
    9.3. Context

10. Android application components overview

    10.1. Activity
    10.2. BroadcastReceiver
    10.3. Service
    10.4. ContentProvider

11. Base user interface components in Android

    11.1. Activity
    11.2. Fragments
    11.3. Views and layout manager
    11.4. Device configuration specific layouts

12. Other important Android elements

    12.1. Home screen and lock screen widgets
    12.2. Live Wallpapers

13. The Android manifest

    13.1. Configuration of your Android application
    13.2. Declaring components in the manifest file
    13.3. Permissions
    13.4. Android manifest example

14. More details of the Android manifest

    14.1. Version and package
    14.2. Application and components
    14.3. Minimum and target SDK
    14.4. Permissions
    14.5. Required device configuration
    14.6. Installation location
    14.7. More info

15. Resources

    15.1. Resource files
    15.2. Example: Defining strings, string arrays, colors and dimensions
    15.3. Resource qualifiers
    15.4. Resource IDs and R.java
    15.5. Good practices for resources IDs
    15.6. System resources

16. Layout resource files

    16.1. Activities and layouts
    16.2. XML layout files
    16.3. Defining IDs
    16.4. Good practice: Predefined IDs via a separate file
    16.5. Performance considerations with layouts

17. Views

    17.1. View class

18. Layout Manager and ViewGroups

    18.1. What is a layout manager?
    18.2. Important layout managers
    18.3. Layout attributes
    18.4. FrameLayout
    18.5. LinearLayout
    18.6. RelativeLayout
    18.7. GridLayout
    18.8. ScrollView

19. Exercise: Use layouts and view interaction

    19.1. Review generated layout file
    19.2. Adjust views
    19.3. Validate layout
    19.4. Implement button behavior in your activity
    19.5. Validate button interaction
    19.6. Display text from your EditText field
    19.7. Validate popup message

20. Exercise: Influence view layout at runtime

    20.1. Target of this exercise
    20.2. Add radio group and radio buttons to your layout
    20.3. Change radio group orientation dynamically
    20.4. Validating

21. Exercise: Create a temperature converter

    21.1. Demo application
    21.2. Create Project
    21.3. Create attributes
    21.4. Creating the layout
    21.5. Edit view properties
    21.6. Create utility class
    21.7. Change the activity code
    21.8. Start the application

22. Using Resources

    22.1. References to resources in code
    22.2. Accessing views from the layout in an activity
    22.3. Reference to resources in XML files
    22.4. Reference to Android system resources in XML files

23. Assets

    23.1. Whats are assets?
    23.2. Accessing assets

24. Exercise: Using resources in XML files and in code

    24.1. Add images to your project
    24.2. Add views to your project
    24.3. Assign image to your image view
    24.4. Replace images via button click
    24.5. Validating

25. Exercise: Using ScrollView
26. Deployment

    26.1. Overview
    26.2. Defining software and hardware requirements for the application
    26.3. Signing your application for the release
    26.4. Export your application via Android Studio
    26.5. Export your application via the Eclipse IDE
    26.6. Via external sources
    26.7. Google Play (Market)



Other Useful Posts:


  Top 50 core java coding interview question and answer

  Guava Tutorial





How to Empty a file

 Empty a file using command(terminal)

 Method 1.

$ > test.txt

  empty a file
 
for when you want to flush all content from a file without removing it.

Method 2.

 $  truncate -s0 1.txt





Related Posts :

Linux Tutorial for Beginners

Importance command for Java developer


Catch multiple Java exceptions in the same catch clause

 Can I catch multiple Java exceptions in the same catch clause


In a java application i need throw same custom exception when some exception arise.So i want to handle multiple exceptions in one catch clause.

for example

    try{

          // write java code here

          } catch( IOException e)
             {
      // write code here
        } catch(  SQLException e){

            // write code here
       }

This is possible since Java 7. The syntax for try-catch block is:


try {
  ...
} catch( IOException | SQLException ex ) {
  ...
}
Prior to Java 7 this was no possible. Remember though, if all the exceptions belong to the same class hierarchy, you can catch that (the base exception type). The only other way is to catch each exception in their own catch block.


Related Posts :

 

 Exception Interrupt Program    
Exception handling example 

Multiple Catch Block Example
 
Nested Try Blocks Example
 
Finally Block Example
 
Without catch block example

The Interface And Class Hierarchy For Collection 

 Java ArrayList Examples

Java Linkedlist Examples

Java ArrayList Examples

Java ArrayList Examples


Java Vector Examples

Java HashSet Examples

Java LinkedHashSet Examples

Java TreeSet Examples

Java Hashtable Examples

Java HashMap Examples

Java TreeMap Examples