Search Results

Search found 1158 results on 47 pages for 'cc'.

Page 19/47 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Normalizing (webdav) unicode paths

    - by Evert
    Hi guys, I'm working on a WebDAV implementation for PHP. In order to make it easier for Windows and other operating systems to work together, I need jump through some character encoding hoops. Windows uses ISO-8859-1 in it's HTTP request, while most other clients encode anything beyond ascii as UTF-8. My first approach was to ignore this altogether, but I quickly ran into issues when returning urls. I then figured it's probably best to normalize all urls. Using u¨ as an example. This will get sent over the wire by OS/X as u%CC%88 (this is codepoint U+0308) Windows sents this as: %FC (latin1) But, doing a utf8_encode on %FC, I get : %C3%BC (this is codepoint U+00FC) Should I treat %C3%BC and u%CC%88 as the same thing? If so.. how? Not touching it seems to work OK for windows. It somehow understands that it's a unicode character, but updating the same file throws an error (for no particular reason). I'd be happy to provide more information.

    Read the article

  • Looking for examples of "real" uses of continuations

    - by Sébastien RoccaSerra
    I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the Wikipedia article: (define the-continuation #f) (define (test) (let ((i 0)) ; call/cc calls its first function argument, passing ; a continuation variable representing this point in ; the program as the argument to that function. ; ; In this case, the function argument assigns that ; continuation to the variable the-continuation. ; (call/cc (lambda (k) (set! the-continuation k))) ; ; The next time the-continuation is called, we start here. (set! i (+ i 1)) i)) I understand what this little function does, but I can't see any obvious application of it. While I don't expect to use continuations all over my code anytime soon, I wish I knew a few cases where they can be appropriate. So I'm looking for more explicitely usefull code samples of what continuations can offer me as a programmer. Cheers!

    Read the article

  • How test a Delphi app with Application Verifier 4.0?

    - by mamcx
    I download the Application Verifier 4.0 to test my App for check if could have problems on Vista/7. I run from Delphi 2010 debugger, and stop in CPU view. Obviously, I don't understand anything about assembler!. So, I try running directly from the windows explorer, and the App die. (In fact, I don't understand well what exactly will do App Verifier: I expect some kind of friendly message). This is what i get: 7C81A3E2 C3 ret 7C81A3E3 90 nop 7C81A3E4 8BFF mov edi,edi ntdll.DbgUserBreakPoint: 7C81A3E6 CC int 3 7C81A3E7 C3 ret 7C81A3E8 8BFF mov edi,edi 7C81A3EA 8B442404 mov eax,[esp+$04] 7C81A3EE CC int 3 7C81A3EF C20400 ret $0004 ntdll.NtCurrentTeb: 7C81A3F2 64A118000000 mov eax, fs:[$00000018] 7C81A3F8 C3 ret ntdll.RtlInitString: 7C81A3F9 57 push edi Loading: :7c81a3e2 ntdll.DbgBreakPoint + 0x1 :10003b68 ; C:\WINDOWS\system32\vrfcore.dll :00396a9d ; C:\WINDOWS\system32\vfbasics.dll :00397316 ; C:\WINDOWS\system32\vfbasics.dll :7c84bcdb ; ntdll.dll :7c8316f8 ; ntdll.dll :7c83154f ; ntdll.dll :7c82855e ntdll.KiUserExceptionDispatcher + 0xe :0040aa00 GetUILanguages + $80 :0040b298 GetResourceModuleName + $124 :0040afde LoadResourceModule + $7A :0040a134 DelayLoadResourceModule + $2C :00406c40 @StartExe + $44 :77e6f23b ; C:\WINDOWS\system32\KERNEL32.dll

    Read the article

  • How to build a GridView like DataBound Templated Custom ASP.NET Server Control

    - by Deyan
    I am trying to develop a very simple templated custom server control that resembles GridView. Basically, I want the control to be added in the .aspx page like this: <cc:SimpleGrid ID="SimpleGrid1" runat="server"> <TemplatedColumn>ID: <%# Eval("ID") %></ TemplatedColumn> <TemplatedColumn>Name: <%# Eval("Name") %></ TemplatedColumn> <TemplatedColumn>Age: <%# Eval("Age") %></ TemplatedColumn> </cc:SimpleGrid> and when providing the following datasource: DataTable table = new DataTable(); table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Age", typeof(int)); table.Rows.Add(1, "Bob", 35); table.Rows.Add(2, "Sam", 44); table.Rows.Add(3, "Ann", 26); SimpleGrid1.DataSource = table; SimpleGrid1.DataBind(); the result should be a HTML table like this one. ------------------------------- | ID: 1 | Name: Bob | Age: 35 | ------------------------------- | ID: 2 | Name: Sam | Age: 44 | ------------------------------- | ID: 3 | Name: Ann | Age: 26 | ------------------------------- The main problem is that I cannot define the TemplatedColumn. When I tried to do it like this ... private ITemplate _TemplatedColumn; [PersistenceMode(PersistenceMode.InnerProperty)] [TemplateContainer(typeof(TemplatedColumnItem))] [TemplateInstance(TemplateInstance.Multiple)] public ITemplate TemplatedColumn { get { return _TemplatedColumn; } set { _TemplatedColumn = value; } } .. and subsequently instantiate the template in the CreateChildControls I got the following result which is not what I want: ----------- | Age: 35 | ----------- | Age: 44 | ----------- | Age: 26 | ----------- I know that what I want to achieve is pointless and that I can use DataGrid to achieve it, but I am giving this very simple example because if I know how to do this I would be able to develop the control that I need. Thank you.

    Read the article

  • Help me create a Firefox extension (Javascript XPCOM Component)

    - by Johnny Grass
    I've been looking at different tutorials and I know I'm close but I'm getting lost in implementation details because some of them are a little bit dated and a few things have changed since Firefox 3. I have already written the javascript for the firefox extension, now I need to make it into an XPCOM component. This is the functionality that I need: My Javascript file is simple, I have two functions startServer() and stopServer. I need to run startServer() when the browser starts and stopServer() when firefox quits. Edit: I've updated my code with a working solution (thanks to Neil). The following is in MyExtension/components/myextension.js. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); const CI = Components.interfaces, CC = Components.classes, CR = Components.results; // class declaration function MyExtension() {} MyExtension.prototype = { classDescription: "My Firefox Extension", classID: Components.ID("{xxxx-xxxx-xxx-xxxxx}"), contractID: "@example.com/MyExtension;1", QueryInterface: XPCOMUtils.generateQI([CI.nsIObserver]), // add to category manager _xpcom_categories: [{ category: "profile-after-change" }], // start socket server startServer: function () { /* socket initialization code */ }, // stop socket server stopServer: function () { /* stop server */ }, observe: function(aSubject, aTopic, aData) { var obs = CC["@mozilla.org/observer-service;1"].getService(CI.nsIObserverService); switch (aTopic) { case "quit-application": this.stopServer(); obs.removeObserver(this, "quit-application"); break; case "profile-after-change": this.startServer(); obs.addObserver(this, "quit-application", false); break; default: throw Components.Exception("Unknown topic: " + aTopic); } } }; var components = [MyExtension]; function NSGetModule(compMgr, fileSpec) { return XPCOMUtils.generateModule(components); }

    Read the article

  • Skip makefile dependency generation for certain targets (e.g. `clean`)

    - by Shtééf
    I have several C and C++ projects that all follow a basic structure I've been using for a while now. My source files go in src/*.c, intermediate files in obj/*.[do], and the actual executable in the top level directory. My makefiles follow roughly this template: # The final executable TARGET := something # Source files (without src/) INPUTS := foo.c bar.c baz.c # OBJECTS will contain: obj/foo.o obj/bar.o obj/baz.o OBJECTS := $(INPUTS:%.cpp=obj/%.o) # DEPFILES will contain: obj/foo.d obj/bar.d obj/baz.d DEPFILES := $(OBJECTS:%.o=%.d) all: $(TARGET) obj/%.o: src/%.cpp $(CC) $(CFLAGS) -c -o $@ $< obj/%.d: src/%.cpp $(CC) $(CFLAGS) -M -MF $@ -MT $(@:%.d=%.o) $< $(TARGET): $(OBJECTS) $(LD) $(LDFLAGS) -o $@ $(OBJECTS) .PHONY: clean clean: -rm -f $(OBJECTS) $(DEPFILES) $(RPOFILES) $(TARGET) -include $(DEPFILES) Now I'm at the point where I'm packaging this for a Debian system. I'm using debuild to build the Debian source package, and pbuilder to build the binary package. The debuild step only has to execute the clean target, but even this causes the dependency files to be generated and included. In short, my question is really: Can I somehow prevent make from generating dependencies when all I want is to run the clean target?

    Read the article

  • Handling Incoming Mail to Multiple Recipients in PHP

    - by Navarr
    Alright, this may take a moment or two to explain: I'm working on creating an Email<SMS Bridge (like Teleflip). I have a few set parameters to work in: Dreamhost Webhosting PHP 5 (without PEAR) Postfix What I have right now, is a catch-all email address that forwards the email sent to a shell account. The shell account in turn forwards it to my PHP script. The PHP script reads it, strips a few Email Headers in an effort to make sure it sends properly, then forwards it to the number specified as the recipient. [email protected] of course sends an SMS to +1 (555) 123-4567. This works really well, as I am parsing the To field and grabbing just the email address it is sending to. However, what I realized that I did not account for is multiple recipients. For example, an email sent to both 5551234567 and 1235554567 (using the To line, the CC line, or any combination of those). The way email works of course, is I get two emails received, end up parsing each of them separately, and 5551234567 ends up getting the same message twice. What is the best way to handle this situation, so that each number specified in TO and CC can get one copy of the message. In addition, though I doubt its possible: Is there a way to handle BCC the same way?

    Read the article

  • TeamCity with TFS - workspace problems

    - by Tom
    Hi, We have been using CC.NET as our CI server for a month or so now, which has worked ok with TFS. In the config we were able to specify the TFS server, username, password, project and workspace which is all good. Now we are moving over to TeamCity mainly because it just seams more solid and is much nicer to use. The problem is getting it work with TFS. For the purpose of this, both the workspace and machine name are "BuildMachine", username is "BuildUser" TFS project is "$/Project/Dev/Website" I seam to have set it up correctly, I think, as when testing the connection it is successful. When I run a build I get a TFS error: "RunBuildException when running build stage UpdateSourcesFromServer." It goes on to say: "No matched workspaces were found. Will recreate workspace and perofming clean checkout." It then tries to create a new workspace something like this: TeamCity-S-sqa9qe2aulx22gz4rzkogl5kr/BuildUser It tries to set up some mappings and then fails because: "The working folder C:\ is already in use by the workspace BuildMachine;BuildUser on computer BuildMachine". This seams ok as this is the workspace that CC.net was using, and c:\project\dev\website is the path to the project. The problem is, why didn't TeamCity pick this up and use this workspace? Why does it try to create its own new one? Any idea how I can fix this? Thanks

    Read the article

  • Node.js/ v8: How to make my own snapshot to accelerate startup

    - by Anand
    I have a node.js (v0.6.12) application that starts by evaluating a Javascript file, startup.js. It takes a long time to evaluate startup.js, and I'd like to 'bake it in' to a custom build of Node if possible. The v8 source directory distributed with Node, node/deps/v8/src, contains a SconScript that can almost be used to do this. On line 302, we have LIBRARY_FILES = ''' runtime.js v8natives.js array.js string.js uri.js math.js messages.js apinatives.js date.js regexp.js json.js liveedit-debugger.js mirror-debugger.js debug-debugger.js '''.split() Those javascript files are present in the same directory. Something in the build process apparently evaluates them, takes a snapshot of state, and saves it as a byte string in node/out/Release/obj/release/snapshot.cc (on Mac OS). Some customization of the startup snapshot is possible by altering the SconScript. For example, I can change the definition of the builtin Date.toString by altering date.js. I can even add new global variables by adding startup.js to the list of library files, with contents global.test = 1. However, I can't put just any javascript code in startup.js. If it contains Date.toString = 1;, an error results even though the code is valid at the node repl: Build failed: -> task failed (err #2): {task: libv8.a SConstruct -> libv8.a} make: *** [program] Error 1 And it obviously can't make use of code that depends on libraries Node adds to v8. global.underscore = require('underscore'); causes the same error. I'd ideally like a tool, customSnapshot, where customSnapshot startup.js evaluates startup.js with node and then dumps a snapshot to a file, snapshot.cc, which I can put into the node source directory. I can then build node and tell it not to rebuild the snapshot.

    Read the article

  • Changing save directory

    - by Nathan
    Disregard my previous pre-edit post. Rethought what I needed to do. This is what I'm currently doing: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIScriptableIO downloadFile: function(httpLoc) { try { //new obj_URI object var obj_URI = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService). newURI(httpLoc, null, null); //new file object //set file with path obj_TargetFile.initWithPath("C:\\javascript\\cache\\test.pdf"); //if file doesn't exist, create if(!obj_TargetFile.exists()) { obj_TargetFile.create(0x00,0644); } //new persitence object var obj_Persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]. createInstance(Ci.nsIWebBrowserPersist); // with persist flags if desired const nsIWBP = Ci.nsIWebBrowserPersist; const flags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES; obj_Persist.persistFlags = flags | nsIWBP.PERSIST_FLAGS_FROM_CACHE; //save file to target obj_Persist.saveURI(obj_URI,null,null,null,null,obj_TargetFile); return true; } catch (e) { alert(e); } },//end downloadFile As you can see the directory is hardcoded in there, I want to save the pdf file open in the active tab to a relative temporary directory, or anywhere that's out of the way enough that the user won't stumble along and delete it. I'm going to try that using File I/O, I was under the impression that what I was looking for was in scriptable file I/O and thus disabled.

    Read the article

  • How do I process the configure file when cross-compiling with mingw?

    - by vy32
    I have a small open source program that builds with an autoconf configure script. I ran configure I tried to compile with: make CC="/opt/local/bin/i386-mingw32-g++" That didn't work because the configure script found include files that were not available to the mingw system. So then I tried: ./configure CC="/opt/local/bin/i386-mingw32-g++" But that didn't work; the configure script gives me this error: ./configure: line 5209: syntax error near unexpected token `newline' ./configure: line 5209: ` *_cv_*' Because of this code: # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\(a-zA-Z_a-zA-Z0-9_*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_* fi Which is generated then the AC_OUTPUT is called. Any thoughts? Is there a correct way to do this?

    Read the article

  • Netbeans GUI building on pre-defined code

    - by deliriumtremens
    I am supposed edit some code for an assignment, and he gave us the framework and wants us to implement code for it. I load the project into netbeans and can't figure out how I'm supposed to edit the swing components. I don't see how to edit source vs. design. import javax.swing.*; import java.util.*; import java.io.*; public class CurrencyConverterGUI extends javax.swing.JFrame { /************************************************************************************************************** insert your code here - most of this will be generated by NetBeans, however, you must write code for the event listeners and handlers for the two ComboBoxes, the two TextBoxes, and the Button. Please note you must also poulate the ComboBoxes withe currency symbols (which are contained in the KeyList attribute of CurrencyConverter CC) ***************************************************************************************************************/ private CurrencyConverter CC; private javax.swing.JTextField Currency1Field; private javax.swing.JComboBox Currency1List; private javax.swing.JTextField Currency2Field; private javax.swing.JComboBox Currency2List; private javax.swing.JButton jButton1; private javax.swing.JPanel jPanel1; } class CurrencyConverter{ private HashMap HM; // contains the Currency symbols and conversion rates private ArrayList KeyList; // contains the list of currency symbols public CurrencyConverter() { /************************************************** Instantiate HM and KeyList and load data into them. Do this by reading the data from the Rates.txt file ***************************************************/ } public double convert(String FromCurrency, String ToCurrency, double amount){ /*************************************************************************** Will return the converted currency value. For example, to convert 100 USD to GBP, FromCurrency is USD, ToCurrency is GBP and amount is 100. The rate specified in the file represent the amount of each currency which is equivalent to one Euro (EUR). Therefore, 1 Euro is equivalent to 1.35 USD Use the rate specified for USD to convert to equivalent GBP: amount / USD_rate * GBP_rate ****************************************************************************/ } public ArrayList getKeys(){ // return KeyList } } This is what we were given, but I can't do anything with it inside the GUI editor. (Can't even get to the GUI editor). I have been staring at this for about an hour. Any ideas?

    Read the article

  • core dump during std::_List_node_base::unhook()

    - by Ron
    I have a program where std::list is used. The program uses threads which act on the std::list as producers and consumers. When a message is dealt with by the consumer, it is removed from the list using pop_front(). But, during pop_front, there is a core dump. The gdb trace is as below. could you help getting me some insights into this issue? (gdb) bt full 0 0xf7531d7b in std::_List_node_base::unhook () from /usr/lib/libstdc++.so.6 No symbol table info available. 1 0x0805c600 in std::list ::_M_erase (this=0x806b08c, __position={_M_node = 0x8075308}) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:1169 __n = (class std::_List_node<myMsg> *) 0x0 2 0x0805c6af in std::list ::pop_front (this=0x806b08c) at /opt/target/usr/include/c++/4.2.0/bits/stl_list.h:750 No locals. 3 0x0805afb6 in Base::run () at ../../src/Base.cc:342 nSentBytes = 130 tmpnm = {_vptr.myMsg = 0x80652c0, m_msg = 0x8075140 "{0130,MSG_TYPE=ND_FUNCTION,ORG_PNAME=P01vm01Ax,FUNCTION=LOG,PARAM_CNT=3,DATETIME=06/12/2010 02:59:26.187,LOGNAME=N,ENTRY=Debug 0 }", m_from = 0x8096ee0 "P01vm01Ax", m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} newMsg = {_vptr.myMsg = 0x80652c0, m_msg = 0x0, m_from = 0x0, m_to = 0x0, static m_logged = false, static m_pLogMutex = {_data = {_lock = 0, __count = 0, __owner = 0, __kind = 0, _nusers = 0, {_spins = 0, _list = {_next = 0x0}}}, __size = '\0' , __align = 0}} strBuffer = "{0440,MSG_TYPE=NG_FUNCTION,ORG_PNAME=mach01./opt/abc/VAvsk/abc/comp/DML/gendrs.pl.17560,DST_PNAME=P01vm01Ax,FUNCTION=DRS_REPLICATE,CAUSE_DML_ERROR=N,CORRUPT_DATA=N,CORRUPT_HEADER=N,DEBUG=Y,EXTENDED_RU"... fds = {{fd = 5, events = 1, revents = 0}} retval = 0 iWaitTime = 0 4 0x0805b277 in startRun () at ../../src/Base.cc:454 No locals. 5 0xf7effe7b in start_thread () from /lib/libpthread.so.0 No symbol table info available. 6 0xf744d82e in clone () from /lib/libc.so.6 No symbol table info available.

    Read the article

  • Potential g++ template bug?

    - by Evan Teran
    I've encountered some code which I think should compile, but doesn't. So I'm hoping some of the local standards experts here at SO can help :-). I basically have some code which resembles this: #include <iostream> template <class T = int> class A { public: class U { }; public: U f() const { return U(); } }; // test either the work around or the code I want... #ifndef USE_FIX template <class T> bool operator==(const typename A<T>::U &x, int y) { return true; } #else typedef A<int> AI; bool operator==(const AI::U &x, int y) { return true; } #endif int main() { A<int> a; std::cout << (a.f() == 1) << std::endl; } So, to describe what is going on here. I have a class template (A) which has an internal class (U) and at least one member function which can return an instance of that internal class (f()). Then I am attempting to create an operator== function which compares this internal type to some other type (in this case an int, but it doesn't seem to matter). When USE_FIX is not defined I get the following error: test.cc: In function 'int main()': test.cc:27:25: error: no match for 'operator==' in 'a.A<T>::f [with T = int]() == 1' Which seems odd, because I am clearly (I think) defining a templated operator== which should cover this, in fact if I just do a little of the work for the compiler (enable USE_FIX), then I no longer get an error. Unfortunately, the "fix" doesn't work generically, only for a specific instantiation of the template. Is this supposed to work as I expected? Or is this simply not allowed? BTW: if it matters I am using gcc 4.5.2.

    Read the article

  • A monkey could do this better - Access to and availability of private member functions in C++

    - by David
    I am wandering the desert of my brain. I'm trying to write something like the following: class MyClass { // Peripherally Related Stuff public: void TakeAnAction(int oneThing, int anotherThing) { switch(oneThing){ case THING_A: TakeThisActionWith(anotherThing); break; //cases THINGS_NOT_A: }; private: void TakeThisActionWith(int thing) { string outcome = new string; outcome = LookUpOutcome(thing); // Do some stuff based on outcome return; } string LookUpOutcome(int key) { string oc = new string; oc = MyPrivateMap[key]; return oc; } map<int, string> MyPrivateMap; Then in the .cc file where I am actually using these things, while compiling the TakeAnAction section, it [CC, the solaris compiler] throws an an error: 'The function LookUpOutcome must have a prototype' and bombs out. In my header file, I have declared 'string LookUpOutcome(int key);' in the private section of the class. I have tried all sorts of variations. I tried to use 'this' for a little while, and it gave me 'Can only use this in non-static member function.' Sadly, I haven't declared anything static and these are all, putatively, member functions. I tried it [on TakeAnAction and LookUp] when I got the error, but I got something like, 'Can't access MyPrivateMap from LookUp'. MyPrivateMap could be made public and I could refer to it directly, I guess, but my sensibility says that is not the right way to go about this [that means that namespace scoped helper functions are out, I think]. I also guess I could just inline the lookup and subsequent other stuff, but my line-o-meter goes on tilt. I'm trying desperately not to kludge it.

    Read the article

  • magento payment process.. how it works in general

    - by spirytus
    hi everyone, got a question and I hope this is right place to ask :).. don’t quite understand how payment works in magento. client goes to checkout and lets say wants to pay as a guest, so provides address etc. and finally gets to payment methods. Then I want clients to pay thru credit card. Already have module installed for gateway (bank?) of my choice. At that point I would expect users to be redirected to 3rd party page (bank hosted) where they giving all the details, only after being returned to my magento site with appropriate message. In magento however it seems like they need to provide cc numbers and details on magento checkout page. I don’t understand if I (or the payment module I installed) need to transfer then all the credit card details to bank? I would have to have checkout page on ssl connection and static ip right? The thing is I want to avoid touching CC numbers at any point and would love to have it done by a bank page. I like the idea of magento interface all the way without redirecting to another page though, the only problem is not sure if would be able to set it all up properly. If anyone could explain to me possible options, what is the common way to do it and how the whole process works that would be very much appreciated. I did my research and looked all over google and various forums still need someones help though. Please let me know if some parts of my question are not quite clear, will try to better explain if necessary.

    Read the article

  • What is the way to go to fake my database layer in a unit test?

    - by Michel
    Hi, i have a question about unit testing. say i have a controller with one create method which puts a new customer in the database: //code a bit shortened public actionresult Create(Formcollection formcollection){ client c = nwe client(); c.Name = formcollection["name"]; ClientService.Save(c); { Clientservice would call a datalayer object and save it in the database. What i do now is create a database testscript and set my database in a know condition before testing. So when i test this method in the unit test, i know that there must be one more client in the database, and what it's name is. In short: ClientController cc = new ClientController(); cc.Create(new FormCollection (){name="John"}); //i know i had 10 clients before assert.areEqual(11, ClientService.GetNumberOfClients()); //the last inserted one is John assert.areEqual("John", ClientService.GetAllClients()[10].Name); So i've read that unit testing should not be hitting the database, i've setup an IOC for the database classes, but then what? I can create a fake database class, and make it do nothing. But then ofcourse my assertions will not work because if i say GetNumberOfClients() it will alwasy return X because it has no interaction with the fake database class used in the Create Method. I can also create a List of Clients in the fake database class, but as there will be two different instance created (one in the controller action and one in the unit test), they will have no interaction. What is the way to make this unit test work without a database?

    Read the article

  • How To Compile YACC And LEX?

    - by nisha
    Actually I'm having YACC file as pos.yacc and LEX file name is pos1.lex.. while compilling I'm getting the folowing error... malathy@malathy:~$ cc lex.yy.c y.tab.c -ly -ll pos1.lex %{ #include "y.tab.h" int yylval; %} DIGIT [0-9]+ %% {DIGIT} {yylval=atoi(yytext);return DIGIT;} [\n ] {} . {return *yytext;} %% yacc file is pos.yacc %token DIGIT %% s:e {printf("%d\n",$1);} e:DIGIT {$$=$1;} |e e "+" {$$=$1+$2;} |e e "*" {$$=$1*$2;} |e e "-" {$$=$1-$2;} |e e "/" {$$=$1/$2;} ; %% main() { yyparse(); } yyerror() { printf("Error"); } so while compiling i m getting like malathy@malathy:~$ cc lex.yy.c y.tab.c -ly -ll pos.y: In function ‘yyerror’: pos.y:16: warning: incompatible implicit declaration of built-in function ‘printf’ pos.y: In function ‘yyparse’: pos.y:4: warning: incompatible implicit declaration of built-in function ‘printf’

    Read the article

  • How do I reference my MainViewController from another class?

    - by todd412
    Hi, I am building an iPhone Utility app that uses UIImageView to display an animation. Within the MainViewController's viewDidLoad() method, I am creating an instance of a CustomClass, and then setting up the animations: - (void)viewDidLoad { [super viewDidLoad]; cc = [CustomClass new]; NSArray * imageArray = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"image-1-off.jpg"], [UIImage imageNamed:@"image-2-off.jpg"], [UIImage imageNamed:@"image-3-off.jpg"], [UIImage imageNamed:@"image-4-off.jpg"], nil]; offSequence = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; offSequence.animationImages = imageArray; offSequence.animationDuration = .8; offSequence.contentMode = UIViewContentModeBottomLeft; [self.view addSubview:offSequence]; [offSequence startAnimating]; } That works fine. However, I would like to be able to move all the above code that sets up the UIImageView into my CustomClass. The problem is in the second to last line: [self.view addSubview:offSequence]; I basically need to replace 'self' with a reference to the MainControllerView, so I can call addSubview from within my CustomClass. I tried creating an instance var of CustomClass called mvc and a setter method that takes a reference to the MainViewController as an argument as such: - (void) setMainViewController: (MainViewController *) the_mvc { mvc = the_mvc; } And then I called it within MainViewController like so: [cc setMainController:MainViewController:self]; But this yields all sorts of errors which I can post here, but it strikes me that I may be overcomplicating this. Is there an easier way to reference the MainViewController that instanatiated my CustomClass?

    Read the article

  • How to easily map c++ enums to strings

    - by Roddy
    I have a bunch of enum types in some library header files that I'm using, and I want to have a way of converting enum values to user strings - and vice-versa. RTTI won't do it for me, because the 'user strings' need to be a bit more readable than the enumerations. A brute force solution would be a bunch of functions like this, but I feel that's a bit too C-like. enum MyEnum {VAL1, VAL2,VAL3}; String getStringFromEnum(MyEnum e) { switch e { case VAL1: return "Value 1"; case VAL2: return "Value 2"; case VAL1: return "Value 3"; default: throw Exception("Bad MyEnum"); } } I have a gut feeling that there's an elegant solution using templates, but I can't quite get my head round it yet. UPDATE: Thanks for suggestions - I should have made clear that the enums are defined in a third-party library header, so I don't want to have to change the definition of them. My gut feeling now is to avoid templates and do something like this: char * MyGetValue(int v, char *tmp); // implementation is trivial #define ENUM_MAP(type, strings) char * getStringValue(const type &T) \ { \ return MyGetValue((int)T, strings); \ } ; enum eee {AA,BB,CC}; - exists in library header file ; enum fff {DD,GG,HH}; ENUM_MAP(eee,"AA|BB|CC") ENUM_MAP(fff,"DD|GG|HH") // To use... eee e; fff f; std::cout<< getStringValue(e); std::cout<< getStringValue(f);

    Read the article

  • SSL over TDS, SQL Server 2005 Express

    - by reuvenab
    I capture packets sent/received by Win Xp machine when connecting to SQL Server 2005 Express using TLS encryption. Server and Client exchange Hello messages Server and Client send ChangeCipherSpec message Then Server and Client server send strange message that is not described in TLS protocol What is the message and if SSL over TDS is standard compliant at all? Server side capture: 16 **SSL Handshake** 03 01 00 4a 02 ServerHello 00 00 46 03 01 4b dd 68 59 GMT 33 13 37 98 10 5d 57 9d ff 71 70 dc d6 6f 9e 2c Random[00..13] cb 96 c0 2e b3 2f 9b 74 67 05 cc 96 Random[14..27] 20 72 26 00 00 0f db 7f d9 b0 51 c2 4f cd 81 4c Session ID 3f e3 d2 d1 da 55 c0 fe 9b 56 b7 6f 70 86 fe bb Session ID 54 Session ID 00 04 Cipher Suite 00 Compression 14 03 01 00 01 01 **ChangeCipherSpec** 16 03 01 ???? Finished ??? 00 20 d0 da cc c4 36 11 43 ff 22 25 8a e1 38 2b ???? ??? 71 ce f3 59 9e 35 b0 be b2 4b 1d c5 21 21 ce 41 ???? ??? 8e 24

    Read the article

  • Rails wont install at create Makefile stage

    - by mattc
    I am getting this error after running sudo gem install rails /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb creating Makefile make xcrun cc -I. - I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c generator.c xcrun: Error: failed to exec real xcrun. (No such file or directory) cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle generator.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl -lobjc i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory lipo: can't figure out the architecture type of: /var/tmp//ccHCNNwM.out make: *** [generator.bundle] Error 1 I have Homebrew installed, Xcode 4.4 with command line tools installed, Osx 10.6.2 I run gem env and get this but not sure what I'm looking for: RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - universal-darwin-12 - GEM PATHS: - /Library/Ruby/Gems/1.8 - /Users/matthewcleghorn/.gem/ruby/1.8 - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ Any help greatly appreciated. Thanks.

    Read the article

  • Why do I get this strange output behavior?

    - by WilliamKF
    I have the following program test.cc: #include <iostream> unsigned char bogus1[] = { // Changing # of periods (0x2e) changes output after periods. 0x2e, 0x2e, 0x2e, 0x2e }; unsigned int bogus2 = 1816; // Changing this value changes output. int main() { std::clog << bogus1; } I build it with: g++ -g -c -o test.o test.cc; g++ -static-libgcc -o test test.o Using g++ version 3.4.6 I run it through valgrind and nothing is reported wrong. However the output has two extra control characters and looks like this: .... Thats a control-X and a control-G at the end. If you change the value of bogus2 you get different control characters. If you change the number of periods in the array the issue goes away or changes. I suspect it is a memory corruption bug in the compiler or iostream package. What is going on here?

    Read the article

  • problem finding a header with a c++ makefile

    - by Max
    Hi. I've started working with my first makefile. I'm writing a roguelike in C++ using the libtcod library, and have the following hello world program to test if my environment's up and running: #include "libtcod.hpp" int main() { TCODConsole::initRoot(80, 50, "PartyHack"); TCODConsole::root->printCenter(40, 25, TCOD_BKGND_NONE, "Hello World"); TCODConsole::flush(); TCODConsole::waitForKeypress(true); } My project directory structure looks like this: /CppPartyHack ----/libtcod-1.5.1 # this is the libtcod root folder --------/include ------------libtcod.hpp ----/PartyHack --------makefile --------partyhack.cpp # the above code (while we're here, how do I do proper indentation? Using those dashes is silly.) and here's my makefile: SRCDIR = . INCDIR = ../libtcod-1.5.1/include CFLAGS = $(FLAGS) -I$(INCDIR) -I$(SRCDIR) -Wall CC = gcc CPP = g++ .SUFFIXES: .o .h .c .hpp .cpp $(TEMP)/%.o : $(SRCDIR)/%.cpp $(CPP) $(CFLAGS) -o $@ -c $< $(TEMP)/%.o : $(SRCDIR)/%.c $(CC) $(CFLAGS) -o $@ -c $< CPP_OBJS = $(TEMP)partyhack.o all : partyhack partyhack : $(CPP_OBJS) $(CPP) $(CPP_OBJS) -o $@ -L../libtcod-1.5.1 -ltcod -ltcod++ -Wl,-rpath,. clean : \rm -f $(CPP_OBJS) partyhack I'm using Ubuntu, and my terminal gives me the following errors: max@max-desktop:~/Desktop/Development/CppPartyhack/PartyHack$ make g++ -c -o partyhack.o partyhack.cpp partyhack.cpp:1:23: error: libtcod.hpp: No such file or directory partyhack.cpp: In function ‘int main()’: partyhack.cpp:5: error: ‘TCODConsole’ has not been declared partyhack.cpp:6: error: ‘TCODConsole’ has not been declared partyhack.cpp:6: error: ‘TCOD_BKGND_NONE’ was not declared in this scope partyhack.cpp:7: error: ‘TCODConsole’ has not been declared partyhack.cpp:8: error: ‘TCODConsole’ has not been declared make: * [partyhack.o] Error 1 So obviously, the makefile can't find libtcod.hpp. I've double checked and I'm sure the relative path to libtcod.hpp in INCDIR is correct, but as I'm just starting out with makefiles, I'm uncertain what else could be wrong. My makefile is based off a template that the libtcod designers provided along with the library itself, and while I've looked at a few online makefile tutorials, the code in this makefile is a good bit more complicated than any of the examples the tutorials showed, so I'm assuming I screwed up something basic in the conversion. Thanks for any help.

    Read the article

  • Inheritance and type parameters of Traversable

    - by Jesper
    I'm studying the source code of the Scala 2.8 collection classes. I have questions about the hierarchy of scala.collection.Traversable. Look at the following declarations: package scala.collection trait Traversable[+A] extends TraversableLike[A, Traversable[A]] with GenericTraversableTemplate[A, Traversable] trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] with TraversableOnce[A] package scala.collection.generic trait HasNewBuilder[+A, +Repr] trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] extends HasNewBuilder[A, CC[A] @uncheckedVariance] Question: Why does Traversable extend GenericTraversableTemplate with type parameters [A, Traversable] - why not [A, Traversable[A]]? I tried some experimenting with a small program with the same structure and got a strange error message when I tried to change it to Traversable[A]: error: Traversable[A] takes no type parameters, expected: one I guess that the use of the @uncheckedVariance annotation in GenericTraversableTemplate also has to do with this? (That seems like a kind of potentially unsafe hack to force things to work...). Question: When you look at the hierarchy, you see that Traversable inherits HasNewBuilder twice (once via TraversableLike and once via GenericTraversableTemplate), but with slightly different type parameters. How does this work exactly? Why don't the different type parameters cause an error?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >