FAQ Database Discussion Community


Splitting a text line into separate lines from command line

text,split,command
What are some simple options to split a single text line into separate based on a character or pattern? I would like to do this from the command line. An example would be when you want to inspect the PATH. With a single simple command I'd like to split something...

Parsing text file lines into numbers using std::iter::Iterator map

file,text,io,rust
I'm trying to read and parse a text file in Rust. Each line is a signed integer. I'm able to do it using for line in lines iteration but I'm unable to do it with a iter().map(|l| ...) one-liner. I'm getting a expected `&core::result::Result<collections::string::String, std::io::error::Error>`, found `core::result::Result<_, _>` when I...

Delete the extra space after special character in all the lines of text file

bash,shell,text,awk,sed
Following data represents 2 lines of text file: 1 2340: 2 1930: 1 1 9: 3 4501: 1 45: 1 5620: 2 I want to delete the space after ":". So the output of above text file should be 1 2340:2 1930:1 1 9:3 4501:1 45:1 5620:2 ...

Align rows in text file with command line

text,command-line
I have data in a text file where data rows are repeated after several columns and each new block shares the first column of row labels. I'd like to use the command line to get align the rows into a single table. The data text file looks like: Values SampleA...

Trying to get just the text from a node with filter(), but is returning an object?

javascript,jquery,dom,text
I am simply trying to extract the text without any of the elements from a DOM node with var textIWant = $('.classname').contents().filter(function(){ return this.nodeType === 3; })[1]; This returns to me what looks like a string in the console, something untrimmed like.. " text I want " so when I...

Keyboard Keys to Paste Text with AutoHotKey

text,keyboard,autohotkey,paste
I am using AutoHotKey software to change the use of some buttons. It helps a lot especially if you want to open programs without having to find the shortcuts and click on them. All I want now is to save a specific text (with paragraphs) in some F keys. For...

Can I put StreamReaders in a list? Or any other way to read a lot of text files at once?

c#,list,text,streamreader
I have a lot of text files and want to read them all by once, how do I do this? This is my code till now: List<StreamReader> lijst = new List<StreamReader>(); using (StreamReader qwe = new StreamReader("C:\\123.txt")) using (StreamReader qwer = new StreamReader("C:\\1234.txt")) lijst.Add(qwe); lijst.Add(qwer); But I get an ObjectDisposedException(Cannot...

Add blank line before a certain phrase in a text file in Linux?

linux,text,grep,kali-linux
I'm using Kali Linux, trying to sort out some input from Nmap. Basically, I ran a scan from NMap, and need to extract specific pieces of information from it. I've got it to show everything I need using the following command: cat discovery.txt | grep 'Nmap scan report for\|Service Info:...

How to tell Users that a Tooltip lies behind a Text/Textbox/Image, etc.?

windows,user-interface,text,tooltip,user-experience
In my U.I. I have a normal text headline that covers a block of checkboxes but without further information I'm scared of Users not knowing what to do with the window. So my idea was to put a tooltip in the headline to give Users information about the funktion of...

Is it possible to change ONE line in a txt file WITHOUT reading and writing the whole file (Java)?

java,file,text,replace,line
Say I have a text file: I love bananas. <age> 23 </age> years old. I like beaches. All I want to do is open said file and change the age to 24 or 25. Any way to do that in Java WITHOUT reading a writing the whole file? I know...

Error: Getting symbols in python output

python,python-2.7,text,file-io,editor
#I wrote the following code for making a text editor. print "This is a simple text editor" from sys import argv script, name = argv print "You have selected the file : %s" %name print "Opening the file...." t = open(name, 'r+') print "The contents of the file are" print...

Text justification C language

c,text,alignment
I have to solve a problem that involves left justification string length and leading zeros. I have the following table : BEGIN CLOSE CONCATENATE DELETE END INITIALIZE PRINT WRITE This is produced by a simple program. My problem is to find out how to convert it like that : It...

To make a particular part of my text clickable

android,redirect,text,clickable
I'm tring to make a particular part of my text clickable. Please see the below image for example: In this image "www.google.com" is placed inside an expandable listview. Can anyone please help me how I can make this text clickable so that it re-directs to its corresponding web page ArrayList<String>...

How to provide default font height or content when

or has no characters?

javascript,html,css,text,height
This started with one question similar to this one in here: HTML <p> and <span> questions . And ended with 3... I want to understand why the following happen. Starting with this example: A <p> element without any special CSS rule on it has no text when the page is...

Powershell Reading text file

powershell,text,text-files
I'm just wondering if it's possible to read the content of text file with specific index? What I mean is like this, for example: I have text file like this, 'test1.txt' 12345678900 ## ## readthistext 54321123440 ## ## hellothistext I just want to read the content of text file after...

Forcing RTL order in a JTextArea

java,text,bidirectional
I am trying to force a JTextArea (and other text components through my application) to allow users to type RTL. This works correctly for input such as Arabic, but I must also be able to set it to apply this to standard text. Therefore, if I type "hello!" it will...

Removing the blank positions (x,y) from a text file in Python?

python,text
I'm working on object tracking from video files, I have 5 to 6 objects in each frame of the video. Due to some bugs in the code there are some frames that are skipped and show as blank spaces in the text file . Like below 5.0 2.3 5.4 5.2...

Select/mark specific word in SWT Textfield

java,text,widget,swt
I've got an SWT Textfield with some text which is added automatically. Now I want to select a specific phrase in the text automatically, so that the user could replace this without the manual selection. But all I've found in the api is the selectAll() method, which works but selects...

Input boxes not lining up

html,css,text,input,form-submit
I'm new to HTML and last time I've been editing my code I found that my input boxes don't align perfectly. I want them to be just in line on right. Here is the code: input { margin: auto; padding: 25px; font: normal 15px Verdana, Tahoma, sans-serif; width: 100%; border-left:...

Why is this basic python program not working?

python,email,text,organization
Well the program is supposed to check if the it sees an "ok" next to the email and if it does spit out the email in another txt file. Input txt file: [email protected],ok [email protected],fail [email protected],fail [email protected],fail [email protected],ok [email protected],fail [email protected],fail [email protected],ok python code is: readEmails = open("C:\\Users\\Greg\\Desktop\\rewriteEmails.txt","r") writeEmails = open("C:\\Users\\Greg\\Desktop\\OutputEmails.txt","w") for...

x axis text overlapping in matlab

matlab,text,overlap
My x axis text are overlapping. I am using this code-- clear all A=[1 2 3 4 5 6 7]'; b=1:length(A); figure(1) bar(A) title('Loss Diagram') xlabel('Loss factor') ylabel('kWh/year','fontsiz`enter code here`e',20) grid on set(gca,'Xtick',b,'XtickLabel',{'Horizntl Global Irr. ' 'Effective irr. on coll. ' 'Array nominal energy ' 'PV module loss ' 'charge...

Replace bigrams based on their frequency in Scala and Spark

scala,text,apache-spark
I want to replace all bigrams which their frequency count is greater than a threshold with this pattern (word1.concat("-").concat(word2)), and i've tried: import org.apache.spark.{SparkConf, SparkContext} object replace { def main(args: Array[String]): Unit = { val conf = new SparkConf() .setMaster("local") .setAppName("replace") val sc = new SparkContext(conf) val rdd = sc.textFile("data/ddd.txt")...

Launch default SMS app without a message

android,android-intent,text,sms,message
I am wanting my app to, on a button click, launch the user's default texting app. The intention is not to have the user send a message, but to view their current text conversations, therefore I don't want it to launch the SMS app's "New Message" activity but instead the...

Verilog Input Text Parsing using Python Regex

python,regex,text,extract,verilog
so I'm trying to parse some verilog files using python. I need to find inputs, outputs, etc. However, in some files, some inputs and outputs have multiple bitwidths, like so: input read_enable, input [WIDTH-1 : 0] write_data, I'm using regular expressions to go through the text file one line at...

text show and hide with button php/js

php,jquery,text,hide,show
How can I apply the multiple texts? With a text it works: <dl> <dt> <img class="empfehlung-bild" style="max-width: 300px; height: auto; float: left; margin-right: 15px; margin-bottom: 15px;" src="<?php echo $bild; ?>" /> <h1><?php echo $title; ?></h1> <p> <?php echo $text; ?> </p><br/> <button id="<?php echo $i; ?>" style="float:right;">Details</button><br/><br/> </dt> <dd style="float:left;">...

Change Font Color on Overflow

css,text,fonts,colors,overflow
This is where I am trying to accomplish this effect: http://www.smalldot.agency/ccren/goals-page/ As the "val" bar increases in width, it should overlap the "current" text ((which is the same text as "val" but a different color)). I am able to force "current"'s copy on top of the "val" element, but I...

jQuery Make Text Change Before It's Noticeable

javascript,jquery,html,dom,text
I'm using the following code to make a text change on a website: jQuery(document).ready(function() { jQuery('div#sidebar ul.side-nav li.current_page_item a').text('Request a Quote'); }); The problem is, the change is done until AFTER the webpage has finished loading, so the user actually gets to see what was the original text before the...

resize/scale text dynamically in andengine

android,text,andengine
I created a simple game where move the objects from one place to another and each moves increment count of moves in score table. After all objects are moved correct I want set opacity to screen and slowly resizing score from initial size(e.g. 15px) to whole screen(e.g. 50px). I load...

Characters arbitrarily being changed

html,text,character,rendering
I've came across this issue where the browser (Chrome) is sometimes rendering characters as completely different ones, however in inspect element they're written how they should be. You'll see in the images that on the right inspect element shows what it's supposed to be, and on the left shows what...

Javascript show / hide on click multi ID

javascript,text,show-hide
Im work with this script : I want to show/hide text on click, with a single id it works great ( add a fade animation will be great ) but I'm not able to add another ID .. someone could help me ?! THANKS function showHide(shID) { if (document.getElementById(shID)) {...

OutOfMemory exception thrown while writing large text file

c#,text,out-of-memory,file-writing
I want to generate a string and then write it in to a .txt file. The problem is I get OutOfMemory exceptions when I attempt to do so. The file is large (about 10000 lines). I use String.Format and loops to create the string. How can I write this to...

Reading text file and dealing with numbers

matlab,for-loop,text,binary
I'm attempting to count the number of letters in a text file, but unfortunately I keep getting stuck if numbers are involved. So far I have been able to deal with letters and symbols, but unfortunately the ischar function doesn't help me when it comes to numbers. function ok =...

The variable 'buff' is being used without being defined

c,arrays,text,runtime
I need to read some data from text file and store it in 2D-array. This code works good: #include <string.h> #include <stdio.h> int main() { FILE *f = fopen("Read.txt", "r"); char buff[100][100]; char str[100]; int i = 0; while(fgets(str, 100, f)) { strcpy(buff[i], str); i++; } return 0; } But...

Parsing html using Selenium - class name contains spaces

python,html,parsing,selenium,text
I'm trying to parse some html using Selenium. The problem is that it raises error in case the class name contains spaces. Here is the tag I'm searching for: <p class="p0 ng-binding">text</p> I've tried these two options: result.find_element_by_class_name('departure').find_element_by_css_selector('p.p0 ng-binding').text result.find_element_by_class_name('departure').find_element_by_class_name('p0 ng-binding').text >>> selenium.common.exceptions.InvalidSelectorException: Message: The given selector p0 ng-binding is...

Python - Select specific value from test file

python,file,text
I'm absolute beginner in python, and I'd like to get field i.e. from 2nd column, 3rd row from text file like this: 176a AUGCACGUACGUA ACGUA AGUCU 156b GACUACAUGCAUG GCAUA AGCUA 172e AGCUCAGCUAGGC CGAGA CGACU (text is separated by spaces). is there any simple way to do that?...

How do i split text to a different column or remove a text from the original column?

excel,vba,excel-vba,text,split
I've copied a column of data starting from D9 to D-whatever, the copied data have both decimal value and text. The data varies in each cell in column D Example D9 : 1675.87 L/s D10 : 1555.87 L/s D11 : 1635.87 L/s This is my code i tried.. Dim c...

Replace text between two special characters

regex,r,text,replace
I have a character vector as: x<- "\t\t<taxon id=\"TOT_F50\"/>" and y<- "TOT_A01" and I want replace TOT_F50 with the text in y ("TOT_A01"). Do you know how to replace the text between " and \ (i.e. "TOT_F50) ? ...

c++ gives Segmentation Fault from text file of all 0's

c++,text,zero,fault
I'm writing a really simple code (or so I thought) that requires 2 text files to be read in. One is full of a bunch of data points (of type double) and the other one happens to be a bunch of 0's (this is only SOMETIMES filled with 0's, sometimes...

Display Popup when text is clicked in wordpress

wordpress,text,popup,wordpress-plugin
I have a Html code In wordpress.: '<a href="">example</a>' When this "example" is clicked, it needs to show a popup window with some texts. i came across some wordpress popup plugins like uji popup,etc.. they given some short codes. how can i use this shortcodes into my "href". or any...

Stop text from leaking out of div [on hold]

html,css,text
I have some text which is contained in a div, however if it's too long, it leaks outside of the div and I don't want that. I dont want to use the overflow attribute and give it a scroll bar. Id like it to put the "..." at the end...

Reading text file in java using scanner

java,file,text,java.util.scanner
I am a beginner. Reading from text file in Java using a scanner. This code just to read the first 3 tokens isn't working: try{ Scanner scFile = new Scanner (new File ("readhere.txt")).useDelimiter("#"); String first = scFile.next(); String second = scFile.next(); int third = scFile.nextInt(); // error here. Why cant...

StreamWriter not appending to file, instead creating a new file in different directory

c#,file,text,file-io,streamwriter
I am attempting to write from one file to a temp file after making certain changes to some of the data in the source file. This was working until I extracted this logic into its own function. After running some tests I noticed that only the first line was being...

Batch - Comparing two txt files

windows,batch-file,text,comparison
I have some difficulties comparing two txt files with batch. I used the "findstr" function with many option matchings but none works (for example FINDSTR /I /V /B /G:file1.txt file2.txt). I have a first txt file as following: File1.txt Object 1 Argument 50 Object 2 Argument 10 Object 3 Argument...

Read text file from specific position and store in two arrays

c#,arrays,file,text
I have text file which contains line like this: @relation SMILEfeatures @attribute pcm_LOGenergy_sma_range numeric @attribute pcm_LOGenergy_sma_maxPos numeric @attribute pcm_LOGenergy_sma_minPos numeric... Where are about 6000 lines of these attributes, after attributes where are lines like this: @data 1.283827e+01,3.800000e+01,2.000000e+00,5.331364e+00 1.850000e+02,4.054457e+01,4.500000e+01,3.200000e+01... I need to seperate these strings in two different arrays. So far...

Change ID in File

java,file,text,path,rename
Let's say I have this notepad file name: Company_XXX_768_JGH.txt Contents: Random Text Blah Blah Blah Network ID: 80801568 I need to change the ID last 4 numbers (1568) to (0003). So far I am able to read the whole, find the line with the number AND print a statement for...

Making 3 columns of text aligned at the same height or line all the time even while re sizing window

html,css,text,alignment,height
CSS: I want to make 3 columns of text aligned at the same height or line all the time even when I resize the window. To illustrate what I am talking about please take a look at the images by following this link: https://drive.google.com/file/d/0BywbaHflqMTERFVrNF84YlBUbTg/view?usp=sharing The problem is that the third...

Python multiple pairs replace in txt file

python,text,substitution
I've got 2 .txt files, the first one is organized like this: 1:NAME1 2:NAME2 3:NAME3 ... and the second one like this: 1 1 1 2 2 2 3 What I want to do is to substitute every line in .txt 2 according to pairs in .txt 1, like this:...

How to change content of unity text?

user-interface,text,unity3d
I create an application on unity3d. I use Unity 5.0.2f1 (64-bit). I create a new project and add an empty gameobject. I click gameobject and add a gui text from inspector. My gui text is below : I want to change the contenf of this text at each frame. I...

Reference a Text File with relative path in Java with the IntelliJ IDEA

java,text,relative-path
I have a program that reads numbers from a .txt file. My problem is where to place this file, or how to reference it with a relative path to make this file accessible without using the absolute path.

Python: iteration problems

python,text,iteration
I am performing text processing on a text file and have been trying to iterate into a for loop. fields = [1, 2, 3, 4, 5] i = 0 with open('file path', 'r') as f: for line in f: # while i is smaller than the number of fields (=5)...

How can I wrap text in QGraphicsItem?

qt,text,word-wrap,qgraphicsitem
1) How can I wrap text in a QGraphicsTextItem to fit a fixed rectangle, with width and height ? Right now I am experimenting with creating a text, getting its bounding rectangle, and resizing it to fit the box - but I can't get wrapping. class TTT: public QGraphicsTextItem {...

search string in textfile [on hold]

c++,c,string,text
Say you have a text file like this all you want from the text is the "size value" but repeats more that thousand time with different value "field_pic_flag : 0 bottom_field_flag : 0 idr_pic_id : 0 Found NAL at offset ,size 28813 !! Found NAL" "field_pic_flag : 0 bottom_field_flag :...

Merge Text Files and Prepend Filename and Line Number - Powershell

powershell,text,powershell-v3.0
I've been trying to adapt the answer to this question: powershell - concatenate N text files and prepend filename to each line My desired output based on an example of 2 .txt files: First.txt lines of data Second.txt more lines of data Output.txt First1 lines of First2 data Second1 more...

Php style show function

php,text,show
Hi guys I want that on click of the button "show" the following inputs became visible, can someone help me? <input id="show"type="submit" value="change" > <input id="oldpass"TYPE="text"value="" style="display: none"> <input id="newpass"TYPE="text"value="" style="display: none"> <input id="cambia"TYPE="submit"value="" style="display: none"> ...

Edit Manager activePoint “Y” Position ActionScript3

actionscript-3,flash,text
I'm working with TextFlow and EditManager in AS3 (flashx.textLayout) I want to know how get ActivePosition pointer "Y" position, I know I can get activePosition from EditManager but it's returns character position. I want to count if activePosition out of screen, then scroll down (text is larger and its out...

Advancing text in a text file using user input

java,text,user-input
So in my first year of college for my christmas project I needed to make a basic game using if statements, I chose a text adventure but me being a novice I chose to write out every print out: System.out.println("You approach the two cupboards one on the right and one...

How can I get common rows that exist in at lest two files or more?

bash,text,text-files
I have seven test files. They look like following File 1 chr start end strand chr1 10525 10525 + chr1 10542 10542 + chr1 10571 10571 + chr1 10577 10577 + chr2 10589 10589 + chr2 565262 565262 + chr2 565397 565397 + chr3 567239 567239 + chr3 567312 567312...

Canvas draw text verticaly

java,android,text,android-canvas,draw
So, I have put everything I need how i need to be, my bitmaps, backgorunds and everything, what I need is to draw text that will be vertically shown. Here is my code for now: private void drawTables(Canvas canvas) { for (Table table : mTablesList) { float x = mWidht...

how can I add text to these rectangles?

python,text,menu,pygame,python-3.4
This is the code I have started to use to make a start menu. # we need some colours!! black = (0,0,0) white = (255,255,200) red = (200,0,0) green = (0, 200, 0) bright_red = (255, 0 ,0) bright_green = (0, 255, 0) bright_white = (255, 255, 255) def main():...

Make text appear on hover

html,css,text,hover
So I need the text to appear on hover over the image (it doesnt have to be a link if that is too difficult) html <div id="con"> <div id="box1"> <p id="text1"> <a href="url">DESTINATION</a>SS </p> </div> css #con { width:1024px; height:670px; background-color: #161717; } #box1 { float:left; font-size:25px; width:388px; height:477px; background-image:...

How to remove numbers from text in Scala?

regex,scala,text,apache-spark
How to remove numbers form a text in Scala ? for example i have this text: canon 40 22mm lens lock strength plenty orientation 321 . after removing : canon lens lock strength plenty orientation . ...

How can I map keys in Insert mode that contains Carriage Return in it?

vim,text,insert,editor,vi
How can I map ctrl + enter to go to new line from anywhere in the current line in vim ? I just want to do it for insert mode. I tried :set <C-<CR>> <Esc>o but that doesn't seem to work....

HTML make your own