Search Results

Search found 14 results on 1 pages for 'twk'.

Page 1/1 | 1 

  • Change TextView without completely re-drawing layout?

    - by twk
    I've found that updating a text view every second in my app burns a lot of CPU. The textview is in a horizontal LinearLayout, which is in turn inside of a vertical LinearLayout. Switching to a RelativeLayout (as recommended to increase perf) is not an option right now (I tried to get that working originally, but it was too complicated). The horizontal LinearLayout has 3 elements. The outer ones are TextViews with a layout_weight of 0, and the middle one is a progress bar with a layout_weight of 1 to make it expand to take up most of the space. I'm changing the contents of the leftmost TextView every second So, is there a way to change the contents of the text view without re-drawing everything? Or, can I force the TextViews to use a fixed amount of space to simplify the layout. Other tips for speeding up a LinearLayout are greatly appreciated as well. For reference, here is my entire layout. The field I'm updating is the timeIn one. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:text="Artist Name" android:id="@+id/curArtist" android:textSize="8pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:paddingTop="5dp"></TextView> <TextView android:text="Song Name" android:id="@+id/curSong" android:textSize="10pt" android:textStyle="bold" android:layout_below="@id/curArtist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"></TextView> <TextView android:text="Album Name" android:id="@+id/curAlbum" android:textSize="8pt" android:layout_below="@id/curSong" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"></TextView> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/curAlbum" android:orientation="vertical"> <LinearLayout android:id="@+id/seekWrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="10dp" android:maxHeight="10dp" android:orientation="horizontal"> <TextView android:text="0:00" android:id="@+id/timeIn" android:textSize="4pt" android:paddingLeft="10dp" android:gravity="center_vertical" android:layout_weight="0" android:layout_gravity="left|center_vertical" android:layout_width="wrap_content" android:layout_height="fill_parent"></TextView> <ProgressBar android:layout_below="@id/curAlbum" android:id="@+id/progressBar" android:paddingLeft="7dp" android:paddingRight="7dp" android:layout_width="fill_parent" android:layout_height="fill_parent" android:maxHeight="10dp" android:minHeight="10dp" android:indeterminate="false" android:layout_weight="1" android:layout_gravity="center_horizontal|center_vertical" style="?android:attr/progressBarStyleHorizontal"></ProgressBar> <TextView android:text="0:00" android:id="@+id/timeLeft" android:paddingRight="10dp" android:textSize="4pt" android:layout_gravity="right|center_vertical" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="fill_parent"></TextView> </LinearLayout> <ImageView android:id="@+id/albumArt" android:layout_weight="1" android:padding="5dp" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/blank_album_art"></ImageView> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:id="@+id/prev" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:src="@drawable/button_prev" android:paddingLeft="10dp" android:background="@null"></ImageButton> <ImageButton android:id="@+id/playPause" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/button_play" android:layout_weight="1" android:background="@null"></ImageButton> <ImageButton android:id="@+id/next" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/button_next" android:layout_gravity="right" android:paddingRight="10dp" android:background="@null"></ImageButton> </LinearLayout> </LinearLayout> </RelativeLayout>

    Read the article

  • Cannot create MVC project in VS2010

    - by twk
    After installing the official VisualStudio 2010 (had installed and uninstalled RC before) I cannot create MVC projects. When I try to create a new "MvcWebApplicationProjectTemplate.cs" project, I got the following error message: Reinstalling MVC 2.0 didn't helped :(

    Read the article

  • Simulate network failure on Android

    - by twk
    I've noticed when I switch from wifi to 3g on my Android phone that HTTP connections get killed. I'd like to simulate this error in an emulator for testing. Changing network speeds doesn't work, nor does turning on airplane mode (I've tried this on a 1.5 and a 2.1 AVD). Any ideas? I'm currently doing this by running my conns through Fiddler and manually killing them, but it would be nice to use something built into the Android dev system. Thanks

    Read the article

  • How to build OpenSSL in release mode with symbols?

    - by twk
    I generally build my openssl libs by doing this: perl Configure VC-WIN32 ms\do_masm nmake -f ms\ntdll.mak nmake -f ms\ntdll.mak test For debugging minidumps, I'd like to get a pdb file for the 2 dlls (while still building them in "release" mode). I've added /Zi to the CFLAGS part of ms\ntdll.mak, but I still get "Binary was not built with debug information" when I look at the in-memory modules in the visual studio debugger. Am I missing a step? Thanks

    Read the article

  • Seeking during mp3 streaming on Android

    - by twk
    I've got an android app that plays mp3s over HTTP. I give the Mediaplayer a URL using setDataSource, then call start in onPrepared, and all is well. Now, I'm trying to implement seeking. When i call seekTo, I don't see the Mediaplayer make a second request using the Range header to my webserver. From reading around, it seems like Android supports this. Do I need to do anything extra to get it to work? Thanks

    Read the article

  • Getting ImageView dimensions before adding the image

    - by twk
    I've got a RelativeLayout that contains these items: LinearLayout ImageView (weight = 1) LinearLayout So, the ImageView should expand and pin the other layouts on the top/bottom of the screen. I'm loading the ImageView using an image stored on a web server. However, I can fetch images of any size from the server, so I'd rather just fetch the exact image size I need. Thus, I need to get the size of the ImageView before I actually fill it in. How can I do this?

    Read the article

  • Downsampling and applying a lowpass filter to digital audio

    - by twk
    I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accurately anymore, so I assume I want to cut everything above that out too. Any ideas? Thanks. Update: There is some code on this page that converts from 48KHz to 8KHz using a simple algorithm and a coefficient array that looks like { 1, 4, 12, 12, 4, 1 }. I think that is what I need, but I need it for a factor of 4x rather than 6x. Any idea how those constants are calculated? Also, I end up converting the 16 byte samples to floats anyway, so I can do the downsampling with floats rather than shorts, if that helps the quality at all.

    Read the article

  • How to effectively measure developer's work hours?

    - by twk
    I have a few software developers working for my projects and I would like to provide them a way to register time they spent on real development. There is good will to register development hours, no force, but we try to avoid techniques like excel sheets register because this is so uncomfortable. I can track svn commits, but this is unreliable. Developers also helps supporting different projects during the day, so assuming they work on one project by whole day is not true. I've seen utilities that popups a message every hour to confirm the project you're working on but this is annoying. Some kind of active-window-title-anaylzer might help (you can get solution name from there in the case of Visual Studio) but I have no experience with such idea. If you have any experience with programmers/designers work hours registration, please share with me. Thanks

    Read the article

  • Interrupt an Http Request blocked in read() on Android

    - by twk
    Using the Apache Http stack on Android, I'm trying to force a thread out of a call to read. This is what the stack looks like: OSNetworkSystem.receiveStreamImpl(FileDescriptor, byte[], int, int, int) line: not available [native method] OSNetworkSystem.receiveStream(FileDescriptor, byte[], int, int, int) line: 478 PlainSocketImpl.read(byte[], int, int) line: 565 SocketInputStream.read(byte[], int, int) line: 87 SocketInputBuffer(AbstractSessionInputBuffer).fillBuffer() line: 103 SocketInputBuffer(AbstractSessionInputBuffer).read(byte[], int, int) line: 134 IdentityInputStream.read(byte[], int, int) line: 86 EofSensorInputStream.read(byte[], int, int) line: 159 Fetcher.readStream() line: 89 I've tried InputStream.close(), Thread.Interrupt(), and HttpUriRequest.abort(), without any success. Any ideas? I'm also open to some kind of non-blocking IO, but I don't see any way to do that with the HttpUriRequest object. Thanks!

    Read the article

  • What kind of storage with two-way replication for multi site C# application?

    - by twk
    Hi I have a web-based system written using asp.net backed by mssql. A synchronized replica of this system is to be run on mobile locations and must be available regardless of the state of the connection to the main system (few hours long interruptions happens). For now I am using a copy of the main web application and a copy of the mssql server with merge replication to the main system. This works unreliably, and setting the replication is a pain. The amount of data the system contains is not huge, so I can migrate to different storage type. For the new version of this system I would like to implement a new replication system. I am considering migration to db4o for storage with it's replication support. I am thinking about other possible solutions like couchdb which had native replication support. I would like to stay with C#. Could you recommend a way to go for such a distributed environment? PS. Master-Slave replication is not an option: any side must be allowed to add/update data.

    Read the article

  • Preventing EF4 ConstraintException when invoking TryUpdateModel

    - by twk
    Given following ASP.NET MVC controller code: [HttpPost] public ActionResult Create(FormCollection collection) { string[] whitelist = new []{ "CompanyName", "Address1", "Address2", ... }; Partner newPartner = new Partner(); if (TryUpdateModel(newPartner, whitelist, collection)) { var db = new mainEntities(); db.Partners.AddObject(newPartner); db.SaveChanges(); return RedirectToAction("Details/" + newPartner.ID); } else { return View(); } } The problem is with the Entity Framework 4: the example Partner entity is mapped to a database table with it's fields NOT ALLOWED to be NULL (which is ok by design - they're required). Unfortunately, invoking TryUpdateModel when some of the properties are nulls produces ConstraintException which is not expected! I do expect that TryUpdateModel return false in this case. It is ok that EF wouldn't allow set a property value to null if it should not be, but the TryUpdateMethod should handle that, and add the error to ModelState errors collection. I am wrong, or somebody screwed the implementation of TryUpdateModel method?

    Read the article

  • Machine leaning algorithm for data classification.

    - by twk
    Hi all, I'm looking for some guidance about which techniques/algorithms I should research to solve the following problem. I've currently got an algorithm that clusters similar-sounding mp3s using acoustic fingerprinting. In each cluster, I have all the different metadata (song/artist/album) for each file. For that cluster, I'd like to pick the "best" song/artist/album metadata that matches an existing row in my database, or if there is no best match, decide to insert a new row. For a cluster, there is generally some correct metadata, but individual files have many types of problems: Artist/songs are completely misnamed, or just slightly mispelled the artist/song/album is missing, but the rest of the information is there the song is actually a live recording, but only some of the files in the cluster are labeled as such. there may be very little metadata, in some cases just the file name, which might be artist - song.mp3, or artist - album - song.mp3, or another variation A simple voting algorithm works fairly well, but I'd like to have something I can train on a large set of data that might pick up more nuances than what I've got right now. Any links to papers or similar projects would be greatly appreciated. Thanks!

    Read the article

  • performance problem looping through table rows

    - by Sridhar
    Hi, I am using jquery to loop through table rows and save the data. If the table has 200 rows it is performing slow. I am getting the javascript message "Stop Running this script" in IE when I call this method. Following is the code I am using to loop through table rows. Can you please let me know if there is a better way to do this. function SaveData() { var $table = $('#' + gridid); var rows = $table.find('tbody > tr').get(); var transactions = []; var $row, empno, newTransaction, $rowChildren; $.each(rows, function(index, row) { $row = $(row); $rowChildren = $row.children("td"); if ($rowChildren.find("input[id*=hRV]").val() === '1') { empno = $rowChildren.find("input[id*=tEmpno]").val(); newTransaction = new Array(); newTransaction[0] = company; newTransaction[1] = $rowChildren.find("input[id*=tEmpno]").val(); newTransaction[2] = $rowChildren.find("input[id*=tPC]").val(); newTransaction[3] = $rowChildren.find("input[id*=hQty]").val(); newTransaction[4] = $rowChildren.find("input[id*=hPR]").val(); newTransaction[5] = $rowChildren.find("input[id*=tJC]").val(); newTransaction[6] = $rowChildren.find("input[id*=tL1]").val(); newTransaction[7] = $rowChildren.find("input[id*=tL2]").val(); newTransaction[8] = $rowChildren.find("input[id*=tL3]").val(); newTransaction[9] = $rowChildren.find("input[id*=tL4]").val(); newTransaction[10] = $rowChildren.find("input[id*=tL5]").val(); newTransaction[11] = $rowChildren.find("input[id*=tL6]").val(); newTransaction[12] = $rowChildren.find("input[id*=tL7]").val(); newTransaction[13] = $rowChildren.find("input[id*=tL8]").val(); newTransaction[14] = $rowChildren.find("input[id*=tL9]").val(); newTransaction[15] = $rowChildren.find("input[id*=tL10]").val(); newTransaction[16] = $rowChildren.find("input[id*=tSF]").val(); newTransaction[17] = $rowChildren.find("input[id*=tCG]").val(); newTransaction[18] = $rowChildren.find("input[id*=tTF]").val(); newTransaction[19] = $rowChildren.find("input[id*=tWK]").val(); newTransaction[20] = $rowChildren.find("input[id*=tAI]").val(); newTransaction[21] = $rowChildren.find("input[id*=tWC]").val(); newTransaction[22] = $rowChildren.find("input[id*=tPI]").val(); newTransaction[23] = "E"; var record = newTransaction.join(';'); transactions.push(record); } }); if (transactions.length > 0) { var strTransactions = transactions.join('|'); //send data to server //here ajax function is called to save data. } }

    Read the article

1