Search Results

Search found 67 results on 3 pages for 'viet anh'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Setting unique key constraint for Db4oEmbedded EmbeddedConfiguration

    - by Viet
    Hi, I want to set unique key constraint for Db4oEmbedded EmbeddedConfiguration. Here goes my code: EmbeddedConfiguration myConf = Db4oEmbedded.newConfiguration(); myConf.common().objectClass(NotyUser.class).objectField("username").indexed(true); myConf.common().add(new com.db4o.constraints.UniqueFieldValueConstraint(NotyUser.class, "username")); The last line throws exception. I don't know why. I'm running Android SDK 1.5 and db4o 7.12 for Java. Please kindly advise. Thanks!

    Read the article

  • How to create static method that evaluates local static variable once?

    - by Viet
    I have a class with static method which has a local static variable. I want that variable to be computed/evaluated once (the 1st time I call the function) and for any subsequent invocation, it is not evaluated anymore. How to do that? Here's my class: template< typename T1 = int, unsigned N1 = 1, typename T2 = int, unsigned N2 = 0, typename T3 = int, unsigned N3 = 0, typename T4 = int, unsigned N4 = 0, typename T5 = int, unsigned N5 = 0, typename T6 = int, unsigned N6 = 0, typename T7 = int, unsigned N7 = 0, typename T8 = int, unsigned N8 = 0, typename T9 = int, unsigned N9 = 0, typename T10 = int, unsigned N10 = 0, typename T11 = int, unsigned N11 = 0, typename T12 = int, unsigned N12 = 0, typename T13 = int, unsigned N13 = 0, typename T14 = int, unsigned N14 = 0, typename T15 = int, unsigned N15 = 0, typename T16 = int, unsigned N16 = 0> struct GroupAlloc { static const uint32_t sizeClass; static uint32_t getSize() { static uint32_t totalSize = 0; totalSize += sizeof(T1)*N1; totalSize += sizeof(T2)*N2; totalSize += sizeof(T3)*N3; totalSize += sizeof(T4)*N4; totalSize += sizeof(T5)*N5; totalSize += sizeof(T6)*N6; totalSize += sizeof(T7)*N7; totalSize += sizeof(T8)*N8; totalSize += sizeof(T9)*N9; totalSize += sizeof(T10)*N10; totalSize += sizeof(T11)*N11; totalSize += sizeof(T12)*N12; totalSize += sizeof(T13)*N13; totalSize += sizeof(T14)*N14; totalSize += sizeof(T15)*N15; totalSize += sizeof(T16)*N16; totalSize = 8*((totalSize + 7)/8); return totalSize; } };

    Read the article

  • LibPNG + Boost::GIL: png_infopp_NULL not found

    - by Viet
    Hi, I always get this error when trying to compile my file with Boost::GIL PNG IO support: (I'm running Mac OS X Leopard and Boost 1.42, LibPNG 1.4) /usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader::init()': /usr/local/include/boost/gil/extension/io/png_io_private.hpp:155: error: 'png_infopp_NULL' was not declared in this scope /usr/local/include/boost/gil/extension/io/png_io_private.hpp:160: error: 'png_infopp_NULL' was not declared in this scope /usr/local/include/boost/gil/extension/io/png_io_private.hpp: In destructor 'boost::gil::detail::png_reader::~png_reader()': /usr/local/include/boost/gil/extension/io/png_io_private.hpp:174: error: 'png_infopp_NULL' was not declared in this scope /usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader::apply(const View&)': /usr/local/include/boost/gil/extension/io/png_io_private.hpp:186: error: 'int_p_NULL' was not declared in this scope /usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_reader_color_convert<CC>::apply(const View&)': /usr/local/include/boost/gil/extension/io/png_io_private.hpp:228: error: 'int_p_NULL' was not declared in this scope /usr/local/include/boost/gil/extension/io/png_io_private.hpp: In member function 'void boost::gil::detail::png_writer::init()': /usr/local/include/boost/gil/extension/io/png_io_private.hpp:317: error: 'png_infopp_NULL' was not declared in this scope

    Read the article

  • How to install and use db4o for Android?

    - by Viet
    I have to admit that I'm new to Java and Android. db4o seems to be an excellent DB framework to replace SQLite http://developer.db4o.com/Platforms/Java/Android.aspx. I want to use it for my Android application. I don't know how to: Import/Install/Attach/Upload db4o to Android phone. Where should I put the JAR file db4o-7.12.132.14217-all-java5.jar so that it was uploaded to Android phone and it could be called from the application? Please kindly advise! Many thanks!!!

    Read the article

  • Writing re-entrant lexer with Flex

    - by Viet
    I'm newbie to flex. I'm trying to write a simple re-entrant lexer/scanner with flex. The lexer definition goes below. I get stuck with compilation errors as shown below (yyg issue): reentrant.l: /* Definitions */ digit [0-9] letter [a-zA-Z] alphanum [a-zA-Z0-9] identifier [a-zA-Z_][a-zA-Z0-9_]+ integer [0-9]+ natural [0-9]*[1-9][0-9]* decimal ([0-9]+\.|\.[0-9]+|[0-9]+\.[0-9]+) %{ #include <stdio.h> #define ECHO fwrite(yytext, yyleng, 1, yyout) int totalNums = 0; %} %option reentrant %option prefix="simpleit_" %% ^(.*)\r?\n printf("%d\t%s", yylineno++, yytext); %% /* Routines */ int yywrap(yyscan_t yyscanner) { return 1; } int main(int argc, char* argv[]) { yyscan_t yyscanner; if(argc < 2) { printf("Usage: %s fileName\n", argv[0]); return -1; } yyin = fopen(argv[1], "rb"); yylex(yyscanner); return 0; } Compilation errors: vietlq@mylappie:~/Desktop/parsers/reentrant$ gcc lex.simpleit_.c reentrant.l: In function ‘main’: reentrant.l:44: error: ‘yyg’ undeclared (first use in this function) reentrant.l:44: error: (Each undeclared identifier is reported only once reentrant.l:44: error: for each function it appears in.)

    Read the article

  • Generating exactly prime number with Java

    - by Viet
    Hi, I'm aware of the function BigInteger.probablePrime(int bitLength, Random rnd) that outputs probably prime number of any bit length. I want a REAL prime number in Java. Is there any FOSS library to do so with acceptable performance? Thanks in advance!

    Read the article

  • Where to find __sync_add_and_fetch_8?

    - by Viet
    I got errors when trying to use __sync_add_and_fetch: test8.cpp:(.text+0x90e): undefined reference to `__sync_add_and_fetch_8' collect2: ld returned 1 exit status Please kindly advise how to rectify this. Specs: GCC/G++: 4.4.1 GNU/Linux 2.6.32 SMP i686 Many thanks!

    Read the article

  • custom validation does not seem to get registered.

    - by viet pham
    Hi, Inside a tab, I have a form that is dynamically loaded via ajax. Since the name of the field is dynamic too (e.g. ), I write a custom validation method inside the "on complete" like this. However, the custom code does not get executed (bolded alert never pops up) no matter what i try. $.ajax ( { url: 'index.php?func=trainingmgr&aAction=displayAddForm', type: 'GET', dataType: 'html', complete: function(req, err) { //Append response to the tab's body $(href, '#trainingTabs').append(req.responseText); $.validator.addMethod ( 'tRequired', function(value, element) { if(value == '') { **alert('I am empty');** return true; } else return false; }, '<br>Required field' ); $('#upload' + index).click ( function() { $('#addForm' + index).validate().numberOfInvalids(); } ); } } );

    Read the article

  • An interesting case of delete and destructor (C++)

    - by Viet
    I have a piece of code where I can call destructor multiple times and access member functions even the destructor was called with member variables' values preserved. I was still able to access member functions after I called delete but the member variables were nullified (all to 0). And I can't double delete. Please kindly explain this. Thanks. #include <iostream> using namespace std; template <typename T> void destroy(T* ptr) { ptr->~T(); } class Testing { public: Testing() : test(20) { } ~Testing() { printf("Testing is being killed!\n"); } int getTest() const { return test; } private: int test; }; int main() { Testing *t = new Testing(); cout << "t->getTest() = " << t->getTest() << endl; destroy(t); cout << "t->getTest() = " << t->getTest() << endl; t->~Testing(); cout << "t->getTest() = " << t->getTest() << endl; delete t; cout << "t->getTest() = " << t->getTest() << endl; destroy(t); cout << "t->getTest() = " << t->getTest() << endl; t->~Testing(); cout << "t->getTest() = " << t->getTest() << endl; //delete t; // <======== Don't do it! Double free/delete! cout << "t->getTest() = " << t->getTest() << endl; return 0; }

    Read the article

  • Recognizing Tail-recursive functions with Flex+Bison and convert code to an Iterative form

    - by Viet
    I'm writing a calculator with an ability to accept new function definitions. Being aware of the need of newbies to try recursive functions such as Fibonacci, I would like my calculator to be able to recognize Tail-recursive functions with Flex + Bison and convert code to an Iterative form. I'm using Flex & Bison to do the job. If you have any hints or ideas, I welcome them warmly. Thanks!

    Read the article

  • select attribute mysql

    - by Viet Tran
    I have there mysql table: **product (id,name)** 1 Samsung 2 Toshiba 3 Sony **attribute (id,name,parentid)** 1 Size 0 2 19" 1 3 17" 1 4 15" 1 5 Color 0 6 White 1 7 Black 2 **attribute2product (id,productid,attributeid)** 1 1 2 2 1 6 3 2 2 4 2 7 5 3 3 6 3 7 And listed them like: Size -- 19" (2 product(s)) -- 17" (1 product) -- 15" (0 product) Color -- White (1 product) -- Black (2 product(s)) Please help me to filter product, eg: when I choose the Size 19" (that product id 1 and 2 have), this will display: Size -- 19" Color -- White (1 product) -- Black (1 product) Thanks,

    Read the article

< Previous Page | 1 2 3  | Next Page >