c++ curly braces and comments [on hold]

Uncategorized
Question: C++ begginer here. I'm struggling a bit to get what's the best practice for curly braces + //comments. I see that for functions comments above the definition provide Visual Studio inspection utility by hovering the mouse on them anywhere. But when it comes to if statements and the sorts, I can't figure out what will be best more helpful in upcoming projects So, between if (condition) { // comment do something(); } or // comment if (condition) { do something(); } or if (condition) // comment { do something(); } or even the following one (to use the that usually useless newline) if (condition) { // comment do something(); } there no clear "Ah this one is better because of xyz", to me yet. Thank you for any foresight!…
Read More

Flowing – Multi-Concept WordPress Blog Theme

Uncategorized
Flowing is a Wordpress Theme crafted with bloggers/newser in mind, impress your audience with bold, clean, and stately aesthetic. From its stunning slider and promo boxes to the plethora of color options, Flowing delights visually and functionally, giving you the power to customize your blog with just a click of the mouse. With lazyload images included, Flowing is light & fast. And if Flowing numerous features, robust options, and arresting design weren’t enough, rest assured knowing that your theme is backed by PenciDesign’s acclaimed customer service.
Read More

Compiling native node addon with c++ 17 inside fails during npm install on ubuntu

Uncategorized
Question: I have native add-on for nodejs that uses c++17 features, specifically "shared_mutex". When I call npm install which downloads and compiles the add-on i get an error: The linux machine has GCC 6.0 installed. My Binding.gyp uses the following config to catch os type and add flags accordingly:'conditions': [ ['OS=="linux"', { 'CXXFLAGS': [ '-std=c++1z' ]}], ** i've also tried with '-std=c++17', '-std=c++1z'. What am I missing? Update: 1. Updated ubuntu 16.04 to GCC 16.04 and made it default. 2. It seems that when i try to compile it manualy using node-gyp rebuild "CXXFLAGS='-std=c++17'" it works and brings only one error: "shared_,utex in namespace std does not name a type std::shared_mutex file mutex" (the last error) Answer: Read more
Read More

flickering when using QGLWidget as the viewport of QGraphicsView

Uncategorized
Question: I'm doing a project with qt 4.8.6 and running it on embedded system(x11). In the beginning, every thing is fine, but if I open a widget which has code QGraphicsView.setViewport(new QGLWidget) in constructor function, it will flicker. If I replace the QGLWidget with QWidget, it is fine. By comparing the difference between QGLWidget and QWidget, I have tried this:QGraphicsScene* scene = new QGraphicsScene(this); QGraphicsView* view = new QGraphicsView (scene,this); view -> setViewport(new QGLWidget); 1 view->viewport()->setWindowFlags(Qt::Widget); 2 view->viewport()->setAutoFillBackground(false); 3 view->viewport()->setAttribute(Qt::WA_PaintOnScreen,false); 4 view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent); However this doesn't fix the issue. What could be the issue? Answer: Read more
Read More

Admin-On-Rest: Display Json grid in edit view

admin-on-rest
Question: I would like to display the following in an edit page. I'm having trouble making a sub-datagrid to hold the intervals part. [ { "name": "Jenn", "description": "", "duration": 780, "level": 2, "instructor": 1, "category": 1, "equipment": [ 1, 2 ], "intervals": [ { "interval": 11, "time": 30, "Incline": 30 }, { "interval": 34, "time": 30, "Incline": 0 } ], "id": 1, "createdAt": "2017-08-18T13:56:50.000Z", "updatedAt": "2017-08-18T13:56:50.000Z" } ] This is what I currently have:export const ClassEdit = (props) => ( {/**/} {/**/} {/**/} I'm guessing I have to somehow pass the sub records into the datagrid, but not sure how to do that? Answer: This is not possible currently. However, someone is working on a PR for that. See https://github.com/marmelab/admin-on-rest/pull/697 Read more
Read More

Add an Icon to the SDCAlertView

Uncategorized
Question: I installed the SDCAlertView to my project from cocoapods because I need to add an icon with a text on the left hand side alertAction, I have a question about how can i add an image (icon) to the AlertAction on the left hand side in my SDCAlertView? Here is my code :func alert() { let alertController = AlertController(title: "Alert Controller", message: "Message For Alert", preferredStyle: .actionSheet) let alertCancel = AlertAction(title: "Cancel", style: .preferred, handler: nil) let alertOK = AlertAction(title: "OK", style: .normal, handler: nil) let paragraphStyle = NSMutableParagraphStyle() // Here is the key thing! paragraphStyle.alignment = .left let messageText = NSMutableAttributedString( string: "Video", attributes: [ NSParagraphStyleAttributeName: paragraphStyle, NSFontAttributeName : UIFont.preferredFont(forTextStyle: .headline), NSForegroundColorAttributeName : UIColor.black ] ) let image = UIImage(named: "video.png") alertOK.setValue(image, forKey: "image") alertOK.setValue(messageText, forKey: "attributedTitle") alertController.add(alertOK)…
Read More

Can response and request data types be different?

Uncategorized
Question: I mean to say that call and response have different data types I send JSON and get string in response in retrofit2 Call call = client.createUser(user); call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { kik=response.body().getId(); Log.d("fhjhh", ""+response.body().); } @Override public void onFailure(Call call, Throwable t) { String message = t.getMessage(); Log.d("failure", message); } }); Answer: Try this, Call call = client.createUser(user); call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { User user = (User) response.body(); Log.d(">>Response",user.toString()); } @Override public void onFailure(Call call, Throwable t) { String message = t.getMessage(); Log.d("failure", message); } }); Create toString() method in your model class called User. Read more
Read More

Reddit PRAW Failing to autenticate due to SSL error

Uncategorized
Question: My code is currently this:from bs4 import BeautifulSoup from urllib.parse import urlparse import requests import praw import time import re import bs4 USERAGENT = 'web:PeskyTrollBot:v0.1 (by /u/redacted)' PASSWORD = 'NOTREALLYMYPASSWORD' USERNAME = "PeskyTrollBot" ID = 'redacted' SECRET = 'redacted' def authenitcate():print("Authenticating...") reddit = praw.Reddit(client_id=ID, client_secret=SECRET, password=PASSWORD, user_agent=USERAGENT, username=USERNAME) print("Authenticated as {}n" .format(reddit.user.me())) return reddit authenitcate() and my console output is as follows:C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32python.exe C:/Users/JoshLaptop/PycharmProjects/practice/TestBot.py Authenticating... Traceback (most recent call last):File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 595, in urlopen self._prepare_proxy(conn) File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connectionpool.py", line 816, in _prepare_proxy conn.connect() File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3connection.py", line 326, in connect ssl_context=context) File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libsite-packagesurllib3utilssl_.py", line 329, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libssl.py", line 401, in wrap_socket _context=self, _session=session) File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libssl.py", line 808, in __init__ self.do_handshake() File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libssl.py", line 1061, in do_handshake self._sslobj.do_handshake() File "C:UsersJoshLaptopAppDataLocalProgramsPythonPython36-32libssl.py", line 683, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL:…
Read More