Hacker Newsnew | past | comments | ask | show | jobs | submit | arunitc's commentslogin

Start small. This is what I do - Drink a large glass of water as soon as I sit at my desk. This forces me to pee within 45-60 minutes. When I go to the bathroom, I ensure I do 20 squats before coming out. Sometimes I do 10 lunges on each leg. Takes about 2-3 minutes. Back to my desk and take another gulp. Repeat!


Ok just make sure you don’t die with too much water


Delete From "APCRoleTableColumn" Where "ColumnName" Not In (Select SC.column_name From (SELECT SC.column_name, SC.table_name FROM information_schema.columns SC where SC.table_schema = 'public') SC, "APCRoleTable" RT Where SC.table_name = RT."TableName" and RT."TableName" = "APCRoleTableColumn"."TableName");

I know this is not an optimized SQL. But this takes about 5 seconds in Postgre while the same command runs in milliseconds in MSSQL Server. The APCRoleTableColumn has only about 5000 records. The above query is to delete all columns not present in the schema from the APCRoleTableColumn table

I used to be a heavy MSSQL user. I do love Postgre and have switched over to using it in all my projects and am not looking back. I wish it was as performant as MSSQL. This is just one example. I can list a number of others too.


If I remember correctly, SQL Server will convert NOT IN to anti-join. PostgreSQL currently does not do that due to NOT IN being incompatible with anti-joins in regards to NULL values. There's room for improvement there by detecting if NULLs can exist or not, and converting if they can't.

If you don't need the NOT IN weirdness around NULL values then I'd suggest you just use a NOT EXISTS. That'll allow something more efficient like a Hash Anti Join to be used during the DELETE. Something like:

Delete From "APCRoleTableColumn" Where Not EXISTS (Select 1 From information_schema.columns SC INNER JOIN "APCRoleTable" RT ON SC.table_name = RT."TableName" Where RT."TableName" = "APCRoleTableColumn"."TableName" AND SC.column_name = "APCRoleTableColumn"."ColumnName" AND SC.table_schema = 'public');

Is that faster now?


It’s a little hard to parse that on mobile but it looks like you’re doing correlated subqueries against the dB schema for each row in the table you’re deleting from.

As others have said, explain analyze will show you what’s going on. I’m fairly sure this query would be fixed by flipping and / or adding an index. 5k records is nothing to pg.


Can you share the explain analyze output of the query?


Have you checked performance using different algorithms like hash-join, merge-join and nested-loop ?


Of course it doesn't help. Just shows local governments that they are trying all they can to stop spread of fake news


What I'm really looking for is a H Series processor with a 14" screen. I want to replace my desktop with a laptop, hooked on to dual monitors. So I don't even need a Ultra HD screen. A laptop helps on the rare occasions I want to travel. But all the manufacturers seem to brand laptops with H Series processors as gaming machines and have a 15.6 inch screen minimum.


> on the rare occasions I want to travel

Then why not get the 15"?! I honestly don't understand why the 13-14" screen size exists. If you want something really portable it's got to be 12" or less. If you want something you can do serious work on too it must be 15" or more...

(The only thing more nonsensical than this is the wide screen AR when we know a 4:3 ratio would always be superior. Yeah, power users will customize their UI to get rid of the crap wasting vertical screen space... but those very same power users will also want to see long batches of code or spreadsheet cells, or text, so they'd still crave for more vertical space.)


13-14" is perfect size for fitting into a normal backpack or satchel, whereas 15" is starting to get to the point where you need a specialist laptop bag.


I find this to be true as well. A ~13.5" machine packs easily and, is noticeably more useful to me than a 12".

And 12" is just a little too small for my preference, though not wholly unbearable.

My 15" and larger machines have been much harder to travel with easily. For productivity, I have usually preferred the 15"+ machines. If that were the only consideration, then I wouldn't think twice. But they have been a pain to haul.


> If you want something you can do serious work on too it must be 15" or more...

I have a 14" T470P (2560x1440) and I do 'serious' work on it all the time, its more than adequate for when I want to work away from a desktop.


I went from 15 to 13 due to getting an amazing deal on mbp. Won't go back. Never thought I would like the 13 but its actually way better than a 15 for taking with. Plugged into monitor at home anyways.


put me in as another 15->13 (well 13.3") convert. the weight reduction is also a nice benefit.


> If you want something really portable it's got to be 12" or less. If you want something you can do serious work on too it must be 15" or more

What about something semi-serious... like Photoshop or Illustrator which can take reasonable amount of resources, but far fewer than a video editor or an IDE. A 13" with a really good screen can handle this task well and doesn't need the added heft of a 15".


If it doesn't have to be portable why spend that much on a laptop at all? Why not get a desktop you can at least sensibly upgrade/fix etc?


There's no reason a 12" (and 13.3/14) laptop should be less powerful than a 15" or 17", though.

I'd buy that even if it adds one centimeter to the height (gasp ! Now I can have an RJ-45 port and more than one USB port ?!).


> There's no reason a 12" (and 13.3/14) laptop should be less powerful than a 15" or 17", though.

yes there is. area and volume inside the chassis increase a lot faster than the length of the diagonal. the limiting factors for performance are heat dissipation and power. a bigger chassis can evacuate heat faster and house a larger battery that can sustain high power use for longer.


But we'd get a larger chassis just by doubling the height, right ?


Gigabyte Aero 14


I just switched to Edge and it looks great. One of the reasons I had used Chrome and had recommended all my customers to use Chrome was the ability to print to PDF, which Firefox did not have (not sure if it does now). Edge does and will be recommending all my clients to try out Egde.


the ability to print to PDF

All browser have had the ability to do that, for many years now, if you install a PDF printer driver. Adobe was the first with a commercial one, but I'm sure there are free ones now.


No idea what GP's role is, but given corporate environments, installing a PDF printer driver isn't always a quick process. This is particularly true if they're working with customers from many different companies, each with their own IT considerations.

Recommending Chrome is an easy enough way to get that functionality.


Windows 10 comes with the virtual printer "Microsoft Print to PDF". That will work with firefox and is probably what Edge is actually using.


If only would Edge add support for installing PWA's directly from chrome, like me prompting users to install, it would be great.


Edge needs to add display: contents support before I’d consider suggesting it to anyone.


Thats’s the reason? So trivial to install pdfwriter, whatever it’s called.


pdf.js was intergrated into Firefox at version 19 (released 2012). It looks like pdf.js it supported printing back then. It certainly does now.


I'm 43 years, Indian and have never had a problem squatting. Was surprised this is such a tough thing to do for some. I work sitting on a chair for 8-10 hours everyday, but ensure I take a squat break every 1 hour or so. To make it a habit, I take every opportunity to squat, when I have my green tea, play with my son, watch TV. It does feel great after squatting for 3-4 minutes. I also workout in the gym and perform 4-5 sets of squats with 30Kgs.

I read this yesterday - “Every joint in our body has synovial fluid in it. This is the oil in our body that provides nutrition to the cartilage. Two things are required to produce that fluid: movement and compression. So if a joint doesn’t go through its full range—if the hips and knees never go past 90 degrees—the body says ‘I’m not being used’ and starts to degenerate and stops the production of synovial fluid.”

https://quartzy.qz.com/1121077/to-solve-problems-caused-by-s...


>if a joint doesn’t go through its full range—if the hips and knees never go past 90 degrees

You don't need to squat to have your knees go past 90 degrees. This would only be an issue for people that are literally bed-ridden, for everyone else our joints move plenty while walking, sitting down and lying in bed at night. I'm sure stretching is good but you're making it sound like not squatting will lead to your joints degenerating.


> you're making it sound like not squatting will lead to your joints degenerating

I believe it will. Specifically, not squatting (or otherwise flexing it fully) will cause a person to lose the full range of motion in their ankles.

Of course, you may not care. You may have no NEED to flex your ankles past a certain point. But you ARE losing flexibility, just as you will lose the ability to do splits if you don't practice them regularly.


Agreed, and walking does not put it near 90 degrees. I lived overseas almost 8 years in SE Asia, and learning to properly squat flat-footed has really made me more flexible, and loosened up my hips and ankles. I also sat on a Pilates ball for 6 to 7 years, but now that I am back in the US, I've gained weight, and sitting at a desk 7 or more hours a day is wreaking havoc on my back and making me stiff again. I take squat breaks, and squat to fill the coffee pot instead of bending over at the water cooler. Bending is something done different in SE Asia too compared to in the West. I lived in a Javanese rice farming village for over a year, and watching and doing the planting and harvesting showed the difference to me. My wife is Indonesian and will perch in a squat on the edge of a chair or sofa while she eats - for 20 minutes. I still can only perch or squat for 5 to 10 minutes maximum.


Let alone using CSS Grid. Here in India, I can't even use Flexbox. Thanks to UC Browser having a 30% market share. Sigh, back to those IE 6 days.


I was wondering if I could use this (using a plugin) or Chrome to generate PDF files on the web server. Most of the PDF generation software out there are quite expensive.


Maybe it's possible with the print option Chrome offers. Regular Chrome can print to PDF files. Maybe headless Chrome supports that.

Edit: It's possible. It's on the introduction page of Chrome Headless

https://developers.google.com/web/updates/2017/04/headless-c...

Look at 'Create a PDF'


Here's a simple library to do that: https://github.com/LucianoGanga/simple-headless-chrome


You can. In my experience, there are very few systems as good at producing accurate renders as well as Chrome. There are a few Chrome/webkit based options.

PhantomJS made the process pretty easy, but that's probably not a good option these days as it's on the way out.

NightmareJS is pretty much the same and can do it (though I haven't tested myself) [0]

If you want to get a little deeper you can use CEF (Chromium Embedded Framework [1 ]. It basically turns Chrome into a library and there are a bunch of projects that build on top of it (eg Electron, which is what NightmareJS uses underneath).

Here's a project that just uses CEF for converting to PDF [2].

[0] https://github.com/segmentio/nightmare#pdfpath-options [1] https://bitbucket.org/chromiumembedded/cef/overview [2] https://github.com/spajak/cef-pdf


For C#, there is also CEFSharp. This is used, for example, by the image(recognition)-driven Kantu automation: https://a9t9.com/kantu/web-automation


We use wkhtmltopdf to do this server side. It as a few problems and quirks, but it work well enough for us.


it has a lot of quirks, and, frankly, webkit is pretty bad at printing in general as it lacks a ton of printing specific features like re-printing table headers across page boundaries.

There's also only very rudimentary support for page headers and footers.

wkhtmktopdf is probably ok if you just need a quick single page invoice printout, but the moment you need more (in our case, we definitely do), I can highly recommend paying for https://www.princexml.com/ which has support for a lot of printing specific features.


One of the issues we had with wkhtmltopdf was that we use Angular for our views, and we have a view for an invoice, and the ability to print it.

We wanted the same view to be passed into wkhtmltopdf to download it as PDF (with a couple of things omitted).

Unfortunately, the JS didn't execute properly, so you get a borked output.

End result was we render it, capture the HTML after render, and pipe that through to wkhtmltopdf.

Using chrome _should_ resolve that issue and let us just pass the page through.


wkhtmltopdf works quite well for us, even with modern web technologies.

Here's an example fully rendered in React: https://s3.amazonaws.com/ud-reports/comps-report-86.pdf

And one with svg charts: https://s3.amazonaws.com/ud-reports/chart-report-89.pdf

With -webkit- prefixes you can use even flexbox, and and with js polyfills you'll have all you need.

Of course if I would start a project now, I would use chrome headless, but I don't feel wkhtmltopdf is that bad.


We used node-html-pdf[1] for this, but it depends on phantomjs which uses an ancient version of webkit. We migrated to electron and its contents.printToPDF(options, callback), but that has the drawback that we have to start a X-server[2] with our backend code. I have hopes with a headless chrome we can ditch the xvfb-server and have one less dependencies. The setup is a pain, but the results are very good and looking very decent.

[1] https://github.com/marcbachmann/node-html-pdf [2] https://en.wikipedia.org/wiki/Xvfb


What about ReportLab (free version)? http://www.reportlab.com/opensource/


I currently use phantomjs for this, I haven't switched to headless chrome yet.


Latex is free.


Really not the same thing (e.g. pandoc for html -> pdf via LaTeX) as having a webkit based renderer. They do not look the same at all; sometimes it is good to have a LaTeX output but most of the time you are going to want a more accurate representation of your HTML.


The original question didn't state that he was starting from HTML. If you want to generate an invoice or such from plain data, then LaTeX seems like a good fit. Rendering HTML is a whole different bag.


That is true. TeX is a typesetting engine, and allows you exact control over the final rendering, while HTML is a markup language, the rendering of which depends on very many factors.


My time isn't. Sometimes the most cost effective option isn't the one with the lowest price tag.


Here in India, you are not only asked your previous salary, you have to provide your last (sometimes three) payslip while joining. Some companies have a policy of NOT giving more than a 30% hike from your previous salary - you need top management approval for such a hike.


At the time of joining - is usually for background verification. Most companies don't even care what your last pay was. Even if you are paid higher, they are going to play in their range.

However, during negotiation, if you lied about your previous pay just to get a better hike - you would get flagged, may get fired and get yourself listed into an unofficial blacklist. Its more of an ethics issue than just a pay mismatch.

> Some companies have a policy of NOT giving more than a 30% hike from your previous salary These companies are telling you "loud and clear" - "we don't care about talent".

There are other companies that would pay "fairly" as per their bands - even if that means a 100-200% hike


I have been through job searching recently in India and I have applied for 10s of companies most of them are statups.

> At the time of joining - is usually for background verification.

Not just during joining, many companies asked my previous salary and expected salary during the first talk. Some companies did not even contact back when I refused to disclose my previous salary.

Salary discrimination is everywhere in startups, not just by gender also by number of years of experience, University, Degree, previous company...

My opinion is "every employee doing the same job should be paid the same."


I just returned to India after working in the US for one year. I find it extremely difficult to believe such a culture can exist in the country let alone an organization. People there were friendly, extremely polite and well mannered. I never once faced any incidents or racism or hatred in my work place and out. I can't imagine things like this even in my wildest dreams.

-Chauvinistic, racist and homophobic attitudes were far too normal

-It was normal for guys to openly refer to attractive female colleagues as sluts

-They had private chats where guys wrote sexual fantasy stories about female colleagues and supervisors where they performed all sorts of demeaning acts on the women

Also the fact that she talks about driver compensation makes it look like it was an article written just to smear Uber. I may be wrong though, but really, really hard to believe.

Edit: She refused to meet Freda Kapor (see comments in post) makes it all the more suspicious.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: