on-internet

scikit-learn's predict() is predicting values out of range

In the program, I am scanning a number of brain samples taken in a time series of 40 x 64 x 64 images every 2.5 seconds. The number of 'voxels' (3D pixels) in each image is thus ~ 168,000 ish (40 * 64 * 64), each of which is a 'feature' for an image sample. I thought of using principal component analysis (PCA) because of the ridiculously high n to perform dimensionality reduction. Then follow this up with Recursive Feature Elimination (RFE). There are nine classes to predict. Thus, it is a multi class classification problem. Below, I convert this nine-class classification to a binary classific

Join the discussion →

Remove only spaces and ignore tabs in a string

I have a string which has both spaces and tabs. I would like to remove all the occurrences of spaces in the string but keep the tab spaces as is. I would like to preserve the tabs so that I can use the tab-delimiter option in Excel when I import the text file.

Join the discussion →

reading RDa file in python as a pandas data frame

I have an RDa file that I created in R. I want to read this file on python as a pandas dataframe. I have the following code to do the same: import rpy2.robjects as robjects import numpy as np from rpy2.robjects import pandas2ri pandas2ri.activate() # load your file robjects.r['load']('Data.RDa') matrix = robjects.r['data'] matrix I get the following results: R object with classes: ('data.frame',) mapped to: <DataFrame - Python:0x0CF46F58 / R:0x0ED0F200> [Float..., Float..., Float..., ..., Float..., Float..., Float...] area: <class 'rpy2.robjects.vectors.FloatVector'> R object with classes: ('n

Join the discussion →

Error : java.net.NoRouteToHostException no route to host

I run select * from customers in hive and i get the result. Now when I run select count(*) customers, the job status is failed. In JobHistory I found 4 failed maps. And in the map log file I have this : 2016-10-19 12:47:09,725 INFO [main] org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties 2016-10-19 12:47:09,786 INFO [main] org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s). 2016-10-19 12:47:09,786 INFO [main] org.apache.hadoop.metrics2.impl.MetricsSystemImpl: MapTask metrics system started 2016-10-19 12:47

Join the discussion →

Import OpenSSL Generated Private Key into Oracle Wallet

I have a private key that was created from an OpenSSL certificate signing request. The CA has accepted the CSR and given my the cert. When I try importing into my Oracle Wallet using orapki I get the error "No matching private key in the wallet". When I try importing the private key just as I would any user cert I get "Invalid Certificate". I've already added all the trusted certificates. Here are the commands used: orapki wallet add -wallet ewallet.p12 -user_cert -cert public.p12 orapki wallet add -wallet ewallet.p12 -user_cert -cert private.txt I'm assuming there's a way to add the private k

Join the discussion →

FCB::Open failed: Could not open file

The machine was restarted while I was shrinking a database and since then the SQL Server (MSSQLSERVER) not starting. After reading the blogs I replaced the master.mdf and mastlog.ldf files from the templates folder with the same file, assuming master database was corrupted as I was shrinking this. However the problem remains and the error log file gives the following message, Starting up database 'msdb'. Starting up database 'mssqlsystemresource'. Error: 17204, Severity: 16, State: 1. FCB::Open failed: Could not open file E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBDa

Join the discussion →

If directory exists in a VB.NET code

I have the following code to create a directory, the task accepts a recordcount and every time the recordcount reaches the required number, say 1000 records, a new directory is created. If the task is run a second time it will add another 1000 records to the existing directories, I want it to skip these existing directories and create a new one. I've tried adding various ifexists, but mess it up all the time, any help would be appreciated Public Sub Main() Dim SourceDirectory As String = "E:\Data" Dim TargetDirectory As String = "E:\CN" Dim FileExtensionsToProcess As String = "CON*.pdf" Dim Fi

Join the discussion →

PHP assoc array to class instance

I saw that the conversion from a class instance (object) to associative array is a simple cast : $array = (array) $yourObject; So if i have class A and an associative array contaning the neccesary fields to fill a class A object would it be enough to do the opposite? e.g $aInstance=(A)$assocArray; If not whats the easiest way to do so?

Join the discussion →

How to make this program print in descending order?

This code runs, but it prints in ascending order. Do I need to change my whole formula? print "Enter an integer \n"; my $root = <STDIN>; my @nums = (100 .. 200); my $i = 0; # code in while loop executes as long as condition is true while ( $i < $#nums ) { print "$nums[$i]\n", if ($nums[$i] % $root == 0); $i++; }

Join the discussion →

How to decrypt a string which hashed using ASP.NET identity

I am using ASP.NET Identity password hasher in my project. Now I need to get the real strings from the hashed string. What can I do to return the real string from the hashed string? private Microsoft.AspNet.IdentityIPasswordHasher _passwordHasher; string hashedString = _passwordHasher.HashPassword('realstring'); This is the code I used for hashing the string: string realString = _passwordHasher.UnHashPassword('hashedstring');

Join the discussion →

How do I apply opacity to a CSS color variable?

I have defined a color variable in vars.css: :root { --color: #f0f0f0; } I want to use this color in main.css, but with some opacity applied: #element { background: (somehow use var(--color) at some opacity); } How would I go about doing this? I am not using any preprocessor, only CSS. I would prefer an all-CSS answer, but I will accept JavaScript/jQuery. I cannot use opacity because I am using a background image that should not be transparent.

Join the discussion →

Use JPA Spring boot with SQL Server

I want to use JPA in Spring boot with SQL Server by STS This is my table: MAVEN <dependencies> <dependency> <groupId>com.hynnet</groupId> <artifactId>sqljdbc-chs</artifactId> <version>4.0.2206.100</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency>

Join the discussion →

How to retrieve PID from windows event log?

I have a python code that uses WMI module of python to get windows event viewer logs. But I am unable to retrieve the PID of the process that generated the log. My code : wmi_obj = wmi.WMI('.') #Initialize WMI object and query. wmi_query = "SELECT * FROM Win32_NTLogEvent WHERE Logfile='System' AND EventType=1" query_result = wmi_obj.query(wmi_query) # Query WMI object query_result is a list of wmi objects. Each object in this list is a windows system log and I want PID of the process that generated this log. I have gone through several msdn docs but couldn't find anything useful there. I want

Join the discussion →

Hangfire FileNotFoundException: Could not load file or assembly DynamicProxyGenAssembly,

I am having an issue with HangFire. After I set a background job, it gets set, but when I open the HangFire dashboard I see the following exception: System.IO.FileNotFoundException: Could not load file or assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. All interfaces are being registered using AutoFac for DI. I am setting up the following in the startup.cs. Here is my code: GlobalConfiguration.Configuration.UseSqlServerStorage("Hangfire"); app.UseHangfireDashboard(); app.UseHangfir

Join the discussion →

Shell into swarm container

I'm unable to connect to a container that's running on a swarm. Seems like the following doesn't work: docker exec -it <container_ID> bash Here is some output: >$ docker service ls ID NAME REPLICAS IMAGE COMMAND 4rliefwe74o5 login 1/1 login-arm64:1.0 >$ docker service ps login ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR 2jk3s2xs7ce62piunbkiptypz login.1 login-arm64:1.0 odroid64-cluster4 Running Running 5 minutes ago Then I'll run: $ docker exec -it 2jk3s2xs7ce62piunbkiptypz bash or $ docker exec -it login.1 bash and see the following errors Error response from daemon: No such containe

Join the discussion →

How to load scripts in MongoDB

I'm using MongoDB version 3.0 and I want to run script.js on database Problem I have find is that mongo is not seeing my file script.js. What I have done step by step: I have installed MongoDB in directory MongoDB\Server\3.0\bin\ I have put script.js inside \bin directory I want to do is run script.js using load() method I have got an error load("script.js") 2016-10-09T22:17:17.557+0200 E - file [script.js] doesn't exist 2016-10-09T22:17:17.558+0200 E QUERY Error: error loading js file: script.js at (shell):1:1 Probably I have put script.js in wrong place but where I should put it? Next step i

Join the discussion →

Failed to execute goal org.apache.maven.plugins: maven-assembly-plugin (GroupId cannot be empty)

I am very much new to maven and Oozie, when i am using the command, ./mkdistro.sh -DskipTests -Dmaven.javadoc.skip=true to build oozie from Oozie-3.3.2 bin folder, i am getting some error message like this. Please help me, i am not able to find any answers on this issue. I am working on Ubuntu (12.04.4 LTS) with java 1.8 (in pom.xml, i have already changed the version to 1.8) and maven 3.2.5 and hadoop version 1.2 [INFO] Reactor Summary: [INFO] [INFO] Apache Oozie Main .................................. SUCCESS [ 2.785 s] [INFO] Apache Oozie Client ................................ SUCCESS [ 18

Join the discussion →

Node.js killed due to out of memory

I'm running Node.js on a server with only 512MB of RAM. The problem is when I run a script, it will be killed due to out of memory. By default the Node.js memory limit is 512MB. So I think using --max-old-space-size is useless. Follows the content of /var/log/syslog: Oct 7 09:24:42 ubuntu-user kernel: [72604.230204] Out of memory: Kill process 6422 (node) score 774 or sacrifice child Oct 7 09:24:42 ubuntu-user kernel: [72604.230351] Killed process 6422 (node) total-vm:1575132kB, anon-rss:396268kB, file-rss:0kB Is there a way to get rid of out of memory without upgrading the memory? (like using

Join the discussion →

PySpark PCA: How can I convert dataframe rows from multiple columns to a single column DenseVector?

I'd like to perform principle component analysis (PCA), using PySpark (Spark 1.6.2), on numerical data that exists in a Hive table. I'm able to import the Hive table to a Spark dataframe: >>> from pyspark.sql import HiveContext >>> hiveContext = HiveContext(sc) >>> dataframe = hiveContext.sql("SELECT * FROM my_table") >>> type(dataframe) <class 'pyspark.sql.dataframe.DataFrame'> >>> dataframe.columns ['par001', 'par002', 'par003', etc...] >>> dataframe.collect() [Row(par001=1.1, par002=5.5, par003=8.2, etc...), Row(par001=0.0, par002=5.7, par003=4.2, etc...), etc...] There's an excellent Stack

Join the discussion →

Facebook API Error: "User does not have sufficient administrative permission for this action on this page."

I'm using a Facebook app (in development mode) to generate a page access token so that my personal web app can schedule/edit/delete posts on a Facebook fan page. I'm using the Graph Explorer to generate the token while logged in as the admin of the fan page. When I use that token, I'm able to GET a list of the scheduled posts, but whenever I try to edit or delete a post, I get this error: "User does not have sufficient administrative permission for this action on this page." Here is the debug of the token: Any ideas on how to fix this?

Join the discussion →

Fail Repeat Transaction in SagePay with NOTAUTHED

I have code to successfully perform a REPEAT transaction against the SagePay test environment. With this I can see that an "OK" result from https://test.sagepay.com/gateway/service/repeat.vsp is working. But is there anyway to get SagePay to return a "NOTAUTHED" result so I can test cases where the customer cannot be billed again (maybe their account is out of funds)?

Join the discussion →

Exchange Web-Services (EWS) Java Api : 401 Unauthorized

When I try to connect to the exchange server, i have an 401 error : microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. The request failed. The remote server returned an error: (401)Unauthorized I tested with https://ewseditor.codeplex.com/ (with same userId, userPw, domain and url) and it works perfectly. This is my actual code : public static void main( String[] args ) { try { CustomExchangeService service = new CustomExchangeService(version); ExchangeCredentials credentials = new WebCredentials(userId, userPw,domain); service.setUrl

Join the discussion →

"find" specific contents [linux]

I would like to go through all the files in the current directory (or sub-directories) and echoes me back the name of files only if they contain certain words. More detail: find -type f -name "*hello *" will give me all file names that have "hello" in their names. But instead of that, I want to search through the files and if that file's content contains "hello" then prints out the name of the file. Is there a way to approach this?

Join the discussion →

Does Linux support memory isolation for processes?

In more detail, the question is: without root permission, is it possible for a process to read (not only write) the memory of another process? (eg. by somehow reading /proc/gcore or /proc/[PID]/mem. I'm not sure their permission requirements yet.) I do understand that virtual address is implemented and each process has its own space. I did a quick search but find neither strong guarantees nor approaches to hack. This article says: Each process in the system has its own virtual address space. These virtual address spaces are completely separate from each other and so a process running one appli

Join the discussion →

Sandbox permission errors in Chrome console but I'm not using any iframes

I keep getting these errors even when the html of my page contains no frames: Blocked script execution in '[url]' because the document's frame is sandboxed and the 'allow-scripts' permission is not set. Blocked form submission to '[url]' because the form's frame is sandboxed and the 'allow-forms' permission is not set. Googling these errors return results mostly for people who are using frames. Simple form and the submit is not js-driven but a regular html submit button... I am lost. Anyone out there getting these for non-frame pages?

Join the discussion →

How to receive image file to API server (Node.js)

I want to build API server by node.js, and I want to post image file to my API server. I was able to write GET method logic in my code but, I have no idea write POST method logic. Please help me. ↓My code (node.js) // preprocessing // import library var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var fs = require('fs'); // post setting app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); // port setting var port = process.env.PORT || 3000; // express setting var router = express.Router(); router.use(function(req, res, n

Join the discussion →

Oracle Universal Connection Pool Error UCP-45060 Invalid life cycle state

I am using Oracle UCP (Universal Connection Pool). I am getting the following error after processing around 100K records. oracle.ucp.UniversalConnectionPoolException: Invalid life cycle state. Check the status of the Universal Connection Pool at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:488) ~[ucp-11.2.0.3.0.jar:11.2.0.3.0] at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:163) ~[ucp-11.2.0.3.0.jar:11.2.0.3.0] at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:943) ~[ucp-11.2.0.3.0.jar:11.2.0.3.0] at oracle.ucp.jdbc.Po

Join the discussion →

Tabs background and font color change when click

I have a tabbed pane in my HTML page. The following changes has to done in the task. When select a tab or hover, background - white, text color - #6baed9, border - 1px same color as text. When tab is unselected (if selected the another tab this become unselected one) - background - #6baed9, text color - white, border - 1px same color as text. My CSS are as following, #my_settings ul.tab li a { display: inline-block; text-align: center; padding: 8px 12px; text-decoration: none; transition: 0.3s; font-size: 17px; height:35px; width:250px; color: #6baed9; } #my_settings ul.tab li a:hover { backgr

Join the discussion →

Does Javascript filter preserve order?

I looked at the documentation and while looking at examples it looks like filter preserves order of the original list (though it returns a new one). Can I rely on that? Ecmascript spec MDN Neither of these reference preserving order. Should I just assume I can't rely on preserved order?

Join the discussion →

How do I correctly use PCA followed by logistic regression?

In the program, I am scanning a number of brain samples taken in a time series of 40 x 64 x 64 images every 2.5 seconds. The number of 'voxels' (3D pixels) in each image is thus approximately 168,000 ish (40 * 64 * 64), each of which is a 'feature' for an image sample. I thought of using principal component analysis (PCA) because of the ridiculously high n to perform dimensionality reduction. I am aware PCA does not actually reduce the number of features. Correct me if I'm wrong, but PCA will produce a new set of features from the original ones. The new features however must follow certain con

Join the discussion →
Older stories