on-internet

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 →

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 →

Configuring app's basename in react-router

I'm struggling a bit with react-router 2.x configuration, specifically app basename. I've an application which may have different base root throughout its lifecycle. For instance: / in development /users in production /account in production after migration The basename comes into play in several places: static asset compilation in Webpack react-router main configuration specifying redirect routes in redux actions providing something like redirectUrl to API calls My current solution is to have an ENV variable and make it available both to Webpack and to the app itself by injecting window.defs v

Join the discussion →

Faster Alternative to Math.sqrt()

Are there any alternatives to using Math.sqrt() to get the square root of an unknown value? For example: var random = (Math.random() * (999 - 1)) + 1; var sqrt = Math.sqrt(random); I've heard that using Math.sqrt() to get the square root of a number is a very slow operation, I'm just wondering if there are any faster ways I can get the square root of a random number. Any help with this would be greatly appreciated.

Join the discussion →

Printer Connection error on escpos-php

From This link(Printing to POS printer from PHP) i started I have use php sample code. my question is my printer is set to default then why i have to connect to printer. anyway i am getting error on connecting printer. as my printer name is in fig1 and to access printer i have to type \Sah-it\ARP-808K in run as shown in fig2. i have tried: 1. $connector = new FilePrintConnector("\\Sah-it\ARP-808K"); $printer = new Printer($connector); 2. $profile = CapabilityProfile::load("simple"); $connector = new WindowsPrintConnector("smb://Sah-it/ARP-808Kr"); $printer = new Printer($connector, $profile);

Join the discussion →

Exporting multiple sheets to .pdf via VBA code

I have seen this question but it doesn't quite answer my question - excel vba not exporting pagesetup to pdf correctly I have the same problem of the specified ranges in each sheet not being exported when utilising code to create the .pdf output. Everything on each sheet is exported so each worksheet is spread across two or more pages. The print ranges for each sheet are set up to print the specified area onto one sheet. I have tried to adapt the code in the link but it doesn't seem to work with multiple sheets. The code I am attempting to use in its unadapted form Sub ClientPDFOutput() If She

Join the discussion →

Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object

i am trying to connect db2 from my java code in web sphere application server. i am getting following exception.please suggest any one on this. Caused by: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is javax.xml.stream.FactoryConfigurationError: Provider javax.xml.stream.XMLInputFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.sun.xml.internal.stream.XMLInputFactoryImpl not a subtype] at com.ibm.ws.n

Join the discussion →

How to use clang++ instead g++ in Bazel

I want to use clang++ instead of g++ to compile my C++ files while g++ is the system's default compiler. I have tried sudo update-alternatives --install c++ c++ /home/guo/bin/clang++ 100 and set CC environment. But they don't work. Bazel still uses g++ as compiler. After an hour, Bazel uses clang++. But an error occurred. ERROR: /home/guo/utils/lib/BUILD:2:1: C++ compilation of rule '//utils/lib:get_pdf' failed: linux-sandbox failed: error executing command /home/guo/.cache/bazel/_bazel_guo/d2d93a82f24e8dc5485ac1b29928428e/execroot/_bin/linux-sandbox ... (remaining 41 argument(s) skipped). src

Join the discussion →

how to display my query in view codeignitier [closed]

this my controler public function ajax_pasien($Kode) { $data = $this->infokamar->get_by_id1($Kode); echo json_encode($data); } this my model public function get_by_id1($Kode) { $sql = "select a.norm, b.nama as pasien, b.alamat, c.tanggal, c.tanggal1, f.jumlah, f.biaya from TTKunjungan a inner join TMPasien b on A.norm = b.norm inner join TTKunjunganDetail c on A.Kode = c.kodekunjungan inner join TMTrfTindakan d on c.kodetindakan = d.Kode inner join TMTrfLayanan e on d.kodelayanan = e.Kode left join (select kodett, sum(jumlah) as jumlah, sum(biaya) as biaya from TTKunjunganDetail where kodett i

Join the discussion →

Date time picker with milliseconds

Is there any way I can get milliseconds in bootstrap . I am using DB2 time stamp for inserting the date time. So while performing the search I need to allow the user to select date and time with milliseconds also. I tried using the link (http://trentrichardson.com/examples/timepicker/) but I was not able to get the slider. Can anyone help me with how to order the required js and css files. Or is there anyway I can get datetimepicker with the format e.g 2016-12-11 02:22:22.444444(6 digits). This is the order I have included files. <script src="/lib/jquery-1.12.4.min.js"></script> <script src="/

Join the discussion →

ggplot2 error "Warning: Ignoring unknown parameters: bins"

I have a df that I am tryint to plot with the geom_histogram function: structure(list(dFormat = c("11M 50S", "13M 30S", "14M 20S", "14M 40S", "1M 10S", "1M 20S", "1M 40S", "1M 50S", "2M 10S", "2M 20S", "2M 30S", "2M 40S", "2M 50S", "3M 0S", "3M 10S", "3M 20S", "3M 30S", "3M 40S", "3M 50S", "4M 0S", "4M 10S", "4M 20S", "4M 30S", "4M 40S", "4M 50S", "5M 0S", "5M 10S", "5M 20S", "5M 30S", "5M 40S", "5M 50S", "6M 0S", "6M 10S", "6M 20S", "6M 30S", "6M 40S", "6M 50S", "7M 0S", "7M 10S", "7M 20S", "7M 30S", "7M 40S", "7M 50S", "8M 0S", "8M 10S", "8M 20S", "8M 30S", "8M 40S", "8M 50S", "9M 0S", "9M 1

Join the discussion →

IIS Express 'The specified port is in use' Visual Studio 2015

Apologies about the long message, but I thought I should let you know what I have already tried. I've very recently started learning C# through Visual Studio and all was going OK until about three weeks ago. I clicked on the button with a green triangle which did the usual thing of launching the internet page, but the site never loads. I then noticed there was an ISS Express notification which brings up the following (can't figure out how to get my cropped screen shot on here): 'The Specified port is in use Port 49665 is already being used by process "svchost.exe" (process ID "2112") Recommend

Join the discussion →

Angular 2 - Endless loop in async pipe

I`m getting an endless loop when I try to bind a async function like this: <tr *ngFor="let i of items"> <td>{{myAsyncFunc(i) | async}}</td> </tr> this is the function: private myAsyncFunc(i: string): Promise<string> { return Promise.resolve("some"); } I'm doing something wrong? Or this is a bug?

Join the discussion →

What is the role of probability in machine learning software? [closed]

There are several components and techniques used in learning programs. Machine learning components include ANN, Bayesian networks, SVM, PCA and other probability based methods. What role do Bayesian networks based techniques play in machine learning? Also it would be helpful to know how does integrating one or more of these components into applications lead to real solutions, and how does software deal with limited knowledge and still produce sufficiently reliable results.

Join the discussion →
Older stories