Search Results

Search found 19928 results on 798 pages for 'multiple constructors'.

Page 145/798 | < Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >

  • Working with multiple input and output files in Python

    - by Morlock
    I need to open multiple files (2 input and 2 output files), do complex manipulations on the lines from input files and then append results at the end of 2 output files. I am currently using the following approach: in_1 = open(input_1) in_2 = open(input_2) out_1 = open(output_1, "w") out_2 = open(output_2, "w") # Read one line from each 'in_' file # Do many operations on the DNA sequences included in the input files # Append one line to each 'out_' file in_1.close() in_2.close() out_1.close() out_2.close() The files are huge (each potentially approaching 1Go, that is why I am reading through these input files one at a time. I am guessing that this is not a very Pythonic way to do things. :) Would using the following form good? with open("file1") as f1: with open("file2") as f2: # etc. If yes, could I do it while avoiding the highly indented code that would result? Thanks for the insights!

    Read the article

  • RIA Services and multiple/dynamic "Include" strategies

    - by user326526
    As an example, assume the following simple model: public class Order { public List<LineItem> LineItems { get; set; } public List<Fee> Fees { get; set; } } public class LineItem { } public class Fee { } With RIA Services, if I want to retrieve an Order and include all of it's line items in the same network call, I can statically place an [Include] attribute on the above LineItems collection. This works great for a single scenario, but what happens when I need multiple "include strategies"? For instance, one situation might call for including the Fees collection and NOT the LineItems collection. Is there any way with RIA Services to control what's included at runtime without redefining your model and/or creating dtos with the attributes statically placed for each use-case?

    Read the article

  • How Can I Reference Multiple Primary Keys For A Vector Type Primary Key

    - by AndreiC
    Hi, I have the following scenario: a table of projects and a table of persons, working on one or serveral projects. Also, I have a project id column (of type int), in the first table, which is a primary key there and I have a vector of project ids, as a column of type int, in my second table (persons), that references primary keys from the first table. What is the correct syntax for referencing multiple primary keys, from a vector foreign key. This is the way I am trying to create the table, but I am not sure what to place at the indicated line: CREATE TABLE Persons( Person_Id int, ..., ProjectsList int[], FOREIGN KEY (ProjectsList) REFERENCES Projects(Project_id) -- not sure what how to define the link here ); I hope my explanations are not over-complicated. Thank you in advance for helping!

    Read the article

  • curl multiple requests cookie issue

    - by embedded
    I'm using curl multi API for multiple curl requests. first I'm using a single request to login to a site and save the cookie file. then I'm using the curl multi API to get some data from that site. The problem I'm facing is that from some reason the cookie file does not get read and I'm redirecting to the main login page. I must say that this work once in awhile so I can't point what went wrong. Any help would be much appreciated. Thanks

    Read the article

  • Avoid multiple autocomplete calls by wrapping it with SetTimeOut

    - by pixelboy
    Here's my issue : using an autocomplete jQuery plugin, I'd like to avoid multiple ajax requests when user strikes his keynoard by surrounding the $('#query1').autocomplete({ serviceUrl:'/actions/autocomplete?population=salon', minChars:3, maxHeight:300, width:200, clearCache:true, onSelect: function(suggestions,data){ $(".btn1").attr("href", "${pageContext.request.contextPath}/actions/espaceClients?participantId=" + data) } }); with something like var search = false; $('#query1, #query2, #query3').keyup(function(){ if (!search){ search = true; } if (search) { search = false; autocompleteThem(); } }); A you can see, above code is stupid, but it kinda shows what i'm trying to do. In simple words, if user dosen't type anything else in a certain period of time, then you can call autocomplete. I hope i'm being clear, as my brains are a mess...

    Read the article

  • How to string multiple TextReaders together?

    - by Ken
    I have 3 TextReaders -- a combination of StreamReaders and StringReaders. Conceptually, the concatenation of them is a single text document. I want to call a method (not under my control) that takes a single TextReader. Is there any built-in or easy way to make a concatenating TextReader from multiple TextReaders? (I could write my own TextReader subclass, but it looks like a fair amount of work. In that case, I'd just write them all out to a temp file and then open it with a single StreamReader.) Is there an easy solution to this that I'm missing?

    Read the article

  • Float multiple fixed-width / varible-height boxes into 2 columns

    - by Jeremy H
    I'll try to explain this as best I can. I have multiple divs that are fixed-width but variable height. I want to float these boxes into two columns inside a fixed-width container. What happens when a give them all a float: left value, I get something like this: ######### ######### # box 1 # # box 2 # ######### # ..... # ......... # ..... # ......... ######### ######### ######### # box 3 # # box 4 # # ..... # # ..... # ######### ######### ######### ######### # box 5 # # box 6 # # ..... # ######### # ..... # ######### (The periods are white space) What I really would really like is the top of box 3 to touch the bottom of box 1. Any easy way to acheive this?

    Read the article

  • WxPython multiple grid instances

    - by randomPythonHacker
    Does anybody know how I can get multiple instances of the same grid to display on one frame? Whenever I create more than 1 instance of the same object, the display of the original grid widget completely collapses and I'm left unable to do anything with it. For reference, here's the code: import wx import wx.grid as gridlib class levelGrid(gridlib.Grid): def __init__(self, parent, rows, columns): gridlib.Grid.__init__(self, parent, -1) self.moveTo = None self.CreateGrid(rows, columns) self.SetDefaultColSize(32) self.SetDefaultRowSize(32) self.SetColLabelSize(0) self.SetRowLabelSize(0) self.SetDefaultCellBackgroundColour(wx.BLACK) self.EnableDragGridSize(False) class mainFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(768, 576)) editor = levelGrid(self, 25, 25) panel1 = wx.Panel(editor, -1) #vbox = wx.BoxSizer(wx.VERTICAL) #vbox.Add(editor, 1, wx.EXPAND | wx.ALL, 5) #selector = levelGrid(self, 1, 25) #vbox.Add(selector, 1, wx.EXPAND |wx.BOTTOM, 5) self.Centre() self.Show(True) app = wx.App() mainFrame(None, -1, "SLAE") app.MainLoop()

    Read the article

  • Java Client-Server problem when sending multiple files

    - by Jim
    Client public void transferImage() { File file = new File(ServerStats.clientFolder); String[] files = file.list(); int numFiles = files.length; boolean done = false; BufferedInputStream bis; BufferedOutputStream bos; int num; byte[] byteArray; long count; long len; Socket socket = null ; while (!done){ try{ socket = new Socket(ServerStats.imgServerName,ServerStats.imgServerPort) ; InputStream inStream = socket.getInputStream() ; OutputStream outStream = socket.getOutputStream() ; System.out.println("Connected to : " + ServerStats.imgServerName); BufferedReader inm = new BufferedReader(new InputStreamReader(inStream)); PrintWriter out = new PrintWriter(outStream, true /* autoFlush */); for (int itor = 0; itor < numFiles; itor++) { String fileName = files[itor]; System.out.println("transfer: " + fileName); File sentFile = new File(fileName); len = sentFile.length(); len++; System.out.println(len); out.println(len); out.println(sentFile); //SENDFILE bis = new BufferedInputStream(new FileInputStream(fileName)); bos = new BufferedOutputStream(socket.getOutputStream( )); byteArray = new byte[1000000]; count = 0; while ( count < len ){ num = bis.read(byteArray); bos.write(byteArray,0,num); count++; } bos.close(); bis.close(); System.out.println("file done: " + itor); } done = true; }catch (Exception e) { System.err.println(e) ; } } } Server public static void main(String[] args) { BufferedInputStream bis; BufferedOutputStream bos; int num; File file = new File(ServerStats.serverFolder); if (!(file.exists())){ file.mkdir(); } try { int i = 1; ServerSocket socket = new ServerSocket(ServerStats.imgServerPort); Socket incoming = socket.accept(); System.out.println("Spawning " + i); try { try{ if (!(file.exists())){ file.mkdir(); } InputStream inStream = incoming.getInputStream(); OutputStream outStream = incoming.getOutputStream(); BufferedReader inm = new BufferedReader(new InputStreamReader(inStream)); PrintWriter out = new PrintWriter(outStream, true /* autoFlush */); String length2 = inm.readLine(); System.out.println(length2); String filename = inm.readLine(); System.out.println("Filename = " + filename); out.println("ACK: Filename received = " + filename); //RECIEVE and WRITE FILE byte[] receivedData = new byte[1000000]; bis = new BufferedInputStream(incoming.getInputStream()); bos = new BufferedOutputStream(new FileOutputStream(ServerStats.serverFolder + "/" + filename)); long length = (long)Integer.parseInt(length2); length++; long counter = 0; while (counter < length){ num = bis.read(receivedData); bos.write(receivedData,0,num); counter ++; } System.out.println(counter); bos.close(); bis.close(); File receivedFile = new File(filename); long receivedLen = receivedFile.length(); out.println("ACK: Length of received file = " + receivedLen); } finally { incoming.close(); } } catch (IOException e){ e.printStackTrace(); } } catch (IOException e1){ e1.printStackTrace(); } } The code is some I found, and I have slightly modified it, but I am having problems transferring multiple images over the server. Output on Client: run ServerQueue.Client Connected to : localhost transfer: Picture 012.jpg 1312743 java.lang.ArrayIndexOutOfBoundsException Connected to : localhost transfer: Picture 012.jpg 1312743 Cant seem to get it to transfer multiple images. But bothsides I think crash or something because the file never finishes transfering

    Read the article

  • Threading multiple WebBrowser in VB .net

    - by Code_Seeker
    I'm building a multiple webbrowser inside tabs( 1 predefine webbrowser control per tab) and I want them all to load at the same time or other words must run in thread. Unfortunately I feel a valid fact came from the error message that this is something not possible. Pls help me to check my simple program code below and its error in case i tried releasing 2 webbrowser controls but when I leave it to single web browser control it works fine. Any workaround? Imports System.Threading Public Class Form1 Dim mythread1 As Thread Dim mythread2 As Thread Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load mythread1 = New Thread(AddressOf mysub1) mythread2 = New Thread(AddressOf mysub2) mythread1.IsBackground = True mythread2.IsBackground = True mythread1.Start() mythread2.Start() End Sub Public Sub mysub1() Dim HTML As String WebBrowser1.Navigate("about:blank") mythread1.Abort() End Sub Public Sub mysub2() WebBrowser2.Navigate("about:blank") mythread2.Abort() End Sub

    Read the article

  • DialogBox in Win32 - Prevent multiple instance

    - by UK
    Hello all, I have a program which creates DialogBox window when user clicks the menu item from tray icon, case ID_OPTIONS: DialogBox ( GetModuleHandle ( NULL ), MAKEINTRESOURCE ( IDD_SETUP_DIALOG ), hWnd, reinterpret_cast<DLGPROC>(SetupDlgProc) ); return 0; But the problem here is everytime when users clicks item from tray , a new instance of the dialogbox appears. Is there anyway to prevent this multiple instance ? BTW, my SetupDlgProc looks like this, BOOL CALLBACK SetupDlgProc ( HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: ... } } Thanks for your help.

    Read the article

  • Reading ResultSet from multiple threads

    - by superdario
    Hello, In the database, I have a definition table that is read from the application once upon starting. This definition table rarely changes, so it makes sense to read it once and restart the application every time it changes. However, after the table is read (put into a ResultSet), it will be read by multiple handlers running in their own threads. How do you suggest to accomplish this? My idea was to populate a CachedRowSet, and then create a copy of this set (through the createCopy() method) for each handler every time a new request comes. Do you think this is wise? Does this offer a good performance? Thanks.

    Read the article

  • make: invoke command for multiple targets of multiple files?

    - by marvin2k
    Hi, I looking to optimize an existing Makefile. It's used to create multiple plots (using Octave) for every logfile in a given directory using an scriptfile for every plot which takes a logfilename as an argument. In the Moment, I use one single rule for every kind of plot available, with a handwritten call to Octave, giving the specific scriptfile/logfile as an argument. It would be nice, if every plot has "his" octave-script as a dependency (plus the logfile, of course), so only one plot is regenerated if his script is changed. Since I don't want to type that much, I wonder how I can simplifiy this by using only one general rule to build "a" plot? To make it clearer: Logfile: "$(LOGNAME).log" Scriptfile: "plot$(PLOTNAME).m" creates "$(LOGNAME)_$(PLOTNAME).png" The first thing I had in mind: %1_%2.png: %1.log $(OCTAVE) --eval "plot$<2('$<1')" But this seems not to be allowed. Could someone give me a hint?

    Read the article

  • cutting a text file into multiple parts in emacs

    - by Gaurish Telang
    Hi I am using the GNU-Emacs-23 editor. I have this huge text file containing about 10,000 lines which I want to chop into multiple files. Using the mouse to select the required text to paste in another file is the really painful. Also this is prone to errors too. If I want to divide the text file according to the line numbers into say 4 file where first file:lines 1-2500 second file:lines 2500-5000 third file :lines 5000-7500 fourth file: lines: 7500-10000 how do I do this? At the very least, is there any efficient way to copy large regions of the file just by specifying line numbers

    Read the article

  • Aggregating and Displaying Multiple Feeds

    - by Keith
    I want to pull feeds for multiple online services (e.g. Tumblr, Google Reader, Delicious) and aggregate them into a single feed to display on my site. I know of services like YQL or Yahoo! Pipes which will combine feeds, but sometimes those services are too slow. I was wondering what the best method would be if I wanted to run this on my own server (using JavaScript or PHP)? Ideally, I would cache the results to cut down on processing.

    Read the article

  • How to add multiple files to py2app?

    - by Niek de Klein
    I have a python script which makes a GUI. When a button 'Run' is pressed in this GUI it runs a function from an imported package (which I made) like this from predictmiP import predictor class MiPFrame(wx.Frame): [...] def runmiP(self, event): predictor.runPrediction(self.uploadProtInterestField.GetValue(), self.uploadAllProteinsField.GetValue(), self.uploadPfamTextField.GetValue(), \ self.edit_eval_all.Value, self.edit_eval_small.Value, self.saveOutputField) When I run the GUI directly from python it all works well and the program writes an output file. However, when I make it into an app, the GUI starts but when I press the button nothing happens. predictmiP does get included in build/bdist.macosx-10.3-fat/python2.7-standalone/app/collect/, like all the other imports I'm using (although it is empty, but that's the same as all the other imports I have). How can I get multiple python files, or an imported package to work with py2app?

    Read the article

  • Extending Multiple models in Codeigniter 2

    - by Rooneyl
    How do you set up CI2 to allow extending of multiple models? I can only get it to extend one model (put in /application/core) named MY_Model (case sensitive). To choose what model to extend I am doing; in the model.. require_once APPPATH.'core/MY_Another_model.php'; class Test_model extends MY_Another_model { ... } I can't find where in the core system code where it states only to allow models that are being extended to be called MY_Model. Thank you for any and all help.

    Read the article

  • MVC - Same URL, multiple views

    - by Amati
    Hi, Is it considered bad practice to have multiple views for same URL in MVC, based on different user roles? For example: http://www.domain.com/ViewProductID/123 will show a "normal" product page for a regular user and it will show an "enhanced" (product stats, ability to edit title etc..) version to someone logged in as admin. If it's bad practice, why? If it's ok, what's the best way to implement it? 2 separate templates or 1 template scattered with if..else? Thanks!

    Read the article

  • Multiple LIKE in SQL

    - by ninumedia
    I wanted to search through multiple rows and obtain the row that contains a particular item. The table in mySQL is setup so each id has a unique list (comma-delimited) of values per row. Ex: id | order 1 | 1,3,8,19,34,2,38 2 | 4,7,2,190,38 Now if I wanted to pull the row that contained just the number 19 how would I go about doing this? The possibilities I could figure in the list with a LIKE condition would be: 19, ,19 ,19, I tried the following and I cannot obtain any results, Thank you for your help! SELECT * FROM categories WHERE order LIKE '19,%' OR '%,19%' OR '%,19%' LIMIT 0 , 30

    Read the article

  • multiple FileSystemWatchers to monitor files on local system?

    - by Jason Crowes
    We're writing a text editor like tool for our internal accounting package system that has actions that can be done by our own Xml language specs. These macro commands are specified in Xml files and we need the ability to monitor if files openned have bean modified externally. The only problem is that there maybe 20-30 files with different paths openned at any one time. Would it be good to use multiple FileSystemWatchers for this scenario? Or would it be better to monitor the root drive and catch specific events that match an open file in the editor (though lots of events could be raised). Some are local drives (C,D,E) others are their network drives (U,X,G,H). Files are quite chunky too about 300-400Kb.

    Read the article

  • Drawing multiple lines with Java Swing

    - by rize
    I'm learning drawing lines with Java Swing in order to draw a labyrinth. I can draw one line at a specified position and it shows just fine. But when I want to draw multiple lines, only the last one shows. My code: public class LabyrinthGUI extends JFrame { ... Line line1 = new Line(0, 0, 0, 50); this.getContentPane().add(line1); } public class Line extends JPanel{ private int x1, y1, x2, y2; public Line(int x1, int y1, int x2, int y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } public void paintComponent (Graphics g) { g.drawLine(x1, y1, x2, y2); } I probably have to refresh something, to display all the lines drawn with for-loop, but don't know what.

    Read the article

  • changing a picker to table view OR having multiple table views on the same view

    - by Brodie4598
    Hello - My iPad app was rejected due to my use of a picker. The picker was used to control a table view. In my view, a picker was displaying a series of items and when one of those items was selected, it used that selection to populate a table with data. (hopefully that makes sense). Now I need to do this without the picker so I need to have the data that was in the picker be represented in a table view. My question, is how do I have multiple tableViews in the same view? I'm guessing I need to have some kind of if statement in the tableview delegate methods, but I'm not quite sure what the if statement needs to be. Or maybe i'm thinking of this the totally wrong way thanks

    Read the article

  • Django finding which field matched in a multiple OR query

    - by Greg Hinch
    I've got a couple models which are set up something like this: class Bar(models.Model): baz = models.CharField() class Foo(models.Model): bar1 = models.ForeignKey(Bar) bar2 = models.ForeignKey(Bar) bar3 = models.ForeignKey(Bar) And elsewhere in the code, I end up with an instance of Bar, and need to find the Foo it is attached to in some capacity. Right now I came up with doing a multiple OR query using Q, something like this: foo_inst = Foo.objects.get(Q(bar1=bar_inst) | Q(bar2=bar_inst) | Q(bar3=bar_inst)) What I need to figure out is, which of the 3 cases actually hit, at least the name of the member (bar1, bar2, or bar3). Is there a good way to do this? Is there a better way to structure the query to glean that information?

    Read the article

  • Documenting software architectures that serve multiple markets

    - by wsb3383
    Hello, I'm the lead developer/architect wanna-be on a J2EE based system/platform at work that serves both real estate and automotive markets. The systems consists of a set of database back ends, web services and two web clients. The platform ends up serving 3 different products: an internal vehicle inventory system for use by company analysts, an external dealer management system (commercialized product), and a real estate inventory system (commercialized). In other words, it follows a software product lines approach....My question is, I'm having trouble communicating to other technical and some business people how this platform architecture is one system that serves multiple markets (by leveraging some existing assets combined with minor modifications)....Is there a formal modeling language that can simplify communicating this intent? I should note that I haven't read much about software product lines, so I'm not sure if there is actually a standard modeling approach to SPL that i'm not aware of....I'm also interested in knowing if there are special configuration management practices for such systems. thanks,

    Read the article

  • habtm multiple times with the same model

    - by Ermin
    I am trying to model a publications. A publication can have multiple authors and editors. Since it is possible that one person is an author of one publication and an editor of another, no separate models for Authors and Editors: class Publication < ActiveRecord::Base has_and_belongs_to_many :authors, :class_name=>'Person' has_and_belongs_to_many :editors, :class_name=>'Person' end The above code doesn't work, because it uses the same join table. Now I now that I can specify the name of the join table, but there is a warning in the API documentation is a warning about that which I don't understand: :join_table: Specify the name of the join table if the default based on lexical order isn’t what you want. WARNING: If you’re overwriting the table name of either class, the table_name method MUST be declared underneath any has_and_belongs_to_many declaration in order to work.

    Read the article

< Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >