Solve ECJ error in liferay IDE

You must have come across the errorTask cannot continue because ECJ is not installed. ECJ was automatically installed. Please rerun your task. Total time: 6 secondwhile ant running the build.xml file in liferay.

To solve this error follow the below steps:

In eclipse Go to Window (menu) –> Preferences and the below window gets opened up:2012-12-29_150309

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Where you can see an option named “Ant”. Under the Ant option select runtime, so you will see the above showed Runtime tab.

Select the Global Entries section, now on the right hand side click on the Add External Jar. Select the ecj.jar file kept in your computer.

You can find the ecj.jar in the liferay sdk/lib folder. And that’s it. Now build your project again. You will see a BUILD SUCCESSFFULL message.

Cheers!!!

Advertisements

Solving 404 error after upgrade magento to 1.7

Hello friends,

By doing many useful changes magento is improving a lot in the current competitive market. As a part of that Magento released the latest stable community version 1.7.0.2 on 5th July 2012.

Now it’s time for magento store owners to upgrade their store to latest version to get the maximum advantage of new functionalities.

To upgrade the magento store you can follow the steps given in the below link.

https://indiestechtips.wordpress.com/2012/05/19/magento-upgrade/

Now let’s come to the main topic. Just before a month I had a task to upgrade magento to 1.7. To do that task I followed the proper steps. But after upgrading I opened my site and it was giving “404 Error” on each page of site.

At that time I was surprised and confused about what happened with my site.

Then to solve that problem I searched the web and found the cause of problem and solution of it that I have discussed below.

Many times while doing any operation with magento connect manager such a 404 error encounters and our site get stopped working.

The cause of that problem is incorrect folder permission.

To solve that problem just download the magento-cleanup.php file from here, put it in your magento root folder and execute it.

Once you executed it you can see the list of messages that magento cleanup has reset the folder permission.

And if you have “maintenance.flag” file in your magento root folder then delete it.

That’s it.

Now open your site and see the result.

Also refer the under given link to get knowledge about some nasty issues which can occur after upgrading magento to 1.7.

https://indiestechtips.wordpress.com/2012/08/18/problems-with-magento-while-upgrading-to-1-7/

Hope this will help you.

Thanks.

Configure Magento Multistore with parked domain

The Magento script allows you to setup multiple stores using different domains which you would have to add as parked for your account. To setup Magento Multistore with parked domains follow this steps:

Note: This article assumes that you have already added a domain as parked for your account.

1) Login the Magento administration area

2) Navigate to “Catalog” -> “Manage Categories”

3) Click the “Add root category” button, which could be found on the left.

mage-root-cat

4) On the right side for “Name” enter your parked domain. For example : example.com. For “Is active” and “Is Anchor” select “yes” from the dropdown menu.

5) Click the “Save Category” button.

6) Now navigate to “System” -> “Manage Stores”

7) Click the “Create website” button.

8) For “Name” use example.com (in your case your parked domain). For code use example (or one by your choice). It is important to remember these settings as you will need them later.

mage-new-website

9) Save the website.

10) Now click on the “Create Store” button.

11) For website choose your example.com (your parked domain) from the dropdown menu. For “Name” you may enter “Example”. For “Root Category” select your parked domain again from the dropdown menu. Hit the “Save” button.

mage-new-store1

Once saved, click the “Create Store View” button.

12) For the “Store” select “Main Store” from the dropdown menu. For “Name” enter “English”. For the code you may use one by your choice. For “Status” select “Enabled”.

13) Save the “Store View”.

14) Navigate to “System” -> Configuration

15) Change “Current Configuration Scope” from “Default Configu” to example.com (or your parked domain).

16) From the left side menu select “Web”

17) For the “Secure” and “Unsecure” sections remove the mark for “Use Default” box. It could be found next to “Base URL”. Now enter the URL for your magento store: http://www.example.com.

mage-base-url

(you should change that with your actual URL)

18) Click the “Save Config” button.

19) Still under “System -> Configuration” change the “Current Configuration Scope” to “Default Config”.

20) Select “Web” from the left sidebar under the General section.

21) For “URL Options -> Auto-redirect to Base URL” set to “No”.

mage-url-redirect

22) Click the “Save Config” button.

23) Now using a text editor open the .htaccess file of your Magento script. Add the following lines in the end of the file:

SetEnvIf Host www\. example\.com MAGE_RUN_CODE=YOUR_CODE_HERE
SetEnvIf Host www\. example \.com MAGE_RUN_TYPE=website
SetEnvIf Host ^ example \.com MAGE_RUN_CODE=YOUR_CODE _HERE
SetEnvIf Host ^ example \.com MAGE_RUN_TYPE=website

You should change:
“example \.com” with your parked domain.

YOUR_CODE_HERE – with the actual code which you have used upon creating the store.

Done ! 🙂
Hope this will help you.
Thanks.

Expandable ListView in Android

Hello Friends,

Today,I will explain you about Expandable listview in android that what is actually Expandable Listview and how it works with simple example.

ExpandableListView is very useful when you want to sort lists into categories.
Like: If you want to make an app for downloading movies and  you might want to categories them by genre, so you can navigate through them easier using ExpandableListView.

A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the  ExpandableListAdapter associated with this view.

Now, We will go through one simple example so you can get some idea.

1)  Lets first create a new Android project and name it “indies.expandListViewDemo”
and the build target for Android 2.2, and next set the following:
Application name: Movie expListView
Package name: com.indies.expandListView
Create Activity (Checked): MovieActivity
Then press Finish.

2)Basic Layout:

The layout is fairly simple.
Go to res->layout and open the file main.xml
There you’ll only find a LinearLayout and a TextView.
Remove the TextView and add the following

<ExpandableListView
android:id="@+id/ExpListview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:groupIndicator="@null" />

So now, the code should look like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=<i>"http://schemas.android.com/apk/res/android"</i>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#000000"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="5dip">

<ExpandableListView
android:id="@+id/ExpListView"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:cacheColorHint="#000000"
android:groupIndicator="@null"/>
</LinearLayout>

3)  Creating  classes for handle the data

Let’s start out by creating a new package in the src-folder and name com.indies.expandListView.Classes
In this package we are going to create 2 class-files, one named ExpandListGroup.java, and the other name ExpandListChild.java.
In this code we will only get and set the values.

The ExpandListChild.java is going to hold 1 value  Name :

package com.indies.expandListView.Classes;

public class ExpandListChild {

private String Name;
public String getName() {
return Name;
}

public void setName(String Name) {
this.Name = Name;
}}

And the ExpandListGroup.java is going to hold 2 values called Name and Items

package com.indies.expandListView.Classes;

import java.util.ArrayList;

public class ExpandListGroup {

private String Name;
private ArrayList<ExpandListChild> Items;

public String getName() {
return Name;
}

public void setName(String name) {
this.Name = name;
}

public ArrayList<ExpandListChild> getItems() {
return Items;
}
}

4) The Adapter: Here is the somewhat tricky part. the ExpandListAdapter, this is the code that will handle the Items so they can be displayed. For this part we are going to create a new package, and we are naming it com.indies.expandListView.Adapter In this package we are going to create a new class called ExpandListAdapter.java Here is the code for that class

package com.indies.expandListView.Adapter;

import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.TextView;

import android.widget.ExpandableListView.OnGroupCollapseListener;
import android.widget.ExpandableListView.OnGroupExpandListener;
import com.indies.expandListView.Classes.ExpandListGroup;
import com.indies.expandListView.Classes.ExpandListChild;
import com.indies.expandListView.R;

public class ExpandListAdapter extends BaseExpandableListAdapter {

private Context context;
private ArrayList<ExpandListGroup> groups;
private ExpandableListView mExpandableListView;
private int[] groupStatus;

public ExpandListAdapter(Context context,ExpandableListView pExpandableListView, ArrayList<ExpandListGroup> groups) {

this.context = context;
this.groups = groups;
mExpandableListView=pExpandableListView;
groupStatus = new int[groups.size()];
setListEvent();
}

private void setListEvent() {
mExpandableListView.setOnGroupExpandListener(new OnGroupExpandListener() {

@Override
public void onGroupExpand(int arg0) {
groupStatus[arg0] = 1;
}
});

mExpandableListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {

@Override
public void onGroupCollapse(int arg0) {
groupStatus[arg0] = 0;
}
});
}

public void addItem(ExpandListChild item, ExpandListGroup group) {

if (!groups.contains(group)) {
groups.add(group);
}

int index = groups.indexOf(group);
ArrayList<ExpandListChild> ch = groups.get(index).getItems();
ch.add(item);
groups.get(index).setItems(ch);
}

public Object getChild(int groupPosition, int childPosition) {

ArrayList<ExpandListChild> chList = groups.get(groupPosition).getItems();
return chList.get(childPosition);
}

public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}

public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View view,

ViewGroup parent) {
ExpandListChild child = (ExpandListChild) getChild(groupPosition, childPosition);

if (view == null) {
LayoutInflater infalInflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
view = infalInflater.inflate(R.layout.<i>expandlist_child_item</i>, null);
}

TextView tv = (TextView) view.findViewById(R.id.<i>item_title);
tv.setText(child.getName().toString());
return view;
}

public int getChildrenCount(int groupPosition) {

ArrayList<ExpandListChild> chList = groups.get(groupPosition).getItems();
return chList.size();
}

public Object getGroup(int groupPosition) {
return groups.get(groupPosition);
}

public int getGroupCount() {
return groups.size();
}

public long getGroupId(int groupPosition) {
return groupPosition;
}

public View getGroupView(int arg0, boolean arg1, View arg2, ViewGroup arg3)  {

GroupHolder groupHolder;

if (arg2 == null) {
arg2 = LayoutInflater.from(this.context).inflate(R.layout.expandlist_group_item,null);

groupHolder = new GroupHolder();
groupHolder.img = (ImageView) arg2.findViewById(R.id.tag_img);
groupHolder.title = (TextView) arg2.findViewById(R.id.group_title);
arg2.setTag(groupHolder);
}
else
{
groupHolder = (GroupHolder) arg2.getTag();
}

if (groupStatus[arg0] == 0) {

groupHolder.img.setImageResource(R.drawable.down_arrow);
}
else {

groupHolder.img.setImageResource(R.drawable.up_arrow);
}

groupHolder.title.setText(groups.get(arg0).getName());
return arg2;
}

class GroupHolder {
ImageView img;
TextView title;
}

public boolean hasStableIds() {
return true;
}

public boolean isChildSelectable(int arg0, int arg1) {
return true;
}

}

Above code gets each group and draws it on the screen in the correct order. Then, when you expand one of them, it gets the Childs and draws them on the screen in the correct order. Above code also sets the displayed text for each group and child.

5)  Group and child layout Lets go into the res->layout and add 2 new xml files named expandlist_child_item.xml and expandlist_group_item.xml The code for each of them are very  simple. For the expandlist_group_item.xml

<?xml version=<i>"1.0"</i> encoding=<i>"utf-8"</i>?>
<RelativeLayout xmlns:android=<i>"http://schemas.android.com/apk/res/android"</i>

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="false"
android:paddingTop="5dip">

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="70dp"
android:background="#13a0d5"
android:gravity="center_vertical">

<TextView
android:id="@+id/group_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dip"
android:textColor="#ffffff"
android:textSize="25dip"
android:textStyle="bold"/>
</LinearLayout>

<ImageView
android:id="@+id/tag_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:src="@drawable/down_arrow"/>

</RelativeLayout>

Now, For the expandlist_child_item.xml

<?xml version=<i>"1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=<i>"http://schemas.android.com/apk/res/android"</i>

android:id="@+id/groupItem"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#0b5c7a"
android:clickable="true" >

<TextView
android:id="@+id/item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dip"
android:layout_marginLeft="15dip"
android:text="sample"
android:textColor="#ffffff"
android:textSize="20sp"/>
</LinearLayout>

6)  Activity: Go in to src->com.indies.expandListView and open the MainActivity.java This is the code you’ll see.


package com.indies.expandListView;

import java.util.ArrayList;
import com.indies.expandListView.Adapter.ExpandListAdapter;
import com.indies.expandListView.Classes.*;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ExpandableListView;

public class MovieActivity extends Activity {
    /** Called when the activity is first created. */
	private ExpandListAdapter ExpAdapter;
	private ArrayList<ExpandListGroup> ExpListItems;
	private ExpandableListView ExpandList;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ExpandList = (ExpandableListView) findViewById(R.id.ExpListView);
        ExpListItems = SetStandardGroups();
        ExpAdapter=new ExpandListAdapter(getApplicationContext(),ExpandList,ExpListItems);
        ExpandList.setAdapter(ExpAdapter);
    }

    public ArrayList<ExpandListGroup> SetStandardGroups() {
    	ArrayList<ExpandListGroup> list = new ArrayList<ExpandListGroup>();
    	ArrayList<ExpandListChild> list2 = new ArrayList<ExpandListChild>();
        ExpandListGroup gru1 = new ExpandListGroup();
        gru1.setName("Action Movies");
        ExpandListChild ch1_1 = new ExpandListChild();
        ch1_1.setName("The Dark night");

        list2.add(ch1_1);
        ExpandListChild ch1_2 = new ExpandListChild();
        ch1_2.setName("Ghayal");
        list2.add(ch1_2);
        ExpandListChild ch1_3 = new ExpandListChild();
        ch1_3.setName("Sigham");
        list2.add(ch1_3);
        gru1.setItems(list2);
        list2 = new ArrayList<ExpandListChild>();

        ExpandListGroup gru2 = new ExpandListGroup();
        gru2.setName("Commmedy");
        ExpandListChild ch2_1 = new ExpandListChild();
        ch2_1.setName("Heraferi");
        list2.add(ch2_1);
        ExpandListChild ch2_2 = new ExpandListChild();
        ch2_2.setName("Chupke Chupke");
        list2.add(ch2_2);
        ExpandListChild ch2_3 = new ExpandListChild();
        ch2_3.setName("HouseFull-2");
        list2.add(ch2_3);
        gru2.setItems(list2);
        list.add(gru1);
        list.add(gru2);

        return list;
    }
}
 

Now we set some default items to a list, load the list to the Adapter, and apply the adapter to the ExpandableListView The finished product of this tutorial will look like this

image

Hope it helps.HaPpY Coding. 🙂

Interface Builder: Connecting Objects ( i-Phone)

Hello friends,
Following steps used for making connectivity UI elements with various events. Example showing events (Touch up Event) occur when button is pressed.

You can drag UI elements from the Library into your app’s windows and views, compile the project, and see the app – but it won’t actually do anything until you make connections between the UI and Xcode.

iphone

IBOutlets
Every object you add in Interface Builder – buttons, labels, text fields, etc. – must have an IBOutlet instance variable declared in your Xcode project. “IBOutlet” is added before the instance declaration; it simply indicates that this object will be connected to something in Interface Builder.

Edit FirstAppDelegate.h and add declarations for the UIButton and UILabel you added in Interface Builder:

@interface FirstAppDelegate : NSObject  {
    UIWindow *window;

    IBOutlet  UIButton  *aButton;
    IBOutlet  UILabel   *helloLabel;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

Save the file, then switch back to Interface Builder. Control-click on the orange “First App Delegate” icon in the Document window. This brings up the connections window:

first

You should see your newly defined IBOutlet instances, aButton and helloLabel, in this list.

IBOutlets are connected from your class object to the UI objects. (In this case your class object is First App Delegate, although normally it will be a view controller class. We’ll look at controllers soon.)

Click and hold-on on the circle next to each outlet’s name (such as aButton), then drag your mouse out to the UI element in the window or view. You can also control-drag from the orange object icon to the UI element.

window

IBActions
IBActions are methods that are called when some action is taken – for example, when a button is pressed, it should call a method in your code. These methods are declared in your class’s @interface (.h) file:

@interface FirstAppDelegate : NSObject  {
    UIWindow *window;

    IBOutlet  UIButton  *aButton;
    IBOutlet  UILabel   *helloLabel;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

// add method declarations AFTER the closing } brace but before the @end statement:

- (IBAction)pressButton:(id)sender;

@end

Add the pressButton method to FirstAppDelegate.h.

Note: – IBAction connections are made in the opposite direction as IBOutlets: you control-drag from your UI object to the orange class object icon.

Save the .h file, then switch back to Interface Builder. Click on the button in your app window, then control-drag from the button to the orange object representing your class (in this case it’s First App Delegate). When you let go of the drag, a small Events window will pop up, showing you the available IBAction methods you can connect to. Chose the pressButton method.

event

If you control-click on the Hello button in your window, you’ll see this summary window with a list of all the touch events that the button responds to:

respond

We’ve connected one event, Touch Up Inside, to our custom pressButton method. The method is called after the user presses and releases the button. Most other input-type UI elements have a similar list of events.

I hope this will help you.
Thank you.

Create a Custom WordPress Sidebar in 2 Steps

Hello friends,
Today here we will learn to implement a custom sidebar into WordPress. It is very useful for any WordPress developer while he/she is using the plugins. Whenever we have to put any plugin on to the specific position on WordPress page, then we have to make a sidebar for that particular position.

There is a very simple technique to make a custom sidebar in WordPress.

1)  In the first step you will have to register your sidebar in to the function.php file as below:

 register_sidebar( array(
          'name' => __( 'Sidebar Name', 'Current activated theme name' ),
           'id' => 'sidebar-1',
           'before_widget' => '<aside id="%1$s" class="widget %2$s">',
           'after_widget' => "</aside>",
           'before_title' => '<h2 class="widget-title">',
           'after_title' => '</h2>',
) );

In this code you will have to enter your custom sidebar name and the name of the theme which is currently activated.

2) In the second step you have to just put the sidebar code in the specific file for the position where you want to put the widget (plugin).

Suppose that if I want to create a sidebar for the footer position than we have to put this code into the footer.php file as below:

          <!--?php if ( !dynamic_sidebar('sidebar-1') ) { ?-->
                    This Content is Dynamic Sidebar 1
          <!--?php } ?-->

In the above code you have to just pass your sidebar id to put that sidebar on the footer position.

Now you can see the newly created sidebar in to the WordPress admin side in the Appearance->Widget menu. Then you will have to just drag and drop any widget (plugin) to put any widget on that (here on footer) position.

I wish that this technique will help you to make a custom sidebar in WordPress. Enjoy