Can I find all music files on computer with electron? [closed] - electron

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I'm thinking about making music player for linux but i'm not sure if it's possible to find all music files and what should i use for that.

You can achieve this using node's walk package.
You'll want the user to select a folder where music is stored because it would take a lot of time to search through every directory on user's machine and find .mp3 files.
It is pretty well documented. It takes the path to the selected folder and loops through all files. Pretty straightforward.
something like this might work
const walk = require('walk');
const files = []
const walker = walk.walk("music/", { followLinks: false });
walker.on('file', function(root, fileStats, next) {
// Add file to the list
files.push(root + '/' + fileStats.name);
next();
});
walker.on('end', function() {
console.log(files);
});

Related

How to render write complex mathematics equations in nativescript-vue? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
There is this plugin (https://github.com/zzish/react-latex#readme) that renders LaTex in React. Is there a way to use a similar plugin in NativeScript-Vue?
Firstly, that is a React component and not a ReactNative component. That component is a wrapper to Katex, which renders LaTex to HTML.
A way to use it NativeScript-Vue is to render LaTex to html render it in a <WebView>, like so:
<template>
...
<WebView :src="exprHtml" height="100"/>
...
</template>
<script>
...
mounted() {
this.exprHtml = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
throwOnError: false
});
}
</script>
You can find a working playground example here.
Note that the <WebView> component is like a mini browser added inside your app. Don't add too many of them in a single screen.

Has anyone developed a tool for checking app for Retina images? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Has anyone developed a tool to scan an iOS app directory to assure that all .png images have matching #2x.png images? I could muck around for 2-3 hours and develop a Java app to do it. However, while I'm not at all good with shell scripts, I figure it can probably be done in a few lines of shell script (and I'm happy to give one of you guys the opportunity to demonstrate your brilliance doing it :-)).
Here's a quick shell script. This even handles images with ~ipad or ~iphone suffixes.
#!/bin/bash
for img in `find . -name '*.png' | grep -v "#2x"`; do
noext=${img%.png}
suffix=
base=${noext%~ipad}
if [ "$base" != "$noext" ]; then
suffix="~ipad"
else
base=${noext%~iphone}
if [ "$base" != "$noext" ]; then
suffix="~iphone"
else
base=${noext}
fi
fi
retina="${base}#2x${suffix}.png"
if [ ! -f $retina ]; then
echo "Missing $retina"
fi
done
Run this from the root of your project and it will check every image found.
I just found a problem with one of my images. I had the #2 but no x.
Update: I just started playing with python. Here's the same script written in python:
#!/usr/bin/python
import fnmatch
import os
for root, dirnames, filenames in os.walk('.'):
for filename in fnmatch.filter(filenames, '*.png'):
if filename.find('#2x') == -1:
noext = filename[:-4]
suffix = ''
base = noext
if noext.endswith('~ipad'):
suffix = '~ipad'
base = noext[:-5]
elif noext.endswith('~iphone'):
suffix = '~iphone'
base = noext[:-6]
retina = os.path.join(root, base + '#2x' + suffix + '.png')
if not os.path.exists(retina) :
print('Missing ' + retina)
i've used slender for that in the past

How to iterate line by line through a .docx file using apache POI [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
My object is to read a .docx file and to display the text of that on the view(Webpage).
I am using apache POI to read a .docx file in Grails Application
Please suggest me a way to display the output on view without loosing Blankspaces and LineBreaks.
My .docx document content
This is a .docx document ...
this is second line
this is third line
Result on Groovy console after reading when i am printing :
This is a .docx document ...
this is second line
this is third line
But when i pass the output to view It becomes
This is a .docx document ... this is second line this is third line
.
My code is :
import org.apache.poi.xwpf.usermodel.XWPFDocument
import org.apache.poi.xwpf.extractor.XWPFWordExtractor
...
String str = "E:\\Query.docx"
File docFile = null;
docFile = new File(str);
FileInputStream fis=new FileInputStream(docFile.getAbsolutePath());
XWPFDocument doc = new XWPFDocument(fis)
XWPFWordExtractor docExtractor = new XWPFWordExtractor(doc)
println docExtractor.getText()
...
if one can suggest me the way to iterate through each line of the document then i can easily get my result.
Please help me i have got stucked.
HTML ignores line breaks. So, while a string like "Hello there\nLine 2\n" renders fine in the console as
Hello There
Line 2
As HTML it'll all show on the same line. You'll need to replace the newline characters with some suitable HTML, eg <br /> or wrapping things in paragraph/div tags.

Choosing the right IOS XML parser [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
There are a million different XML parsers for the iPhone. I have a medium sized XML file that contains alot of duplicate tags (at different points in the hierarchy). I was thinking about TBXML but I was concerned about its lack of XPath support. For instance lets say my XML file looked like this.
<blog>
<author> foo1 </author>
<comments>
<comment>
<text>
<![CDATA[ HTML code that must be extracted ]]>
</text>
<author>foo2</author>
</comment>
<comment>
<text>
<![CDATA[ Here is another post ]]>
</text>
<author>foo1</author>
</comment>
</comments>
</blog>
Basically my requirements are that I need to be able to extract that cdata. And know whether it is the blog author a comment author.
Best comparison I've seen on the subject:
http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
The difference between the slowest and fastest parsers in his case was a factor of 2. Depending on your feature requirements, there are definitely parsers that can cut your parsing time in half.
Check out RaptureXML. It's not official XPath behavior, but it's pretty close. Your query would be:
[rxml iterate:#"comments.comment" with: ^(RXMLElement *e) {
if ([[e child:#"author"].text isEqualToString:#"foo1"]) {
NSLog(#"Blog Text is %#.", e.text);
} else {
NSLog(#"Comment Text is %#.", e.text);
}
}];
UPDATE: RaptureXML now supports XPath!
You should look at these libraries, in order :)
Ono, powered by libxml2
XMLDictionary
RaptureXML
Ono has the the cool AFOnoResponseSerializer which can be integrated with AFNetworking
I made this new simple and lightweight XML parser for iOS in Swift - AEXML
You can use it to read XML data like this:
let someValue = xmlDocument["element"]["child"]["anotherChild"].value
or you can use it to build XML string like this:
let document = AEXMLDocument()
let element = document.addChild("element")
element.addChild("child")
document.xmlString // returns XML string of the entire document structure
I hope it will be useful for someone.
As you have requirement for medium sized XML
TinyXML could be an good choice for medium sized documents if you already have experience with the API and are comfortable with C as it ports quite easily over to the iPhone.
For More information you can go through this link

Need an API to find a full company name given a ticker symbol [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I need a way from within client-side Javascript to find a full company name given a ticker symbol. I am aware of Yahoo Finance's interface at:
http://finance.yahoo.com/d/quotes.csv?s=TKR&f=n
and am able to access that via YQL (since this is cross-domain). However, that doesn't return the full company name, yet Yahoo Finance has such because it appears in their charts for the company and on their pages about the company.
I don't need for the solution to be via Yahoo Finance... just mention it here as I already know about it (and am accessing it for other data).
One of the community-provided YQL tables looks like it will work for you: yahoo.finance.stocks.
Example YQL query:
select CompanyName from yahoo.finance.stocks where symbol="TKR"
Update 2012-02-10: As firebush points out in the comments, this YQL community table (yahoo.finance.stocks) doesn't seem to be working correctly any more, probably because the HTML page structures on finance.yahoo.com have changed. This is a good example of the downside of any YQL tables that rely on HTML scraping rather than a true API. (Which for Yahoo Finance doesn't exist, unfortunately.)
It looks like the community table for Google Finance is still working, so this may be an alternative to try: select * from google.igoogle.stock where stock='TRK';
I have screen scrapped this information in the past either using Yahoo Finance or MSN Money. For instance you can get this information for ExxonMobil by going to (link). As far as an API you might need to build one yourself. For an API checkout Xignite.
You can use the "Company Search" operation in the Company Fundamentals API here: http://www.mergent.com/servius/
You can use Yahoo's look up service using Jonathan Christian's .NET api that is available on NuGet under "Yahoo Stock Quotes".
https://github.com/jchristian/yahoo_stock_quotes
//Create the quote service
var quote_service = new QuoteService();
//Get a quote
var quotes = quote_service.Quote("MSFT", "GOOG").Return(QuoteReturnParameter.Symbol,
QuoteReturnParameter.Name,
QuoteReturnParameter.LatestTradePrice,
QuoteReturnParameter.LatestTradeTime);
//Get info from the quotes
foreach (var quote in quotes)
{
Console.WriteLine("{0} - {1} - {2} - {3}", quote.Symbol, quote.Name, quote.LatestTradePrice, quote.LatestTradeTime);
}
EDIT: After posting this I tried this exact code and it was not working for me so instead I used the Yahoo Finance Managed Api however it's not available via NuGet. A good example of use here
QuotesDownload dl = new QuotesDownload();
DownloadClient<QuotesResult> baseDl = dl;
QuotesDownloadSettings settings = dl.Settings;
settings.IDs = new string[] { "MSFT", "GOOG", "YHOO" };
settings.Properties = new QuoteProperty[] { QuoteProperty.Symbol,
QuoteProperty.Name,
QuoteProperty.LastTradePriceOnly
};
SettingsBase baseSettings = baseDl.Settings;
Response<QuotesResult> resp = baseDl.Download();
Also if you just want to download the stuff stocktwits api has a download link for the symbology and industries under "Resources" http://stocktwits.com/developers/docs
It also possible to use Quandl.com resources. Their WIKI database contains 3339 major stocks and can be fetched via secwiki_tickers.csv file. For a plain file portfolio.lst storing the list of your tickers (stocks in US markets), e.g.:
AAPL
IBM
JNJ
MSFT
TXN
you can scan the .csv file for the name, e.g:
import pandas as pd
df = pd.read_csv('secwiki_tickers.csv')
dp = pd.read_csv('portfolio.lst',names=['pTicker'])
pTickers = dp.pTicker.values # converts into a list
tmpTickers = []
for i in range(len(pTickers)):
test = df[df.Ticker==pTickers[i]]
if not (test.empty):
print("%-10s%s" % (pTickers[i], list(test.Name.values)[0]))
what returns:
AAPL Apple Inc.
IBM International Business Machines Corporation
JNJ Johnson & Johnson
MSFT Microsoft Corporation
TXN Texas Instruments Inc.
It is possible to combine more stocks from other Quandl's resources. See the documentation online.

Resources