Daily Archives

Articles indexed Thursday April 1 2010

Page 3/126 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to unpack htmlAttributes in a span tag in ASP.NET MVC

    - by sleepy
    I have htmlAttributes generated - originally for the purpose of creating a link with the attribute using Html.ActionLink. Now, based on some condition, I would like to create a <span> tag instead and put the attributes in there. Is there anyway it can be done easily ? Eg: something like: <span <%= htmlAttributes.Unpack() %> > Some txt </span> OR <%= Html.SpanTag("Some txt", htmlAttributes) %> OR anything similar without wresling too much with the already generated htmlAttribues? Thanks

    Read the article

  • Getting started with Festival on iphone

    - by Moshe
    I'd like to use Festival in an iPhone app. Is this possible, considering the way Festival generates and then plays back audio files? Can I pass Festival an audio file directly from itself to play back? or is there a different way to read things? Is there another Text-to-speech engine for C/C++ to use with iphone?

    Read the article

  • Java - When to use Iterators?

    - by Walter White
    Hi all, I am trying to better understand when I should and should not use Iterators. To me, whenever I have a potentially large amount of data to iterate through, I write an Iterator for it. If it also lends itself to the Iterator interface, then it seems like a win. I was reading a little bit that there is a lot of overhead with using an Iterator. A good example of where I used an Iterator was to iterate through a bunch of SQL scripts to execute one query at a time, reading it in, then executing it. Is there another performance trade off I should be aware of? Before I used iterators, I would read the entire String of SQL commands to execute into an ArrayList, and the iterate through that. If the import is rather large (like for geolocation data, then the server tends to get bogged down). Walter

    Read the article

  • write() causes fatal crash when filedescriptor becomes invalid

    - by ckrames1234
    I'm writing an iPhone App with a webserver in it. To handle a web request, I take the web request and write() to it the data that I want to send back. When I try to download a moderately sized file (3-6MB) it works fine, but if I cancel the download halfway through, the app crashes and leaves no trace of an error. I'm thinking that the file descriptor becomes invalid halfway through the write, and causes the crash. I really don't know if this is what causes the crash, i'm just assuming. I'm basing my webserver off of this example. NSString *header = @""; NSData *data = [NSData dataWithContentsOfFile:fullPath]; write (fd, [header UTF8String], [header length]); write(fd, [data bytes], [data length]); close(fd); Does anyone know how to fix this? I was thinking about chunking the data and then writing each part, but I don't think it would help.

    Read the article

  • jQuery changing fields to substring of related field

    - by Katherine
    Another jquery calculation question. I've this, which is sample code from the plugin site that I am playing with to get this working: function recalc(){ $("[id^=total_item]").calc( "qty * price", { qty: $("input[name^=qty_item_]"), price: $("input[name^=price_item_]"), }, function (s){ return s.toFixed(2);}, function ($this){ var sum = $this.sum(); $("#grandTotal").val( // round the results to 2 digits sum.toFixed(2) ); } ); } Changes in the price fields cause the totals to update: $("input[name^=price_item_]").bind("keyup", recalc); recalc(); Problem is I won't know the value of the price fields, they will be available to me only as a substring of values entered by the user, call it 'itemcode'. There will be a variable number of items, based on a php query. I've come up with this to change the price based on the itemcode: $("input[name^='itemcode_item_1']").keyup(function () { var codeprice = this.value.substring(2,6); $("input[name^='price_item_1']").val(codeprice); }); $("input[name^='itemcode_item_2']").keyup(function () { var codeprice = this.value.substring(2,6); $("input[name^='price_item_2']").val(codeprice); }); However while it does that, it also stops the item_total from updating. Also, I feel there must be a way to not need to write a numbered function for each item on the list. However when I just use $("input[name^='itemcode_item_']") updating any itemcode field updates all price fields, which is not good. Can anyone point me in the right direction? I know I am a bit clueless here, but javascript of any kind is not my thing.

    Read the article

  • visual studio localhost server can't locate file

    - by mhenk
    i have a very simple web project. just one htm file with some javascript that opens a file test.xml. the xml file is in the same folder as the htm file (and it is part of the project) but when i start the page (f5 or ctrl-f5) it can't find the xml. it starts as http://localhost:50586/main.htm when i do a folder list the test.xml file is right there. opening the page directly in firefox works fine and the script can read and extract data from the xml. how can i convince the development server that the xml is indeed there?? or better still: how can i turn the development server off entirely? for my purposes simply opening the page in my browser is all i need and that should happen from within vs of course.

    Read the article

  • How to use generic (NSObject) controller with subviews of a UIViewController?

    - by wanderlust
    I have a UIViewController that is loading several subviews at different times based on user interaction. I originally built all of these subviews in code, with no nib files. Now I am moving to nib files with custom UIView subclasses. Some of these subviews display static data, and I am using loadNibNamed:owner:options: to load them into the view controller. Others contain controls that I need to access. I (sort of) understand the reasons Apple says to use one view controller per screen of content, using generic controller objects (NSObjects) to manage subsections of a screen. So I need a view controller, a generic controller, a view class and a nib. How do I put this all together? My working assumptions and subsequent questions: I will associate the view class with the nib in the 'class identity' drop down in IB. The view controller will coordinate overall screen interactions. When necessary, it will create an instance of the generic controller. Does the generic controller load the nib? How? Do I define the outlets and actions in that view class, or should they be in the generic controller? How do I pass messages between the view controller and the generic controller? If anyone can point me to some sample code using a controller in this way, it will go a long way to helping me understand. None of the books or stackoverflow posts I've read have quite hit the spot yet.

    Read the article

  • Does performance even matter anymore? [closed]

    - by Jeff Dahmer
    The performance differences between C/C++ and C# are astounding. An ASP.NET page loads in 1/8 the time that a PHP script does haha.... WPF, aka " The Future ", (you know it will be, all the companies are gonna want cool looking desktop apps, don't kid yourself.) And it has huge performance hits just to start up. We've let Microsoft make us as developers lazy! Why do I hate this, it's such a good thing? Are we at a point in time where the majority of computers can handle this kinda crap? I remember when performance used to matter. Anyways, I'm writing a .NET library and ever since I found out LINQ is slower than traditional delegates which is slower than the normal procedural code... well it's a guilty evil I feel for every LINQ query I write, because they are so beautiful. Am I just too much of a performance stickler? Or just too big of a nerd?

    Read the article

  • Why is "rake tests" running an empty suite when I use shoulda?

    - by ryeguy
    So here is my test suite: class ReleaseTest < ActiveSupport::TestCase should_not_allow_values_for :title, '', 'blah', 'blah blah' should_allow_values_for :title, 'blah - bleh', 'blah blah - bleh bleh' def test_something assert true end end Shoulda's macros generate 5 tests, and then I have test_something below (just to see if that would matter), totalling 6 tests. They all pass as you can see below, but then it runs a 0-test suite. This happens even if I completely empty out ReleaseTest. This problem only exists if I have config.gem 'shoulda' in my environment.rb. If I explicitly do require 'shoulda' at the top of my tests, everything works fine. What would be causing this? /usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /var/lib/gems/1.9.1/bin/rake test Testing started at 6:58 PM ... (in /home/rlepidi/projects/rails/testproject) /usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/release_test.rb" Loaded suite /var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader Started ...... Finished in 0.029335778 seconds. 6 tests, 6 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed /usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" /usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" Loaded suite /var/lib/gems/1.9.1/bin/rake Started Finished in 0.000106717 seconds. 0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 0% passed Empty test suite.

    Read the article

  • Where can I find a good software implementation plan template?

    - by Corpsekicker
    This is not "programming" related as much as it is "software engineering" related. I am required to produce an implementation for additional functionality to a complete system. All I am armed with is knowledge of the existing architecture and a functional spec with visual requirements, user stories and use cases. Is there a standardised way to go about this? I suck at documentation.

    Read the article

  • .htaccess equivalent of baseurl?

    - by Ryan
    Hello, I'm trying to install Symfony on a shared server and am attempting to duplicate the httpd.conf command: # Be sure to only have this line once in your configuration NameVirtualHost 127.0.0.1:8080 # This is the configuration for your project Listen 127.0.0.1:8080 <VirtualHost 127.0.0.1:8080> DocumentRoot "/home/sfproject/web" DirectoryIndex index.php <Directory "/home/sfproject/web"> AllowOverride All Allow from All </Directory> Alias /sf /home/sfproject/lib/vendor/symfony/data/web/sf <Directory "/home/sfproject/lib/vendor/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost> I need to do so using .htaccess The redirect portion was done in the root using the following: Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^symfony.mysite.ca [nc] rewriterule ^(.*)$ http://symfony.mysite.ca/web/$1 [r=301,nc] For the alias, I've tried using: RewriteBase / but no success. The main issue is that the index.php file residing in the /web folder uses the /web path in its path to images and scripts. So instead of href="/css/main.css" //this would work it uses href="/web/css/main.css" //this doesn't work, already in the /web/ directory! Any ideas? Thanks!

    Read the article

  • WPF custom BalloonTips problem with multithreading

    - by Erika
    Hi, I have read other related question but i cant really get them to relate to this so I thought it were best to ask, Im pretty new to WPF and so on so please bear with me. I am using this http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx api to work with custom WPF Windows (in particular FancyBalloon). However, i'm coming across the following problem, I seem unable to start off BalloonTips in a separate thread ( i need this because i'm parsing emails and hence if there are 3 emails for instance, it displays the first email (that works fine), but when it comes to the second email it crashes with a TargetInvocationException , {"Specified element is already the logical child of another element. Disconnect it first."}. Thing is, im supposedly working with the same instance and i have attempted calling it to close it before, disposing it etc but to no avail. (then again if i dispose it, i cant create another instance as apparently WPF UI components must be called from a static thread so throughout the looping of emails + displaying balloon, i am trying to use the same BalloonTip. Any suggestions please? I am really at a loss here and i've been on it for quite a while now :/ I was wondering if there was anyone

    Read the article

  • Simple, fast SQL queries for flat files.

    - by plinehan
    Does anyone know of any tools to provide simple, fast queries of flat files using a SQL-like declarative query language? I'd rather not pay the overhead of loading the file into a DB since the input data is typically thrown out almost immediately after the query is run. Consider the data file, "animals.txt": dog 15 cat 20 dog 10 cat 30 dog 5 cat 40 Suppose I want to extract the highest value for each unique animal. I would like to write something like: cat animals.txt | foo "select $1, max(convert($2 using decimal)) group by $1" I can get nearly the same result using sort: cat animals.txt | sort -t " " -k1,1 -k2,2nr And I can always drop into awk from there, but this all feels a bit awkward (couldn't resist) when a SQL-like language would seem to solve the problem so cleanly. I've considered writing a wrapper for SQLite that would automatically create a table based on the input data, and I've looked into using Hive in single-processor mode, but I can't help but feel this problem has been solved before. Am I missing something? Is this functionality already implemented by another standard tool? Halp!

    Read the article

  • Asynchronous subprocess on Windows

    - by Stigma
    First of all, the overall problem I am solving is a bit more complicated than I am showing here, so please do not tell me 'use threads with blocking' as it would not solve my actual situation without a fair, FAIR bit of rewriting and refactoring. I have several applications which are not mine to modify, which take data from stdin and poop it out on stdout after doing their magic. My task is to chain several of these programs. Problem is, sometimes they choke, and as such I need to track their progress which is outputted on STDERR. pA = subprocess.Popen(CommandA, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # ... some more processes make up the chain, but that is irrelevant to the problem pB = subprocess.Popen(CommandB, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=pA.stdout ) Now, reading directly through pA.stdout.readline() and pB.stdout.readline(), or the plain read() functions, is a blocking matter. Since different applications output in different paces and different formats, blocking is not an option. (And as I wrote above, threading is not an option unless at a last, last resort.) pA.communicate() is deadlock safe, but since I need the information live, that is not an option either. Thus google brought me to this asynchronous subprocess snippet on ActiveState. All good at first, until I implement it. Comparing the cmd.exe output of pA.exe | pB.exe, ignoring the fact both output to the same window making for a mess, I see very instantaneous updates. However, I implement the same thing using the above snippet and the read_some() function declared there, and it takes over 10 seconds to notify updates of a single pipe. But when it does, it has updates leading all the way upto 40% progress, for example. Thus I do some more research, and see numerous subjects concerning PeekNamedPipe, anonymous handles, and returning 0 bytes available even though there is information available in the pipe. As the subject has proven quite a bit beyond my expertise to fix or code around, I come to Stack Overflow to look for guidance. :) My platform is W7 64-bit with Python 2.6, the applications are 32-bit in case it matters, and compatibility with Unix is not a concern. I can even deal with a full ctypes or pywin32 solution that subverts subprocess entirely if it is the only solution, as long as I can read from every stderr pipe asynchronously with immediate performance and no deadlocks. :)

    Read the article

  • How to refresh/reload page once using jQuery?

    - by Pete
    Hi! Newbie question: I'm wondering how to refresh/reload a page (or even specific div) once(!) using jQuery? Ideally in a way right after the "DOM structure" is available (cf. "onload" event) and not negatively affecting "back button" or "bookmark" functionalities. Please note: ''replace('' is not allowed due to third-party restrictions. Thanks in advance! --Pete

    Read the article

  • Location.getTime() returning a future time.

    - by fiXedd
    The following code: // get the last known location Criteria c = new Criteria(); c.setAccuracy(Criteria.ACCURACY_FINE); Location lastKnown = mLocationManager.getLastKnownLocation(mLocationManager.getBestProvider(c, true)); // compare times long currentTime = System.currentTimeMillis(); long gpsTime = lastKnown.getTime(); long age = (currentTime - gpsTime) / 1000; Gives me: currentTime = 1270062152738 gpsTime = 1270085378000 age = -23225 If you'll notice, it's returning the last location fix's time as a time in the future. Why is this happening? EDIT: From Location.getTime() : Returns the UTC time of this fix, in milliseconds since January 1, 1970. From System.currentTimeMillis() : Returns the current system time in milliseconds since January 1, 1970 00:00:00 UTC. This method shouldn't be used for measuring timeouts or other elapsed time measurements, as changing the system time can affect the results.

    Read the article

  • iphone SDK buttons control views

    - by mangnv
    Hi, all I'v just started to learn SDK. I have several questions. First. I will do the project about university APP. if u clike the app, then u can c several buttons on one page, then each button( eg: event, BBS,courses, map....) has specific function...each one connect to anohter view. Are they buttons on the main page? Second, how to deal with one view has several buttons, one button connect to other view? Third, how to deal with controller classes? I'd like to make a app like this way. Main Page has 6 buttonss(event, community, directory...), take community for eg: community has two functions( Notices and BBS). if i clike Notices, then i can read notices, and if i clike BBS, then i could also read BBS. The thing that i do not get is..how to deal with classes. I mean main Page has one controller classes that control 6 buttons? If my question is not so clearly, then let me know....I really need help~

    Read the article

  • How to aggregate bindings in Silverlight UserControl

    - by Peter Wone
    Imagine a UserControl containing some sort of ItemsControl. The UserControl as a whole has a DataContext, but you also need to expose the ItemsSource of the ItemsControl. I have tried all manner of arrangements, and eventually passed a DomainDataSource as a UserControl dependency property named DDS, and bound the ItemsControl like this: ItemsSource="{Binding DDS.Data, ElementName=userControl}" It works, but this is mucky, and with Silverlight mucky is nearly always a sign of incorrect approach. Your advice is sought. It looks like multi-bindings might be the answer to this.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >