text-files

Export Core Data Entity as text files in Cocoa

被刻印的时光 ゝ 提交于 2019-12-02 21:31:17
I have an entity in core data that has 2 Attributes. One that is a string called "name", and another one that is a string called "message". I need a method to create text files for all the attributes that the user has added. I wan't the files names to be the name attribute and the contents to be the message attribute. If anyone knows how to do this any help would be great. Thanks for any help Joshua Nozzi Have you given any thought at all to the steps involved? Create a fetch request (possibly with a predicate if you want to filter the results). Execute the fetch request. If successful ... For

Count number of blank lines in a file

别来无恙 提交于 2019-12-02 18:47:50
In count (non-blank) lines-of-code in bash they explain how to count the number of non-empty lines. But is there a way to count the number of blank lines in a file? By blank line I also mean lines that have spaces in them. Another way is: grep -cvP '\S' file -P '\S' (perl regex) will match any line contains non-space -v select non-matching lines -c print a count of matching lines If your grep doesn't support -P option, please use -E '[^[:space:]]' One way using grep : grep -c "^$" file Or with whitespace: grep -c "^\s*$" file You can also use awk for this: awk '!NF {sum += 1} END {print sum}'

How to make Excel save a file as text, with support for Unicode, and support for multiple lines within a cell (alt-enter)?

微笑、不失礼 提交于 2019-12-02 18:36:35
问题 My application needs to pass data back and forth via text files with Excel. My text files will have Unicode text, and will also need to have some way of indicating mulitple lines within a cell (which I believe is the LF character (ascii 10)). Excel can read my csv file correctly. However, when I save the csv file in Excel, it replaces the Unicode characters with ?'s. So although it still looks fine in Excel, if I close Excel and re-open the file with Excel, I see ?'s instead of my Unicode

Xcode 7.1 beta: Content Of File Error

倖福魔咒の 提交于 2019-12-02 18:33:01
问题 I had just finished the final touches to my swift app. But after upgrading to Beta 7 its giving me errors for the 'ContentOfFile' String. can anyone help me understand how I can go about fixing this please? here's what i've got ATM. //Reads the Text File if var path = NSBundle.mainBundle().pathForResource("Chapters", ofType: "txt"){ //Reads the Text File into one Huge String var data = String(contentsOfFile:path, encoding: NSUTF8StringEncoding, error: nil) //sets String content of the Text

vbscript code to read input from text file avoiding manual efforts

旧街凉风 提交于 2019-12-02 18:20:30
问题 I am drilling down Internet to get Vbscript code, where input is read from text file one per line and pass it to the commands in script. I am just a beginner and need help with this. Basically I am gathering script to get pending patches of servers in our environment. The script looks like below: '# '# ServerPendingUpdates.vbs '# '# Usage: cscript ServerPendingUpdates.vbs {servername} {servername} {servername} {servername} '# If no {servername} specified then 'localhost' assumed '# '# To do:

How to add duplicate keys into the Dictionary

♀尐吖头ヾ 提交于 2019-12-02 18:09:40
I have some lines from text files that i want to add into the Dictionary.I am using Dictionary for the first time.While adding up starting lines it was Ok but suddenly i got error: An item with the same key has already been added Here in my code there are duplicate keys which i can not change.Here is my code in c# Dictionary<string, string> previousLines = new Dictionary<string, string> { }; previousLines.Add(dialedno, line); Here dialedno is the key and line is the textfile line. Here is the code from which i am retrieving the given line based on key. string tansferOrginExt = previousLines

Notepad++: Capitalize first letter by Shortcut?

扶醉桌前 提交于 2019-12-02 17:12:51
I've got a huge list of words (every single word in one line in a txt file) and certain words need to get capitalized manually (e.g. by hand), so I was looking if there's a shortcut in notepad++ (my editor currently) to automatically capitalize the first letter of a line but couldnt find one. Is there none? If not, can you advise me an alternative windows program to quickly do this by using a simple shortcut (so I can go through with the arrow-down key and use the shortcut whenever needed on a specific word)? thanks a lot Placido This can be easily done if the first letters are latin

How to append text to an existing file in Java

落爺英雄遲暮 提交于 2019-12-02 15:05:18
问题 I need to append text repeatedly to an existing file in Java. How do I do that? 回答1: Are you doing this for logging purposes? If so there are several libraries for this. Two of the most popular are Log4j and Logback. Java 7+ If you just need to do this one time, the Files class makes this easy: try { Files.write(Paths.get("myfile.txt"), "the text".getBytes(), StandardOpenOption.APPEND); }catch (IOException e) { //exception handling left as an exercise for the reader } Careful : The above

How can I make a integer for every name in a txt file?

坚强是说给别人听的谎言 提交于 2019-12-02 14:59:43
问题 I have a text file with content like this: Bill, 89 Alex, 64 Dan, 29 , which represents the names of some students and their note. I want to sort them ascending by note, and my idea is to make an integer for every name, for example: int dan = 29; so further I can sort them, but I have no idea how to assign a integer for this names from the text file. Hope you can help because is the first time I make a little bit more complex program. Thank you! 回答1: The problem here is that in C++ (as in C)

How do I get my java program to read Japanese (Unicode encoding) from a text file?

主宰稳场 提交于 2019-12-02 13:33:08
I have followed an example program from the book "Head First Java", chapter 14 page 448-459 Here's a link to the book online though Google Books: Head First Java I made sure that I had Japanese installed as a viewing language on my OS (Windows 7) and I of course have the Japanese IME in order to type in Japanese in the first place. I even saved the text file with a unicode encoding. I'm sure this has something to do with the code because it works properly with only English words. Thank you! The program consists of 3 classes. package chap14; import java.util.*; import java.awt.event.*; import