Search Results

Search found 960 results on 39 pages for 'confusion'.

Page 30/39 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • JSF/Seam - new component instance on submit?

    - by purecharger
    And my confusion with JSF continues. This is a continuation of a question asked yesterday, but I feel it warrants a new question. I have a single seam component that expects a URL parameter to be injected for retrieving a List<String> from a method. This works perfectly on the first navigation to the page. The List is used to display many different selectOneRadio groups that populate a <h:form/>. Now on the submit, I cannot get the URL parameter to be injected or otherwise set on the component! Adding <h:inputHidden/> causes FacesExceptions to be thrown. Then I tried setting the List as an instance variable on the object, and when the subsequent call is made on the submit (which I also do not understand why that is done) I check to see if the variable is non-null: if it isn't, return it. Now I found that a new instance of the component is created on submit!!! getList() called this.toString(): .BeanAction@5fd98420 #### This is when submit is clicked getList() called this.toString(): .BeanAction@22aacbce The component has the following annotations: Stateful @Scope(ScopeType.CONVERSATION) @Name("bean") @Restrict("#{identity.loggedIn}") Can someone explain why there is a new instance of the component created? I'm really not quite sure how to go about handling this. I thought the hidden parameter would work, because that is how I would do it with straight HTML, and I'm a little surprised that its not working for JSF/Seam.

    Read the article

  • Can't Install libcurl PHP on Ubuntu Linux

    - by FranticPedantic
    I am trying to use the new facebook api and it requires libcurl PHP. I used sudo apt-get install php5-curl sudo apachectl -k restart And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl. The source of this problem is probably that I built some of the tools from source (apache2, php), but then I got bored so installed a lot of the extensions with the package manager. But I'm not exactly how to go about diagnosing the point of failure. The apt-get install for curl definitely worked, and can be found in /usr/lib/php5/20060613/curl.so I think a lot of my confusion stems from not knowing which files go where, and what purpose they have. Any help would be appreciated, and please tell me if I need to provide more information. edit: The specific error I get is: Exception: Facebook needs the CURL PHP extension. from line if (!function_exists('curl_init')) { throw new Exception('Facebook needs the CURL PHP extension.'); } Ubuntu: 9.10 PHP: 5.2.13 Loaded Configuration File: /etc/php5/apache2/php.ini

    Read the article

  • How do I setup NInject? (i.e.

    - by Greg
    Hi, I'm getting confused in the doco how I should be setting up Ninject. I'm seeing different ways of doing it, some v2 versus v1 confusion probably included... Question - What is the best way in my WinForms application to set things up for NInject (i.e. what are the few lines of code required). I'm assuming this would go into the MainForm Load method. In other words what code do I have to have prior to getting to: Bind<IWeapon>().To<Sword>(); I have the following code, so effectively I just want to get clarification on the setup and bind code that would be required in my MainForm.Load() to end up with a concrete Samurai instance? internal interface IWeapon { void Hit(string target); } class Sword : IWeapon { public void Hit(string target) { Console.WriteLine("Chopped {0} clean in half", target); } } class Samurai { private IWeapon _weapon; [Inject] public Samurai(IWeapon weapon) { _weapon = weapon; } public void Attack(string target) { _weapon.Hit(target); } } thanks

    Read the article

  • How can I programmatically add more than just one view object to my view controller?

    - by BeachRunnerJoe
    I'm diving into iPhone OS development and I'm trying to understand how I can add multiple view objects to the "Left/Root" view of my SplitView iPad app. I've figured out how to programmatically add a TableView to that view based on the example code I found in Apple's online documentation... RootViewController.h @interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate, UITableViewDelegate, UITableViewDataSource> { DetailViewController *detailViewController; UITableView *tableView; NSFetchedResultsController *fetchedResultsController; NSManagedObjectContext *managedObjectContext; } RootViewController.m - (void)loadView { UITableView *newTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; newTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; newTableView.delegate = self; newTableView.dataSource = self; [newTableView reloadData]; self.view = newTableView; [newTableView release]; } but there are a few things I don't understand about it and I was hoping you veterans could help clear up some confusion. In the statement self.view = newTableView, I assume I'm setting the entire view to a single UITableView. If that's the case, then how can I add additional view objects to that view alongside the table view? For example, if I wanted to have a DatePicker view object and the TableView object instead of just the TableView object, then how would I programmatically add that? Referencing the code above, how can I resize the table view to make room for the DatePicker view object that I'd like to add? Thanks so much in advance for your help! I'm going to continue researching these questions right now.

    Read the article

  • jQuery - Callback failing if there is no options parameter

    - by user249950
    Hi, I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options, callback) { // default options - these are used when no others are specified $.fn.gpSlideOut.defaults = { fadeToColour: "#ffffb3", fadeToColourSpeed: 500, slideUpSpeed: 400 }; // build main options before element iteration var o = $.extend({}, $.fn.gpSlideOut.defaults, options); this.each(function() { $(this) .animate({backgroundColor: o.fadeToColour},o.fadeToColourSpeed) .slideUp(o.SlideUpSpeed, function(){ if (typeof callback == 'function') { // make sure the callback is a function callback.call(this); // brings the scope to the callback } }); }); return this; }; // invoke the function we just created passing it the jQuery object })(jQuery); The confusion I'm having is that normally on jQuery plugins you can call something like this: $(this_moveable_item).gpSlideOut(function() { // Do stuff }); Without the options parameter, but it misses the callback if I do it like that so I have to always have var options = {} $(this_moveable_item).gpSlideOut(options, function() { // Do stuff }); Even if I only want to use the defaults. Is there anyway to make sure the callback function is called whether or not the options parameter is there? Cheers.

    Read the article

  • [Python] name 'OptionGroup' is not defined

    - by Cawas
    Ok, so I made this rookie mistake below, but in my defense I was led to it thanks to how the help about this subject is on python docs, which states how to use optparse. It is actually an error under the gigantic tutorial section. In contrast and to my offense, I may be one of the very few stupid people who can't read very well and pay close attention on what I do. But since this took me so long to discover, I wanted to "document" it here: Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) >>> from optparse import OptionParser >>> outputGroup = OptionGroup(parser, 'Output handling') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'OptionGroup' is not defined This is strictly done with examples found on the docs, and you can't find anything about it anywhere, be it that long long docs page, google or stackoverflow. Plus, reading optparse.py shows OptionGroup is there, so that adds to the confusion. I bet it will take less than 1 minute for someone to spot my error. For that I'll only add proper tags and / or modify the title later on. :)

    Read the article

  • Siverlight animation issue

    - by George2
    Hello everyone, Suppose I have the following XAML snippets, my confusion is what is the meaning of the value for Storyboard.TargetProperty? i.e. the meaning of "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)". <DoubleAnimationUsingKeyFrames Storyboard.TargetName="p1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" BeginTime="00:00:00"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2500000" Value="1"/> <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/> </DoubleAnimationUsingKeyFrames> ... <Path Height="2.75" Width="2.75" Data="M2.75,1.375 C2.75,2.1343915 2.1343915,2.75 1.375,2.75 C0.61560845,2.75 0,2.1343915 0,1.375 C0,0.61560845 0.61560845,0 1.375,0 C2.1343915,0 2.75,0.61560845 2.75,1.375 z" Fill="#FF9F9B9B" Stretch="Fill" Stroke="#FF000000" StrokeThickness="0" Canvas.Left="7" Canvas.Top="14" x:Name="p1"> <Path.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </Path.RenderTransform> </Path> thanks in advance, George

    Read the article

  • SharePoint extensions for VS - which version have I got?

    - by Javaman59
    I'm using Visual Studio 2008, and have downloaded VSeWSS.exe 1.2, to enable Web Part development. I am new to SP development, and am already bewildered by the number of different versions of SP, and the VS add-ons. This particular problem has come up, which highlights my confusion. I selected Add - New Project - Visual C# - SharePoint- Web Part, accepted the defaults, and VS created a project, with the main file WebPart1.cs using System; using System.Runtime.InteropServices; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Serialization; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.WebPartPages; namespace WebPart1 { [Guid("9bd7e74c-280b-44d4-baa1-9271679657a0")] public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart { public WebPart1() { } protected override void CreateChildControls() // <-- This line { base.CreateChildControls(); // TODO: add custom rendering code here. // Label label = new Label(); // label.Text = "Hello World"; // this.Controls.Add(label); } } } The book I'm following, Essential SharePoint 2007, by Jeff Webb, has the following for the default project - using System; <...as previously> namespace WebPart1 { [Guid("9bd7e74c-280b-44d4-baa1-9271679657a0")] public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart { // ^ this is a new style (ASP.NET) web part! [author's comment] protected override void Render(HtmlTextWriter writer) // <-- This line { // This method draws the web part // TODO: add custom rendering code here. // Label label = new Label(); // writer.Write("Output HTML"); } } } The real reason for my concern is that in this chapter of the book the author frequently mentions the distinction between "old style" web parts, and "new style" web parts, as noted in his comment on the Render method. What's happened? Why has my default Web Part got a different signature to the authors?

    Read the article

  • Linked List pop() function

    - by JKid314159
    Consider the following list: [LinkNode * head -- LinkNode * node1 -- LinkNode * node2] I'm creating a stack of FIFO. I Call pop() which I want to pop node1. LinkNode::LinkNode(int numIn) { this->numIn = numIn; next = null; } . . . int LinkNode::pop() { Link * temp = head->next; head = temp->next; int popped = head->nodeNum; delete temp; Return numOut; Question: 1) head should be a pointer or a LinkNode *? 2) Link * temp is created on the call stack and when pop finishes doesn't temp delete automatically? 3) My major confusion is on what is the value of temp-next? Does this point to node1.next which equals node2? Appreciate your help? My reference is C++ for Java Programmers by Weiss.

    Read the article

  • widget within module in Yii

    - by Karolis
    I'm trying to create a widget within the module and then load that widget from 'outside' of the module. More particularly I'm using user module written by someone else. I don't want to have a separate page for displaying a login form, therefore I tried to make a CPortlet/widget (confusion) displaying the login form. Basically, I've moved the code from LoginController into that widget. Then I try to display the widget on some random page by <?php $this->widget('user.components.LoginForm'); ?> However, I get an error CWebApplication does not have a method named "encrypting". in UserIdentity class in this line: else if(Yii::app()->controller->module->encrypting($this->password)!==$user->password) This happens, because I'm basically trying to execute this code within context of the app and not the module. Thus the "Yii::app()-controller-module" trick doesn't really work as expected. What am I doing wrong:-\ Is there a better way to achieve this. I.e. display that login form in some other page, which is normally displayed by accessing login controller within user module (user/login) or is a widget the right way of doing it? Thanks.

    Read the article

  • Text size for drop down menu/input select not working in Safari

    - by Nick
    Hello All, First question... I'm having trouble getting ANY of the Drop down menu/Input Select's to appear with size 18 font in Safari. Works fine in FF. Code: <form class="form"> <select name="make"> <option value="0"> All</option> </select> </form> Css: .form input{ font-size:18px; margin-bottom:0px; } Any ideas? Can view live at [http://www.motolistr.com][1] Best, Nick EDIT 1: Thanks for the quick reply. I added a style to the select itself to avoid confusion. I tried; <select name='make' style='font-size: 18pt;'> </select> And <select name='make' style='font-size: 18px;'> </select> And <select name='make' style='font-size: 1.3em;'> </select> Still not working in SAFARI...Again FF works fine with all 3. Best, Nick

    Read the article

  • Glassfish, railo and coldbox - messed up links?

    - by mrt181
    I am new to ColdFusion and ColdBox (and programming). I tried to setup ColdBox but some of the links in the sample applications are broken. My configuration is a GlassFish v3 installation with the current Railo OSS. I access my site through Apache 2.2.14. So instead of http://127.0.0.1:8080/railo/ I access my environment trough http://railo/. In Railo I have a webroot mapping / to C:/webapps/myproject/. I have copied the current ColdBox 3M4 to C:/webapps/myproject/coldbox. I can access the dashboard through http://railo/coldbox/dashboard/index.cfm and have access to all options. My problems start the moment I try to open the sample gallery: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.io.FileNotFoundException: C:\webapps\viss-dev\coldbox\samples (Zugriff verweigert) note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs. GlassFish v3 OK, no problem, just enter the link directly: http://railo/coldbox/samples/index.cfm. The site looks plain, who cares - BUT all local links look like this: http://127.0.0.1:8080/coldbox/samples/applications/helloworld/index.cfm (railo is replaced with 127.0.0.1:8080). Looks like trouble. To make my confusion perfect: when I try to access the login app: http://railo/coldbox/samples/applications/sampleloginapp/index.cfm and hit the submit button, I am redirected to this address: http://railo/railo/coldbox/samples/applications/sampleloginapp/index.cfm. I believe that this is not really ColdBox-related, but it manifests itself when I try to use ColdBox, so here I am. P.S.: amazon.de takes too long to ship the ColdBox book :(

    Read the article

  • How do you rotate a sprite around its center by caclulating a new x and y position?

    - by Sam152
    I'm using Dark GDK and C++ to create a simple 2d game. I'm rotating an object but it rotates from the top left corner of the sprite. I have the following variables available: PlayerX PlayerY PlayerWidth PlayerHeight RotateAngle (360 x 0) Is there an algorithm that will modify the pivot point of the sprite, preferable to the center? Here is a small code sample: void Player::Move( void ) { if ( checkLeft() ) { PlayerX -= PlayerSpeed; if ( PlayerX < 0 ) PlayerX = 0; } if ( checkRight() ) { PlayerX += PlayerSpeed ; if ( PlayerX > 800 - PlayerWidth ) PlayerX = 800 - PlayerWidth; } if ( checkUp()) { PlayerY -= PlayerSpeed; if ( PlayerY < 0 ) PlayerY = 0; } if ( checkDown()) { PlayerY += PlayerSpeed; if ( PlayerY > 600 - PlayerHeight) PlayerY = 600 - PlayerHeight; } RotateAngle += 5; if(RotateAngle > 360) RotateAngle -=360; dbRotateSprite(Handle,RotateAngle); dbSprite ( 1 , PlayerX , PlayerY , Handle ); } Edit I'm considering opening up some reputation for this question, I have yet to be provided with an answer that works for me. If someone can provide an actual code sample that does the job, I'd be very happy. The problem with Blindy's answer is that no matter how much I simply translate it back or forth, the spirte still rotates around the top left hand corner and moving it somewhere rotating around the top left corner, then moving it back to the same position accomplishes nothing. Here is what I believe to be going on: Just so there is no confusion I have created a an image of what is going on. The left shows what is actually happening and the right shows what I need to happen.

    Read the article

  • Password Cracking in 2010 and Beyond

    - by mttr
    I have looked a bit into cryptography and related matters during the last couple of days and am pretty confused by now. I have a question about password strength and am hoping that someone can clear up my confusion by sharing how they think through the following questions. I am becoming obsessed about these things, but need to spend my time otherwise :-) Let's assume we have an eight-digit password that consists of upper and lower-case alphabetic characters, numbers and common symbols. This means we have 8^96 ~= 7.2 quadrillion different possible passwords. As I understand there are at least two approaches to breaking this password. One is to try a brute-force attack where we try to guess each possible combination of characters. How many passwords can modern processors (in 2010, Core i7 Extreme for eg) guess per second (how many instructions does a single password guess take and why)? My guess would be that it takes a modern processor in the order of years to break such a password. Another approach would consist of obtaining a hash of my password as stored by operating systems and then search for collisions. Depending on the type of hash used, we might get the password a lot quicker than by the bruteforce attack. A number of questions about this: Is the assertion in the above sentence correct? How do I think about the time it takes to find collisions for MD4, MD5, etc. hashes? Where does my Snow Leopard store my password hash and what hashing algorithm does it use? And finally, regardless of the strength of file encryption using AES-128/256, the weak link is still my en/decryption password used. Even if breaking the ciphered text would take longer than the lifetime of the universe, a brute-force attack on my de/encryption password (guess password, then try to decrypt file, try next password...), might succeed a lot earlier than the end of the universe. Is that correct? I would be very grateful, if people could have mercy on me and help me think through these probably simple questions, so that I can get back to work.

    Read the article

  • Installing RestEasy documentation is not clear--does maven install resteasy?

    - by user798719
    3.1. Standalone Resteasy If you are using resteasy outside of JBoss AS 6, you will need to do a few manual steps to install and configure resteasy. RESTeasy is deployed as a WAR archive and thus depends on a Servlet container. We strongly suggest that you use Maven to build your WAR files as RESTEasy is split into a bunch of different modules. You can see an example Maven project in one of the examples in the examples/ directory Also, when you download RESTeasy and unzip it you will see a lib/ directory that contains the libraries needed by resteasy. Copy these into your /WEB-INF/lib directory. Place your JAX-RS annotated class resources and providers within one or more jars within /WEB-INF/lib or your raw class files within /WEB-INF/classes. Hi, is my confusion justified? I am using JBoss 5 unfortunately. Do I need to download RESTeasy and unzip it IF I am using Maven, as the documentation recommends? Maven grabs all the dependencies that are needed to build a project, including the RESTEasy fraemwork, right? So why the contradiction here? Wish that the documentation would anticipate common questions and be written more clearly.

    Read the article

  • Value objects in DDD - Why immutable?

    - by Hobbes
    I don't get why value objects in DDD should be immutable, nor do I see how this is easily done. (I'm focusing on C# and Entity Framework, if that matters.) For example, let's consider the classic Address value object. If you needed to change "123 Main St" to "123 Main Street", why should I need to construct a whole new object instead of saying myCustomer.Address.AddressLine1 = "123 Main Street"? (Even if Entity Framework supported structs, this would still be a problem, wouldn't it?) I understand (I think) the idea that value objects don't have an identity and are part of a domain object, but can someone explain why immutability is a Good Thing? EDIT: My final question here really should be "Can someone explain why immutability is a Good Thing as applied to Value Objects?" Sorry for the confusion! EDIT: To clairfy, I am not asking about CLR value types (vs reference types). I'm asking about the higher level DDD concept of Value Objects. For example, here is a hack-ish way to implement immutable value types for Entity Framework: http://rogeralsing.com/2009/05/21/entity-framework-4-immutable-value-objects. Basically, he just makes all setters private. Why go through the trouble of doing this?

    Read the article

  • Are Fortran control characters (carriage control) still implemented in compilers?

    - by CmdrGuard
    In the book Fortran 95/2003 for Scientists and Engineers, there is much talk given to the importance of recognizing that the first column in a format statement is reserved for control characters. I've also seen control characters referred to as carriage control on the internet. To avoid confusion, by control characters, I refer to the characters "1, a blank (i.e. \s), 0, and +" as having an effect on the vertical spacing of output when placed in the first column (character) of a FORMAT statement. Also, see this text-only web page written entirely in fixed-width typeface : Fortran carriage-control (because nothing screams accuracy and antiquity better than prose in monospaced font). I found this page and others like it to be not quite clear. According to Fortran 95/2003 for Scientists and Engineers, failure to recall that the first column is reserved for carriage control can lead to horrible unintended output. Paraphrasing Dave Barry, type the wrong character, and nuclear missiles get fired at Norway. However, when I attempt to adhere to this stern warning, I find that gfortran has no idea what I'm talking about. Allow me to illustrate my point with some example code. I am trying to print out the number Pi: PROGRAM test_format IMPLICIT NONE REAL :: PI = 2 * ACOS(0.0) WRITE (*, 100) PI WRITE (*, 200) PI WRITE (*, 300) PI 100 FORMAT ('1', "New page: ", F11.9) 200 FORMAT (' ', "Single Space: ", F11.9) 300 FORMAT ('0', "Double Space: ", F11.9) END PROGRAM test_format This is the output: 1New page: 3.141592741 Single Space: 3.141592741 0Double Space: 3.141592741 The "1" and "0" are not typos. It appears that gfortran is completely ignoring the control character column. My question, then, is this: Are control characters still implemented in standards compliant compilers or is gfortran simply not standards compliant? For clarity, here is the output of my gfortran -v Using built-in specs. Target: powerpc-apple-darwin9 Configured with: ../gcc-4.4.0/configure --prefix=/sw --prefix=/sw/lib/gcc4.4 --mandir=/sw/share/man --infodir=/sw/share/info --enable-languages=c,c++,fortran,objc,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --disable-libjava-multilib --build=powerpc-apple-darwin9 --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9 Thread model: posix gcc version 4.4.0 (GCC)

    Read the article

  • Select * from 'many to many' SQL relationship

    - by Rampant Creative Group
    I'm still learning SQL and my brain is having a hard time with this one. Say I have 3 tables: teams players and teams_players as my link table All I want to do is run a query to get each team and the players on them. I tried this: SELECT * FROM teams INNER JOIN teams_players ON teams.id = teams_players.team_id INNER JOIN players ON teams_players.player_id = players.id But it returned a separate row for each player on each team. Is JOIN the right way to do it or should I be doing something else? ----------------------------------------- Edit Ok, so from what I'm hearing, this isn't necessarily a bad way to do it. I'll just have to group the data by team while I'm doing my loop. I have not yet tried the modified SQL statements provided, but I will today and get back to you. To answer the question about structure - I guess I wasn't thinking about the returned row structure which is part of what lead to my confusion. In this particular case, each team is limited to 4 players (or less) so I guess the structure that would be helpful to me is something like the following: teams.id, teams.name, players.id, players.name, players.id, players.name, players.id, players.name, players.id, players.name, 1 Team ABC 1 Jim 2 Bob 3 Ned 4 Roy 2 Team XYZ 2 Bob 3 Ned 5 Ralph 6 Tom

    Read the article

  • Are MEF's ComposableParts contracts instance-based?

    - by Dave
    I didn't really know how to phrase the title of my questions, so my apologies in advance. I read through parts of the MEF documentation to try to find the answer to my question, but couldn't find it. I'm using ImportMany to allow MEF to create multiple instances of a specific plugin. That plugin Imports several parts, and within calls to a specific instance, it wants these Imports to be singletons. However, what I don't want is for all instances of this plugin to use the same singleton. For example, let's say my application ImportManys Blender appliances. Every time I ask for one, I want a different Blender. However, each Blender Imports a ControlPanel. I want each Blender to have its own ControlPanel. To make things a little more interesting, each Blender can load BlendPrograms, which are also contained within their own assemblies, and MEF takes care of this loading. A BlendProgram might need to access the ControlPanel to get the speed, but I want to ensure that it is accessing the correct ControlPanel (i.e. the one that is associated with the Blender that is associated with the program!) This diagram might clear things up a little bit: As the note shows, I believe that the confusion could come from an inherently-poor design. The BlendProgram shouldn't touch the ControlPanel directly, and instead perhaps the BlendProgram should get the speed via the Blender, which will then delegate the request to its ControlPanel. If this is the case, then I assume the BlendProgram needs to have a reference to a specific Blender. In order to do this, is the right way to leverage MEF and use an ImportingConstructor for BlendProgram, i.e. [ImportingConstructor] public class BlendProgram : IBlendProgram { public BlendProgram( Blender blender) {} } And if this is the case, how do I know that MEF will use the intended Blender plugin?

    Read the article

  • How does the socket API accept() function work?

    - by Eli Bendersky
    The socket API is the de-facto standard for TCP/IP and UDP/IP communications (that is, networking code as we know it). However, one of its core functions, accept() is a bit magical. To borrow a semi-formal definition: accept() is used on the server side. It accepts a received incoming attempt to create a new TCP connection from the remote client, and creates a new socket associated with the socket address pair of this connection. In other words, accept returns a new socket through which the server can communicate with the newly connected client. The old socket (on which accept was called) stays open, on the same port, listening for new connections. How does accept work? How is it implemented? There's a lot of confusion on this topic. Many people claim accept opens a new port and you communicate with the client through it. But this obviously isn't true, as no new port is opened. You actually can communicate through the same port with different clients, but how? When several threads call recv on the same port, how does the data know where to go? I guess it's something along the lines of the client's address being associated with a socket descriptor, and whenever data comes through recv it's routed to the correct socket, but I'm not sure. It'd be great to get a thorough explanation of the inner-workings of this mechanism.

    Read the article

  • What's the best way to learn .NET?

    - by duffymo
    I've been developing Java EE for quite a while now. I've used WebLogic, Tomcat, Spring, and Hibernate extensively, so I have a mental model of what features are available and how things are developed and deployed. The problem that I have with .NET is that I don't have a clear mapping of its features onto Java EE. Here's what I know so far: Java EE - .NET Java - C# JAR - DLL WAR - ? (deployment in general) EAR - ? (deployment in general) Tomcat - IIS web server JSP - ASP? JDBC - ODBC JMS - MSMQ JTA - Microsoft Transaction Manager So much of the functionality that WebLogic handles appears to be dispersed throughout the Windows OS. My confusion kicks in when I see the waves of books at Borders - VB.NET, ASP.NET, C#, etc. If I'm not a VB programmer, would it be possible to stick with C# and write enterprise apps that are the equivalent of what I'm used to with Java EE? If there were a Top Three list of books to learn from, what would they be? The "Head First" series has certainly been successful for Java. http://www.amazon.com/Head-First-C-Brain-Friendly-Guides/dp/0596514824/ref=sr_1_1?ie=UTF8&s=books&qid=1224121193&sr=8-1 Equally well recommended for .NET learning? Thanks. - %

    Read the article

  • Put together tiles in android sdk and use as background

    - by Jon
    In a feeble attempt to learn some Android development am I stuck at graphics. My aim here is pretty simple: Take n small images and build a random image, larger than the screen with possibility to scroll around. Have an animated object move around on it I have looked at the SDK examples, Lunar Lander especially but there are a few things I utterly fail to wrap my head around. I've got a birds view plan (which in my head seems reasonably sane): How do I merge the tiles into one large image? The background is static so I figure I should do like this: Make a 2d array with refs to the tiles Make a large Drawable and draw the tiles on it At init draw this big image as the background At each onDraw redraw the background of the previous spot of the moving object, and the moving object at its new location The problem is the hands on things. I load the small images with "Bitmap img1 = BitmapFactory.decodeResource (res, R.drawable.img1)", but then what? Should I make a canvas and draw the images on it with "canvas.drawBitmap (img1, x, y, null);"? If so how to get a Drawable/Bitmap from that? I'm totally lost here, and would really appreciate some hands on help (I would of course be grateful for general hints as well, but I'm primarily trying to understand the Graphics objects). To make you, dear reader, see my level of confusion will I add my last desperate try: Drawable drawable; Canvas canvas = new Canvas (); Bitmap img1 = BitmapFactory.decodeResource (res, R.drawable.img1); // 50 x 100 px image Bitmap img2 = BitmapFactory.decodeResource (res, R.drawable.img2); // 50 x 100 px image canvas.drawBitmap (img1, 0, 0, null); canvas.drawBitmap (img2, 50, 0, null); drawable.draw (canvas); // obviously wrong as draw == null this.setBackground (drawable); Thanks in advance

    Read the article

  • Slow Python HTTP server on localhost

    - by Abiel
    I am experiencing some performance problems when creating a very simple Python HTTP server. The key issue is that performance is varying depending on which client I use to access it, where the server and all clients are being run on the local machine. For instance, a GET request issued from a Python script (urllib2.urlopen('http://localhost/').read()) takes just over a second to complete, which seems slow considering that the server is under no load. Running the GET request from Excel using MSXML2.ServerXMLHTTP also feels slow. However, requesting the data Google Chrome or from RCurl, the curl add-in for R, yields an essentially instantaneous response, which is what I would expect. Adding further to my confusion is that I do not experience any performance problems for any client when I am on my computer at work (the performance problems are on my home computer). Both systems run Python 2.6, although the work computer runs Windows XP instead of 7. Below is my very simple server example, which simply returns 'Hello world' for any get request. from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer class MyHandler(BaseHTTPRequestHandler): def do_GET(self): print("Just received a GET request") self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() self.wfile.write('Hello world') return def log_request(self, code=None, size=None): print('Request') def log_message(self, format, *args): print('Message') if __name__ == "__main__": try: server = HTTPServer(('localhost', 80), MyHandler) print('Started http server') server.serve_forever() except KeyboardInterrupt: print('^C received, shutting down server') server.socket.close() Note that in MyHandler I override the log_request() and log_message() functions. The reason is that I read that a fully-qualified domain name lookup performed by one of these functions might be a reason for a slow server. Unfortunately setting them to just print a static message did not solve my problem. Also, notice that I have put in a print() statement as the first line of the do_GET() routine in MyHandler. The slowness occurs prior to this message being printed, meaning that none of the stuff that comes after it is causing a delay.

    Read the article

  • Getting Depth Value on Kinect SDK 1.6

    - by AlexanderPD
    this is my first try on Kinect and Kinect SDK so I'm having a lot of "newbie issues" :) my goal is to point my mouse on the Kinect standard video output and get the depth value. I already have both normal video and depth video outputs by using the 2 "Color Basic-WPF" and "Depth Basic-WPF" samples, and handling mouse events or position is not a problem. In fact i already did all and i already got a depth value, but this value is always HIGHLY imprecise. It jumps from 500 to 4000 by just moving to the next pixel in a plane surface. So.. I'm pretty sure I'm reading the depth value in the wrong way. This is how i read it: short debugValue = depthPixels[x*y].Depth; debug.Text = "X = "+x+", Y = "+y+", value = "+debugValue.ToString(); i know it's pretty out of context, this little piece of code is inside the same SensorDepthFrameReady function in "Depth Basic-WPF"! "x" and "y" are the mouse coordinates and depthPixels is DepthImagePixel[] type, a temporary array filled with the "depthFrame.CopyDepthImagePixelDataTo(this.depthPixels);" instruction. Depth frame is filled here: DepthImageFrame depthFrame = e.OpenDepthImageFrame() the "e" comes from here: private void SensorDepthFrameReady(object sender, DepthImageFrameReadyEventArgs e) and this last one is called here: this.sensor.DepthFrameReady += this.SensorDepthFrameReady; how i must handle that depth value i get? I know the value must be between 800 and 4000 but i get values between about 500 and about 8000. i already google a lot (here on SO too) and i still can't understand if the depth value is 11 or 13 bit. The sdk examples uses shrink this value to 8 bit and this is making even more confusion in my head :(

    Read the article

  • Javascript JQUERY AJAX: When Are These Implemented

    - by Michael Moreno
    I'm learning javascript. Poked around this excellent site to gather intel. Keep coming across questions / answers about javascript, JQUERY, JQUERY with AJAX, javascript with JQUERY, AJAX alone. My conclusion: these are all individually powerful and useful. My confusion: how does one determine which/which combination to use ? I've concluded that javascript is readily available on most browsers. For example, I can extend a simple HTML page with <html> <body> <script type="text/javascript"> document.write("Hello World!"); </script> </body> </html> However, within the scope of Python/DJANGO, many of these questions are JQUERY and AJAX related. At which point or under what development circumstances would I conclude that javascript alone isn't going to "cut it", and I need to implement JQUERY and/or AJAX and/or some other permutation ?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >