Search Results

Search found 15210 results on 609 pages for 'technical writing'.

Page 32/609 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Writing tests for Rails plugins

    - by Adam
    I'm working on a plugin for Rails that would add limited in-memory caching to ActiveRecord's finders. The functionality itself is mature enough, but I can't for the life of me get unit tests to work with the plugin. I now have under vendor/plugins/my_plugin/test/my_plugin_test.rb a standard subclass of ActiveSupport::TestCase with a couple of basic tests. I try running 'rake test' from the plugin directory, and I have confirmed that this task loads the ruby file with the test case, but it doesn't actually run any of the tests. I followed the Rails plugin guide (http://guides.rubyonrails.org/plugins.html) where applicable, but it seems to be horribly outdated (it suggests things that Rails now do automatically, etc.) The only output I get is this: Kakadu:ingenious_record adam$ rake test (in /Users/adam/Sites/1_PRK/vendor/plugins/ingenious_record) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:lib:test "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/ingenious_record_test.rb" The simplest test case looks like this: require 'test_helper' require 'active_record' class IngeniousRecordTest < ActiveSupport::TestCase test "example" do assert false end end This should definitely produce at least some output, and the only test in that file should produce a failed assertion. Any ideas what I could do to get Rails to run my tests?

    Read the article

  • Writing to a specific line of a file.

    - by helpmeh
    I have a .dat file with data like this in "James","Project5","15/05/2010","3" "Matt","Project1","01/05/2010","5" "Ellie","Project5","24/04/2010","1" "Ellie","Project2","10/05/2010","3" "Matt","Project3","03/05/2010","4" It gets written in with thise code. Private Sub Command2_Click() Open jobs For Append As #1 Write #1, Combo1, Combo3, Combo2, Text3 Close #1 End Sub I instead would like to write it to the file so that if a persons name is already in the file then it would just put the data in the file, under their that is already there but without the name. I can't figure out how to do this but this is what I would like it to end up like. "James","Project5","15/05/2010","3" "Matt","Project1","01/05/2010","5" "Ellie","Project5","24/04/2010","1" "Project2","10/05/2010","3" "Matt","Project3","03/05/2010","4" Any help would be fantastic!

    Read the article

  • Best Practise for Writing a POS System

    - by Gary
    Hi, I'm putting together a basic POS system in C# that needs to print to a receipt printer and open a cash drawer. Do I have to use the Microsoft Point of Service SDK? I've been playing around with printing to my Samsung printer using the Windows driver that came with it, and it seems to work great. I assume though that other printers may not come with Windows drivers and then I would be stuck? Or would I be able to simply use the Generic/Text Driver to print to any printer that supports it? For the cash drawer I would need to send codes directly to the COM port which is fine with me, if it saves me the hassle of helping clients setup OPOS drivers on there systems. Am I going down the wrong path here? Thanks, Gary

    Read the article

  • utf8 codification problem C#, writing a tex file, and compiling with pdflatex

    - by voodoomsr
    Hi, i have the next code written in C#....it create a tex file using utf-8.....the problem is that appears that is not a real valid utf-8 file because, when i use pdflatex it doesn't recognize the characters with accents. Somebody knows a way to write a real UTF-8 file? When i use TexmakerX to create a utf8 file with the same latex code, pdflatex doesn't complaints, so the problem must be in the generation. FileInfo file = new FileInfo("hello.tex"); StreamWriter writer = new StreamWriter("hello.tex", false, Encoding.UTF8); writer.Write(@"\documentclass{article}" + "\n" + @"\usepackage[utf8]{inputenc}" + "\n" + @"\usepackage[spanish]{babel}" + "\n" + @"\usepackage{listings}" + "\n" + @"\usepackage{fancyvrb}" + "\n" + @"\begin{document}" + "\n" + @"\title{asd}" + "\n" + @"\maketitle" + "\n" + @"\section{canción}" + "\n" + @"canción" + "\n" + @"\end{document}"); writer.Close();

    Read the article

  • Writing Google chrome extension for GET query

    - by Yada
    I'm trying to write a Google chrome extension so that I can highlight text that appear on any website and perform at GET query to another website. It will open the query in new tab. For example if I highlight the text "google chrome" and right click to activate the chrome extension it will open http://example.com/index.php?q=google%20chrome in a new tab. What the best way to go about doing this?

    Read the article

  • Can someone provide an example of seeking, reading, and writing a >4GB file using boost iostreams

    - by Queueless
    I have read that boost iostreams supposedly supports 64 bit access to large files semi-portable way. Their FAQ mentions 64 bit offset functions, but there is no examples on how to use them. Has anyone used this library for handling large files? A simple example of opening two files, seeking to their middles, and copying one to the other would be very helpful. Thanks.

    Read the article

  • Writing a Makefile.am to invoke googletest unit tests

    - by jmglov
    I am trying to add my first unit test to an existing Open Source project. Specifically, I added a new class, called audio_manager: src/audio/audio_manager.h src/audio/audio_manager.cc I created a src/test directory structure that mirrors the structure of the implementation files, and wrote my googletest unit tests: src/test/audio/audio_manager.cc Now, I am trying to set up my Makefile.am to compile and run the unit test: src/test/audio/Makefile.am I copied Makefile.am from: src/audio/Makefile.am Does anyone have a simple recipe for me, or is it to the cryptic automake documentation for me? :)

    Read the article

  • Error on writing data to DVD

    - by sijith
    Hi, From past 1 week i stuck on this please help me i am attaching code. bool DVDBurner::Burner() { m_hResult = CoCreateInstance(__uuidof(MsftDiscFormat2Data), NULL, CLSCTX_INPROC_SERVER, __uuidof(IDiscFormat2Data), (void**)&m_discFormatData); if (!SUCCEEDED(m_hResult)) { qDebug()<<"Unable to Initialize IDiscFormat2Data "; return false; } m_hResult = CoCreateInstance(__uuidof(MsftDiscRecorder2), NULL, CLSCTX_INPROC_SERVER, __uuidof(IDiscRecorder2), (void**)&m_discRecorder); if (FAILED(m_hResult)) { qDebug()<<"Unable to Initialize IDiscRecorder2 Data "; return false; } BSTR bstrDeviceName; HRESULT hr = S_OK; BOOL bComInitialised; UINT iCounter = 0; LONG lValue = 0; LONG iCount; bComInitialised = SUCCEEDED(CoInitializeEx(0, COINIT_MULTITHREADED)); // Create an object of IDiscMaster2 if (SUCCEEDED(hr)){ CoCreateInstance( CLSID_MsftDiscMaster2, NULL, CLSCTX_ALL, IID_PPV_ARGS(&discMaster) ); if(FAILED(hr)){ qDebug()<<"\nUnsuccessful in creating an instance of CLSID_MsftDiscMaster2.\n\nError returned: 0x%x\n"<<hr; return 0; } } /////////////////////////// Get the number of drives/////////////////////////////// if (SUCCEEDED(hr)){ hr = discMaster->get_Count(&lValue); if (SUCCEEDED(hr)){ printf("lValue %d\n\n",lValue); } } ////////////////////////// Print all the optical drives attached to the system//// if (SUCCEEDED(hr)){ for(iCount = 0; iCount < lValue; iCount++) { hr = discMaster->get_Item(iCount, &bstrDeviceName); qDebug()<<"\nUnique identifier of the disc device associated with index"<< iCount<< bstrDeviceName; } } m_hResult = m_discRecorder->InitializeDiscRecorder(bstrDeviceName); if (!SUCCEEDED(m_hResult)) { qDebug()<<"IDiscFormat2Data->InitializeDiscRecorder Failed "; return false; } LPCWSTR pszFile=L"D:\\Test\\output.txt"; ULONGLONG mediaSize = 0; mediaSize=GetSizeOnDisc(pszFile); IStream* dataStream = NULL; if (dataStream == NULL) { SHCreateStreamOnFileEx(pszFile, STGM_READ|STGM_SHARE_DENY_NONE|STGM_DELETEONRELEASE, FILE_ATTRIBUTE_NORMAL, FALSE,NULL, &dataStream); } m_hResult = m_discFormatData->put_Recorder(GetInterface()); if (!SUCCEEDED(m_hResult)) { qDebug()<<"IDiscFormat2Data->put_Recorder Failed ";return false;} char *ansistr = "DVDBurner"; int a = lstrlenA(ansistr); BSTR unicodestr = SysAllocStringLen(NULL, a); ::MultiByteToWideChar(CP_ACP, 0, ansistr, a, unicodestr, a); m_hResult = m_discFormatData->put_ClientName(unicodestr); if (FAILED(m_hResult)){qDebug()<<"Unable to put_ClientName(buf_bstr)";return false;} m_hResult = m_discFormatData->Write(dataStream); // Here i am getting error 0xc0aa0403 if (FAILED(m_hResult)){printf("Unable to m_discFormatData- >Write::::Error:0x%08x",m_hResult); return false;} discMaster->Release(); CoUninitialize(); bComInitialised = FALSE; return 0; } ULONGLONG DVDBurner::GetSizeOnDisc(LPCWSTR pszFile) { CFileStatus status; if (CFile::GetStatus(pszFile, status)) { if (status.m_size > 0) { return ((status.m_size / SECTOR_SIZE) + 1) * SECTOR_SIZE; } } return 0; }

    Read the article

  • Android: writing a file to sdcard

    - by Sumit M Asok
    I'm trying to write a file from an Http post reply to a file on the sdcard. Everything works fine until the byte array of data is retrieved. I've tried setting WRITE_EXTERNAL_STORAGE permission in the manifest and tried many different combinations of tutorials I found on the net. All I could find was using the openFileOutput("",MODE_WORLD_READABLE) method, of the activity but how my app writes file is by using a thread. Specifically, a thread is invoked from another thread when a file has to be written, so giving an activity object didn't work even though I tried it. The app has come a long way and I cannot change how the app is currently written. Please, someone help me? CODE: File file = new File(bgdmanip.savLocation); FileOutputStream filecon = null; filecon = new FileOutputStream(file); // bgdmanip.savLocation holds the whole files path byte[] myByte; myByte = Base64Coder.decode(seReply); Log.d("myBytes", String.valueOf(myByte)); bos.write(myByte); filecon.write(myByte); myvals = x * 11024; seReply is a string reply from HttpPost response. the second set of code is looped with reference to x. the file is created but remains 0 bytes

    Read the article

  • .NET and P2P - writing a P2P messenger

    - by brovar
    Hi there, Does anyone have any advice how to write such app? Or maybe knows some nice tutorial? I would like to use System.Net.PeerToPeer namespace, but everything I can find about it is MSDN which I can't read without getting mad. Or maybe using "old-school" TCP/IP would more efficient? I will appreciate every piece of advice. Every sample code I will shower with gold ;) And please, don't send me back to Google for I have searched for a long time for sth useful - maybe inaccurately but time is running out and I really need some help.

    Read the article

  • Some questions about writing on ASP.NET response stream

    - by vtortola
    Hi, I'm making tests with ASP.NET HttpHandler for download a file writting directly on the response stream, and I'm not pretty sure about the way I'm doing it. This is a example method, in the future the file could be stored in a BLOB in the database: public void GetFile(HttpResponse response) { String fileName = "example.iso"; response.ClearHeaders(); response.ClearContent(); response.ContentType = "application/octet-stream"; response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); using (FileStream fs = new FileStream(Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data"), fileName), FileMode.Open)) { Byte[] buffer = new Byte[4096]; Int32 readed = 0; while ((readed = fs.Read(buffer, 0, buffer.Length)) > 0) { response.OutputStream.Write(buffer, 0, readed); response.Flush(); } } } But, I'm not sure if this is correct or there is a better way to do it. My questions are: When I open the url with the browser, appears the "Save File" dialog... but it seems like the server has started already to push data into the stream before I click "Save", is that normal? If I remove the line"response.Flush()", when I open the url with the browser, ... I see how the web server is pushing data but the "Save File" dialog doesn't come up, (or at least not in a reasonable time fashion) why? When I open the url with a WebRequest object, I see that the HttpResponse.ContentLength is "-1", although I can read the stream and get the file. What is the meaning of -1? When is HttpResponse.ContentLength going to show the length of the response? For example, I have a method that retrieves a big xml compresed with deflate as a binary stream, but in that case... when I access it with a WebRequest, in the HttpResponse I can actually see the ContentLength with the length of the stream, why? What is the optimal length for the Byte[] array that I use as buffer for optimal performance in a web server? I've read that is between 4K and 8K... but which factors should I consider to make the correct decision. Does this method bloat the IIS or client memory usage? or is it actually buffering the transference correctly? Sorry for so many questions, I'm pretty new in web development :P Cheers.

    Read the article

  • How to overcome vc++ warning C4003 while writing common code for both gcc and vc++

    - by compbugs
    I have a code that is compiled in both gcc and vc++. The code has a common macro which is called in two scenarios. When we pass some parameters to it. When we don't want to pass any parameters to it. An example of such a code is: #define B(X) A1##X int main() { int B(123), B(); return 0; } The expect output from the pre-processing step of compilation is: int main() { int A1123, A1; return 0; } The output for both gcc and vc++ is as expected, but vc++ gives a warning: warning C4003: not enough actual parameters for macro 'B' How can I remove this warning and yet get the expected output? Thanks.

    Read the article

  • Writing a Jeweler Rakefile that adds dependencies depending on RUBY_ENGINE (ruby or jruby)

    - by Matt Zukowski
    I have a Rakefile that includes this: Jeweler::Tasks.new do |gem| # ... gem.add_dependency('json') end The gemspec that this generates builds a gem that can't be installed on jruby because the 'json' gem is native. For jruby, this would have to be: Jeweler::Tasks.new do |gem| # ... gem.add_dependency('json-jruby') end How do I conditionally add the dependency for 'json-jruby' when RUBY_ENGINE == 'java'? It seems like my only option is to manually edit the gemspec file that jeweler generates to add the RUBY_ENGINE check. But I'd rather avoid this, since it kind of defeats the purpose of using jeweler in the first place. Any ideas?

    Read the article

  • cache_money only writing to memcached on creates and updates, and seemingly never looking in the cac

    - by Shane Liebling
    I seem to be having some extremely odd cache_money interactions. When I am on the console, and I create a new instance of a class and save it I see the cache misses and cache stores on my memcached console output. Then when the create finishes I see a bunch of cache deletions. If I then try to do any kind of find for the newly created object (or any other objects for that matter) I never see any cache access. This is highly confusing. I could kind of understand if all finds never hit the cache (though that in and of itself would be an issue requiring investigation), but finds do seem to hit the cache when the object is being created (checking for associations and such). Anyone have this experience in the past at all? Any thoughts? AFAIK there isn't really much in the way of configuration options for cache_money, and it certainly doesn't seem like there are any that would be on by default and be creating these kinds of symptoms. My cache_money config is basically straight out of the docs. Any help would be greatly appreciated.

    Read the article

  • Writing to a new line of a file in Objective-C

    - by Kulpreet
    For some strange reason, the \n and \r escape sequences do not seem to be working in my code. I want to write each NSString on a new line of the file, but it just appends it the last string on one line. Here's the code: for (Entry *entry in self.entries) { NSString *path = @"/Users/me/File.txt"; NSString *string = (@"%@\r\n", [entry thisEntry]); NSFileHandle *fh = [NSFileHandle fileHandleForWritingAtPath:path]; [fh seekToEndOfFile]; [fh writeData:[string dataUsingEncoding:NSUnicodeStringEncoding]]; [fh closeFile]; } Am I doing something wrong? Forgive me as I am new to Objective-C.

    Read the article

  • Things one needs to know while writing a game engine

    - by Joe Barr
    I have been dabbling in game development as a hobby for a while now, and I cannot seam to quite get my games to sparkle at least a bit with some graphics. I have decided to write a simple test game engine that only focuses on the representation of graphics - shapes, textures and surfaces. While I have a few very simple game engines designed for my own games under my belt, I want to create a game engine that I can use to display and play with graphics. I'm going to do this in C++. Since this is my first time with a major engine, the engine in not going to focus on 3D graphics, it's going to be a mixture of isometric and 2D graphics. My previous engines have incorporated (been able to draw) or focused on simple flat (almost 2D) non impressive graphic designs and representations of: the player NPCs objects walls and surfaces textures Also, I had some basic AI and sometimes even sound. They also saved and loaded games. They didn't have a map editor or a level editor. Is this going to be a problem in the future? At this time I have to point out that some of my games didn't get finished because I was to lazy to write the few last levels. My question at this point would be: What are some things one should know if one wants write (develope) a better graphical game engine with all it's functions.

    Read the article

  • c# Unit Test: Writing to Settings in unit test does not save values in user.config

    - by HorstWalter
    I am running a c# unit test (VS 2008). Within the test I do write to the settings, which should result in saving the data to the user.config. Settings.Default.X = "History"; // X is string Settings.Default.Save(); But this simply does not create the file (I have crosschecked under "C:\Documents and Settings\HW\Local Settings\Application Data"). If I create the same stuff as a Console application, there is no problem persisting the data (same code). Is there something special I need to consider doing this in a UnitTest?

    Read the article

  • Writing preprocessor directives to get string

    - by Dave18
    Can you write preprocessor directives to return you a std::string or char*? For example: In case of integers: #define square(x) (x*x) int main() { int x = square(5); } I'm looking to do the same but with strings like a switch-case pattern. if pass 1 it should return "One" and 2 for "Two" so on..

    Read the article

  • Writing a blackjack console program in Java

    - by user337465
    Hello, I have an assignment of making a blackjack like program in a class. My first problem I am dealing with is creating an array of the cards. The professor wants an array setup with a txt file with the following format. 2 of hearts 2 of diamonds 2 of spades 2 of clubs 3 of hearts 3 of diamonds 3 of spades This goes on till face cards when it replaces the number with jack, queen, king, ace. Following the professors requirements, How would I take input from the txt file and just store the number and the hearts,diamonds,spades, and clubs. Thank you for the help

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >