2018-10-22         Eden

JavaScript click addEventListener not working on my code

I am trying to get a JavaScript listener to work but nothing changes.Here is the full code:<!doctype html><html lang="en"><head> <meta charset="utf-8"> <title></title> <style type="text/css"> #trigger { padding: 20px; background-color: red; border: 1px solid white; width: 100px; cursor: pointer; } #box { padding: 20px; background-color: green; border: 1px solid white; width: 100px; cursor: pointer; } </style></head><body> <div id="trigger">Cli...

 javascript                     2 answers                     33 view
 2018-10-22         Eden

Is it possible to link to the n-th character of a HTML page?

In a search component I plan to write, I would like to be able to point to specific places in a web page. As an example, searching for foo would bring all instances of foo across all the pages of my site, to which I would like to provide a link (to the instance of the word foo, not to the page).Is it possible to link to the n-th character of a HTML page? Linking to a section of a page via the url only works when an element is referenced to by it's ID. So if you want to use the same behavior you will need to wrap each character found into an element with a unique Id when ...

 html                     1 answers                     91 view
 2018-10-22         Eden

Is there a gem/plugin that will populate a database with test data?

is there a gem or plugin that will populate a database with test data? As ever, Ryan Bates has a Railscast on this very subject that covers using the Faker and Populator gems. [XXX]For testing, I'm a fan of thoughtbot's factory girl. [XXX]Take a look at Fixtures in Rails. It comes with the standard Rails kit.See Also: A Guide To Testing Rails Applications - see section 2.3 [XXX]I think Red Gate's SQL Data Generator will do that. I use their SQL Prompt product. Pretty popular product it seems. Even Scott Gu blogged about them. [edit] oh, unless you meant for ra...

 ruby-on-rails                     4 answers                     95 view
 2018-10-22         Eden

Automatically answer to input prompt of batch script run by Python

This is rather a unusual use case where I had to make a legacy system to work.I have Windows batch script like following named 'batch_test.bat' (example only):@echo OFFset /P choice=Enter your choice: if /I "%choice%" == "N" ( echo "Don't proceed")if /I "%choice%" == "Y" ( echo "Proceed")if /I "%choice%" == "C" ( echo "Cancel")EXIT /B 0I have following python code (sample):import osos.system('batch_test.bat')Question is how do I feed the choice batch script is expecting from Python? I did some look up but could not find the appropriate answer.thanks. You can use...

 python                     1 answers                     5 view
 2018-10-22         Eden

Fetch details through API from the secondary table using Django

I'm new to Django,Having two databases,DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'global_db', 'USER': 'root', 'PASSWORD': 'abc123', 'HOST': '127.0.0.1', 'PORT': '' }, 'usersdb': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'users', 'USER': 'root', 'PASSWORD': 'abc123', 'HOST': '127.0.0.1', 'PORT': '' }}Created required models and serializers separately. setup required views in views.py class.i'm getting the below error1146, "Table 'global_db.acco...

 django                     2 answers                     32 view
 2018-10-22         Eden

How to make a generic method in Python to execute multiple piped shell commands?

I have many shell commands that need to be executed in my python script. I know that I shouldn't use shell=true as mentioned here and that I can use the std outputs and inputs in case when I have pipes in the command as mentioned here.But the problem is that my shell commands are complex and full of pipes, so I'd like to make a generic method to be used by my script.I made a small test below, but is hanging after printing the result (I simplified just to put here). Can somebody please let me know:Why is hanging.If there's a better method of doing this. Thanks.PS: This is ju...

 python                     2 answers                     77 view
 2018-10-22         Eden

Checking to see if on last option of dropdown in selenium

I'm trying to make a program that is going to keep clicking on the listingnextbtn button until it reaches the last page, the website design makes this tricky so the only way I can do it is by detected that it is on the last option of the page number list dropdown.<div id="pgn-nav" class="pgn-nav"> <a id="listingNextBtn" class="btn blue disabled" role="button" href="#"><span class="btn-txt bg-grey">Prev</span></a> <select id="listingPageNumber" class="pageNumber"> <option value="1">1 - 150</option><option value=...

 python-3.x                     1 answers                     85 view
 2018-10-22         Eden

Have layout with fixed View top of screen with collapsable view underneath

I'm trying to create a layout with the following format:The ViewPager contains a TabLayout each with a Fragment that contains a RecyclerView. I haven't been able to create a layout that works (with everything I've tried either both the red and blue areas scroll or they both stay fixed). Here is my current layout, which scrolls both the red and blue areas. Any ideas on how to achieve my desired layout?<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http...

 android                     1 answers                     82 view
 2018-10-22         Eden

PL/SQL block problem: No data found error

SET SERVEROUTPUT ONDECLARE v_student_id NUMBER := &sv_student_id; v_section_id NUMBER := 89; v_final_grade NUMBER; v_letter_grade CHAR(1);BEGIN SELECT final_grade INTO v_final_grade FROM enrollment WHERE student_id = v_student_id AND section_id = v_section_id; CASE -- outer CASE WHEN v_final_grade IS NULL THEN DBMS_OUTPUT.PUT_LINE ('There is no final grade.'); ELSE CASE -- inner CASE WHEN v_final_grade >= 90 THEN v_letter_grade := 'A'; WHEN v_final_grade >= 80 THEN v_le...

 sql                     5 answers                     47 view
 2018-10-22         Eden

When using multiple WHEN MATCHED statements, do they all execute, or does only one get executed?

If I have multiple WHEN MATCHED statements in a MERGE statement, do they all execute if they're true?My example:DECLARE @X bit = NULL;--skipping the MERGE statement, straight to WHEN MATCHEDWHEN MATCHED AND A = 1 @X = 0;WHEN MATCHED AND B = 1 @X = 1;What is the state of X in each of the 4 possibilities?A|B|X0|0|?0|1|?1|0|?1|1|?Basically, I'm curious if there's an implicit BREAK after each WHEN MATCHED clause. To answer your question, yes, it will only run a single match and then break. However, if you'd like to have logic to allow for conditional matching in the u...

 sql                     3 answers                     66 view
 2018-10-22         Eden

How can parallelism affect number of results?

I have a fairly complex query that looks something like this:create table Items(SomeOtherTableID int,SomeField int)create table SomeOtherTable(Id int,GroupID int)with cte1 as( select SomeOtherTableID,COUNT(*) SubItemCount from Items t where t.SomeField is not null group by SomeOtherTableID),cte2 as( select tc.SomeOtherTableID,ROW_NUMBER() over (partition by a.GroupID order by tc.SubItemCount desc) SubItemRank from Items t inner join SomeOtherTable a on a.Id=t.SomeOtherTableID inner join cte1 ...

 sql-server-2008                     2 answers                     24 view
 2018-10-22         Eden

PyQt4 signals and slots

I am writing my first Python app with PyQt4. I have a MainWindow and a Dialog class, which is a part of MainWindow class:self.loginDialog = LoginDialog();I use slots and signals. Here's a connection made in MainWindow:QtCore.QObject.connect(self.loginDialog, QtCore.SIGNAL("aa(str)"), self.login)And I try to emit signal inside the Dialog class (I'm sure it is emitted):self.emit(QtCore.SIGNAL("aa"), "jacek")Unfortunately, slot is not invoked. I tried with no arguments as well, different styles of emitting signal. No errors, no warnings in the code. What might be the problem? ...

 python                     7 answers                     52 view
 2018-10-22         Eden

"BCP copy in failed" on tsv (no further error message info)

Trying to use BCP utility on linux CentOS7 to copy tsv files into remote MSSQL Server DB (in a Windows Server 2012 machine), getting the curt error message that Starting copy... BCP copy in failedThe BCP command in question is/opt/mssql-tools/bin/bcp "$TABLE" in $DATAFILES/part-m-00000 \ -S -D $SERVER_DSN \ -U $USER \ -P $PASSWORD \ -d $DB \ -c \ -t "\t" \ -e /home/me/projects/bcp-experiments/examples/recent-err-rows.logand the version is[me@mapr001 examples]$ bcp -vBCP - Bulk Copy Program for Microsoft SQL Server.Copyri...

 sql-server                     1 answers                     31 view
 2018-10-22         Eden

.Net Core Async Method for Azure Services

I've created an ASP Net Core (2.0) Web Application with Azure Connected Services, when testing on localhost it works perfect, but when published to IIS it throws the following error: An unhandled exception occurred while processing the request. SocketException: An error occurred during the connection attempt because the connected party did not respond properly after a period of time, or an error occurred in the connection established since the connected host could not respond 40.112.254.71:443I post a txt file from view to controller and send to Azure Service for analysis,...

 c#                     1 answers                     40 view
 2018-10-22         Eden

step by step process : create a firewall in a virtual machine

Please help me to create a firewall in a virtual machine. I know how to create a firewall of a virtual network. And select firewall from Networking option. Deploy and configure Azure Firewall you can refer to https://docs.microsoft.com/en-us/azure/firewall/tutorial-firewall-deploy-portal. [XXX]

 azure                     1 answers                     43 view
 2018-10-22         Eden

How to control an HTML elements from inside a SVG tag

I'm new with .svg files and tags. I want to do something simple, but after 2 days of trawling the net, I did not find exactly what I need. Please HELP.I have a simple svg file with an image and a circle (id=button)as a button, that I want to click and control an HTML element, in this case, hide/show a div (id=test). I have tried svg commands and .js but all unsuccessful.Can anyone help?!<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head&g...

 javascript                     1 answers                     8 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last