on-internet

Get an input of array using GetOptions

I am trying to get create a file in Perl using GetOptions from Getopt::Long, and one of the inputs is an array. My code looks like this: my $filename = 'grid.sh'; my @job_name; my $output_file; my $testbench; my %opts = ( 'job_name' => \@job_name, 'output' => \$output_file, 'testbench' => \$testbench, ); GetOptions( \%opts, 'job_name=s', 'output=s', 'testbench=s' ); open(my $fh, '>', $filename) or die "Could not open"; for (my $i=0; $i <= 2; $i++) { print $fh "Job names are $job_name[$i]"; } close $fh; In my command line I am providing the input as: perl grip_script.pl "-job_name test -job_nam

Join the discussion →

Error while synthesizing: For loop stop condition should depend on loop variable or be static

When I try to synthesize my Verilog project, I get the following errors: ERROR:Xst:2634 - "shiftman.v" line 15: For loop stop condition should depend on loop variable or be static. ERROR:Xst:2634 - "shiftman.v" line 22: For loop stop condition should depend on loop variable or be static. I think I understand what causes the error, but I can't find a way to fix it. module shiftman(in,sh,out); input[47:0] in; input[8:0] sh; output[47:0] out; reg[47:0] out; reg[7:0] r; reg i; always @(in or sh) begin r = sh[7:0]; out = in; if (sh[8] == 0) for (i=0; i<r; i=i+1) begin out[23:0] = {1'b0,out[23:1]};

Join the discussion →

SQL query to count number of objects in each state on each day

Given a set of database records that record the date when an object enters a particular state, I would like to produce a query that shows how many objects are in each state on any particular date. The results will be used to produce trend reports showing how the number of objects in each state changes over time. I have a table like the following that records the date when an object enters a particular state: ObjID EntryDate State 1 2014-11-01 A 1 2014-11-04 B 1 2014-11-06 C 2 2014-11-01 A 2 2014-11-03 B 2 2014-11-10 C 3 2014-11-03 B 3 2014-11-08 C There are an arbitrary number of objects and s

Join the discussion →

Responsive Masonry layout without predefined widths

I'm creating a 2 column masonry layout using images of different sizes. The images can be any size as long as they have the greatest common divisor (as required by the Masonry plugin). In order to make the layout responsive I'm converting the width of the masonry items into percent (or I can use min-width and width 100%). Update: I noticed that many who answer make both columns 50% as a solution. That works but is not the goal. Images have to retain their original image size. They can shrink but keep the same ratio. $(function () { var container = $('#container'); // Convert .box width from pi

Join the discussion →

zsh history is too short [closed]

When I run history in Bash, I get a load of results (1000+). However, when I run history the zsh shell I only get 15 results. This makes grepping history in zsh mostly useless. My .zshrc file contains the following lines: HISTFILE=~/.zhistory HISTSIZE=SAVEHIST=10000 setopt sharehistory setopt extendedhistory How can I fix zsh to make my shell history more useful? UPDATE If in zsh I call history 1 I get all of my history, just as I do in Bash with history. I could alias the command to get the same result, but I wonder why does history behave differently in zsh and in Bash.

Join the discussion →

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

I am getting below exception org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile. Configuration: RabbitMQ 3.3.5 on windows On Config file in %APPDATA%\RabbitMQ\rabbit.config I have done below change as per https://www.rabbitmq.com/access-control.html [{rabbit, [{loopback_users, []}]}]. I also tried creating a user/pwd - test/test doesn't seem to make it work. Tried the Steps from this post. Other Configuration Details are as below: To

Join the discussion →

How to add RSVP button options in MailChimp template

I've created a party invitation template in MailChimp with an RSVP section within the body of the email that contains 3 buttons: yes maybe no I have also added a custom text field on the list called "RSVP". Is there a way I can automate the user click event to automatically update the profile and target this field? I realize I can add the |UPDATE_PROFILE| merge tag and send the user to a custom form where they choose their RSVP option, but ideally i want to bypass the form and handle the response using the buttons in the email body ONLY. Is this possible?

Join the discussion →

Faster Way to Import Excel Spreadsheet to Array With ADO

I am trying to import and sort data from a large excel report into a new file using Excel 2007 VBA. I have come up with two methods so far for doing this: Have Excel actually open the file (code below), gather all data into arrays and output the arrays onto new sheets in the same file and save/close it. Public Sub GetData() Dim FilePath As String FilePath = "D:\File_Test.xlsx" Workbooks.OpenText Filename:=FilePath, FieldInfo:=Array(Array(2, 2)) ActiveWorkbook.Sheets(1).Select End Sub Use ADO to get all data out of the closed workbook, import the whole datasheet into an array (code below) and s

Join the discussion →

Adding Video Tag in iframe

I have an iframe inside Div in which i want to add video . I have added the URL path for the video correctly but not getting video on the screen neither i am getting any error on the browser console.Here is the HTML for the whole.. <div style="position:relative; width: 100%; height: 0; padding-bottom: 56.25%;"> <iframe width="420" height="315" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"> <video id='video-player' autoplay preload='metadata' controls> <source src="Video/Sapno.MP4" type="video/mp4"> </video> </iframe> </div> Please help

Join the discussion →

Code compiles fine, but simulation does not run

I have had some fairly good experiences with structural modelling in Verilog, but I barely have any with other modelling methods. So, kindly help me out. The code compiles fine, but when simulating, it just hangs. Nothing happens. If it is important, the code is a Montgomery Modular Multiplier. It is a bit above my academic level, but I have managed to understand the algorithm and write the code. Why won't the simulation run? module MMM42(A1,A2,B1,B2,N,S1,S2,clk); input clk; input [3:0]A1,A2,B1,B2,N; output [6:0]S1,S2; reg [3:0]a1,a2,b1,b2,n,bd1,bd2,d1,d2,w,y; reg [6:0]s1,s2,s11,s21,s12,s22; r

Join the discussion →

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class

I’m trying develop SOAP web service client using spring-ws-2.2.0 & spring-boot-1.1.8 in a standalone app, but I get this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class pcc_load.ApexConfiguration: Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "pcc_load/src/com/company/dept/ape

Join the discussion →

Netbeans 7.3.1 Cannot establish a connection to jdbc:derby

Recently I'm working on this little project with Java EE and I need to use derby database , but every time I go to service->Database and try to connect to my jdbc:derby I get this error : Unable to connect. Cannot establish a connection to jdbc:derby://localhost:1527//sample using org.apache.derby.jdbc.ClientDriver (java.netConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect.). and this exception : Wed Oct 29 15:05:26 EET 2014 : access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") java.security.AccessControlExce

Join the discussion →

Web API and report viewer

I have a requirement to produce within a Web API a service that will return a pdf of a local report viewer file. In MVC you can do something like this using FileResult but i'm struggling to replicate this as a HttpResponseMessage. Has anybody ever tried or had success in trying to do anything similar? All my attempts in trying toconvert the byte[] to a stream and then output as an HttpResponse have ended up with empty files. public FileResult File() { // Create a new dataset StudentDataSet ds = new StudentDataSet(); // Create and fill the Student data table // using the Student table adapter S

Join the discussion →

How can I use vector representation of words (as obtained from Word2Vec,etc) as features for a classifier?

I am familiar with using BOW features for text classification, wherein we first find the size of the vocabulary for the corpus which becomes the size of our feature vector. For each sentence/document, and for all its constituent words, we then put 0/1 depending on the absence/presence of that word in that sentence/document. However, now that I am trying to use vector representation of each word, is creating a global vocabulary essential?

Join the discussion →

Trigger File Download within iPython Notebook

Given an iPython notebook running on an external server, is there a way to trigger a file download? I would like to either be able to have the notebook be able to initiate the download of a file living on the the external server to the where the notebook is being rendered locally, or perform a direct string dump from the notebook workspace into a text file, downloaded locally. I.E. a powerful and tool would be a Notebook that can query from a database, alter data, and download the query results as a CSV file. A quick experiment showed that a cell containing the following renders a link which d

Join the discussion →

Why are the data types xml and varchar are incompatible in the add operator

I'm trying to display a column name as well as the data from that column, but can't because of the following error: Msg 402, Level 16, State 1, Line 5 The data types xml and varchar are incompatible in the add operator. Convert or Cast don't work in this instance. Code: select CUSTOMER_ID, CURRENCY, DELIVERY_METHOD, CASE WHEN (COURIER_TRACKING_XML) IS NOT NULL THEN dbo.GetXml(COURIER_TRACKING_XML) + 'Courier' END, CASE WHEN BILLING_ADDRESS IS NOT NULL THEN dbo.GetXml(BILLING_ADDRESS) + 'Billing' END, CASE WHEN DELIVERY_ADDRESS IS NOT NULL THEN dbo.GetXml(DELIVERY_ADDRESS) + 'Delivery' END from

Join the discussion →

Google API 401 Invalid Credentials

I'm trying to use Oauth2 to access Analytics data. I successfully get authorization code from and change it for authorization token. But when I try to get any data from Analytics API I get 401 Invalid Credentials error. The code I'm using is from PHP client library: <?php ini_set('display_errors', 1); error_reporting(E_ALL); require_once 'lib/API/Google_Client.php'; require_once 'lib/API/contrib/Google_AnalyticsService.php'; session_start(); $client = new Google_Client(); $client->setApplicationName("APP name"); $client->setClientId('xxx.apps.googleusercontent.com'); $client->setClientSecret('

Join the discussion →

How do I make a variable detect if it is greater than or less than another one?

I am currently learning Python, and I decided to build a small "Guess the Number" type of game. I am using the random feature, and trying to make it so it will detect if the user's input is equal the the random number. This is my code: irand = randrange(1, 10) while True: number = input ("Pick a number 1-10: ") if number < irand: print (" ") print ("That's too high, try again.") if number > irand: print (" ") print ("That's too low, try again.") if number == irand: print (" ") print ("You got it right! You won!") break I am not exactly sure how to make it detect if number is equal to, less tha

Join the discussion →

Android infinite Scroll List view

I want to implement OnScrollListener to load more data, when scrolled to bottom, dynamically. Following code is giving me NullPointerException, but when I declare BusinessListDataAdapter adapter = new BusinessListDataAdapter(this, this.imgFetcher, this.layoutInflator, this.businesses); inside setBusiness, it doesn't show any error and works fine. Problem with this is when I scroll to the bottom of page it replaces current data in list view with new data but what I wanted is endless scrolling while appending new data instead of replacing so that I can view first data scrolling up import java.ut

Join the discussion →

JavaScript/jQuery VIN Validator

Has anyone ever created a VIN Validator? I am trying to create a textbox where the user will enter in a Vehicle Identification Number and then JS/jQuery will validate if its correct or not in case they mistype the number. I am very new to JS/jQuery and have found some examples but of course have not been able to get them to work correctly... Any one with any ideas or suggestions it would be greatly appreciated, especially if you can tell me how to set up what I have below to work properly! Note: The isVin() function is courtesy of cflib.org HTML: <label name="vin">VIN</label> <input type="text

Join the discussion →

How to fork multiple processes from a same parent?

I am trying to create multiple processes from a same parent, but it always ended up with more processes than expected. I couldn't figure out how to do it and need some help here. I found a piece of code online and tried it, int main () { pid_t pid=0; int i=0; for (i=0; i<3; i++) { pid=fork(); switch(pid) { case 0: { cout<<"\nI am a child and my pid is:"<<getpid(); cout<<endl; exit(0); break; } default: { cout<<"\nI am a parent and my pid is: "<<getpid(); cout<<"\nMy child pid is: "<<pid; cout<<endl; wait(NULL); break; } } } return 0; } This code does work and creates 3 children from same paren

Join the discussion →

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 →

How to deny with 404 on nginx

I want to secure some locations in nginx by supplying deny/allow directives, but I do not want outsider to know that a location is denied. I want outsider to get 404, not 403 http code. My configuration snippet is location /admin/ { uwsgi_pass myupstream1; include /path/to/uwsgi_params; allow 127.0.0.1; deny all; } When I try to visit /admin/ nginx responds with HTTP 403, but I want it respond with HTTP 404. Any recipe for this?

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 →

How to check ECDSA (on p-256) signature using public key from certificate

I have certificate and ECDSA (on p-256) signature. Now I want to verify this signature using the provided certificate. I use C++ (on Windows). Managed code (.NET) can't be used. I found that CryptoAPI doesn'T support ECDSA, so I should use CryptoAPI NG (CNG). However I can't find how to import a public key from a certificate to the CNG. Can you help with my problem?

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 →
Older stories