Monday, 23 September 2013
How to read write NTS external storage files format on MAC
Download the trial version of this application tuxera-ntfs-for-mac
And use one of the following product key to activate it
J0M1H-37VYL-YEVNK-VFVM5
visit this site to check new keys
Wednesday, 4 September 2013
android GridView inside ScrollView
Use the following class and enjoy :)
package com.alameentech.android.apps.tv_guide;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.GridView;
//public class NestedGridView extends GridView implements OnTouchListener, OnScrollListener {
public class NestedGridView extends GridView {
boolean expanded = true;
public NestedGridView(Context context) {
super(context);
}
public NestedGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NestedGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public boolean isExpanded() {
return expanded;
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// HACK! TAKE THAT ANDROID!
if (isExpanded()) {
// Calculate entire height by providing a very large height hint.
// View.MEASURED_SIZE_MASK represents the largest height possible.
int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
public void setIsExpanded(boolean expanded) {
this.expanded = expanded;
}
}
android ListView inside ScrollView
Use this class
package com.alameentech.android.apps.tv_guide;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.view.View.OnTouchListener;
import android.widget.AbsListView.OnScrollListener;;
public class NestedListView extends ListView implements OnTouchListener, OnScrollListener {
private int listViewTouchAction;
private static final int MAXIMUM_LIST_ITEMS_VIEWABLE = 99;
public NestedListView(Context context, AttributeSet attrs) {
super(context, attrs);
listViewTouchAction = -1;
setOnScrollListener(this);
setOnTouchListener(this);
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (getAdapter() != null && getAdapter().getCount() > MAXIMUM_LIST_ITEMS_VIEWABLE) {
if (listViewTouchAction == MotionEvent.ACTION_MOVE) {
scrollBy(0, -1);
}
}
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int newHeight = 0;
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode != MeasureSpec.EXACTLY) {
ListAdapter listAdapter = getAdapter();
if (listAdapter != null && !listAdapter.isEmpty()) {
int listPosition = 0;
for (listPosition = 0; listPosition < listAdapter.getCount()
&& listPosition < MAXIMUM_LIST_ITEMS_VIEWABLE; listPosition++) {
View listItem = listAdapter.getView(listPosition, null, this);
//now it will not throw a NPE if listItem is a ViewGroup instance
if (listItem instanceof ViewGroup) {
listItem.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
listItem.measure(widthMeasureSpec, heightMeasureSpec);
newHeight += listItem.getMeasuredHeight();
}
newHeight += getDividerHeight() * listPosition;
}
if ((heightMode == MeasureSpec.AT_MOST) && (newHeight > heightSize)) {
if (newHeight > heightSize) {
newHeight = heightSize;
}
}
} else {
newHeight = getMeasuredHeight();
}
setMeasuredDimension(getMeasuredWidth(), newHeight);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
if (getAdapter() != null && getAdapter().getCount() > MAXIMUM_LIST_ITEMS_VIEWABLE) {
if (listViewTouchAction == MotionEvent.ACTION_MOVE) {
scrollBy(0, 1);
}
}
return false;
}
}
<com.alameentech.android.apps.tv_guide.NestedListView
android:id="@+id/lv_channels"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="@drawable/line_sparator_0"
android:scrollbars="none"
android:dividerHeight="2dp" >
</com.alameentech.android.apps.tv_guide.NestedListView>
Monday, 2 September 2013
Shrink Database Log File
USE [MeAndCultureDB]
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [MeAndCultureDB]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ('WhoWantsToBeMillionaireQs_log' , 100)
GO
-- Reset the database recovery model.
ALTER DATABASE [MeAndCultureDB]
SET RECOVERY FULL;
GO
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [MeAndCultureDB]
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ('WhoWantsToBeMillionaireQs_log' , 100)
GO
-- Reset the database recovery model.
ALTER DATABASE [MeAndCultureDB]
SET RECOVERY FULL;
GO
Thursday, 2 May 2013
Display divs side by side in asp and css
Just change the float property to right or left for the child div and display property to inline-block for the parent div, see the example below
<div style="width: 960px; position: relative; display: inline-block;">
<div style="width: 320px; float: right; background-color:
#00FFFF;">
<br />
Mohammad
<br />
</div>
<div style="width: 320px; float: right; background-color:
#C0C0C0;">
<br />
Mohammad
<br />
</div>
<div style="width: 320px; float: right; background-color:
#008080;">
<br />
Mohammad
<br />
</div>
</div>
Wednesday, 24 April 2013
HTML Horizontal Scroll List
<div>
<ul style="width: 900px; display: block; white-space: nowrap; overflow: auto; list-style-type:
none;">
<li style="display:
inline-block;">
<asp:LinkButton runat="server"
ID="linkBtn1"
Text="Link Button
"></asp:LinkButton>
</li>
<li style="display:
inline-block;">
<asp:LinkButton runat="server"
ID="linkBtn1"
Text="Link Button
"></asp:LinkButton>
</li>
<li style="display:
inline-block;">
<asp:LinkButton runat="server"
ID="linkBtn1"
Text="Link Button
"></asp:LinkButton>
</li>
</ul>
</div>
Monday, 1 April 2013
Visual studio 2010 does not show new project option
Goto Tools> Import Export Settings> Reset all settings> No> General Development Settings
Subscribe to:
Posts (Atom)