text:
package android.app;

import android.app.DownloadManager.Query;
import android.app.DownloadManager.Request;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor.AutoCloseInputStream;
import android.os.SystemClock;
import android.provider.Settings;
import android.test.InstrumentationTestCase;
import android.util.Log;

import com.google.mockwebserver.MockResponse;
import com.google.mockwebserver.MockWebServer;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.TimeoutException;

import libcore.io.Streams;

/**
 * Base class for Instrumented tests for the Download Manager.
 */
public class DownloadManagerBaseTest extends InstrumentationTestCase {
    private static final String TAG = "DownloadManagerBaseTest";
    protected DownloadManager mDownloadManager = null;
    private MockWebServer mServer = null;
    protected String mFileType = "text/plain";
    protected Context mContext = null;
    protected MultipleDownloadsCompletedReceiver mReceiver = null;
    protected static final int DEFAULT_FILE_SIZE = 10 * 1024;  // 10kb
    protected static final int FILE_BLOCK_READ_SIZE = 1024 * 1024;

    protected static final String LOG_TAG = "android.net.DownloadManagerBaseTest";
    protected static final int HTTP_OK = 200;
    protected static final int HTTP_REDIRECT = 307;
    protected static final int HTTP_PARTIAL_CONTENT = 206;
    protected static final int HTTP_NOT_FOUND = 404;
    protected static final int HTTP_SERVICE_UNAVAILABLE = 503;
    protected String DEFAULT_FILENAME = "somefile.txt";

    protected static final int DEFAULT_MAX_WAIT_TIME = 2 * 60 * 1000;  // 2 minutes
    protected static final int DEFAULT_WAIT_POLL_TIME = 5 * 1000;  // 5 seconds

    protected static final int WAIT_FOR_DOWNLOAD_POLL_TIME = 1 * 1000;  // 1 second
    protected static final int MAX_WAIT_FOR_DOWNLOAD_TIME = 5 * 60 * 1000; // 5 minutes
    protected static final int MAX_WAIT_FOR_LARGE_DOWNLOAD_TIME = 15 * 60 * 1000; // 15 minutes

    protected static final int DOWNLOAD_TO_SYSTEM_CACHE = 1;
    protected static final int DOWNLOAD_TO_DOWNLOAD_CACHE_DIR = 2;

    // Just a few popular file types used to return from a download
    protected enum DownloadFileType {
        PLAINTEXT,
        APK,
        GIF,
        GARBAGE,
        UNRECOGNIZED,
        ZIP
    }

    protected enum DataType {
        TEXT,
        BINARY
    }

    public static class LoggingRng extends Random {

        /**
         * Constructor
         *
         * Creates RNG with self-generated seed value.
         */
        public LoggingRng() {
            this(SystemClock.uptimeMillis());
        }

        /**
         * Constructor
         *
         * Creats RNG with given initial seed value

         * @param seed The initial seed value
         */
        public LoggingRng(long seed) {
            super(seed);
            Log.i(LOG_TAG, "Seeding RNG with value: " + seed);
        }
    }

    public static class MultipleDownloadsCompletedReceiver extends BroadcastReceiver {
        private volatile int mNumDownloadsCompleted = 0;
        private Set<Long> downloadIds = Collections.synchronizedSet(new HashSet<Long>());

        /**
         * {@inheritDoc}
         */
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equalsIgnoreCase(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
                synchronized(this) {
                    long id = intent.getExtras().getLong(DownloadManager.EXTRA_DOWNLOAD_ID);
                    Log.i(LOG_TAG, "Received Notification for download: " + id);
                    if (!downloadIds.contains(id)) {
                        ++mNumDownloadsCompleted;
                        Log.i(LOG_TAG, "MultipleDownloadsCompletedReceiver got intent: " +
                                intent.getAction() + " --> total count: " + mNumDownloadsCompleted);
                        downloadIds.add(id);

                        DownloadManager dm = (DownloadManager)context.getSystemService(
                                Context.DOWNLOAD_SERVICE);

                        Cursor cursor = dm.query(new Query().setFilterById(id));
                        try {
                            if (cursor.moveToFirst()) {
                                int status = cursor.getInt(cursor.getColumnIndex(
                                        DownloadManager.COLUMN_STATUS));
                                Log.i(LOG_TAG, "Download status is: " + status);
                            } else {
                                fail("No status found for completed download!");
                            }
                        } finally {
                            cursor.close();
                        }
                    } else {
                        Log.i(LOG_TAG, "Notification for id: " + id + " has already been made.");
                    }
                }
            }
        }

        /**
         * Gets the number of times the {@link #onReceive} callback has been called for the
         * {@link DownloadManager.ACTION_DOWNLOAD_COMPLETED} action, indicating the number of
         * downloads completed thus far.
         *
         * @return the number of downloads completed so far.
         */
        public int numDownloadsCompleted() {
            return mNumDownloadsCompleted;
        }

        /**
         * Gets the list of download IDs.
         * @return A Set<Long> with the ids of the completed downloads.
         */
        public Set<Long> getDownloadIds() {
            synchronized(this) {
                Set<Long> returnIds = new HashSet<Long>(downloadIds);
                return returnIds;
            }
        }

    }

    public static class WiFiChangedReceiver extends BroadcastReceiver {
        private Context mContext = null;

        /**
         * Constructor
         *
         * Sets the current state of WiFi.
         *
         * @param context The current app {@link Context}.
         */
        public WiFiChangedReceiver(Context context) {
            mContext = context;
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equalsIgnoreCase(ConnectivityManager.CONNECTIVITY_ACTION)) {
                Log.i(LOG_TAG, "ConnectivityManager state change: " + intent.getAction());
                synchronized (this) {
                    this.notify();
                }
            }
        }

        /**
         * Gets the current state of WiFi.
         *
         * @return Returns true if WiFi is on, false otherwise.
         */
        public boolean getWiFiIsOn() {
            ConnectivityManager connManager = (ConnectivityManager)mContext.getSystemService(
                    Context.CONNECTIVITY_SERVICE);
            NetworkInfo info = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
            Log.i(LOG_TAG, "WiFi Connection state is currently: " + info.isConnected());
            return info.isConnected();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUp() throws Exception {
        mContext = getInstrumentation().getContext();
        mDownloadManager = (DownloadManager)mContext.getSystemService(Context.DOWNLOAD_SERVICE);
        mServer = new MockWebServer();
        mServer.play();
        mReceiver = registerNewMultipleDownloadsReceiver();
        // Note: callers overriding this should call mServer.play() with the desired port #
    }

    /**
     * Helper to build a response from the MockWebServer with no body.
     *
     * @param status The HTTP status code to return for this response
     * @return Returns the mock web server response that was queued (which can be modified)
     */
    protected MockResponse buildResponse(int status) {
        MockResponse response = new MockResponse().setResponseCode(status);
        response.setHeader("Content-type", mFileType);
        return response;
    }

    /**
     * Helper to build a response from the MockWebServer.
     *
     * @param status The HTTP status code to return for this response
     * @param body The body to return in this response
     * @return Returns the mock web server response that was queued (which can be modified)
     */
    protected MockResponse buildResponse(int status, byte[] body) {
        return buildResponse(status).setBody(body);
    }

    /**
     * Helper to build a response from the MockWebServer.
     *
     * @param status The HTTP status code to return for this response
     * @param bodyFile The body to return in this response
     * @return Returns the mock web server response that was queued (which can be modified)
     */
    protected MockResponse buildResponse(int status, File bodyFile)
            throws FileNotFoundException, IOException {
        final byte[] body = Streams.readFully(new FileInputStream(bodyFile));
        return buildResponse(status).setBody(body);
    }

    protected void enqueueResponse(MockResponse resp) {
        mServer.enqueue(resp);
    }

    /**
     * Helper to generate a random blob of bytes.
     *
     * @param size The size of the data to generate
     * @param type The type of data to generate: currently, one of {@link DataType#TEXT} or
     *         {@link DataType#BINARY}.
     * @return The random data that is generated.
     */
    protected byte[] generateData(int size, DataType type) {
        return generateData(size, type, null);
    }

    /**
     * Helper to generate a random blob of bytes using a given RNG.
     *
     * @param size The size of the data to generate
     * @param type The type of data to generate: currently, one of {@link DataType#TEXT} or
     *         {@link DataType#BINARY}.
     * @param rng (optional) The RNG to use; pass null to use
     * @return The random data that is generated.
     */
    protected byte[] generateData(int size, DataType type, Random rng) {
        int min = Byte.MIN_VALUE;
        int max = Byte.MAX_VALUE;

        // Only use chars in the HTTP ASCII printable character range for Text
        if (type == DataType.TEXT) {
            min = 32;
            max = 126;
        }
        byte[] result = new byte[size];
        Log.i(LOG_TAG, "Generating data of size: " + size);

        if (rng == null) {
            rng = new LoggingRng();
        }

        for (int i = 0; i < size; ++i) {
            result[i] = (byte) (min + rng.nextInt(max - min + 1));
        }
        return result;
    }

    /**
     * Helper to verify the size of a file.
     *
     * @param pfd The input file to compare the size of
     * @param size The expected size of the file
     */
    protected void verifyFileSize(ParcelFileDescriptor pfd, long size) {
        assertEquals(pfd.getStatSize(), size);
    }

    /**
     * Helper to verify the contents of a downloaded file versus a byte[].
     *
     * @param actual The file of whose contents to verify
     * @param expected The data we expect to find in the aforementioned file
     * @throws IOException if there was a problem reading from the file
     */
    protected void verifyFileContents(ParcelFileDescriptor actual, byte[] expected)
            throws IOException {
        AutoCloseInputStream input = new ParcelFileDescriptor.AutoCloseInputStream(actual);
        long fileSize = actual.getStatSize();

        assertTrue(fileSize <= Integer.MAX_VALUE);
        assertEquals(expected.length, fileSize);

        byte[] actualData = new byte[expected.length];
        assertEquals(input.read(actualData), fileSize);
        compareByteArrays(actualData, expected);
    }

    /**
     * Helper to compare 2 byte arrays.
     *
     * @param actual The array whose data we want to verify
     * @param expected The array of data we expect to see
     */
    protected void compareByteArrays(byte[] actual, byte[] expected) {
        assertEquals(actual.length, expected.length);
        int length = actual.length;
        for (int i = 0; i < length; ++i) {
            // assert has a bit of overhead, so only do the assert when the values are not the same
            if (actual[i] != expected[i]) {
                fail("Byte arrays are not equal.");
            }
        }
    }

    /**
     * Verifies the contents of a downloaded file versus the contents of a File.
     *
     * @param pfd The file whose data we want to verify
     * @param file The file containing the data we expect to see in the aforementioned file
     * @throws IOException If there was a problem reading either of the two files
     */
    protected void verifyFileContents(ParcelFileDescriptor pfd, File file) throws IOException {
        byte[] actual = new byte[FILE_BLOCK_READ_SIZE];
        byte[] expected = new byte[FILE_BLOCK_READ_SIZE];

        AutoCloseInputStream input = new ParcelFileDescriptor.AutoCloseInputStream(pfd);

        assertEquals(file.length(), pfd.getStatSize());

        DataInputStream inFile = new DataInputStream(new FileInputStream(file));
        int actualRead = 0;
        int expectedRead = 0;

        while (((actualRead = input.read(actual)) != -1) &&
                ((expectedRead = inFile.read(expected)) != -1)) {
            assertEquals(actualRead, expectedRead);
            compareByteArrays(actual, expected);
        }
    }

    /**
     * Sets the MIME type of file that will be served from the mock server
     *
     * @param type The MIME type to return from the server
     */
    protected void setServerMimeType(DownloadFileType type) {
        mFileType = getMimeMapping(type);
    }

    /**
     * Gets the MIME content string for a given type
     *
     * @param type The MIME type to return
     * @return the String representation of that MIME content type
     */
    protected String getMimeMapping(DownloadFileType type) {
        switch (type) {
            case APK:
                return "application/vnd.android.package-archive";
            case GIF:
                return "image/gif";
            case ZIP:
                return "application/x-zip-compressed";
            case GARBAGE:
                return "zip\\pidy/doo/da";
            case UNRECOGNIZED:
                return "application/new.undefined.type.of.app";
        }
        return "text/plain";
    }

    /**
     * Gets the Uri that should be used to access the mock server
     *
     * @param filename The name of the file to try to retrieve from the mock server
     * @return the Uri to use for access the file on the mock server
     */
    protected Uri getServerUri(String filename) throws Exception {
        URL url = mServer.getUrl("/" + filename);
        return Uri.parse(url.toString());
    }

   /**
    * Gets the Uri that should be used to access the mock server
    *
    * @param filename The name of the file to try to retrieve from the mock server
    * @return the Uri to use for access the file on the mock server
    */
    protected void logDBColumnData(Cursor cursor, String column) {
        int index = cursor.getColumnIndex(column);
        Log.i(LOG_TAG, "columnName: " + column);
        Log.i(LOG_TAG, "columnValue: " + cursor.getString(index));
    }

    /**
     * Helper to create and register a new MultipleDownloadCompletedReciever
     *
     * This is used to track many simultaneous downloads by keeping count of all the downloads
     * that have completed.
     *
     * @return A new receiver that records and can be queried on how many downloads have completed.
     */
    protected MultipleDownloadsCompletedReceiver registerNewMultipleDownloadsReceiver() {
        MultipleDownloadsCompletedReceiver receiver = new MultipleDownloadsCompletedReceiver();
        mContext.registerReceiver(receiver, new IntentFilter(
                DownloadManager.ACTION_DOWNLOAD_COMPLETE));
        return receiver;
    }

    /**
     * Helper to verify a standard single-file download from the mock server, and clean up after
     * verification
     *
     * Note that this also calls the Download manager's remove, which cleans up the file from cache.
     *
     * @param requestId The id of the download to remove
     * @param fileData The data to verify the file contains
     */
    protected void verifyAndCleanupSingleFileDownload(long requestId, byte[] fileData)
            throws Exception {
        int fileSize = fileData.length;
        ParcelFileDescriptor pfd = mDownloadManager.openDownloadedFile(requestId);
        Cursor cursor = mDownloadManager.query(new Query().setFilterById(requestId));

        try {
            assertEquals(1, cursor.getCount());
            assertTrue(cursor.moveToFirst());

            verifyFileSize(pfd, fileSize);
            verifyFileContents(pfd, fileData);
        } finally {
            pfd.close();
            cursor.close();
            mDownloadManager.remove(requestId);
        }
    }

    /**
     * Enables or disables WiFi.
     *
     * Note: Needs the following permissions:
     *  android.permission.ACCESS_WIFI_STATE
     *  android.permission.CHANGE_WIFI_STATE
     * @param enable true if it should be enabled, false if it should be disabled
     */
    protected void setWiFiStateOn(boolean enable) throws Exception {
        Log.i(LOG_TAG, "Setting WiFi State to: " + enable);
        WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);

        manager.setWifiEnabled(enable);

        String timeoutMessage = "Timed out waiting for Wifi to be "
            + (enable ? "enabled!" : "disabled!");

        WiFiChangedReceiver receiver = new WiFiChangedReceiver(mContext);
        mContext.registerReceiver(receiver, new IntentFilter(
                ConnectivityManager.CONNECTIVITY_ACTION));

        synchronized (receiver) {
            long timeoutTime = SystemClock.elapsedRealtime() + DEFAULT_MAX_WAIT_TIME;
            boolean timedOut = false;

            while (receiver.getWiFiIsOn() != enable && !timedOut) {
                try {
                    receiver.wait(DEFAULT_WAIT_POLL_TIME);

                    if (SystemClock.elapsedRealtime() > timeoutTime) {
                        timedOut = true;
                    }
                }
                catch (InterruptedException e) {
                    // ignore InterruptedExceptions
                }
            }
            if (timedOut) {
                fail(timeoutMessage);
            }
        }
        assertEquals(enable, receiver.getWiFiIsOn());
    }

    /**
     * Helper to enables or disables airplane mode. If successful, it also broadcasts an intent
     * indicating that the mode has changed.
     *
     * Note: Needs the following permission:
     *  android.permission.WRITE_SETTINGS
     * @param enable true if airplane mode should be ON, false if it should be OFF
     */
    protected void setAirplaneModeOn(boolean enable) throws Exception {
        int state = enable ? 1 : 0;

        // Change the system setting
        Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON,
                state);

        String timeoutMessage = "Timed out waiting for airplane mode to be " +
                (enable ? "enabled!" : "disabled!");

        // wait for airplane mode to change state
        int currentWaitTime = 0;
        while (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON, -1) != state) {
            timeoutWait(currentWaitTime, DEFAULT_WAIT_POLL_TIME, DEFAULT_MAX_WAIT_TIME,
                    timeoutMessage);
        }

        // Post the intent
        Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        intent.putExtra("state", true);
        mContext.sendBroadcast(intent);
    }

    /**
     * Helper to create a large file of random data on the SD card.
     *
     * @param filename (optional) The name of the file to create on the SD card; pass in null to
     *          use a default temp filename.
     * @param type The type of file to create
     * @param subdirectory If not null, the subdirectory under the SD card where the file should go
     * @return The File that was created
     * @throws IOException if there was an error while creating the file.
     */
    protected File createFileOnSD(String filename, long fileSize, DataType type,
            String subdirectory) throws IOException {

        // Build up the file path and name
        String sdPath = Environment.getExternalStorageDirectory().getPath();
        StringBuilder fullPath = new StringBuilder(sdPath);
        if (subdirectory != null) {
            fullPath.append(File.separatorChar).append(subdirectory);
        }

        File file = null;
        if (filename == null) {
            file = File.createTempFile("DMTEST_", null, new File(fullPath.toString()));
        }
        else {
            fullPath.append(File.separatorChar).append(filename);
            file = new File(fullPath.toString());
            file.createNewFile();
        }

        // Fill the file with random data
        DataOutputStream output = new DataOutputStream(new FileOutputStream(file));
        final int CHUNK_SIZE = 1000000;  // copy random data in 1000000-char chunks
        long remaining = fileSize;
        int nextChunkSize = CHUNK_SIZE;
        byte[] randomData = null;
        Random rng = new LoggingRng();
        byte[] chunkSizeData = generateData(nextChunkSize, type, rng);

        try {
            while (remaining > 0) {
                if (remaining < CHUNK_SIZE) {
                    nextChunkSize = (int)remaining;
                    remaining = 0;
                    randomData = generateData(nextChunkSize, type, rng);
                }
                else {
                    remaining -= CHUNK_SIZE;
                    randomData = chunkSizeData;
                }
                output.write(randomData);
                Log.i(TAG, "while creating " + fileSize + " file, " +
                        "remaining bytes to be written: " + remaining);
            }
        } catch (IOException e) {
            Log.e(LOG_TAG, "Error writing to file " + file.getAbsolutePath());
            file.delete();
            throw e;
        } finally {
            output.close();
        }
        return file;
    }

    /**
     * Helper to wait for a particular download to finish, or else a timeout to occur
     *
     * Does not wait for a receiver notification of the download.
     *
     * @param id The download id to query on (wait for)
     */
    protected void waitForDownloadOrTimeout_skipNotification(long id) throws TimeoutException,
            InterruptedException {
        waitForDownloadOrTimeout(id, WAIT_FOR_DOWNLOAD_POLL_TIME, MAX_WAIT_FOR_DOWNLOAD_TIME);
    }

    /**
     * Helper to wait for a particular download to finish, or else a timeout to occur
     *
     * Also guarantees a notification has been posted for the download.
     *
     * @param id The download id to query on (wait for)
     */
    protected void waitForDownloadOrTimeout(long id) throws TimeoutException,
            InterruptedException {
        waitForDownloadOrTimeout_skipNotification(id);
        waitForReceiverNotifications(1);
    }

    /**
     * Helper to wait for a particular download to finish, or else a timeout to occur
     *
     * Also guarantees a notification has been posted for the download.
     *
     * @param id The download id to query on (wait for)
     * @param poll The amount of time to wait
     * @param timeoutMillis The max time (in ms) to wait for the download(s) to complete
     */
    protected void waitForDownloadOrTimeout(long id, long poll, long timeoutMillis)
            throws TimeoutException, InterruptedException {
        doWaitForDownloadsOrTimeout(new Query().setFilterById(id), poll, timeoutMillis);
        waitForReceiverNotifications(1);
    }

    /**
     * Helper to wait for all downloads to finish, or else a specified timeout to occur
     *
     * Makes no guaranee that notifications have been posted for all downloads.
     *
     * @param poll The amount of time to wait
     * @param timeoutMillis The max time (in ms) to wait for the download(s) to complete
     */
    protected void waitForDownloadsOrTimeout(long poll, long timeoutMillis) throws TimeoutException,
            InterruptedException {
        doWaitForDownloadsOrTimeout(new Query(), poll, timeoutMillis);
    }

    /**
     * Helper to wait for all downloads to finish, or else a timeout to occur, but does not throw
     *
     * Also guarantees a notification has been posted for the download.
     *
     * @param id The id of the download to query against
     * @param poll The amount of time to wait
     * @param timeoutMillis The max time (in ms) to wait for the download(s) to complete
     * @return true if download completed successfully (didn't timeout), false otherwise
     */
    protected boolean waitForDownloadOrTimeoutNoThrow(long id, long poll, long timeoutMillis) {
        try {
            doWaitForDownloadsOrTimeout(new Query().setFilterById(id), poll, timeoutMillis);
            waitForReceiverNotifications(1);
        } catch (TimeoutException e) {
            return false;
        }
        return true;
    }

    /**
     * Helper function to synchronously wait, or timeout if the maximum threshold has been exceeded.
     *
     * @param currentTotalWaitTime The total time waited so far
     * @param poll The amount of time to wait
     * @param maxTimeoutMillis The total wait time threshold; if we've waited more than this long,
     *          we timeout and fail
     * @param timedOutMessage The message to display in the failure message if we timeout
     * @return The new total amount of time we've waited so far
     * @throws TimeoutException if timed out waiting for SD card to mount
     */
    protected int timeoutWait(int currentTotalWaitTime, long poll, long maxTimeoutMillis,
            String timedOutMessage) throws TimeoutException {
        long now = SystemClock.elapsedRealtime();
        long end = now + poll;

        // if we get InterruptedException's, ignore them and just keep sleeping
        while (now < end) {
            try {
                Thread.sleep(end - now);
            } catch (InterruptedException e) {
                // ignore interrupted exceptions
            }
            now = SystemClock.elapsedRealtime();
        }

        currentTotalWaitTime += poll;
        if (currentTotalWaitTime > maxTimeoutMillis) {
            throw new TimeoutException(timedOutMessage);
        }
        return currentTotalWaitTime;
    }

    /**
     * Helper to wait for all downloads to finish, or else a timeout to occur
     *
     * @param query The query to pass to the download manager
     * @param poll The poll time to wait between checks
     * @param timeoutMillis The max amount of time (in ms) to wait for the download(s) to complete
     */
    protected void doWaitForDownloadsOrTimeout(Query query, long poll, long timeoutMillis)
            throws TimeoutException {
        int currentWaitTime = 0;
        while (true) {
            query.setFilterByStatus(DownloadManager.STATUS_PENDING | DownloadManager.STATUS_PAUSED
                    | DownloadManager.STATUS_RUNNING);
            Cursor cursor = mDownloadManager.query(query);

            try {
                if (cursor.getCount() == 0) {
                    Log.i(LOG_TAG, "All downloads should be done...");
                    break;
                }
                currentWaitTime = timeoutWait(currentWaitTime, poll, timeoutMillis,
                        "Timed out waiting for all downloads to finish");
            } finally {
                cursor.close();
            }
        }
    }

    /**
     * Synchronously waits for external store to be mounted (eg: SD Card).
     *
     * @throws InterruptedException if interrupted
     * @throws Exception if timed out waiting for SD card to mount
     */
    protected void waitForExternalStoreMount() throws Exception {
        String extStorageState = Environment.getExternalStorageState();
        int currentWaitTime = 0;
        while (!extStorageState.equals(Environment.MEDIA_MOUNTED)) {
            Log.i(LOG_TAG, "Waiting for SD card...");
            currentWaitTime = timeoutWait(currentWaitTime, DEFAULT_WAIT_POLL_TIME,
                    DEFAULT_MAX_WAIT_TIME, "Timed out waiting for SD Card to be ready!");
            extStorageState = Environment.getExternalStorageState();
        }
    }

    /**
     * Synchronously waits for a download to start.
     *
     * @param dlRequest the download request id used by Download Manager to track the download.
     * @throws Exception if timed out while waiting for SD card to mount
     */
    protected void waitForDownloadToStart(long dlRequest) throws Exception {
        Cursor cursor = getCursor(dlRequest);
        try {
            int columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);
            int value = cursor.getInt(columnIndex);
            int currentWaitTime = 0;

            while (value != DownloadManager.STATUS_RUNNING &&
                    (value != DownloadManager.STATUS_FAILED) &&
                    (value != DownloadManager.STATUS_SUCCESSFUL)) {
                Log.i(LOG_TAG, "Waiting for download to start...");
                currentWaitTime = timeoutWait(currentWaitTime, WAIT_FOR_DOWNLOAD_POLL_TIME,
                        MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for download to start!");
                cursor.requery();
                assertTrue(cursor.moveToFirst());
                columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);
                value = cursor.getInt(columnIndex);
            }
            assertFalse("Download failed immediately after start",
                    value == DownloadManager.STATUS_FAILED);
        } finally {
            cursor.close();
        }
    }

    /**
     * Convenience function to wait for just 1 notification of a download.
     *
     * @throws Exception if timed out while waiting
     */
    protected void waitForReceiverNotification() throws Exception {
        waitForReceiverNotifications(1);
    }

    /**
     * Synchronously waits for our receiver to receive notification for a given number of
     * downloads.
     *
     * @param targetNumber The number of notifications for unique downloads to wait for; pass in
     *         -1 to not wait for notification.
     * @throws Exception if timed out while waiting
     */
    protected void waitForReceiverNotifications(int targetNumber) throws TimeoutException {
        int count = mReceiver.numDownloadsCompleted();
        int currentWaitTime = 0;

        while (count < targetNumber) {
            Log.i(LOG_TAG, "Waiting for notification of downloads...");
            currentWaitTime = timeoutWait(currentWaitTime, WAIT_FOR_DOWNLOAD_POLL_TIME,
                    MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for download notifications!"
                    + " Received " + count + "notifications.");
            count = mReceiver.numDownloadsCompleted();
        }
    }

    /**
     * Synchronously waits for a file to increase in size (such as to monitor that a download is
     * progressing).
     *
     * @param file The file whose size to track.
     * @throws Exception if timed out while waiting for the file to grow in size.
     */
    protected void waitForFileToGrow(File file) throws Exception {
        int currentWaitTime = 0;

        // File may not even exist yet, so wait until it does (or we timeout)
        while (!file.exists()) {
            Log.i(LOG_TAG, "Waiting for file to exist...");
            currentWaitTime = timeoutWait(currentWaitTime, WAIT_FOR_DOWNLOAD_POLL_TIME,
                    MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for file to be created.");
        }

        // Get original file size...
        long originalSize = file.length();

        while (file.length() <= originalSize) {
            Log.i(LOG_TAG, "Waiting for file to be written to...");
            currentWaitTime = timeoutWait(currentWaitTime, WAIT_FOR_DOWNLOAD_POLL_TIME,
                    MAX_WAIT_FOR_DOWNLOAD_TIME, "Timed out waiting for file to be written to.");
        }
    }

    /**
     * Helper to remove all downloads that are registered with the DL Manager.
     *
     * Note: This gives us a clean slate b/c it includes downloads that are pending, running,
     * paused, or have completed.
     */
    protected void removeAllCurrentDownloads() {
        Log.i(LOG_TAG, "Removing all current registered downloads...");
        ArrayList<Long> ids = new ArrayList<Long>();
        Cursor cursor = mDownloadManager.query(new Query());
        try {
            if (cursor.moveToFirst()) {
                do {
                    int index = cursor.getColumnIndex(DownloadManager.COLUMN_ID);
                    long downloadId = cursor.getLong(index);
                    ids.add(downloadId);
                } while (cursor.moveToNext());
            }
        } finally {
            cursor.close();
        }
        // delete all ids
        for (long id : ids) {
            mDownloadManager.remove(id);
        }
        // make sure the database is empty
        cursor = mDownloadManager.query(new Query());
        try {
            assertEquals(0, cursor.getCount());
        } finally {
            cursor.close();
        }
    }

    /**
     * Helper to perform a standard enqueue of data to the mock server.
     * download is performed to the downloads cache dir (NOT systemcache dir)
     *
     * @param body The body to return in the response from the server
     */
    protected long doStandardEnqueue(byte[] body) throws Exception {
        return enqueueDownloadRequest(body, DOWNLOAD_TO_DOWNLOAD_CACHE_DIR);
    }

    protected long enqueueDownloadRequest(byte[] body, int location) throws Exception {
        // Prepare the mock server with a standard response
        mServer.enqueue(buildResponse(HTTP_OK, body));
        return doEnqueue(location);
    }

    /**
     * Helper to perform a standard enqueue of data to the mock server.
     *
     * @param body The body to return in the response from the server, contained in the file
     */
    protected long doStandardEnqueue(File body) throws Exception {
        return enqueueDownloadRequest(body, DOWNLOAD_TO_DOWNLOAD_CACHE_DIR);
    }

    protected long enqueueDownloadRequest(File body, int location) throws Exception {
        // Prepare the mock server with a standard response
        mServer.enqueue(buildResponse(HTTP_OK, body));
        return doEnqueue(location);
    }

    /**
     * Helper to do the additional steps (setting title and Uri of default filename) when
     * doing a standard enqueue request to the server.
     */
    protected long doCommonStandardEnqueue() throws Exception {
        return doEnqueue(DOWNLOAD_TO_DOWNLOAD_CACHE_DIR);
    }

    private long doEnqueue(int location) throws Exception {
        Uri uri = getServerUri(DEFAULT_FILENAME);
        Request request = new Request(uri).setTitle(DEFAULT_FILENAME);
        if (location == DOWNLOAD_TO_SYSTEM_CACHE) {
            request.setDestinationToSystemCache();
        }

        return mDownloadManager.enqueue(request);
    }

    /**
     * Helper to verify an int value in a Cursor
     *
     * @param cursor The cursor containing the query results
     * @param columnName The name of the column to query
     * @param expected The expected int value
     */
    protected void verifyInt(Cursor cursor, String columnName, int expected) {
        int index = cursor.getColumnIndex(columnName);
        int actual = cursor.getInt(index);
        assertEquals(expected, actual);
    }

    /**
     * Helper to verify a String value in a Cursor
     *
     * @param cursor The cursor containing the query results
     * @param columnName The name of the column to query
     * @param expected The expected String value
     */
    protected void verifyString(Cursor cursor, String columnName, String expected) {
        int index = cursor.getColumnIndex(columnName);
        String actual = cursor.getString(index);
        Log.i(LOG_TAG, ": " + actual);
        assertEquals(expected, actual);
    }

    /**
     * Performs a query based on ID and returns a Cursor for the query.
     *
     * @param id The id of the download in DL Manager; pass -1 to query all downloads
     * @return A cursor for the query results
     */
    protected Cursor getCursor(long id) throws Exception {
        Query query = new Query();
        if (id != -1) {
            query.setFilterById(id);
        }

        Cursor cursor = mDownloadManager.query(query);
        int currentWaitTime = 0;

        try {
            while (!cursor.moveToFirst()) {
                Thread.sleep(DEFAULT_WAIT_POLL_TIME);
                currentWaitTime += DEFAULT_WAIT_POLL_TIME;
                if (currentWaitTime > DEFAULT_MAX_WAIT_TIME) {
                    fail("timed out waiting for a non-null query result");
                }
                cursor.requery();
            }
        } catch (Exception e) {
            cursor.close();
            throw e;
        }
        return cursor;
    }

    /**
     * Helper that does the actual basic download verification.
     */
    protected long doBasicDownload(byte[] blobData, int location) throws Exception {
        long dlRequest = enqueueDownloadRequest(blobData, location);

        // wait for the download to complete
        waitForDownloadOrTimeout(dlRequest);

        assertEquals(1, mReceiver.numDownloadsCompleted());
        return dlRequest;
    }
}


Ms. Miller, a psychology student at Rutgers, was feeling greatly nostalgic for those rinky-dink days as she waited for her boyfriend's arrival on a Continental Airlines flight from Jacksonville, Fla. She was slumped like a sack of laundry on a window ledge in Terminal C, braced against the New Year's Eve crowds. Travelers were slumped similarly all around her, overpacked and unfit to bear their loads. The lines at the Continental ticket counters were thick and messy, people were whining to beleaguered baggage handlers and two babies were screaming as if the world were coming to an end.
It wasn't so long ago. Newark used to be the sleeper airport, the one where you could get in, get out and take off without feeling as though reaching the plane was a trip in itself. A pre-ticketed traveler from, say, Hoboken, could leave the house an hour before the flight, get to the airport in a half hour, tops, and sashay to the gate for boarding with time left to buy a Snapple.
Then came the terrific economy, Continental's tremendous expansion and a wide-bodied monorail that makes going from Point A to Point B feel like a ride in the World's Fair. Now, Newark airport is no longer a local secret, the one thing New Jersey travelers could lord over New Yorkers. Now, the same traveler from Hoboken has to do what New Yorkers have had to do for years -- leave a couple of hours before the flight just in case there's traffic, which there usually is, and in time to secure the seat in case the airline overbooks the flight, which it often does.
How huge is it? Port Authority officials project that the airport, the fastest-growing airport in the region, will set a record for its number of passengers in 1997, with 30.8 million. That's up from 29.1 million in 1996, 26.6 million in 1995. The day after Christmas, for the first time ever, all the airport's parking lots, from the hourly to the daily to the remote long-term lots that require a bus ride to the terminals, were full. That's over 15,000 parking spaces, all taken. The scurry for spaces backed up traffic around the airport for hours.
''We attribute that, at least in part, to the coinciding of Christmas and Hanukkah,'' said Bill Cahill, an authority spokesman.
Port Authority officials, perhaps anxious to appease Mayor Rudolph W. Giuliani of New York, who has complained that the agency has favored Newark over New York, took pains to point out that Newark's growth has not come at the expense of Kennedy and La Guardia airports.
ALL three airports are experiencing a healthy growth,'' said Robert Kelly, the Port Authority's director of aviation. He said Kennedy International Airport was also expected to set a record for passengers in 1997, with 31.3 million, making Kennedy and Newark about neck and neck. ''We've got a great economy and it's making it great for air travel,'' he said.
The Port Authority, he added, is hoping that the Federal Aviation Administration will announce its approval in the next few weeks for an elaborate plan to ease congestion at Kennedy airport that should prove as attractive as the monorail at Newark (which is also being expanded).
Mr. Kelly said that Newark's passengers come from New Jersey while New Yorkers still go to Kennedy and La Guardia. But anecdotal evidence suggests otherwise.
Scores of yellow cabs with New York plates drop off passengers at Newark airport every day. There were dozens of the cabs at Terminal C alone yesterday, suggesting that at least some of the New Yorkers who have been complaining about all the tourists in Times Square are making their late holiday escape over the Hudson.
Sandrine Betances and Kevin Mitchell, plopping out of a yellow cab with two carry-on bags for a New Year's Eve trip to Boston, were two of them. Yes, they said, they had abandoned Kennedy about a year ago.
''We live on the Upper West Side, so it's actually faster to take a cab across the bridge than it is to take it across town to go to Kennedy,'' Ms. Betances said.


The place is both a gallery for folk art and a funky cafe that specializes in New Mexican cooking (there are subtle differences between this cuisine and Tex-Mex, or California Mex, or Mex Mex). Flo gets its peppers directly from a farmer in New Mexico, so the taste is as genuine as anything in Santa Fe.
Adam recommended Flo and says it's the best breakfast place around.
Colleen was in awe of the creative menu and will definitely be returning.
Greg was impressed with the selection of food and says they do an excellent job.


The East Brook is a small stream that runs southeast to northwest within the Morris Arboretum where it then feeds into the Wissahickon Creek. This stream is used by Arboretum staff to educate the public through interpretative signage and it provides many views valuable to the Arboretum. A portion of the East Brook, specifically the northwestern portion from the log cabin bridge to where it meets the Wissahickon Creek was focused on because there was a more immediate need for stabilization improvements as there are large eroded sections of the stream bank due to the absence of an adequate wall, stone, or natural plant root protection. Climate models have predicted an increase in precipitation for the Mid-Atlantic region that will increase stream bank degradation. Six spots along the stream were identified that could benefit from some type of erosion control. Additionally, areas along the stream are improved by continual removal of invasive species and weeds. A few native plantings will be added to be barriers for the stream, add seasonal interest, and for potential erosion control. Recommendations for bamboo control and path reestablishment were also noted. Evaluation of the erosion issues concluded that the problems were more numerous and serious than originally thought. Experts were consulted to assess the erosion problems and assist in the effort to start developing improvement plans. Once completed and an estimated budget developed, the Arboretum will be able to initiate fundraising efforts to cover repair costs, hopefully to be completed in the next 5-10 years.


text:
Perjury proceedings can't be initiated in every case: HC
Says false statement resulting in favourable order a fit case to file plaint
Updated At: Aug 13, 2022 07:39 AM (IST)
Saurabh Malik
Chandigarh, August 12
The Punjab and Haryana High Court has ruled that perjury proceedings under Section 340 of the CrPC are not to be initiated in "every case where the offences are purportedly made out". Justice Jasjit Singh Bedi of the High Court further ruled that a false statement resulting in a favourable order was one of the circumstances where perjury proceedings were required to be initiated.
If the false statement affects the very nature of the order passed by the court, that itself can be one of the circumstances, where proceedings under Section 340 CrPC ought to be initiated. Justice Jasjit Singh Bedi
The ruling by Justice Bedi came on a petition seeking the quashing of orders dismissing an application and an appeal filed by the petitioner for registering a complaint against his brothers for "using as true such declaration knowing it to be false" and other offences under Section 191, 192, 193, 199, 200, 209 and 120-B of the IPC.
Justice Bedi's Bench, during the course of hearing, was told that the petitioner had filed a civil suit for possession by way of partition and permanent injunction against his brothers in 2012. The respondent-brothers filed their written statement, wherein they purportedly denied the petitioner's ownership of the land wilfully and intentionally.
The civil suit was decreed and decided in the petitioner's favour before he filed an application under Section 340, read with Section 195 of the CrPC, for registering a complaint against the respondents for making a false complaint in the court, knowing the same to be false. But Phul Subdivisional Judicial Magistrate dismissed the application. The appeal against the order, too, was dismissed by the Bathinda Additional Sessions Judge.
Justice Bedi asserted the civil suit, in which alleged false affidavit was filed, was decreed in the petitioner's favour. But the court nowhere gave a finding that the respondent-brothers deliberately committed any offence, took a false plea in the written statement, or filed a wrong sworn affidavit while appearing in the witness box. In fact, reference for initiating the proceedings was not made by the court while decreeing the suit.
Justice Bedi added one of the situations for proceeding under Section 340 would be where a party succeeded in getting a favourable order due to a false statement, which otherwise would not have been possible.
"Therefore, if the false statement affects the very nature of the order passed by the court, that itself can be one of the circumstances, where proceedings under Section 340 CrPC ought to be initiated. In the present case, assuming that a false statement had been made either in the written statement or by virtue of filing of affidavits, those pleadings/averments did not affect the fate of the case. In fact, the petitioner did obtain a decree in his favour. Therefore, there is no apparent illegality in the orders," Justice Bedi concluded.

redpajama_set_name: RedPajamaCommonCrawl


text:
TheCare Serve Give Team
Vanessa Pollock: CEO of a $60M real estate business that has given back & raised over $125,000 in the last 5 years, Vanessa wants to equip & inspire other businesses to do the same, in order to leave a legacy of generosity.
Website: VanessaPollock.com
Vanessa@CareServeGive.com
Charlie Pollock: Accomplished Broadway Actor and former Pastor, Charlie lives by two rules: Love God and Love People. He is passionate about co-directing Care Serve Give to equip businesses that will go out and Love People, ALL people.
Charlie@CareServeGive.com
Paul Madsen: Spending the last 10 years working in the Non-profit world, Paul is ecstatic to be part of this amazing opportunity with CSG! Seeing community and world change by help others experience working and thinking for something greater.
Paul@CareServeGive.com
Learn MoreAbout Our Vision
Profit matters.
Profit matters so that generosity can exist.
Profit matters so that generosity can make an impact both locally and globally.
Every business can have a higher purpose and exist for more than profit alone.
With a higher purpose in place for a business, culture is strong and the business can withstand any shift in a market.
We believe that it is nearly impossible to change the world through our individual generosity, or as a single business. We believe, however, that world change is inevitable through the collective strategic giving of many successful and profitable businesses. And that is us – the Care Serve Give community. We are stronger together than we are alone. And as a community, we can change the world.
We envision a day when the Care Serve Give community is 1,000 strong and we are donating and raising over $20,000,000 year as a giving army. Join us?
Care Serve Give Community Contributors
We have world-class contributors, who have partnered with the founders to bring their insight for "Care Serve Give". Our contributors touch on the various aspects of the "Care Serve Give" way: CARE of self, team, clients and community | SERVE for self, team, clients and community | GIVING of self, through team, on behalf of clients and in the community.
Mo Anderson
Co-Owner of Keller Williams Realty
Mo Anderson is an international speaker and trainer of trainers. As co-owner, Vice Chairman, and former CEO, she is one of the most significant driving forces behind the success of Keller Williams Realty, which is now one of the largest and most successful real estate companies in North America- making her a true icon in the industry! By using her experiences, achievements, successes, and God-given gifts, Mo is dedicated to serving people both inside and outside of the real estate industry to live their best life!
Website: MoAnderson.com
Paul Cummings
Speaker, Leader & Author
Paul Cummings has been educating business professionals for over thirty-five years and has developed revolutionary techniques in sales, customer service, and leadership development. His personal mission is to always leave it better than he found it because he truly understands and firmly believes that It All Matters.
Website: PaulCummings.com
Kanani Briggs
Business & Life Strategist
Kanani Briggs is a business and life strategist with over 15 years experience in sales, marketing, and international business development. She helps women translate their corporate skills into socially conscious lifestyle businesses that provide financial abundance and revolve around their lives, not the other way around.
Website: KananiBriggs.com
Liz Josefsberg
Health, Wellness and Weight Loss Expert
Liz Josefsberg is a health, wellness and weight loss expert with over 15 years in the industry. Liz worked for several years as the Director of Brand Advocacy and a Leader for Weight Watchers, until she started her own consulting firm as a wellness expert. Liz's work today centers on advising companies at the cutting edge of weight loss and emerging health solutions.
Website: lizjosefsberg.com
Sam Neylan
Financial Speaker & Teacher, CEO of the Neylan Group Int'l
Sam grew up in the Real Estate industry, through her experience, skill, and international travel, the success of Neylan Group International is rooted in protecting our clients by equipping them with reliable data by which to make informed & strategic decisions for their investments, their families, and their futures. Neylan Group International is relentless in delivering our client's best interests.
Website: NeylanGroup.com
Included with the Care Serve Give Membership
The Marketing Toolkit
New Ideas + New Perspectives for Marketing
With your CSG subscription, you will be equipped with attractional branding of the Care Serve Give logo, service tools and inspirational training that will grow your business, inspire others and spark generosity. You will also be listed on our National Directory of Businesses. Ongoing education and new marketing ideas will be provided to all of our CSG businesses monthly!
Care Serve Give in Action
"With this platform, our team created a not-for-profit initiative that has impacted over 500 students with support for music education."
Case Study: Music InitiativeCheck out the video
Apply to Join the Care Serve Give Community today!


text:
Jackie S. Arms
Jackie "Gran" Snipes Arms, 77, passed away December 16, 2021. A native of Greenville County, daughter of the late Jack and Hattie Flynn Snipes, she was a retired teacher at Greenville County Schools for 32 years and a member of Mount Lebanon Baptist Church. Surviving are her husband of 58 years, Allen G. Arms of the home; a daughter, Tonya A. Jackson (Rev. Ken) of Lugoff; a daughter-in-law, Wendi Arms of Taylors; a sister, Charlene Crowe (Rev. Keith) of Taylors; four grandchildren, Madelyn J. Impson (Logan) of Pelzer, Micah Arms of Taylors, M. Flynn Jackson of Lugoff, and Macon G. Jackson of Lugoff; and a niece, Adrianne Goodell (Jeff) of Taylors. She was predeceased by a son, Michael Shane Arms. Funeral services will be held 11:00 a.m. Saturday, December 18, 2021, at Mount Lebanon Baptist Church conducted by Rev. Mark Smith, Rev. Ken Jackson, and Rev. Keith Crowe. Burial will follow in the church cemetery. Honorary escort will be the Hannah Sunday School Class of Mount Lebanon Baptist Church. Visitation will be held 10:00-10:45 a.m. Saturday at the church. The family is at the home. Memorials may be made to Mount Lebanon Baptist Church, 572 Mount Lebanon Church Road, Greer, SC 29651. Online condolences may be made at www.thewoodmortuary.com
Jackie "Gran" Snipes Arms, 77, passed away December 16, 2021. A native of Greenville County, daughter of the late Jack and Hattie Flynn Snipes, she was a retired teacher at Greenville County Schools for 32 years and a member of Mount... View Obituary & Service Information
The family of Jackie S. Arms created this Life Tributes page to make it easy to share your memories.
Jackie "Gran" Snipes Arms, 77, passed away December 16, 2021.
Send flowers to the Arms family.


text:
Warhammer 40,000: Dawn of War II - Ultramarines Pack on Steam Discovery
What is Warhammer 40,000: Dawn of War II - Ultramarines Pack?
Warhammer 40,000: Dawn of War II - Ultramarines Pack is a Strategy PC game, developed by Feral Interactive (Mac/Linux), available on Steam and published by Feral Interactive (Mac/Linux).
Warhammer 40,000: Dawn of War II - Ultramarines Pack images
Warhammer 40,000: Dawn of War II - Ultramarines Pack PC release date
The release date for Warhammer 40,000: Dawn of War II - Ultramarines Pack PC game on Steam: 16 Aug, 2011
Warhammer 40,000: Dawn of War II - Ultramarines Pack review
According to Steam user reviews, 0% of the 0 user reviews in the last 30 days are positive. For all time, 0% of the 0 user reviews for Warhammer 40,000: Dawn of War II - Ultramarines Pack are positive.
Warhammer 40,000: Dawn of War II - Ultramarines Pack Steam features
Game like Warhammer 40,000: Dawn of War II - Ultramarines Pack
Click on any of these tags to find more games like Warhammer 40,000: Dawn of War II - Ultramarines Pack
Requires Windows, Mac, Linux/SteamOS
$6.99 | £4.99 | 6.99€	Buy on Steam


to play Monopoly or work on a jigsaw puzzle or just read. Vocabulary, english Teacher, etymology, difficult Words, letter Writing. Home is the place where your family. On the porch, I'd put a big pot of yellow and purple pansies in the spring, bright red geraniums in the summer, golden chrysanthemums in the fall, and a wreath of greens in December. Finally, I'd go to an antique shop and find a china teapot and a few pretty teacups so I could invite my old friends over for a cup of tea. When you go through the newspaper, you find many houses for sale. A house is a structure, nothing more, nothing less. . The company that is like a house, focuses on the structure.
Home essaysWhat is home? By definition a house is a building built for habitation where as a home is an abode built for one. What is the difference between Home and House? When you go through the newspaper, you find many houses for sale.
If you were starting over in an empty house without any of your accumulated belongings, what would you need to make it feel like home? The same is true for a company, but sadly we don't have two words to make the comparison. It's where we daydream where little girls can be or and little boys can. What they lack is not a roof over their head, but the emotional warmth and security. I love the antique clock on the mantel, the family photographs that make me smile, our wedding-gift silver that can turn a plain meal into a celebration, the handed-down Blue Willow platter that has held the turkey for generations. The house which you choose to live in becomes your home. The company that feels like a home, focuses on the culture - the very thing that makes a house into a home. That's the question four of us, longtime good friends, were discussing over a cup of tea. We would need a yardstick in order to start a new measuring wall out in the kitchen, probably behind a door, where children are measured, where year after year, and the inches march upward on the wall to show how tall they have become. Slowly, we would reaccumulate the books we cherish from "A Child's Garden of Verses "The Little Engine that Could and "Goodnight Moon" to books by Dickens, Twain, Hemingway, and Frost.


text:
---
layout: post
title: Use Existing SQLite Database in Android App
date: 2014-01-22 10:40
author: trinh_le
comments: true

tags: [SQLite, Android Database]
---

In my previous post about SQLite , I only post the way to create database when application started.

In reality, we do not only need a database to store data but also need one to read information from.

So, in this post, I will show you how to use existing SQLite database in Android app.

The basic idea for this case is instead of creating a new database, we copy the exist one to the application's data folder.

Very simple, right?

Now, we'll go straight to the demo for easier understanding.

First, create a Test database:

Enter some dummy data:

The very first thing you need to do when you want to use SQLite is create a sub class of SQLiteOpenHelper.

Create some constants for database name, table name, and the database path:
{% highlight java %}
public class DatabaseHelper extends SQLiteOpenHelper {

    public static String DB_PATH = "/data/data/ice.tea09.sqlitedemo/databases/";

    public static String DB_NAME = "Test.sqlite"; public static final int DB_VERSION = 1;

    public static final String TB_USER = "Users";

}
{% endhighlight %}

Note that ice.tea09.splitedemo is your project namespace.

Implement constructor, and some methods of super class:
{% highlight java %}
private SQLiteDatabase myDB;
private Context context;

public DatabaseHelper(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
    this.context = context;
}

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

}

@Override
public synchronized void close(){
    if(myDB!=null){
        myDB.close();
    }
    super.close();
}
{% endhighlight %}

Method checkDatabase() allow you to check if the database exists on the phone or not:

{% highlight java %}
/***
* Check if the database is exist on device or not
* @return
*/
private boolean checkDataBase() {
    SQLiteDatabase tempDB = null;
    try {
        String myPath = DB_PATH + DB_NAME;
        tempDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE);
    } catch (SQLiteException e) {
        Log.e("tle99 - check", e.getMessage());
    }
    if (tempDB != null)
        tempDB.close();
    return tempDB != null ? true : false;
}
{% endhighlight %}
Method copyDatabase() used to copy SQLite file in assets folder to data folder of application on the phone:
{% highlight java %}
/***
 * Copy database from source code assets to device
 * @throws IOException
 */
public void copyDataBase() throws IOException{
    try {
        InputStream myInput = context.getAssets().open(DB_NAME);
        String outputFileName = DB_PATH + DB_NAME;
        OutputStream myOutput = new FileOutputStream(outputFileName);

        byte[] buffer = new byte[1024];
        int length;

        while((length = myInput.read(buffer))>0){
            myOutput.write(buffer, 0, length);
        }

        myOutput.flush();
        myOutput.close();
        myInput.close();
    } catch (Exception e) {
        Log.e("tle99 - copyDatabase", e.getMessage());
    }

}
{% endhighlight %}
openDatabase() method:
{% highlight java %}
/***
 * Open database
 * @throws SQLException
 */
public void openDataBase() throws SQLException{
    String myPath = DB_PATH + DB_NAME;
    myDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE);
}
{% endhighlight %}

Finally, createDatabase() method - which will be called every time we launch app. It will check if the database does not exist on the phone, It'll copy the database to data folder of application:
{% highlight java %}
/***
 * Check if the database doesn't exist on device, create new one
 * @throws IOException
 */
public void createDataBase() throws IOException {
    boolean dbExist = checkDataBase();

    if (dbExist) {

    } else {
        this.getReadableDatabase();
        try {
            copyDataBase();
        } catch (IOException e) {
            Log.e("tle99 - create", e.getMessage());
        }
    }
}
{% endhighlight %}

Finally, method that help you retrieve data from database:
{% highlight java %}
public List<String> getAllUsers(){
    List<String> listUsers = new ArrayList<String>();
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor c;

    try {
        c = db.rawQuery("SELECT * FROM " + TB_USER , null);
        if(c == null) return null;

        String name;
        c.moveToFirst();
        do {
            name = c.getString(1);
            listUsers.add(name);
        } while (c.moveToNext());
        c.close();
    } catch (Exception e) {
        Log.e("tle99", e.getMessage());
    }

    db.close();

    return listUsers;
}
{% endhighlight %}

The way we using DatabaseHelper in MainActivity:
{% highlight java %}
public class MainActivity extends Activity {

    DatabaseHelper dbHeplper;
    ListView lvUsers;
    ListAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        dbHeplper = new DatabaseHelper(getApplicationContext());
        try {
            dbHeplper.createDataBase();
        } catch (IOException e) {
            e.printStackTrace();
        }

        lvUsers = (ListView)findViewById(id.lvUsers);
         List<String> listUsers = dbHeplper.getAllUsers();

        if(listUsers != null){
            adapter = new ArrayAdapter<String>(getApplicationContext(),
                    android.R.layout.simple_list_item_1, android.R.id.text1,
                    listUsers);
            lvUsers.setAdapter(adapter);
        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}
{% endhighlight %}

Demo result:

Source code:

https://drive.google.com/file/d/0BzvV1wN-WHWwWG5LQm01ZnNJTzQ/edit?usp=sharing

redpajama_set_name: RedPajamaGithub


Yesterday marked exactly six months since the passage of Hurricane Maria. But today it felt more real than it felt yesterday because it happened on a Monday. I still remember those howling winds and those heavy rains. Hearing the branches on the trees cracking and seeing water pass through every crack and flooding the house. That must have been the longest night I ever had to experience.
But with all that we had to face there are so many lessons that I learnt from the hurricane. Some of them I am still learning today – six months later. So today I share five of those lessons with you.
Don't Procrastinate – there are so many things I wanted to do and kept putting them off and after it got more difficult to achieve them after Maria I wished that I had gone through with getting them done. There were even documents I needed to put away and kept looking at them thinking I will do so tomorrow – and they got wet during the flooding and were lost.
Always say I Love You to the ones you love – this is something I try my best to do all the time but sometimes fall short in how much I would want to do it. I always remember that song by country singer Garth Brookes "If tomorrow never comes" when thinking of this lesson. We never know what may happen so say today everything we want to.
Never take anything for granted – so often when we have full access to the banks, the supermarkets, the food, the water, the electricity, we never stop to think how fortunate we are and how easily it can all be taken away. Those little things that we missed after the hurricane some people are without it for years so we should never take anything for granted because we never know when we will lose it.
Stop existing and start living – Life was given to us to be lived. While we don't go beyond and fall prey to harmful or dangerous activities we should live life to the full – and that includes spiritually as well. Too often we work hard but fail to enjoy the fruits of our labour. Go out with family and friends. Go on a date with your spouse. Spend some quality family time. Travel. Like people say these days "Live before you leave".
People choose their actions – I can honestly say that I was really surprised and a bit concerned about the actions I heard of following the hurricane. But at the end of the day people choose how they want to react or behave in a particular situation. And some situations bring out the worst or the best in a person. So I had to learn, and am still learning, that not everyone will act the same way to a particular situation and we have to accept that.
The past six months have been tough to say the least. We have been working under "unfriendly" conditions and most people are in constant fear whenever it rains. Added to that there are still so many houses that still remain uncovered today for a number of reasons. But we are in the process of healing as a people and as a nation. There is such a long way to go in order to get back to some from of normalcy but we will get there.
I ask that you all continue to keep us, and all other countries that have suffered loss and damage as a result of natural disasters, in your prayers.


text:
Building museums, building cities: U of T hosts all-star panel of artists and architects
(photo by Romi Levine)
Imagine Toronto without the Royal Ontario Museum or the Art Gallery of Ontario.
The ROM's Lee-Chin Crystal and Frank Gehry's long glass and wood façade at the AGO have reached iconic status in the city – and Toronto would feel emptier without them. The buildings themselves have become as important as the artifacts they house.
The relationship between cities and their cultural institutions was the topic of "Building Museums: Building Cities" – a discussion, organized by the Art Museum at the University of Toronto and the French Consulate General in Toronto, which took place on June 24 at Hart House.
Moderated by Richard M. Sommer, dean of the John H. Daniels Faculty of Architecture, Landscape, and Design at the University of Toronto, the talk centred on the cultural role of museums and the importance of making these spaces accessible to a broader audience.
Speakers included artist Adrian Blackwell, architect Éric Lapierre and journalist Philippe Tretiack – both from France, architect Charles Renfro who is a partner at design studio Diller Scofidio + Renfro and alumna Shirley Blumberg, founding partner of KPMB Architects.
A diverse group of people from students and alumni to architects and art curators packed into the Debate Room at Hart House to listen to and participate in the discussion.
For attendee Cynthia Roberts, who holds a Masters of Museum Studies from U of T, the event highlighted the importance of talking about art and architecture so that decision makers are aware of its importance and the need for funding.
"It's a never-ending task to engage people in arts, culture and preserving heritage," says Roberts, who is currently a content manager at an international design firm.
Sociology graduate student Noga Keidar and Architecture and geography grad Jessie Ouyang were part of a group of University of Toronto students who recently traveled to Israel to learn about urban growth and regeneration. Inspired by what they learned, they decided to come to the event to hear the panellists' perspectives.
More about their trip
"I'm interested in the role of museums in the urban economy and the connection between art and industry," says Keidar.
Toronto is an interesting backdrop for a talk about the relationship between city and culture. While its creative scene is growing, Sommer told U of T News that Toronto's cultural institutions are struggling to keep up.
"They don't have the scale or the extent or the resources that are in sync with the growth and the exuberance of the city itself," he says.
Panelists weigh in
"It's very much trying to establish a new relationship between the artist, the institution, the audience and the wider community," said Blumberg on what goes into designing a museum.
She spoke about her involvement in the creation of the Remai Modern Art Gallery of Saskatchewan in Saskatoon – a project she says was designed to respect both the landscape that surrounds the museum and the city's indigenous community.
Architects must also foster relationships with art curators to ensure that the interior gallery space does the art justice.
"Museums have both an opportunity and obligation to provide new experiences for the public but we're also really conscious of and concerned about the art everyone is seeing inside," says Charles
Renfro, whose firm has designed major cultural buildings around the world from Rio de Janeiro to Berkeley California.
Diller Scofidio + Renfro is currently collaborating with Architects Alliance to design the new University of Toronto Centre for Civilizations and Cultures where the McLaughlin Planetarium currently stands.
"Building Museums: Building Cities" was not without some friendly debate, but the panel had nothing but praise for one of Toronto's most unique cultural spaces – the Hearn Generating Station – the decommissioned plant that has hosted a number of events. It most recently housed performances and installations for the Luminato Festival.
"I was blown away by what it is," said Renfro.
The relationship between technology and art was also a hot-button issue – with agreement across the panel that while anything and everything can be found online, there's still something special that still draws people to museums and galleries.
City & CultureOur Community
ArchitectureMuseumsCities


text:
Ámina bint Wahb (psána též Amina, Ámna a podobně; arabsky آمنة بنت وهب; zemřela kolem roku 577) byla matkou Mohameda, proroka islámu. V arabštině se jí většinou říká Umm an-Nabíj ("Matka Prorokova").

Ámina byla dcerou Wahba ibn ʿAbd Manáfa. Provdala se za ʿAbdalláha ibn ʿAbd al-Muttaliba, který se stal Mohamedovým otcem, jenž však zemřel ještě před prorokovým narozením. Mohamed byl brzy po narození předán do péče chůvy jménem Halíma. Ta později (snad vzhledem k chlapcovým epileptickým záchvatům) nabyla přesvědčení, že malý Mohamed je posedlý démony, a kolem roku 575 chlapce vrátila matce. Sama Ámina zemřela kolem roku 577, když bylo Mohamedovi asi šest let. Jakút ar-Rúmí uvádí ve svém Zeměpisném slovníku tři místa, kde by mohl být Áminin hrob. Podle Muhammada ibn Saʿda je její hrob v al-Abwě na cestě mezi Mekkou a Medínou.

V nejstarších sbírkách hadísů je několik zpráv o Mohamedově návštěvě hrobu jeho matky. Traduje se, že v přítomnosti několika svých společníků prosil Boha o odpuštění pro Áminu, ale jeho přímluva nebyla vyslyšena. Tato událost prý byla podnětem následujícího verše Koránu: "Nepřísluší prorokovi ani věřícím, aby prosili za odpuštění pro modloslužebníky, byť i to byli blízcí příbuzní, poté, co jim bylo jasně ukázáno, že stanou se obyvateli ohně." (súra 9, verš 114)

Z tradice kolem tohoto verše se odvodilo, že matka proroka zůstala pohankou, a proto přišla do pekla. O problematice prorokových rodičů se v islámské teologii debatuje od 10. století.

Odkazy

Reference

Externí odkazy

Mohamedova rodina
Ženy v islámu
Arabové
Narození v 6. století
Narození v Saúdské Arábii
Úmrtí v 6. století
Úmrtí v Saúdské Arábii
Ženy

redpajama_set_name: RedPajamaWikipedia


text:
A hiena-riscada (Hyaena hyaena), também conhecida por hiena-raiada ou hiena-listrada, é um mamífero carnívoro da família Hyaenidae, conhecida por sua vocalização semelhante a uma gargalhada humana, usada para comunicação. Habita partes da África e da Ásia.

Características
A hiena-riscada pesa entre 25 e 60 kg, possui até 1,30 m de comprimento, sem medir a cauda que tem de 25 a 40 cm de comprimento. Possui de 70 a 80 cm de altura na cernelha. Diferencia-se de sua parente Hiena-malhada por suas listras negras ao longo do corpo. Possui também pêlos longos e até eriçados na costas, vindo de trás da cabeça até a cauda. No inverno seus pêlos se tornam mais longos.

As hienas também comem frutas. Em Israel, atacam canteiros de melão o que causa conflito com os fruticultores locais. As hienas listradas foram observados com uma matilha de lobo cinzento(Canis lupus) se movendo através do deserto de Negueve como uma espécie única de predador.

Hyaenidae
Mamíferos descritos em 1758


text:
» UMAYC framework correspondence
UMAYC framework correspondence
Submitted by sfletcher on Thu, 03/20/2014 - 09:15
2000 February 7 - 2000 May 12
- UMAYC Road Map aka evaluation framework PowerPoint printouts
- draft of guide to answering AHS National Administrative and Process Survey with handwritten notes on the following pages: 28, 30, 32, 40, 46, 47, 48, 52, 53, 54, 55, 57, 58, 61, 63, 64, 66.
- another draft of guide attached to an e-mail. The draft has handwritten notes throughout.
- third draft of guide with some handwritten notes, but no page numbers.
‹ 2014-004-012 (006) Presentation handouts and printed slides (part 2 of 2), [2008 March 13] up 2014-004-013 (001) AHS national administrative and press survey code books and surveys, 2000 March 31 - 2000 May 4 ›


text:
Hezbollah attack tunnels exposed by IDF
Photo: IDF Spokesperson's Unit
IDF declares end of Operation Northern Shield with finding of 6th tunnel
Israeli military marks the completion of operation to locate and neutralize Hezbollah's underground terror constructions after exposing sixth attack tunnel dug along the Israel-Lebanon border.
Yoav Zitun|Published: 01.13.19 , 09:21
The IDF declared Sunday the completion of Operation Northern Shield after locating a sixth attack tunnel dug by the Hezbollah terror group from Lebanon into Israeli territory. The tunnel is expected to be neutralized in the coming days.
In early December, the IDF launched the operation to expose and neutralize terror tunnels Hezbollah has constructed along the Israel-Lebanon border since 2006, after years of intensive and careful planning.
Map showing tunnel from Lebanon into Israel (Photo: IDF Spokesman's Office)
The IDF said the latest tunnel is one of the most strategically important due to not only its location, but also in light of its size.
"The tunnel was 800 meters long on its Lebanese side and infiltrated dozens of meters into Israel. The tunnel is two meters high, one meter in diameter, and approximately 55 meters deep," said the military. "Its equipped with railway tracks, steps carved into the rock, as well as electric power and lighting system."
IDF exposes 6th Hezbollah tunnel
כתובת דוא''ל של החבר שמך כתובת הדוא''ל שלך נושא
הקלידו את הקוד המוצג
תמונה חדשה
הסרטון נשלח לחברך
הטמעת הסרטון באתר שלך
קוד להטמעה:
"All of the tunnels have been exposed and have either already been destroyed or are going to be destroyed," military spokesman Lieutenant-Colonel Jonathan Conricus told reporters."According to our assessments, there are no longer any tunnels crossing into Israel," he said, adding that Hezbollah retained some underground facilities on the Lebanese side.
IDF works along Israel-Lebanon border (Photo: IDF Spokesperson's Unit)
"Operation Northern Shield deprived Hezbollah of the unique offensive abilities it had built over the years as part of its planned attack on Israeli territory," the army also said. "The operation reflected advanced operational and intelligence technological capabilities and multi-stage detection of underground areas, which have developed even more over the past few weeks."
Inside the exposed Hezbollah tunnel (Photo: IDF Spokesperson's Unit)
The army said once the exposed tunnels have been neutralized, the IDF will begin the construction of the defensive barrier along the border.
"Until the neutralization process is completed, the IDF will continue its defensive efforts on the border … In addition, IDF troops and the underground detection laboratory will continue operating regularly along the Lebanese border," the army added.
Reuters contributed to this story.
See all talkbacks "IDF declares end of Operation Northern Shield with finding of 6th tunnel"


text:
/ Portrait - NPG x32378; Carel Weight
© George Newson / Lebrecht Music & Arts
by George Newson
bromide fibre print, September 1988
6 1/2 in. x 10 in. (165 mm x 253 mm)
Given by George Newson, 1989
George Newson (1932-), Composer and photographer. Artist of 57 portraits, Sitter in 2 portraits.
Placesback to top
Place made: United Kingdom: England, Sussex (Hastings Museum)
A Pan Am jumbo jet is brought down by a bomb over Lockerbie in Scotland, killing 259 passengers and 11 people on the ground. The Dumfries and Galloway Constabulary launched Britain's largest criminal investigation before convicting a Libyan intelligence officer of planting the bomb.
Professor Stephen Hawking publishes his popular book on cosmology, A Brief History Of Time.
Damien Hirst and his fellow Goldsmiths students organise the exhibition Freeze in a disused block in the Docklands. The exhibition launched the careers of many of the young British artists (YBAs) associated with Brit Art including Gary Hume, Michael Landy, Sarah Lucas, Angus Fairhurst, and Anya Gallaccio.
Iraq drops poison gas on the Iraqi Kurdish city of Halabja, killing thousands of civilians. The city was held at the time by Iranian forces and Iraqi Kurdish rebels, although there was initially some debate over which side was responsible for the atrocity. It was the largest-scale chemical attack on civilians in modern times.
Gallery blog
Read our latest news and have your say.
Identify our Silhouettes
Join enthusiastic contributors who have already identified 155 sitters.
Help transcribe signatures
Tell us more about our Silvy sitters
Help us identify the sitters who visited Camille Silvy's photographic studio during the 1860s.
Identify our sitters
Reviewers Revealed: Celebrating the TLS Centenary


Nirala World and the promoters of SMC Group have join hands to develop a home of your dreams in the heart of Noida Extension- A luxurious yet affordable residential development- Nirala Estate! Nirala World, Noida, Uttar Pradesh, India @9667367666.
Founded in 1996, Nirala World is known for developing world-class real estate developments in NCR. The promoters of SMC Group are of brand Madhusudan Ghee. Both are the popular names in the market. So, there is no need to worry about the quality of the project and the deliverance will be in time as per experts.
This amazing and affordable Project is surrounded by I.T. Park of well-known companies. The project has got 1948 total units in the project towers. These well designed 2BHK, 3 BHK and 4 BHK Nirala Estate Noida Extension Apartments are very close to many important landmarks.
The residential place of your choice is located at Tech Zone-4 Noida Extension. Loaded with premium amenities, this development is presenting different sizes of apartments- from 955 sqft to 2320 sqft! Spread over 25 acres, Vaastu-Compliant apartments are best homes for you and your loved ones!
The best Housing loan facility is available to turn your dreams into reality. Many financial institutions are offering home loans at cheaper interest rates. Round the clock security, 24 Hour Electricity, Rain water harvesting and WI-FI connectivity are the part and parcel of the project.
SBI ATM and Chaudhary Hospital are also in the vicinity of Tech Zone 4. Sec-18 Market and Fortis Hospital are just in close proximity to the Nirala Estate project. Nirala World has come up with this project plan to cater to the exact requirements. State of the art- Golf Course, Sai Mandir and Proposed Metro Station are also located closer to the project!
As a resident you will love to find that only 20% covered area and around 80% open space with Double Park in Nirala Estate Noida Extension Society! The features of the project include Coffee Lounge & Restaurants, Club House, Cafeteria/Food Court, Swimming Pool, Private Terrace/Garden, Outdoor Tennis Courts, Bar/Lounge, Cycling and Strolling Track/ Jogging Track Power Back Up and Dance Studio.
Please let us know if you want to know more about Nirala Estate Noida Extension!


text:
Self-advocacy key for college-bound special education students
By David PaulkDavid.paulk@doverpost.com@paulkatdover
Educators say self advocacy is a key for success
A lifelong disability isn't enough to stop Samantha Wierney's college dreams. But like any special education student, she faces additional hurdles.
Wierney, 18, remains enthusiastic about attending Delaware Technical Community College in the fall. But the Dover High School senior wasn't always this confident about furthering her education.
"My freshman year I didn't really think I was going to go to college," Wierney said. "I was like, 'What am I going to do?' I knew my grades weren't that good."
Since she was an infant, Wierney has been living with the debilitating effects of a brain injury.
Because of her disability she often struggles to keep the same walking pace as her peers and struggles to write for long periods of time. At one point in her life she would lose weeks of memory following a seizure.
Despite the challenges, she was determined to get a college education.
"People said that if you actually go to college you can make more money," she said. "I had my mom pushing me towards going to college, and by the end of my sophomore year I thought I could handle college."
The Delaware Department of Education recognizes her disability, a mild form of cerebral palsy, as a health impairment.
Students categorized as special education can include those with autism, emotional disturbances, intellectual disabilities and hearing impairments.
Basic college requirements – such as submitting grade point averages, college applications and scores on college entrance exams like the SAT – are the same for special education and general students.
Wierney's path, however, contains additional steps. All Delaware special education students follow academic roadmaps called Individual Education Programs.
This state mandated program involves educators, parents and the scholar meeting on a regular basis to determine a student's needs. At age 14 they are switched from a regular IEP to a transitional one, meant to help a student plan for life after high school.
The IEPs are aligned with the student's specific condition and will list appropriate accommodations for them in class. In Wierney's case, she may need extended time on exams.
But the IEPs are only applicable while the student is using public education. Once students move on to college, the responsibility shifts from the school to the student.
Cassandra Green, Vice President of University College and Interim Student Accessibilities Coordinator at Delaware State University, said this sort of self-advocacy can be difficult.
"Once they register and send in their documentation sometimes the challenge is following through. During K through 12 they pretty much were hand held," she said. "Everybody knew about their disability all the way up to the principal."
She recommends students and future students reach out to Student Accessibility Services. Once their condition is on file, a counselor will help with accommodations. Certain students with learning disabilities may need extended time on exams; the visually impaired may need braille while students with sleeping disorders may need excused absences because.
At University of Delaware, an estimated 1,200 students identified themselves as having a disability during the 2015-2016 academic year, according to Anne Jannarone, director of the school's Office of Disability Support Services. This marks an 18 percent growth over ten years.
"I believe that students and their families are more aware of their rights in seeking academic accommodations at the postsecondary level now," she said. "Many of our students select their college in part based on the support offered through the disability services office."
The college environment is a determining factor. Wierney had been considering Delaware State University, but a visit made her decide it was too fast-paced for her to focus. She instead opted for the smaller Delaware Tech.
Despite her ambitious nature, she's still nervous about new, unfamiliar territory.
"It's kind of in the middle because I know I can handle it," she said. "But I'm also kind of nervous because I'm not sure who I will meet at Del Tech."
Students with disabilities may have that extra layer of responsibilities in preparing for college, but DSU's Green has seen some impressive feats.
"They are the hardest workers, because they have to accommodate for their disability," she said. "If it's not accommodated it could get in the way of their learning. Once the accommodations are in place their intelligence can take off because they're not getting hindered."


Johannesburg - Shane Eagle just proved my point: this guy should have won Vuzu Amp's The Hustle! He's outshone the other contestants since he was booted off the show.
In control of his own career, the rapper and TV presenter has put out an impressive music video for his single Let It Flow, which is off his debut album Yellow. The video and the album illustrate how he's grown as an artist since his days of trying to impress AKA, Khuli Chana and Stogie T.
The video, directed by ArmsDeal, is beautifully executed. It shows how Eagle isn't just a rapper, but also an entertainer – which has started the debate over whether he is better than everyone's favourite rapper. AKA once said the reason Eagle has been more successful than others on The Hustle was because he understood the importance of being an all-round entertainer.
Eagle kinda is too, and on Yellow he's at times a little Travis Scott and Drake-esque. Which isn't a bad thing – his rhymes are slightly dreary at times, but the beat, his flow and the visuals more than make up for that.
This project has set a high bar for Eagle's peers. While the style of the Let It Flow video is not new, one of the more interesting concepts is the rapper at Wits west campus walking into still images of himself – think back to Kanye West's music video for Mercy.
Eagle dropped the video for Need Me on the same day as Let It Flow, and it isn't too bad either. Sure, at times it has "emo rapper" vibes, but he sounds good.


This convenient kit includes everything you need to accessorize your MINI, Micro, or Squeeze Water Filters. It includes two 32-ounce Squeeze Pouches to use as back-ups or just to have on hand as additional reservoirs, and a set of Fast Fill Adapters so you can fill your hydration pack directly from your filter.
For the Squeeze Water Filter, the kit also includes a set of Inline Adapters to turn your Squeeze into an inline filtering system on a hydration pack (sold separately), and a Cleaning Coupling adapter that allows you to backwash the Squeeze with a plastic bottle.
Everything you need to accessorize your Sawyer Squeeze or Mini Water Filter.
Fast Fill Adapters: 0.6 oz.
Q: ViewAre the filters and purifiers tested and approved?
Our filters and purifiers have been tested by independent and qualified research laboratories according to EPA standards for water filter and purifiers.
Q: ViewCan I freeze the filter?
While we have no proof that freezing will harm the filter, we do not have enough proof to say it will not harm the filter, therefore we must say that if you suspect the filter has been frozen, to replace it — this is especially true with a hard freeze.
Q: ViewHow fast should the water come out of my filter?
Flow rates vary depending on how clean the filter is and how well you cleaned the filter. Altitude also affects the flow rates (the higher you go the slower the flow. Also, the PointZEROTWO™ filter flows much slower that the Point ONE.
Join us on our mission to bring clean water around the world. Click below to learn more or text SAWYER to 41444.


Did you know? CSE data is real time on Google Finance!
In fact, CSE is the only Canadian exchange to offer real time data on Google Finance. Other exchanges that supply real time data to Google include Nasdaq, the NYSE, the London Stock Exchange and Euronext.
Visit Google Finance today and start researching your favourite CSE stocks using real time data!


The Board of Royal Dutch Shellplc today announced an interim dividend in respect of the second quarter of2005 of EUR0.23 per A and B share.
Limited says it will for the first time in the history of unit trust scheme in Nigeria, pay an interim dividend to holders of its Legacy Fund.
Interim Dividend: A dividend paid to creditors before the estate is finalized.
Server processing from 2019-04-26 13:50:37 thru 2019-04-26 13:50:37 GMT for 0 secs.


Now a days we are crazy to watch videos on YouTube. Sometimes we want something to be unique. We want to embed Youtube videos on our own website.
YouTube API is one of the most dynamic process to control the embedded videos. YouTube offers several APIs to integrate YouTube functionality.
1. Videos can be embedded very easily on the website.
2. No need to redirect the website to youtube.
3. Saves Memory of website by embedding the video from youtube.
1. Youtube data API integration.
2. Youtube player API integration.
3. Embedding Videos to your site.


text:
Q: FindFirstFile Windows8 error i'm trying to find all files on all drives, the OS is Windows 8
    std::string FolderName = "C:\\";
    FindAllFiles(FolderName);
...
void FindAllFiles(std::string FolderName)
{
    WIN32_FIND_DATA FileData;
    HANDLE FirstFile = FindFirstFile(&FolderName[0], &FileData);
    if (FirstFile == INVALID_HANDLE_VALUE) {
        std::cout << "Invalid handle value" << std::endl;
        return;
    }

    while (FindNextFile(FirstFile, &FileData))
    {
        if (isalpha(FileData.cFileName[0]))
        {
            if (FileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
            {
                std::cout << FileData.cFileName << std::endl;
            }
            else
            {
                std::string NewPath = FolderName + FileData.cFileName;
                NewPath = NewPath + "\\*.*";
                    FindAllFiles(NewPath);
            }
        }
    }
    }

but always receive Invalid_handle_value error. What is the problem?

A: You didn't call GetLastError(), which you should always do when a Windows function fails, but the most likely cause is that you failed to fill in FileData correctly before calling FindFirstFile.
Nearly all output buffers for use by Windows functions must be prepared:

*

*Populate the dwSize member using sizeof (this structure doesn't have this)

*Fill all other members with zero.

So try initializing the buffer with:
WIN32_FIND_DATAA FileData = {};

redpajama_set_name: RedPajamaStackExchange


text:
Q: Emulate a full-featured switch in Python I have read Replacements for switch statement in Python? and none of the answers seem to fully emulate a switch.
I know you can use if elif else or a dictionary but I'm wondering... is it possible in Python to fully emulate a switch including fall-through and default (without defining an enormous function before-hand)?
I am not overly concerned with performance and am mainly interested in readability and want to get the logical layout of a switch statement as in C-like languages in Python
Is this achievable or not?

A: As you don't want to use a dictionary or if elif else, the closest possible emulation, AFAIK, would be something like this:
class switch(object):
    def __init__(self, value):
        self.value = value
        self.fall = False

    def __iter__(self):
        """Return the match method once, then stop"""
        yield self.match
        raise StopIteration

    def match(self, *args):
        """Indicate whether or not to enter a case suite"""
        if self.fall or not args:
            return True
        elif self.value in args: # changed for v1.5, see below
            self.fall = True
            return True
        else:
            return False

import string
c = 'A'
for case in switch(c):
    if case(*string.lowercase): # note the * for unpacking as arguments
        print "c is lowercase!"
        break
    if case(*string.uppercase):
        print "c is uppercase!"
        break
    if case('!', '?', '.'): # normal argument passing style also applies
        print "c is a sentence terminator!"
        break
    if case(): # default
        print "I dunno what c was!"

@Author Brian Beck
@source: http://code.activestate.com/recipes/410692/ <- there are other suggestions there, you might want to check to see if any is good enough for you.
Note that you will have to use (or import this class switch)


El Reno tornado on May 31 now widest ever recorded in U.S.
El Reno, Oklahoma tornado on May 31, 2013 is now widest ever recorded in the U.S. at 2.6 miles (4.2 km) wide, according to the National Weather Service.
On June 4, 2013, the National Weather Service office in Norman, Oklahoma announced that the May 31 El Reno, Oklahoma tornado – responsible for killing highly respected storm chasers Tim Samaras, Paul Samaras and Carl Young – is now the widest tornado ever recorded in the United States at 2.6 miles (4.2 km) wide. The National Weather Service confirmed that the El Reno tornado, which was originally ranked as an EF-3 tornado, has been reclassified as an EF-5 tornado with winds greater than 200 miles per hour. Its path across the ground was 16.2 miles.
El Reno tornado. It has also been reclassified as an EF-5 tornado with winds greater than 200 miles per hour. Three storm chasers were killed in this storm. Image by Mike Bettes of TWC.
METEOROLOGISTS WITH THE NATIONAL WEATHER SERVICE AND RESEARCHERS FROM THE UNIVERSITY OF OKLAHOMA CONTINUE TO INVESTIGATE INFORMATION RELATED TO THE MAY 31 EL RENO TORNADO.
WITH THIS INVESTIGATION… THE TORNADO HAS BEEN UPGRADED TO AN EF5 TORNADO BASED ON VELOCITY DATA FROM THE RESEARCH MOBILE RADAR DATA FROM THE UNIVERSITY OF OKLAHOMA RAXPOL RADAR. IN ADDITION… THE WIDTH OF TORNADO WAS MEASURED BY THE MOBILE RADAR DATA TO BE 2.6 MILES AFTER THE TORNADO PASSED EAST OF US HIGHWAY 81 SOUTH OF EL RENO. THIS WIDTH IS THE WIDTH OF THE TORNADO ITSELF AND DOES NOT INCLUDE THE DAMAGING STRAIGHT-LINE WINDS NEAR THE TORNADO AS DETERMINED BY THE HIGH-RESOLUTION MOBILE RADAR DATA. THE 2.6 MILE TORNADO PATH WIDTH IS BELIEVED TO BE THE WIDEST TORNADO ON RECORD IN THE UNITED STATES.
The radar images above were taken by a University of Oklahoma research team using the RaXPol mobile radar. In the image, wind speeds of 296 mph at 500 feet above ground level are indicated. Additionally, multiple vortices can be seen in the data.
How wide would the El Reno tornado have been if you put all its 2.6-mile width over a large city?
The size and intensity of this large and violent tornado in El Reno, Oklahoma on May 31 explains why experienced storm chasers Tim Samaras, Paul Samaras and Carl Young, plus others whose vehicles were overturned, were caught in the tornado's path. It's highly likely that this tornado grew in size and intensity within a matter of minutes, as it shifted its track to the north near Interstate 40, where many storm chasers were moving fast down the highway, trying to keep the tornado in their sights. Not only was the tornado growing in size, but it was growing in intensity as well and apparently caught the chasers off guard.
This tornado proves one other thing: Storm chasers are vital for learning about supercells and tornadoes. Without the mobile dopplar radar carried in their vehicles, the NWS would likely never have reclassified this tornado as an EF-5 or been able to re-calculate its enormous width of 2.6 miles.
For a full two hour discussion about the El Reno, Oklahoma tornado, check out the Weatherbrains episode above. It was recorded Monday, June 3, prior to the announcement of the width and intensity of this tornado.
Bottom line: The National Weather Service has classified the El Reno, Oklahoma tornado on May 31, 2013 as an EF-5 tornado and it has changed the estimate of its width to be around 2.6 miles (4.2 km) wide. The May 31 El Reno tornado is now the widest tornado ever recorded in the United States.


Just a couple of guys filling sock in a lean-to near State College, Pennsylvania (we couldn't afford a barn). It was 2011 and although we were small, we thought big. We made friends, we kept our promises, and good things started to happen. By late 2011, things were growing, and Kurtz Brothers from Ohio got involved (something about "having juice"). By mid-2012 MKB Company was born. In the years that followed we have focused on 3 things – the highest quality products, keeping our promises, and continuous innovation. Today, MKB Company is an industry leader in sediment control in the Eastern U.S. - we have shipped over 16,000,000 linear feet of Filter Sock to customers in 22 states. We continue to grow geographically (recently adding factories in South Carolina and Missouri) and grow the product line though innovations like Switch Sock®, Blackhawk™, and Siltron®. Although our future is bright, we will never forget our humble beginnings – a lean-to, a skid steer, and a kid who said "yes" when he could have said "no".
To all our customers and partners, thanks for giving us a chance.