Daily Archives

Articles indexed Monday April 12 2010

Page 24/116 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Visual Studio - Attach Source Code to Reference

    - by Joe
    My C# project references a third-party DLL for which I have the source code. Can I somehow tell Visual Studio the location of that source code, so that, for example, when I press F12 to open the definition of a method in the DLL, it will open up the source code, instead of opening up the "Class [from metadata]" stub code?

    Read the article

  • DataModelSelection on list exposed via EntityQuery

    - by Kalpana
    Is it possible to have support for enabling DataModelSelection on a list page paginated via EntityQuery? (All the examples load the list by performing a query on the @Factory method). But, I would like to re-use the existing pagination mechanism and just enable the ability to support DataModelSelection on it. I am also assuming that DataModelSelection is capable of tracking a single row in a List, how do we extend this to support a certain action (say deletion, activation ...) of multiple rows. I am a newbie and would appreciate any help on this topic. I have already gone through the samples shipped as part of Seam (booking, message). I have already posted this in seam users forum, but I am yet to get a response

    Read the article

  • JavaFX UI freeze hang

    - by cancelledout
    My JavaFX app's UI freezes after consecutive times of executing webservice calls. Those process calls are asynchronous. How do I fix this problem? Is there a way to "unfreeze" the UI? Sorry for the newbie question. But I badly need anyone;'s help

    Read the article

  • Problem with Date Query - sql server 2008

    - by Gold
    hi i have this date's & Time's: date1: 10/04/2010 - Time: 08:09 date2: 11/04/2010 - Time: 08:14 i need to show all the date's between 10/04/2010 time 06:00 and 11/04/2010 time 6:00 i write this: select * from MyTbl where ((Tdate BETWEEN '20100410' AND '20100411') and (Ttime BETWEEN '06:00' and '06:00')) but i get empty table thank's in advance

    Read the article

  • problem in decoupling urls.py , while following a tutorial of django

    - by Nitin Garg
    http://docs.djangoproject.com/en/dev/intro/tutorial03/ I was at the step Decoupling the URLconfs where the tutorial illustrates how to decouple urls.py. On doing exactly what it says, i get the following error- error at /polls/1/ nothing to repeat Request Method: GET Request URL: http://localhost:8000/polls/1/ Exception Type: error Exception Value: nothing to repeat Exception Location: C:\jython2.5.1\Lib\re.py in _compile, line 241 Python Executable: C:\jython2.5.1\jython.bat Python Version: 2.5.1 Python Path: ['E:\\Programming\\Project\\django_app\\mysite', 'C:\\jython2.5.1\\Lib\\site-packages\\setuptools-0.6c11-py2.5.egg', 'C:\\jython2.5.1\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\jython2.5.1\\Lib\\site-packages'] Server time: Mon, 12 Apr 2010 12:02:56 +0530

    Read the article

  • How can I speed up CURL tasks?

    - by embedded
    I'm using CURL to fetch some data from user accounts. First it logs in and then redirect to another URL where the data resides. My stats showed that it took an average of 14 seconds to fetch some data spread over 5 pages. I would like to speed things up, my questions are: Is it possible to see how much each step takes? Do you know how could I speed up/enhance CURL? Thanks

    Read the article

  • perl one liner alternative to this bash "chain"?

    - by Michael Mao
    Hello everyone: I am trying to comprehend Perl following the way describe in the book "Minimal Perl". I've uploaded all source txt files onto my own server : results folder I got the output from using several bash commands in a "chain" like this: cat run*.txt | grep '^Bank[[:space:]]Balance'| cut -d ':' -f2 | grep -E '\$[0-9]+' I know this is far from the most concise and efficient, but at least it works... As our uni subject now moves onto the Perl part, I'd like to know if there is a way to get the same results in one line? I am trying something like the following code but stuck in the middle: Chenxi Mao@chenxi-a6b123bb /cygdrive/c/eMarket/output $ perl -wlne 'print; if $n=~/^Bank Balance/' syntax error at -e line 1, near "if $n" Execution of -e aborted due to compilation errors.

    Read the article

  • Ajax, Lizard Brain Web Design, JSF, Struts, JavaScript, Mobile Web, Flash, jQuery, GWT, Harmony at I

    - by Kim Won
    Great Indian Developer Summit 2010 – India's Biggest Polyglot Conference and Workshops for IT Software Professionals Bangalore, April 9, 2010: The GIDS.Web Conference and Workshops has announced the complete program of over 30 sessions on how browser and rich web technologies such as AJAX, DHTML, Mashups, Web 2.0, Enterprise 2.0 technologies, and Rich UI technologies are making money and gaining market-share for some of the leading businesses in the world. The GIDS.Web track at Great Indian Developer Summit takes place 21 and 23 April 2010, at the Indian Institute of Science in Bangalore. As one of the longest running independent developer conferences in India, GIDS.Web at the Great Indian Developer Summit 2010 is uniquely positioned to provide a blend of practical, pragmatic and immediately applicable knowledge and a glimpse of the future of technology. During 21 and 23 April 2010, GIDS.Web offers a multi-track conference, workshops, expo show floor, and networking opportunities. The first keynote at GIDS.Web is led by the leading Java EE and Ajax developer, speaker, and author Marty Hall. The best of India's Java and RIA programmers have learnt the subject from Marty's seminal books Core Servlets and JavaServer Pages (first and second editions), More Servlets and JavaServer Pages, and Core Web Programming (first and second editions) from Prentice Hall and Sun Microsystems Press. Marty's keynote address is a comparison of approaches to building rich Internet applications with Ajax. Marty says Ajax development is difficult, and there are several fundamentally different strategies to building Ajaxified Web applications. The keynote address will survey the three most important of these approaches: using an Ajax-enabled JavaScript library such as jQuery, Prototype, Scriptaculous, Dojo, or Ext/JS; using a Web framework such as JSF 2.0 or Struts 2 that has integrated Ajax support; using the Google Web Toolkit (GWT) to build "pure Java" Ajax applications. The talk will compare and contrast these three approaches, discussing the types of applications that fit best for each option. Over the course of the summit Marty will conduct several more sessions on "Choosing an Ajax/JavaScript Toolkit: A Comparison of the Most Popular JavaScript Libraries", "Pure Java Ajax: An Overview of GWT 2.0", "Integrated Ajax Support in JSF 2.0" and "Ajax Support in the Prototype JavaScript Library". The second keynote by the head of Adobe's Flash initiative in India, Ramesh Srinivasaraghavan, explores the state of art in web application development and identify trends that could transform the way we create and use web applications. The talk explains how the Adobe Flash Platform has fuelled this revolution with an integrated set of technologies for delivering the most compelling applications, content and video to the widest possible audience. The Director of Forum Nokia will explain how cloud computing coupled with mobile applications enable consumers to have access to powerful services and improved user experiences never before thought possible. IEEE's 2010 President-Elect Sorel Reisman's afternoon address steps to improve the IT profession in India. Featured talks at GID.Web also include: Web 2.0 Checklist - Deconstructing Modern Websites, Scott Davis Choosing an Ajax/JavaScript Toolkit: Comparison of Popular JavaScript Libraries, Marty Hall Lizard Brain Web Design, Scott Davis Effective Design Processes and Resources for Mobile Web Development, Arabella David NoSQL: The Shift to a Non-relational World, Nosh Petigara Open Source Web Debugging Tools, Matthew McCullough Building Line of Business Applications with Silverlight 4.0, Stephen Forte Hadoop - Divide and Conquer, Matthew McCullough Adobe Flash Catalyst for Agile Interaction Design, Harish Sivaramakrishnan Using jQuery and AJAX to Build Front-ends for ASP.NET and ASP.NET MVC, Pandurang Nayak First Steps to IT Heaven Through the Cloud. Part II: .WEB, Simone Brunozzi Building Rich Internet Applications with SL RIA Web Services, Pandurang Nayak Enriching Cloud Applications with Adobe Flash Platform, Ramesh Srinivasaraghavan Payments for the Web.future, Khurram Khan and Praveen Alavilli Longevity of Scalable Systems, Nishad Kamat Transform yourself into a Mobile App Developer Using Web Run Time, Balagopal K S Developing Multi Screen Applications on Adobe Flash Platform, Hemanth Sharma Why Harmony and For Whom?, Himanshu Goyal IIS Hosting Solution for ASP.net and PHP Web Sites, Nahas Mohammed Building Pluggable Web applications using Django, Lakshman Prasad Workshop: The 180-min AJAX and JSON Spike Class, Scott Davis Workshop: Essence of Functional Programming, Venkat Subramaniam Workshop: Agile Development, Tools, and Teams and Scrum Certification, Stephen Forte Workshop: PHP + Adobe Flex = Killer RIA, Shyamprasad P Workshop: Cloud Computing Boot Camp on the Google App Engine, Matthew McCullough Workshop: Building Data Centric Applications using Adobe Flex and Java, Prashant Singh Workshop: Building Your First Amazon App, Simone Brunozzi Workshop: Windows Azure Deep Dive, Ramaprasanna Chellamuthu Workshop: Monetizing your Apps with PayPal X Payments Platform, Khurram Khan, Praveen Alavilli Workshop: User Expereince Evaluation Model Walkthrough, Sanna Häiväläinen Sponsors of Great Indian Developer Summit 2010 include: Platinum sponsors Microsoft, Oracle Forum Nokia and Adobe; Gold sponsors Intel and SAP; Silver sponsors Quest Software, PayPal, Telerik and AMT. About Great Indian Developer Summit Great Indian Developer Summit is the gold standard for India's software developer ecosystem for gaining exposure to and evaluating new projects, tools, services, platforms, languages, software and standards. Packed with premium knowledge, action plans and advise from been-there-done-it veterans, creators, and visionaries, the 2010 edition of Great Indian Developer Summit features focused sessions, case studies, workshops and power panels that will transform you into a force to reckon with. Featuring 3 co-located conferences: GIDS.NET, GIDS.Web, GIDS.Java and an exclusive day of in-depth tutorials - GIDS.Workshops, from 20 April to 24 April at the IISc campus in Bangalore. At GIDS you'll participate in hundreds of sessions encompassing the full range of Microsoft computing, Java, Agile, RIA, Rich Web, open source/standards, languages, frameworks and platforms, practical tutorials that deep dive into technical skill and best practices, inspirational keynote presentations, an Expo Hall featuring dozens of the latest projects and products activities, engaging networking events, and the interact with the best and brightest of speakers from around the world. For further information on GIDS 2010, please visit the summit on the web http://www.developersummit.com/ A Saltmarch Media Press Release E: [email protected] Ph: +91 80 4005 1000

    Read the article

  • How can I get MTK development platform for MT series mobiles with English explanation?

    - by Robert
    You said in a post that you are an engineer and you have MTK development platform for MT series mobiles with English explanation. Can you please tell me how your company obtained it? Did you purchase it from MTK or you downloaded it? If you downloaded it please tell me your source. I am researching how i can develop application in the MTK platform so i hope you could help me with this information.

    Read the article

  • How to use more than one DataSource in JasperReport?

    - by Kumar
    Hi Friends, Is it possible to use more than one java bean datasource or JDBC datasource in jasper report to populate data in the pdf document.If possible can u please tell me how to do? I could not get any details in the internet, Regarding using more than one datasource in jasper report.

    Read the article

  • Archive tar files to a different location inperl

    - by user314261
    Hi, I am a newbee in Perl. I am reading a directory having some archive files and uncompressing the archive files one by one. Everything seems well however the files are getting uncompressed in the folder which has the main perl code module which is running the sub modules. I want the archive to be generated in the folder I specify. This is my code: sub ExtractFile { #Read the folder which was copied in the output path recursively and extract if any file is compressed my $dirpath = $_[0]; opendir(D, "$dirpath") || die "Can't open dir $dirpath: $!\n"; my @list = readdir(D); closedir(D); foreach my $f (@list) { print " \$f = $f"; if(-f $dirpath."/$f") { #print " File in directory $dirpath \n ";#is \$f = $f\n"; my($file_name, $file_dirname,$filetype)= fileparse($f,qr{\..*}); #print " \nThe file extension is $filetype"; #print " \nThe file name is is $file_name"; # If compressed file then extract the file if($filetype eq ".tar" or $filetype eq ".tzr.gz") { my $arch_file = $dirpath."/$f"; print "\n file to be extracted is $arch_file"; my $tar = Archive::Tar->new($arch_file); #$tar->extract() or die ("Cannot extract file $arch_file"); #mkdir($dirpath."/$file_name"); $tar->extract_file($arch_file,$dirpath."/$file_name" ) or die ("Cannot extract file $arch_file"); } } if(-d $dirpath."/$f") { if($f eq "." or $f eq "..") { next; } print " Directory\n";# is $f"; ExtractFile($dirpath."/$f"); } } } The method ExtractFile is called recursively to loop all the archives. When using $tar-extract() it uncompresses in the folder which calls this metohd. when I use $tar-extract_file($arch_file,$dirpath."/$file_name" ) I get an error : No such file in archive: '/home/fsang/dante/workspace/output/s.tar' at /home/fsang/dante/lib/Extraction.pm line 80 Please help I have checked that path and input output there is no issue with it. Seems some usage problem I am not aware of for $tar-extract_file(). Many thanks for anyone resolving this issue. Regards, Sakshi

    Read the article

  • T-SQL Improvements And Data Types in ms sql 2008

    - by Aamir Hasan
     Microsoft SQL Server 2008 is a new version released in the first half of 2008 introducing new properties and capabilities to SQL Server product family. All these new and enhanced capabilities can be defined as the classic words like secure, reliable, scalable and manageable. SQL Server 2008 is secure. It is reliable. SQL2008 is scalable and is more manageable when compared to previous releases. Now we will have a look at the features that are making MS SQL Server 2008 more secure, more reliable, more scalable, etc. in details.Microsoft SQL Server 2008 provides T-SQL enhancements that improve performance and reliability. Itzik discusses composable DML, the ability to declare and initialize variables in the same statement, compound assignment operators, and more reliable object dependency information. Table-Valued ParametersInserts into structures with 1-N cardinality problematicOne order -> N order line items"N" is variable and can be largeDon't want to force a new order for every 20 line itemsOne database round-trip / line item slows things downNo ARRAY data type in SQL ServerXML composition/decomposition used as an alternativeTable-valued parameters solve this problemTable-Valued ParametersSQL Server has table variablesDECLARE @t TABLE (id int);SQL Server 2008 adds strongly typed table variablesCREATE TYPE mytab AS TABLE (id int);DECLARE @t mytab;Parameters must use strongly typed table variables Table Variables are Input OnlyDeclare and initialize TABLE variable  DECLARE @t mytab;  INSERT @t VALUES (1), (2), (3);  EXEC myproc @t;Procedure must declare variable READONLY  CREATE PROCEDURE usetable (    @t mytab READONLY ...)  AS    INSERT INTO lineitems SELECT * FROM @t;    UPDATE @t SET... -- no!T-SQL Syntax EnhancementsSingle statement declare and initialize  DECLARE @iint = 4;Compound Assignment Operators  SET @i += 1;Row constructors  DECLARE @t TABLE (id int, name varchar(20));  INSERT INTO @t VALUES    (1, 'Fred'), (2, 'Jim'), (3, 'Sue');Grouping SetsGrouping Sets allow multiple GROUP BY clauses in a single SQL statementMultiple, arbitrary, sets of subtotalsSingle read pass for performanceNested subtotals provide ever better performanceGrouping Sets are an ANSI-standardCOMPUTE BY is deprecatedGROUPING SETS, ROLLUP, CUBESQL Server 2008 - ANSI-syntax ROLLUP and CUBEPre-2008 non-ANSI syntax is deprecatedWITH ROLLUP produces n+1 different groupings of datawhere n is the number of columns in GROUP BYWITH CUBE produces 2^n different groupingswhere n is the number of columns in GROUP BYGROUPING SETS provide a "halfway measure"Just the number of different groupings you needGrouping Sets are visible in query planGROUPING_ID and GROUPINGGrouping Sets can produce non-homogeneous setsGrouping set includes NULL values for group membersNeed to distinguish by grouping and NULL valuesGROUPING (column expression) returns 0 or 1Is this a group based on column expr. or NULL value?GROUPING_ID (a,b,c) is a bitmaskGROUPING_ID bits are set based on column expressions a, b, and cMERGE StatementMultiple set operations in a single SQL statementUses multiple sets as inputMERGE target USING source ON ...Operations can be INSERT, UPDATE, DELETEOperations based onWHEN MATCHEDWHEN NOT MATCHED [BY TARGET] WHEN NOT MATCHED [BY SOURCE]More on MERGEMERGE statement can reference a $action columnUsed when MERGE used with OUTPUT clauseMultiple WHEN clauses possible For MATCHED and NOT MATCHED BY SOURCEOnly one WHEN clause for NOT MATCHED BY TARGETMERGE can be used with any table sourceA MERGE statement causes triggers to be fired onceRows affected includes total rows affected by all clausesMERGE PerformanceMERGE statement is transactionalNo explicit transaction requiredOne Pass Through TablesAt most a full outer joinMatching rows = when matchedLeft-outer join rows = when not matched by targetRight-outer join rows = when not matched by sourceMERGE and DeterminismUPDATE using a JOIN is non-deterministicIf more than one row in source matches ON clause, either/any row can be used for the UPDATEMERGE is deterministicIf more than one row in source matches ON clause, its an errorKeeping Track of DependenciesNew dependency views replace sp_dependsViews are kept in sync as changes occursys.dm_sql_referenced_entitiesLists all named entities that an object referencesExample: which objects does this stored procedure use?sys.dm_sql_referencing_entities 

    Read the article

  • Resin server giving 200 OK response but tomcat 6.0 not giving 404 Not Found

    - by Suryanarayan Panda
    Hi, We have an application running in resin. We are sending HTTP get and post request to this application & it gives 200 ok response with some text in the response body, as expected. But when same application deployed on tomcat6.0 ,and HTTP get and post request are made , the url gets excuted as expected ,but 404 not found response is coming with nothig in the response body. Can anybody please point out the issue ,and give suggetion what is going wrong.Its urgent Thanks in Advance. Surya

    Read the article

  • Breaking down currency in c#

    - by Thatguy
    i'm trying to get this program to break down a user defined amount of dollars into the fewest possible bills. i don't think my for loops are running because if i put a writeline line in them it doesn't show up when i run it. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication13 { class Program { static void Main(string[] args) { Console.Write("Enter the amount of money: $"); int totalAmount = Convert.ToInt32(Console.ReadLine()); calculateNumberOfBills(totalAmount); } static void calculateNumberOfBills(int totalAmount) { int[] denominations = { 20, 10, 5, 1 }; int[] numberOfBills = new int[4]; for (numberOfBills[0] = 0; totalAmount < 20; numberOfBills[0]++) { totalAmount = totalAmount - 20; } for (numberOfBills[1] = 0; totalAmount < 10; numberOfBills[1]++) { totalAmount = totalAmount - 10; } for (numberOfBills[2] = 0; totalAmount < 5; numberOfBills[2]++) { totalAmount = totalAmount - 5; } for (numberOfBills[3] = 0; totalAmount <= 0; numberOfBills[3]++) { totalAmount = totalAmount - 1; } Console.WriteLine("Number of twenties" + numberOfBills[0]); Console.WriteLine("Number of tens" + numberOfBills[1]); Console.WriteLine("Number of fives" + numberOfBills[2]); Console.WriteLine("Number of ones" + numberOfBills[3]); } } }

    Read the article

  • How to avoid recursion in Java SecurityManager checkConnect?

    - by Zilupe
    I'm trying to take control of a Java code base that does lots of un-documented things. I'm using a custom SecurityManager to check permission requests. Specifically, my code is checking SocketPermission checks -- checkConnect. checkConnect is called when the application tries to resolve a host name to IP address and to connect to a specific IP address. The problem is that I don't know how to properly call host name resolution (InetAddress.getAddressByName) without falling into infinite recursion, because normally checkConnect is called even when I resolve the name from inside the SecurityManager.checkConnect. I have read on the web that I have to call the address resolution from a doPrivileged block, but no idea how. P.S. Is this possible without writing any policy files?

    Read the article

  • Issue in Adding data into database using hibernate

    - by sarah
    Hi , I am getting the following exception "org.hibernate.HibernateException: The database returned no natively generated identity value "while adding data into database i am using the following code.Please let me know what is wrong Sesion session=HibernateUtil.getSession(); Transaction tx = session.beginTransaction(); session.save(user); logger.info("Successfully data insert in database"); tx.commit(); isSaved=true; Thankx

    Read the article

  • Allow member to be const while still supporting operator= on the class

    - by LeopardSkinPillBoxHat
    I have several members in my class which are const and can therefore only be initialised via the initialiser list like so: class MyItemT { public: MyItemT(const MyPacketT& aMyPacket, const MyInfoT& aMyInfo) : mMyPacket(aMyPacket), mMyInfo(aMyInfo) { } private: const MyPacketT mMyPacket; const MyInfoT mMyInfo; }; My class can be used in some of our internally defined container classes (e.g. vectors), and these containers require that operator= is defined in the class. Of course, my operator= needs to do something like this: MyItemT& MyItemT::operator=(const MyItemT& other) { mMyPacket = other.mPacket; mMyInfo = other.mMyInfo; return *this; } which of course doesn't work because mMyPacket and mMyInfo are const members. Other than making these members non-const (which I don't want to do), any ideas about how I could fix this?

    Read the article

  • How to do this layout? (Link on Image)

    - by Spredzy
    Hi all, I was wondering how to obtain this result : http://img718.imageshack.us/img718/6173/screenshot20100411at126.png This is what I tried : <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#CCCCCC" android:orientation="horizontal" android:layout_weight="0"> <Button android:id="@+id/btn_cancel" android:text="@string/cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5px" android:gravity="left" /> <Button android:id="@+id/btn_save" android:text="@string/save" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5px" android:layout_toRightOf="@id/btn_cancel" android:gravity="right"/> </RelativeLayout> I tried to play with the layout_width properties and setting them up to fill parents both of them but did not work, if anyone has an idea ... Thank you !

    Read the article

  • SQL query: Delete a entry which is not present in a join table?

    - by Mestika
    Hi, I’m going to delete all users which has no subscription but I seem to run into problems each time I try to detect the users. My schemas look like this: Users = {userid, name} Subscriptionoffering = {userid, subscriptionname} Now, what I’m going to do is to delete all users in the user table there has a count of zero in the subscriptionoffering table. Or said in other words: All users which userid is not present in the subscriptionoffering table. I’ve tried with different queries but with no result. I’ve tried to say where user.userid <> subscriptionoffering.userid, but that doesn’t seem to work. Do anyone know how to create the correct query? Thanks Mestika

    Read the article

  • Javascript sleep

    - by fmsf
    Is any better way than this function to make a sleep in javascript, or should I just use that function? (taken from here) function pausecomp(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); } This is not a dupe of http://stackoverflow.com/questions/758688/sleep-in-javascript I want a real sleep in a middle of a function, not a delay for a piece of code;

    Read the article

  • Why is it impossible to declare extension methods in a generic static class?

    - by Hun1Ahpu
    I'd like to create a lot of extension methods for some generic class, e.g. for public class SimpleLinkedList<T> where T:IComparable And I've started creating methods like this: public static class LinkedListExtensions { public static T[] ToArray<T>(this SimpleLinkedList<T> simpleLinkedList) where T:IComparable { //// code } } But when I tried to make LinkedListExtensions class generic like this: public static class LinkedListExtensions<T> where T:IComparable { public static T[] ToArray(this SimpleLinkedList<T> simpleLinkedList) { ////code } } I get "Extension methods can only be declared in non-generic, non-nested static class". And I'm trying to guess where this restriction came from and have no ideas.

    Read the article

  • C++ type-checking at compile-time

    - by Masterofpsi
    Hi, all. I'm pretty new to C++, and I'm writing a small library (mostly for my own projects) in C++. In the process of designing a type hierarchy, I've run into the problem of defining the assignment operator. I've taken the basic approach that was eventually reached in this article, which is that for every class MyClass in a hierarchy derived from a class Base you define two assignment operators like so: class MyClass: public Base { public: MyClass& operator =(MyClass const& rhs); virtual MyClass& operator =(Base const& rhs); }; // automatically gets defined, so we make it call the virtual function below MyClass& MyClass::operator =(MyClass const& rhs); { return (*this = static_cast<Base const&>(rhs)); } MyClass& MyClass::operator =(Base const& rhs); { assert(typeid(rhs) == typeid(*this)); // assigning to different types is a logical error MyClass const& casted_rhs = dynamic_cast<MyClass const&>(rhs); try { // allocate new variables Base::operator =(rhs); } catch(...) { // delete the allocated variables throw; } // assign to member variables } The part I'm concerned with is the assertion for type equality. Since I'm writing a library, where assertions will presumably be compiled out of the final result, this has led me to go with a scheme that looks more like this: class MyClass: public Base { public: operator =(MyClass const& rhs); // etc virtual inline MyClass& operator =(Base const& rhs) { assert(typeid(rhs) == typeid(*this)); return this->set(static_cast<Base const&>(rhs)); } private: MyClass& set(Base const& rhs); // same basic thing }; But I've been wondering if I could check the types at compile-time. I looked into Boost.TypeTraits, and I came close by doing BOOST_MPL_ASSERT((boost::is_same<BOOST_TYPEOF(*this), BOOST_TYPEOF(rhs)>));, but since rhs is declared as a reference to the parent class and not the derived class, it choked. Now that I think about it, my reasoning seems silly -- I was hoping that since the function was inline, it would be able to check the actual parameters themselves, but of course the preprocessor always gets run before the compiler. But I was wondering if anyone knew of any other way I could enforce this kind of check at compile-time.

    Read the article

  • Overlay bitmap on live video

    - by sijith
    Hi i want to Overlay bitmap on live video. Iam trying to do this with the directshow sample. I edited PlayCapMonker sample and added some functions to enable this. i did this with the procedure explained in below link http://www.ureader.com/msg/1471251.aspx Now i am gettting errors Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 8 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 9 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 21 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 22 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 26 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 27 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 36 error C2228: left of '.m_alpha' must have class/struct/union Error 38 error C2227: left of '-SetAlphaBitmap' must point to class/struct/union/generic type Error 7 error C2146: syntax error : missing ';' before identifier 'Pool' Error 4 error C2146: syntax error : missing ';' before identifier 'Format' c:\Program Files\Microsoft Platform SDK\include\Vmr9.h 368 PlayCapMoniker Error 1 error C2143: syntax error : missing ';' before '' Error 20 error C2143: syntax error : missing ';' before '' Error 25 error C2143: syntax error : missing ';' before '*' Error 30 error C2065: 'g_pMixerBitmap' : undeclared identifier Error 33 error C2065: 'g_pMixerBitmap' : undeclared identifier Error 37 error C2065: 'g_pMixerBitmap' : undeclared identifier Error 31 error C2065: 'g_hbm' : undeclared identifier Error 32 error C2065: 'g_hbm' : undeclared identifier Error 35 error C2065: 'config' : undeclared identifier Error 10 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 11 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 12 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 13 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 16 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 19 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 23 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 24 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 28 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 29 error C2061: syntax error : identifier 'IDirect3DSurface9' Error 14 error C2061: syntax error : identifier 'IDirect3DDevice9' Error 15 error C2061: syntax error : identifier 'IDirect3DDevice9' Error 17 error C2061: syntax error : identifier 'IDirect3DDevice9' Error 18 error C2061: syntax error : identifier 'IDirect3DDevice9' Error 34 error C2039: 'pDDS' : is not a member of '_VMR9AlphaBitmap' SDK\Samples\Multimedia\DirectShow\Capture\PlayCapMoniker\PlayCapMoniker.cpp 263 PlayCapMoniker

    Read the article

  • How to use pthread_atfork() and pthread_once() to reinitialize mutexes in child processes

    - by Blair Zajac
    We have a C++ shared library that uses ZeroC's Ice library for RPC and unless we shut down Ice's runtime, we've observed child processes hanging on random mutexes. The Ice runtime starts threads, has many internal mutexes and keeps open file descriptors to servers. Additionally, we have a few of mutexes of our own to protect our internal state. Our shared library is used by hundreds of internal applications so we don't have control over when the process calls fork(), so we need a way to safely shutdown Ice and lock our mutexes while the process forks. Reading the POSIX standard on pthread_atfork() on handling mutexes and internal state: Alternatively, some libraries might have been able to supply just a child routine that reinitializes the mutexes in the library and all associated states to some known value (for example, what it was when the image was originally executed). This approach is not possible, though, because implementations are allowed to fail *_init() and *_destroy() calls for mutexes and locks if the mutex or lock is still locked. In this case, the child routine is not able to reinitialize the mutexes and locks. On Linux, the this test C program returns EPERM from pthread_mutex_unlock() in the child pthread_atfork() handler. Linux requires adding _NP to the PTHREAD_MUTEX_ERRORCHECK macro for it to compile. This program is linked from this good thread. Given that it's technically not safe or legal to unlock or destroy a mutex in the child, I'm thinking it's better to have pointers to mutexes and then have the child make new pthread_mutex_t on the heap and leave the parent's mutexes alone, thereby having a small memory leak. The only issue is how to reinitialize the state of the library and I'm thinking of reseting a pthread_once_t. Maybe because POSIX has an initializer for pthread_once_t that it can be reset to its initial state. #include <pthread.h> #include <stdlib.h> #include <string.h> static pthread_once_t once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t *mutex_ptr = 0; static void setup_new_mutex() { mutex_ptr = malloc(sizeof(*mutex_ptr)); pthread_mutex_init(mutex_ptr, 0); } static void prepare() { pthread_mutex_lock(mutex_ptr); } static void parent() { pthread_mutex_unlock(mutex_ptr); } static void child() { // Reset the once control. pthread_once_t once = PTHREAD_ONCE_INIT; memcpy(&once_control, &once, sizeof(once_control)); setup_new_mutex(); } static void init() { setup_new_mutex(); pthread_atfork(&prepare, &parent, &child); } int my_library_call(int arg) { pthread_once(&once_control, &init); pthread_mutex_lock(mutex_ptr); // Do something here that requires the lock. int result = 2*arg; pthread_mutex_unlock(mutex_ptr); return result; } In the above sample in the child() I only reset the pthread_once_t by making a copy of a fresh pthread_once_t initialized with PTHREAD_ONCE_INIT. A new pthread_mutex_t is only created when the library function is invoked in the child process. This is hacky but maybe the best way of dealing with this skirting the standards. If the pthread_once_t contains a mutex then the system must have a way of initializing it from its PTHREAD_ONCE_INIT state. If it contains a pointer to a mutex allocated on the heap than it'll be forced to allocate a new one and set the address in the pthread_once_t. I'm hoping it doesn't use the address of the pthread_once_t for anything special which would defeat this. Searching comp.programming.threads group for pthread_atfork() shows a lot of good discussion and how little the POSIX standards really provides to solve this problem. There's also the issue that one should only call async-signal-safe functions from pthread_atfork() handlers, and it appears the most important one is the child handler, where only a memcpy() is done. Does this work? Is there a better way of dealing with the requirements of our shared library?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >