Monday, 30 September 2013

how do I find all Elements of a Group?

how do I find all Elements of a Group?

I am given a Group $\mathbb{Z_{11}^*}$. a multiplicative group.
How do i find all elements of this Group?

For $n$ at least 5, the index of a subgroup of $Alt(n)$ is at least $n$.

For $n$ at least 5, the index of a subgroup of $Alt(n)$ is at least $n$.

Can someone can help me get started with this problems?
Prove that $A_n$ does not have a proper subgroup of index less than $n$
for all $n \geq 5$.

ListFragment shows empty text when the list is not empty

ListFragment shows empty text when the list is not empty

I am trying to make a LoaderManager list backwards compatible to Android
2.1. The list is loading fine but the @id/android:empty message shows even
when there are items clearly visible in the list.
I have looked at a number of solutions on StackOverflow that use
setEmptyView() and setEmptyText() but couldn't get them to work.
Here is the code for the ListFragment. I have been combining code from
various http://www.vogella.com/ tutorials.
package com.example.contentprov;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.widget.SimpleCursorAdapter;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.example.contentprov.data.MyTodoContentProvider;
import com.example.contentprov.data.TodoTable;
/*
* TodosOverviewActivity displays the existing todo items
* in a list
*
* You can create new ones via the ActionBar entry "Insert"
* You can delete existing ones via a long press on the item
*/
public class TodoOverviewFragment extends ListFragment implements
LoaderManager.LoaderCallbacks<Cursor>, OnItemClickListener {
private SimpleCursorAdapter adapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setContentView(R.layout.todo_list);
fillData();
}
// Opens the second activity if an entry is clicked
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Intent i = new Intent(getActivity(), TodoDetailActivity.class);
Uri todoUri = Uri.parse(MyTodoContentProvider.CONTENT_URI + "/" +
id);
i.putExtra(MyTodoContentProvider.CONTENT_ITEM_TYPE, todoUri);
startActivity(i);
}
private void fillData() {
// Fields from the database (projection)
// Must include the _id column for the adapter to work
String[] from = new String[] { TodoTable.COLUMN_SUMMARY };
// Fields on the UI to which we map
int[] to = new int[] { R.id.label };
getActivity().getSupportLoaderManager().initLoader(0, null, this);
adapter = new SimpleCursorAdapter(getActivity(),
R.layout.todo_row, null, from,
to, 0);
setListAdapter(adapter);
}
// Creates a new loader after the initLoader () call
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = { TodoTable.COLUMN_ID,
TodoTable.COLUMN_SUMMARY };
CursorLoader cursorLoader = new CursorLoader(getActivity(),
MyTodoContentProvider.CONTENT_URI, projection, null, null,
null);
return cursorLoader;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
adapter.swapCursor(data);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
// data is not available anymore, delete reference
adapter.swapCursor(null);
}
@Override
public void onItemClick(AdapterView<?> l, View v, int position, long
id) {
Intent i = new Intent(getActivity(), TodoDetailActivity.class);
Uri todoUri = Uri.parse(MyTodoContentProvider.CONTENT_URI + "/" +
id);
i.putExtra(MyTodoContentProvider.CONTENT_ITEM_TYPE, todoUri);
startActivity(i);
}
}
Here is the XML file for the list:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
<TextView
android:id="@id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_todos" />
</LinearLayout>

How to display rows that when added together equal zero

How to display rows that when added together equal zero

Been searching for a few weeks for a solution to this but have come up blank.
I have table of data similar to this:
client_ref supplier_key client_amount
1111 GBP 10
1111 GBP -10
1111 EUR 50
2222 CHF -22.5
2222 CHF -20
3333 EUR -27
3333 EUR -52
3333 EUR 79
I need to extract all items where the client_ref and supplier_key match
and the total of the client_amount equals zero. The output would look like
this:
client_ref supplier_key client_amount
1111 GBP 10
1111 GBP -10
3333 EUR -27
3333 EUR -52
3333 EUR 79
I have written the following that returns the totals but I need any help
you could provide to change this to show the rows that make up the totals
rather than just the overall results.
SELECT tbis.client_ref ,tbis.supplier_key ,sum(tbis.client_amount)
FROM [XXXX].[dbo].[transaction] tbis
WHERE tbis.tbis.client_amount !=0
GROUP BY tbis.client_ref, tbis.supplier_key
HAVING sum(tbis.client_amount) =0
ORDER BY sum(tbis.client_amount)
Hope this makes sense and my first post is OK. Please feel free to
critique my post.

Sunday, 29 September 2013

Row numbering selection auto-fill till the end

Row numbering selection auto-fill till the end

I have a table with thousands of lines. I want to number rows by adding 1
2 3 next to first rows, then to select these and drag till end to make a
fill with increasing numbers.
How to autofill till last row without dragging with a mouse for several
minutes?

python fibonacci function that take a list of integers & returns True return false otherwise

python fibonacci function that take a list of integers & returns True
return false otherwise

how to write a python function that takes a list of integers and returns
True if they are consecutive numbers within the Fibonacci sequence. False
is returned otherwise

php print pdf using php_printer.dll on windows serverside

php print pdf using php_printer.dll on windows serverside

my job is to print pdf-files serverside on a windows-machine with xampp
installed. Now I´ve installed php_printer.dll and copied/written a
test-script from here:
$printer = "\\\\SERVER\\PRINTER";
$file = "test.pdf";
if ($ph = printer_open($printer)) {
// Get file contents
$fh = fopen($file, "rb");
$content = fread($fh, filesize($file));
fclose($fh);
printer_start_doc($ph, "TESTPAGE");
printer_start_page($ph);
// Set print mode to RAW and send PDF to printer
printer_set_option($ph, PRINTER_MODE, "RAW");
printer_write($ph, $content);
printer_close($ph);
echo "-> Job was sent to ".$printer;
} else {
echo "-> Couldn't connect... ".$printer;
}
But it does not work with pdf-files; text-only is okay. If I print
pdf-files, there are only incorrect chars on the paper :( What can I do to
print serverside pdf´s in php? Any tips?
Regards, rumble