Search Results

Search found 269 results on 11 pages for 'alistair bell'.

Page 11/11 | < Previous Page | 7 8 9 10 11 

  • Testing a Gui-heavy WPF application.

    - by Hamish Grubijan
    We (my colleagues) have a messy 12 y.o. mature app that is GUI-based, and the current plan is to add new dialogs & other GUI in WPF, as well as replace some of the older dialogs in WPF as well. At the same time we wish to be able to test that Monster - GUI automation in a maintainable way. Some challenges: The application is massive. It constantly gains new features. It is being changed around (bug fixes, patches). It has a back end, and a layer in-between. The state of it can get out of whack if you beat it to death. What we want is: Some tool that can automate testing of WPF. auto-discovery of what the inputs and the outputs of the dialog are. An old test should still work if you add a label that does nothing. It should fail, however, if you remove a necessary text field. It would be very nice if the test suite was easy to maintain, if it ran and did not break most of the time. Every new dialog should be created with testability in mind. At this point I do not know exactly what I want, so I am marking this as a community wiki. If having to test a huge GUI-based app rings the bell (even if not in WPF), then please share your good, bad and ugly experiences here.

    Read the article

  • Self organizing layouts

    - by user613326
    Quite a while ago i was more in websites building then i am now. In my time there where huge debates about what to use; tables or pure CSS alternatives. I went out of the webdesigning, but now an old question re-surfaces. What i would like to create is a web page design that depending on screensize, would self organize the page into columns, so that for example on a PDA it would show 1 column On an old computer monitor, it would show 2 colomns, and on a widescreen laptop it would show 3 columns. I forgot how this was called and how it was done in the past, it had to do with XML and storing data seperate from design (if i remember well), perhaps these days better methods exist to do that, does this, anyone ring this a bell ? Also i note a lot is possible with Jquery and and brouwser depending webkits. But i need to make sure that it would run on all (modern) brouwsers : Iexplorer, Firefox, chrome And Jquery is nice too, but i am kinda woried that some day one of these brouwser vendors decides that jscript like java isnt enabled by default (or is that very unlikely ?)11 Perhaps someone can point me to a method that is the prefered way to do this.

    Read the article

  • Using MS Standalone profiler in VS2008 Professional

    - by fishdump
    I am trying to profile my .NET dll while running it from VS unit testing tools but I am having problems. I am using the standalone command-line profiler as VS2008 Professional does not come with an inbuilt profiler. I have an open CMD window and have run the following commands (I instrumented it earlier which is why vsinstr gave the warning that it did): C:\...\BusinessRules\obj\Debug>vsperfclrenv /samplegclife /tracegclife /globalsamplegclife /globaltracegclife Enabling VSPerf Sampling Attach Profiling. Allows to 'attaching' to managed applications. Current Profiling Environment variables are: COR_ENABLE_PROFILING=1 COR_PROFILER={0a56a683-003a-41a1-a0ac-0f94c4913c48} COR_LINE_PROFILING=1 COR_GC_PROFILING=2 C:\...\BusinessRules\obj\Debug>vsinstr BusinessRules.dll Microsoft (R) VSInstr Post-Link Instrumentation 9.0.30729 x86 Copyright (C) Microsoft Corp. All rights reserved. Error VSP1018 : VSInstr does not support processing binaries that are already instrumented. C:\...\BusinessRules\obj\Debug>vsperfcmd /start:trace /output:foo.vsp Microsoft (R) VSPerf Command Version 9.0.30729 x86 Copyright (C) Microsoft Corp. All rights reserved. C:\...\BusinessRules\obj\Debug> I then ran the unit tests that exercised the instrumented code. When the unit tests were complete, I did... C:\...\BusinessRules\obj\Debug>vsperfcmd /shutdown Microsoft (R) VSPerf Command Version 9.0.30729 x86 Copyright (C) Microsoft Corp. All rights reserved. Waiting for process 4836 ( C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vstesthost.exe) to shutdown... It was clearly waiting for VS2008 to close so I closed it... Shutting down the Profile Monitor ------------------------------------------------------------ C:\...\BusinessRules\obj\Debug> All looking good, there was a 3.2mb foo.vsp file in the directory. I next did... C:\...\BusinessRules\obj\Debug>vsperfreport foo.vsp /summary:all Microsoft (R) VSPerf Report Generator, Version 9.0.0.0 Copyright (C) Microsoft Corporation. All rights reserved. VSP2340: Environment variables were not properly set during profiling run and managed symbols may not resolve. Please use vsperfclrenv before profiling. File opened Successfully opened the file. A report file, foo_Header.csv, has been generated. A report file, foo_MarksSummary.csv, has been generated. A report file, foo_ProcessSummary.csv, has been generated. A report file, foo_ThreadSummary.csv, has been generated. Analysis completed A report file, foo_FunctionSummary.csv, has been generated. A report file, foo_CallerCalleeSummary.csv, has been generated. A report file, foo_CallTreeSummary.csv, has been generated. A report file, foo_ModuleSummary.csv, has been generated. C:\...\BusinessRules\obj\Debug> Notice the warning about environment variables and using vsperfclrenv? But I had run it! Maybe I used the wrong switches? I don't know. Anyway, loading the csv files into Excel or using the perfconsole tool gives loads of useful info with useless symbol names: *** Loading commands from: C:\temp\PerfConsole\bin\commands\timebytype.dll *** Adding command: timebytype *** Loading commands from: C:\temp\PerfConsole\bin\commands\partition.dll *** Adding command: partition Welcome to PerfConsole 1.0 (for bugs please email: [email protected]), for help type: ?, for a quickstart type: ?? > load foo.vsp *** Couldn't match to either expected sampled or instrumented profile schema, defaulting to sampled *** Couldn't match to either expected sampled or instrumented profile schema, defaulting to sampled *** Profile loaded from 'foo.vsp' into @foo > > functions @foo >>>>> Function Name Exclusive Inclusive Function Name Module Name -------------------- -------------------- -------------- --------------- 900,798,600,000.00 % 900,798,600,000.00 % 0x0600003F 20397910 14,968,500,000.00 % 44,691,540,000.00 % 0x06000040 14736385 8,101,253,000.00 % 14,836,330,000.00 % 0x06000041 5491345 3,216,315,000.00 % 6,876,929,000.00 % 0x06000042 3924533 <snip> 71,449,430.00 % 71,449,430.00 % 0x0A000074 42572 52,914,200.00 % 52,914,200.00 % 0x0A000073 0 14,791.00 % 13,006,010.00 % 0x0A00007B 0 199,177.00 % 6,082,932.00 % 0x2B000001 5350072 2,420,116.00 % 2,420,116.00 % 0x0A00008A 0 836.00 % 451,888.00 % 0x0A000045 0 9,616.00 % 399,436.00 % 0x0A000039 0 18,202.00 % 298,223.00 % 0x06000046 1479900 I am so close to being able to find the bottlenecks, if only it will give me the function and module names instead of hex numbers! What am I doing wrong? --- Alistair.

    Read the article

  • Silverlight Firestarter Wrap Up and WCF RIA Services Talk Sample Code

    - by dwahlin
    I had a great time attending and speaking at the Silverlight Firestarter event up in Redmond on December 2, 2010. In addition to getting a chance to hang out with a lot of cool people from Microsoft such as Scott Guthrie, John Papa, Tim Heuer, Brian Goldfarb, John Allwright, David Pugmire, Jesse Liberty, Jeff Handley, Yavor Georgiev, Jossef Goldberg, Mike Cook and many others, I also had a chance to chat with a lot of people attending the event and hear about what projects they’re working on which was awesome. If you didn’t get a chance to look through all of the new features coming in Silverlight 5 check out John Papa’s post on the subject. While at the Silverlight Firestarter event I gave a presentation on WCF RIA Services and wanted to get the code posted since several people have asked when it’d be available. The talk can be viewed by clicking the image below. Code from the talk follows as well as additional links. I had a few people ask about the green bracelet on my left hand since it looks like something you’d get from a waterpark. It was used to get us access down a little hall that led backstage and allowed us to go backstage during the event. I thought it looked kind of dorky but it was required to get through security. Sample Code from My WCF RIA Services Talk (To login to the 2 apps use “user” and “P@ssw0rd”. Make sure to do a rebuild of the projects in Visual Studio before running them.) View All Silverlight Firestarter Talks and Scott Guthrie’s Keynote WCF RIA Services SP1 Beta for Silverlight 4 WCF RIA Services Code Samples (including some SP1 samples) Improved binding support in EntitySet and EntityCollection with SP1 (Kyle McClellan’s Blog) Introducing an MVVM-Friendly DomainDataSource: The DomainCollectionView (Kyle McClellan’s Blog) I’ve had the chance to speak at a lot of conferences but never with as many cameras, streaming capabilities, people watching live and overall hype involved. Over 1000 people registered to attend the conference in person at the Microsoft campus and well over 15,000 to watch it through the live stream.  The event started for me on Tuesday afternoon with a flight up to Seattle from Phoenix. My flight was delayed 1 1/2 hours (I seem to be good at booking delayed flights) so I didn’t get up there until almost 8 PM. John Papa did a tech check at 9 PM that night and I was scheduled for 9:30 PM. We basically plugged in my laptop backstage (amazing number of servers, racks and audio devices back there) and made sure everything showed up properly on the projector and the machines recording the presentation. In addition to a dedicated show director, there were at least 5 tech people back stage and at least that many up in the booth running lights, audio, cameras, and other aspects of the show. I wish I would’ve taken a picture of the backstage setup since it was pretty massive – servers all over the place. I definitely gained a new appreciation for how much work goes into these types of events. Here’s what the room looked like right before my tech check– not real exciting at this point. That’s Yavor Georgiev (who spoke on WCF Services at the Firestarter) in the background. We had plenty of monitors to reference during the presentation. Two monitors for slides (right and left side) and a notes monitor. The 4th monitor showed the time and they’d type in notes to us as we talked (such as “You’re over time!” in my case since I went around 4 minutes over :-)). Wednesday morning I went back on campus at Microsoft and watched John Papa film a few Silverlight TV episodes with Dave Campbell and Ryan Plemons.   Next I had the chance to watch the dry run of the keynote with Scott Guthrie and John Papa. We were all blown away by the demos shown since they were even better than expected. Starting at 1 PM on Wednesday I went over to Building 35 and listened to Yavor Georgiev (WCF Services), Jaime Rodriguez (Windows Phone 7), Jesse Liberty (Data Binding) and Jossef Goldberg and Mike Cook (Silverlight Performance) give their different talks and we all shared feedback with each other which was a lot of fun. Jeff Handley from the RIA Services team came afterwards and listened to me give a dry run of my WCF RIA Services talk. He had some great feedback that I really appreciated getting. That night I hung out with John Papa and Ward Bell and listened to John walk through his keynote demos. I also got a sneak peak of the gift given to Dave Campbell for all his work with Silverlight Cream over the years. It’s a poster signed by all of the key people involved with Silverlight: Thursday morning I got up fairly early to get to the event center by 8 AM for speaker pictures. It was nice and quiet at that point although outside the room there was a huge line of people waiting to get in.     At around 8:30 AM everyone was let in and the main room was filled quickly. Two other overflow rooms in the Microsoft conference center (Building 33) were also filled to capacity. At around 9 AM Scott Guthrie kicked off the event and all the excitement started! From there it was all a blur but it was definitely a lot of fun. All of the sessions for the Silverlight Firestarter were recorded and can be watched here (including the keynote). Corey Schuman, John Papa and I also released 11 lab exercises and associated videos to help people get started with Silverlight. Definitely check them out if you’re interested in learning more! Level 100: Getting Started Lab 01 - WinForms and Silverlight Lab 02 - ASP.NET and Silverlight Lab 03 - XAML and Controls Lab 04 - Data Binding Level 200: Ready for More Lab 05 - Migrating Apps to Out-of-Browser Lab 06 - Great UX with Blend Lab 07 - Web Services and Silverlight Lab 08 - Using WCF RIA Services Level 300: Take me Further Lab 09 - Deep Dive into Out-of-Browser Lab 10 - Silverlight Patterns: Using MVVM Lab 11 - Silverlight and Windows Phone 7

    Read the article

  • Monitoring Events in your BPEL Runtime - RSS Feeds?

    - by Ramkumar Menon
    @10g - It had been a while since I'd tried something different. so here's what I did this week!Whenever our Developers deployed processes to the BPEL runtime, or perhaps when a process gets turned off due to connectivity issues, or maybe someone retired a process, I needed to know. So here's what I did. Step 1: Downloaded Quartz libraries and went through the documentation to understand what it takes to schedule a recurring job. Step 2: Cranked out two components using Oracle JDeveloper. [Within a new Web Project] a) A simple Java Class named FeedUpdater that extends org.quartz.Job. All this class does is to connect to your BPEL Runtime [via opmn:ormi] and fetch all events that occured in the last "n" minutes. events? - If it doesn't ring a bell - its right there on the BPEL Console. If you click on "Administration > Process Log" - what you see are events.The API to retrieve the events is //get the locator reference for the domain you are interested in.Locator l = .... //Predicate to retrieve events for last "n" minutesWhereCondition wc = new WhereCondition(...) //get all those events you needed.BPELProcessEvent[] events = l.listProcessEvents(wc); After you get all these events, write out these into an RSS Feed XML structure and stream it into a file that resides either in your Apache htdocs, or wherever it can be accessed via HTTP.You can read all about RSS 2.0 here. At a high level, here is how it looks like. <?xml version = '1.0' encoding = 'UTF-8'?><rss version="2.0">  <channel>    <title>Live Updates from the Development Environment</title>    <link>http://soadev.myserver.com/feeds/</link>    <description>Live Updates from the Development Environment</description>    <lastBuildDate>Fri, 19 Nov 2010 01:03:00 PST</lastBuildDate>    <language>en-us</language>    <ttl>1</ttl>    <item>      <guid>1290213724692</guid>      <title>Process compiled</title>      <link>http://soadev.myserver.com/BPELConsole/mdm_product/administration.jsp?mode=processLog&amp;processName=&amp;dn=all&amp;eventType=all&amp;eventDate=600&amp;Filter=++Filter++</link>      <pubDate>Fri Nov 19 00:00:37 PST 2010</pubDate>      <description>SendPurchaseOrderRequestService: 3.0 Time : Fri Nov 19 00:00:37                   PST 2010</description>    </item>   ...... </channel> </rss> For writing ut XML content, read through Oracle XML Parser APIs - [search around for oracle.xml.parser.v2] b) Now that my "Job" was done, my job was half done. Next, I wrote up a simple Scheduler Servlet that schedules the above "Job" class to be executed ever "n" minutes. It is very straight forward. Here is the primary section of the code.           try {        Scheduler sched = StdSchedulerFactory.getDefaultScheduler();         //get n and make a trigger that executes every "n" seconds        Trigger trigger = TriggerUtils.makeSecondlyTrigger(n);        trigger.setName("feedTrigger" + System.currentTimeMillis());        trigger.setGroup("feedGroup");                JobDetail job = new JobDetail("SOA_Feed" + System.currentTimeMillis(), "feedGroup", FeedUpdater.class);        sched.scheduleJob(job,trigger);         }catch(Exception ex) {            ex.printStackTrace();            throw new ServletException(ex.getMessage());        } Look up the Quartz API and documentation. It will make this look much simpler.   Now that both components were ready, I packaged the Application into a war file and deployed it onto my Application Server. When the servlet initialized, the "n" second schedule was set/initialized. From then on, the servlet kept populating the RSS Feed file. I just ensured that my "Job" code keeps only 30 latest events within it, so that the feed file is small and under control. [a few kbs]   Next I opened up the feed xml on my browser - It requested a subscription - and Here I was - watching new deployments/life cycle events all popping up on my browser toolbar every 5 (actually n)  minutes!   Well, you could do it on a browser/reader of your choice - or perhaps read them like you read an email on your thunderbird!.      

    Read the article

  • How to include a PHP generated XML file into flash vars, while ALSO passing through the current php functions into it?

    - by Sam
    Hello Given situation: In webpage.php the flashscript is calling a flash script with a flashvar: the playlist file which is a PHP generated XML file: playlist.php, it does that well so long as there are no extra functions in there. Now, in that XML-format playlistfile there needs to be a special function, besides the usual echo("");, namely the very special echo __(""); function that is already declared in webpage.php which needs to do something with the paragraphs residing within that xml file. However, currently the retrieved file misses the function echo __();and says "no such function declared in that xml-format [playlist.php] file". The php functions that are currently included at the very top of webpage.php somehow do not pass-through-the necessary functions into the playlist file for it to recognise how to handle it, in order for that playlist to get those necessary functions working. Apparently these are not passed through automatically/properly when residing in the flashvars?? Cause the echo __(""); works fine when called within webpage.php or via a normal php include(""); if those functions are in a different php file. But not working from the playlist.php file. Any ideas why/what is going on here? I appreciate your clues for this prob +1. Thanks very much. WEBPAGE.PHP the webpage, has at the top an include with functions: <?php include (functions.php); ?> // function that know what to do with echo __("paragraph") <script language="JavaScript" type="text/javascript"> run( 'play', 'true', 'loop', 'true', 'flashvars', 'xmlFile=/incl/playlist.php', // <<<< !! 'wmode', 'transparent', 'allowScriptAccess','sameDomain', ); </script> <noscript> <object classid="blabla"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="/movies/movie.swf" /> <param name="flashvars" value="xmlFile=/incl/playlist.php" /> // <<< !! <embed src="/movies/movies.swf" type="application/x-shockwave-flash"/> </object> </noscript> PLAYLIST.PHP The PHP generated XML file which is retrieved into the webpage as flash variable (see above) <?php echo ('<?xml version="1.0" encoding="UTF-8"?>'); echo ('<songs>'); echo ('<song version="1. "') . __("boom blue blow bell bowl") . ('/>'); echo ('<song version="2. "') . __("ball bail beam bike base") . ('/>'); echo ('</songs>'); ?>

    Read the article

  • C#: System.Collections.Concurrent.ConcurrentQueue vs. Queue

    - by James Michael Hare
    I love new toys, so of course when .NET 4.0 came out I felt like the proverbial kid in the candy store!  Now, some people get all excited about the IDE and it’s new features or about changes to WPF and Silver Light and yes, those are all very fine and grand.  But me, I get all excited about things that tend to affect my life on the backside of development.  That’s why when I heard there were going to be concurrent container implementations in the latest version of .NET I was salivating like Pavlov’s dog at the dinner bell. They seem so simple, really, that one could easily overlook them.  Essentially they are implementations of containers (many that mirror the generic collections, others are new) that have either been optimized with very efficient, limited, or no locking but are still completely thread safe -- and I just had to see what kind of an improvement that would translate into. Since part of my job as a solutions architect here where I work is to help design, develop, and maintain the systems that process tons of requests each second, the thought of extremely efficient thread-safe containers was extremely appealing.  Of course, they also rolled out a whole parallel development framework which I won’t get into in this post but will cover bits and pieces of as time goes by. This time, I was mainly curious as to how well these new concurrent containers would perform compared to areas in our code where we manually synchronize them using lock or some other mechanism.  So I set about to run a processing test with a series of producers and consumers that would be either processing a traditional System.Collections.Generic.Queue or a System.Collection.Concurrent.ConcurrentQueue. Now, I wanted to keep the code as common as possible to make sure that the only variance was the container, so I created a test Producer and a test Consumer.  The test Producer takes an Action<string> delegate which is responsible for taking a string and placing it on whichever queue we’re testing in a thread-safe manner: 1: internal class Producer 2: { 3: public int Iterations { get; set; } 4: public Action<string> ProduceDelegate { get; set; } 5: 6: public void Produce() 7: { 8: for (int i = 0; i < Iterations; i++) 9: { 10: ProduceDelegate(“Hello”); 11: } 12: } 13: } Then likewise, I created a consumer that took a Func<string> that would read from whichever queue we’re testing and return either the string if data exists or null if not.  Then, if the item doesn’t exist, it will do a 10 ms wait before testing again.  Once all the producers are done and join the main thread, a flag will be set in each of the consumers to tell them once the queue is empty they can shut down since no other data is coming: 1: internal class Consumer 2: { 3: public Func<string> ConsumeDelegate { get; set; } 4: public bool HaltWhenEmpty { get; set; } 5: 6: public void Consume() 7: { 8: bool processing = true; 9: 10: while (processing) 11: { 12: string result = ConsumeDelegate(); 13: 14: if(result == null) 15: { 16: if (HaltWhenEmpty) 17: { 18: processing = false; 19: } 20: else 21: { 22: Thread.Sleep(TimeSpan.FromMilliseconds(10)); 23: } 24: } 25: else 26: { 27: DoWork(); // do something non-trivial so consumers lag behind a bit 28: } 29: } 30: } 31: } Okay, now that we’ve done that, we can launch threads of varying numbers using lambdas for each different method of production/consumption.  First let's look at the lambdas for a typical System.Collections.Generics.Queue with locking: 1: // lambda for putting to typical Queue with locking... 2: var productionDelegate = s => 3: { 4: lock (_mutex) 5: { 6: _mutexQueue.Enqueue(s); 7: } 8: }; 9:  10: // and lambda for typical getting from Queue with locking... 11: var consumptionDelegate = () => 12: { 13: lock (_mutex) 14: { 15: if (_mutexQueue.Count > 0) 16: { 17: return _mutexQueue.Dequeue(); 18: } 19: } 20: return null; 21: }; Nothing new or interesting here.  Just typical locks on an internal object instance.  Now let's look at using a ConcurrentQueue from the System.Collections.Concurrent library: 1: // lambda for putting to a ConcurrentQueue, notice it needs no locking! 2: var productionDelegate = s => 3: { 4: _concurrentQueue.Enqueue(s); 5: }; 6:  7: // lambda for getting from a ConcurrentQueue, once again, no locking required. 8: var consumptionDelegate = () => 9: { 10: string s; 11: return _concurrentQueue.TryDequeue(out s) ? s : null; 12: }; So I pass each of these lambdas and the number of producer and consumers threads to launch and take a look at the timing results.  Basically I’m timing from the time all threads start and begin producing/consuming to the time that all threads rejoin.  I won't bore you with the test code, basically it just launches code that creates the producers and consumers and launches them in their own threads, then waits for them all to rejoin.  The following are the timings from the start of all threads to the Join() on all threads completing.  The producers create 10,000,000 items evenly between themselves and then when all producers are done they trigger the consumers to stop once the queue is empty. These are the results in milliseconds from the ordinary Queue with locking: 1: Consumers Producers 1 2 3 Time (ms) 2: ---------- ---------- ------ ------ ------ --------- 3: 1 1 4284 5153 4226 4554.33 4: 10 10 4044 3831 5010 4295.00 5: 100 100 5497 5378 5612 5495.67 6: 1000 1000 24234 25409 27160 25601.00 And the following are the results in milliseconds from the ConcurrentQueue with no locking necessary: 1: Consumers Producers 1 2 3 Time (ms) 2: ---------- ---------- ------ ------ ------ --------- 3: 1 1 3647 3643 3718 3669.33 4: 10 10 2311 2136 2142 2196.33 5: 100 100 2480 2416 2190 2362.00 6: 1000 1000 7289 6897 7061 7082.33 Note that even though obviously 2000 threads is quite extreme, the concurrent queue actually scales really well, whereas the traditional queue with simple locking scales much more poorly. I love the new concurrent collections, they look so much simpler without littering your code with the locking logic, and they perform much better.  All in all, a great new toy to add to your arsenal of multi-threaded processing!

    Read the article

  • Scripting Language Sessions at Oracle OpenWorld and MySQL Connect, 2012

    - by cj
    This posts highlights some great scripting language sessions coming up at the Oracle OpenWorld and MySQL Connect conferences. These events are happening in San Francisco from the end of September. You can search for other interesting conference sessions in the Content Catalog. Also check out what is happening at JavaOne in that event's Content Catalog (I haven't included sessions from it in this post.) To find the timeslots and locations of each session, click their respective link and check the "Session Schedule" box on the top right. GEN8431 - General Session: What’s New in Oracle Database Application Development This general session takes a look at what’s been new in the last year in Oracle Database application development tools using the latest generation of database technology. Topics range from Oracle SQL Developer and Oracle Application Express to Java and PHP. (Thomas Kyte - Architect, Oracle) BOF9858 - Meet the Developers of Database Access Services (OCI, ODBC, DRCP, PHP, Python) This session is your opportunity to meet in person the Oracle developers who have built Oracle Database access tools and products such as the Oracle Call Interface (OCI), Oracle C++ Call Interface (OCCI), and Open Database Connectivity (ODBC) drivers; Transparent Application Failover (TAF); Oracle Database Instant Client; Database Resident Connection Pool (DRCP); Oracle Net Services, and so on. The team also works with those who develop the PHP, Ruby, Python, and Perl adapters for Oracle Database. Come discuss with them the features you like, your pains, and new product enhancements in the latest database technology. CON8506 - Syndication and Consolidation: Oracle Database Driver for MySQL Applications This technical session presents a new Oracle Database driver that enables you to run MySQL applications (written in PHP, Perl, C, C++, and so on) against Oracle Database with almost no code change. Use cases for such a driver include application syndication such as interoperability across a relationship database management system, application migration, and database consolidation. In addition, the session covers enhancements in database technology that enable and simplify the migration of third-party databases and applications to and consolidation with Oracle Database. Attend this session to learn more and see a live demo. (Srinath Krishnaswamy - Director, Software Development, Oracle. Kuassi Mensah - Director Product Management, Oracle. Mohammad Lari - Principal Technical Staff, Oracle ) CON9167 - Current State of PHP and MySQL Together, PHP and MySQL power large parts of the Web. The developers of both technologies continue to enhance their software to ensure that developers can be satisfied despite all their changing and growing needs. This session presents an overview of changes in PHP 5.4, which was released earlier this year and shows you various new MySQL-related features available for PHP, from transparent client-side caching to direct support for scaling and high-availability needs. (Johannes Schlüter - SoftwareDeveloper, Oracle) CON8983 - Sharding with PHP and MySQL In deploying MySQL, scale-out techniques can be used to scale out reads, but for scaling out writes, other techniques have to be used. To distribute writes over a cluster, it is necessary to shard the database and store the shards on separate servers. This session provides a brief introduction to traditional MySQL scale-out techniques in preparation for a discussion on the different sharding techniques that can be used with MySQL server and how they can be implemented with PHP. You will learn about static and dynamic sharding schemes, their advantages and drawbacks, techniques for locating and moving shards, and techniques for resharding. (Mats Kindahl - Senior Principal Software Developer, Oracle) CON9268 - Developing Python Applications with MySQL Utilities and MySQL Connector/Python This session discusses MySQL Connector/Python and the MySQL Utilities component of MySQL Workbench and explains how to write MySQL applications in Python. It includes in-depth explanations of the features of MySQL Connector/Python and the MySQL Utilities library, along with example code to illustrate the concepts. Those interested in learning how to expand or build their own utilities and connector features will benefit from the tips and tricks from the experts. This session also provides an opportunity to meet directly with the engineers and provide feedback on your issues and priorities. You can learn what exists today and influence future developments. (Geert Vanderkelen - Software Developer, Oracle) BOF9141 - MySQL Utilities and MySQL Connector/Python: Python Developers, Unite! Come to this lively discussion of the MySQL Utilities component of MySQL Workbench and MySQL Connector/Python. It includes in-depth explanations of the features and dives into the code for those interested in learning how to expand or build their own utilities and connector features. This is an audience-driven session, so put on your best Python shirt and let’s talk about MySQL Utilities and MySQL Connector/Python. (Geert Vanderkelen - Software Developer, Oracle. Charles Bell - Senior Software Developer, Oracle) CON3290 - Integrating Oracle Database with a Social Network Facebook, Flickr, YouTube, Google Maps. There are many social network sites, each with their own APIs for sharing data with them. Most developers do not realize that Oracle Database has base tools for communicating with these sites, enabling all manner of information, including multimedia, to be passed back and forth between the sites. This technical presentation goes through the methods in PL/SQL for connecting to, and then sending and retrieving, all types of data between these sites. (Marcelle Kratochvil - CTO, Piction) CON3291 - Storing and Tuning Unstructured Data and Multimedia in Oracle Database Database administrators need to learn new skills and techniques when the decision is made in their organization to let Oracle Database manage its unstructured data. They will face new scalability challenges. A single row in a table can become larger than a whole database. This presentation covers the techniques a DBA needs for managing the large volume of data in a standard Oracle Database instance. (Marcelle Kratochvil - CTO, Piction) CON3292 - Using PHP, Perl, Visual Basic, Ruby, and Python for Multimedia in Oracle Database These five programming languages are just some of the most popular ones in use at the moment in the marketplace. This presentation details how you can use them to access and retrieve multimedia from Oracle Database. It covers programming techniques and methods for achieving faster development against Oracle Database. (Marcelle Kratochvil - CTO, Piction) UGF5181 - Building Real-World Oracle DBA Tools in Perl Perl is not normally associated with building mission-critical application or DBA tools. Learn why Perl could be a good choice for building your next killer DBA app. This session draws on real-world experience of building DBA tools in Perl, showing the framework and architecture needed to deal with portability, efficiency, and maintainability. Topics include Perl frameworks; Which Comprehensive Perl Archive Network (CPAN) modules are good to use; Perl and CPAN module licensing; Perl and Oracle connectivity; Compiling and deploying your app; An example of what is possible with Perl. (Arjen Visser - CEO & CTO, Dbvisit Software Limited) CON3153 - Perl: A DBA’s and Developer’s Best (Forgotten) Friend This session reintroduces Perl as a language of choice for many solutions for DBAs and developers. Discover what makes Perl so successful and why it is so versatile in our day-to-day lives. Perl can automate all those manual tasks and is truly platform-independent. Perl may not be in the limelight the way other languages are, but it is a remarkable language, it is still very current with ongoing development, and it has amazing online resources. Learn what makes Perl so great (including CPAN), get an introduction to Perl language syntax, find out what you can use Perl for, hear how Oracle uses Perl, discover the best way to learn Perl, and take away a small Perl project challenge. (Arjen Visser - CEO & CTO, Dbvisit Software Limited) CON10332 - Oracle RightNow CX Cloud Service’s Connect PHP API: Intro, What’s New, and Roadmap Connect PHP is a public API that enables developers to build solutions with the Oracle RightNow CX Cloud Service platform. This API is used primarily by developers working within the Oracle RightNow Customer Portal Cloud Service framework who are looking to gain access to data and services hosted by the Oracle RightNow CX Cloud Service platform through a backward-compatible API. Connect for PHP leverages the same data model and services as the Connect Web Services for SOAP API. Come to this session to get an introduction and learn what’s new and what’s coming up. (Mark Rhoads - Senior Principal Applications Engineer, Oracle. Mark Ericson - Sr. Principle Product Manager, Oracle) CON10330 - Oracle RightNow CX Cloud Service APIs and Frameworks Overview Oracle RightNow CX Cloud Service APIs are available in the following areas: desktop UI, Web services, customer portal, PHP, and knowledge. These frameworks provide access to Oracle RightNow CX Cloud Service’s Connect Common Object Model and custom objects. This session provides a broad overview of capabilities in all these areas. (Mark Ericson - Sr. Principle Product Manager, Oracle)

    Read the article

  • CodePlex Daily Summary for Friday, February 26, 2010

    CodePlex Daily Summary for Friday, February 26, 2010New Projectsaion-gamecp: Aion Gamecp for aion Private server based on Aion UniqueAzure Email Queuer: Azure Email Queuer makes it easier for Developers Programming in the Cloud to Queue Emails to keep the UI Thread Clear for Requests. Developed w...BIG1: Bob and Ian's Game. Written using XNA Game Studio Express. Basically an update of David Braben and Ian Bell's classic game "Elite." This is a nonco...CMS7: CMS7 The CMS7 is composed of three module. (1)Main CMS Business (2)Process Customization (3)Role/Department CustomizationCoreSharp Networking Core: A simple to use framework to develop efficient client/server application. The framework is part of my project at school and I hope it will benefit ...Fullscreen Countdown: Small and basic countdown application. The countdown window can be resized to fit any size to display the minutes elapsed. Developped in C#, .NET F...IRC4N00bz: Learning sockets, events, delegates, SQL, and IRC commands all in one big project! It's written in C# (Csharp) and hope you find it helpfull, or ev...LjSystem: This project is a collection of my extensions to the BCLMP3 Tags Management: A software to manage the tags of MP3 filesnetone: All net in oneNext Dart (Dublin Area Rapid Transport): The shows the times of the next darts from a given station. It is a windows application that updates automatically and so is easier to use than th...PChat - An OCDotNet.Org Presentation: PChat is a multithreaded pinnable chat server and client. It is designed to be a demonstration of Visual Studio 2010 MVC 2, for ocdotnet.org Use...Pittsburgh Code Camp iPhone App: The Pittsburgh Code Camp iPhone Application is meant as a demonstration of the creation of an iPhone application while at the same time providing t...Radical: Radical is an infrastructure frameworkRadioAutomation: Windows application for radio automation.SilverSynth - Digital Audio Synthesis for Silverlight: SilverSynth is a digial audio synthesis library for Silverlight developers to create synthesized wave forms from code. It supports synthesis of sin...SkeinLibManaged: This implementation of the Skein Cryptographic Hash function is written entirely in Managed CSharp. It is posted here to share with the world at l...SpecExplorerEval: We are checking out spec explorer and presenting on its useSPOJemu: This is a SPOJ emulator. It allows you to define tests in xml and then check your application if it's working as you expected.The C# Skype Chat bot: A Skype bot in C# for managing Skype chats.VS 2010 Architecture Layers Patterns: Architecture layers patterns toolbox items for layers diagrams.Yakiimo3D: Mostly DirectX 11 programming tutorials.代码生成器: Project DetailsNew ReleasesArkSwitch: ArkSwitch v1.1.1: This release fixes a crash that occurs when certain processes with multiple primary windows are encountered.BTP Tools: CSB, CUV and HCSB e-Sword files 2010-02-26: include csb.bbl csb+.bbl csb.cmt csbc.dct cuv.bbl cuv+.bbl cuv.cmt cuvc.dct hcsb+.bbl hcsbc.dct files for e-Sword 8.0BubbleBurst: BubbleBurst v1.1: This is the second release of BubbleBurst, the subject of the book Advanced MVVM. This release contains a minor fix that was added after the book ...DevTreks -social budgeting that improves lives and livelihoods: Social Budgeting Web Software, alpha 3b: Alpha 3b simplifies and strengthens state management. With the exception of linked lists, the internal mechanics of addins have not been improved...Dragonrealms PvpStance plugin for Genie: 1.0.0.4: This updated is needed now that the DR server move broke the "profile soandso pvp" syntax. This version will capture the pvp stance out of the full...FastCode: FastCode 1.0: Definitions <integerType> : byte, sbyte, short, ushort, int, uint, long, ulond <floatType> : float, double, decimal Base types extensions Intege...Fullscreen Countdown: Fullscreen Countdown 1.0: First versionIRC4N00bz: IRC4N00bz_02252010.zip: I'm calling it a night. Here's the dll for where I'm at so far. It works, just lakcs some abilities. Anything not included can be pulled from th...Labrado: Labrado MiniTimer: Labrado MiniTimer is a convenient timer tool designed and implemented for GMAT test preparation.LINQ to VFP: LinqToVfp (v1.0.17.1): Cleaned up WCF Data Service Expression Tree. (details...) This build requires IQToolkit v0.17b.Microsoft Health Common User Interface: Release 8.0.200.000: This is version 8.0 of the Microsoft® Health Common User Interface Control Toolkit. The scope and requirements of this release are based on materia...Mini SQL Query: Mini SQL Query Funky Dev Build (RC1+): The "Funk Dev Build" bit is that I added a couple of features I think are pretty cool. It is a "dev" build but I class it as stable. Find Object...Neovolve: Neovolve.BlogEngine.Extensions 1.2: Updated extensions to work with BE 1.6. Updated Snippets extension to better handle excluded tags and fixed regex bug. Added SyntaxHighlighter exte...Neovolve: Neovolve.BlogEngine.Web 1.1: Update to support BE version 1.6 Neovolve.BlogEngine.Web 1.1 contains a redirector module that translates Community Server url formats into BlogEn...Next Dart (Dublin Area Rapid Transport): 1.0: There are 2 files NextDart 1.0.zip This contains just the files. Extract it to a folder and run NextDart.exe. NextDart 1.0 Intaller.zip This c...Powershell4SQL: Version 1.2: Changes from version 1.1 Added additional attributes to simplify syntax. Server and Database become optional. Defaulted to (local) and 'master' ...Radical: Radical (Desktop) 1.0: First stable dropRaidTracker: Raid Tracker: a few tweaksRaiser's Edge API Developer Toolkit: Alpha Release 1: This is an untested, alpha release. Contains RE API Toolkit built using 7.85 Dlls and 7.91 Dlls.SharePoint Enhanced Calendar by ArtfulBits: ArtfulBits.EnhancedCalendar v1.3: New Features: Simple to activate mechanism added (add Enhanced Calendar Web Part on the same page as standard calendar) Support for any type of S...Silverlight 4.0 Com Library for SQL Server Access: Version 1.0: This is the intial alpha release. It includes ExecuteQuery, ExecuteNonQuery and ExecuteScalar routines. See roadmap section of home page for detai...Silverlight HTML 5 Canvas: SLCanvas 1.1: This release enables <canvas renderMethod="auto" onload="runme(this)"></canvas> or <canvas renderMethod="Silverlight" onload="runme(this)"></ca...SilverSynth - Digital Audio Synthesis for Silverlight: SilverSynth 1.0: Source code including demo application.StringDefs: StringDefs Alpha Release 1.01: In this release of the Library few namespaces are added.STSDev 2008: STSDev 2008 2.1: Update to the StsDev 2008 project to correct Manifest Building issues.Text to HTML: 0.4.0.2: Cambios de la versión:Correcciones menores en el sistema de traducción. Controlada la excepción aparecida al suprimir los archivos de idioma. A...The Silverlight Hyper Video Player [http://slhvp.com]: Release 4 - Friendly User Release (Pre-Beta): Release 4 - Friendly User Release (Pre-Beta) This version of the code has much of the design that we plan to go forward with for Mix and utilizes a...TreeSizeNet: TreeSizeNet 0.10.2: - Assemblies merged in one executableVCC: Latest build, v2.1.30225.0: Automatic drop of latest buildVCC: Latest build, v2.1.30225.1: Automatic drop of latest buildVS 2010 Architecture Layers Patterns: VS 2010 RC Architecture Layers Patterns v1.0: Architecture layers patterns toolbox items based on the Microsoft Application Architecture Guide, 2nd Edition for the layer diagram designer of Vi...Yakiimo3D: DirectX11 BitonicSortCPU Source and Binary: DirectX11 BitonicSortCPU sample source and binary.Yakiimo3D: DirectX11 MandelbrotGPU Source and Binary: DirectX11 MandelbrotGPU source and binary.Most Popular ProjectsVSLabOSIS Interop TestsRawrWBFS ManagerAJAX Control ToolkitMicrosoft SQL Server Product Samples: DatabaseSilverlight ToolkitWindows Presentation Foundation (WPF)ASP.NETMicrosoft SQL Server Community & SamplesMost Active ProjectsDinnerNow.netRawrBlogEngine.NETSLARToolkit - Silverlight Augmented Reality ToolkitInfoServiceSharpMap - Geospatial Application Framework for the CLRCommon Context AdaptersNB_Store - Free DotNetNuke Ecommerce Catalog ModulejQuery Library for SharePoint Web Servicespatterns & practices – Enterprise Library

    Read the article

  • SQL Spatial: Getting “nearest” calculations working properly

    - by Rob Farley
    If you’ve ever done spatial work with SQL Server, I hope you’ve come across the ‘nearest’ problem. You have five thousand stores around the world, and you want to identify the one that’s closest to a particular place. Maybe you want the store closest to the LobsterPot office in Adelaide, at -34.925806, 138.605073. Or our new US office, at 42.524929, -87.858244. Or maybe both! You know how to do this. You don’t want to use an aggregate MIN or MAX, because you want the whole row, telling you which store it is. You want to use TOP, and if you want to find the closest store for multiple locations, you use APPLY. Let’s do this (but I’m going to use addresses in AdventureWorks2012, as I don’t have a list of stores). Oh, and before I do, let’s make sure we have a spatial index in place. I’m going to use the default options. CREATE SPATIAL INDEX spin_Address ON Person.Address(SpatialLocation); And my actual query: WITH MyLocations AS (SELECT * FROM (VALUES ('LobsterPot Adelaide', geography::Point(-34.925806, 138.605073, 4326)),                        ('LobsterPot USA', geography::Point(42.524929, -87.858244, 4326))                ) t (Name, Geo)) SELECT l.Name, a.AddressLine1, a.City, s.Name AS [State], c.Name AS Country FROM MyLocations AS l CROSS APPLY (     SELECT TOP (1) *     FROM Person.Address AS ad     ORDER BY l.Geo.STDistance(ad.SpatialLocation)     ) AS a JOIN Person.StateProvince AS s     ON s.StateProvinceID = a.StateProvinceID JOIN Person.CountryRegion AS c     ON c.CountryRegionCode = s.CountryRegionCode ; Great! This is definitely working. I know both those City locations, even if the AddressLine1s don’t quite ring a bell. I’m sure I’ll be able to find them next time I’m in the area. But of course what I’m concerned about from a querying perspective is what’s happened behind the scenes – the execution plan. This isn’t pretty. It’s not using my index. It’s sucking every row out of the Address table TWICE (which sucks), and then it’s sorting them by the distance to find the smallest one. It’s not pretty, and it takes a while. Mind you, I do like the fact that it saw an indexed view it could use for the State and Country details – that’s pretty neat. But yeah – users of my nifty website aren’t going to like how long that query takes. The frustrating thing is that I know that I can use the index to find locations that are within a particular distance of my locations quite easily, and Microsoft recommends this for solving the ‘nearest’ problem, as described at http://msdn.microsoft.com/en-au/library/ff929109.aspx. Now, in the first example on this page, it says that the query there will use the spatial index. But when I run it on my machine, it does nothing of the sort. I’m not particularly impressed. But what we see here is that parallelism has kicked in. In my scenario, it’s split the data up into 4 threads, but it’s still slow, and not using my index. It’s disappointing. But I can persuade it with hints! If I tell it to FORCESEEK, or use my index, or even turn off the parallelism with MAXDOP 1, then I get the index being used, and it’s a thing of beauty! Part of the plan is here: It’s massive, and it’s ugly, and it uses a TVF… but it’s quick. The way it works is to hook into the GeodeticTessellation function, which is essentially finds where the point is, and works out through the spatial index cells that surround it. This then provides a framework to be able to see into the spatial index for the items we want. You can read more about it at http://msdn.microsoft.com/en-us/library/bb895265.aspx#tessellation – including a bunch of pretty diagrams. One of those times when we have a much more complex-looking plan, but just because of the good that’s going on. This tessellation stuff was introduced in SQL Server 2012. But my query isn’t using it. When I try to use the FORCESEEK hint on the Person.Address table, I get the friendly error: Msg 8622, Level 16, State 1, Line 1 Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN. And I’m almost tempted to just give up and move back to the old method of checking increasingly large circles around my location. After all, I can even leverage multiple OUTER APPLY clauses just like I did in my recent Lookup post. WITH MyLocations AS (SELECT * FROM (VALUES ('LobsterPot Adelaide', geography::Point(-34.925806, 138.605073, 4326)),                        ('LobsterPot USA', geography::Point(42.524929, -87.858244, 4326))                ) t (Name, Geo)) SELECT     l.Name,     COALESCE(a1.AddressLine1,a2.AddressLine1,a3.AddressLine1),     COALESCE(a1.City,a2.City,a3.City),     s.Name AS [State],     c.Name AS Country FROM MyLocations AS l OUTER APPLY (     SELECT TOP (1) *     FROM Person.Address AS ad     WHERE l.Geo.STDistance(ad.SpatialLocation) < 1000     ORDER BY l.Geo.STDistance(ad.SpatialLocation)     ) AS a1 OUTER APPLY (     SELECT TOP (1) *     FROM Person.Address AS ad     WHERE l.Geo.STDistance(ad.SpatialLocation) < 5000     AND a1.AddressID IS NULL     ORDER BY l.Geo.STDistance(ad.SpatialLocation)     ) AS a2 OUTER APPLY (     SELECT TOP (1) *     FROM Person.Address AS ad     WHERE l.Geo.STDistance(ad.SpatialLocation) < 20000     AND a2.AddressID IS NULL     ORDER BY l.Geo.STDistance(ad.SpatialLocation)     ) AS a3 JOIN Person.StateProvince AS s     ON s.StateProvinceID = COALESCE(a1.StateProvinceID,a2.StateProvinceID,a3.StateProvinceID) JOIN Person.CountryRegion AS c     ON c.CountryRegionCode = s.CountryRegionCode ; But this isn’t friendly-looking at all, and I’d use the method recommended by Isaac Kunen, who uses a table of numbers for the expanding circles. It feels old-school though, when I’m dealing with SQL 2012 (and later) versions. So why isn’t my query doing what it’s supposed to? Remember the query... WITH MyLocations AS (SELECT * FROM (VALUES ('LobsterPot Adelaide', geography::Point(-34.925806, 138.605073, 4326)),                        ('LobsterPot USA', geography::Point(42.524929, -87.858244, 4326))                ) t (Name, Geo)) SELECT l.Name, a.AddressLine1, a.City, s.Name AS [State], c.Name AS Country FROM MyLocations AS l CROSS APPLY (     SELECT TOP (1) *     FROM Person.Address AS ad     ORDER BY l.Geo.STDistance(ad.SpatialLocation)     ) AS a JOIN Person.StateProvince AS s     ON s.StateProvinceID = a.StateProvinceID JOIN Person.CountryRegion AS c     ON c.CountryRegionCode = s.CountryRegionCode ; Well, I just wasn’t reading http://msdn.microsoft.com/en-us/library/ff929109.aspx properly. The following requirements must be met for a Nearest Neighbor query to use a spatial index: A spatial index must be present on one of the spatial columns and the STDistance() method must use that column in the WHERE and ORDER BY clauses. The TOP clause cannot contain a PERCENT statement. The WHERE clause must contain a STDistance() method. If there are multiple predicates in the WHERE clause then the predicate containing STDistance() method must be connected by an AND conjunction to the other predicates. The STDistance() method cannot be in an optional part of the WHERE clause. The first expression in the ORDER BY clause must use the STDistance() method. Sort order for the first STDistance() expression in the ORDER BY clause must be ASC. All the rows for which STDistance returns NULL must be filtered out. Let’s start from the top. 1. Needs a spatial index on one of the columns that’s in the STDistance call. Yup, got the index. 2. No ‘PERCENT’. Yeah, I don’t have that. 3. The WHERE clause needs to use STDistance(). Ok, but I’m not filtering, so that should be fine. 4. Yeah, I don’t have multiple predicates. 5. The first expression in the ORDER BY is my distance, that’s fine. 6. Sort order is ASC, because otherwise we’d be starting with the ones that are furthest away, and that’s tricky. 7. All the rows for which STDistance returns NULL must be filtered out. But I don’t have any NULL values, so that shouldn’t affect me either. ...but something’s wrong. I do actually need to satisfy #3. And I do need to make sure #7 is being handled properly, because there are some situations (eg, differing SRIDs) where STDistance can return NULL. It says so at http://msdn.microsoft.com/en-us/library/bb933808.aspx – “STDistance() always returns null if the spatial reference IDs (SRIDs) of the geography instances do not match.” So if I simply make sure that I’m filtering out the rows that return NULL… …then it’s blindingly fast, I get the right results, and I’ve got the complex-but-brilliant plan that I wanted. It just wasn’t overly intuitive, despite being documented. @rob_farley

    Read the article

  • Add Service Reference is generating Message Contracts

    - by JohnIdol
    OK, this has been haunting me for a while, can't find much on Google and I am starting to lose hope so I am reverting to the SO community. When I import a given service using "Add service Reference" on Visual Studio 2008 (SP1) all the Request/Response messages are being unnecessarily wrapped into Message Contracts (named as -- "operationName" + "Request"/"Response" + "1" at the end). The code generator says: // CODEGEN: Generating message contract since the operation XXX is neither RPC nor document wrapped. The guys who are generating the wsdl from a Java service say they are specifying DOCUMENT-LITERAL/WRAPPED. Any help/pointer/clue would be highly appreciated. Update: this is a sample of my wsdl for one of the operations that look suspicious. Note the mismatch on the message element attribute for the request, compared to the response. <!- imports namespaces and defines elements --> <wsdl:types> <xsd:schema targetNamespace="http://WHATEVER/" xmlns:xsd_1="http://WHATEVER_1/" xmlns:xsd_2="http://WHATEVER_2/"> <xsd:import namespace="http://WHATEVER_1/" schemaLocation="WHATEVER_1.xsd"/> <xsd:import namespace="http://WHATEVER_2/" schemaLocation="WHATEVER_2.xsd"/> <xsd:element name="myOperationResponse" type="xsd_1:MyOperationResponse"/> <xsd:element name="myOperation" type="xsd_1:MyOperationRequest"/> </xsd:schema> </wsdl:types> <!- declares messages - NOTE the mismatch on the request element attribute compared to response --> <wsdl:message name="myOperationRequest"> <wsdl:part element="tns:myOperation" name="request"/> </wsdl:message> <wsdl:message name="myOperationResponse"> <wsdl:part element="tns:myOperationResponse" name="response"/> </wsdl:message> <!- operations --> <wsdl:portType name="MyService"> <wsdl:operation name="myOperation"> <wsdl:input message="tns:myOperationRequest"/> <wsdl:output message="tns:myOperationResponse"/> <wsdl:fault message="tns:myOperationFault" name="myOperationFault"/> <wsdl:fault message="tns:myOperationFault1" name="myOperationFault1"/> </wsdl:operation> </wsdl:portType> Update 2: I pulled all the types that I had in my imported namespace (they were in a separate xsd) into the wsdl, as I suspected the import could be triggering the message contract generation. To my surprise it was not the case and having all the types defined in the wsdl did not change anything. I then (out of desperation) started constructing wsdls from scratch and playing with the maxOccurs attributes of element attributes contained in a sequence attribute I was able to reproduce the undesired message contract generation behavior. Here's a sample of an element: <xsd:element name="myElement"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="arg1" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> Playing with maxOccurs on elements that are used as messages (all requests and responses basically) the following happens: maxOccurs = "1" does not trigger the wrapping macOcccurs 1 triggers the wrapping maxOccurs = "unbounded" triggers the wrapping I was not able to reproduce this on my production wsdl yet because the nesting of the types goes very deep, and it's gonna take me time to inspect it thoroughly. In the meanwhile I am hoping it might ring a bell - any help highly appreciated.

    Read the article

  • Build a gem with native extension (Gem::Installer::ExtensionBuildError)

    - by Arnaud Leymet
    I have the following configuration: uname -a : Linux 2.6.24.2 i686 GNU/Linux (Ubuntu) ruby -v : ruby 1.9.0 (2007-12-25 revision 14709) [i486-linux] rails -v : Rails 3.0.0.beta3 gem -v : 1.3.5 rake --version : rake, version 0.8.7 make -v : GNU Make 3.81 gem env : RUBYGEMS VERSION: 1.3.5 RUBY VERSION: 1.9.0 (2007-12-25 patchlevel 0) [i486-linux] INSTALLATION DIRECTORY: /usr/lib/ruby1.9/gems/1.9.0 RUBY EXECUTABLE: /usr/bin/ruby1.9 EXECUTABLE DIRECTORY: /usr/bin RUBYGEMS PLATFORMS: ruby x86-linux GEM PATHS: /usr/lib/ruby1.9/gems/1.9.0 /root/.gem/ruby/1.9.0 GEM CONFIGURATION: :update_sources = true :verbose = true :benchmark = false :backtrace = false :bulk_threshold = 1000 REMOTE SOURCES: http://gems.rubyforge.org/ And when I try this simple command: gem install nokogiri Here is what I get: # gem install nokogiri Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9 extconf.rb checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for xmlParseDoc() in -lxml2... yes checking for xsltParseStylesheetDoc() in -lxslt... yes checking for exsltFuncRegister() in -lexslt... yes checking for xmlRelaxNGSetParserStructuredErrors()... yes checking for xmlRelaxNGSetParserStructuredErrors()... yes checking for xmlRelaxNGSetValidStructuredErrors()... yes checking for xmlSchemaSetValidStructuredErrors()... yes checking for xmlSchemaSetParserStructuredErrors()... yes creating Makefile make cc -I. -I/usr/include/libxml2 -I/usr/include -I/usr/include/ruby-1.9.0/i486-linux -I/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include -D_FILE_OFFSET_BITS=64 -fPIC -fno-strict-aliasing -g -fPIC -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -o xml_document_fragment.o -c xml_document_fragment.c In the included file starting at ./nokogiri.h:75, From ./xml_document_fragment.h:4, From xml_document_fragment.c:1: ./xml_document.h:5:16: error: st.h : No file or folder with this type make: *** [xml_document_fragment.o] Error 1 Gem files will remain installed in /usr/lib/ruby1.9/gems/1.9.0/gems/nokogiri-1.4.1 for inspection. Results logged to /usr/lib/ruby1.9/gems/1.9.0/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out The "gem_make.out" file contains the exact same information as described above. If I try with another gem: gem install gherkin Here is what I get: u# gem install gherkin Building native extensions. This could take a while... ERROR: Error installing gherkin: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9 extconf.rb checking for main() in -lc... yes creating Makefile make cc -I. -I/usr/include/ruby-1.9.0/i486-linux -I/usr/include/ruby-1.9.0 -I. -D_FILE_OFFSET_BITS=64 -fPIC -fno-strict-aliasing -g -fPIC -o gherkin_lexer_ar.o -c gherkin_lexer_ar.c /Users/aslakhellesoy/scm/gherkin/tasks/../ragel/i18n/ar.c.rl:11:16: erreur: re.h : Aucun fichier ou dossier de ce type make: *** [gherkin_lexer_ar.o] Erreur 1 Gem files will remain installed in /usr/lib/ruby1.9/gems/1.9.0/gems/gherkin-1.0.30 for inspection. Results logged to /usr/lib/ruby1.9/gems/1.9.0/gems/gherkin-1.0.30/ext/gherkin_lexer_ar/gem_make.out In fact whenever I try to install a gem with native extension, I get the same type of error. Would that ring a bell to anyone?

    Read the article

  • How to develop an english .com domain value rating algorithm?

    - by Tom
    I've been thinking about an algorithm that should rougly be able to guess the value of an english .com domain in most cases. For this to work I want to perform tests that consider the strengths and weaknesses of an english .com domain. A simple point based system is what I had in mind, where each domain property can be given a certain weight to factor it's importance in. I had these properties in mind: domain character length Eg. initially 20 points are added. If the domain has 4 or less characters, no points are substracted. For each extra character, one or more points are substracted on an exponential basis (the more characters, the higher the penalty). domain characters Eg. initially 20 points are added. If the domain is only alphabetic, no points are substracted. For each non-alhabetic character, X points are substracted (exponential increase again). domain name words Scans through a big offline english database, including non-formal speech, eg. words like "tweet" should be recognized. Question 1 : where can I get a modern list of english words for use in such application? Are these lists available for free? Are there lists like these with non-formal words? The more words are found per character, the more points are added. So, a domain with a lot of characters will still not get a lot of points. words hype-level I believe this is a tricky one, but this should be the cause to differentiate perfect but boring domains from perfect and interesting domains. For example, the following domain is probably not that valueable: www.peanutgalaxy.com The algorithm should identify that peanuts and galaxies are not very popular topics on the web. This is just an example. On the other side, a domain like www.shopdeals.com should ring a bell to the hype test, as shops and deals are quite popular on the web. My initial thought would be to see how often these keywords are references to on the web, preferably with some database. Question 2: is this logic flawed, or does this hype level test have merit? Question 3: are such "hype databases" available? Or is there anything else that could work offline? The problem with eg. a query to google is that it requires a lot of requests due to the many domains to be tested. domain name spelling mistakes Domains like "freemoneyz.com" etc. are generally (notice I am making a lot of assumptions in this post but that's necessary I believe) not valueable due to the spelling mistakes. Question 4: are there any offline APIs available to check for spelling mistakes, preferably in javascript or some database that I can use interact with myself. Or should a word list help here as well? use of consonants, vowels etc. A domain that is easy to pronounce (eg. Google) is usually much more valueable than one that is not (eg. Gkyld). Question 5: how does one test for such pronuncability? Do you check for consonants, vowels, etc.? What does a valueable domain have? Has there been any work in this field, where should I look? That is what I came up with, which leads me to my final two questions. Question 6: can you think of any more english .com domain strengths or weaknesses? Which? How would you implement these? Question 7: do you believe this idea has any merit or all, or am I too naive? Anything I should know, read or hear about? Suggestions/comments? Thanks!

    Read the article

  • onDraw() triggered but results don't show

    - by Don
    I have the following routine in a subclass of view: It calculates an array of points that make up a line, then erases the previous lines, then draws the new lines (impact refers to the width in pixels drawn with multiple lines). The line is your basic bell curve, squeezed or stretched by variance and x-factor. Unfortunately, nothing shows on the screen. A previous version with drawPoint() and no array worked, and I've verified the array contents are being loaded correctly, and I can see that my onDraw() is being triggered. Any ideas why it might not be drawn? Thanks in advance! protected void drawNewLine( int maxx, int maxy, Canvas canvas, int impact, double variance, double xFactor, int color) { // impact = 2 to 8; xFactor between 4 and 20; variance between 0.2 and 5 double x = 0; double y = 0; int cx = maxx / 2; int cy = maxy / 2; int mu = cx; int index = 0; points[maxx<<1][1] = points[maxx<<1][0]; for (x = 0; x < maxx; x++) { points[index][1] = points[index][0]; points[index][0] = (float) x; Log.i(DEBUG_TAG, "x: " + x); index++; double root = 1.0 / (Math.sqrt(2 * Math.PI * variance)); double exponent = -1.0 * (Math.pow(((x - mu)/maxx*xFactor), 2) / (2 * variance)); double ePow = Math.exp(exponent); y = Math.round(cy * root * ePow); points[index][1] = points[index][0]; points[index][0] = (float) (maxy - y - OFFSET); index++; } points[maxx<<1][0] = (float) impact; for (int line = 0; line < points[maxx<<1][1]; line++) { for (int pt = 0; pt < (maxx<<1); pt++) { pointsToPaint[pt] = points[pt][1]; } for (int skip = 1; skip < (maxx<<1); skip = skip + 2) pointsToPaint[skip] = pointsToPaint[skip] + line; myLinePaint.setColor(Color.BLACK); canvas.drawLines(pointsToPaint, bLinePaint); // draw over old lines w/blk } for (int line = 0; line < points[maxx<<1][0]; line++) { for (int pt = 0; pt < maxx<<1; pt++) { pointsToPaint[pt] = points[pt][0]; } for (int skip = 1; skip < maxx<<1; skip = skip + 2) pointsToPaint[skip] = pointsToPaint[skip] + line; myLinePaint.setColor(color); canvas.drawLines(pointsToPaint, myLinePaint); / new color } } update: Replaced the drawLines() with drawPoint() in loop, still no joy for (int p = 0; p<pointsToPaint.length; p = p + 2) { Log.i(DEBUG_TAG, "x " + pointsToPaint[p] + " y " + pointsToPaint[p+1]); canvas.drawPoint(pointsToPaint[p], pointsToPaint[p+1], myLinePaint); } /// canvas.drawLines(pointsToPaint, myLinePaint);

    Read the article

  • DevConnections Session Slides, Samples and Links

    - by Rick Strahl
    Finally coming up for air this week, after catching up with being on the road for the better part of three weeks. Here are my slides, samples and links for my four DevConnections Session two weeks ago in Vegas. I ended up doing one extra un-prepared for session on WebAPI and AJAX, as some of the speakers were either delayed or unable to make it at all to Vegas due to Sandy's mayhem. It was pretty hectic in the speaker room as Erik (our event coordinator extrodinaire) was scrambling to fill session slots with speakers :-). Surprisingly it didn't feel like the storm affected attendance drastically though, but I guess it's hard to tell without actual numbers. The conference was a lot of fun - it's been a while since I've been speaking at one of these larger conferences. I'd been taking a hiatus, and I forgot how much I enjoy actually giving talks. Preparing - well not  quite so much, especially since I ended up essentially preparing or completely rewriting for all three of these talks and I was stressing out a bit as I was sick the week before the conference and didn't get as much time to prepare as I wanted to. But - as always seems to be the case - it all worked out, but I guess those that attended have to be the judge of that… It was great to catch up with my speaker friends as well - man I feel out of touch. I got to spend a bunch of time with Dan Wahlin, Ward Bell, Julie Lerman and for about 10 minutes even got to catch up with the ever so busy Michele Bustamante. Lots of great technical discussions including a fun and heated REST controversy with Ward and Howard Dierking. There were also a number of great discussions with attendees, describing how they're using the technologies touched in my talks in live applications. I got some great ideas from some of these and I wish there would have been more opportunities for these kinds of discussions. One thing I miss at these Vegas events though is some sort of coherent event where attendees and speakers get to mingle. These Vegas conferences are just like "go to sessions, then go out and PARTY on the town" - it's Vegas after all! But I think that it's always nice to have at least one evening event where everybody gets to hang out together and trade stories and geek talk. Overall there didn't seem to be much opportunity for that beyond lunch or the small and short exhibit hall events which it seemed not many people actually went to. Anyways, a good time was had. I hope those of you that came to my sessions learned something useful. There were lots of great questions and discussions after the sessions - always appreciate hearing the real life scenarios that people deal with in relation to the abstracted scenarios in sessions. Here are the Session abstracts, a few comments and the links for downloading slides and  samples. It's not quite like being there, but I hope this stuff turns out to be useful to some of you. I'll be following up a couple of these sessions with white papers in the following weeks. Enjoy. ASP.NET Architecture: How ASP.NET Works at the Low Level Abstract:Interested in how ASP.NET works at a low level? ASP.NET is extremely powerful and flexible technology, but it's easy to forget about the core framework that underlies the higher level technologies like ASP.NET MVC, WebForms, WebPages, Web Services that we deal with on a day to day basis. The ASP.NET core drives all the higher level handlers and frameworks layered on top of it and with the core power comes some complexity in the form of a very rich object model that controls the flow of a request through the ASP.NET pipeline from Windows HTTP services down to the application level. To take full advantage of it, it helps to understand the underlying architecture and model. This session discusses the architecture of ASP.NET along with a number of useful tidbits that you can use for building and debugging your ASP.NET applications more efficiently. We look at overall architecture, how requests flow from the IIS (7 and later) Web Server to the ASP.NET runtime into HTTP handlers, modules and filters and finally into high-level handlers like MVC, Web Forms or Web API. Focus of this session is on the low-level aspects on the ASP.NET runtime, with examples that demonstrate the bootstrapping of ASP.NET, threading models, how Application Domains are used, startup bootstrapping, how configuration files are applied and how all of this relates to the applications you write either using low-level tools like HTTP handlers and modules or high-level pages or services sitting at the top of the ASP.NET runtime processing chain. Comments:I was surprised to see so many people show up for this session - especially since it was the last session on the last day and a short 1 hour session to boot. The room was packed and it was to see so many people interested the abstracts of architecture of ASP.NET beyond the immediate high level application needs. Lots of great questions in this talk as well - I only wish this session would have been the full hour 15 minutes as we just a little short of getting through the main material (didn't make it to Filters and Error handling). I haven't done this session in a long time and I had to pretty much re-figure all the system internals having to do with the ASP.NET bootstrapping in light for the changes that came with IIS 7 and later. The last time I did this talk was with IIS6, I guess it's been a while. I love doing this session, mainly because in my mind the core of ASP.NET overall is so cleanly designed to provide maximum flexibility without compromising performance that has clearly stood the test of time in the 10 years or so that .NET has been around. While there are a lot of moving parts, the technology is easy to manage once you understand the core components and the core model hasn't changed much even while the underlying architecture that drives has been almost completely revamped especially with the introduction of IIS 7 and later. Download Samples and Slides   Introduction to using jQuery with ASP.NET Abstract:In this session you'll learn how to take advantage of jQuery in your ASP.NET applications. Starting with an overview of jQuery client features via many short and fun examples, you'll find out about core features like the power of selectors for document element selection, manipulating these elements with jQuery's wrapped set methods in a browser independent way, how to hook up and handle events easily and generally apply concepts of unobtrusive JavaScript principles to client scripting. The second half of the session then delves into jQuery's AJAX features and several different ways how you can interact with ASP.NET on the server. You'll see examples of using ASP.NET MVC for serving HTML and JSON AJAX content, as well as using the new ASP.NET Web API to serve JSON and hypermedia content. You'll also see examples of client side templating/databinding with Handlebars and Knockout. Comments:This session was in a monster of a room and to my surprise it was nearly packed, given that this was a 100 level session. I can see that it's a good idea to continue to do intro sessions to jQuery as there appeared to be quite a number of folks who had not worked much with jQuery yet and who most likely could greatly benefit from using it. Seemed seemed to me the session got more than a few people excited to going if they hadn't yet :-).  Anyway I just love doing this session because it's mostly live coding and highly interactive - not many sessions that I can build things up from scratch and iterate on in an hour. jQuery makes that easy though. Resources: Slides and Code Samples Introduction to jQuery White Paper Introduction to ASP.NET Web API   Hosting the Razor Scripting Engine in Your Own Applications Abstract:The Razor Engine used in ASP.NET MVC and ASP.NET Web Pages is a free-standing scripting engine that can be disassociated from these Web-specific implementations and can be used in your own applications. Razor allows for a powerful mix of code and text rendering that makes it a wonderful tool for any sort of text generation, from creating HTML output in non-Web applications, to rendering mail merge-like functionality, to code generation for developer tools and even as a plug-in scripting engine. In this session, we'll look at the components that make up the Razor engine and how you can bootstrap it in your own applications to hook up templating. You'll find out how to create custom templates and manage Razor requests that can be pre-compiled, detecting page changes and act in ways similar to a full runtime. We look at ways that you can pass data into the engine and retrieve both the rendered output as well as result values in a package that makes it easy to plug Razor into your own applications. Comments:That this session was picked was a bit of a surprise to me, since it's a bit of a niche topic. Even more of a surprise was that during the session quite a few people who attended had actually used Razor externally and were there to find out more about how the process works and how to extend it. In the session I talk a bit about a custom Razor hosting implementation (Westwind.RazorHosting) and drilled into the various components required to build a custom Razor Hosting engine and a runtime around it. This sessions was a bit of a chore to prepare for as there are lots of technical implementation details that needed to be dealt with and squeezing that into an hour 15 is a bit tight (and that aren't addressed even by some of the wrapper libraries that exist). Found out though that there's quite a bit of interest in using a templating engine outside of web applications, or often side by side with the HTML output generated by frameworks like MVC or WebForms. An extra fun part of this session was that this was my first session and when I went to set up I realized I forgot my mini-DVI to VGA adapter cable to plug into the projector in my room - 6 minutes before the session was about to start. So I ended up sprinting the half a mile + back to my room - and back at a full sprint. I managed to be back only a couple of minutes late, but when I started I was out of breath for the first 10 minutes or so, while trying to talk. Musta sounded a bit funny as I was trying to not gasp too much :-) Resources: Slides and Code Samples Westwind.RazorHosting GitHub Project Original RazorHosting Blog Post   Introduction to ASP.NET Web API for AJAX Applications Abstract:WebAPI provides a new framework for creating REST based APIs, but it can also act as a backend to typical AJAX operations. This session covers the core features of Web API as it relates to typical AJAX application development. We’ll cover content-negotiation, routing and a variety of output generation options as well as managing data updates from the client in the context of a small Single Page Application style Web app. Finally we’ll look at some of the extensibility features in WebAPI to customize and extend Web API in a number and useful useful ways. Comments:This session was a fill in for session slots not filled due MIA speakers stranded by Sandy. I had samples from my previous Web API article so decided to go ahead and put together a session from it. Given that I spent only a couple of hours preparing and putting slides together I was glad it turned out as it did - kind of just ran itself by way of the examples I guess as well as nice audience interactions and questions. Lots of interest - and also some confusion about when Web API makes sense. Both this session and the jQuery session ended up getting a ton of questions about when to use Web API vs. MVC, whether it would make sense to switch to Web API for all AJAX backend work etc. In my opinion there's no need to jump to Web API for existing applications that already have a good AJAX foundation. Web API is awesome for real externally consumed APIs and clearly defined application AJAX APIs. For typical application level AJAX calls, it's still a good idea, but ASP.NET MVC can serve most if not all of that functionality just as well. There's no need to abandon MVC (or even ASP.NET AJAX or third party AJAX backends) just to move to Web API. For new projects Web API probably makes good sense for isolation of AJAX calls, but it really depends on how the application is set up. In some cases sharing business logic between the HTML and AJAX interfaces with a single MVC API can be cleaner than creating two completely separate code paths to serve essentially the same business logic. Resources: Slides and Code Samples Sample Code on GitHub Introduction to ASP.NET Web API White Paper© Rick Strahl, West Wind Technologies, 2005-2012Posted in Conferences  ASP.NET   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • tmux: Suddenly, cannot horizontally split

    - by A__A__0
    As root, using a reasonably default .profile and .shrc and an empty tmux.conf, I am unable to split the window horizontally. There are a number of cases to consider so I'll list them clearly. Using the keybinding + empty configuration: nothing happens Using the keybinding + my configuration: a bell is generated, nothing else; occasionally, the split will appear and disappear immediately (maybe it always does this, but I'm connecting over ssh so it may not make it through) Using tmux split-window -h with any config: tmux immediately exits I've posted here in order the server and client verbose logs generated by tmux -v during the third case: server started, pid 9523 socket path /tmp/tmux-0/default new client 7 got 100 from client 7 got 101 from client 7 got 102 from client 7 got 103 from client 7 got 104 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 105 from client 7 got 106 from client 7 got 200 from client 7 cmdq 0x801c6e080: new-session (client 7) new term: xterm xterm override: XT xterm override: Ms ]52;%p1%s;%p2%s xterm override: Cs ]12;%p1%s xterm override: Cr ]112 xterm override: Ss [%p1%d q xterm override: Se [2 q new key Oo: 0x1021 (KP/) new key Oj: 0x1022 (KP*) new key Om: 0x1023 (KP-) new key Ow: 0x1024 (KP7) new key Ox: 0x1025 (KP8) new key Oy: 0x1026 (KP9) new key Ok: 0x1027 (KP+) new key Ot: 0x1028 (KP4) new key Ou: 0x1029 (KP5) new key Ov: 0x102a (KP6) new key Oq: 0x102b (KP1) new key Or: 0x102c (KP2) new key Os: 0x102d (KP3) new key OM: 0x102e (KPEnter) new key Op: 0x102f (KP0) new key On: 0x1030 (KP.) new key OA: 0x101d (Up) new key OB: 0x101e (Down) new key OC: 0x1020 (Right) new key OD: 0x101f (Left) new key [A: 0x101d (Up) new key [B: 0x101e (Down) new key [C: 0x1020 (Right) new key [D: 0x101f (Left) new key OH: 0x1018 (Home) new key OF: 0x1019 (End) new key [H: 0x1018 (Home) new key [F: 0x1019 (End) new key Oa: 0x501d (C-Up) new key Ob: 0x501e (C-Down) new key Oc: 0x5020 (C-Right) new key Od: 0x501f (C-Left) new key [a: 0x901d (S-Up) new key [b: 0x901e (S-Down) new key [c: 0x9020 (S-Right) new key [d: 0x901f (S-Left) new key [11^: 0x5002 (C-F1) new key [12^: 0x5003 (C-F2) new key [13^: 0x5004 (C-F3) new key [14^: 0x5005 (C-F4) new key [15^: 0x5006 (C-F5) new key [17^: 0x5007 (C-F6) new key [18^: 0x5008 (C-F7) new key [19^: 0x5009 (C-F8) new key [20^: 0x500a (C-F9) new key [21^: 0x500b (C-F10) new key [23^: 0x500c (C-F11) new key [24^: 0x500d (C-F12) new key [25^: 0x500e (C-F13) new key [26^: 0x500f (C-F14) new key [28^: 0x5010 (C-F15) new key [29^: 0x5011 (C-F16) new key [31^: 0x5012 (C-F17) new key [32^: 0x5013 (C-F18) new key [33^: 0x5014 (C-F19) new key [34^: 0x5015 (C-F20) new key [2^: 0x5016 (C-IC) new key [3^: 0x5017 (C-DC) new key [7^: 0x5018 (C-Home) new key [8^: 0x5019 (C-End) new key [6^: 0x501a (C-NPage) new key [5^: 0x501b (C-PPage) new key [11$: 0x9002 (S-F1) new key [12$: 0x9003 (S-F2) new key [13$: 0x9004 (S-F3) new key [14$: 0x9005 (S-F4) new key [15$: 0x9006 (S-F5) new key [17$: 0x9007 (S-F6) new key [18$: 0x9008 (S-F7) new key [19$: 0x9009 (S-F8) new key [20$: 0x900a (S-F9) new key [21$: 0x900b (S-F10) new key [23$: 0x900c (S-F11) new key [24$: 0x900d (S-F12) new key [25$: 0x900e (S-F13) new key [26$: 0x900f (S-F14) new key [28$: 0x9010 (S-F15) new key [29$: 0x9011 (S-F16) new key [31$: 0x9012 (S-F17) new key [32$: 0x9013 (S-F18) new key [33$: 0x9014 (S-F19) new key [34$: 0x9015 (S-F20) new key [2$: 0x9016 (S-IC) new key [3$: 0x9017 (S-DC) new key [7$: 0x9018 (S-Home) new key [8$: 0x9019 (S-End) new key [6$: 0x901a (S-NPage) new key [5$: 0x901b (S-PPage) new key [11@: 0xd002 (C-S-F1) new key [12@: 0xd003 (C-S-F2) new key [13@: 0xd004 (C-S-F3) new key [14@: 0xd005 (C-S-F4) new key [15@: 0xd006 (C-S-F5) new key [17@: 0xd007 (C-S-F6) new key [18@: 0xd008 (C-S-F7) new key [19@: 0xd009 (C-S-F8) new key [20@: 0xd00a (C-S-F9) new key [21@: 0xd00b (C-S-F10) new key [23@: 0xd00c (C-S-F11) new key [24@: 0xd00d (C-S-F12) new key [25@: 0xd00e (C-S-F13) new key [26@: 0xd00f (C-S-F14) new key [28@: 0xd010 (C-S-F15) new key [29@: 0xd011 (C-S-F16) new key [31@: 0xd012 (C-S-F17) new key [32@: 0xd013 (C-S-F18) new key [33@: 0xd014 (C-S-F19) new key [34@: 0xd015 (C-S-F20) new key [2@: 0xd016 (C-S-IC) new key [3@: 0xd017 (C-S-DC) new key [7@: 0xd018 (C-S-Home) new key [8@: 0xd019 (C-S-End) new key [6@: 0xd01a (C-S-NPage) new key [5@: 0xd01b (C-S-PPage) new key [I: 0x1031 ((null)) new key [O: 0x1032 ((null)) new key OP: 0x1002 (F1) new key OQ: 0x1003 (F2) new key OR: 0x1004 (F3) new key OS: 0x1005 (F4) new key [15~: 0x1006 (F5) new key [17~: 0x1007 (F6) new key [18~: 0x1008 (F7) new key [19~: 0x1009 (F8) new key [20~: 0x100a (F9) new key [21~: 0x100b (F10) new key [23~: 0x100c (F11) new key [24~: 0x100d (F12) new key [2~: 0x1016 (IC) new key [3~: 0x1017 (DC) replacing key OH: 0x1018 (Home) replacing key OF: 0x1019 (End) new key [6~: 0x101a (NPage) new key [5~: 0x101b (PPage) new key [Z: 0x101c (BTab) replacing key OA: 0x101d (Up) replacing key OB: 0x101e (Down) replacing key OD: 0x101f (Left) replacing key OC: 0x1020 (Right) spawn: /bin/sh -- session 0 created writing 207 to client 7 got 208 from client 7 input_parse: '#' ground input_parse: ' ' ground keys are 7 ([?1;2c) received service class 1 complete key [?1;2c 0xfff keys are 1 (t) complete key t 0x74 input_parse: 't' ground keys are 1 (m) complete key m 0x6d input_parse: 'm' ground keys are 1 (u) complete key u 0x75 input_parse: 'u' ground keys are 1 (x) complete key x 0x78 input_parse: 'x' ground keys are 1 ( ) complete key 0x20 input_parse: ' ' ground keys are 1 (s) complete key s 0x73 input_parse: 's' ground keys are 1 (p) complete key p 0x70 input_parse: 'p' ground keys are 1 (l) complete key l 0x6c input_parse: 'l' ground keys are 1 (i) complete key i 0x69 input_parse: 'i' ground keys are 1 (t) complete key t 0x74 input_parse: 't' ground keys are 1 (-) complete key - 0x2d input_parse: '-' ground keys are 1 (d) complete key d 0x64 input_parse: 'd' ground keys are 1 () complete key 0x7f input_parse: '' ground input_c0_dispatch: ' input_parse: '' ground input_parse: '[' esc_enter input_parse: 'K' csi_enter input_csi_dispatch: 'K' "" "" keys are 1 (w) complete key w 0x77 input_parse: 'w' ground keys are 1 (i) complete key i 0x69 input_parse: 'i' ground keys are 1 (n) complete key n 0x6e input_parse: 'n' ground keys are 1 (d) complete key d 0x64 input_parse: 'd' ground keys are 1 (o) complete key o 0x6f input_parse: 'o' ground keys are 1 (w) complete key w 0x77 input_parse: 'w' ground keys are 1 ( ) complete key 0x20 input_parse: ' ' ground keys are 1 (-) complete key - 0x2d input_parse: '-' ground keys are 1 (h) complete key h 0x68 input_parse: 'h' ground keys are 1 ( ) complete key 0xd input_parse: ' ' ground input_c0_dispatch: ' input_parse: ' ' ground input_c0_dispatch: ' new client 13 got 100 from client 13 got 101 from client 13 got 102 from client 13 got 103 from client 13 got 104 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 105 from client 13 got 106 from client 13 got 200 from client 13 cmdq 0x801c6e160: split-window -h (client 13) spawn: /bin/sh -- writing 203 to client 13 input_parse: '#' ground input_parse: ' ' ground input_parse: '#' ground input_parse: ' ' ground lost client 13 session 0 destroyed writing 203 to client 7 got 205 from client 7 writing 204 to client 7 lost client 7 got 207 from server got 203 from server got 204 from server There are some other peculiarities: With a newly created user (from which I overwrote root's .profile and .shrc, tmux works perfectly. Occasionally (twice out of the 50 or so times I've tested it), the splitting will work fine once in a session. (This happened for example when I ran ktrace on tmux, which I can also post) To explain the 'suddenly' part of the title: when I started my newly updated mysql56-server, tmux immediately exited and lost the session. Recently I changed architectures, from FreeBSD 10.0 i386 to amd64, and I am still working through shared library incompatibilities. I suspect that this could be involved, but I can't imagine how an incompatibility of this sort could result in such a specific, isolated failure.

    Read the article

  • How can I get FreeNAS to respond to libvirt shutdown requests

    - by ptomli
    I have a KVM VM of FreeNAS 0.7.1 Shere (revision 5127) running on Ubuntu Server 10.04 and I'm unable to convince the VM to shutdown from the host virsh shutdown freenas I would expect this to send some ACPI? trigger to the VM and FreeNAS then do what it's told. I'm not a FreeBSD fundi so I don't really know what packages or processes to poke to get this running. I have tried to convince powerd to run, but the VM cpus don't have the required freq entry Sysctl HW $ sysctl hw hw.machine: amd64 hw.model: QEMU Virtual CPU version 0.12.3 hw.ncpu: 1 hw.byteorder: 1234 hw.physmem: 523116544 hw.usermem: 463806464 hw.pagesize: 4096 hw.floatingpoint: 1 hw.machine_arch: amd64 hw.realmem: 536850432 hw.aac.iosize_max: 65536 hw.amr.force_sg32: 0 hw.an.an_cache_iponly: 1 hw.an.an_cache_mcastonly: 0 hw.an.an_cache_mode: dbm hw.an.an_dump: off hw.ata.to: 15 hw.ata.wc: 1 hw.ata.atapi_dma: 1 hw.ata.ata_dma_check_80pin: 1 hw.ata.ata_dma: 1 hw.ath.txbuf: 200 hw.ath.rxbuf: 40 hw.ath.regdomain: 0 hw.ath.countrycode: 0 hw.ath.xchanmode: 1 hw.ath.outdoor: 1 hw.ath.calibrate: 30 hw.ath.hal.swba_backoff: 0 hw.ath.hal.sw_brt: 10 hw.ath.hal.dma_brt: 2 hw.bce.msi_enable: 1 hw.bce.tso_enable: 1 hw.bge.allow_asf: 0 hw.cardbus.cis_debug: 0 hw.cardbus.debug: 0 hw.cs.recv_delay: 570 hw.cs.ignore_checksum_failure: 0 hw.cs.debug: 0 hw.cxgb.snd_queue_len: 50 hw.cxgb.use_16k_clusters: 1 hw.cxgb.force_fw_update: 0 hw.cxgb.singleq: 0 hw.cxgb.ofld_disable: 0 hw.cxgb.msi_allowed: 2 hw.cxgb.txq_mr_size: 1024 hw.cxgb.sleep_ticks: 1 hw.cxgb.tx_coalesce: 0 hw.firewire.hold_count: 3 hw.firewire.try_bmr: 1 hw.firewire.fwmem.speed: 2 hw.firewire.fwmem.eui64_lo: 0 hw.firewire.fwmem.eui64_hi: 0 hw.firewire.phydma_enable: 1 hw.firewire.nocyclemaster: 0 hw.firewire.fwe.rx_queue_len: 128 hw.firewire.fwe.tx_speed: 2 hw.firewire.fwe.stream_ch: 1 hw.firewire.fwip.rx_queue_len: 128 hw.firewire.sbp.tags: 0 hw.firewire.sbp.use_doorbell: 0 hw.firewire.sbp.scan_delay: 500 hw.firewire.sbp.login_delay: 1000 hw.firewire.sbp.exclusive_login: 1 hw.firewire.sbp.max_speed: -1 hw.firewire.sbp.auto_login: 1 hw.mfi.max_cmds: 128 hw.mfi.event_class: 0 hw.mfi.event_locale: 65535 hw.pccard.cis_debug: 0 hw.pccard.debug: 0 hw.cbb.debug: 0 hw.cbb.start_32_io: 4096 hw.cbb.start_16_io: 256 hw.cbb.start_memory: 2281701376 hw.pcic.pd6722_vsense: 1 hw.pcic.intr_mask: 57016 hw.pci.honor_msi_blacklist: 1 hw.pci.enable_msix: 1 hw.pci.enable_msi: 1 hw.pci.do_power_resume: 1 hw.pci.do_power_nodriver: 0 hw.pci.enable_io_modes: 1 hw.pci.host_mem_start: 2147483648 hw.syscons.kbd_debug: 1 hw.syscons.kbd_reboot: 1 hw.syscons.bell: 1 hw.syscons.saver.keybonly: 1 hw.syscons.sc_no_suspend_vtswitch: 0 hw.usb.uplcom.interval: 100 hw.usb.uvscom.interval: 100 hw.usb.uvscom.opktsize: 8 hw.wi.debug: 0 hw.wi.txerate: 0 hw.xe.debug: 0 hw.intr_storm_threshold: 1000 hw.availpages: 127714 hw.bus.devctl_disable: 0 hw.ste.rxsyncs: 0 hw.busdma.total_bpages: 32 hw.busdma.zone0.total_bpages: 32 hw.busdma.zone0.free_bpages: 32 hw.busdma.zone0.reserved_bpages: 0 hw.busdma.zone0.active_bpages: 0 hw.busdma.zone0.total_bounced: 0 hw.busdma.zone0.total_deferred: 0 hw.busdma.zone0.lowaddr: 0xffffffff hw.busdma.zone0.alignment: 2 hw.busdma.zone0.boundary: 65536 hw.clockrate: 2808 hw.instruction_sse: 1 hw.apic.enable_extint: 0 hw.kbd.keymap_restrict_change: 0 hw.acpi.supported_sleep_state: S3 S4 S5 hw.acpi.power_button_state: S5 hw.acpi.sleep_button_state: S3 hw.acpi.lid_switch_state: NONE hw.acpi.standby_state: S1 hw.acpi.suspend_state: S3 hw.acpi.sleep_delay: 1 hw.acpi.s4bios: 0 hw.acpi.verbose: 0 hw.acpi.disable_on_reboot: 0 hw.acpi.handle_reboot: 0 hw.acpi.cpu.cx_lowest: C1 Processes $ ps ax PID TT STAT TIME COMMAND 0 ?? DLs 0:00.00 [swapper] 1 ?? ILs 0:00.00 /sbin/init -- 2 ?? DL 0:00.08 [g_event] 3 ?? DL 0:00.29 [g_up] 4 ?? DL 0:00.33 [g_down] 5 ?? DL 0:00.00 [crypto] 6 ?? DL 0:00.00 [crypto returns] 7 ?? DL 0:00.00 [xpt_thrd] 8 ?? DL 0:00.00 [kqueue taskq] 9 ?? DL 0:00.00 [acpi_task_0] 10 ?? RL 34:12.42 [idle: cpu0] 11 ?? WL 0:01.13 [swi4: clock sio] 12 ?? WL 0:00.00 [swi3: vm] 13 ?? WL 0:00.00 [swi1: net] 14 ?? DL 0:00.04 [yarrow] 15 ?? WL 0:00.00 [swi6: task queue] 16 ?? WL 0:00.00 [swi2: cambio] 17 ?? DL 0:00.00 [acpi_task_1] 18 ?? DL 0:00.00 [acpi_task_2] 19 ?? WL 0:00.00 [swi5: +] 20 ?? DL 0:00.01 [thread taskq] 21 ?? WL 0:00.00 [swi6: Giant taskq] 22 ?? WL 0:00.00 [irq9: acpi0] 23 ?? WL 0:00.09 [irq14: ata0] 24 ?? WL 0:00.11 [irq15: ata1] 25 ?? WL 0:00.57 [irq11: ed0 uhci0] 26 ?? DL 0:00.00 [usb0] 27 ?? DL 0:00.00 [usbtask-hc] 28 ?? DL 0:00.00 [usbtask-dr] 29 ?? WL 0:00.01 [irq1: atkbd0] 30 ?? WL 0:00.00 [swi0: sio] 31 ?? DL 0:00.00 [sctp_iterator] 32 ?? DL 0:00.00 [pagedaemon] 33 ?? DL 0:00.00 [vmdaemon] 34 ?? DL 0:00.00 [idlepoll] 35 ?? DL 0:00.00 [pagezero] 36 ?? DL 0:00.01 [bufdaemon] 37 ?? DL 0:00.00 [vnlru] 38 ?? DL 0:00.14 [syncer] 39 ?? DL 0:00.01 [softdepflush] 1221 ?? Is 0:00.00 /sbin/devd 1289 ?? Is 0:00.01 /usr/sbin/syslogd -ss -f /var/etc/syslog.conf 1608 ?? Is 0:00.00 /usr/sbin/cron -s 1692 ?? Ss 0:00.03 /usr/local/sbin/mDNSResponderPosix -b -f /var/etc/mdn 1730 ?? S 0:00.43 /usr/local/sbin/lighttpd -f /var/etc/lighttpd.conf -m 1882 ?? DL 0:00.00 [system_taskq] 1883 ?? DL 0:00.00 [arc_reclaim_thread] 4139 ?? S 0:00.03 /usr/local/bin/php /usr/local/www/exec.php 4144 ?? S 0:00.00 sh -c ps ax 4145 ?? R 0:00.00 ps ax 1816 v0 Is 0:00.01 login [pam] (login) 1818 v0 I+ 0:00.03 -tcsh (csh) 1817 v1 Is+ 0:00.00 /usr/libexec/getty Pc ttyv1 1402 con- I 0:00.00 /usr/local/sbin/afpd -F /var/etc/afpd.conf 1404 con- S 0:00.00 /usr/local/sbin/cnid_metad 1682 con- I 0:02.78 /usr/local/sbin/mt-daapd -m -c /var/etc/mt-daapd.conf 1789 con- S 0:00.18 /usr/local/bin/fuppesd --config-dir /var/etc --config Libvert snippet <domain type='kvm'> <name>freenas</name> <uuid>********-****-****-****-************</uuid> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> Is this possible? Ideally I'd like to be able to stop the host without having to manually deal with shutting down the VM.

    Read the article

  • adresse book with C programming, i have problem with library i think, couldn't complite my code

    - by osabri
    I've divided my code in small programm so it can be easy to excute /* ab_error.c : in case of errors following messages will be displayed */ #include "adressbook.h" static char *errormsg[] = { "", "\nNot enough space on disk", "\nCannot open file", "\nCannot read file", "\nCannot write file" }; void check(int error) { switch(error) { case 0: return; case 1: write_file(); case 2: case 3: case 4: system("cls"); fputs(errormsg[error], stderr); exit(error); } } 2nd /* ab_fileio.c : functions for file input/output */ include "adressbook.h" static char ab_file[] = "ADRESSBOOK.DAT"; //file to save the entries int read_file(void) { int error = 0; FILE *fp; ELEMENT *new_e, *last_e = NULL; DATA buffer; if( (fp = fopen(ab_file, "rb")) == NULL) return -1; //no file found while (fread(&buffer, sizeof(DATA), 1, fp) == 1) //reads one list element after another { if( (new_e = make_element()) == NULL) { error = 1; break; //not enough space } new_e->person = buffer; //copy data to new element new_e->next = NULL; if(hol.first == NULL) //list is empty? hol.first = new_e; //yes else last_e->next = new_e; //no last_e = new_e; ++hol.amount; } if( !error && !feof(fp) ) error = 3; //cannot read file fclose(fp); return error; } /-------------------------------/ int write_file(void) { int error = 0; FILE *fp; ELEMENT *p; if( (p = hol.first) == NULL) return 0; //list is empty if( (fp = fopen(ab_file, "wb")) == NULL) return 2; //cannot open while( p!= NULL) { if( fwrite(&p->person, sizeof(DATA), 1, fp) < 1) { error = 4; break; //cannot write } p = p->next; } fclose(fp); return error; } 3rd /* ab_list.c : functions to manipulate the list */ #include "adressbook.h" HOL hol = {0, NULL}; //global definition for head of list /* -------------------- */ ELEMENT *make_element(void) { return (ELEMENT *)malloc( sizeof(ELEMENT) ); } /* -------------------- */ int ins_element( DATA *newdata) { ELEMENT *new_e, *pre_p; if((new_e = make_element()) == NULL) return 1; new_e ->person = *newdata; // copy data to new element pre_p = search(new_e->person.family_name); if(pre_p == NULL) //no person in list { new_e->next = hol.first; //put it to the begin hol.first = new_e; } else { new_e->next = pre_p->next; pre_p->next = new_e; } ++hol.amount; return 0; } int erase_element( char name, char surname ) { return 0; } /* ---------------------*/ ELEMENT *search(char *name) { ELEMENT *sp, *retp; //searchpointer, returnpointer retp = NULL; sp = hol.first; while(sp != NULL && sp->person.family_name != name) { retp = sp; sp = sp->next; } return(retp); } 4th /* ab_screen.c : functions for printing information on screen */ #include "adressbook.h" #include <conio.h> #include <ctype.h> /* standard prompts for in- and output */ static char pgmname[] = "---- Oussama's Adressbook made in splendid C ----"; static char options[] = "\ 1: Enter new adress\n\n\ 2: Delete entry\n\n\ 3: Change entry\n\n\ 4: Print adress\n\n\ Esc: Exit\n\n\n\ Your choice . . .: "; static char prompt[] = "\ Name . . . .:\n\ Surname . . :\n\n\ Street . . .:\n\n\ House number:\n\n\ Postal code :\n\n\ Phone number:"; static char buttons[] = "\ <Esc> = cancel input <Backspace> = correct input\ <Return> = assume"; static char headline[] = "\ Name Surname Street House Postal code Phone number \n\ ------------------------------------------------------------------------"; static char further[] = "\ -------- continue with any key --------"; /* ---------------------------------- */ int menu(void) //show menu and read user input { int c; system ("cls"); set_cur(0,20); puts(pgmname); set_cur(6,0); printf("%s", options); while( (c = getch()) != ESC && (c < '1' || c > '4')) putch('\a'); return c; } /* ---------------------------------- */ int print_adr_book(void) //display adressbook { int line = 1; ELEMENT *p = hol.first; system("cls"); set_cur(0,20); puts(pgmname); set_cur(2,0); puts(headline); set_cur(5,0); while(p != NULL) //run through list and show entries { printf("%5d %-15s ",line, p->person.family_name); printf("%-12s %-15s ", p->person.given_name, p->person.street); printf("%-4d %-5d %-12d\n",p->person.house_number, p->person.postal_code, p->person.phone); p = p->next; if( p == NULL || ++line %16 == 1) //end of list or screen is full { set_cur(24,0); printf("%s",further); if( getch() == ESC) return 0; set_cur(5,0); scroll_up(0,5,24);//puts(headline); } } return 0; } /* -------------------------------------------*/ int make_entry(void) { char cache[50]; DATA newperson; ELEMENT *p; while(1) { system("cls"); set_cur(0,20); puts(pgmname); set_cur(6,0); puts("Please enter new data:"); set_cur(10,0); puts(prompt); set_cur(24,0); printf("%s",buttons); balken(10, 25, MAXL, ' ',0x70); //input name if(input(newperson.family_name, MAXL, ESC, CR) == ESC) return 0; balken(12,25, MAXL, ' ', 0x70); //surname if(input(newperson.given_name, MAXL, ESC, CR) == ESC) return 0; balken(14,25, 30, ' ', 0x70); //street if(input(newperson.street, 30, ESC, CR) == ESC) return 0; balken(16,25, 4, ' ',0x70); //housenumber if(input(cache, 4, ESC, CR) == ESC) return 0; newperson.house_number = atol(cache); //to string balken(18,25, 5, ' ',0x70); //postal code if(input(cache, 5, ESC, CR) == ESC) return 0; newperson.postal_code = atol(cache); //to string balken(20,25, 20, ' ',0x70); //phone number if(input(cache, 20, ESC, CR) == ESC) return 0; newperson.phone = atol(cache); //to string p = search(newperson.phone); if( p!= NULL && p->person.phone == newperson.phone) { set_cur(22,25); puts("phonenumber already exists!"); set_cur(24,0); printf("%s, further"); getch(); continue; } } } 5th /* adress_book_project.c : main program to create an adressbook */ /* copyrights by Oussama Sabri, June 2010 */ #include "adressbook.h" //project header file int main() { int rv, cmd; //return value, user command if ( (rv = read_file() ) == -1) // no data saved yet rv = make_entry(); check(rv); //prompts an error and quits program on disfunction do { switch (cmd = menu())//calls menu and gets user input back { case '1': rv = make_entry(); break; case '2': //delete entry case '3': //changes entry rv = change_entry(cmd); break; case '4': //prints adressbook on screen rv = print_adr_book(); break; case ESC: //end of program system ("cls"); rv = 0; break; } }while(cmd!= ESC); check ( write_file() ); //save adressbook return 0; } 6th /* Getcb.c --> Die Funktion getcb() liefert die naechste * * Tastatureingabe (ruft den BIOS-INT 0x16 auf). * * Return-Wert: * * ASCII-Code bzw. erweiterter Code + 256 */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> int getcb(void) { union REGS intregs; intregs.h.ah = 0; // Subfunktion 0: ein Zeichen // von der Tastatur lesen. int86( 0x16, &intregs, &intregs); if( intregs.h.al != 0) // Falls ASCII-Zeichen, return (intregs.h.al); // dieses zurueckgeben. else // Sonst den erweiterten return (intregs.h.ah + 0x100); // Code + 256 } 7th /* PUTCB.C --> enthaelt die Funktionen * * - putcb() * * - putcb9() * * - balken() * * - input() * * * * Es werden die Funktionen 9 und 14 des Video-Interrupts * * (ROM-BIOS-Interrupt 0x10) verwendet. * * * * Die Prototypen dieser Funktionen stehen in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #define VIDEO_INT 0x10 /*---------------------------------------------------------------- * putcb(c) gibt das Zeichen auf der aktuellen Cursor-Position * am Bildschirm aus. Der Cursor wird versetzt. * Steuerzeichen Back-Space, CR, LF und BELL werden * ausgefuehrt. * Return-Wert: keiner */ void putcb(unsigned char c) /* Gibt das Zeichen in c auf */ { /* den Bildschirm aus. */ union REGS intregs; intregs.h.ah = 14; /* Subfunktion 14 ("Teletype") */ intregs.h.al = c; intregs.h.bl = 0xf; /* Vordergrund-Farbe im */ /* Grafik-Modus. */ int86(VIDEO_INT, &intregs, &intregs); } /*---------------------------------------------------------------- * putcb9(c,count,mode) gibt das Zeichen in c count-mal im * angegebenen Modus auf der aktuellen * Cursor-Position am Bildschirm aus. * Der Cursor wird nicht versetzt. * * Return-Wert: keiner */ void putcb9( unsigned char c, /* das Zeichen */ unsigned count, /* die Anzahl */ unsigned mode ) /* Low-Byte: das Atrribut */ { /* High-Byte: die Bildschirmseite*/ union REGS intregs; intregs.h.ah = 9; /* Subfunktion 9 des Int 0x10 */ intregs.h.al = c; intregs.x.bx = mode; intregs.x.cx = count; int86( VIDEO_INT, &intregs, &intregs); } /*---------------------------------------------------------------- * balken() positioniert den Cursor und zeichnet einen Balken, * wobei Position, L„nge, Fllzeichen und Attribut * als Argumente bergeben werden. * Der Cursor bleibt auf der ersten Position im Balken. */ void balken( unsigned int zeile, /* Start-Position */ unsigned int spalte, unsigned int laenge, /* Laenge des Balkens */ unsigned char c, /* Fuellzeichen */ unsigned int modus) /* Low-Byte: Attribut */ /* High-Byte: Bildschirmseite */ { union REGS intregs; intregs.h.ah = 2; /* Cursor auf der angegebenen */ intregs.h.dh = zeile; /* Bildschirmseite versetzen. */ intregs.h.dl = spalte; intregs.h.bh = (modus >> 8); int86(VIDEO_INT, &intregs, &intregs); putcb9(c, laenge, modus); /* Balken ausgeben. */ } /*---------------------------------------------------------------- * input() liest Zeichen von der Tastatur ein und haengt '\0' an. * Mit Backspace kann die Eingabe geloescht werden. * Das Attribut am Bildschirm bleibt erhalten. * * Argumente: 1. Zeiger auf den Eingabepuffer. * 2. Anzahl maximal einzulesender Zeichen. * 3. Die optionalen Argumente: Zeichen, mit denen die * Eingabe abgebrochen werden kann. * Diese Liste muá mit CR = '\r' enden! * Return-Wert: Das Zeichen, mit dem die Eingabe abgebrochen wurde. */ #include <stdarg.h> int getcb( void); /* Zum Lesen der Tastatur */ int input(char *puffer, int max,... ) { int c; /* aktuelles Zeichen */ int breakc; /* Abruchzeichen */ int nc = 0; /* Anzahl eingelesener Zeichen */ va_list argp; /* Zeiger auf die weiteren Arumente */ while(1) { *puffer = '\0'; va_start(argp, max); /* argp initialisieren */ c = getcb(); do /* Mit Zeichen der Abbruchliste vergleichen */ if(c == (breakc = va_arg(argp,int)) ) return(breakc); while( breakc != '\r' ); va_end( argp); if( c == '\b' && nc > 0) /* Backspace? */ { --nc; --puffer; putcb(c); putcb(' '); putcb(c); } else if( c >= 32 && c <= 255 && nc < max ) { ++nc; *puffer++ = c; putcb(c); } else if( nc == max) putcb('\7'); /* Ton ausgeben */ } } 8th /* Video.c --> Enthaelt die Funktionen * cls(), * scroll_up(), scroll_down(), * set_cur(), get_cur(), * set_screen_page(), get_screen_page() * * Die Prototypen dieser Funktionen befinden sich in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #include "bio.h" #define VIDEO_INT 0x10 typedef unsigned char BYTE; void scroll_up( int anzahl, int anf_zeile, int end_zeile) { /* Fenster hoch rollen. */ union REGS intregs; intregs.x.ax = 0x600 + anzahl; /* Subfunktion AH = 6, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void scroll_down( int anzahl, int anf_zeile, int end_zeile) { /* Fenster runter rollen. */ union REGS intregs; intregs.x.ax = 0x700 + anzahl; /* Subfunktion AH = 7, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void set_cur( int zeile, int spalte) /* versetzt den Cursor */ { /* der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 2; intregs.h.dh = (BYTE)zeile; intregs.h.dl = (BYTE)spalte; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); } void get_cur(int *zeile, int *spalte) /* holt die Cursor- */ { /* Position der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 3; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); *zeile = (unsigned)intregs.h.dh; *spalte = (unsigned)intregs.h.dl; } void cls(void) { scroll_up(0,0,24); /* Gesamten Bildschirm loeschen. */ set_cur(0,0); /* Cursor in Home-Position. */ } int get_screen_page(void) /* Aktuelle Bildschirmseite holen.*/ { union REGS intregs; intregs.h.ah = 15; /* Subfunktion AH = 15: */ /* Bildschirm-Modus feststellen. */ int86(VIDEO_INT, &intregs, &intregs); return (intregs.h.bh); } void set_screen_page(int seite) /* setzt die aktive Seite des */ { /* Bildschirmpuffers auf die */ /* angegebene Seite. */ union REGS intregs; intregs.x.ax = 0x500 + seite; /* Subfunktion AH = 5 */ int86(VIDEO_INT, &intregs, &intregs); } /* ------------------------------------------------------------- Ein kleines Testprogramm : */ /* #include <stdio.h> int main() { cls(); set_cur(23, 0); printf("Weiter mit <Return>\n"); set_cur(12, 20); printf("Ein Test!\n"); getchar(); scroll_up(3, 5, 20); getchar(); scroll_down(6, 5, 20); getchar(); set_screen_page(1); printf("\nAuf der 2. Seite !\n"); getchar(); set_screen_page(0); set_cur(0,0); printf("\nWieder auf der 1. Seite !\n"); getchar(); cls(); return 0; } */ /* Video.c --> Enthaelt die Funktionen * cls(), * scroll_up(), scroll_down(), * set_cur(), get_cur(), * set_screen_page(), get_screen_page() * * Die Prototypen dieser Funktionen befinden sich in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #include "bio.h" #define VIDEO_INT 0x10 typedef unsigned char BYTE; void scroll_up( int anzahl, int anf_zeile, int end_zeile) { /* Fenster hoch rollen. */ union REGS intregs; intregs.x.ax = 0x600 + anzahl; /* Subfunktion AH = 6, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void scroll_down( int anzahl, int anf_zeile, int end_zeile) { /* Fenster runter rollen. */ union REGS intregs; intregs.x.ax = 0x700 + anzahl; /* Subfunktion AH = 7, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void set_cur( int zeile, int spalte) /* versetzt den Cursor */ { /* der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 2; intregs.h.dh = (BYTE)zeile; intregs.h.dl = (BYTE)spalte; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); } void get_cur(int *zeile, int *spalte) /* holt die Cursor- */ { /* Position der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 3; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); *zeile = (unsigned)intregs.h.dh; *spalte = (unsigned)intregs.h.dl; } void cls(void) { scroll_up(0,0,24); /* Gesamten Bildschirm loeschen. */ set_cur(0,0); /* Cursor in Home-Position. */ } int get_screen_page(void) /* Aktuelle Bildschirmseite holen.*/ { union REGS intregs; intregs.h.ah = 15; /* Subfunktion AH = 15: */ /* Bildschirm-Modus feststellen. */ int86(VIDEO_INT, &intregs, &intregs); return (intregs.h.bh); } void set_screen_page(int seite) /* setzt die aktive Seite des */ { /* Bildschirmpuffers auf die */ /* angegebene Seite. */ union REGS intregs; intregs.x.ax = 0x500 + seite; /* Subfunktion AH = 5 */ int86(VIDEO_INT, &intregs, &intregs); } /* ------------------------------------------------------------- Ein kleines Testprogramm : */ /* #include <stdio.h> int main() { cls(); set_cur(23, 0); printf("Weiter mit <Return>\n"); set_cur(12, 20); printf("Ein Test!\n"); getchar(); scroll_up(3, 5, 20); getchar(); scroll_down(6, 5, 20); getchar(); set_screen_page(1); printf("\nAuf der 2. Seite !\n"); getchar(); set_screen_page(0); set_cur(0,0); printf("\nWieder auf der 1. Seite !\n"); getchar(); cls(); return 0; } */ /* BIO.H --> Enthaelt die Prototypen der BIOS-Funktionen. */ /* --- Funktionen in VIDEO.C --- */ extern void scroll_up(int anzahl, int anf_zeile,int end_zeile); extern void scroll_down(int anzahl, int anf_zeile, int end_zeile); extern void set_cur(int zeile, int spalte); extern void get_cur(int *zeile, int *spalte); extern void cls(void); extern int get_screen_page(void); extern void set_screen_page(int page); /* --- Funktionen in GETCB.C / PUTCB.C --- */ extern int getcb(void); extern void putcb(int c); extern void putcb9(int c, unsigned count, unsigned modus); extern void balken(int zeile, int spalte, int laenge, int c, unsigned modus); extern int input(char *puffer, int max,... ); need your help, can't find my mistakes:((

    Read the article

  • Address book with C programming; cannot compile my code.

    - by osabri
    I've divided my code into small programs so it can be easy to excute /* ab_error.c : in case of errors following messages will be displayed */ #include "adressbook.h" static char *errormsg[] = { "", "\nNot enough space on disk", "\nCannot open file", "\nCannot read file", "\nCannot write file" }; void check(int error) { switch(error) { case 0: return; case 1: write_file(); case 2: case 3: case 4: system("cls"); fputs(errormsg[error], stderr); exit(error); } } 2nd /* ab_fileio.c : functions for file input/output */ #include "adressbook.h" static char ab_file[] = "ADRESSBOOK.DAT"; //file to save the entries int read_file(void) { int error = 0; FILE *fp; ELEMENT *new_e, *last_e = NULL; DATA buffer; if( (fp = fopen(ab_file, "rb")) == NULL) return -1; //no file found while (fread(&buffer, sizeof(DATA), 1, fp) == 1) //reads one list element after another { if( (new_e = make_element()) == NULL) { error = 1; break; //not enough space } new_e->person = buffer; //copy data to new element new_e->next = NULL; if(hol.first == NULL) //list is empty? hol.first = new_e; //yes else last_e->next = new_e; //no last_e = new_e; ++hol.amount; } if( !error && !feof(fp) ) error = 3; //cannot read file fclose(fp); return error; } /*-------------------------------*/ int write_file(void) { int error = 0; FILE *fp; ELEMENT *p; if( (p = hol.first) == NULL) return 0; //list is empty if( (fp = fopen(ab_file, "wb")) == NULL) return 2; //cannot open while( p!= NULL) { if( fwrite(&p->person, sizeof(DATA), 1, fp) < 1) { error = 4; break; //cannot write } p = p->next; } fclose(fp); return error; } 3rd /* ab_list.c : functions to manipulate the list */ #include "adressbook.h" HOL hol = {0, NULL}; //global definition for head of list /* -------------------- */ ELEMENT *make_element(void) { return (ELEMENT *)malloc( sizeof(ELEMENT) ); } /* -------------------- */ int ins_element( DATA *newdata) { ELEMENT *new_e, *pre_p; if((new_e = make_element()) == NULL) return 1; new_e ->person = *newdata; // copy data to new element pre_p = search(new_e->person.family_name); if(pre_p == NULL) //no person in list { new_e->next = hol.first; //put it to the begin hol.first = new_e; } else { new_e->next = pre_p->next; pre_p->next = new_e; } ++hol.amount; return 0; } int erase_element( char name, char surname ) { return 0; } /* ---------------------*/ ELEMENT *search(char *name) { ELEMENT *sp, *retp; //searchpointer, returnpointer retp = NULL; sp = hol.first; while(sp != NULL && sp->person.family_name != name) { retp = sp; sp = sp->next; } return(retp); } 4th /* ab_screen.c : functions for printing information on screen */ #include "adressbook.h" #include <conio.h> #include <ctype.h> /* standard prompts for in- and output */ static char pgmname[] = "---- Oussama's Adressbook made in splendid C ----"; static char options[] = "\ 1: Enter new adress\n\n\ 2: Delete entry\n\n\ 3: Change entry\n\n\ 4: Print adress\n\n\ Esc: Exit\n\n\n\ Your choice . . .: "; static char prompt[] = "\ Name . . . .:\n\ Surname . . :\n\n\ Street . . .:\n\n\ House number:\n\n\ Postal code :\n\n\ Phone number:"; static char buttons[] = "\ <Esc> = cancel input <Backspace> = correct input\ <Return> = assume"; static char headline[] = "\ Name Surname Street House Postal code Phone number \n\ ------------------------------------------------------------------------"; static char further[] = "\ -------- continue with any key --------"; /* ---------------------------------- */ int menu(void) //show menu and read user input { int c; system ("cls"); set_cur(0,20); puts(pgmname); set_cur(6,0); printf("%s", options); while( (c = getch()) != ESC && (c < '1' || c > '4')) putch('\a'); return c; } /* ---------------------------------- */ int print_adr_book(void) //display adressbook { int line = 1; ELEMENT *p = hol.first; system("cls"); set_cur(0,20); puts(pgmname); set_cur(2,0); puts(headline); set_cur(5,0); while(p != NULL) //run through list and show entries { printf("%5d %-15s ",line, p->person.family_name); printf("%-12s %-15s ", p->person.given_name, p->person.street); printf("%-4d %-5d %-12d\n",p->person.house_number, p->person.postal_code, p->person.phone); p = p->next; if( p == NULL || ++line %16 == 1) //end of list or screen is full { set_cur(24,0); printf("%s",further); if( getch() == ESC) return 0; set_cur(5,0); scroll_up(0,5,24);//puts(headline); } } return 0; } /* -------------------------------------------*/ int make_entry(void) { char cache[50]; DATA newperson; ELEMENT *p; while(1) { system("cls"); set_cur(0,20); puts(pgmname); set_cur(6,0); puts("Please enter new data:"); set_cur(10,0); puts(prompt); set_cur(24,0); printf("%s",buttons); balken(10, 25, MAXL, ' ',0x70); //input name if(input(newperson.family_name, MAXL, ESC, CR) == ESC) return 0; balken(12,25, MAXL, ' ', 0x70); //surname if(input(newperson.given_name, MAXL, ESC, CR) == ESC) return 0; balken(14,25, 30, ' ', 0x70); //street if(input(newperson.street, 30, ESC, CR) == ESC) return 0; balken(16,25, 4, ' ',0x70); //housenumber if(input(cache, 4, ESC, CR) == ESC) return 0; newperson.house_number = atol(cache); //to string balken(18,25, 5, ' ',0x70); //postal code if(input(cache, 5, ESC, CR) == ESC) return 0; newperson.postal_code = atol(cache); //to string balken(20,25, 20, ' ',0x70); //phone number if(input(cache, 20, ESC, CR) == ESC) return 0; newperson.phone = atol(cache); //to string p = search(newperson.phone); if( p!= NULL && p->person.phone == newperson.phone) { set_cur(22,25); puts("phonenumber already exists!"); set_cur(24,0); printf("%s, further"); getch(); continue; } } } 5th /* adress_book_project.c : main program to create an adressbook */ /* copyrights by Oussama Sabri, June 2010 */ #include "adressbook.h" //project header file int main() { int rv, cmd; //return value, user command if ( (rv = read_file() ) == -1) // no data saved yet rv = make_entry(); check(rv); //prompts an error and quits program on disfunction do { switch (cmd = menu())//calls menu and gets user input back { case '1': rv = make_entry(); break; case '2': //delete entry case '3': //changes entry rv = change_entry(cmd); break; case '4': //prints adressbook on screen rv = print_adr_book(); break; case ESC: //end of program system ("cls"); rv = 0; break; } }while(cmd!= ESC); check ( write_file() ); //save adressbook return 0; } 6th /* Getcb.c --> Die Funktion getcb() liefert die naechste * * Tastatureingabe (ruft den BIOS-INT 0x16 auf). * * Return-Wert: * * ASCII-Code bzw. erweiterter Code + 256 */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> int getcb(void) { union REGS intregs; intregs.h.ah = 0; // Subfunktion 0: ein Zeichen // von der Tastatur lesen. int86( 0x16, &intregs, &intregs); if( intregs.h.al != 0) // Falls ASCII-Zeichen, return (intregs.h.al); // dieses zurueckgeben. else // Sonst den erweiterten return (intregs.h.ah + 0x100); // Code + 256 } 7th /* PUTCB.C --> enthaelt die Funktionen * * - putcb() * * - putcb9() * * - balken() * * - input() * * * * Es werden die Funktionen 9 und 14 des Video-Interrupts * * (ROM-BIOS-Interrupt 0x10) verwendet. * * * * Die Prototypen dieser Funktionen stehen in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #define VIDEO_INT 0x10 /*---------------------------------------------------------------- * putcb(c) gibt das Zeichen auf der aktuellen Cursor-Position * am Bildschirm aus. Der Cursor wird versetzt. * Steuerzeichen Back-Space, CR, LF und BELL werden * ausgefuehrt. * Return-Wert: keiner */ void putcb(unsigned char c) /* Gibt das Zeichen in c auf */ { /* den Bildschirm aus. */ union REGS intregs; intregs.h.ah = 14; /* Subfunktion 14 ("Teletype") */ intregs.h.al = c; intregs.h.bl = 0xf; /* Vordergrund-Farbe im */ /* Grafik-Modus. */ int86(VIDEO_INT, &intregs, &intregs); } /*---------------------------------------------------------------- * putcb9(c,count,mode) gibt das Zeichen in c count-mal im * angegebenen Modus auf der aktuellen * Cursor-Position am Bildschirm aus. * Der Cursor wird nicht versetzt. * * Return-Wert: keiner */ void putcb9( unsigned char c, /* das Zeichen */ unsigned count, /* die Anzahl */ unsigned mode ) /* Low-Byte: das Atrribut */ { /* High-Byte: die Bildschirmseite*/ union REGS intregs; intregs.h.ah = 9; /* Subfunktion 9 des Int 0x10 */ intregs.h.al = c; intregs.x.bx = mode; intregs.x.cx = count; int86( VIDEO_INT, &intregs, &intregs); } /*---------------------------------------------------------------- * balken() positioniert den Cursor und zeichnet einen Balken, * wobei Position, L„nge, Fllzeichen und Attribut * als Argumente bergeben werden. * Der Cursor bleibt auf der ersten Position im Balken. */ void balken( unsigned int zeile, /* Start-Position */ unsigned int spalte, unsigned int laenge, /* Laenge des Balkens */ unsigned char c, /* Fuellzeichen */ unsigned int modus) /* Low-Byte: Attribut */ /* High-Byte: Bildschirmseite */ { union REGS intregs; intregs.h.ah = 2; /* Cursor auf der angegebenen */ intregs.h.dh = zeile; /* Bildschirmseite versetzen. */ intregs.h.dl = spalte; intregs.h.bh = (modus >> 8); int86(VIDEO_INT, &intregs, &intregs); putcb9(c, laenge, modus); /* Balken ausgeben. */ } /*---------------------------------------------------------------- * input() liest Zeichen von der Tastatur ein und haengt '\0' an. * Mit Backspace kann die Eingabe geloescht werden. * Das Attribut am Bildschirm bleibt erhalten. * * Argumente: 1. Zeiger auf den Eingabepuffer. * 2. Anzahl maximal einzulesender Zeichen. * 3. Die optionalen Argumente: Zeichen, mit denen die * Eingabe abgebrochen werden kann. * Diese Liste muá mit CR = '\r' enden! * Return-Wert: Das Zeichen, mit dem die Eingabe abgebrochen wurde. */ #include <stdarg.h> int getcb( void); /* Zum Lesen der Tastatur */ int input(char *puffer, int max,... ) { int c; /* aktuelles Zeichen */ int breakc; /* Abruchzeichen */ int nc = 0; /* Anzahl eingelesener Zeichen */ va_list argp; /* Zeiger auf die weiteren Arumente */ while(1) { *puffer = '\0'; va_start(argp, max); /* argp initialisieren */ c = getcb(); do /* Mit Zeichen der Abbruchliste vergleichen */ if(c == (breakc = va_arg(argp,int)) ) return(breakc); while( breakc != '\r' ); va_end( argp); if( c == '\b' && nc > 0) /* Backspace? */ { --nc; --puffer; putcb(c); putcb(' '); putcb(c); } else if( c >= 32 && c <= 255 && nc < max ) { ++nc; *puffer++ = c; putcb(c); } else if( nc == max) putcb('\7'); /* Ton ausgeben */ } } 8th /* Video.c --> Enthaelt die Funktionen * cls(), * scroll_up(), scroll_down(), * set_cur(), get_cur(), * set_screen_page(), get_screen_page() * * Die Prototypen dieser Funktionen befinden sich in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #include "bio.h" #define VIDEO_INT 0x10 typedef unsigned char BYTE; void scroll_up( int anzahl, int anf_zeile, int end_zeile) { /* Fenster hoch rollen. */ union REGS intregs; intregs.x.ax = 0x600 + anzahl; /* Subfunktion AH = 6, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void scroll_down( int anzahl, int anf_zeile, int end_zeile) { /* Fenster runter rollen. */ union REGS intregs; intregs.x.ax = 0x700 + anzahl; /* Subfunktion AH = 7, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void set_cur( int zeile, int spalte) /* versetzt den Cursor */ { /* der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 2; intregs.h.dh = (BYTE)zeile; intregs.h.dl = (BYTE)spalte; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); } void get_cur(int *zeile, int *spalte) /* holt die Cursor- */ { /* Position der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 3; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); *zeile = (unsigned)intregs.h.dh; *spalte = (unsigned)intregs.h.dl; } void cls(void) { scroll_up(0,0,24); /* Gesamten Bildschirm loeschen. */ set_cur(0,0); /* Cursor in Home-Position. */ } int get_screen_page(void) /* Aktuelle Bildschirmseite holen.*/ { union REGS intregs; intregs.h.ah = 15; /* Subfunktion AH = 15: */ /* Bildschirm-Modus feststellen. */ int86(VIDEO_INT, &intregs, &intregs); return (intregs.h.bh); } void set_screen_page(int seite) /* setzt die aktive Seite des */ { /* Bildschirmpuffers auf die */ /* angegebene Seite. */ union REGS intregs; intregs.x.ax = 0x500 + seite; /* Subfunktion AH = 5 */ int86(VIDEO_INT, &intregs, &intregs); } /* ------------------------------------------------------------- Ein kleines Testprogramm : */ /* #include <stdio.h> int main() { cls(); set_cur(23, 0); printf("Weiter mit <Return>\n"); set_cur(12, 20); printf("Ein Test!\n"); getchar(); scroll_up(3, 5, 20); getchar(); scroll_down(6, 5, 20); getchar(); set_screen_page(1); printf("\nAuf der 2. Seite !\n"); getchar(); set_screen_page(0); set_cur(0,0); printf("\nWieder auf der 1. Seite !\n"); getchar(); cls(); return 0; } */ /* Video.c --> Enthaelt die Funktionen * cls(), * scroll_up(), scroll_down(), * set_cur(), get_cur(), * set_screen_page(), get_screen_page() * * Die Prototypen dieser Funktionen befinden sich in BIO.H */ /* Hinweis: Es muss ein DOS-Compiler verwendet werden. * * (z.B. der GNU-Compiler fuer DOS auf der CD) */ #include <dos.h> #include "bio.h" #define VIDEO_INT 0x10 typedef unsigned char BYTE; void scroll_up( int anzahl, int anf_zeile, int end_zeile) { /* Fenster hoch rollen. */ union REGS intregs; intregs.x.ax = 0x600 + anzahl; /* Subfunktion AH = 6, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void scroll_down( int anzahl, int anf_zeile, int end_zeile) { /* Fenster runter rollen. */ union REGS intregs; intregs.x.ax = 0x700 + anzahl; /* Subfunktion AH = 7, */ /* AL = Anzahl Zeilen. */ intregs.x.cx = anf_zeile << 8; /* CH=anf_zeile, cl=0 */ intregs.x.dx = (end_zeile <<8) | 79; /* DH=end_zeile,DL=79 */ intregs.h.bh = 7; /* normales Attribut */ int86(VIDEO_INT, &intregs, &intregs); } void set_cur( int zeile, int spalte) /* versetzt den Cursor */ { /* der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 2; intregs.h.dh = (BYTE)zeile; intregs.h.dl = (BYTE)spalte; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); } void get_cur(int *zeile, int *spalte) /* holt die Cursor- */ { /* Position der aktuellen Bildschirmseite.*/ union REGS intregs; intregs.h.ah = 3; intregs.h.bh = (BYTE)get_screen_page(); int86(VIDEO_INT, &intregs, &intregs); *zeile = (unsigned)intregs.h.dh; *spalte = (unsigned)intregs.h.dl; } void cls(void) { scroll_up(0,0,24); /* Gesamten Bildschirm loeschen. */ set_cur(0,0); /* Cursor in Home-Position. */ } int get_screen_page(void) /* Aktuelle Bildschirmseite holen.*/ { union REGS intregs; intregs.h.ah = 15; /* Subfunktion AH = 15: */ /* Bildschirm-Modus feststellen. */ int86(VIDEO_INT, &intregs, &intregs); return (intregs.h.bh); } void set_screen_page(int seite) /* setzt die aktive Seite des */ { /* Bildschirmpuffers auf die */ /* angegebene Seite. */ union REGS intregs; intregs.x.ax = 0x500 + seite; /* Subfunktion AH = 5 */ int86(VIDEO_INT, &intregs, &intregs); } /* ------------------------------------------------------------- Ein kleines Testprogramm : */ /* #include <stdio.h> int main() { cls(); set_cur(23, 0); printf("Weiter mit <Return>\n"); set_cur(12, 20); printf("Ein Test!\n"); getchar(); scroll_up(3, 5, 20); getchar(); scroll_down(6, 5, 20); getchar(); set_screen_page(1); printf("\nAuf der 2. Seite !\n"); getchar(); set_screen_page(0); set_cur(0,0); printf("\nWieder auf der 1. Seite !\n"); getchar(); cls(); return 0; } */ /* BIO.H --> Enthaelt die Prototypen der BIOS-Funktionen. */ /* --- Funktionen in VIDEO.C --- */ extern void scroll_up(int anzahl, int anf_zeile,int end_zeile); extern void scroll_down(int anzahl, int anf_zeile, int end_zeile); extern void set_cur(int zeile, int spalte); extern void get_cur(int *zeile, int *spalte); extern void cls(void); extern int get_screen_page(void); extern void set_screen_page(int page); /* --- Funktionen in GETCB.C / PUTCB.C --- */ extern int getcb(void); extern void putcb(int c); extern void putcb9(int c, unsigned count, unsigned modus); extern void balken(int zeile, int spalte, int laenge, int c, unsigned modus); extern int input(char *puffer, int max,... ); need your help, can't find my mistakes:((

    Read the article

< Previous Page | 7 8 9 10 11