on-internet

What is the best alternative to strncpy()?

The function strncpy() doesn't always null terminate so I want to know what is the best alternative that always null terminates? I want a function that if: strlen(src) >= n /*n is the number of characters to be copied from source*/ there's no need to add further code like this: buf[sizeof(buf)-1] = 0;

Join the discussion →

Get Google Drive multiple shared links...in order

I've been working with Google Drive's features for a while now,but I've stumbled on quite a problematic issue. As people know,you can get multiple share links from multiple files within Google Drive,by holding the Shift button+selecting the files,and then right clicking and select 'Share' and 'Get Link' However the problem is,that the links I get are in a completely random order!,I've been checking over and over if they were sorted by date or filename or access time,but I couldn't figure out any reasoning behind the seemingly random order. This is quite a nuisance as I was trying to use Google

Join the discussion →

how do I chop up a row of numbers into columns with Perl [closed]

I am trying to convert data that is currently being processed by hand into an easier format but I am not a programmer so i really could use some help. Our tab delimited .txt datafile looks as following: Date : Time : Sample name : Temperature : : -4000 4.882813E-03 4.882813E-03 -3000 4.882813E-03 4.882813E-03 -2000 0 0 -1000 -.1367188 .1367188 0 -3.554688 3.457031 1000 -3.632813 3.491211 2000 -3.657227 3.496094 3000 -3.686523 3.491211 4000 -3.710938 3.496094 5000 -3.735352 3.496094 6000 -3.754883 3.491211 7000 -3.774414 3.496094 8000 -3.793945 3.496094 the text and all data until column A reac

Join the discussion →

org.thymeleaf.exceptions.TemplateInputException for Spring Boot

I use Spring Boot with thymeleaf, but thymeleaf is not work like ' org.thymeleaf.exceptions.TemplateInputException: Error resolving template "graduation", template might not exist or might not be accessible by any of the configured Template Resolvers' **this is Exception, when I access 'localhost:8080' ** org.thymeleaf.exceptions.TemplateInputException: Error resolving template "graduation", template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:246) ~[thymeleaf-2.1.5.RELEASE.jar:2.

Join the discussion →

How to properly set parent of a widget in Pyqt?

I have the following code from PyQt5 import QtCore, QtGui, QtWidgets from mw import Ui_MainWindow as mwin from wd import Ui_Form as wdg class widget(QtWidgets.QWidget): def __init__(self,parent = None): super(widget,self).__init__(parent) self.ui = wdg() self.ui.setupUi(self) self.show() class Main(QtWidgets.QMainWindow): def __init__(self,parent = None): super(Main,self).__init__(parent) self.ui = mwin() self.ui.setupUi(self) self.show() w = widget(self) import sys if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) mn = Main() sys.exit(app.exec_()) The Ui is generated by qt des

Join the discussion →

Mocking a method based on the parameter in Spock

Im trying to figure out mocking and for some reason it keeps returning the correct answer (win) not the one i want it to return (mac) /** * This is an empty imple class. Its intention is to allow operating * system specific information to be mocked for unit testing. */ class OsImpl extends Os { } /** * A utility convenience class that helps with pulling a variety of machine information for the build system */ class ProjectInfo { static String operatingSystem(){ operatingSystem(new OsImpl()) } /** * Returns a 3 char code on the operating system of the local machine. * @return String Code ['win'

Join the discussion →

Move a directory to another git repository while keeping the history

I'm moving a folder from one git repo to another which already exists, e.g.: repo-1 ---- dir1 ---- dir2 ---- dir-to-move ---- dir4 repo-2 ---- dir1 ---- dir2 In the end I want the repos to look like repo-1 ---- dir1 ---- dir2 ---- dir-to-move ---- dir4 repo-2 ---- dir1 ---- dir2 ---- dir-to-move That is, for a time dir-to-move will exist in both repos. But eventually I'll migrate the latest changes to repo-2 and remove dir-to-move from repo-1. My research Initially, I believed that I need to use git filter-branch as described here: How to move files from one git repo to another preserving hist

Join the discussion →

How to hit a http URL from PL/SQL procedure?

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production I am creating an Oracle job where I need to hit a procedure for every 30 minutes, Inside the procedure, I want to hit a HTTP URL so behind that a java program will execute. Approach : declare req UTL_HTTP.REQ; BEGIN req := UTL_HTTP.BEGIN_REQUEST('http://dev.xxx.com/yyy/zzz/aaa/triggerJob'); dbms_output.put_line('hitting'); EXCEPTION WHEN UTL_HTTP.END_OF_BODY THEN dbms_output.put_line('exception'); END; DBMS OUTPUT is hitting -- But it is not hitting actually! Approach 2 declare req UTL_HTTP.REQ; resp UTL_HTTP.RESP; BE

Join the discussion →

ZK Framework, Execute MVVM command when all zk components have been loaded

I am working with ZK 8.0.2. I use MVVM pattern. I want execute a view model command when all zk components have been loaded. How I can do? I annoted by @Init but @Init method is executed before all zk components are loaded. I need execute a view model command when all components (included scripts) are loaded. I annoted ny @AfterCompose but same behaviour

Join the discussion →

Center image between containers while keeping responsivity

How can I add an image on top of the other and keep the responsivity? Basically what I need is an image that is centered between one image and a container. I am using Bootstrap. Attached screenshot. I tried different variants with float, position: absolute; and so on but nothing seemed to work when the screen was being resized. Tried finding info about this but frankly I have no idea how to formulate the problem so that I find an answer. [![screenshot][1]][1]

Join the discussion →

Make a click event in NodeJS

I'm trying to make a click from server side. I'm using nodeJS and I'm not able to use JQuery function. I would make click on the .next class. This is what I would do : while (nbrPage > 0) { //my scraping code nbrPage--; $('.next').click(); } Note than the html code to scrape is like this : <span class="next"> <a id="nextPage-159c6fa8635" class="page" href="/blablabla"></a> </span> Does anyone know how to use JQuery methods in NodeJS code or how to make click function in NodeJS ? EDIT: I'm scraping a website and I want to loop on each pagination and scrap my data from each page. For this I need

Join the discussion →

Changing from #define to const (uppercase?)

I'm doing a bit of refactoring on some code and I'm seeing #define used a lot to create constants. From what I read I understand that consts with the proper type would be better. But what about the naming style? Should I keep the uppercase for the consts or it should be used exclusively for macros? #define MINUTE_LEN 6 #define SECOND_LEN 6 #define MILISECOND_LEN 11 Should be: const int MINUTE_LEN = 6; const int SECOND_LEN = 6; const int MILISECOND_LEN = 11; or: const int minuteLen = 6; const int secondLen = 6; const int milisecondLen = 11; What is recommended? I feel like the uppercase helps t

Join the discussion →

Connection timing out while connecting to Maven repository

I am trying to build my project in my local system using the below command mvn clean install -Dmaven.test.skip=true It fails with the below error. It is failing to connect to repo.maven.apache.org. I pinged to the server repo.maven.apache.org, I can see the response back. I am using maven 3 version and connecting to maven 2 repo (repo.maven.apache.org). [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building web-order-avpn 1702.0.0-SNAPSHOT [INFO] ---------------------------------------------------------------------

Join the discussion →

How to know MongoDB collection size?

db.collection.stats() Response : "count" : 20696445, "size" : NumberLong("1478263842661"), "storageSize" : 334732324864, "totalIndexSize" : 676327424, "indexSizes" : { "_id_" : 377094144, "leadID_1" : 128049152, "leadID_hashed" : 171184128 }, "avgObjSize" : 71425.97884134208 My actual disk size is matched with storageSize. So what is the size and other keys.

Join the discussion →

FontAwesome fontawesome-webfont.woff2?v=4.5.0 404 not found

I am using fontawesome 4.5 in my asp.net mvc project. I am facing following error on console I have included fonts in my fonts folder And line the fontwesome style sheet in layout.cshtml <link href="~/Content/font-awesome.min.css" rel="stylesheet" /> and my font face attribute is like this @font-face { font-family: 'FontAwesome'; src: url('../fonts/fontawesome-webfont.eot?v=4.5.0'); src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('wof

Join the discussion →

Make Web push notification work using webview in a native android app?

I have a website which is responsive and push notification feature enabled. In my native android app, if i load my website in a WebView, then the pop up which usually comes in chrome/firefox to ask if user wants to allow push notification or not, doesn't shows up in WebView. And obviously the WebView won't support the same web push notification for the app. I know how to implement GCM or FCM in app to enable mobile push, but i wanted to know if it possible just to club the web push notification with android webview so that it would work in my app as it is working in chrome/firefox etc. What I

Join the discussion →

How to convert Excel file with multiple sheets to a set of TSV files?

What addition clde to be added to cconvert excel file with multiple sheets to Tsv file in the below code. note:The below code convert an excel file with one sheet to Tsv.It does not handle an excel sheet with multiple sheet Public Sub Main() Dim oExcel As Object Dim oBook As Object Dim sFileName As String Dim sFileNameOnly As String Dim sXlsPath As String Dim sTsvPath As String sFileName = CStr(Dts.Variables("User::Xls_File_Name").Value) sXlsPath = "H:\Xls_Files\" + sFileName sFileNameOnly = Path.GetFileNameWithoutExtension(sFileName) sTsvPath = "H:\Xls_Files\" + sFileNameOnly + ".Txt" oExcel

Join the discussion →

Offset columns in Bootstrap

This is the idea of what I want to do: <div class="container-fluid"> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-4"></div> <div class="col-sm-4"></div> <div class="col-sm-2"></div> </div> </div> How would it work using offset?

Join the discussion →

Where to set hibernate.id.new_generator_mappings property?

I've wasted too much time on this ... I'm using oracle and I have a sequence (MY_TABLE_SEQ) defined which increments by 1. In my Pojo I have: @SequenceGenerator(name = "MY_SEQ", sequenceName="MY_TABLE_SEQ", allocationSize=50) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MY_SEQ") This gives me a unique constraint issue. From my understanding I need to set the following property: hibernate.id.new_generator_mappings=true I've tried setting in my hibernate.cfg.xml file but it does not seem to make any difference. I've come across server post to place in persistance.xml but this is

Join the discussion →

reCAPTCHA 2.0 not appearing in Safari (works in Edge, Chrome, and Firefox)

I just integrated the Google reCAPTCHA 2.0 into my site. It works as expected in Chrome, Firefox, and Edge, but it doesn't work / appear in Safari on my MacBook Pro. MacBook Pro: macOS Sierra version 10.12.2. Safari: Version 10.0.2 (12602.3.12.0.1) The reCAPTCHA is being used within a dhtmlXForm like this... ... { type:"label", name:"myrecaptcha", label:"<div class=\"g-recaptcha\" data-sitekey=\"MY_KEY_HERE\"></div>", offsetLeft:320 }, ... Which in all browsers except for Safari generates this... But in Safari it doesn't appear... There are no errors in the console. I have cleared all browser

Join the discussion →

React JS bold the text in between

In the below code, I would like to style only some words for chartDesc (for example "the payback period"). Either bold or italic etc. Tried regular expressions, did not work. Please help! import React from 'react'; import Pie from './Pie'; import TextTruncate from 'react-text-truncate'; import ReactTooltip from 'react-tooltip'; import { browserHistory } from 'react-router'; export default class Donutchart extends React.Component { constructor(props) { super(); } getElements(id) { let backendData = this.props.data; let width = 120; let height = 120; let radius = Math.min(width, height) / 2; let

Join the discussion →

Error: "Unable to find the requested .Net Framework Data Provider. It may not be installed."

I have followed post such as checking machine.config file to remove the extra and it still does not work. These are the following error message. [ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Web.Providers.ModelHelper.CreateEntityConnection(ConnectionStringSettings setting, String csdl, String ssdl, String msl) +413 System.Web.Providers.ModelHelper.CreateMembershipEntities(ConnectionStringSettings setting) +51 System.Web.Providers.DefaultMembershipProvider.Membership_CreateUser(String applicationName, String userName, String pass

Join the discussion →

How to convert javaRDD to dataset

I am trying to use spark to read the data from the Oracle database into a dataset, then convert the dataset into javaRDD for map operation. My code can only store the dataset Spark official documents show: http://spark.apache.org/docs/latest/sql-programming-guide.html#inferring-the-schema-using-reflection // Apply a schema to an RDD of JavaBeans to get a DataFrame Dataset<Row> peopleDF = spark.createDataFrame(peopleRDD, Person.class); Our Data is read from Oracle. How do I define the Person.class to store and convert the rdd to dataset? Or how can I use Java directly to take the map operation

Join the discussion →

trying to generate a PDF and view or email it with React Native

I spent the last few days playing with react-native-html-to-pdf (https://github.com/christopherdro/react-native-html-to-pdf ), react-native-mail (by chirag04) and react-native-view-pdf (by cnjon) There is another version of react-native-mail by parkerdan that I have yet to try, but the chrirag04's version basically corrupted all my projects and was a pain to uninstall. react-native-html-to-pdf doesn't seem to generate any error, and I can't seem have access to the pdf generated. here a snippet of the code I am running: import RNHTMLtoPDF from 'react-native-html-to-pdf'; import PDFView from 're

Join the discussion →
Older stories