Search Results

Search found 8384 results on 336 pages for 'lines'.

Page 4/336 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Reverse Two Consecutive Lines

    - by thebourneid
    I have this part of a code for editing cue sheets and I don't know how to reverse two consecutive lines if found: /^TITLE.*?"$/ /^PERFORMER.*?"$/ to reverse to /^PERFORMER.*?"$/ /^TITLE.*?"$/ What would it be the solution in my case? use strict; use warnings; use File::Find; use Tie::File; my $dir_target = 'test'; find(\&c, $dir_target); sub c { /\.cue$/ or return; my $fn = $File::Find::name; tie my @lines, 'Tie::File', $fn or die "could not tie file: $!"; for (my $i = 0; $i < @lines; $i++) { if ($lines[$i] =~ /^REM (DATE|GENRE|REPLAYGAIN).*?$/) { splice(@lines, $i, 3); } if ($lines[$i] =~ /^\s+REPLAYGAIN.*?$/) { splice(@lines, $i, 1); } } untie @lines; }

    Read the article

  • How to limit JTextArea max Rows and Coloums?

    - by Billbo bug
    I am using JTextArea in JScrollPane I want to limit the maximum number of lines possible and the maximum chars in each line. I need that the string will be exactly like on the screen, each line will end with '\n' (if there another line after it) and the user will be able to insert only X lines and Y chars in each line. I tried to limit the lines but i don't know exactly how many lines do i have because of the line wrapping, The line wrapping is starting new line visualy on the screen(because of the width of the JTextArea) but in the string of the component it is really the same line with no '\n' to indicate new line. I do not have an idea how to limit the max chars in each line while typing. There are 2 stages: The typing of the string- keep that the user will not be able to type more then X lines and Y chars in each line. (even if the line wrap only visualy or the user typed '/n') Insert the string to the DB- after cliking 'OK' convert the string that every line will end with "/n" even if the user did not typed it and the line was wrapped only visualy. There are few problems if i will count the chars in the line and insert '/n' in the end of the line, thats why i decided to do it in two stages. In the first stage ehile the user is typing i would rather only limit it visualy and force line wrpping or something similar. Only in the second stage when i save string i will add the '/n' even if the user did not typed it in the end of the lines! Does anyone have an idea? I know that i will have to use DocumentFilter OR StyledDocument. Here is sample code that limit only the lines to 3:(but not the chars in row to 19) private JTextArea textArea ; textArea = new JTextArea(3,19); textArea .setLineWrap(true); textArea .setDocument(new LimitedStyledDocument(3)); JScrollPane scrollPane = new JScrollPane(textArea public class LimitedStyledDocument extends DefaultStyledDocument /** Field maxCharacters */ int maxLines; public LimitedStyledDocument(int maxLines) { maxCharacters = maxLines; } public void insertString(int offs, String str, AttributeSet attribute) throws BadLocationException { Element root = this.getDefaultRootElement(); int lineCount = getLineCount(str); if (lineCount + root.getElementCount() <= maxLines){ super.insertString(offs, str, attribute); } else { Toolkit.getDefaultToolkit().beep(); } } /** * get Line Count * * @param str * @return the count of '\n' in the String */ private int getLineCount(String str){ String tempStr = new String(str); int index; int lineCount = 0; while (tempStr.length() > 0){ index = tempStr.indexOf("\n"); if(index != -1){ lineCount++; tempStr = tempStr.substring(index+1); } else{ break; } } return lineCount; } }

    Read the article

  • Diff tool to align shuffled lines

    - by Ken Bloom
    Suppose I have two documents that are identical except the lines are shuffled. Is there a tool that can show me which lines in document A correspond to which lines on document B by drawing lines to connect them (kinda like Cairo does for machine translation word alignments)? What if the files have some level of differing lines (I don't want to figure out which lines are similar to each other -- if there isn't an exact match for a line, then that line has no match.) Note: I am not looking to sort the files and compare them, rather I am looking to get a visualization of how far out of order the files are relative to each other, and which particular regions tend to move together, and which tend to be shuffled.

    Read the article

  • Hylafax / Capi4hylafax: faxgetty does not recognize number of lines

    - by Wrikken
    We've got a T.30 card, 30 working lines on it, but for some reason, if I add more then 30 faxes in the queue at any time (and we're busy enough at peak times that this happens a lot), faxgetty sends faxes to non-existent lines and they appear in the error queue as a 'busy' signal on the line, which results in a lot of failed faxes because the counter of max 3 tries increases rapidly. This is using faxgetty (USE_FAXGETTY="y" in /etc/default/hylafax). I've inherited this thing, so I'm not entirely sure how faxgetty is supposed to know the number of lines. However, if I alter the script to faxmodem (USE_FAXGETTY="n" in /etc/default/hylafax and manually enabling 30 modems), this behavior goes away (new faxes 'wait' for a line to be available before trying to send, so each try / fail is a valid one on a working line, majorly descreasing the amount of failed faxes. However, when researching this almost anyone talks about faxgetty being the preferred, more robust, method, and on top of that for some unexplained reason all FIFO's disappeared for some reason after several errorless hours with faxmodem, forcing a hylafax restart using faxgetty until we figured out why this faxmodem solution failed (which is another question, and somewhat out of scope here). Environment: Debian 2.6.26-2-amd64 capi4hylafax 1:01.03.00.99.svn.300-12 hylafax-client 2:4.4.4-10.1 hylafax-server 2:4.4.4-10.1 Config --hfaxd.conf-- LogFacility: daemon ServerTracing: 0x1ff --hyla.conf-- Host: localhost Verbose: No VRes: 196 TimeZone: local DialRules: "/etc/hylafax/dialrules.europe" --/etc/hylafax/config -- InternationalPrefix: 00 LongDistancePrefix: 0 AreaCode: 99999 CountryCode: 31 DialStringRules: "etc/dialrules.europe" ModemGroup: any:faxCAPI SendFaxCmd: "/usr/bin/wrapc2faxsend" --/etc/hylafax/config.faxCAPI -- SpoolDir: /var/spool/hylafax FaxRcvdCmd: /var/spool/hylafax/bin/faxrcvd PollRcvdCmd: /var/spool/hylafax/bin/pollrcvd FaxReceiveUser: uucp FaxReceiveGroup: dialout LogFile: /var/spool/hylafax/log/capi4hylafax #no, checking this log did not yield anything interesting LogTraceLevel: 4 LogFileMode: 0600 ModemGroup: any:faxCAPI #repeats of faxCAPI2 = faxCAPI30, with of course another devicename/local ident: { HylafaxDeviceName: faxCAPI RecvFileMode: 0600 FAXNumber: ****redacted**** LocalIdentifier: ****some-ident-per-device*** MaxConcurrentRecvs: 0 OutgoingController: 1 OutgoingMSN: SuppressMSN: 0 NumberPrefix: NumberPlusReplacer: "00" UseISDNFaxService: 0 RingingDuration: 0 { Controller: 1 AcceptSpeech: 0 UseDDI: 0 DDIOffset: DDILength: 0 IncomingDDIs: IncomingMSNs: AcceptGlobalCall: 1 } } So in short: How does faxgetty determine the number of lines available? (the man page isn't terribly revealing, and I can't find an appropriate setting in hylafax-config. And how can I get a capi4hylafax/hylafax setup which queues more faxes then lines are available correctly without immediately incrementing the fail count? We will not be receiving any faxes on this machine b.t.w. As I said, I've inherited this thing, so if there are important configuration options I'm not including, please let me know.

    Read the article

  • Data Flow Diagrams - Difference between Lines and Arrows

    - by Howdy_McGee
    I'm currently working with Visio to create Data Flow Diagrams for a System Analysis and Design class but I'm unsure what the difference between ------ and ------> is. I can connect 2 shapes together with a line (process, entity, data store) but does the single line connecting the two mean data flow? Do I need to explicitly use the data flow arrow to show which way data is flowing? (There doesn't seem to be tags for this topic, maybe im in the wrong place?)

    Read the article

  • blurry lines between web application context layer, service layer and data access layer in spring

    - by thenaglecode
    I Originally asked this question in SO but on advice I have moved the question here... I'll admit I'm a spring newbie, but you can correct me if I'm wrong, this one liner looks kinda fishy in a best practices sort of way: @RepositoryRestResource(collectionResourceRel="people"...) public interface PersonRepository extends PagingAndSortingRepository<Person, Long> For those who are unaware, the following does many things: It is an interface definition that can be registered in an application context as a jpa repository, automagically hooking up all the default CRUD operations within a persistence context (that is externally configured). and also configures default controller/request-mapping/handler functionality at the namespace "/people" relative to your configured dispatcher servlet-mapping. Here's my point. I just crossed 3 conceptual layers with one line of code! this feels against my seperation-of-concern instincts but i wanted to hear your opinion. And for the sake of being on a question and answer site, I would like to know whether there is a better way of seperating these different layers - Service, Data, Controllers - whilst maintaining as minimal configuration as possible

    Read the article

  • Less than 50 Lines of Code to Create a Java Palette in NetBeans

    - by Geertjan
    Want to drag and drop Java code snippets into the palette, in the same way as can be done for HTML files? If so, create a new module and add a class with the content below and you're done. You'll be able to select a piece of Java code, drag it into the palette (Ctrl-Shift-8 to open it), where you'll be able to set a name, tooltip, and icons for the snippet, and then you'll be able to drag it out of the palette into any Java files you like. The palette content is persisted across restarts of the IDE. package org.netbeans.modules.javasourcefilepalette; import java.io.IOException; import javax.swing.Action; import org.netbeans.api.editor.mimelookup.MimeRegistration; import org.netbeans.spi.palette.DragAndDropHandler; import org.netbeans.spi.palette.PaletteActions; import org.netbeans.spi.palette.PaletteController; import org.netbeans.spi.palette.PaletteFactory; import org.openide.util.Exceptions; import org.openide.util.Lookup; import org.openide.util.datatransfer.ExTransferable; public class JavaSourceFileLayerPaletteFactory { private static PaletteController palette = null; @MimeRegistration(mimeType = "text/x-java", service = PaletteController.class) public static PaletteController createPalette() { try { if (null == palette) { return PaletteFactory.createPalette( //Folder: "JavaPalette", //Palette Actions: new PaletteActions() { @Override public Action[] getImportActions() {return null;} @Override public Action[] getCustomPaletteActions() {return null;} @Override public Action[] getCustomCategoryActions(Lookup lkp) {return null;} @Override public Action[] getCustomItemActions(Lookup lkp) {return null;} @Override public Action getPreferredAction(Lookup lkp) {return null;} }, //Palette Filter: null, //Drag and Drop Handler: new DragAndDropHandler(true) { @Override public void customize(ExTransferable et, Lookup lkp) {} }); } } catch (IOException ex) { Exceptions.printStackTrace(ex); } return null; } } In my layer file, I have this content: <folder name="JavaPalette"> <folder name="Snippets"/> </folder> That's all. Run the module. Open a Java source file and the palette will automatically open. Drag some code into the palette and a dialog will pop up asking for some details like display name and icons. Then the snippet will be in the palette and you'll be able to drag and drop it anywhere you like. Use the Palette Manager, which is automatically integrated, to add new categories and show/hide palette items. Related blog entry, for which the above is a big simplification: Drag/Drop Snippets into Palette .

    Read the article

  • Google Webmasters tools crawl error caused by URL split into two lines

    - by Shiro
    I am looking in to Google Webmaster Tools - Crawl Error section. How should I handle for those URL due their system / application showed invalid URL. e.g http://www.example/images/products/s_=enlarge_16gb.jpg but, I dunno what happen to yahoo groups, it break the link into http://www.example/images/products/s_= enlarge_16gb.jpg and I only make the top part become hyperlink, which is http://www.example/images/products/s_= Because of the URL, Google show crawl error, I got few error because of this kind of result or because other people typo error. How do I prevent this. I am sure I don't have the right go and change other people post. What is the solution for this. Thanks!

    Read the article

  • Font corruption: lines through characters

    - by Aibara Iduas
    I have an odd problem where a one-pixel high white line is displayed through certain letters of text. Almost always only a single character type is affected at once, and only in one font size (though that size can change over time). Most of the time things are fine, but this happens several times a day. It's been happening ever since I upgraded to 10.10. I have noticed few patterns: It might be a problem with Firefox (I'm currently using the nightly ppa, but it occurred in 3.6 also) - but this could just be because I spend most of my time on my computer either at a browser or text editors. I seem to remember it happening with the buttons on various Gnome dialogs. It never occurs in text I've typed, be it an email, url bar, etc. In Firefox it happens across tabs, and the problem remains even if they are closed or reloaded; only restarting the program can fix it. Two examples (in the first, only the larger "r" is corrupted): Any help would be appreciated, thanks.

    Read the article

  • Drawing random smooth lines contained in a square [migrated]

    - by Doug Mercer
    I'm trying to write a matlab function that creates random, smooth trajectories in a square of finite side length. Here is my current attempt at such a procedure: function [] = drawroutes( SideLength, v, t) %DRAWROUTES Summary of this function goes here % Detailed explanation goes here %Some parameters intended to help help keep the particles in the box RandAccel=.01; ConservAccel=0; speedlimit=.1; G=10^(-8); % %Initialize Matrices Ax=zeros(v,10*t); Ay=Ax; vx=Ax; vy=Ax; x=Ax; y=Ax; sx=zeros(v,1); sy=zeros(v,1); % %Define initial position in square x(:,1)=SideLength*.15*ones(v,1)+(SideLength*.7)*rand(v,1); y(:,1)=SideLength*.15*ones(v,1)+(SideLength*.7)*rand(v,1); % for i=2:10*t %Measure minimum particle distance component wise from boundary %for each vehicle BorderGravX=[abs(SideLength*ones(v,1)-x(:,i-1)),abs(x(:,i-1))]'; BorderGravY=[abs(SideLength*ones(v,1)-y(:,i-1)),abs(y(:,i-1))]'; rx=min(BorderGravX)'; ry=min(BorderGravY)'; % %Set the sign of the repulsive force for k=1:v if x(k,i)<.5*SideLength sx(k)=1; else sx(k)=-1; end if y(k,i)<.5*SideLength sy(k)=1; else sy(k)=-1; end end % %Calculate Acceleration w/ random "nudge" and repulive force Ax(:,i)=ConservAccel*Ax(:,i-1)+RandAccel*(rand(v,1)-.5*ones(v,1))+sx*G./rx.^2; Ay(:,i)=ConservAccel*Ay(:,i-1)+RandAccel*(rand(v,1)-.5*ones(v,1))+sy*G./ry.^2; % %Ad hoc method of trying to slow down particles from jumping outside of %feasible region for h=1:v if abs(vx(h,i-1)+Ax(h,i))<speedlimit vx(h,i)=vx(h,i-1)+Ax(h,i); elseif (vx(h,i-1)+Ax(h,i))<-speedlimit vx(h,i)=-speedlimit; else vx(h,i)=speedlimit; end end for h=1:v if abs(vy(h,i-1)+Ay(h,i))<speedlimit vy(h,i)=vy(h,i-1)+Ay(h,i); elseif (vy(h,i-1)+Ay(h,i))<-speedlimit vy(h,i)=-speedlimit; else vy(h,i)=speedlimit; end end % %Update position x(:,i)=x(:,i-1)+(vx(:,i-1)+vx(:,i))/2; y(:,i)=y(:,i-1)+(vy(:,i-1)+vy(:,1))/2; % end %Plot position clf; hold on; axis([-100,SideLength+100,-100,SideLength+100]); cc=hsv(v); for j=1:v plot(x(j,1),y(j,1),'ko') plot(x(j,:),y(j,:),'color',cc(j,:)) end hold off; % end My original plan was to place particles within a square, and move them around by allowing their acceleration in the x and y direction to be governed by a uniformly distributed random variable. To keep the particles within the square, I tried to create a repulsive force that would push the particles away from the boundaries of the square. In practice, the particles tend to leave the desired "feasible" region after a relatively small number of time steps (say, 1000)." I'd love to hear your suggestions on either modifying my existing code or considering the problem from another perspective. When reading the code, please don't feel the need to get hung up on any of the ad hoc parameters at the very beginning of the script. They seem to help, but I don't believe any beside the "G" constant should truly be necessary to make this system work. Here is an example of the current output: Many of the vehicles have found their way outside of the desired square region, [0,400] X [0,400].

    Read the article

  • How to Draw Lines on the Screen (Part 2)

    - by Geertjan
    In part 1, I showed how you can click on the screen to create widgets and then connect those widgets together. But that's not really drawing, is it? (And I'm surprised nobody made that point in the comments to that blog entry.) Drawing doesn't really revolve around connecting dots together. It's more about using a free-flow style and being able to randomly write stuff onto a screen, without constraints. Something like this: I achieved the above by changing one line of code from the original referred to above. Instead of using a "mousePressed" event, I'm now using a "mouseDragged" event. That's all. And now the widgets are created when I drag my mouse on the scene. (I removed the rectangular select action, since that's also invoked during dragging and since that doesn't apply to the above scenario.) Now, the next step is to rewrite the NetBeans Platform Paint Application Tutorial, so that the Visual Library is used. That would be pretty cool.

    Read the article

  • MacBook Pro screen flickers, and lines appears after using it a while

    - by Adam L. S.
    My aunt gave me her old MacBook Pro, but unfortunately it has a few issues. The main problem is that lines appears after I use it with applications that heavily depend on graphics, but they don't necessarily appear in that window. I also figured out that these lines appear with the windows, so the cursor goes over the lines, and menus and other windows also overlap them. If I take a screenshot of the window by itself, no lines appear. It seems obvious to me that this is a driver-related problem. Unfortunately, there are no updates or anything for the driver. At first I tried asking for a solution at Apple's forum, but they were only able to figure out that "something is wrong with the video card". I checked the MacBook with an Ubuntu disk, and the screen seemed OK. I've uploaded some photos to my Picasa account to show the symptoms. Recently, I've also noticed the screen flickering when using applications that need high performance graphics, like games. Also, the MacBook Pro came with Mac OS X Tiger, but she upgraded it to Leopard (she only brought the Tiger disk with her.) What can I do with this?

    Read the article

  • Read Lines between a start index and end index in java

    - by HonorGod
    Lets say I have 10 lines in a file. I have 2 parameters that specify the beginning and ending of a index. StartIndex = 2 // specifies the first 2 lines EndIndex = 3 // specifies the last 3 lines I need to read the lines in between. I know maintaining index and skipping is one of the ways...but are there any other efficient ways (even with external libraries)? Thanks

    Read the article

  • Paste multiple lines before a line in vim?

    - by Umar
    How do I copy multiple lines and paste them as a block before a line? As an example I have the following code and I want to copy and paste the three lines after the if statement to after the else statement but before the line below it. [row col] = find(H); if (nargin < 4) delqmn = sparse(row, col, 0, M, N); % diff of msgs from bits to checks delrmn = sparse(row, col, 0, M, N);% diff of msgs from checks to bits rmn0 = sparse(row, col, 0, M, N);% msgs from checks to bits (p=0) else // Insert 3 lines after if statement here qn0 = 1-r;% pseudoposterior probabilities qn1 = r;% pseudoposterior probabilities Thanks

    Read the article

  • How to ignore moved lines in a diff

    - by klickverbot
    I am currently working on a source code generation tool. To make sure that my changes do no introduce any new bugs, a diff between the output of the program before and after my changes would theoretically be a valuable tool. However, this turns out to be harder than one might think, because the tool outputs lines where the order does not matter (like import statements, function declarations, …) in a semi-randomly ordered way. Because of this, the output of diff is cluttered with many changes that are in fact only lines moved to another position in the same file. Is there a way to make diff ignore these moves and only output the lines that have really been added or removed?

    Read the article

  • Diff and ignore lines missing in one file

    - by Millianz
    I want to diff two files and ignore lines that are present in one file but missing in the other. For example File1: foo bar baz bat File2: foo ball bat I'm currently running the following diff command diff File1 File2 --changed-group-format='%>' --unchanged-group-format='' Which in this case would produce bar baz as the output, i.e. only missing or conflicting lines. I would like to only print conflicting lines, i.e. ignore cases where one line is missing from File2 and is present in File1 (not the other way around). Is there any way to do something like this using diff or do I have to resort to other tools? If so, what would you recommend?

    Read the article

  • How to ignore moved lines in a diff

    - by klickverbot
    I am currently working on a source code generation tool. To make sure that my changes do no introduce any new bugs, a diff between the output of the program before and after my changes would theoretically be a valuable tool. However, this turns out to be harder than one might think, because the tool outputs lines where the order does not matter (like import statements, function declarations, …) in a semi-randomly ordered way. Because of this, the output of diff is cluttered with many changes that are in fact only lines moved to another position in the same file. Is there a way to make diff ignore these moves and only output the lines that have really been added or removed?

    Read the article

  • How do I prevent a curve snapping to a straight line in Flash CS4?

    - by Kelix
    I am trying to do some vector drawing in Flash but am having trouble when "curving" lines. At the moment, unless the curve is significant, it snaps back to a straight line meaning I am finding it impossible to draw shallow curves. Any idea how to turn this snapping off? I have tried turning everything off in View Snapping and it makes no difference.

    Read the article

  • Changing the background colour of lines in the stack

    - by Mongus Pong
    I have just changed the colour scheme of my Visual Studio 2008 environment to have a dark backround with light text. This is so much easier on the eyes. The only problem is lines that are on the call stack... Those lines that are referred to in this thread here in visual studio some lines of code have light grey background while debugging These lines have a bright grey background, which against my light text means I cannot read the text at all. I have been through every single colour in Tools - Options - Fonts and Colours and cannot find one that matches. How can I change the background for lines on the current call stack?

    Read the article

  • Truncate text if it atempts to run into three lines

    - by Jigs
    I have a small about 140px wide aligned next to a picture. In total there is space for four lines of text. The first two lines are reserved for the title and there are two lines of other info. I want the title to be cut if it spans more than two lines else it will push the other info out of line with the bottom of the image. The only solution I could think of was to create a div the height of two lines with an overflow to hidden. However, if the title is only one line it leaves a big gap. The solution can be Jquery, plain javascript, CSS or even PHP (if its possible). TIA

    Read the article

  • Approximate photo of a simple drawing using lines

    - by user3704596
    As an input I have a photo of a simple symbol, e.g.: https://www.dropbox.com/s/nrmsvfd0le0bkke/symbol.jpg I would like to detect the straight lines in it, like points of start and ends of the lines. In this case, assuming the top left of the symbol is (0,0), the lines would be defined like this: start end (coordinates of beginning and end of a line) 1. (0,0); (0,10) (vertical line) 2. (0,10); (15, 15) 3. (15,15); (0, 20) 4. (0,20); (0,30) How can I do it (pereferably using OpenCV)? I though about Hough lines, but they seem to be good for perfect thin straight lines, which is not the case in a drawing. I'll probably work on binarized image, too.

    Read the article

  • Print the next X number of lines in Scala

    - by soulesschild
    Trying to learn Scala using the Programming in Scala book and they have a very basic example for reading lines from a file. I'm trying to expand on it and read a file line by line, look for a certain phrase, then print the next 6 lines following that line if it finds the line. I can write the script easily enough in something like java or Perl but I have no idea how to do it in Scala (probably because I'm not very familiar with the language yet...) Here's the semi adapted sample code from the Programming in Scala book, import scala.io.Source if(args.length>0) { val lines = Source.fromFile(args(0)).getLines().toList for(line<-lines) { if(line.contains("secretPhrase")) { println(line) //How to get the next lines here? } } } else Console.err.println("Pleaseenterfilename")

    Read the article

  • Adding tail behaviour where enter adds blank lines to less

    - by gonvaled
    I love less, which I can use to follow logs with the +F flag (or the ShiftF hotkey), search forwards and backwards, and generally move freely through the document. But there is one thing missing in less: usually I am at the end of the file, and I want to see new things happening. In tail -f I would just hit enter several times, and new log lines would just appear clearly separated from old lines. Is it possible to add this to less? How?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >