Search Results

Search found 11972 results on 479 pages for 'writing'.

Page 69/479 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Localizing a JSF 1.2 application with UTF-8 resources

    - by Filini
    (WARNING: this is my first java application, coming from .NET, so don't bash me if I write too much garbage) I'm developing a simple JSF 1.2 web application which should support Russian, Chinese, and other languages outside ISO 8859-1, which is automatically used in Properties.load(). Is there a way to use the Properties loaded from XML files, with Properties.loadFromXml(), inside JSF, without writing too much code? I know there are alternative ways to do so (writing my own loader, escaping the characters...), but I'd really love to find a simple solution, and I don't see it in all the forums I checked. Thanks in advance for any help

    Read the article

  • Overhead of serving pages - JSPs vs. PHP vs. ASPXs vs. C

    - by John Shedletsky
    I am interested in writing my own internet ad server. I want to serve billions of impressions with as little hardware possible. Which server-side technologies are best suited for this task? I am asking about the relative overhead of serving my ad pages as either pages rendered by PHP, or Java, or .net, or coding Http responses directly in C and writing some multi-socket IO monster to serve requests (I assume this one wins, but if my assumption is wrong, that would actually be most interesting). Obviously all the most efficient optimizations are done at the algorithm level, but I figure there has got to be some speed differences at the end of the day that makes one method of serving ads better than another. How much overhead does something like apache or IIS introduce? There's got to be a ton of extra junk in there I don't need. At some point I guess this is more a question of which platform/language combo is best suited - please excuse the in-adroitly posed question, hopefully you understand what I am trying to get at.

    Read the article

  • f# string.Format

    - by mamu
    I am writing my first f# library i am trying to use string.Format and it complains that no such function Is it not available or am i doing something wrong

    Read the article

  • Ruby Metaprogramming

    - by Veerendra Manikonda
    I am having a method which returns the price of a given symbol and i am writing a test for that method. This is my test def setup @asset = NetAssetValue.new end def test_retrieve_price_for_symbol_YHOO assert_equal(33.987, @asset.retrieve_price_for_a_symbol('YHOO')) end def test_retrive_price_for_YHOO def self.retrieve_price_for_a_symbol(symbol) 33.77 end assert_equal(33.97, @asset.retrieve_price_for_a_symbol('YHOO')) end This is my method. def retrieve_price_for_a_symbol(symbol) symbol_price = { "YHOO" => 33.987, "UPS" => 35.345, "T" => 80.90 } raise Exception if(symbol_price[symbol].nil?) symbol_price[symbol] end I am trying to mock the retrieve_price_for_a_symbol method by writing same method in test class but when i call it, the call is happening to method in main class not in the test class. How do I add that method to meta class from test and how do i call it? Please help.

    Read the article

  • How to do visible EditText Data on Activity change

    - by user1249134
    HellO friends i am having edit text in my program and if i am writing some thing on there and if i am clciking on other option which will move to anothe activity and when i am coming back to same page the data of my edit text is clearing i dont want to clear data if i move on another page can any body tell me how to do it ..i am doing it by writing below code.. if(PresetQuestion.value=="true") { String note1=note.getText().toString(); note.setText(note1); } but its not woring i thing i am not doing correctly ...

    Read the article

  • How can I give some basic text editing functionality to a firefox plugin?

    - by roddik
    Hello. I'm writing a plugin to Firefox, which is basically a sidebar, that is filled with yaml-formatted information based on what user does on the page (just another web testing solution). I want to enable user to change generated text manually right in the sidebar and: Add code-folding (folding click: \n text: some text to a single line) Add highlighting of registered actions (click, fill and so on) and unregistered actions (syntax errors) How do I do that? Is placing an iframe to the sidebar and trying to do that with html/js the best solution (seen it in a similar one)? As you may have noticed, I'm a newbie in plugin writing, so please excuse if anything.

    Read the article

  • Are there design-time watch windows for Visual Studio 2008/2010?

    - by Jeff
    There are many times when I need to test a little snippet of .net code but rebuilding and publishing the entire project or writing a suite of unit tests just seems like overkill. For example, I am writing a regular expression right now and I want to see if it the pattern is matching on the right parts. I could go and find a million other utilities that do that sort of thing, but that is not exactly my point. FireBug has an exact analogue to what I want - the FireBug console. There is a text box where the user can enter some JavaScript and FireBug will execute it on the spot and display the return value. I would love to be able to enter something like (new Regex("b+")).Replace("abc", "x") and see the results without having to do all the overhead. Does VS have anything like this?

    Read the article

  • Tests that are 2-3 times bigger than the testable code

    - by HeavyWave
    Is it normal to have tests that are way bigger than the actual code being tested? For every line of code I am testing I usually have 2-3 lines in the unit test. Which ultimately leads to tons of time being spent just typing the tests in (mock, mock and mock more). Where are the time savings? Do you ever avoid tests for code that is along the lines of being trivial? Most of my methods are less than 10 lines long and testing each one of them takes a lot of time, to the point where, as you see, I start questioning writing most of the tests in the first place. I am not advocating not unit testing, I like it. Just want to see what factors people consider before writing tests. They come at a cost (in terms of time, hence money), so this cost must be evaluated somehow. How do you estimate the savings created by your unit tests, if ever?

    Read the article

  • Efficient way to access a mapping of identifiers in Python

    - by sixbelo
    I am writing an app to do a file conversion and part of that is replacing old account numbers with a new account numbers. Right now I have a CSV file mapping the old and new account numbers with around 30K records. I read this in and store it as dict and when writing the new file grab the new account from the dict by key. My question is what is the best way to do this if the CSV file increases to 100K+ records? Would it be more efficient to convert the account mappings from a CSV to a sqlite database rather than storing them as a dict in memory?

    Read the article

  • ' \r ' vs ' \n ' in C

    - by MCP
    I'm writing a function that basically waits for the user to hit "enter" and then does something. What I've found that works when testing is the below: #include <stdio.h> int main() { int x = getc(stdin); if (x == '\n') { printf("carriage return"); printf("\n"); } else { printf("missed it"); printf("\n"); } } The question I have, and what I tried at first was to do: "if (x == '\r')" but in testing, the program didn't catch me hitting enter. The '\n' seems to correspond to me hitting enter from the console. Can someone explain the difference? Also, to verify, writing it as "if... == "\n"" would mean the character string literal? Ie the user would literally have to enter "\n" from the console, correct? Thanks!

    Read the article

  • Is pthread_spin_trylock safe inside of sigsegv handler of multithreaded application?

    - by TWMouton
    I am trying to implement a handler that on SIGSEGV will collect some information such as process-id, thread-id and a backtrace and write this information to a file/pipe/socket. The problem lies in that there is the (probably pretty high) possibility that if one thread experienced a SIGSEGV that the others will shortly follow. If two threads happen to make it to the bit of code where they're writing their report out at the same time then they'll interleave their writing (to the same file). I know that I should only be using async-signal-safe functions as detailed in signal(7) I also have seen at least two cases here and video linked in top answer here where others have used pthread_spin_trylock to get around this problem. Is this a safe way to prevent the above problem?

    Read the article

  • FTP: check whether file is closed

    - by Andrey
    Hello! My FTP client (apache commons ftpclient) needs to download file from FTP. The problem is that an external service may not have finished writing to this file before I start downloading. Is there any way to determine via FTP whether the file is already closed (i.e. there is no writing handlers opened)? The problem is that I cannot synchronize with that external service. But I mustn't download file which is not finished yet (a large JPEG). Thanks in advance!

    Read the article

  • Any custom/third party Visual C# text box Controls with extra features?

    - by PlaZmaZ
    I'm writing a program that uses the textbox in visual C# to read a log file. When dealing with very large amounts of text, writing to the textbox is incredibly slow. The textbox also lacks many features. Are there any custom textbox controls that are faster, or even a sort of embedded editor (with ability to highlight certain words, indent, input bookmarks)? Many of the features I want are programmable, but it would be nice if there was a faster textbox or one that already had these features :) Thanks.

    Read the article

  • Python 2.6 - I can not write dwords greater than 0x7fffffff into registry using _winreg.SetValueEx()

    - by stasizke
    using regedit.exe I have manually created a key in registry called HKEY_CURRENT_USER/00_Just_a_Test_Key and created two dword values dword_test_1 and dword_test_2 I am trying to write some values into those two keys using following program import _winreg aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_CURRENT_USER) aKey = _winreg.OpenKey(aReg, r"00_Just_a_Test_Key", 0, _winreg.KEY_WRITE) _winreg.SetValueEx(aKey,"dword_test_1",0, _winreg.REG_DWORD, 0x0edcba98) _winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 0xfedcba98) _winreg.CloseKey(aKey) _winreg.CloseKey(aReg) I can write into the first key, dword_test_1, but when I attempt to write into the second, I get following message Traceback (most recent call last): File "D:/src/registry/question.py", line 7, in <module> _winreg.SetValueEx(aKey,"dword_test_2",0, _winreg.REG_DWORD, 0xfedcba98) ValueError: Could not convert the data to the specified type. How do I write the second value 0xfedcba98, or any value greater than 0x7fffffff as a dword value? Originally I was writing script to switch the "My documents" icon on or off by writing "0xf0500174" to hide or "0xf0400174" to display the icon into [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID{450D8FBA-AD25-11D0-98A8-0800361B1103}\ShellFolder]

    Read the article

  • [perl] where can i find an array of the Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • Identify machine (relatively) uniquely using unc path

    - by Gareth
    Using C#, and given that the user enters in a unc path. Is there a way to verify that 2 months down the line, when I'm writing a file to the unc path, that it is the same machine as when he entered it? i.e. I'm writing some sensitive information to the path, and want to stop someone from putting another machine on the network with the same name / share etc and grabbing the output. Or if the software is running on a laptop and the user plugs it into another network, and there just happens to be a machine with the same name / share... Any ideas, other than using the IP address (and verifying that its the same?). I don't necessarily have any rights on the remote machine other than write access to the unc share. Yes, I'm probably being paranoid, but would like to know if anything is possible...

    Read the article

  • How should I mock out my data connectivity

    - by BobTheBuilder
    I'm trying to unit test my Data Access Layer and I'm in the process of trying to mock my data connectivity to unit test my DAL and I'm coming unstuck trying to mock out the creation of the commands. I thought about using a queue of IDbParameters for the creation of the parameters, but the unit tests then require that the parameters are configured in the right order. I'm using MOQ and having looked around for some documentation to walk me through this, I'm finding lots of recommendation not to do this, but to write a wrapper for the connection, but it's my contention that my DAL is supposed to be the wrapper for my database and I don't feel I should be writing wrappers... if I do, how do I unit test the connectivity to the database for my wrapper? By writing another wrapper? It seems like it's turtles all the way down. So does anyone have any recommendations or tutorials regarding this particular area of unit testing/mocking?

    Read the article

  • Where can I find an array of the Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • Is there a way to test if a scalar has been stringified or not?

    - by Yobert
    I am writing a thing to output something similar to JSON, from a perl structure. I want the quoting to behave like this: "string" outputs "string" "05" outputs "05" "5" outputs "5" 5 outputs 5 05 outputs 5, or 05 would be acceptable JSON::XS handles this by testing if a scalar has been "stringified" or not, which I think is very cool. But I can't find a way to do this test myself without writing XS, which I'd rather avoid. Is this possible? I can't find this anywhere on CPAN without finding vast pedantry about Scalar::Util::looks_like_number, etc which completely isn't what I want. The only stopgap I can find is Devel::Peek, which feels evil. And also, just like JSON::XS, I'm fine with this secenario: my $a = 5; print $a."\n"; # now $a outputs "5" instead of 5)

    Read the article

  • Ways to Unit Test Oauth for different services in ruby?

    - by viatropos
    Are there any best practices in writing unit tests when 90% of the time I'm building the Oauth connecting class, I need to actually be logging into the remote service? I am building a rubygem that logs in to Twitter/Google/MySpace, etc., and the hardest part is making sure I have the settings right for that particular provider, and I would like to write tests for that. Is there a recommended way to do that? If I did mocks or stubs, I'd still have to spend that 90% of the time figuring out how to use the service, and would end up writing tests after the fact instead of before...

    Read the article

  • How to check an exectuable's path is correct in PHP?

    - by nickf
    I'm writing a setup/installer script for my application, basically just a nice front end to the configuration file. One of the configuration variables is the executable path for mysql. After the user has typed it in (for example: /path/to/mysql-5.0/bin/mysql or just mysql if it is in their system PATH), I want to verify that it is correct. My initial reaction would be to try running it with "--version" to see what comes back. However, I quickly realised this would lead to me writing this line of code: shell_exec($somethingAUserHasEntered . " --version"); ...which is obviously a Very Bad Thing. Now, this is a setup script which is designed for trusted users only, and ones which probably already have relatively high level access to the system, but still I don't think the above solution is something I want to write. Is there a better way to verify the executable path? Perhaps one which doesn't expose a massive security hole?

    Read the article

  • How to restore data on Power Failure using C++ programming on windows.

    - by Tarun
    Hi, In my program I am writing a file of my programs states. I am writing the file many times to the file during the program run, because the program changes some variables that that i need to store very frequently. Now, if , for some reasons my power fails. Then most of the time I loose data in that file. Please, tell me any mechanism which can protect data even if the power fails. (I have written C++ program on windows). Thank you

    Read the article

  • In linux, is it possible to do partial reads on a regular file

    - by Jimm
    I need to write an application that spits out log entries to a regular file at a very fast rate. Also, there will be another process, that can read the same file concurrently at the time, other process would be writing to it. I have following questions How does read() determine EOF, specially in the case, where the underlying file could be concurrently being modified? Is it possible for read() to return partially written data from the other process write? For example, the write process wrote half a line and read would pick that half line and return? The application would be written in C on linux 2.6.x using Ex4 filesystem UPDATE: Below link points to the patch, that locks inode in EXT4, before reading and writing. http://patchwork.ozlabs.org/patch/91834/

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >