Search Results

Search found 9366 results on 375 pages for 'common lisp'.

Page 27/375 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • FTPing a file to Mainframe using Java, Apache Common Net

    - by SKR
    I'm am trying to upload a file into mainframe server using FTP. My code is below FTPClient client = new FTPClient(); InputStream in = null; FileInputStream fis = null; try{ client.connect("10.10.23.23"); client.login("user1", "pass123"); client.setFileType(FTPClient.BINARY_FILE_TYPE); int reply ; reply = client.getReplyCode(); System.out.println("Reply Code:"+reply); if(FTPReply.isPositiveCompletion(reply)){ System.out.println("Positive reply"); String filename ="D:\\FILE.txt"; in = new FileInputStream(filename); client.storeFile("FILE.TXT", in); client.logout(); fis.close(); }else{ System.out.println("Negative reply"); } }catch(final Throwable t){ t.printStackTrace(); } The code gets struck in client.storeFile("FILE.TXT", in); I am unable to debug. Please suggest ways / solutions.

    Read the article

  • multiple classes with same methods - best pattern

    - by Tony
    I have a few classes in my current project where validation of Email/Website addresses is necessary. The methods to do that are all the same. I wondered what's the best way to implement this, so I don't need to have these methods copy pasted everywhere? The classes themselves are not necessarily related, they only have those validation methods in common.

    Read the article

  • Common utility functions for Perl .t tests

    - by zedoo
    Hi I am getting started with Test::More, already have a few .t test scripts. Now I'd like to define a function that will only be used for the tests, but accross different .t files. Where's the best place to put such a function? Define another .t without any tests and require it where needed? (As a sidenote I use the module structure created by Module::Starter)

    Read the article

  • Longest Common Subsequence

    - by tsudot
    Consider 2 sequences X[1..m] and Y[1..n]. The memoization algorithm would compute the LCS in time O(m*n). Is there any better algorithm to find out LCS wrt time? I guess memoization done diagonally can give us O(min(m,n)) time complexity.

    Read the article

  • what is common GIS method?

    - by smile
    hello every one I want to know what is the main methods that used in GIS to connect between the location and their information (spatial access methodes) SAM. I read in some web sites two methods are: vector raster is that methods related what I want??? thank you ^_^

    Read the article

  • Common, reusable iPhone-App configuration screen

    - by Janey
    I'm writing code that will allow my iphone-app to have a "configuration page". A grouped, scrolling, UITableView... with cells that contain the needed textFields, switches, sliders, etc. It is an ENOURMOUS amount of code. Is there an easier way? Is there a way I could create a simple text-file, contain all my desired design choices and have my (reusable) code build the TableView for me? Or... can I just do the whole thing quicker/easier in Interface Builder instead of code?

    Read the article

  • Finding out the common / uncommon elements between two Arrays in PHP

    - by Veera
    Consider I have two arrays: $friends = Array('foo', 'bar', 'alpha'); $attendees = Array('foo', 'bar'); Now I need to populate a new array $nonattendees which contains only the elements which are in $friends array and not in $attendees array. i.e, $nonattendees array should be populated with 'alpha'. Is there any in built array operation available in PHP to achieve the above functionality or should I write my own for loops?

    Read the article

  • EF4: common interface for EF entities

    - by Feryt
    Hi. I have public interface: public interface IEntity { int ID { get; set; } string Name { get; set; } bool IsEnabled { get; set; } } ehich some EF entities implements(thanks to partial class) and extesion method: public static IEnumerable<SelectListItem> ToSelectListItems<T>(this IQueryable<T> entities, int? selectedID = null) where T : IEntity { return entities.Select(c => new { c.Name, c.ID }).ToList().Select(c => new SelectListItem { Text = c.Name, Value = c.ID.ToString(), Selected = (c.ID == selectedID) }); } Calling ToSelectListItems return exception: Unable to cast the type '<EF entity name>' to type 'IEntity'. LINQ to Entities only supports casting Entity Data Model primitive types. Why, any ideas? Thank you.

    Read the article

  • How do common web frameworks (Django, Rails, Symfony, etc) handle multiple instances of the same plu

    - by Steven Wei
    Do any of the popular web frameworks solve this problem well? Here's an example: suppose you're running one of these web frameworks and you want to install a blog plugin. Except instead of a single blog, you need to run two separate instances of the blog plugin, and you want to keep them segregated. Or say you want to install multiple instances of a user authentication plugin, because you want to segregate your administrative users from your customer user accounts. Or say you want to install multiple instances of a wiki plugin for different parts of your site, or multiple instances of a comments plugin, or whatever else. It seems to me that at the basic level, each instance of plugin would need to be able to configured with a different set of database tables, and would need to be 'installed' at a different URL path. My experience is mostly with Django and Symfony, and I haven't seen a clean solution to this problem in either of them. They both tend to assume that each plugin (or app, in Django's case) is only ever going to be installed once. I'm curious if the Rails folks have figured out a clean solution to this problem, or any other framework authors (in any language). And if you were going to design a solution to this problem, what would it look like?

    Read the article

  • longest common subsequence

    - by davit-datuashvili
    i have following code public class LCS1 { public static String lcs(String a,String b) { String x; String y; int alen=a.length(); int blen=b.length(); if (alen==0 || blen==0) { return ""; } else if (a.charAt(alen-1)==b.charAt(blen-1)) { return lcs(a.substring(0,alen-1),b.substring(0,blen-1)); } else { x=lcs(a,b.substring(0,blen-1)); y=lcs(a.substring(0,alen-1),b); } return (x.length()>y.length()) ? x : y; } public static void main(String[]args){ String a="computer"; String b="houseboat"; System.out.println(lcs(a,b)); } } it should return "out" but returns nothing what is problem?

    Read the article

  • One Common event for all controls in Silverlight

    - by Veejay
    I have a couple of textblock controls and all of them are calling a single event. But i have to wire all of them invidividually using TextBlock1.MouseMove += new MouseEventHandler(TextBlock_MouseMove); TextBlock2.MouseMove += new MouseEventHandler(TextBlock_MouseMove); TextBlock3.MouseMove += new MouseEventHandler(TextBlock_MouseMove); Is there a way that I can apply the mouse move to all TextBlock without wiring them one by one

    Read the article

  • How to host 50 domains/sites with common Django code base

    - by Off Rhoden
    I have 50 different websites that use the same layout and code base, but mostly non-overlapping data (regional support sites, not link farm). Is there a way to have a single installation of the code and run all 50 at the same time? When I have a bug to fix (or deploy new feature), I want to deploy ONE time + 1 restart and be done with it. Also: Code needs to know what domain the request is coming to so the appropriate data is displayed.

    Read the article

  • Many to Many delete in NHibernate two parents with common association

    - by Joshua Grippo
    I have 3 top level entities in my app: Circuit, Issue, Document Circuits can contain Documents and Issues can contain Documents. When I delete a Circuit, I want it to delete the documents associated with it, unless it is used by something else. I would like this same behavior with Issues. I have it working when the only association is in the same table in the db, but if it is in another table, then it fails due to foreign key constraints. ex 1(This will cascade properly, because there is only a foreign constraint from Circuit to Document) Document1 exists. Circuit1 exists and contains a reference to Document1. If I delete Circuit1 then it deletes Document1 with it. ex 2(This will cascade properly, because there is only a foreign constraint from Circuit to Document.) Document1 exists. Circuit1 exists and contains a reference to Document1. Circuit2 exists and contains a reference to Document1. If I delete Circuit1 then it is deleted, but Document1 is not deleted because Circuit2 exists. If I then delete Circuit2, then Document1 is deleted. ex 3(This will throw an error, because when it deletes the Circuit it sees that there are no other circuits that reference the document so it tries to delete the document. However it should not, because there is an Issue that has a foreign constraint to the document.) Document 1 exists. Circuit1 exists and contains a reference to Document1. Issue1 exists and contains a reference to Document1. If I delete Circuit1, then it fails, because it tries to delete Document1, but Issues1 still has a reference. DB: This think won't let upload an image, so here is the ERD to the DB: http://lh3.ggpht.com/_jZWhe7NXay8/TROJhOd7qlI/AAAAAAAAAGU/rkni3oEANvc/CircuitIssues.gif Model: public class Circuit { public virtual int CircuitID { get; set; } public virtual string CJON { get; set; } public virtual IList<Document> Documents { get; set; } } public class Issue { public virtual int IssueID { get; set; } public virtual string Summary { get; set; } public virtual IList<Model.Document> Documents { get; set; } } public class Document { public virtual int DocumentID { get; set; } public virtual string Data { get; set; } } Mapping Files: <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Model" assembly="Model"> <class name="Circuit" table="Circuit"> <id name="CircuitID"> <column name="CircuitID" not-null="true"/> <generator class="identity" /> </id> <property name="CJON" column="CJON" type="string" not-null="true"/> <bag name="Documents" table="CircuitDocument" cascade="save-update,delete-orphan"> <key column="CircuitID"/> <many-to-many class="Document"> <column name="DocumentID" not-null="true"/> </many-to-many> </bag> </class> </hibernate-mapping> <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Model" assembly="Model"> <class name="Issue" table="Issue"> <id name="IssueID"> <column name="IssueID" not-null="true"/> <generator class="identity" /> </id> <property name="Summary" column="Summary" type="string" not-null="true"/> <bag name="Documents" table="IssueDocument" cascade="save-update,delete-orphan"> <key column="IssueID"/> <many-to-many class="Document"> <column name="DocumentID" not-null="true"/> </many-to-many> </bag> </class> </hibernate-mapping> <?xml version="1.0" encoding="utf-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Model" assembly="Model"> <class name="Document" table="Document"> <id name="DocumentID"> <column name="DocumentID" not-null="true"/> <generator class="identity" /> </id> <property name="Data" column="Data" type="string" not-null="true"/> </class> </hibernate-mapping> Code: using (ISession session = sessionFactory.OpenSession()) { var doc = new Model.Document() { Data = "Doc" }; var circuit = new Model.Circuit() { CJON = "circ" }; circuit.Documents = new List<Model.Document>(new Model.Document[] { doc }); var issue = new Model.Issue() { Summary = "iss" }; issue.Documents = new List<Model.Document>(new Model.Document[] { doc }); session.Save(circuit); session.Save(issue); session.Flush(); } using (ISession session = sessionFactory.OpenSession()) { foreach (var item in session.CreateCriteria<Model.Circuit>().List<Model.Circuit>()) { session.Delete(item); } //this flush fails, because there is a reference to a child document from issue session.Flush(); foreach (var item in session.CreateCriteria<Model.Issue>().List<Model.Issue>()) { session.Delete(item); } session.Flush(); }

    Read the article

  • Maintaining a common set of Eclipse preferences

    - by Robert Munteanu
    Whenever I switch workspaces/Eclipse installs I need to copy/redo the preferences: compiler settings; font sizes/families; code formatter; java code templates; editor templates; code clean-ups; I would like to maintain these settings in an unitary way, preferrably under source control. How can I do that? I know about 'copy settings' when creating a new workspace, but it does not keep updated copies.

    Read the article

  • libgtk2.0-common fails to build with Gdk-2.0.gir error, Type reference 'GdkPixbuf' not found

    - by Stefano Palazzo
    I'm trying to build gtk, but it fails. Here's what I'm doing: sudo apt-get build-dep libgtk2.0-common sudo apt-get source libgtk2.0-common cd gtk+2.0-2.22.0/ sudo gedit gtk/gtktreeview.c & #...editing a few files (or not, it's the same error) sudo ./configure --prefix=/usr sudo make The compilation runs for a while and then quits: Gdk-2.0.gir: error: Type reference 'GdkPixbuf' not found ... make: *** [all] Error 2 What am I doing wrong?

    Read the article

  • Good or common naming conventions for xsd target namespaces

    - by Anne Schuessler
    I'm looking for some ideas for good naming conventions for xsd target namespaces. Basically I just need to make a definite decision on how to name the target namespace of my xsd so I try to get it right the first time. Changing it later would require changes to another system which is not in my control. Do you have any experience from past XML schema creations on what is a good and working solution? I've tried to find information online, but most examples just use very generic target namespaces like "http://exampleSchema" and similar. I'm actually trying to find some real life examples.

    Read the article

  • Find most common string in an array

    - by j.
    I have this array, for example (the size is variable): x = ["1.111", "1.122", "1.250", "1.111"] and I need to find the most commom value ("1.111" in this case). Is there an easy way to do that? Tks in advance!

    Read the article

  • Creating a function that will handle objects with common properties

    - by geocine
    Take this as an example I have trimmed this example for readability and you may not find the use of this concept here. class Teacher() { public Name {get; set;} public Salt {get; set;} public Department{get; set;} } class Student() { public Name {get; set;} public Salt {get; set;} public Section{get; set;} } public string GetEncryptedName(object Person) { //return encrypted name based on Name and Salt property return encrypt(object.Salt,object.Name) } callig the function GetEncryptedName(Teacher) GetEncryptedName(Student) How do you implement this kind of stuff?

    Read the article

  • What is the most common way to use a middleware in node with express and connect

    - by Bernhard
    Thinking about the correct way, how to make use of middlewares in a node.js web project using express and connect which is growing up at the moment. Of course there are middlewares right now wich has to pass or extend requests globally but in a lot of cases there are special jobs like prepare incoming data and in this case the middleware would only work for a set of http-methods and routes. I've a component based architecture and each component brings it's own middleware layer which can implement those for requests this component can handle. On app startup any required component is loaded and prepared. Is it a good idea to bind the middleware code execution to URLs to keep cpu load lower or is it better to use middlewares only for global purposes? Here's some dummy how an url related middleware look like. app.use(function(req, res, next) { // Check if requested route is a part of the current component // or if the middleware should be passed on any request if (APP.controller.groups.Component.isExpectedRoute(req) || APP.controller.groups.Component.getConfig().MIDDLEWARE_PASS_ALL === true) { // Execute the midleware code here console.log('This is a route which should be afected by middleware'); ... next(); }else{ next(); } });

    Read the article

  • What are the common patterns in web programming?

    - by lankerisms
    I have been trying to write my first big web app (more than one cgi file) and as I kept moving forward with the rough prototype, paralelly trying to predict more tasks, this is the todo that got accumulated (In no particular order). * Validations and input sanitizations * Object versioning (to avoid edit conflicts. I dont want hard locks) * Exception handling * memcache * xss and injection protections * javascript * html * ACLs * phonetics in search, match and find duplicates (for form validation) * Ajaxify!!! (I have snipped off the project specific items.) I know that each todo will be quite tied up to its project and technologies used. What I am wondering though, is if there is a pattern in your todo items as well as the sequence in which you experienced guys have come across them.

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >