Search Results

Search found 119 results on 5 pages for 'lew cohen'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Dreamweaver CS4 - How do you preview in Browser?

    - by Linda Cohen
    I'm new to Dreamweaver CS4 and making my first website. I've watched a lot of tutorials and they all just click the Preview in Browser button and they can see what their page looks like in Firefox/IE/etc. But when I click Preview in Browser a new Firefox window opens up and it goes to my homepage and that's it. What do I need to setup in order be able to preview in firefox? THANKS!

    Read the article

  • How do you solve this Haskell problem?

    - by Linda Cohen
    I want to define a function replicate to replicate a list of numbers by its value using only list comprehension, for example: replicate [5,1,3,2,8,1,2] output: [5,5,5,5,5,1,3,3,3,2,2,8,8,8,8,8,8,8,8,1,2,2] I know this would be easy to use the 'replicate' built in function but only list comprehension is allow, how can I do this? THANKS!

    Read the article

  • Managing database connections in an Android Activity

    - by Daniel Lew
    I have an application with a ListActivity that uses a CursorAdapter as its adapter. The ListActivity opens the database and does the querying for the CursorAdapter, which is all well and good, but I am having issues with figuring out when to close both the Cursor and the SQLiteDatabase. The way things are handled right now, if the user finishes the activity, I close the database and the cursor. However, this still ends up with the DalvikVM warning me that I've left a database open - for example, if the user hits the "home" button (leaving the activity in the task's stack), rather than the "back" button. If I close them during pause and then re-query during resume, then I don't get any errors, but then a user cannot return to the list without it requerying (and thus losing the user's place in the list). By this I mean, the user can click on any item in the list and open a new activity based on it, but will often want to hit "back" afterwards and return to the same place on the list. If I requery, then I cannot return the user back to the correct spot. What is the proper way to handle this issue? I want the list to remain scrolled properly, but I don't want the VM to keep complaining about unclosed databases. Edit: Here's a general outline of how I handle the code at the moment: public class MyListActivity extends ListActivity { private Cursor mCursor; private CursorAdapter mAdapter; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new MyCursorAdapter(this); setListAdapter(mAdapter); } protected void onPause() { super.onPause(); if (isFinishing()) { mCursor.close(); } } protected void onDestroy() { super.onDestroy(); mCursor.close(); } private void updateQuery() { // If we had a cursor open before, close it. if (mCursor != null) { mCursor.close(); } MyDbHelper dbHelper = new MyDbHelper(this); SQLiteDatabase db = dbHelper.getReadableDatabase(); mCursor = db.query(...); mAdapter.changeCursor(mCursor); db.close(); } } updateQuery() can be called multiple times because the user can filter the results via menu items (I left this part out of the code, as the problem still occurs even if the user does no filtering). Again, the issue is that when I hit home I get leak errors. Yet, after going home, I can go back to the app and find my list again - cursor fully intact.

    Read the article

  • What can tables do that CSS positioning cannot?

    - by Jeremy Lew
    I know there are various good arguments preferring css positioning over table-based layouts. What I'm wondering is whether the CSS model is complete (assuming a relatively modern browser) with respect to ALL of the capabilities of tables. Are there layouts that tables can achieve that are impossible or impractical with CSS?

    Read the article

  • Why is 1px sometimes 2px when specified in Android XML?

    - by Daniel Lew
    I've got a desire for a one-pixel divider line, just for looks. I thought I could accomplish this using a View of height 1px, with a defined background. However, I'm getting some very odd behavior on different devices - sometimes the 1px ends up as 2px. Take this sample layout for example: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="@android:color/white" android:layout_marginBottom="4dp" /> </LinearLayout> When run on my G1, this comes out fine. But on the Nexus One, it alternates between 1px lines and 2px lines. Does anyone know where this is going awry? Why does Android sometimes make 1px into 2px?

    Read the article

  • Is there a detailed description of optimizations in the Android build process?

    - by Daniel Lew
    I've been curious as to all the optimizations that go into the building of an .apk. I'm curious because of two things I've tried in the past to bring down the size of my .apk: I have had a few large json assets in projects before, as well as a static sqlite database. I tried bringing down the size of the apk by gzipping them before the build process, but the resulting size is exactly the same. I just today tried pngcrush on my /drawable/ folders. The resulting build was exactly the same size as before. I would think that perhaps #1 could be explained by the zip process, but simply zipping the /drawable/ folders in #2 result in different-sized files. Perhaps the build process runs something akin to pngcrush? Regardless, I was wondering if anyone knew where to find a detailed description of all the optimizations in the Android build process. I don't want to waste my time trying to optimize what is already automated, and also I think it'd help my understanding of the resulting apk. Does anyone know if this is documented anywhere?

    Read the article

  • Algorithm question.

    - by Lukasz Lew
    I can't solve it: You are given 8 integers: A, B, C representing a line on a plane with equation A*x + B*y = C a, b, c representing another line x, y representing a point on a plane The two lines are not parallel therefore divide plane into 4 pieces. Point (x, y) lies inside of one these pieces. Problem: Write a fast algorithm that will find a point with integer coordinates in the same piece as (x,y) that is closest to the cross point of the two given lines. Note: This is not a homework, this is old Euler-type task that I have absolutely no idea how to approach.

    Read the article

  • Scala Array constructor?

    - by Lukasz Lew
    scala> val a = Array [Double] (10) a: Array[Double] = Array(10.0) scala> val a = new Array [Double] (10) a: Array[Double] = Array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) Why these two expressions have different semantics?

    Read the article

  • Hidden features of Qt.

    - by Lukasz Lew
    A little is hidden in Qt given splendid documentation. But given vastness of Qt functionality paradoxically many useful features have been overlooked by me (and reimplemented or work-arounded). What Qt functions you wish you have noticed earlier?

    Read the article

  • Assign method in Scala.

    - by Lukasz Lew
    When this code is executed: var a = 24 var b = Array (1, 2, 3) a = 42 b = Array (3, 4, 5) b (1) = 42 I see three (five?) assignments here. What is the name of the method call that is called in such circumstances? Is it operator overloading?

    Read the article

  • How to formulate a SQL Server indexed view that aggregates distinct values?

    - by Jeremy Lew
    I have a schema that includes tables like the following (pseudo schema): TABLE ItemCollection { ItemCollectionId ...etc... } TABLE Item { ItemId, ItemCollectionId, ContributorId } I need to aggregate the number of distinct contributors per ItemCollectionId. This is possible with a query like: SELECT ItemCollectionId, COUNT(DISTINCT ContributorId) FROM Item GROUP BY ItemCollectionId I further want to pre-calculate this aggregation using an indexed (materialized) view. The DISTINCT prevents an index being placed on this view. Is there any way to reformulate this which will not violate SQL Server's indexed view constraints?

    Read the article

  • Can you decode a mutable Bitmap from an InputStream?

    - by Daniel Lew
    Right now I've got an Android application that: Downloads an image. Does some pre-processing to that image. Displays the image. The dilemma is that I would like this process to use less memory, so that I can afford to download a higher-resolution image. However, when I download the image now, I use BitmapFactory.decodeStream(), which has the unfortunate side effect of returning an immutable Bitmap. As a result, I'm having to create a copy of the Bitmap before I can start operating on it, which means I have to have 2x the size of the Bitmap's memory allocated (at least for a brief period of time; once the copy is complete I can recycle the original). Is there a way to decode an InputStream into a mutable Bitmap?

    Read the article

  • Scala simple dummy project.

    - by Lukasz Lew
    Currently my whole work cycle is: edit foo.scala fsc foo.scala && scala -cp . FooMain But my project is getting bigger and I would like to split files, make unit tests, etc. But I'm too lazy for reading sbt documentation and doing whatever needs to be done to get a sbt's "Makefile". Similarly for unit tests (there are so many frameworks, which to choose?) What would make my day is a simple zipped dummy project with a dummy unit tests using sbt. Do you know whether such thing exists?

    Read the article

  • Getting Raw XML From SOAPMessage in Java

    - by Daniel Lew
    I've set up a SOAP WebServiceProvider in JAX-WS, but I'm having trouble figuring out how to get the raw XML from a SOAPMessage (or any Node) object. Here's a sample of the code I've got right now, and where I'm trying to grab the XML: @WebServiceProvider(wsdlLocation="SoapService.wsdl") @ServiceMode(value=Service.Mode.MESSAGE) public class SoapProvider implements Provider<SOAPMessage> { public SOAPMessage invoke(SOAPMessage msg) { // How do I get the raw XML here? } } Is there a simple way to get the XML of the original request? If there's a way to get the raw XML by setting up a different type of Provider (such as Source), I'd be willing to do that, too.

    Read the article

  • Does fast typing influence fast programming? [closed]

    - by Lukasz Lew
    Many young programmers think that their bottleneck is typing speed. After some experience one realizes that it is not the case, you have to think much more than type. At some point my room-mate forced me to turn of the light (he sleeps during the night). I had to learn to touch type and I experienced an actual improvement in programming skill. The most surprising was that the improvement not due to sheer typing speed, but to a change in mindset. I'm less afraid now to try new things and refactor them later if they work well. It's like having a new tool in the bag. Have anyone of you had similar experience? Now I trained a touch typing a little with KTouch. I find auto-generate lessons the best. I can use this program to create new lessons out of text files but it's only verbatim training, not auto-generated based on a language model. Do you know any touch typing program that allows creation of custom, but randomized lessons?

    Read the article

  • Perfect hash in Scala.

    - by Lukasz Lew
    I have some class C: class C (...) { ... } I want to use it to index an efficient map. The most efficient map is an Array. So I add a "global" "static" counter in companion object to give each object unique id: object C { var id_counter = 0 } In primary constructor of C, with each creation of C I want to remember global counter value and increase it. Question 1: How to do it? Now I can use id in C objects as perfect hash to index array. But array does not preserve type information like map would, that a given array is indexed by C's id. Question 2: Is it possible to have it with type safety?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >