Search Results

Search found 13838 results on 554 pages for 'disconnected model'.

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

  • SQL Developer Data Modeler v3.3 Early Adopter: Link Model Objects Across Designs

    - by thatjeffsmith
    The third post in our “What’s New in SQL Developer Data Modeler v3.3” series, SQL Developer Data Modeler now allows you to link objects across models. If you need to catch up on the earlier posts, here are the first two: New and Improved Search Collaborative Design via Excel Today’s post is a very simple and straightforward discussion on how to share objects across models and designs. In previous releases you could easily copy and paste objects between models and designs. Simply select your object, right-click and select ‘Copy’ Once copied, paste it into your other designs and then make changes as required. Once you paste the object, it is no longer associated with the source it was copied from. You are free to make any changes you want in the new location without affecting the source material. And it works the other way as well – make any changes to the source material and the new object is also unaffected. However. What if you want to LINK a model object instead of COPYING it? In version 3.3, you can now do this. Simply drag and drop the object instead of copy and pasting it. Select the object, in this case a relational model table, and drag it to your other model. It’s as simple as it sounds, here’s a little animated GIF to show you what I’m talking about. Drag and drop between models/designs to LINK an object Notes The ‘linked’ object cannot be modified from the destination space Updating the source object will propagate the changes forward to wherever it’s been linked You can drag a linked object to another design, so dragging from A - B and then from B - C will work Linked objects are annotated in the model with a ‘Chain’ bitmap, see below This object has been linked from another design/model and cannot be modified. A very simple feature, but I like the flexibility here. Copy and paste = new independent object. Drag and drop = linked object.

    Read the article

  • Apply bone tranforms when importing FBX in XNA

    - by hichaeretaqua
    Preconditions: I have some models, that does only contain some meshes and one texture. There is no animation within the model. An example: a model of a table. I want to draw the Model with a custom effect, so I have to swap the effect after loading the model. In order to draw them correctly, I have to apply the bone transformation manually on each draw for each mesh and effect as can be seen here. So there are two questions: Is there a option during import that allows my to apply the bone transformation on all vertices, so that during draw call I should not have to do this? Is there a option during import that merges all vertices into a Vertex- and IndexBuffer, that allows me to draw the whole model with just one call? I'm pretty sure that the build-in "Autodesk FBX - XNA Framework" does not support this features, but maybe there is an other imported available or an other possibility I missed. The aim is to speed up rendering a little bit especially by using instancing. So having one VertexBuffer to draw at one time would be pretty nice.

    Read the article

  • Parameterized Django models

    - by mgibsonbr
    In principle, a single Django application can be reused in two or more projects, providing functionality relevent to both. That implies that the same database structure (tables and relations) will be re-created identically in different databases, and most times this is not a problem (assuming the projects/databases are unrelated - for instance when someone downloads a complete app to use in their own projects). Sometimes, however, the models must be "tweaked" a little to better fit the problem needs. This can be accomplished by forking the app, but I wondered if there wouldn't be a better option in cases where the app designer can anticipate the most common customizations. For instance, if I have a model that could relate to another as one-to-one or one-to-many, I could specify the unique property as a parameter, that can be specified in the project's settings: class This(models.Model): other = models.ForeignKey(Other, unique=settings.OTHER_TO_THIS) Or if a model can relate to many others, I could create an intermediate table for each of them (thus enforcing referential integrity) instead of using generic fks: for related in settings.MODELS_RELATED_TO_OTHER: model_name = '%s_Other' % related globals()[model_name] = type(model_name, (models.Model,) { me:models.ForeignKey(find_model_class(related)), other:models.ForeignKey(Other), # Some other properties all intersection tables must have }) Etc. Let me stress out that I'm not proposing to change the models at runtime nor anything like that; once the parameters were defined and syncdb called for the first time, those parameters are not to be changed again (unless you're doing a schema migration). Is this a good design? Are there better ways to accomplish the same thing, or maybe drawbacks I coulnd't anticipate? This technique is meant to be used sparingly (only on apps meant to be reused in wildly different contexts, and only when a specific need of customization can be detected while the app model is being designed).

    Read the article

  • Active RDP session over VPN getting disconnected

    - by Wandering Penguin
    I am having seemingly random disconnects of active RDP sessions (I am actively typing or otherwise interacting with the desktop) when connected over the VPN connection. The attempted to reconnect 1/20 pops up and proceeds all the way through 20 then drops. Once the session drops I can open a new session and connect again. This started happening about a week ago, The VPN connection is an IPSec VPN connection from a SonicWall NSA 2400. The NIC drivers are up to date. The VPN client is up to date. The firmware on the SonicWall is up to date (both regular and the early-release versions work the same). I have attempted to connect over three ISPs all with the same behavior. Two different workstations were used to test the VPN connection. The same behavior occurs when connecting to a domain workstation or server. If I am within the firewall I can connect to the same workstations and servers with the disconnect. The VPN connection has "enable fragmented packet handling" and "ignore DF (don't fragment) bit" set. Is there something I am missing in where I am looking for the problem?

    Read the article

  • Resolving DNS queries for two disconnected, private, networks

    - by Mikeage
    I'm trying to setup two PCs (one Windows, one Linux, but my understanding is that this problem is more DNS and less OS) as follows: Home network: 192.168.1.0/24 VPN (via OpenVPN server not within the home network): 192.168.2.0/24 . I would like a PC on both networks to be able to access three different types of site: Internet addresses Addresses on the home network Addresses on the vpn However, I'm not sure how/which DNS servers to use. If I prioritize my home DNS server, I can resolve (1) and (2), but not (3). If I prioritize my VPN DNS server, I can't resolve addresses of type (2). Of course, looking up addresses via nslookup and explicitly setting the correct server works, so I know my local DNS servers are OK. Is there any way I can set up my PCs to fallback on the second DNS server if there is no response? Alternatively, is there any way I can tell different queries to go to different servers [maybe by setting up different subdomains; foo.local.something vs. bar.vpn.something]? Thanks

    Read the article

  • Router gets disconnected once I terminate my SIP application

    - by TacB0sS
    Hey, Here is an interesting one, I have a SIP VoIP application which is able to register to the PBX server, and I can invite and see the user call on the callee end receiving an Invite, and on the caller end I see the Ringing response... now here is interesting part, if I close my application with out any notification to the server my router disconnects and restart, after a short while (30 - 150 sec). I could fix that if I would complete the ACK BYE process, but I'm just wondering why does my router hangs up? any ideas? My Router is TNN-Siemens SL2-141, thought this might matter Update: this is what I found: SIP ALG allows two or more simultaneous VoIP phone calls made by VoIP clients through this router. which means that if I disable it I would not be able to do the testing I'm trying so badly to do, and since I don't have access to another router, I must handle it with the bug then... I can say that this never happened to me with one user connecting, but then again I didn't have anyone to invite then, I received from the SIP UAS 503 when I tried to invite an imaginary user. This bug only occur after I connected the second SIP UAC and invited it and closed the application. Adam.

    Read the article

  • Windows 8 - When AC Power is disconnected, atibtmon.exe throws a Runtime error

    - by Junior Mayhé
    The installer is not working for my ATI mobility Radeon HD 3670 on Dell XPS Studio 16 using Windows 8 PRO 64 bits. Here are the screenshots of my ATI Radeon configuration: Hardware configuration Software configuration And here is the problem on Windows 8: everytime I disconnect the AC power cord, atibtmon.exe throws a runtime error as follows What could I do to avoid this error? I have installed the legacy driver http://support.amd.com/us/kbarticles/Pages/catalystlegacywin8.aspx but this installer fails (when trying to install the driver).

    Read the article

  • Good Linux Distro for Disconnected Netbook

    - by MrWizard54
    I'm deployed to Afghanistan with the Army and I have a friend who's netbook had his hard drive take a dump on him. He ordered a new hard drive and I was able to download and burn a copy of Ubuntu to disk from work. However the default install doesn't support most of the media that he wants to watch (AVI files, probably some DIVX video) without installing extra packages. We don't have internet in the tent and really don't have a vaiable option for downloading additional packages through the package manager anywhere here. The computer is a small HP netbook. All my friend wants is to watch ripped movies. Does anyone know of a good way to do either of the following: Download packages seperately and install them via CD A distro that is going to come preloaded with all of the packages and needed to watch just about any type of video file you can think of? Thanks in advance, Andy

    Read the article

  • Drive Mapped On Amazon EC2 Instance Startup Disconnected After Logon

    - by jsn
    I am launching an Amazon EC2 instance (Windows Server 2012), and on startup (though User Data field), it runs this powershell script: <powershell> NET CONFIG SERVER /AUTODISCONNECT:-1 # clear all prior connections net use * /delete /y > C:\delLog.txt 2>&1 # mount new drive net use R: \\dbHost\share /user:username pass /persistent:yes > C:\useLog.txt 2>&1 ipconfig /all > C:\ipLog.txt </powershell> When it launches and I connect to it through RDP, it shows in explorer "Diconnected Network Drive (R:). If I double click it, error message displays "R:\ is not accesible. Access id denied". Normally, it would ask me for credentials to reconnect. I need for this drive to be connected through the duration of the instance. delLog.txt contents: You have these remote connections: T: \\dbHost\share Continuing will cancel the connections. The command completed successfully. useLog.txt contents: The command completed successfully. ipLog.txt contents as expected. The net use commands works fine by itself, it connects. Anyone have any idea what could be wrong? There is only one account on these machines - Administrator. It is a samba share to a Linux server on a private network.

    Read the article

  • arp requests are sent continuously and my linux machine disconnected to the world

    - by sees
    I have the following problem and really need your help I'm implementing a small server to receive request from client on port 18999(just sample) using TCP socket. When I tested my server by using a lot of requests from a tablet through a router, I got the ARP problem(?) My net work just like: TABLET <------- WIRELESS ROUTER <------- MY SERVER (LINUX) Problems: 1. Can not connect to my Linux any more ( telnet, ping v.v...unreachable) 2. I use serial cable to connect to my Linux machine and use Wiresharp (from Windows) to catch the send message from Linux. It says that Linux keeps sending out continuously every 3 seconds ARP messages like the following: xx:xx:99:77:ff:69 ff:ff:ff:ff:ff:ff ARP 60 Who has 192.168.10.2? Tell 192.168.10.3 In the above message: xx:xx:99:77:ff:69 my Linux MAC address 192.168.10.2 my Tablet address 192.168.10.3 my Linux IP address Can you help me figure out the problem? Or tell me the way to detect the problem and reset the network back to normal (maybe restart Linux but I want to detect problem and restart automatically) UPDATE: 1. The above network works normally if tablet sends messages to my LINUX in normal speed (but also down after 48 hours) 2. The router works again after I unplugged my Linux ethernet cable (RJ45) from router. 3. The wireless network still works ( I can browser the router page from tablet) 4. When I use: ifconfig down then ifconfig up , the Linux restarts (?????????)

    Read the article

  • VMWare Host Not Responding - VMs are Disconnected (ESXi 3.5)

    - by EyeonTech
    I have inherited a VMWare environement ESX v3i 3.5. I am not fluent with VMWare ESXi so bare with me. Two days ago, when I opened Virtual Centre, one of the Hosts showed up as Not Responding. The error I am seeing is:----- Unable to acquire licenses because license source is unavailable: The license manager has not been started yet, the wrong port@host or license file is being used, or the port or hostname in the license file has been changed. What I have tried: I have Stopped and Started the license server within the application. When I do this, I am able to disconnect the host in Virtual Centre and reconnect. This brings the host back online, but a few minutes later, the host goes to a not responding state again. I have rebooted the server with the Licensing software installed. While browsing Google, I have not been able to find any steps I feel comfortable performing and I would like the opinion of the VMWare pros. Where are the log files I should be looking at to correctly determine what is going on? Has anyone seen this behaviour and how did you resolve it? Thank you

    Read the article

  • Laptop kicks other users off the wifi when it connects, then gets disconnected itself

    - by Devon
    I've got an Acer Aspire One running Linux. When I connect to my building's wifi, everything seems fine for a short period of time (I can google a few things or start downloading an Apt package), but then other devices on the network lose their IP addresses. Shortly after that, my computer also gets disconected. My computer is set to use DHCP. What causes this, and do you know how it could be fixed? Am I causing a broadcast storm?

    Read the article

  • Media disconnected Acer Aspire Win 7 Starter

    - by RoadGlide
    Problem setting up wireless connection on my new ACER Netbook using Win 7 Starter. Works fine with LAN cable from NETGEAR WGT624V3 router with updated firmware. The NETGEAR does not see the ACER, but does see my XP Laptop. I'm also running a wireless, BlueRay DVD. When I run getmac I get hardware not pesent, my mac address, Hardware not present. Is there a switch that needs to be set?

    Read the article

  • Program opens on disconnected and invisible monitor [closed]

    - by FiveO
    Possible Duplicate: Recover Windows Opening Off Screen? I'm working with a HP Elitebook 8460p with Windows 8 using always 2 Monitors connected. And some Programs I'm always opening on the second screen (which windows does automatically). But now the problem: When the screens aren't connected (when I'm at home), some programs still open on the second screen (which does not exist anymore) and it's just not possible to move them to the main (only!) screen! Does some one knows a solution for the problem - already bringing back the windows to the main screen would be enough. Thanks

    Read the article

  • Server refuses to boot when Raid5 disk is disconnected - /root/ missing

    - by Ronni
    I recently set up a NAS server running a Debian OS (6.0.4) It contains 4 disks, 3 of them are in a Raid5 array, while the last one is used for the OS. To simulate a disk-failure I unplugged one of the raid disks, which resulted in the OS being unable to boot. It started the boot, recognized that md0 (the raid array) was running on 2/3 disks, and then threw a few errors. It was unable to find the following directories: /dev/root on /root, /dev on /root/dev, /sys on /root/sys, /proc on /root/proc It appears this happens regardless of which raid disk is removed. These directories are supposed to be on /dev/sdd my system disk. Output from fstab and blkid : http://dl.dropbox.com/u/6017799/NASOutput.txt If you need additional info, please let me know.

    Read the article

  • ASP.NET MVC 2 Model encapsulated within ViewModel Validation

    - by Program.X
    I am trying to get validation to work in ASP.NET MVC 2, but without much success. I have a complex class containing a large number of fields. (Don't ask - this is oneo f those real-world situations best practices can't touch) This would normally be my Model and is a LINQ-to-SQL generated class. Because this is generated code, I have created a MetaData class as per http://davidhayden.com/blog/dave/archive/2009/08/10/AspNetMvc20BuddyClassesMetadataType.aspx. public class ConsultantRegistrationMetadata { [DisplayName("Title")] [Required(ErrorMessage = "Title is required")] [StringLength(10, ErrorMessage = "Title cannot contain more than 10 characters")] string Title { get; set; } [Required(ErrorMessage = "Forename(s) is required")] [StringLength(128, ErrorMessage = "Forename(s) cannot contain more than 128 characters")] [DisplayName("Forename(s)")] string Forenames { get; set; } // ... I've attached this to the partial class of my generated class: [MetadataType(typeof(ConsultantRegistrationMetadata))] public partial class ConsultantRegistration { // ... Because my form is complex, it has a number of dependencies, such as SelectLists, etc. which I have encapsulated in a ViewModel pattern - and included the ConsultantRegistration model as a property: public class ConsultantRegistrationFormViewModel { public Data.ConsultantRegistration ConsultantRegistration { get; private set; } public SelectList Titles { get; private set; } public SelectList Countries { get; private set; } // ... So it is essentially ViewModel=Model My View then has: <p> <%: Html.LabelFor(model => model.ConsultantRegistration.Title) %> <%: Html.DropDownListFor(model => model.ConsultantRegistration.Title, Model.Titles,"(select a Title)") %> <%: Html.ValidationMessage("Title","*") %> </p> <p> <%: Html.LabelFor(model => model.ConsultantRegistration.Forenames) %> <%: Html.TextBoxFor(model => model.ConsultantRegistration.Forenames) %> <%: Html.ValidationMessageFor(model=>model.ConsultantRegistration.Forenames) %> </p> The problem is, the validation attributes on the metadata class are having no effect. I tried doing it via an Interface, but also no effect. I'm beginning to think that the reason is because I am encapsulating my model within a ViewModel. My Controller (Create Action) is as follows: [HttpPost] public ActionResult Create(Data.ConsultantRegistration consultantRegistration) { if (ModelState.IsValid) // this is always true - which is wrong!! { try { consultantRegistration = ConsultantRegistrationRepository.SaveConsultantRegistration(consultantRegistration); return RedirectToAction("Edit", new { id = consultantRegistration.ID, sectionIndex = 2 }); } catch (Exception ex) { ModelState.AddModelError("CreateException",ex); } } return View(new ConsultantRegistrationFormViewModel(consultantRegistration)); } As outlined in the comment, the ModelState.IsValid property always returns true, despite fields with the Validaiton annotations not being valid. (Forenames being a key example). Am I missing something obvious - considering I am an MVC newbie? I'm after the mechanism demoed by Jon Galloway at http://www.asp.net/learn/mvc-videos/video-10082.aspx. (Am aware t is similar to http://stackoverflow.com/questions/1260562/asp-net-mvc-model-viewmodel-validation but that post seems to talk about xVal. I have no idea what that is and suspect it is for MVC 1)

    Read the article

  • Financial institutions build predictive models using Oracle R Enterprise to speed model deployment

    - by Mark Hornick
    See the Oracle press release, Financial Institutions Leverage Metadata Driven Modeling Capability Built on the Oracle R Enterprise Platform to Accelerate Model Deployment and Streamline Governance for a description where a "unified environment for analytics data management and model lifecycle management brings the power and flexibility of the open source R statistical platform, delivered via the in-database Oracle R Enterprise engine to support open standards compliance." Through its integration with Oracle R Enterprise, Oracle Financial Services Analytical Applications provides "productivity, management, and governance benefits to financial institutions, including the ability to: Centrally manage and control models in a single, enterprise model repository, allowing for consistent management and application of security and IT governance policies across enterprise assets Reuse models and rapidly integrate with applications by exposing models as services Accelerate development with seeded models and common modeling and statistical techniques available out-of-the-box Cut risk and speed model deployment by testing and tuning models with production data while working within a safe sandbox Support compliance with regulatory requirements by carrying out comprehensive stress testing, which captures the effects of adverse risk events that are not estimated by standard statistical and business models. This approach supplements the modeling process and supports compliance with the Pillar I and the Internal Capital Adequacy Assessment Process stress testing requirements of the Basel II Accord Improve performance by deploying and running models co-resident with data. Oracle R Enterprise engines run in database, virtually eliminating the need to move data to and from client machines, thereby reducing latency and improving security"

    Read the article

  • XNA model drawing problem

    - by user1990950
    When using this code: public static void DrawModel(Model model, Vector3 position, Vector3 offset, float xRotation, float yRotation, float zRotation, float allrot, float xScale, float yScale, float zScale) { position.Y *= -1; offset.Y *= -1; Matrix worldMatrix = ((Matrix.CreateRotationZ(MathHelper.ToRadians(zRotation)) * Matrix.CreateRotationX(MathHelper.ToRadians(xRotation))) * Matrix.CreateRotationY(MathHelper.ToRadians(yRotation))) * (Matrix.CreateTranslation(offset) * Matrix.CreateRotationY(MathHelper.ToRadians(allrot))) * Matrix.CreateScale(xScale, yScale, zScale); worldMatrix *= Matrix.CreateTranslation(position) * theCamera.GetTransformation() * Matrix.CreateTranslation(new Vector3(-(graphics.GraphicsDevice.Viewport.Width / 2), graphics.GraphicsDevice.Viewport.Height / 2, 0)); foreach (ModelMesh mesh in model.Meshes) { for (int i = 0; i < mesh.Effects.Count; i++) { ((BasicEffect)mesh.Effects[i]).EnableDefaultLighting(); ((BasicEffect)mesh.Effects[i]).World = worldMatrix; ((BasicEffect)mesh.Effects[i]).View = viewMatrix; ((BasicEffect)mesh.Effects[i]).Projection = projectionMatrix; } mesh.Draw(); } } The model rotates and then scales. It should scale and then rotate, but whenever I try to change it, it won't work.

    Read the article

  • Calling a model from a controller from the 404 route [migrated]

    - by IrishRob
    Got a problem here where I can’t seem to load a method from a model after the page has been redirected after encountering a 404. Model name: Category_Model Method name: get_category_menu() In my routes, I’ve updated the 404 over-ride to: $route[‘404_override’] = ‘whoops’; I’ve also got my controller Whoops that reads… <?php class Whoops extends CI_Controller { function index() { $this->load->model('Category_Model'); $data['Categories'] = $this->Category_Model->get_category_menu(); $data['main_content'] = $this->load->view('messages/whoops', null, true); $this->load->view('includes/template', $data); } } So when I navigate to a page that doesn’t exist, I get the following error… Message: Undefined property: Whoops::$Category_Model Filename: controllers/whoops.php I’ve hard coded the loading of the model into the controller here, even though I have it in my autoload, but no luck. Everything else with the site so far works, just this 404 problem. Any pointers would be great, kinda new to CI so go easy on me. Cheers.

    Read the article

  • Domain model integration using JSON capable DTOs

    - by g-makulik
    I'm a bit confused about architectural choices for the java/web-applications world. The background is I have a system with certain hardware components (that introduce system immanent active behavior) and a configuration database for system meta and HW-components configuration data (these are even usually self contained, since the HW-components persist configuration data anyway). For realization of the configuration/status data exchange protocol with the HW-components we have chosen the Google Protobuf format, which works well for the directly wired communication with these components. Now we want to develop an abstract model (domain model) for those HW-components and I have the feeling that a plain Java class model would fit best for this (c++ implementation seems to have too much implementation/integration overhead with viable language-bridge interfaces). Google Protobuf message definitions could still serve well to describe DTO objects used to interact with a domain model API. But integrating Google Protobuf messages client side for e.g. data binding in the current view doesn't seem to be a good choice. I'm thinking about some extra serialization features, e.g. for JSON based data exchange with the views/controllers. Most lightweight solutions seem to involve a python based presentation layer using JSON based data transfer (I'm at least not sure to be fully informed about this). Is there some lightweight (applicable for a limited ARM Linux platform) framework available, supporting such architecture to realize a web-application?

    Read the article

  • model association or controller?

    - by andybritton
    I'm trying to create a rails app that allows users to submit information about their pets. I've come to a point where my knowledge is limited and I don't know enough about what/how this could be done so I'm hoping this will be relatively easy to answer. At the moment I have a model called Pet, this model currently stores basic information like name, picture etc but it also holds more specific data like type, breed, date of birth etc. What I would like to be able to do is create a page that can match various records without having to be manually categorized if that makes sense so a users pet could be matched to other pets with the same breed, age etc. I've read about nested models as I understand this information could be submitted to 2 models in one form but I am not sure whether this could be done directly in a separate controller which would only be visible to users with pets in these matched "groups" if that makes sense. So in essence is it best practice to use 1 table to store all the information and just use a controller to match pets based on rows having the same values or would it be far simpler to have a form with a nested model and link 2 tables together? The main feature needs to be matching without a user having to create a group or categorize pets so the second model would need to add id's to an array instead of just creating more and more rows.

    Read the article

  • dotRAS Disconnected State not triggered

    - by JD
    Can someone give me a heads up... I'm trying to use the dotRAS .NET control, and this code to change the value of internetConnected (boolean) using an event handler... But it seems that the state RasConnectionState.Disconnected is not triggered by dotRAS hangup().. Any ideas? Am I doing it totally wrong... or have I managed to find a bug? public class USBModem { // private vars private RasDialer dialer = new RasDialer(); private bool internetConnected = false; /// <summary> /// Default constructor for USBModem /// </summary> public USBModem() { // Add Events for dialer dialer.StateChanged += new EventHandler<StateChangedEventArgs>(dialer_StateChanged); } void dialer_StateChanged(object sender, StateChangedEventArgs e) { // Handle state changes here switch (e.State) { case RasConnectionState.Connected: internetConnected = true; Console.WriteLine(e.State.ToString()); break; case RasConnectionState.Disconnected: internetConnected = false; Console.WriteLine(e.State.ToString()); break; default: Console.WriteLine("INFO -> Unhandled state: " + e.State.ToString()); break; } } public void ConnectInternet(string connectionName) { // Dial dialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers); dialer.EntryName = connectionName; dialer.DialAsync(); } public void DisconnectInternet() { foreach (RasConnection connection in dialer.GetActiveConnections()) { connection.HangUp(); } } }

    Read the article

  • How to tell when a Socket has been disconnected

    - by BowserKingKoopa
    On the client side I need to know when/if my socket connection has been broken. However the Socket.Connected property always returns true, even after the server side has been disconnected and I've tried sending data through it. Can anyone help me figure out what's going on here. I need to know when a socket has been disconnected. Socket serverSocket = null; TcpListener listener = new TcpListener(1530); listener.Start(); listener.BeginAcceptSocket(new AsyncCallback(delegate(IAsyncResult result) { Debug.WriteLine("ACCEPTING SOCKET CONNECTION"); TcpListener currentListener = (TcpListener)result.AsyncState; serverSocket = currentListener.EndAcceptSocket(result); }), listener); Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Debug.WriteLine("client socket connected: " + clientSocket.Connected);//should be FALSE, and it is clientSocket.Connect("localhost", 1530); Debug.WriteLine("client socket connected: " + clientSocket.Connected);//should be TRUE, and it is Thread.Sleep(1000); serverSocket.Close();//closing the server socket here Thread.Sleep(1000); clientSocket.Send(new byte[0]);//sending data should cause the socket to update its Connected property. Debug.WriteLine("client socket connected: " + clientSocket.Connected);//should be FALSE, but its always TRUE

    Read the article

  • JSF 2.0: java based custom component + html table + facelets = data model not updated

    - by mikic
    Hi, I'm having problems getting the data model of a HtmlDataTable to be correctly updated by JSF 2.0 and Facelets. I have created a custom Java-based component that extends HtmlDataTable and dynamically adds columns in the encodeBegin method. @Override public void encodeBegin(FacesContext context) throws IOException { if (this.findComponent("c0") == null) { for (int i = 0; i < 3; i++) { HtmlColumn myNewCol = new HtmlColumn(); myNewCol.setId("c" + i); HtmlInputText myNewText = new HtmlInputText(); myNewText.setId("t" + i); myNewText.setValue("#{row[" + i + "]}"); myNewCol.getChildren().add(myNewText); this.getChildren().add(myNewCol); } } super.encodeBegin(context); } My test page contains the following <h:form id="fromtb"> <test:MatrixTest id="tb" var="row" value="#{MyManagedBean.model}"> </test:MatrixTest> <h:commandButton id="btn" value="Set" action="#{MyManagedBean.mergeInput}"/> </h:form> <h:outputText id="mergedInput" value="#{MyManagedBean.mergedInput}"/> My managed bean class contains the following @ManagedBean(name="MyManagedBean") @SessionScoped public class MyManagedBean { private List model = null; private String mergedInput = null; public MyManagedBean() { model = new ArrayList(); List myFirst = new ArrayList(); myFirst.add(""); myFirst.add(""); myFirst.add(""); model.add(myFirst); List mySecond = new ArrayList(); mySecond.add(""); mySecond.add(""); mySecond.add(""); model.add(mySecond); } public String mergeInput() { StringBuffer myMergedInput = new StringBuffer(); for (Object object : model) { myMergedInput.append(object); } setMergedInput(myMergedInput.toString()); return null; } public List getModel() { return model; } public void setModel(List model) { this.model = model; } public String getMergedInput() { return mergedInput; } public void setMergedInput(String mergedInput) { this.mergedInput = mergedInput; } When invoked, the page is correctly rendered with a table made of 3 columns (added at runtime) and 2 rows (as my data model has 2 rows). However when the user enter some data in the input fields and then click the submit button, the model is not correctly updated and therefore the mergeInput() method creates a sequence of empty strings which is rendered on the same page. I have added some logging to the decode() method of my custom component and I can see that the parameters entered by the user are being posted back with the request, however these parameters are not used to update the data model. If I update the encodeBegin() method of my custom component as follow @Override public void encodeBegin(FacesContext context) throws IOException { super.encodeBegin(context); } and I update the test page as follow <test:MatrixTest id="tb" var="row" value="#{MyManagedBean.model}"> <h:column id="c0"><h:inputText id="t0" value="#{row[0]}"/></h:column> <h:column id="c1"><h:inputText id="t1" value="#{row[1]}"/></h:column> <h:column id="c2"><h:inputText id="t2" value="#{row[2]}"/></h:column> </test:MatrixTest> the page is correctly rendered and this time when the user enters data and submits the form, the underlying data model is correctly updated and the mergeInput() method creates a sequence of strings with the user data. Why does the test case with columns declared in the facelet page works correctly (ie the data model is correctly updated by JSF) where the same does not happen when the columns are created at runtime using the encodeBegin() method? Is there any method I need to invoke or interface I need to extend in order to ensure the data model is correctly updated? I am using this test case to address the issue that is appearing in a much more complex component, therefore I can't achieve the same functionality using a facelet composite component. Please note that this has been done using NetBeans 6.8, JRE 1.6.0u18, GlassFish 3.0. Thanks for your help.

    Read the article

  • Refactoring a Single Rails Model with large methods & long join queries trying to do everything

    - by Kelseydh
    I have a working Ruby on Rails Model that I suspect is inefficient, hard to maintain, and full of unnecessary SQL join queries. I want to optimize and refactor this Model (Quiz.rb) to comply with Rails best practices, but I'm not sure how I should do it. The Rails app is a game that has Missions with many Stages. Users complete Stages by answering Questions that have correct or incorrect Answers. When a User tries to complete a stage by answering questions, the User gets a Quiz entry with many Attempts. Each Attempt records an Answer submitted for that Question within the Stage. A user completes a stage or mission by getting every Attempt correct, and their progress is tracked by adding a new entry to the UserMission & UserStage join tables. All of these features work, but unfortunately the Quiz.rb Model has been twisted to handle almost all of it exclusively. The callbacks began at 'Quiz.rb', and because I wasn't sure how to leave the Quiz Model during a multi-model update, I resorted to using Rails Console to have the @quiz instance variable via self.some_method do all the heavy lifting to retrieve every data value for the game's business logic; resulting in large extended join queries that "dance" all around the Database schema. The Quiz.rb Model that Smells: class Quiz < ActiveRecord::Base belongs_to :user has_many :attempts, dependent: :destroy before_save :check_answer before_save :update_user_mission_and_stage accepts_nested_attributes_for :attempts, :reject_if => lambda { |a| a[:answer_id].blank? }, :allow_destroy => true #Checks every answer within each quiz, adding +1 for each correct answer #within a stage quiz, and -1 for each incorrect answer def check_answer stage_score = 0 self.attempts.each do |attempt| if attempt.answer.correct? == true stage_score += 1 elsif attempt.answer.correct == false stage_score - 1 end end stage_score end def winner return true end def update_user_mission_and_stage ####### #Step 1: Checks if UserMission exists, finds or creates one. #if no UserMission for the current mission exists, creates a new UserMission if self.user_has_mission? == false @user_mission = UserMission.new(user_id: self.user.id, mission_id: self.current_stage.mission_id, available: true) @user_mission.save else @user_mission = self.find_user_mission end ####### #Step 2: Checks if current UserStage exists, stops if true to prevent duplicate entry if self.user_has_stage? @user_mission.save return true else ####### ##Step 3: if step 2 returns false: ##Initiates UserStage creation instructions #checks for winner (winner actions need to be defined) if they complete last stage of last mission for a given orientation if self.passed? && self.is_last_stage? && self.is_last_mission? create_user_stage_and_update_user_mission self.winner #NOTE: The rest are the same, but specify conditions that are available to add badges or other actions upon those conditions occurring: ##if user completes first stage of a mission elsif self.passed? && self.is_first_stage? && self.is_first_mission? create_user_stage_and_update_user_mission #creates user badge for finishing first stage of first mission self.user.add_badge(5) self.user.activity_logs.create(description: "granted first-stage badge", type_event: "badge", value: "first-stage") #If user completes last stage of a given mission, creates a new UserMission elsif self.passed? && self.is_last_stage? && self.is_first_mission? create_user_stage_and_update_user_mission #creates user badge for finishing first mission self.user.add_badge(6) self.user.activity_logs.create(description: "granted first-mission badge", type_event: "badge", value: "first-mission") elsif self.passed? create_user_stage_and_update_user_mission else self.passed? == false return true end end end #Creates a new UserStage record in the database for a successful Quiz question passing def create_user_stage_and_update_user_mission @nu_stage = @user_mission.user_stages.new(user_id: self.user.id, stage_id: self.current_stage.id) @nu_stage.save @user_mission.save self.user.add_points(50) end #Boolean that defines passing a stage as answering every question in that stage correct def passed? self.check_answer >= self.number_of_questions end #Returns the number of questions asked for that stage's quiz def number_of_questions self.attempts.first.answer.question.stage.questions.count end #Returns the current_stage for the Quiz, routing through 1st attempt in that Quiz def current_stage self.attempts.first.answer.question.stage end #Gives back the position of the stage relative to its mission. def stage_position self.attempts.first.answer.question.stage.position end #will find the user_mission for the current user and stage if it exists def find_user_mission self.user.user_missions.find_by_mission_id(self.current_stage.mission_id) end #Returns true if quiz was for the last stage within that mission #helpful for triggering actions related to a user completing a mission def is_last_stage? self.stage_position == self.current_stage.mission.stages.last.position end #Returns true if quiz was for the first stage within that mission #helpful for triggering actions related to a user completing a mission def is_first_stage? self.stage_position == self.current_stage.mission.stages_ordered.first.position end #Returns true if current user has a UserMission for the current stage def user_has_mission? self.user.missions.ids.include?(self.current_stage.mission.id) end #Returns true if current user has a UserStage for the current stage def user_has_stage? self.user.stages.include?(self.current_stage) end #Returns true if current user is on the last mission based on position within a given orientation def is_first_mission? self.user.missions.first.orientation.missions.by_position.first.position == self.current_stage.mission.position end #Returns true if current user is on the first stage & mission of a given orientation def is_last_mission? self.user.missions.first.orientation.missions.by_position.last.position == self.current_stage.mission.position end end My Question Currently my Rails server takes roughly 500ms to 1 sec to process single @quiz.save action. I am confident that the slowness here is due to sloppy code, not bad Database ERD design. What does a better solution look like? And specifically: Should I use join queries to retrieve values like I did here, or is it better to instantiate new objects within the model instead? Or am I missing a better solution? How should update_user_mission_and_stage be refactored to follow best practices? Relevant Code for Reference: quizzes_controller.rb w/ Controller Route Initiating Callback: class QuizzesController < ApplicationController before_action :find_stage_and_mission before_action :find_orientation before_action :find_question def show end def create @user = current_user @quiz = current_user.quizzes.new(quiz_params) if @quiz.save if @quiz.passed? if @mission.next_mission.nil? && @stage.next_stage.nil? redirect_to root_path, notice: "Congratulations, you have finished the last mission!" elsif @stage.next_stage.nil? redirect_to [@mission.next_mission, @mission.first_stage], notice: "Correct! Time for Mission #{@mission.next_mission.position}", info: "Starting next mission" else redirect_to [@mission, @stage.next_stage], notice: "Answer Correct! You passed the stage!" end else redirect_to [@mission, @stage], alert: "You didn't get every question right, please try again." end else redirect_to [@mission, @stage], alert: "Sorry. We were unable to save your answer. Please contact the admministrator." end @questions = @stage.questions.all end private def find_stage_and_mission @stage = Stage.find(params[:stage_id]) @mission = @stage.mission end def find_question @question = @stage.questions.find_by_id params[:id] end def quiz_params params.require(:quiz).permit(:user_id, :attempt_id, {attempts_attributes: [:id, :quiz_id, :answer_id]}) end def find_orientation @orientation = @mission.orientation @missions = @orientation.missions.by_position end end Overview of Relevant ERD Database Relationships: Mission - Stage - Question - Answer - Attempt <- Quiz <- User Mission - UserMission <- User Stage - UserStage <- User Other Models: Mission.rb class Mission < ActiveRecord::Base belongs_to :orientation has_many :stages has_many :user_missions, dependent: :destroy has_many :users, through: :user_missions #SCOPES scope :by_position, -> {order(position: :asc)} def stages_ordered stages.order(:position) end def next_mission self.orientation.missions.find_by_position(self.position.next) end def first_stage next_mission.stages_ordered.first end end Stage.rb: class Stage < ActiveRecord::Base belongs_to :mission has_many :questions, dependent: :destroy has_many :user_stages, dependent: :destroy has_many :users, through: :user_stages accepts_nested_attributes_for :questions, reject_if: :all_blank, allow_destroy: true def next_stage self.mission.stages.find_by_position(self.position.next) end end Question.rb class Question < ActiveRecord::Base belongs_to :stage has_many :answers, dependent: :destroy accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:body].blank? }, :allow_destroy => true end Answer.rb: class Answer < ActiveRecord::Base belongs_to :question has_many :attempts, dependent: :destroy end Attempt.rb: class Attempt < ActiveRecord::Base belongs_to :answer belongs_to :quiz end User.rb: class User < ActiveRecord::Base belongs_to :school has_many :activity_logs has_many :user_missions, dependent: :destroy has_many :missions, through: :user_missions has_many :user_stages, dependent: :destroy has_many :stages, through: :user_stages has_many :orientations, through: :school has_many :quizzes, dependent: :destroy has_many :attempts, through: :quizzes def latest_stage_position self.user_missions.last.user_stages.last.stage.position end end UserMission.rb class UserMission < ActiveRecord::Base belongs_to :user belongs_to :mission has_many :user_stages, dependent: :destroy end UserStage.rb class UserStage < ActiveRecord::Base belongs_to :user belongs_to :stage belongs_to :user_mission end

    Read the article

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