Daily Archives

Articles indexed Tuesday May 11 2010

Page 15/123 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Using asp.net mvc model binders generically

    - by Sean Chambers
    I have a hierarchy of classes that all derive from a base type and the base type also implements an interface. What I'm wanting to do is have one controller to handle the management of the entire hierarchy (as the actions exposed via the controller is identical). That being said, I want to have the views have the type specific fields on it and the model binder to bind against a hidden field value. something like: <input type="text" name="model.DerivedTypeSpecificField" /> <input type="hidden" name="modelType" value="MyDerivedType" /> That being said, the asp.net mvc model binders seem to require the concrete type that they will be creating, because of that reason I would need to create a different controller for every derived type. Has anyone does this before or know how to manipulate the model binder to behave in this way? I could write my own model binder, but I'm not wanting anything past the basic model binding behavior of assign properties and building arrays on the target type. Thanks!

    Read the article

  • how to get obj2.name via obj1.categories(), thanks (gae python)

    - by zjm1126
    i using google-app-engine webapp ,code is : class Post(db.Model): title = db.StringProperty(required=True) def categories(self): return (x.category for x in self.postcategory_set) class Category(db.Model): name = db.StringProperty() class PostCategory(db.Model): post = db.ReferenceProperty(Post) category = db.ReferenceProperty(Category) class sss(webapp.RequestHandler): def get(self): obj1 = Post(title='hhaa') #obj1.title = 'haha' obj1.put() obj2 = Category() obj2.name='haha-kao' obj2.put() obj3=PostCategory() obj3.post=obj1 obj3.category=obj2 obj3.put() self.response.out.write(obj1.categories().get().name) the error is : Traceback (most recent call last): File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__ handler.get(*groups) File "D:\zjm_code\helloworld\a.py", line 131, in get self.response.out.write(obj1.categories().get().name) AttributeError: 'generator' object has no attribute 'get' so how to get the obj2.name via obj1's method thanks

    Read the article

  • Easiest way to store long term variables with AS3

    - by deeb
    What's the easiest way to store a simple numeric variable on my server and then have a Flash application also hosted on the server read/write the variable? I've seen various xml solutions, but they look too complex for such a simple job. Is there a way to just read/write a simple text file with just AS3 and no middle-ware?

    Read the article

  • C2360 compiler error on TFS build, but not on desktop

    - by pdmaguire
    A c++ code snippet similar to the code below caused our TFS build to fail with a C2360 compiler error. switch (i) { case 0 : for each (int n in a) System::Console::WriteLine(n.ToString()); break; case 1 : System::Console::WriteLine("n is not in scope here"); break; } This is fixed by using {} brackets within the body of case 0, as below: switch (i) { case 0 : { for each (int n in a) System::Console::WriteLine(n.ToString()); } break; case 1 : System::Console::WriteLine("n is not in scope here"); break; } The developer had successfully compiled the code on their desktop before committing the changes. A cursory look at versions of things like compilers, Visual Studio etc on the server and desktop suggest they are the same. The source code is the same, obviously. What is the difference between a desktop build and TFS build that would smother a compiler error like this?

    Read the article

  • Rails with Oracle often got "no listener" error

    - by qichunren
    I am on Rails 2.3.5 and use oracle 10 as my database,use oracle_adapter ,ruby-oci8 to connect oracle host. But I often got exception as the log info show: Completed in 463ms (View: 18, DB: 166) | 200 OK [http://192.168.30.128/auctions?page=1] /!\ FAILSAFE /!\ Mon Feb 01 19:02:11 +0800 2010 Status: 500 Internal Server Error ORA-12541: TNS:no listener env.c:257:in oci8lib.so /home/qichunren/.gem/ruby/1.8/gems/ruby-oci8-1.0.7/lib/oci8.rb:229:in `initialize' /home/qichunren/.gem/ruby/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:623:in `new' /home/qichunren/.gem/ruby/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:623:in `new_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:659:in `initialize' /home/qichunren/.gem/ruby/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:35:in `new' /home/qichunren/.gem/ruby/1.8/gems/activerecord-oracle-adapter-1.0.0.9250/lib/active_record/connection_adapters/oracle_adapter.rb:35:in `oracle_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout' /usr/local/ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call' /home/qichunren/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call' /home/qichunren/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call' /home/qichunren/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call' /home/qichunren/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' /home/qichunren/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize' /home/qichunren/.gem/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/cgi_process.rb:44:in `dispatch_cgi' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi' /home/qichunren/.gem/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:27:in `dispatch' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `process' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:282:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `each' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:281:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run' /home/qichunren/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /home/qichunren/.gem/ruby/1.8/bin/mongrel_rails:19:in `load' /home/qichunren/.gem/ruby/1.8/bin/mongrel_rails:19 it seems that connection to oracle often disconnect.it show oracle error:ORA-12541: TNS:no listener How to fix this ? Many tks. oci8.c:270:in oci8lib.so: ORA-12541: TNS:no listener (OCIError) from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_oci_connection.rb:223:in new' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_oci_connection.rb:223:innew_connection' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_oci_connection.rb:328:in initialize' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_oci_connection.rb:24:innew' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_oci_connection.rb:24:in initialize' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_connection.rb:9:innew' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_connection.rb:9:in create' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.4/lib/active_record/connec tion_adapters/oracle_enhanced_adapter.rb:50:inoracle_enhanced_connection' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/c onnection_specification.rb:291:in send' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/c onnection_specification.rb:291:inconnection=' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/c onnection_specification.rb:259:in retrieve_connection' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/c onnection_specification.rb:78:inconnection' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2438:in quoted_table_ name' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1259:infind_one' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1250:in find_from_ids ' from /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:infind' from script/maintenance/adjust_settlement.rb:19

    Read the article

  • How to delay user login until RunOnce is completed? [Win XP]

    - by Shaitan00
    Currently I have an application that runs at startup when a user log's in to the account (administrative), as well as something under HKLM...\Run which is also executed - but I need to run something once and BEFORE both these things are executed. My solution was to use HKLM...\RunOnce which is executed before the HKLM...\Run but the task can take 30-45 seconds which gives enough time for the user Startup to be executed and launch the application prematurely. I thought of maybe including a SLEEP but RunOnce doesn't block the user account load... Then I considered the group policies but they do not have a RunOnce equivalent that I can use... Also I am not sure if Group Policy is run at the right time (never used it before). Is there anyway to make my RunOnce delay the account startup of my application, or a better place where I can execute it before both HKLM...\Run and user Startup? Or any recommended alternatives? Any ideas or help would be much appreciated... Thanks,

    Read the article

  • Parent and siblings inherits a child list items styles

    - by elvista
    I have a simple menu <ul id="menu"> <li class="leaf"><a href="#">Menu Item 1</a></li> <li class="leaf"><a href="#">Menu Item 2</a></li> <li class="expanded"><a href="#">Menu Item 3</a> <ul> <li class="leaf"><a href="#">Menu Item a</a></li> <li class="leaf"><a href="#">Menu Item b</a></li> <li class="leaf"><a href="#">Menu Item c</a></li> </ul> </li> <li class="leaf"><a href="#">Menu Item 4</a></li> </ul> and ul#menu li:hover {font-weight:bold;} The problem I am facing is when I hover above a ul li li, the parent as well as all its siblings gets the hover effect. I only want the list item I hovered above to get the effect. I tried ul#menu li.leaf:hover {..}, ul#menu li.expanded:hover {..} , but even in that case, when I hover above li.expanded, it's child inherits the style. It is important for me to style the list items, not a (the style is more complicated than the one I posted) How do I fix this?

    Read the article

  • ASP.NET MVC: Complete action before posting to Paypal

    - by ajbeaven
    I'm in the middle of developing an e-commerce site that is using Paypal as it's payment gateway. All I want to do is run some code before the user heads off to Paypal, but I have no idea how to do it. Eg: [AcceptVerbs(HttpVerbs.Post)] public ActionResult GoToPaypal(FormCollection collection) { //do what I want to do //go to paypal } Can you do this? Example HTML and C# would be lovely :)

    Read the article

  • "Automatic" class proxy in C++

    - by PierreBdR
    I need to allow the user to change members of two data structures of the same type at the same time. For example: struct Foo { int a, b; } Foo a1 = {1,2}, a2 = {3,4}; dual(a1,a2)->a = 5; // Now a1 = {5,2} and a2 = {5,2} I have a class that works and that change first a1 and then copy a1 into a2. This is fine as long as: the class copied is small the user doesn't mind about everything being copied, not only the part modified. Is there a way to obtain this behavior: dual(a1,a2)->a = 5; // Now a1 = {5,2} and a2 = {5,4} I am opened to alternative syntax, but they should stay simple, and I would like to avoid things like: set_members(a1, a2, &Foo::a, 5); members(a1, a2, &Foo::a) = 5; or anything involving specifying explictely &Foo::

    Read the article

  • How can i use a duration setting on .animate if it is inside the callback from a .fadeOut effect?

    - by Jannis
    I am trying to just fade the content of section#secondary out and once the content has been faded out, the parent (section#secondary) should animate 'shut' in a slider animation. All this is working however the durations are not and I cannot figure out why. Here is my code: HTML <section id="secondary"> <a href="#" class="slide_button">&laquo;</a> <!-- slide in/back button --> <article> <h1>photos</h1> <div class="album_nav"><a href="#">photo 1 of 6</a> | <a href="#">create an album</a></div> <div class="bar"> <p class="section_title">current image title</p> </div> <section class="image"> <div class="links"> <a class="_back album_link" href="#">« from the album: james new toy</a> <nav> <a href="#" class="_back small_button">back</a> <a href="#" class="_next small_button">next</a> </nav> </div> <img src="http://localhost/~jannis/3781_doggie_wonderland/www/preview/static/images/sample-image-enlarged.jpg" width="418" height="280" alt="" /> </section> </article> <footer> <embed src="http://localhost/~jannis/3781_doggie_wonderland/www/preview/static/flash/secondary-footer.swf" wmode="transparent" width="495" height="115" type="application/x-shockwave-flash" /> </footer> </section> <!-- close secondary --> jQuery // ============================= // = Close button (slide away) = // ============================= $('a.slide_button').click(function() { $(this).closest('section#secondary').children('*').fadeOut('slow', function() { $('section#secondary').animate({'width':'0'}, 3000); }); }); Because the content of section#secondary is variable I use the * selector. What happens is that the fadeOut uses the appropriate slow speed but as soon as the callback fires (once the content is faded out) the section#secondary animates to width: 0 within a couple of milliseconds and not the 3000 ms ( 3 sec ) I set the animation duration to. Any ideas would be appreciated. PS: I cannot post an example at this point but since this is more a matter of theory of jQuery I don't think an example is necessary here. Correct me if I am wrong..

    Read the article

  • Problem storing an RSS feed in Flex 4

    - by ben
    Hey guys, I'm having some trouble storing the results of an RSS feed in my Flex 4 app. Here is the variables view, showing the result of the HTTPService which gets the feed: And here is the code I use to store the result: public var rssXML:XML; rssXML = event.result as XML; But after this code is run, rssXML is still null. What am I doing wrong? Thanks for reading.

    Read the article

  • Import Namespace System.Query

    - by GateKiller
    I am trying to load Linq on my .Net 3.5 enabled web server by adding the following to my .aspx page: <%@ Import Namespace="System.Query" %> However, this fails and tells me it cannot find the namespace. The type or namespace name 'Query' does not exist in the namespace 'System' I have also tried with no luck: System.Data.Linq System.Linq System.Xml.Linq I believe that .Net 3.5 is working because var hello = "Hello World" seems to work. Can anyone help please? Cheers, Stephen PS: I just want to clarify that I don't use Visual Studio, I simple have a Text Editor and write my code directly into .aspx files.

    Read the article

  • Integrating HTML into Silverlight Applications

    - by dwahlin
    Looking for a way to display HTML content within a Silverlight application? If you haven’t tried doing that before it can be challenging at first until you know a few tricks of the trade.  Being able to display HTML is especially handy when you’re required to display RSS feeds (with embedded HTML), SQL Server Reporting Services reports, PDF files (not actually HTML – but the techniques discussed will work), or other HTML content.  In this post I'll discuss three options for displaying HTML content in Silverlight applications and describe how my company is using these techniques in client applications. Displaying HTML Overlays If you need to display HTML over a Silverlight application (such as an RSS feed containing HTML data in it) you’ll need to set the Silverlight control’s windowless parameter to true. This can be done using the object tag as shown next: <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param name="source" value="ClientBin/HTMLAndSilverlight.xap"/> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="4.0.50401.0" /> <param name="autoUpgrade" value="true" /> <param name="windowless" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0" style="text-decoration:none"> <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> </a> </object> By setting the control to “windowless” you can overlay HTML objects by using absolute positioning and other CSS techniques. Keep in mind that on Windows machines the windowless setting can result in a performance hit when complex animations or HD video are running since the plug-in content is displayed directly by the browser window. It goes without saying that you should only set windowless to true when you really need the functionality it offers. For example, if I want to display my blog’s RSS content on top of a Silverlight application I could set windowless to true and create a user control that grabbed the content and output it using a DataList control: <style type="text/css"> a {text-decoration:none;font-weight:bold;font-size:14pt;} </style> <div style="margin-top:10px; margin-left:10px;margin-right:5px;"> <asp:DataList ID="RSSDataList" runat="server" DataSourceID="RSSDataSource"> <ItemTemplate> <a href='<%# XPath("link") %>'><%# XPath("title") %></a> <br /> <%# XPath("description") %> <br /> </ItemTemplate> </asp:DataList> <asp:XmlDataSource ID="RSSDataSource" DataFile="http://weblogs.asp.net/dwahlin/rss.aspx" XPath="rss/channel/item" CacheDuration="60" runat="server" /> </div> The user control can then be placed in the page hosting the Silverlight control as shown below. This example adds a Close button, additional content to display in the overlay window and the HTML generated from the user control. <div id="RSSDiv"> <div style="background-color:#484848;border:1px solid black;height:35px;width:100%;"> <img alt="Close Button" align="right" src="Images/Close.png" onclick="HideOverlay();" style="cursor:pointer;" /> </div> <div style="overflow:auto;width:800px;height:565px;"> <div style="float:left;width:100px;height:103px;margin-left:10px;margin-top:5px;"> <img src="http://weblogs.asp.net/blogs/dwahlin/dan2008.jpg" style="border:1px solid Gray" /> </div> <div style="float:left;width:300px;height:103px;margin-top:5px;"> <a href="http://weblogs.asp.net/dwahlin" style="margin-left:10px;font-size:20pt;">Dan Wahlin's Blog</a> </div> <br /><br /><br /> <div style="clear:both;margin-top:20px;"> <uc:BlogRoller ID="BlogRoller" runat="server" /> </div> </div> </div> Of course, we wouldn’t want the RSS HTML content to be shown until requested. Once it’s requested the absolute position of where it should show above the Silverlight control can be set using standard CSS styles. The following ID selector named #RSSDiv handles hiding the overlay div shown above and determines where it will be display on the screen. #RSSDiv { background-color:White; position:absolute; top:100px; left:300px; width:800px; height:600px; border:1px solid black; display:none; } Now that the HTML content to display above the Silverlight control is set, how can we show it as a user clicks a HyperlinkButton or other control in the application? Fortunately, Silverlight provides an excellent HTML bridge that allows direct access to content hosted within a page. The following code shows two JavaScript functions that can be called from Siverlight to handle showing or hiding HTML overlay content. The two functions rely on jQuery (http://www.jQuery.com) to make it easy to select HTML objects and manipulate their properties: function ShowOverlay() { rssDiv.css('display', 'block'); } function HideOverlay() { rssDiv.css('display', 'none'); } Calling the ShowOverlay function is as simple as adding the following code into the Silverlight application within a button’s Click event handler: private void OverlayHyperlinkButton_Click(object sender, RoutedEventArgs e) { HtmlPage.Window.Invoke("ShowOverlay"); } The result of setting the Silverlight control’s windowless parameter to true and showing the HTML overlay content is shown in the following screenshot:   Thinking Outside the Box to Show HTML Content Setting the windowless parameter to true may not be a viable option for some Silverlight applications or you may simply want to go about showing HTML content a different way. The next technique I’ll show takes advantage of simple HTML, CSS and JavaScript code to handle showing HTML content while a Silverlight application is running in the browser. Keep in mind that with Silverlight’s HTML bridge feature you can always pop-up HTML content in a new browser window using code similar to the following: System.Windows.Browser.HtmlPage.Window.Navigate( new Uri("http://silverlight.net"), "_blank"); For this example I’ll demonstrate how to hide the Silverlight application while maximizing a container div containing the HTML content to show. This allows HTML content to take up the full screen area of the browser without having to set windowless to true and when done right can make the user feel like they never left the Silverlight application. The following HTML shows several div elements that are used to display HTML within the same browser window as the Silverlight application: <div id="JobPlanDiv"> <div style="vertical-align:middle"> <img alt="Close Button" align="right" src="Images/Close.png" onclick="HideJobPlanIFrame();" style="cursor:pointer;" /> </div> <div id="JobPlan_IFrame_Container" style="height:95%;width:100%;margin-top:37px;"></div> </div> The JobPlanDiv element acts as a container for two other divs that handle showing a close button and hosting an iframe that will be added dynamically at runtime. JobPlanDiv isn’t visible when the Silverlight application loads due to the following ID selector added into the page: #JobPlanDiv { position:absolute; background-color:#484848; overflow:hidden; left:0; top:0; height:100%; width:100%; display:none; } When the HTML content needs to be shown or hidden the JavaScript functions shown next can be used: var jobPlanIFrameID = 'JobPlan_IFrame'; var slHost = null; var jobPlanContainer = null; var jobPlanIFrameContainer = null; var rssDiv = null; $(document).ready(function () { slHost = $('#silverlightControlHost'); jobPlanContainer = $('#JobPlanDiv'); jobPlanIFrameContainer = $('#JobPlan_IFrame_Container'); rssDiv = $('#RSSDiv'); }); function ShowJobPlanIFrame(url) { jobPlanContainer.css('display', 'block'); $('<iframe id="' + jobPlanIFrameID + '" src="' + url + '" style="height:100%;width:100%;" />') .appendTo(jobPlanIFrameContainer); slHost.css('width', '0%'); } function HideJobPlanIFrame() { jobPlanContainer.css('display', 'none'); $('#' + jobPlanIFrameID).remove(); slHost.css('width', '100%'); } ShowJobPlanIFrame() handles showing the JobPlanDiv div and adding an iframe into it dynamically. Once JobPlanDiv is shown, the Silverlight control host has its width set to a value of 0% to allow the control to stay alive while making it invisible to the user. I found that this technique works better across multiple browsers as opposed to manipulating the Silverlight control host div’s display or visibility properties. Now that you’ve seen the code to handle showing and hiding the HTML content area, let’s switch focus to the Silverlight application. As a user clicks on a link such as “View Report” the ShowJobPlanIFrame() JavaScript function needs to be called. The following code handles that task: private void ReportHyperlinkButton_Click(object sender, RoutedEventArgs e) { ShowBrowser(_BaseUrl + "/Report.aspx"); } public void ShowBrowser(string url) { HtmlPage.Window.Invoke("ShowJobPlanIFrame", url); } Any URL can be passed into the ShowBrowser() method which handles invoking the JavaScript function. This includes standard web pages or even PDF files. We’ve used this technique frequently with our SmartPrint control (http://www.smartwebcontrols.com) which converts Silverlight screens into PDF documents and displays them. Here’s an example of the content generated:   Silverlight 4’s WebBrowser Control Both techniques shown to this point work well when Silverlight is running in-browser but not so well when it’s running out-of-browser since there’s no host page that you can access using the HTML bridge. Fortunately, Silverlight 4 provides a WebBrowser control that can be used to perform the same functionality quite easily. We’re currently using it in client applications to display PDF documents, SSRS reports and standard HTML content. Using the WebBrowser control simplifies the application quite a bit since no JavaScript is required if the application only runs out-of-browser. Here’s a simple example of defining the WebBrowser control in XAML. I typically define it in MainPage.xaml when a Silverlight Navigation template is used to create the project so that I can re-use the functionality across multiple screens. <Grid x:Name="WebBrowserGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Collapsed"> <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Border Background="#484848" HorizontalAlignment="Stretch" Height="40"> <Image x:Name="WebBrowserImage" Width="100" Height="33" Cursor="Hand" HorizontalAlignment="Right" Source="/HTMLAndSilverlight;component/Assets/Images/Close.png" MouseLeftButtonDown="WebBrowserImage_MouseLeftButtonDown" /> </Border> <WebBrowser x:Name="JobPlanReportWebBrowser" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> </StackPanel> </Grid> Looking through the XAML you can see that a close image is defined along with the WebBrowser control. Because the URL that the WebBrowser should navigate to isn’t known at design time no value is assigned to the control’s Source property. If the XAML shown above is left “as is” you’ll find that any HTML content assigned to the WebBrowser doesn’t display properly. This is due to no height or width being set on the control. To handle this issue the following code is added into the XAML’s code-behind file to dynamically determine the height and width of the page and assign it to the WebBrowser. This is done by handling the SizeChanged event. void MainPage_SizeChanged(object sender, SizeChangedEventArgs e) { WebBrowserGrid.Height = JobPlanReportWebBrowser.Height = ActualHeight; WebBrowserGrid.Width = JobPlanReportWebBrowser.Width = ActualWidth; } When the user wants to view HTML content they click a button which executes the code shown in next: public void ShowBrowser(string url) { if (Application.Current.IsRunningOutOfBrowser) { JobPlanReportWebBrowser.NavigateToString("<html><body><iframe src='" + url + "' style='width:100%;height:97%;' /></body></html>"); WebBrowserGrid.Visibility = Visibility.Visible; } else { HtmlPage.Window.Invoke("ShowJobPlanIFrame", url); } } private void WebBrowserImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { WebBrowserGrid.Visibility = Visibility.Collapsed; }   Looking through the code you’ll see that it checks to see if the Silverlight application is running out-of-browser and then either displays the WebBrowser control or runs the JavaScript function discussed earlier. Although the WebBrowser control’s Source property could be assigned the URI of the page to navigate to, by assigning HTML content using the NavigateToString() method and adding an iframe, content can be shown from any site including cross-domain sites. This is especially handy when you need to grab a page from a reporting site that’s in a different domain than the Silverlight application. Here’s an example of viewing  PDF file inside of an out-of-browser application. The first image shows the application running out-of-browser before the user clicks a PDF HyperlinkButton.  The second image shows the PDF being displayed.   While there are certainly other techniques that can be used, the ones shown here have worked well for us in different applications and provide the ability to display HTML content in-browser or out-of-browser. Feel free to add a comment if you have another tip or trick you like to use when working with HTML content in Silverlight applications.   Download Code Sample   For more information about onsite, online and video training, mentoring and consulting solutions for .NET, SharePoint or Silverlight please visit http://www.thewahlingroup.com.

    Read the article

  • Mysql: create index on 1.4 billion records

    - by SiLent SoNG
    I have a table with 1.4 billion records. The table structure is as follows: CREATE TABLE text_page ( text VARCHAR(255), page_id INT UNSIGNED ) ENGINE=MYISAM DEFAULT CHARSET=ascii The requirement is to create an index over the column text. The table size is about 34G. I have tried to create the index by the following statement: ALTER TABLE text_page ADD KEY ix_text (text) After 10 hours' waiting I finally give up this approach. Is there any workable solution on this problem? UPDATE: the table is unlikely to be updated or inserted or deleted. The reason why to create index on the column text is because this kind of sql query would be frequently executed: SELECT page_id FROM text_page WHERE text = ? UPDATE: I have solved the problem by partitioning the table. The table is partitioned into 40 pieces on column text. Then creating index on the table takes about 1 hours to complete. It seems that MySQL index creation becomes very slow when the table size becomes very big. And partitioning reduces the table into smaller trunks.

    Read the article

  • How to make Ultra VNC viewer faster ?

    - by karthik
    I am trying to share the screen of a system A to another system B. The normal screen sharing is good. But when i run a 3-D program in System A and try to view it from System B, i see the screen frame by frame. The response time is too slow. My Req. is to show the 3-D program to another person. How can i make VNC faster, to its best ?

    Read the article

  • How to make Ultra VNC viewer faster ?

    - by karthik
    I am trying to share the screen of a system A to another system B. The normal screen sharing is good. But when i run a 3-D program in System A and try to view it from System B, i see the screen frame by frame. The response time is too slow. My Req. is to show the 3-D program to another person. How can i make VNC faster, to its best ?

    Read the article

  • linq expression in vb.net

    - by Thurein
    Hi, Can any body translate the following c# code to vb. I have tried telarik code converter but I got problem at expression.call and it won't compile at all. private static IOrderedQueryable<T> OrderingHelper<T>(IQueryable<T> source, string propertyName, bool descending, bool anotherLevel) { ParameterExpression param = Expression.Parameter(typeof(T), string.Empty); MemberExpression property = Expression.PropertyOrField(param, propertyName); LambdaExpression sort = Expression.Lambda(property, param); MethodCallExpression call = Expression.Call( typeof(Queryable), (!anotherLevel ? "OrderBy" : "ThenBy") + (descending ? "Descending" : string.Empty), new[] { typeof(T), property.Type }, // error line source.Expression, Expression.Quote(sort)); return (IOrderedQueryable<T>)source.Provider.CreateQuery<T>(call); } thanks Thurein

    Read the article

  • C++'s char * by swig got problem in Python 3.0

    - by gpliu3
    Our C++ lib works fine with Python2.4 using Swig, returning a C++ char* back to a python str. But this solution hit problem in Python3.0, error is: Exception=(, UnicodeDecodeError('utf8', b"\xb6\x9d\xa.....",0, 1, 'unexpected code byte') Our definition is like(working fine in Python 2.4): void cGetPubModulus( void* pSslRsa, char* cMod, int* nLen ); %include "cstring.i" %cstring_output_withsize( char* cMod, int* nLen ); Suspect swig is doing a Bytes-Str conversion automatically. In python2.4 it can be implicit but in Python3.0 it's no long allowed.. Anyone got a good idea? thanks

    Read the article

  • PHP create huge errors file on my server feof() fread()

    - by Nik
    I have a script that allows users to 'save as' a pdf, this is the script - <?php header("Content-Type: application/octet-stream"); $file = $_GET["file"] .".pdf"; header("Content-Disposition: attachment; filename=" . urlencode($file)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file)); flush(); // this doesn't really matter. $fp = fopen($file, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); ? An error log is being created and gets to be more than a gig in a few days the errors I receive are- [10-May-2010 12:38:50] PHP Warning: filesize() [function.filesize]: stat failed for BYJ-Timetable.pdf in /home/byj/public_html/pdf_server.php on line 10 [10-May-2010 12:38:50] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/byj/public_html/pdf_server.php:10) in /home/byj/public_html/pdf_server.php on line 10 [10-May-2010 12:38:50] PHP Warning: fopen(BYJ-Timetable.pdf) [function.fopen]: failed to open stream: No such file or directory in /home/byj/public_html/pdf_server.php on line 12 [10-May-2010 12:38:50] PHP Warning: feof(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 13 [10-May-2010 12:38:50] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 15 [10-May-2010 12:38:50] PHP Warning: feof(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 13 [10-May-2010 12:38:50] PHP Warning: fread(): supplied argument is not a valid stream resource in /home/byj/public_html/pdf_server.php on line 15 The line 13 and 15 just continue on and on... I'm a bit of a newbie with php so any help is great. Thanks guys Nik

    Read the article

  • Good looking programs that are built using wxPython for their UI

    - by ChrisC
    I need inspiration and motivation so I'm trying to find examples of different programs that have interesting and attractive UI's created free using wxPython. My searches have been slow to find results. I'm hoping you guys know of some of the best ones out there. btw, I've seen these: http://www.wxpython.org/screenshots.php and the list under "Applications Developed with wxPython" on the wxPython Wikipedia page. Update: only need Windows examples

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >