Search Results

Search found 276 results on 12 pages for 'p campbell'.

Page 10/12 | < Previous Page | 6 7 8 9 10 11 12  | Next Page >

  • How do I correctly Re-render a Recaptcha in ASP.NET MVC 2 after an AJAX POST

    - by Eoin Campbell
    Ok... I've downloaded and implemented this Recaptcha implementation for MVC which uses the ModelState to confirm the validity of the captcha control. It works brilliantly... except when I start to use it in an AJAX Form. In a nutshell, when a div is re-rendered with AJAX, the ReCaptcha that it should contain does not appear, even though the relevant <scripts> are in the source after the partial render. Code Below. using (Ajax.BeginForm("CreateComment", "Blog", new AjaxOptions() { HttpMethod = "POST", UpdateTargetId = "CommentAdd", OnComplete="ReloadRecaptcha", OnSuccess = "ShowComment", OnFailure = "ShowComment", OnBegin = "HideComment" })) {%> <fieldset class="comment"> <legend>Add New Comment</legend> <%= Html.ValidationSummary()%> <table class="postdetails"> <tbody> <tr> <td rowspan="3" id="blahCaptcha"> <%= Html.CreateRecaptcha("recaptcha", "blackglass") %> </td> .... Remainder of Form Omitted for Brevity I've confirmed the Form is perfectly functional when the Recaptcha Control is not present and the Javascript calls in the AjaxOptions are all working fine. The problem is that if the ModelState is Invalid as a result of the Recaptcha or some other validation, then the ActionResult returns the View to reshow the form. [RecaptchaFilter(IgnoreOnMobile = true)] [HttpPost] public ActionResult CreateComment(Comment c) { if (ModelState.IsValid) { try { //Code to insert Comment To DB return Content("Thank You"); } catch { ModelState.AddRuleViolations(c.GetRuleViolations()); } } else { ModelState.AddRuleViolations(c.GetRuleViolations()); } return View("CreateComment", c); } When it's InValid and the form posts back, for some reason the ReCaptcha Control does not re-render. I've checked the source and the <script> & <noscript> blocks are present in the HTML so the HTML Helper function below is obviously working <%= Html.CreateRecaptcha("recaptcha", "blackglass") %> I assume this has something to do with scripts injected into the DOM by AJAX are not re-executed. As you can see from the HTML snippet above, I've tried to add an OnComplete= javascript function to re-create the Captcha on the client side, but although the script executes with no errors, it doesn't work. OnComplete Function is. function ReloadRecaptcha() { Recaptcha.create("my-pub-key", 'blahCaptcha', { //blahCaptcha is the ID of the <td> where the ReCaptcha should go. theme: 'blackglass' }); } Can anyone shed any light on this ? Thanks, Eoin C

    Read the article

  • MySQL Interview Questions

    - by Campbell
    Hi, I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set. I myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is there anything specific I should be asking with regards to MySQL? I would ideally like to ask them about enterprise level features of MySQL that they would typically only use when working on a big database. Need to separate out the enterprise developers from the home / small website kind of guys. Thanks.

    Read the article

  • RhinoMocks AAA Syntax

    - by Bill Campbell
    Hi, I've spent a good part of the day trying to figure out why a simple RhinoMocks test doesn't return the value I'm setting in the return. I'm sure that I'm just missing something really simple but I can't figure it out. Here's my test: [TestMethod] public void CopyvRAFiles_ShouldCallCopyvRAFiles_ShouldReturnTrue2() { FileInfo fi = new FileInfo(@"c:\Myprogram.txt"); FileInfo[] myFileInfo = new FileInfo[2]; myFileInfo[0] = fi; myFileInfo[1] = fi; var mockSystemIO = MockRepository.GenerateMock<ISystemIO>(); mockSystemIO.Stub(x => x.GetFilesForCopy("c:")).Return(myFileInfo); mockSystemIO.Expect(y => y.FileCopyDateCheck(@"c:\Myprogram.txt", @"c:\Myprogram.txt")).Return("Test"); CopyFiles copy = new CopyFiles(mockSystemIO); List<string> retValue = copy.CopyvRAFiles("c:", "c:", new AdminWindowViewModel(vRASharedData)); mockSystemIO.VerifyAllExpectations(); } I have an interface for my SystemIO class I'm passing in a mock for that to my CopyFiles class. I'm setting an expectation on my FileCopyDatCheck method and saying that it should Return("Test"). When I step through the code, it returns a null insteaed. Any ideas what I'm missing here? Here's my CopyFiles class Method: public List<string> CopyvRAFiles(string currentDirectoryPath, string destPath, AdminWindowViewModel adminWindowViewModel) { string fileCopied; List<string> filesCopied = new List<string>(); try { sysIO.CreateDirectoryIfNotExist(destPath); FileInfo[] files = sysIO.GetFilesForCopy(currentDirectoryPath); if (files != null) { foreach (FileInfo file in files) { fileCopied = sysIO.FileCopyDateCheck(file.FullName, destPath + file.Name); filesCopied.Add(fileCopied); } } //adminWindowViewModel.CheckFilesThatRequireSystemUpdate(filesCopied); return filesCopied; } catch (Exception ex) { ExceptionPolicy.HandleException(ex, "vRAClientPolicy"); Console.WriteLine("{0} Exception caught.", ex); ShowErrorMessageDialog(ex); return null; } } I would think that "fileCopied" would have the Return value set by the Expect. The GetFilesForCopy returns the two files in myFileInfo. Please Help. :) thanks in advance!

    Read the article

  • How to tell if Microsoft Works is 32 or 64 bit? Please Help!

    - by Bill Campbell
    Hi, I am trying to convert one of our apps to run on Win7 64 bit from XP 32 bit. One of the things that it uses is Excel to import files. It's a little complicated since it was using Microsoft.Jet.OLEDB.4.0 (Excel). I found Office 14 (2010) has a 64bit version I can download. I downloaded Office 2010 Beta but it didn't seem to install Microsoft.ACE.OLEDB.14.0. I found that I could download 2010 Office System Driver Beta: Data Connectivity Components which has the ACE.OLEDB.14 in it but when I try to install it, the installed tells me "You cannot install the 64-bit version of Access Database engine for Microsoft Office 2010 because you currently have 32-bit Office products installed". How do I determine what 32bit office products this is reffering to? My Dell came with Microsoft Works installed. I don't know if this is 32 or 64 bit. Is there anyway to tell? I don't want to uninstall this if it's not the problem and I'm not sure what else might be the problem. Any help would be appreciated! thanks, Bill

    Read the article

  • Can rpmbuild ingore files in buildroot?

    - by Noah Campbell
    I have a target directory that is checked into svn. I use the target as the --buildroot when I run rpmbuild. This causes rpmbuild to loose it mind because of the .svn directories in each directory. Is there a way to tell rpmbuild to relax? I looked at svn export target target-build, but it only knows about files tracked by rpm. Perhaps not a bad way to do it, but I'm not quite sure that is the best way.

    Read the article

  • Is there a suggested solution structure for ASP.NET MVC Production Apps

    - by Eoin Campbell
    In general, I don't like to keep code (BaseClasses or DataAccess Code) in the App_Code directory of an ASP.NET Site. I'll usually pull this stuff out into a MySite.BusinessLogic & MySite.DataAccess DLL's respectively. I'm wondering should I be doing the same for ASP.NET MVC. Would it be better to Organise the solution something along the lines of MySite.Common - DLL - (Basic Functionality built on .NET System Dlls) MySite.DAL - DLL - (DataAccessLayer & DBML Files) MySite.Models - DLL - (MVC Models e.g. Repository Classes) MySite.Controllers - DLL (MVC Controllers which use Models) MySite - ASP.NET MVC Site. Or am I missing something... presumably, I'll lose some of the nice (Add View, Go To Controller, context menu items that have been added)

    Read the article

  • LINQ OrderBy: best search results at top of results list

    - by p.campbell
    Consider the need to search a list of Customer by both first and last names. The desire is to have the results list sorted by the Customer with the most matches in the search terms. FirstName LastName ---------- --------- Foo Laurie Bar Jackson Jackson Bro Laurie Foo Jackson Laurie string[] searchTerms = new string[] {"Jackson", "Laurie"}; //want to find those customers with first, last or BOTH names in the searchTerms var matchingCusts = Customers .Where(m => searchTerms.Contains(m.FirstName) || searchTerms.Contains(m.LastName)) .ToList(); /* Want to sort for those results with BOTH FirstName and LastName matching in the search terms. Those that match on both First and Last should be at the top of the results, the rest who match on one property should be below. */ return matchingCusts.OrderBy(m=>m); Desired Sort: Jackson Laurie (matches on both properties) Foo Laurie Bar Jackson Jackson Bro Laurie Foo How can I achieve this desired functionality with LINQ and OrderBy / OrderByDescending?

    Read the article

  • WPF TextBlock Binding to DependencyProperty

    - by Bill Campbell
    Hi, I have what I believe to be about one of the most simple cases of attempting to bind a view to a dependencyproperty in the view model. It seems that the initial changes are reflected in the view but other changes to the DP do not update the view's TextBlock. I'm probably just missing something simple but I just can't see what it is. Please take a look... My XAML has a status bar on the bottom of the window. I want to bind to the DP "VRAStatus". <StatusBar x:Name="sbar" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Background="LightBlue" Opacity="0.4" DockPanel.Dock="Bottom" > <StatusBarItem> <TextBlock x:Name="statusBar" Text="{Binding VRAStatus}" /> </StatusBarItem> <StatusBarItem> <Separator Style="{StaticResource StatusBarSeparatorStyle}"/> </StatusBarItem> </StatusBar> My viewmodel has the DP defined: public string VRAStatus { get { return (string)GetValue(VRAStatusProperty); } set { SetValue(VRAStatusProperty, value); } } // Using a DependencyProperty as the backing store for VRAStatus. public static readonly DependencyProperty VRAStatusProperty = DependencyProperty.Register("VRAStatus", typeof(string), typeof(PenskeRouteAssistViewModel),new PropertyMetadata(string.Empty)); Then, in my code I set the DP: VRAStatus = "Test Message..."; Is there something obvious here that I am missing? In my constructor for the viewmodel I set the DP like this: VRAStatus = "Ready"; I never get the Test Message to display. Please Help. thanks in advance! Bill

    Read the article

  • What is the suggested approach to Syncing/Backing up/Restoring from SQL Server 2008 to SQL Server 20

    - by Eoin Campbell
    I only have SQL Server 2008 (Dev Edition) on my development machine I only have SQL Server 2005 available with my hosting company (and I don't have direct connection access to this database) I'm just wondering what the best approach is for: Getting the initlal DB Structure & Data into production. And keeping any structural changes/data changes in sync in future. As far as I can see... Replication - not an option cos I can't connect to the production DB. Restoring a backup - not an option because as far as I can see, you cannot export a DB from 2008 that is restorable in 2005 (even with the 2008 DB set in 2005 compatibility mode) and it wouldn't make sense to be restoring production over the top of my dev version anyway. Dump all the scripts from my 2008 Database, Revert my Dev to machine from 2008 - 2005, and recreate the database from the scripts, then just use backup & restore to get the initial DB into production, then run scripts through the web panel from that point onwards Dump all the scripts from my 2008 Database and generate the entire 2005 db from scripts in production. then run scripts through the web panel from that point onwards With the last 2 options, I'd probably need to script all the data inserts as well using some tool (which I presume exists on the web) Are there any other possibile solutions that I'm not considering.

    Read the article

  • What's a good way of building up a String given specific start and end locations?

    - by Michael Campbell
    (java 1.5) I have a need to build up a String, in pieces. I'm given a set of (sub)strings, each with a start and end point of where they belong in the final string. Was wondering if there were some canonical way of doing this. This isn't homework, and I can use any licensable OSS, such as jakarta commons-lang StringUtils etc. My company has a solution using a CharBuffer, and I'm content to leave it as is (and add some unit tests, of which there are none (?!)) but the code is fairly hideous and I would like something easier to read. As I said this isn't homework, and I don't need a complete solution, just some pointers to libraries or java classes that might give me some insight. The String.Format didn't seem QUITE right... I would have to honor inputs too long and too short, etc. Substrings would be overlaid in the order they appear (in case of overlap). As an example of input, I might have something like: String:start:end FO:0:3 (string shorter than field) BAR:4:5 (String larger than field) BLEH:5:9 (String overlays previous field) I'd want to end up with FO BBLEH 01234567890

    Read the article

  • What's a good way of building up a String where you specific start and end locations?

    - by Michael Campbell
    (java 1.5) I have a need to build up a String, in pieces. I'm given a set of (sub)strings, each with a start and end point of where they belong in the final string. Was wondering if there were some canonical way of doing this. This isn't homework, and I can use any licensable OSS, such as jakarta commons-lang StringUtils etc. My company has a solution using a CharBuffer, and I'm content to leave it as is (and add some unit tests, of which there are none (?!)) but the code is fairly hideous and I would like something easier to read. As I said this isn't homework, and I don't need a complete solution, just some pointers to libraries or java classes that might give me some insight. The String.Format didn't seem QUITE right... I would have to honor inputs too long and too short, etc. Substrings would be overlaid in the order they appear (in case of overlap). As an example of input, I might have something like: String:start:end FO:0:3 (string shorter than field) BAR:4:5 (String larger than field) BLEH:5:9 (String overlays previous field) I'd want to end up with FO BBLEH 01234567890

    Read the article

  • Visual Studio 2008: Can't connect to known good TFS 2010 beta 2

    - by p.campbell
    A freshly installed TFS 2010 Beta 2 is at http://serverX:8080/tfs. A Windows 7 developer machine with VS 2008 Pro SP1 and the VS2008 Team Explorer (no SP). The TFS 2008 Service Pack 1 didn't work for me - "None of the products that are addressed by this software update are installed on this computer." The developer machine is able to browse the TFS site at the above URL. The Issue is around trying to add the TFS server into the Team Explorer window in Visual Studio 2008. Here's a screenshot showing the error: unable to connect to this Team Foundation Server. Possible reasons for failure include: The Team Foundation Server name, port number or protocol is incorrect. The Team Foundation Server is offline. Password is expired or incorrect. The TFS server is up and running properly. Firewall ports are open, and is accessible via the browser on the dev machine!! larger image Question: how can you connect from VS 2008 Pro to a TFS 2010 Beta 2 server? Resolution Here's how I solved this problem: installed VS 2008 Team Explorer as above. re-install VS 2008 Service Pack 1 when adding a TFS server to Team Explorer, you MUST specify the URL as such: http://[tfsserver]:[port]/[vdir]/[projectCollection] in my case above, it was http://serverX:8080/tfs/AppDev-TestProject you cannot simply add the TFS server name and have VS look for all Project Collections on the server. TFS 2010 has a new URL (by default) and VS 2008 doesn't recognize how to gather that list.

    Read the article

  • Is it possible to create a new T-SQL Operator using CLR Code in SQL Server?

    - by Eoin Campbell
    I have a very simple CLR Function for doing Regex Matching public static SqlBoolean RegExMatch(SqlString input, SqlString pattern) { if (input.IsNull || pattern.IsNull) return SqlBoolean.False; return Regex.IsMatch(input.Value, pattern.Value, RegexOptions.IgnoreCase); } It allows me to write a SQL Statement Like. SELECT * FROM dbo.table1 WHERE dbo.RegexMatch(column1, '[0-9][A-Z]') = 1 -- match entries in col1 like 1A, 2B etc... I'm just thinking it would be nice to reformulate that query so it could be called like SELECT * FROM dbo.table1 WHERE column1 REGEXLIKE '[0-9][A-Z]' Is it possible to create new comparison operators using CLR Code. (I'm guessing from my brief glance around the web that the answer is NO, but no harm asking)

    Read the article

  • Is it possible to create a new T-SQL Operator using CLR Code in MSSQL?

    - by Eoin Campbell
    I have a very simple CLR Function for doing Regex Matching public static SqlBoolean RegExMatch(SqlString input, SqlString pattern) { if (input.IsNull || pattern.IsNull) return SqlBoolean.False; return Regex.IsMatch(input.Value, pattern.Value, RegexOptions.IgnoreCase); } It allows me to write a SQL Statement Like. SELECT * FROM dbo.table1 WHERE dbo.RegexMatch(column1, '[0-9][A-Z]') = 1 -- match entries in col1 like 1A, 2B etc... I'm just thinking it would be nice to reformulate that query so it could be called like SELECT * FROM dbo.table1 WHERE column1 REGEXLIKE '[0-9][A-Z]' Is it possible to create new comparison operators using CLR Code. (I'm guessing from my brief glance around the web that the answer is NO, but no harm asking) Thanks, Eoin C

    Read the article

  • How to read in Excel file in Win7 64bit?

    - by Bill Campbell
    Hi, I have a c# application that I have moved to a 64bit machine. This application reads in an Excel file for some data input. I would like to build this project as 64bit. Is there any way to have my program read in this file? I find it hard to believe that there is no way to use and Excel file as input into a 64bit app. I have installed Office 2010 64 bit as well as the 2010 Office System Driver Beta: Data Connectivity Components with no luck. I'm sure that I'm just missing something really simple. thanks!! Bill

    Read the article

  • runtime loading of ValidateAntiForgeryToken Salt value

    - by p.campbell
    Consider an ASP.NET MVC application using the Salt parameter in the [ValidateAntiForgeryToken] directive. The scenario is such that the app will be used by many customers. It's not terribly desirable to have the Salt known at compile time. The current strategy is to locate the Salt value in the web.config. [ValidateAntiForgeryToken(Salt = Config.AppSalt)] //Config.AppSalt is a static property that reads the web.config. This leads to a compile-time exception suggesting that the Salt must be a const at compile time. An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type How can I modify the application to allow for a runtime loading of the Salt so that the app doesn't have to be re-salted and recompiled for each customer? Consider that the Salt won't change frequently, if at all, thereby removing the possibility of invalidating form

    Read the article

  • Why is this attempt at a binary search crashing?

    - by Ian Campbell
    I am fairly new to the concept of a binary search, and am trying to write a program that does this in Java for personal practice. I understand the concept of this well, but my code is not working. There is a run-time exception happening in my code that just caused Eclipse, and then my computer, to crash... there are no compile-time errors here though. Here is what I have so far: public class BinarySearch { // instance variables int[] arr; int iterations; // constructor public BinarySearch(int[] arr) { this.arr = arr; iterations = 0; } // instance method public int findTarget(int targ, int[] sorted) { int firstIndex = 1; int lastIndex = sorted.length; int middleIndex = (firstIndex + lastIndex) / 2; int result = sorted[middleIndex - 1]; while(result != targ) { if(result > targ) { firstIndex = middleIndex + 1; middleIndex = (firstIndex + lastIndex) / 2; result = sorted[middleIndex - 1]; iterations++; } else { lastIndex = middleIndex + 1; middleIndex = (firstIndex + lastIndex) / 2; result = sorted[middleIndex - 1]; iterations++; } } return result; } // main method public static void main(String[] args) { int[] sortedArr = new int[] { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29 }; BinarySearch obj = new BinarySearch(sortedArr); int target = sortedArr[8]; int result = obj.findTarget(target, sortedArr); System.out.println("The original target was -- " + target + ".\n" + "The result found was -- " + result + ".\n" + "This took " + obj.iterations + " iterations to find."); } // end of main method } // end of class BinarySearch

    Read the article

  • Forcing WCF proxy to generate an alias prefix

    - by Sean Campbell
    To comply with a clients schema, I've been attempting to generate a WCF client proxy capable of serializing down to a structure with a root node that looks like the following: <quote:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:quote="https://foo.com/services/schema/1.2/car_quote"> After some reading, I've had luck in updating the proxy to include the required 'quote' namespace through the use of XmlNameSpaceDeclarations and XmlSerializerNamespaces [System.SerializableAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class request { [XmlNamespaceDeclarations()] public XmlSerializerNamespaces xmlsn { get { XmlSerializerNamespaces xsn = new XmlSerializerNamespaces(); xsn.Add("quote", "https://foo.com/services/schema/1.2/car_quote"); return xsn; } set { //Just provide an empty setter. } } ... which delivers: <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:quote="https://foo.com/services/schema/1.2/car_quote"> however I'm stumped as to how to generate the quote:request element. Environment: ASP.NET 3.5 Thanks

    Read the article

  • Commercial web application--scalable database design

    - by Rob Campbell
    I'm designing a set of web apps to track scientific laboratory data. Each laboratory has several members, each of whom will access both their own data and that of their laboratory as a whole. Many typical queries will thus be expected to return records of multiple members (e.g. my mouse, joe's mouse and sally's mouse). I think I have the database fairly well normalized. I'm now wondering how to ensure that users can efficiently access both their own data and their lab's data set when it is mixed among (hopefully) a whole ton of records from other labs. What I've come up with so far is that most tables will end with two fields: user_id and labgroup_id. The WHERE clause of any SELECT statement will include the appropriate reference to one of the id fields ("...WHERE 'labroup_id=n..." or "...WHERE user_id=n..."). My questions are: Is this an approach that will scale to 10^6 or more records? If so, what's the best way to use these fields in a query so that it most efficiently searches the relevant subset of the database? e.g. Should the first step in querying be to create a temporary table containing just the labgroup's data? Or will indexing using some combination of the id, user_id, and labroup_id fields be sufficient at that scale? I thank any responders very much in advance.

    Read the article

  • How to use LINQ to query list of strings that do not contain substring entries from another list

    - by p.campbell
    string candidates = new string[] { "Luke_jedi", "Force_unknown", "Vader_jedi" , "Emperor_human", "r2d2_robot" }; string[] disregard = new string[] {"_robot", "_jedi"}; //find those that aren't jedi or robots. var nonJedi = candidates.Where(c=> c.??? //likely using EndsWith() and Any() ); How would you implement this solution using LINQ to find all those that do not end with any of the disregards items?

    Read the article

  • Override Maven's default resource filter replacement pattern.

    - by Matt Campbell
    By default maven will filter resources like this: <properties> <replace.me>value</replace.me> </properties> <some-tag> <key>${replace.me}</key> </some-tag> will get you: <some-tag> <key>value</key> </some-tag> Is there a way to override the way maven selects the strings to replace? Specifically, I want to be able to use this: <some-tag> <key>@replace.me@</key> </some-tag> to get the same result as above.

    Read the article

  • How long until programming becomes a professionally certified (and respected as such) skill such as

    - by Michael Campbell
    Given Toyota's recent issues and the ENORMOUS amount of safety that is being relegated to computers, how long do you think it will be before programming, or perhaps programming certain things (embedded transportation software, (air) traffic control, electrical grid, hospital equipment, nuclear plant security, planes, etc.) becomes regulated? And/or, how long before there will be certain regulated certifications before you can call yourself a "software developer", like Architects and Engineers have now? (NB: I'm from the US, so I don't know how it works in other countries; please forgive my ignornace.)

    Read the article

  • designing an ASP.NET MVC partial view - showing user choices within a large set of choices

    - by p.campbell
    Consider a partial view whose job is to render markup for a pizza order. The desire is to reuse this partial view in the Create, Details, and Update views. It will always be passed an IEnumerable<Topping>, and output a multitude of checkboxes. There are lots... maybe 40 in all (yes, that might smell). A-OK so far. Problem The question is around how to include the user's choices on the Details and Update views. From the datastore, we've got a List<ChosenTopping>. The goal is to have each checkbox set to true for each chosen topping. What's the easiest to read, or most maintainable way to achieve this? Potential Solutions Create a ViewModel with the List and List. Write out the checkboxes as per normal. While writing each, check whether the ToppingID exists in the list of ChosenTopping. Create a new ViewModel that's a hybrid of both. Perhaps call it DisplayTopping or similar. It would have property ID, Name and IsUserChosen. The respective controller methods for Create, Update, and Details would have to create this new collection with respect to the user's choices as they see fit. The Create controller method would basically set all to false so that it appears to be a blank slate. The real application isn't pizza, and the organization is a bit different from the fakeshot, but the concept is the same. Is it wise to reuse the control for the 3 different scenarios? How better can you display the list of options + the user's current choices? Would you use jQuery instead to show the user selections? Any other thoughts on the potential smell of splashing up a whole bunch of checkboxes?

    Read the article

  • Strange Java Socket Behavior (Connects, but Doesn't Send)

    - by Donald Campbell
    I have a fairly complex project that boils down to a simple Client / Server communicating through object streams. Everything works flawlessly for two consecutive connections (I connect once, work, disconnect, then connect again, work, and disconnect). The client connects, does its business, and then closes. The server successfully closes both the object output stream and the socket, with no IO errors. When I try to connect a third time, the connection appears to go through (the ServerSocket.accept() method goes through and an ObjectOutputStream is successfully created). No data is passed, however. The inputStream.readUnshared() method simply blocks. I have taken the following memory precautions: When it comes time to close the sockets, all running threads are stopped, and all objects are nulled out. After every writeUnshared() method call, the ObjectOutputBuffer is flushed and reset. Has anyone encountered a similar problem, or does anyone have any suggestions? I'm afraid my project is rather large, and so copying code is problematic. The project boils down to this: SERVER MAIN ServerSocket serverSocket = new ServerSocket(port); while (true) { new WorkThread(serverSocket.accept()).start(); } WORK THREAD (SERVER) public void run() { ObjectInputBuffer inputBuffer = new ObjectInputBuffer(new BufferedInputStream(socket.getInputStream())); while (running) { try { Object myObject = inputBuffer.readUnshared(); // do work is not specified in this sample doWork(myObject); } catch (IOException e) { running = false; } } try { inputBuffer.close(); socket.close(); } catch (Exception e) { System.out.println("Could not close."); } } CLIENT public Client() { Object myObject; Socket mySocket = new Socket(address, port); try { ObjectOutputBuffer output = new ObjectOutputBuffer(new BufferedOutputStream(mySocket.getOutputStream())); output.reset(); output.flush(); } catch (Exception e) { System.out.println("Could not get an input."); mySocket.close(); return; } // get object data is not specified in this sample. it simply returns a serializable object myObject = getObjectData(); while (myObject != null) { try { output.writeUnshared(myObject); output.reset(); output.flush(); } catch (Exception e) { e.printStackTrace(); break; } // catch } // while try { output.close(); socket.close(); } catch (Exception e) { System.out.println("Could not close."); } } Thank you to everyone who may be able to help!

    Read the article

  • What's a good way to encrypt data using an asymmetric key, that's available to both java and ruby?

    - by Michael Campbell
    I have a customer that wants to encrypt some data in his database (not passwords; this needs actual encryption, not hashing). The application which will be doing the encrypting/writing is in Java, but the process which will DECRYPT it is behind a secure firewall, and is written in ruby. The idea was to use a public/private key scheme; the java system would encrypt it with the public key, then the process on his local box would use the private key to decrypt it as needed. I'm looking for any experience anyone has doing something like that; my main question is what sorts of libraries on java and ruby can interoperate with the same keys and data.

    Read the article

< Previous Page | 6 7 8 9 10 11 12  | Next Page >