on-internet

R: Number of classes is not equal to 2

I am getting the following error when trying to generate a lift chart for a random forest model being run through rattle: Error in prediction(crs$pr, no.miss) : Number of classes is not equal to 2. ROCR currently supports only evaluation of binary classification tasks. My code is as follows: # Evaluate model performance. # Lift Chart: requires the ROCR package. library(ROCR) # Obtain predictions for the rf model on TBA_jul21c.csv [**train**]. crs$pr <- predict(crs$rf, newdata=na.omit(crs$dataset[crs$sample, c(crs$input, crs$target)]), type="prob")[,2] # Remove observations with missing target.

Join the discussion →

How to set the Radio Button based on the value fetched from the database

I have a JTable filled with data about students (student id, name...), and when I select a row from a table, the form opens and its field need to be filled with same values (eg. if Johny Bravo was selected from the table. Then his name should be shown in text filed Name on the form, I did like this txtfieldName.setText(student.getName). My question is how do I set my Radio button automatically (my radio button is Male or Female) when I clicked the field. enter code here tableGuest.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { try{ int row = tableGuest.getSelect

Join the discussion →

Abrir link em nova aba sem usar target="_blank" embutido no HTML

Cenário Estou otimizando uma página onde é exibida cerca de 200 Imagens (muito pequenas não necessita paginar) de parceiros, estas imagens estão envoltas em uma tag <a> e todos os sites dos parceiros abrem em nova aba (target="_blank"). Obs: Vi materiais relacionados no site porem o Javascript usado para responder a pergunta (que também não eram tão semelhantes a esta) era demasiadamente grande o que tiraria toda a economia obtida e necessitariam adaptações ao problema. Pergunta Como posso suprimir o target="_blank" e ainda manter as página abrindo em uma nova aba Código HTML <div id="minor_pa

Join the discussion →

Incremental loading in grid using DataTable as DataSource

In my Windows application, there are many screens with grid. I have used a DataTable as data source of the grid, and the DataTable has some really large data sets (> 50,000), which take a lot time to load data onto the screen if we load all at a time while loading the UI get un-responsive till all data not get loaded. I have implemented incremental loading in that grid using a background worker. Here is the code: // DoWork Event of the background Wroker. private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { while (bgstop) { e.Result = addNewRecord(); if (Convert.ToBoo

Join the discussion →

React's mouseEvent doesn't have offsetX/offsetY

I try get position of click relative to element, but event doesn't have offsetX. onClick(e) { console.log(e.offsetX) // returns undefined console.log(e.target.offsetX) // returns undefined } render() { return <img src='http://placehold.it/1000x500' onClick={this.onClick} /> } How I can get position of click in element?

Join the discussion →

How to determine the IIS ApplicationPoolIdentity account

I'm on Windows Server 2008 R2 Standard (Microsoft Windows Server Version 6.1 Build 7601: Service Pack 1), running IIS 7.5.7600.16385 In IIS Manager for a Site assigned an ApplicationPool with Identity = ApplicationPoolIdentity (the default setting), how do I determine the Windows account the site uses for directory operations? In previous versions of IIS, Application Pools run under the Network Service account. What is default account for ApplicationPoolIdentity? IIS Manager > Server Instance > Application Pools > Application Pool > right-click Set Application Pool Defaults... --OR-- Advanced

Join the discussion →

How to save data in textarea on enter key using ajax like facebook comment?

I have done the code like this in view page and controller done in codeigniter. While pressing enter key multiple times data saving to the table. How can I solve this problem? View Page <form> <div class="cmt-box"> <textarea class="form-control" name="txtArea" id="txtArea<?php echo $row->id;?>" onkeypress="onTestChange(1)" rows="1"></textarea> </div></form> script function onTestChange(id) { $("#txtArea"+id).keypress(function(e) { if(e.which == 13) { dataString=document.getElementById("txtArea"+id).value; $.ajax({ type: "POST", url: "<?php echo site_url('show/insertcomment'); ?>", data: { comm

Join the discussion →

What is the difference between mysqli_prepare() and mysqli_stmt_prepare()?

This article of the PHP manual uses mysqli_prepare() here but mysqli_stmt_* for everything else. However, in this article of the PHP manual, it uses mysqli_stmt_prepare() What is the difference between these? Can I use either? And if mysqli_prepare() is valid, does that mean mysqli_bind_param() is valid? OK, this article for mysqli_bind_param() says it's an alias for mysql_stmt_bind_param(). I guess it's safe to assume it's the same with mysqli_prepare() and the rest of the mysqli_* functions?

Join the discussion →

Adding generic multiple textField in listview in wicket

I need a to populate textFields dynamically in the web page and I have used listview for this: Form <BenificiaryFormModel> registerForm = new Form<BenificiaryFormModel>("registerForm", Model.of(new BenificiaryFormModel())); ListView listView = new ListView("registerListView", benificiaryRegFieldsList) { @Override protected void populateItem(ListItem item) { LOG.debug("Incrementer value {}", incrementer); BenificiaryRegFieldsBean listViewBean = (BenificiaryRegFieldsBean )item.getModelObject(); item.add(new Label("beneficiaryLabel", listViewBean .getLabel())); item.add(new TextField("beneficiary

Join the discussion →

textContent logs as number, but parsing it with Number() gives NaN

Given the circumstances I have to use a node list to get at elements that I need to work with. I am able to use .textContent (or .nodeValue) to return a string that I need, but I am having trouble finding a way to get that string into any type of number. I need to have it in number form so I can perform calculations with it. I have tried Number(), parseInt(), etc. All return NaN. I am pretty new to JS so hopefully this is an easy issue to solve. var siteActual = tdNodeListActual[36].textContent; // location of data console.log(siteActual); // returns the value 1 as it should var asd = Number(s

Join the discussion →

How to make product image slideshows?

I'm working on a Shopify website, and I need to create a couple of image slideshows (for mobile layout only): (1) One for the product collection (2) One for the thumbnails of the product on the product page itself Anybody have any idea how to accomplish either? Thanks.

Join the discussion →

Firefox cross origin images

Whenever I set the crossorigin attribute on an image Firefox doesn't render the image. <img crossorigin="anonymous"> I'm using fabric.js which sets this attribute for me via JavaScript. I need to be able to render cross origin images. It works fine in Chrome and even IE. It seams as if Firefox previously have had some problems with CORS and I'm not sure if it's related, but I can seem to find any solutions to the problem. Since I am using a PHP proxy I have set the the headers: header("Access-Control-Allow-Origin: *"); This works fine in Chrome and even IE. So do any of you know why the image

Join the discussion →

Oracle Database characterset migration from WE8MSWIN1252 to AL32UTF8

Our Confluence database have over 100 tables and it is over 3 GB large. In initial setup the database was created with default characterset (WE8MSWIN1252). But now we want unicode characters to display on Confluence and, so that we want our database characterset to be AL32UTF8. But we don't want to lose any of the data because, it is in production environment. Our confluence 5.7.3 web application is supporting UTF-8 but database does not. How can I converert the Database to AL32UTF8, without loosing any data?

Join the discussion →

How to add functionality a bootstrap search bar

I have a navigation bar set up on my website, I have set up a search bar towards the right of the navigation bar, see code below <nav class="navbar navbar-trans navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapsible"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand text-danger" href="index.php">Network TV</a> </div> <div class="navbar-coll

Join the discussion →

Sending gzip data using restclient or postman

How can I send gzip data as part of body using restclient or postman?. I used apache restclient 3.2.2 also couldn't able to get the response. I have attached images for reference. Basically I have an xml file, want to convert it to gzip first and then send as part of body. To convert to GZip I used online tools to first convert my xml file to gzip and included the converted gzip file as part of body in my restclient. I got following java code and with code I'm getting response properly. But not able to get it working in restclient tool! ! restclient body URL url = new URL(String.format("%s?tid

Join the discussion →

CL_GUI_ALV_TREE Link Click on node

I want to catch events on link click on node. I know how to set link click on column item, it's like: DATA: ls_layout TYPE lvc_s_layi, lt_layout TYPE lvc_t_layi. ls_layout-fieldname = 'Fieldname from table passing to alv tree'. ls_layout-class = cl_gui_column_tree=>item_class_link. APPEND ls_layout to lt_layout. o_cl_gui_tree->add_node( EXPORTING "other parameters... it_item_layout = lt_layout "other parameters... ). But I don't know how to set link click on node. Could you help me? Thanks.

Join the discussion →

How to automatically zip files with Node.js and npm

Is there a way to automatically zip certain files at the build time with Node.js and npm? For example, I have a project, that file structure looks like this: Project/ --lib/ --node_modules/ --test/ --index.js --package.json I want to be able to zip lib folder, certain modules from node_modules and index.js into some zip archive to upload it on the AWS Lambda, for example. I do not need test folder or test Node.js modules (mocha and chai) to be zipped. I have even created a bash script for generating zip file, but is there a way to automatically execute this script, when 'npm install' is called

Join the discussion →

Error in SSLv2/SSLv3 read client hello

Some Background: I am trying to setup reverse proxy for my internal business users for site validation when the external route is down. I am able to setup multiple routes with corresponding virtualhosts entries in httpd.conf for port 80 : anonymous user. Am afraid am stuck at SSL route and unable to make progress. I have been to multiple forums but unable to find a response which assists me in moving further. Server Details: Apache version: Apache/2.2.29 (Unix) Linux Version: $ cat /etc/*-release Enterprise Linux Enterprise Linux Server release 5.8 (Carthage) Oracle Linux Server release 5.8 Re

Join the discussion →

Error creating bean with name 'mongoTemplate'

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class com.socketcruiter.config.SpringMongoConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.mongodb.core.MongoTemplate org.springframework.data.mongodb.config.AbstractMongoConfiguration.mongoTemplate() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingMong

Join the discussion →

Ordered associative arrays in bash

I can do the following in bash: declare -A data data[A]="aaa" data[C]="ccc" data[B]="bbb" for i in "${!data[@]}" ; do printf "%-20s ---> %s\n" "$i" "${data[$i]}" done Which outputs: A ---> aaa B ---> bbb C ---> ccc That is, the associative array is reordered (I assume using lexicographic ordering on the keys, but I am not sure), and loses the original order in which I created the data. I wanted instead: A ---> aaa C ---> ccc B ---> bbb In python I would use an OrderedDict instead of a plain dict for that. Is there a similar concept in bash?

Join the discussion →

How to disable future date in ajax calendarextender

I have an user control in AJAX for the date calendar and I want to disable the future dates in the Calendar. I have tried to do it by using the Maximum Value property but that doesn't disables the control. Any suggestions or help? <%@ Control Language="C#" AutoEventWireup="true" CodeFile="usrCtrlDatePicker.ascx.cs" Inherits="UserControls_usrCtrlDatePicker" %> <table cellspacing="0" cellpadding="0" border="0" style="height:18px;"> <tr> <td style="text-align:center; vertical-align:middle; height:16px"> <asp:TextBox ID="txtDateEntry" runat="server" Width="75px" MaxLength="1" style="text-align:jus

Join the discussion →

Getting compression information of a .tif file in python

I'm currently writing a script to batch compress a bunch of .tif files in python, however some of them are already compressed and some of them aren't. If you go into the properties of a .tif file you can see what compression, if any, is already applied to the file. How can I check this metadata so I can apply some if/then logic in my script to determine whether a .tif file is compressed?

Join the discussion →

What are the notify-keyspace-events in Redis

I started to setup spring project by following this spring-boot article. But suddenly application could not start successfully, instead I am getting the following stack trace: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration: Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: ERR Unsupported CONFIG parameter: no

Join the discussion →

I am getting this error "ERROR: Teradata row not delivered (trget): Numeric overflow occurred during computation"

While executing teradata query in proc sql (SAS), I am getting this error ERROR: Teradata row not delivered (trget): Numeric overflow occurred during computation. I am using SAS EG 9.3. I tried increasing the spool space and I tried with mode=teradat The query is large and has a lot of sum, max and count functions. Can anybody tell me how to troubleshoot this?

Join the discussion →
Older stories