on-internet

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 →

Is it possible to create a symbolic link on Android?

I want to know if in android it is possible to create symbolic links from my android application, because I want to create a symbolic link of the folder / data of my application with / sdcard. I am not an expert on android, but I usually do it in java using the Java.nio.File.Files class but in android this class is not allowed, I know that in android there is a way that is by using api 21 with The Os.symlink () method, but this is for android 5.0 and I need it for the minimum android 4.0 or 4.1 onwards. If you know any way please let me know, thank you very much.

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 →

PHP can't unlink file after fclose

After my script finishes I can delete the file, but while it's running I can't touch it, even after an fclose(). Here is the code I'm trying to use: $Files = glob("$_SERVER[DOCUMENT_ROOT]/files/*.csv"); $File = fopen($Files[0], "r"); //while (($Data = fgetcsv($File)) !== false) {... $i = 0; while (is_resource($File)) { $i && sleep(1); echo "Closing handle.\n"; fclose($File); if (++$i > 5) die("Could not close handle."); } foreach ($Files as $File) { $i = 0; while (file_exists($File)) { $i && sleep(1); echo "Deleting file.\n"; @unlink($File); echo 'www-data@debian:~$ ', $Command = "rm -f '$File

Join the discussion →

How would people living in eternal day learn that stars exist?

In a world I am building, the day lasts longer than the year, 9 times longer in fact. The native people of this world have been forced to migrate around the world, both avoiding the scorching desert of noon and the freezing winter of night. This world is otherwise rather unremarkable on the surface. Outside of the planet is a ring as well as many small moons, so many that the tides are rather small and unpredictable, but as I was designing their culture I realized something, without seeing the stars, would the have astronomy? How would a species that lives in eternal day have any knowledge of

Join the discussion →

Compare a mongo diff on two collections

I have two mongo collections, one which refers to the production env and the other to the testing env. How can I compare a diff between my two collections? I tried dumping them to a bson and then converting to a json. But I cant just perform a simple diff on them since the sorting might vary and the json file is way too large to be sorted.

Join the discussion →

ajax link in script tag

i've made a webpage where i used a code that i found on the internet. in this code is a link to an ajax page. I uploaded my html and css to a webserver, now i get a message "this website is trying to load unverified sources". is it possible to copy this code to a file and add this this to my webserver, so the message doesn't appear? thanks in advance. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Join the discussion →

Impala JDBC Error: User '' does not have privileges to execute 'SELECT' on: table

Resently I enabled the Sentry policy file for Hive. So when I try to execute a query in Impala using Impala-JDBC4 (version 2.5.16) I get this error: errorMessage:AuthorizationException: User '' does not have privileges to execute 'SELECT' on: db.table In my code I set the user and password of my admin account of my DB. So I don't undestand why it don't reads that. public static double getDolarFromImpala(String date) { double dolar = 0.0; try { Class.forName(JDBC_DRIVER_IMPALA); String sql = "SELECT value FROM db.table where date ='"+date+"'"; String JDBC_IMPALA_URL = "jdbc:impala://impala1:210

Join the discussion →

Auto Increment id in sharepoint

I want Auto Increment ID in SharePoint and ID should be in the form of CZAR1001,CZAR1002,CZAR1003 and so on. I have tried =RIGHT(EmpID-LEN(EmpID-4)) this formula but its not giving proper output. Might be due to EmpID is single line text type

Join the discussion →

How to fetch data in Oracle database and use it in Selenium WebDriver

I have two test cases. First Test Case: Create a user. Once the user is created, the info gets stored in the database.(i.e account number, username, password, first name, last name etc) Second Test Case: Login as a User. Once the first test case has been passed, how can I fetch the data from the db (e.g. select * from created_user) and use it in my second test case. For example: I would like to fetch the username and password from the database, and use it in my second test case when i'm on the login page. Any help would be appreciated. Thanks!

Join the discussion →

Fitting a curve to a power-law distribution with curve_fit does not work

I am trying to find a curve fitting my data that visually seem to have a power law distribution. I hoped to utilize scipy.optimize.curve_fit, but no matter what function or data normalization I try, I am getting either a RuntimeError (parameters not found or overflow) or a curve that does not fit my data even remotely. Please help me to figure out what I am doing wrong here. %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import curve_fit df = pd.DataFrame({ 'x': [ 1000, 3250, 5500, 10000, 32500, 55000, 77500, 100000, 200000 ], 'y':

Join the discussion →

Error:The preLaunchTask 'build' terminated with exit code 1

Visual Studio debug c# script on OSX, show a Error: The preLaunchTask 'build' terminated with exit code 1. This is a copy of the launch.json file: { "version": "0.2.0", "configurations": [{ "name": ".NET Core Launch (console)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/hwapp.dll", "args": [], "cwd": "${workspaceRoot}", "stopAtEntry": false, "externalConsole": false }, { "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "${workspaceRoot}/bin/Debug/netcoreapp1

Join the discussion →

How can I convert text to title case?

I have a text file containing a list of titles that I need to change to title case (words should begin with a capital letter except for most articles, conjunctions, and prepositions). For example, this list of book titles: barbarians at the gate hot, flat, and crowded A DAY LATE AND A DOLLAR SHORT THE HITCHHIKER'S GUIDE TO THE GALAXY should be changed to: Barbarians at the Gate Hot, Flat, and Crowded A Day Late and a Dollar Short The Hitchhiker's Guide to the Galaxy I wrote the following code: while(<DATA>) { $_=~s/(\s+)([a-z])/$1.uc($2)/eg; print $_; } But it capitalizes the first letter of e

Join the discussion →

Non-ASCII character '\x90' executing pserve on windows inside virtualenv

Question: How can i solve no-ascii character error executing pserve on virtualenv in windows? Description: I'm trying to execute pserve (pyllons/pyramid development web server) inside a virtualenv on windows. It's a fresh install, so maybe it is related to versions. Problem: With the virtualenv activated, execute pserve config.ini throw error: SyntaxError: Non-ASCII character '\x90' in file C:\PATH_TO_MY_ENV_HOME\env\Scripts\pserve.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details. Command line: pserve development.ini --reload Notes: this error happe

Join the discussion →

offsetTop,offsetLeft and getBoundingClientRect() are not working in my React app

I'm working in react and I'm creating a button with a tooltip, but I can't place it. I mean I can't read the button's distance from the top and left. I tried offsetTop and offsetLeft and I got this error: "Uncaught TypeError: Cannot read property 'offsetWidth' of undefined" so I tried getBoundingClientRect() and all I got is another error: "Uncaught TypeError: elem.getBoundingClientRect is not a function". I'm passing the information from component to the second component by assigning the distances to the global variable and read it in this second component when I need to place it. This is my

Join the discussion →
Older stories