News for hackers. Stuff that matters.
Re:Ask HN: What is something you do for clients that consist... by Zyst on Monday December 12, 2016 @02:47AM (#13156363)
Most of these seem to be very on the side of "I'm a company", so as a sole developer what I like to do for clients is implementing sockets into their apps.

Adding sockets for, say, the 3 newest logs they get in real time. Or if they have anything that maps to a graph/app-overview just make sure that will always update in real time. It's not a huge time investment for me. Customers usually never request it specifically. But I've found they are blown away when they see how everything is updated in real time. It just makes the whole thing feel 'alive'.

Another thing which I don't personally love, but I do because I understand industries have differences is just exporting whatever can be exported into .csv files or .xls files where applicable.

All in all, I work in consulting. The code I write is meant to make the life of people easier, I want to make sure they get that when possible. A big part of why I'm able to do this is that I have a lot of creative freedom to do whatever I want so long as I'm getting stuff shipped. So huzzah for comprehensive management as well!

Re:Ask HN: What is something you do for clients that consist... by mathw on Monday December 12, 2016 @05:24AM (#13157062)
Oh gosh yes. Companies love their CSV exports! I think the reason is that it lets them make glue - they can take data from something, play with it, analyse it, produce graphs, using tools they understand (almost invariably Excel), and sometimes then import into another system.

Yes, my employer's customers like their CSV imports too. If you're looking at a big data entry feature and they ask you how the interface works and you say "you give it a CSV file with these columns", they're happy.

Re:Ask HN: What is something you do for clients that consist... by vog on Monday December 12, 2016 @08:13AM (#13157781)
You're lucky. We always try to explain that CSV is a mostly-clean format while XLS and XLSX are a mess.

Yet, most of the time customers insist on XLS export, and we are happy if they at least acccept XLSX instead.

Re:Ask HN: What is something you do for clients that consist... by jerf on Monday December 12, 2016 @09:15AM (#13158110)
But CSV isn't a mostly clean format. It's a collection of dozens of formats, some of them clean, some of them not, and with no way of labeling which one of the dozens you have in the file itself. Whereas XLS and XLSX, for all their binary cruft, are at least capable of unambiguously (AFAIK) representing, say, a string with a quote and a newline in it. (If there are encoding issues, well, same with CSV.)

I suspect you're thinking of something like "CSV as outputted by Excel with the default settings", which may be clean and unambiguous, but is far from the only CSV in the world.

For that reason (and I'm just saying this generally, not targeted at the comment I'm replying to), always use the most mature CSV output library you can find for your stack. Never write your own CSV export code by bashing strings together unless you have no other choice because you're working in some stack that doesn't have or can't use existing CSV libraries.

(You can ignore the RFC for CSV too; it's not "wrong", it's just one particular flavor that was declared long after the horses had left the barn, learned to form a horse civilization, discovered the atom bomb and bombed themselves back to being plain horses again. It barely rises to the level of being "advisory" in practice.)

Re:Ask HN: What is something you do for clients that consist... by manyxcxi on Monday December 12, 2016 @09:31AM (#13158214)
XLS and XLSX are neither clear nor unambiguous and I would take 12 CSV formats over either any day. I actually haven't ever met anyone who seriously had to extract data from XLS/X frequently that didn't revile it for its ambiguities. Not to mention the ways that the application munges the user input prior to saving it, leaving the biggest ambiguity of all, what the heck is ACTUALLY in that cell.

EDIT: I will add that EXPORTING to XLS/X is usually quite straightforward and makes users happier than getting a CSV often times. Until they start wanting to get crazy with template design and then you get into Excel styling application and you're back to hating it all over again.

Re:Ask HN: What is something you do for clients that consist... by barrkel on Monday December 12, 2016 @11:52AM (#13159499)
The single biggest problem is date / time formats.

Excel encodes dates and times as floating point numbers. The date / time-ness of a cell is encoded in its format. Some of the formats are hard-coded, some float depending on locale, and some use explicit format-pictures embedded in the styles.

But of course there's no guarantee that the user has formatted a cell with a date as a date. Sometimes the user has pasted a US-format date into a copy of Excel running in a UK locale, so dates that fit have day and month swapped, while dates that don't fit show up as strings. This is non-trivial to handle in the general case. I've had to add customer-specific workarounds for this case in particular.

Re:Ask HN: What is something you do for clients that consist... by mathw on Tuesday December 13, 2016 @03:27AM (#13165387)
You've unleashed a flood of horrible memories of reading XLS and XLSX files with dates in. Thanks a bunch.

You'd think when Microsoft came up with their new shiny file formats they'd actually make them new and shiny and good.

But nope.

Re:Ask HN: What is something you do for clients that consist... by arethuza on Monday December 12, 2016 @10:53AM (#13158906)
Actually, there are some commercial libraries that make working with even complex Excel spreadsheets pretty straightforward. I've used Aspose.Cells a lot and was very happy with it:

http://www.aspose.com/products/cells

[NB I have no connection with Aspose, just been a happy customer for many years].

Re:Ask HN: What is something you do for clients that consist... by t0mas88 on Monday December 12, 2016 @03:52PM (#13161787)
Let me create a headache for you: there is no "CSV as created by Excel with the default settings". There are a lot of different ones for each language setting of Excel, and they are incompatible. So if you're going to work anywhere but the US or even have just some foreigners in the US as your users you're in for a total nightmare doing "Excel CSV"

The worst thing Microsoft ever did to Excel was even translating the formula functions in different languages. So SUM() isn't actually called SUM() in half of Europe...

Re:Ask HN: What is something you do for clients that consist... by dzdt on Monday December 12, 2016 @12:15PM (#13159715)
Evil pro-tip : you can output a csv file and name it "foo.xls". Excel will open it fine, with just a click-thru complaint dialog that no one will read anyway.
Re:Ask HN: What is something you do for clients that consist... by SonOfLilit on Monday December 12, 2016 @12:53PM (#13160085)
Israeli bank websites export an HTML table and call the file "foo.xls", and it works quite well.
Re:Ask HN: What is something you do for clients that consist... by my_ghola on Monday December 12, 2016 @09:39AM (#13158270)
I don't talk about XLS or XLSX, I just say Excel and give them SpreadsheetML files.
Re:Ask HN: What is something you do for clients that consist... by majewsky on Monday December 12, 2016 @04:16AM (#13156747)
> Another thing which I don't personally love, but I do because I understand industries have differences is just exporting whatever can be exported into .csv files or .xls files where applicable.

Working on an in-house application, this has been one of the most common types of requests. "Can we add this field here to the CSV export?" It's a three-minute task for me, but a huge time-saver for the manager of the team using the application and thus highly appreciated.

Re:Ask HN: What is something you do for clients that consist... by ape4 on Monday December 12, 2016 @09:26AM (#13158178)
But then exporting the CSV into Excel and doing something becomes part of the workflow. That could possibly be better done in the application.
Re:Ask HN: What is something you do for clients that consist... by TeMPOraL on Monday December 12, 2016 @10:52AM (#13158899)
Not unless your application aims to encompass the entirety of running a business. Otherwise it's just plain user-hostile greed.

Personally, I do love whenever applications allow to export data and lack of such feature is IMO strong negative.

Re:Ask HN: What is something you do for clients that consist... by majewsky on Monday December 12, 2016 @05:39PM (#13162685)
It's also much more efficient for me as a developer to offer an export interface instead of having to implement all the reporting functionality myself.
Re:Ask HN: What is something you do for clients that consist... by ape4 on Monday December 12, 2016 @02:52PM (#13161303)
You are right I don't want to be user-hostile greedy. Its a fine line.
Re:Ask HN: What is something you do for clients that consist... by Cerium on Monday December 12, 2016 @10:14AM (#13158572)
You can't stop it. If you don't have export then you will hear about your clients copying and pasting to Excel. Much better to add a csv export and high-res download button for all charts and graphs.

By the way, I've had lots of success with chart downloading by simply copying the svg element into a request to an svg to png converter.

Re:Ask HN: What is something you do for clients that consist... by jenkstom on Monday December 12, 2016 @09:36AM (#13158250)
Often it already is. Export from here, import to there. SaaS is more and more common, so the glue needs to get better.
Re:Ask HN: What is something you do for clients that consist... by swalsh on Monday December 12, 2016 @09:56AM (#13158431)
I'm thinking about starting a consulting company next year. I've been in an engineering role for over 10 years, but I really want to move into a role where I'm not selling my time in exchange for code, but rather selling the value my code creates.

I'm curious how you got your first few "gigs". What should the sales process actually look like? Did you cold call, or did you have enough established relationships first? How do you typically agree on a contract, has the customer come to you with needs, or did you ask them for problems first and propose some solutions, and they agreed to them?

Re:Ask HN: What is something you do for clients that consist... by thirdreplicator on Monday December 12, 2016 @11:46AM (#13159443)
If you really want to reap the value your code creates start an internet-like business with the code that you write. All the value is yours! :)
Re:Ask HN: What is something you do for clients that consist... by Fortative on Monday December 12, 2016 @11:30PM (#13164446)
The first gig came to me. The second was a result of the first. And it goes on from there. If you network then someone will approach you to help them with some code. Do a great job and the second will start. After you do a few, then worry about sales and marketing.
Re:Ask HN: What is something you do for clients that consist... by roadnottaken on Monday December 12, 2016 @01:07PM (#13160208)
Can you say a little-more about the "sockets"? How do you implement this? I'm not even sure exactly what you mean, do you have an example? It sounds like a fun feature to implement so I'd love to hear more. Thanks
Re:Ask HN: What is something you do for clients that consist... by bestows on Monday December 12, 2016 @02:06PM (#13160812)
Have a look into websockets. They are used to create an always open connection between the client and server. Meaning your application will not need to continually poll the server for updates.
Re:Ask HN: What is something you do for clients that consist... by stephenr on Tuesday December 13, 2016 @02:14AM (#13165130)
For notification type stuff (i.e. predominantly one way, server > client) Server Sent Events/EventSource is IMO a simpler, more appropriate solution:

It works over regular HTTP and has a built in method to tell the server the last seen message (i.e. to allow replaying old messages), and exposes the event type (i.e. the event: field in the event block sent from the server) for use with addEventListener in the browser.

It's supported by all non-MS browsers, and because it works over regular HTTP, it can be polyfilled in IE/Edge using long polling XHR.

Re:Ask HN: What is something you do for clients that consist... by raverbashing on Monday December 12, 2016 @05:30AM (#13157082)
How would you export it to xls? ActiveX Excel controller ("in my time this was called COM", etc)? Open source library?
Re:Ask HN: What is something you do for clients that consist... by thibaut_barrere on Monday December 12, 2016 @10:00AM (#13158457)
One useful trick is that you can rely on the headless version of LibreOffice to do the conversion, here on Mac for instance (but also work on Ubuntu with a slightly different call):

    /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to xlsx file.csv
Note, though, that some conversion errors can still occur (I've seen one personally a long time back).
Re:Ask HN: What is something you do for clients that consist... by Piskvorrr on Monday December 12, 2016 @11:36AM (#13159353)
This works for many other formats, too: anything to PDF, for example.

A resource hog, though - had to close it off into its own container, lest it gobble up all available RAM.

Re:Ask HN: What is something you do for clients that consist... by Jugurtha on Monday December 12, 2016 @06:54AM (#13157405)
For Python, there's XlsxWriter[0] (creation of new excel files) and OpenPyXL[1] (creation of new and manipulation of existing files).

[0]: http://xlsxwriter.readthedocs.io/ https://pypi.python.org/pypi/XlsxWriter

[1]: https://openpyxl.readthedocs.io/ https://pypi.python.org/pypi/openpyxl

Re:Ask HN: What is something you do for clients that consist... by inopinatus on Monday December 12, 2016 @06:10AM (#13157241)
For anyone using Ruby I'd recommend the (open-source) axlsx gem, I've had great results being able to treat Excel generation like I'm rendering a view.
Re:Ask HN: What is something you do for clients that consist... by rubyfan on Monday December 12, 2016 @08:18AM (#13157819)
I've had luck with that one too for the times I actually need a real Excel file.
Re:Ask HN: What is something you do for clients that consist... by karussell on Monday December 12, 2016 @09:09AM (#13158072)
For Java there are at least two good solutions: https://poi.apache.org/ and https://github.com/plutext/docx4j/ (or JExcelAPI)
Re:Ask HN: What is something you do for clients that consist... by haldean on Monday December 12, 2016 @11:58AM (#13159563)
+1 for Apache POI; we actually used that at Google for exporting XLS reports for ads.
Re:Ask HN: What is something you do for clients that consist... by michaelmior on Monday December 12, 2016 @06:42AM (#13157366)
tablib[0] is one option for Python. There are quite a few libraries that handle export. Excel files (and other Office) file formats are just zip files containing XML. For a while now, this has been an open standard[1].

[0] https://github.com/kennethreitz/tablib

[1] https://en.wikipedia.org/wiki/Office_Open_XML

Re:Ask HN: What is something you do for clients that consist... by rgacote on Monday December 12, 2016 @05:49PM (#13162784)
I've found the Python pyexcel library to be the most flexible option to read/write Excel files. https://pypi.python.org/pypi/pyexcel/0.0.9
Re:Ask HN: What is something you do for clients that consist... by michaelmior on Tuesday December 13, 2016 @11:23AM (#13167966)
Curious if you've tried tablib. I haven't used either, but knowing kenneth_reitz tablib is quality :)
Re:Ask HN: What is something you do for clients that consist... by dagw on Monday December 12, 2016 @08:20AM (#13157828)
I've used openpyxl a lot for these kinds of tasks, and found it really useful.

One nice feature with openpyxl is that it can work together with excel template files. So I can create a template in excel with whatever looks and features I want and then use openpyxl to populate those templates with data.

Re:Ask HN: What is something you do for clients that consist... by tacostakohashi on Monday December 12, 2016 @08:09AM (#13157766)
HTML table in a file with a .xls extension.
Re:Ask HN: What is something you do for clients that consist... by rubyfan on Monday December 12, 2016 @08:15AM (#13157799)
One of my favorite old tricks. Works with renaming a .csv to .xls.
Re:Ask HN: What is something you do for clients that consist... by JosephHatfield on Monday December 12, 2016 @08:56AM (#13158018)
Newer versions of Excel will warn the user of possible file corruption if they try to open an .html file that has been renamed to .xls. The file can still be opened but the warning is bothersome.
Re:Ask HN: What is something you do for clients that consist... by jules on Thursday December 15, 2016 @08:06AM (#13184294)
An alternative is to make a .xlsx file with Excel, then unzip it. You'll get a folder with text files and then you'll see how to generate your own.
Re:Ask HN: What is something you do for clients that consist... by Piskvorrr on Monday December 12, 2016 @11:12AM (#13159086)
PHPExcel for, you guessed it, PHP. An order of magnitude less hassle than CSV ("the files you generate are wrong, but only on some computers! Fixitfixitfixit!!!"), and surprisingly powerful.
Re:Ask HN: What is something you do for clients that consist... by geckoquaint on Monday December 12, 2016 @03:30PM (#13161637)
Note: Last time we used it for large data report generation results were slow and consumed huge amount of memory.
Re:Ask HN: What is something you do for clients that consist... by Piskvorrr on Thursday December 15, 2016 @02:02AM (#13182979)
Depends on the amount of data, calculations, and formatting. For "output this array of arrays as XLSX instead of CSV", I find its current performance acceptable.
Re:Ask HN: What is something you do for clients that consist... by mlangdon on Monday December 12, 2016 @07:42AM (#13157625)
Most reasonably popular languages will have platform-independent open source read-write libraries for Excel. I've used the Python version of this with minimal pain.
Re:Ask HN: What is something you do for clients that consist... by skrowl on Monday December 12, 2016 @07:28AM (#13157563)
Create it as a report in SSRS, then they can export to XLSX, PDF, CSV, etc
Re:Ask HN: What is something you do for clients that consist... by wonderwonder on Monday December 12, 2016 @01:36PM (#13160522)
I've used this a couple of times: http://papaparse.com/
Re:Ask HN: What is something you do for clients that consist... by ffjffsfr on Monday December 12, 2016 @02:02PM (#13160781)
> implementing sockets into their apps.

are you talking about websockets for web apps? It's not always easy to implement and it requires some extra libraries and deployment setups. Is it really that easy to add for you as giving client extra candy in post order?

Re:Ask HN: What is something you do for clients that consist... by muse900 on Monday December 12, 2016 @05:01AM (#13156952)
quite nice yes, you always have to think people that will monitor statistics etc and how long it will take them to do so. If you can make their life a lot easier thats a + and of course they'll appreciate it.
Re:Ask HN: What is something you do for clients that consist... by pknerd on Monday December 12, 2016 @05:58AM (#13157203)
+1 for CSV export.
Re:Ask HN: What is something you do for clients that consist... by rch on Monday December 12, 2016 @12:33PM (#13159902)
For large datasets I've switched to using HDF5 files. They are easy to use from Matlab and a few other applications engineers typically have already.