FAQ Database Discussion Community


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 ...

How to change text based on time and date?

android,android-layout,text,countdown,android-cardview
So I need one of two options but don't know where to start with either. I have a list card views in a recyclerview. Each card view needs to have countdown timer implemented and able to run simultaneously. (Seems like the harder option) OR Update the text in a card...

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...

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 . ...

RichTextbox write in place to current line

c#,text,visual-studio-2013,richtextbox
Clarification: I want to output line of text to the same "position" in a RichTextBox, replacing the previous line. In C# Windows Forms Application trying to use RichTextBox for displaying messages. Most of the messages are appended, so that is fine but at one point in the program it has...

How do I make the text of one label node take up 2 lines?

xcode,string,swift,text,sklabelnode
I have this text below that is too long to fit on the screen when it runs. How can I make this 2 lines rather than one? myLabel.text = "The weather today is going to be partly cloudy with a chance of rain" ...

SQL Server - Join Table1 to Table2 ON substring(T1.Field) = T2.ID

sql-server,text,substring,inner-join,patindex
I have two tables: MyOrders and MyDrivers. In table MyOrders, I have a column called Details (datatype TEXT - I know, but I didn't build the database...) In MyOrders.Details, there are sometimes comma-separated lists of numerical values which correspond to the ID values of table MyDrivers. The goal is to...

how to change text direction to the right slide of switch in android?

android,text,switch-statement
In default mode , text of a Switch sit on the left side of ON/OFF states. i want to change direction of this text to the right slide. how can i do this? I already try this xml code but not working: <Switch android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/switch1" android:layout_gravity:"right" android:layout_margin="@dimen/abc_dropdownitem_text_padding_right" /> ...

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...

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...

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...

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 {...

Get string (file name) of a given extension from within a text file

c#,string,file,text
I apologize if the question title is a little confusing, but let's say a text file contains the following data: Sample 'Line1 1 'Line2 2 'ProjectCount FileA.ext 'Projects( 1) 0 'SortTermCount FileB.ext 'Projects( 2) 0 'SortTermCount ... I know the extension name that exists as a string within the file...

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...

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...

Extract lines from File2 already found File1

linux,text,awk,sed,grep
Using linux commandline, i need to output the lines from text file2 that are already found in file1. File1: C A G E B D H F File2: N I H J K M D L A Output: A D H Thanks!...

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>...

Splitting a text file

python,text,split
I have a folder with a set of text documents. I want to split each document to two or three documents, each one should be 45-70kb. How сan I do it? I tried: def split_file(filename, pattern, size): with open(filename, 'rb') as f: for index, line in enumerate(f, start=1): with open(pattern.format(index),...

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) ? ...

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:...

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...

Python outputs a .txt file, which's format differs depending on the text editor I use to open it

python,text,output
So I have some python code taht outputs some data to a .txt file like this: f3 = codecs.open(r'C:\Users\dimrizo\Desktop\PythonData\GTFS\routes.txt','w+',"UTF-8") f3.write('route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n') f3.write('blah,blah,blah,blah,blah,blah,blah,blah,blah\n') Problem is that if I open the produced file with the simple windows text editor the text is not properly formatted. The "\n" don't even count. If I open...

How to read data separated by a ',' in a text file in C [duplicate]

c,file,csv,text,input
This question already has an answer here: Reading CSV from text file in C 4 answers I was wondering how to read data from a text file that has its data separated by a comma; for example line 1 of the text file says: (Name,Integer,Integer). So I tried using...

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...

Corona sdk not view random text

text,random,lua,corona
I'm have a problem because when I touch my button sometimes my text doe not appear and I do not understand what is wrong. Code: function randomText(event) display.remove(mmDis) local a = {"Cristiano ronaldo jest najlepszy!", "messi jest dobry!","lewandowski jest ok","diego lopez to bramkarz realu"} com = (a[math.random(1,#a)]) local mmDis =...

JQuery add a whitespace to each new text node to prevent clumping on extraction

jquery,text,whitespace
What I do is I want to transform <div id=master> Blah <span id=crap>Blah1</span> <div id=crap2>Blah2</div> <b>Blah3</b> </div> to <div id=master> Blah <span id=crap> Blah1 </span> <div id=crap2> Blah2 </div> <b> Blah3 </b> </div> because when I extract all the text from all elements inside master it becomes looking like this...

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...

Save user input into a Text widget Tkinter when using classes

python,text,tkinter
I want to know how to save text entered by the user in a Text widget when pressing a "submit" button. At the moment, I have the function submitbutton but it comes up with an error when clicking "submit." On another note, I want the top right Label widget to...

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...

Changing a read-only file [on hold]

python,text
I need to change text documents. The way I've been doing it is making a new file, copying everything line by line from the old file and making changes on the way, then saving the new file as the old file's name. This becomes a problem when I only have...

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...

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 =...

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...

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.

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():...

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...

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)...

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:...

Read lines of a text file into an array

java,android,arrays,file,text
I would like to display a new quote randomly every time someone launch the app.In order to do that I was thinking of using a text file containing all the quotes, one at each line. I would like to know in android studio where should I put my text file...

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...

HTML make your own