on-internet

JavaScript Array#map: index argument

My question is about the map method of arrays in JavaScript. You can pass it a function that takes a second argument, the index of the current element of the array being processed, but... to what purpose? What happens when you do it and what's the difference when you don't? What would you use this feature for?

Join the discussion →

Spring Securirty Granted Authorities always return empty

I am trying to gather user permissions from Active Directory in my Spring 4.0.6 application, using Spring Security 3.2.4. Some details: Authentication works. I can get the current username. Pre-authentication is done by JBoss 7.2 using JCIFS (NTLM). LDAP server works, so host and port are correct. Domain is correct. SecurityConfig.java @Configuration @EnableWebMvcSecurity @PropertySource( "classpath:/resources/ldap-config.properties" ) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Value( "${domain}" ) private String strDomain; @Value( "${ldap.host}" ) private String strHo

Join the discussion →

Create View based on condition in SQL Server

This question is asked several times, but I cann't figure out some things. First, I have situation that I need to create view (must be view), but according to the result of one query. create view as if (select count(oid)...)>1 select1 else select2 I know that this form is not allowed. But how can I accomplish something like this? I have tens of views like this I need to create. Because these SELECT statements contain spatial conditions, and the database is big and has many many tables, I need the 'most optimal' solution, or it will query forever. I read something about using stored procedures

Join the discussion →

In Excel, how can i break ties when ranking students' tests?

I'm doing like a bit of a competition for my students in which they have a weekly test they have to complete and submit. The grade is stored in an excel column next to their names. Following instructions i found, i was able to create a full working general TOP3 with the Average of the tests' grade and when i get to the TOP5 for the grades of the last submitted test, i get a three-way tie. I use the LARGE function to find the top grades and the combination of the INDEX and MATCH functions to find and display the name associated to that mark. (Something like this =INDEX($A$1:$A$29;MATCH(M12;$F$1

Join the discussion →

The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Negotiate,NTLM'

I am trying to connect to a service using the following settings. <bindings> <basicHttpBinding> <binding name="EngineSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096

Join the discussion →

HTML - Keep placeholder when user types

I have an input like this: <input value="My text" placeholder="Placeholder"> When I type something in the input the placeholder text will disappear, that's quite obvious. Now, what I want to do is that I want the placeholder text to stay when the user types so you can see the placeholder text as a background text behind the original text: EDIT: I also want to be able to change the background-text using JavaScript.

Join the discussion →

Trunc date field in mysql like Oracle

I am to not able to use the 'trunc(in oracle)' function in 'mysql' database. I have a table called dlb_cc_purchase and date field called due_date in my 'mysql' database. The data displaying in the date field like 20-11-2014 00:00:00 (20-nov-2014). in oracle we are using query select * from dlbcc_purchase where trunc(due_date) = '20-nov-2014' Oracle DB will fetch the row with due date 20-11-2014 00:00:00. How can I use this function in 'mysql'? I know this is a basic question, but i was trying to do this for long time with truncate, str_to_date... but not able to fetch value. Please help.

Join the discussion →

Alpha shapes in 3D

Is there an "alpha shape" function in 3 dimensions in python, other than the CGAL python bindings? Alternatively, is there a way to extend the example below into 3D? 2D example: draw a smooth polygon around data points in a scatter plot, in matplotlib I'm currently calculating volume using this ConvexHull example, but for my purposes the volumes are inflated due to the "convex" constraint. Thanks,

Join the discussion →

How to configure a WCF service with basicHttpBinding and windows authentication and binary encoding

There are lots of existing questions/answers with subsets of my question (basicHttpBinding with Windows Authentication, using custom bindings, specifying binaryMessageEncoding). However, there are no existing answers with this particular combination of all THREE of those items. I started with a simple WCF service using basicHttpBinding, with Windows authentication, so the bindings section looked like: <bindings> <basicHttpBinding> <binding name="BasicHttpWindowsBinding"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBin

Join the discussion →

Convert object array to hash map, indexed by an attribute value of the Object

Use Case The use case is to convert an array of objects into a hash map based on string or function provided to evaluate and use as the key in the hash map and value as an object itself. A common case of using this is converting an array of objects into a hash map of objects. Code The following is a small snippet in JavaScript to convert an array of objects to a hash map, indexed by the attribute value of object. You can provide a function to evaluate the key of hash map dynamically (run time). function isFunction(func) { return Object.prototype.toString.call(func) === '[object Function]'; } /

Join the discussion →

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (uri:"", local:"fault") after migrating from AXIS to CXF

The Problem I am trying to migrate my web service client from Apache AXIS-1 to Apache CXF. The web service itself runs om AXIS-1 and is out of my control. I generated all the CXF artifacts and the client has been working well until any fault is thrown by the service. The faulty XML looks like: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <soapenv:Fault> <faultcode>soapenv:Server</faultcode> <faultstring>Remote error processing component card request</faultstring> <detail> <fault> <faultcode>:-303</faultcode>

Join the discussion →

jdbc connectTimeout vs jdbc loginTimeout

There is a requirement in our project to support 'jdbc timeout' feature for Postgres (Postgresql driver). we also support Microsoft SQL (JTDS driver) and MySQl (mysql driver). So i want to introduce the 'loginTimeout' as a common feature for all the Databases. While going through documentation of the drivers, i found there is a jdbc parameter called 'loginTimeout' supported from both JTDS and Postgresql drivers but not for Msql http://jtds.sourceforge.net/faq.html loginTimeout (default - 0 for TCP/IP connections or 20 for named pipe connections) The amount of time to wait (in seconds) for a su

Join the discussion →

Refresh Fragment inside tabhost. OnSetUserVisibleHint is not called

I want to do a refresh on my fragment that is inside a tabhost when it is visible. The setup was there is a ViewPager, on page X, there's a fragment with a tabhost and 2 child fragments in it. I want to refresh do something if first child of the tabhost is visible. Please help me. setUserVisibleHint is not called on my fragment(child) but called on the fragment parent. Thanks in Advance.

Join the discussion →

Illustrate command gives "Error reading data. Internal error creating job configuration."

]$ cat webccess.txt mark,yahoo.com,6 sam,google.com,7 john,yahoo.com,3 patrick,cnn.com,8 mary,facebook.com,1 mark,yahoo.com,4 john,bbc.com,10 andrew,twitter.com,3 patrick,twitter.com,9 I am running below task in Cloudera Quick Vm Hue-Pig Shell(Grunt) grunt> stage1 = LOAD '/user/cloudera/webaccess.txt' USING PigStorage(',') AS (name:chararray, website:chararray, access:int); grunt> DUMP stage1; grunt> stage2 = FILTER stage1 by access >= 8; grunt> stage3 = GROUP stage1 by name; grunt> stage4 = FOREACH stage3 GENERATE group as GROUPS, MAX(stage1.access); grunt> DUMP stage4; OUTPUT: (sam,7) (john,

Join the discussion →

IE11 keeps asking for credentials on intranet

We are creating an intranet site and want to use SSO. The problem is however, that Internet Explorer (11) keeps asking for credentials. By specifying the username and password we are able to access it. Then the intranet application can be used without a problem. When Internet Explorer is closed however it asks for credentials again. The problem occurs on the testing machine (running in a domain) and also on my laptop at home which I also use to develop on. I access the test server with Remote Desktop and then test the site on the same machine as it is running on, which is Windows 2012R2 runnin

Join the discussion →

Build Path: Invalid ZIP archive

After searching for an answer to my problem in vain, I would be grateful if you guys could help me out. I'm trying to add sounds to a little game I'm coding. I copy/paste the sound file in the Java project through eclipse, then go right click -> Build Path -> Add to Build Path. Now this is how I learned it and haven't heard of any alternative so far, so I'm gonna guess this is the correct way to do it. However, as soon as I add it to the Build Path, I get an error saying "Invalid ZIP archive: soundname...". First of all, why is it considered a ZIP file when it actually is a WAV file? Should I

Join the discussion →

Sending Multiple emails with Different Attachments

I am trying to send emails to a list of recipients in an Excel spreadsheet, with a different attachment for each of the emails. I created a macro that generates the different emails, but when I added attachments, only the first email of the list is created with the correct attachment. When the loop comes back to the second email it gives me an error message saying that the attachment was not found (I assume this is for the second message). I checked and the file names and paths are correct according to the rules I set in the code. It doesn't create a draft of the second email, but simply tells

Join the discussion →

See the type of a var in Visual Studio

Is there a way to see the type of a var within the Visual Studio 2013 code editor? When I have a crazy linq query it would be nice to see what the resulting type will be. I don't want to replace the var keyword with the actual type, I just want to see what it is.

Join the discussion →

Cannot read property 'addEventListener' of null

I have to use vanilla JavaScript for a project. I have a few functions, one of which is a button that opens a menu. It works on pages where the target id exists, but causes an error on pages where the id doesn't exist. On those pages where the function cannot find the id, I receive a "Cannot read property 'addEventListener' of null " error and none of my other functions work. Below is the code for the button that opens the menu. function swapper() { toggleClass(document.getElementById('overlay'), 'open'); } var el = document.getElementById('overlayBtn'); el.addEventListener('click', swapper, f

Join the discussion →

Get MNC, MCC, LAC and CID from mobile number

I want to create an Android application that shows location of a given mobile number in map. I have found some services: https://unwiredlabs.com/api http://opencellid.org that returns latitude and longitude based on MNC, MCC, LAC and CID There is also Google Maps Geolocation API that returns latitude, longitude based on MNC, MCC, LAC and CID. Therefore, I need this MNC, MCC, LAC and CID information from a given number. I have found that this Andoid API returns the current device's cellular information. Is there any Android API or third party service which returns cellular information based on

Join the discussion →

TypeError: Cannot read property 'node' of undefined

I'm trying to install NPM. I first ran brew install node then curl -O https://www.npmjs.org/install.sh then ~ % sh install.sh this is what I get tar=/usr/bin/tar version: bsdtar 2.8.3 - libarchive 2.8.3 install npm@latest fetching: http://registry.npmjs.org/npm/-/npm-2.0.2.tgz /private/var/folders/92/2l_j234x7n7bys14466b4dcr0000gn/T/npm.12852/package/bin/read-package-json.js:18 val = val[f] ^ TypeError: Cannot read property 'node' of undefined at /private/var/folders/92/2l_j234x7n7bys14466b4dcr0000gn/T/npm.12852/package/bin/read-package-json.js:18:16 at Array.forEach (native) at /private/var/f

Join the discussion →

Youtube API get a video?

I am trying to get a simple thing - a video, and i just can't understand why such a simple thing, is not clearly defined in the API docs. To search for a video i have : https://www.googleapis.com/youtube/v3/search?part=snippet&q=guy&key=api key Than , i get the json, with results like : "kind": "youtube#searchListResponse", "etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/_yCHjN-Yei6to4bLpd2j603Ea18\"", "nextPageToken": "CAUQAA", "pageInfo": { "totalResults": 223929, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#searchResult", "etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/ruSBEQPUZp3DX2M8M4bcCPny2fc\"",

Join the discussion →

How to insert data into the database using spring + hibernate?

see i m havving user.java for the user info. @Entity(name = "user") @Table(name = "user") public class User { @Id @Column(name = "id") private String id; @Column(name = "password") private String password; //getter and setter for this.. } this is my userdao public class UserDao { public interface UserDAO { public String insert(User user); } } and this is the impl class for inserting into database see this was my code.please check it and tell me what i m doing wrong @Repository @Transactional public class UserImpl implements UserDAO { private DataSource dataSource; @Autowired SessionFactory ses

Join the discussion →

Ipython Kernel Restart

Well , I had this problem of Restarting kernel periodically so tried to upgrade ipython and successfully upgraded . But then now I am trying to open ipython notebook ipython notebook --pylab inline So I am getting Following Error Traceback (most recent call last): File "/usr/local/bin/ipython", line 9, in load_entry_point('ipython==2.2.0', 'console_scripts', 'ipython')() File "/usr/local/lib/python2.7/dist-packages/ipython-2.2.0-py2.7.egg/IPython/init.py", line 120, in start_ipython return launch_new_instance(argv=argv, **kwargs) File "/usr/local/lib/python2.7/dist-packages/ipython-2.2.0-py2.7

Join the discussion →

Bootstrap Validator not working on File Input

I have a form field that should only accept a .jpg or .png image at a certain file size. The validation doesn't seem to be working(tested with invalid file types). This is what I have so far, so what is it I'm missing? I should work like it does here http://bootstrapvalidator.com/validators/file/ jsFiddle: http://jsfiddle.net/933yvfmh/3/ <div class="container-fluid"> <form id="fileupload"> <div class="row top"> <div class="col-md-4"></div> <div class="col-md-4 logo">Image Cropper</div> <div class="col-md-4"></div> </div> <div class="row"> <div class="col-md-6"> <div class="panel crop"> <div cl

Join the discussion →

Exception: .Net SqlClient Data Provider at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,

I'm doing sitecore 7.0 Installation with installer but every time when the database is set up it throws the same error: Exception: .Net SqlClient Data Provider at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParse

Join the discussion →

Filtering gridview with textbox in header

Soo I'm trying to filter my gridview with textboxes in the header. I created a textchanged method for every textbox. Now I want to filter the gridview and bind the filtered data. For some reason the datasource is null once it hits the textchanged method. See my code below: <asp:GridView ID="GridView_Imported" runat="server" CssClass="GridView-Upload" Width="100%" OnRowDataBound="GridView_Imported_RowDataBound" HorizontalAlign="Center" AutoGenerateColumns="False"> <Columns> <asp:TemplateField> <HeaderTemplate> <asp:CheckBox ID="checkAll" runat="server" CssClass="checkAll" onclick="checkAll(this

Join the discussion →

npm install fails with "Cannot find module 'glob'"

Here is the output on the console: floydpink@MBP mean-app (master) $ npm install npm ERR! Darwin 13.4.0 npm ERR! argv "node" "/usr/local/bin/npm" "install" npm ERR! node v0.10.32 npm ERR! npm v2.0.0 npm ERR! code MODULE_NOT_FOUND npm ERR! Cannot find module 'glob' npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! <http://github.com/npm/npm/issues> npm ERR! Please include the following file with any support request: npm ERR! /Users/floydpink/Source/swara-server/mean-app/npm-debug.log floydpink@MBP mean-app (master) $ And the npm-debug.log: 0 info it worked if it ends wi

Join the discussion →
Older stories