What is the difference between getWidth/Height() and getMeasuredWidth/Height() in Android SDK?

As the name suggests the measuredWidth/height is used during measuring and layoutting phase. Let me give an example, A widget is asked to measure itself, The widget says that it wants to be 200px by 200px. This is measuredWidth/height. During the layout phase, i.e. in onLayout method. The method can use the measuredWidth/height of its … Read more

Difference between View and table in sql

A table contains data, a view is just a SELECT statement which has been saved in the database (more or less, depending on your database). The advantage of a view is that it can join data from several tables thus creating a new view of it. Say you have a database with salaries and you … Read more

Passing parameters to a view scoped bean in JSF

Using view parameters is the most proper way for your case. You don’t really need to perform a REDIRECT, but a plain GET request: <h:button value=”Go to details” outcome=”carDetails”> <f:param name=”carId” value=”#{currentCar.id}” /> </h:button> This will point you to this address: carDetails.xhtml?carId=1 After that, in your carDetails.xhtml page, grab the view param and load the … Read more

Value cannot be null. Parameter name: items (DrodownList)

Consider the case when model validation fails. View will be redisplayed again with model sent with the request. However this line: new SelectList(ViewBag.Districts, “district_id”, “district_name”, Model.Districts) will have null as a first parameter, since ViewBag.Districts was not repopulated, causing the exception. So in order to avoid exception just set this property again: // If we … Read more

adding primary key to sql view

We can add a disabled primary key constraint to a view. That is, the constraint does not fire if an insert or update is run against the view. The database expects integrity to be maintained through constraints on the underlying tables. So the constraint exists solely for the purposes of documentation. SQL> create view emp_view … Read more

Android — How to allow horizontal and vertical scrolling

Try this <?xml version=”1.0″ encoding=”utf-8″?> <ScrollView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”wrap_content”> <HorizontalScrollView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”fill_parent”> <TableLayout android:id=”@+id/amortization” android:layout_width=”wrap_content” android:layout_height=”wrap_content”> <TableRow android:background=”#ffff00″> <TextView android:text=”@string/amortization_1″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_2″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_3″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_4″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_5″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_6″ android:padding=”3dip”/> <TextView android:text=”@string/amortization_7″ android:padding=”3dip”/> </TableRow> </TableLayout> </HorizontalScrollView> </ScrollView>

Android animate drop down/up view proper

So I ended up doing it myself with some help from this answer. If it had been Android 3.0, I could have used property animation, but it’s not so I had to do that myself. Here is what I ended up with: import android.view.View; import android.view.animation.Animation; import android.view.animation.Transformation; /** * Class for handling collapse and … Read more

Conditional List itemtemplate or datatemplate in WPF

Just specifying DataTemplates in the Resources with the respective DataType is enough, e.g. <ListView ItemsSource=”{Binding Data}”> <ListView.Resources> <!– Do NOT set the x:Key –> <DataTemplate DataType=”{x:Type local:Employee}”> <TextBlock Text=”{Binding Name}” Foreground=”Blue”/> </DataTemplate> <DataTemplate DataType=”{x:Type local:Machine}”> <TextBlock Text=”{Binding Model}” Foreground=”Red”/> </DataTemplate> </ListView.Resources> </ListView> (Note that DataTemplate.DataType can also be used for implicit XML data templating (see … Read more