2018-10-22         Audrey

addEventListener() when the id isn't specified

this to call each of the top menuvar arrayTop=document.getElementById("topmenu").getElementsByTagName("a");for (i=0;i<arrayTop.length;i++){ document.getElementById(arrayTop[i].id).addEventListener("click",topMenu,false);}the HTML<div id="topmenu"> <a id="help" href=#><span>Help</span></a> <a id="frum" href=#><span>Forum</span></a> <a id="home" href=#><span>Home</span></a></div>but,how to apply addEventListener() when the id isn't specified?since some of the elements will have the same...

 javascript                     1 answers                     35 view
 2018-10-22         Audrey

Rails can't find image_magick gem

I am trying to use image_magick gem to process image uploads, but rails can't locate it.I have installed the gem successfully using: gem install mini_magick-1.2.3.gem --localgem update systemgem cleanupand my model hasrequire 'rubygems'require 'mini_magick'However, I still get the error:no such file to load -- mini_magickCan I add something to the environment.rb to point rails to the correct location?Environment information:Windows XP/InstantRails 2.0 ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]Rails 2.3.2Thanks for the help, Sanity check: does gem list mini_mag...

 ruby-on-rails                     1 answers                     97 view
 2018-10-22         Audrey

Batch File Issue with Program Files 86 Java Call

I'm getting a 'The system cannot find the path specified' error message when running a short batch that correctly echos the LAW_JAVA_HOME variable and set the new variable. Even when I run this from the command line CMD - and include the variable - it returns the same error.@ ECHO OFFif not defined LAW_JAVA_BIN ( set LAW_JAVA_BIN=%LAW_JAVA_HOME%\bin)%LAW_JAVA_BIN%\java.exe -Djava.net.preferIPv4Stack=true -jar %LAENVDIR%\java\bin\managegrid.jar %*The path issue is related to this path with should be PF86 - C:\Progra~1\Java\jdk1.6.0_45\bin My comment as an answer:@Echo ...

 batch-file                     1 answers                     7 view
 2018-10-22         Audrey

StringRelatedField not working as expected

I have models,class Reporter(models.Model): name = models.CharField(max_length=50) def __str__(self): return self.nameclass Article(models.Model): title = models.CharField(max_length=100) reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE) def __str__(self): return self.titleand serializer,class ReporterSerializer(serializers.ModelSerializer): article = serializers.StringRelatedField(source='article_set') class Meta: model = Reporter fields = '__all__'and viewsclass ReporterAPI(viewsets.ModelViewSet): queryset...

 django                     2 answers                     34 view
 2018-10-22         Audrey

If-then bash statement as a sequence in Python subprocess

Is there any way to execute the if-then bash statement as a sequence in Python subprocess?I can execute the if-then statement as a string, but I want to convert it into a sequence for a safer code.This is my program at the moment. It uses string as the first input of the subprocess with shell=True argument.# this example worksimport subprocessp = subprocess.Popen('if [ ! -d "dir1" ]; then mkdir dir1; fi;', shell=True)I want to convert the first argument as a sequence with shell=False argument, but I don't know how to make the statement above as a sequence. This is what I've...

 python                     1 answers                     79 view
 2018-10-22         Audrey

How to scroll in an element using selenium in python

I've been searching for a while to find a way to scroll in an element using selenium. I'm already able to scroll up and down the web page, but I haven't found a way to use the scroll bar inside an element. I was wondering if anyone else knew how to do it. You can use execute_script, for example, if we go to a random pastebin link (https://pastebin.com/en0f652r) and use the code below, it will scroll down the pasted code window.driver.execute_script("$('#paste_code').animate({scrollTop: '100px'})")Replace "#paste_code" with the scroll bar element you are wishing to scroll...

 python-3.x                     1 answers                     86 view
 2018-10-22         Audrey

Accept Strings and XML data from Ruby

I want to create REST Server which accepts XML requests and plain text from Ruby code into different controllers. I tried to implement this:@SpringBootApplicationpublic class Application extends SpringBootServletInitializer implements WebMvcConfigurer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } .............. @Override public void extendMessageConverters(List<HttpMessageConverter<?>> converters) { converters.removeIf(converter -&g...

 java                     1 answers                     54 view
 2018-10-22         Audrey

How to set a CSS font-family using JQuery when the font name has a space

I'm trying to set the font-family property using the JQuery css method and running into a problem when the font name has a space.No matter how I quote or don't quote the font name, the element ends up like:<h1 style="font-family: "Comic Sans"">Title Text</h1>with nested double quotes.var font_family = 'Arial Black';var $title_template = $('<h1>Title Text</h1>');var $title;console.log(font_family)$title = $title_template.clone().css({'font-family': font_family});$('body').append($title)font_family = "'Arial Black'";console.log(font_family);$title = $t...

 javascript                     1 answers                     84 view
 2018-10-22         Audrey

How to automate an Excel data sheet to be loaded in the SQL developer?

We get daily data in Excel files and I want to load that Excel sheet data into the database on a daily basis. I want that Excel sheet data to be loaded automatically into the database.How can I set auto-load for this? I am using SQL Developer. One way to solve this is to write an Excel macro in VBA. Saving to CSV first is risky in my experience as data like telephone numbers (represented as text) lose the leading zeros. Furthermore, UK/US date formats can get misinterpreted.The macro can load source files from a directory, validate the spreadsheet in its native format ...

 sql                     1 answers                     49 view
 2018-10-22         Audrey

Python SQL - keep saying 'unsupported format character 'f' (0x66) at index 81' even all attributes' types are correct

This question already has an answer here: ValueError usupported format character 'd' with psycopg2 1 answer In your query string, you always have to use %s placeholders, even when passing a number. All Python objects are converted by Psycopg in their SQL representation, so they get passed to the query as strings.insert_stat = """INSERT INTO measurement VALUES (%(Station)s, %(Date)s, %(Level)s, %(MeanDischarge)s, %(Discharge)s, %(Temp)s, %(EC)s)"""http://...

 python                     2 answers                     67 view
 2018-10-22         Audrey

Reddit Python Bot, why is it unsafe to store login credentials in the script?

I'm following along this tutorial: http://pythonforengineers.com/build-a-reddit-bot-part-1/ and in the Create Reddit App subsection it states that I should not have any login credentials directly in the script, because 'others might see them'.Now, you need to update your praw ini file to remember these settings. Otherwise, you’ll have to put them in your script and thats dangerous (as others might see them).Does my script get uploaded to Reddit, where it can then be read by other people? If not, why is it then unsafe? If you're only developing this bot as a proof of conc...

 python                     1 answers                     8 view
 2018-10-22         Audrey

Key DataType for a high volume SQL Server 2008?

I in the process of designing a database for high volume data and I was wondering what datatype to use for the primary keys?There will be table partitioning and the database will ultimatley be clustered and will be hot failover to alternative datacentres.EDITTables - think chat system for multiple time periods and multiple things to chat about with multiple users chatting about the time period and thing. Exponential issues are what I am thinking about - ie something could generate billions of rows in small time period. ie before we could change the database or DBA doing DB...

 sql-server-2008                     4 answers                     26 view
 2018-10-22         Audrey

Decode %xx in Python 3.6

This question already has an answer here: Transform URL string into normal string in python (%20 to space etc) 3 answers unquote() has been moved to the urllib.parse package in Python 3:>>> from urllib.parse import unquote>>> unquote('%64%6f%63%75%6d%65%6e%74%2e')'document.' [XXX]

 python                     1 answers                     54 view
 2018-10-22         Audrey

Azure Data Factory v2 - SSIS lift and shift

I'm in the process of evaluating the possibilites of lifting and shifting my ssis packages to ADFv2 but without testing I'm finding it hard to see if all SSIS functionalities are supported. For example my package unzips files, modifies contents of files (script task) saving new version in different directory, loads modified files to DB and update data etcWhat I'm not sure about is unzipping the files (I dont want to transfer unzipped files from on prem) and also modifying files with script task. I believe these would have to be moved outside of SSIS and created as an activi...

 azure                     1 answers                     42 view
 2018-10-22         Audrey

Azure VM shutdown

I have 2 VM machines on Azure.One suddenly stopped responding.It was down for around 30 minutes, until I just browsed into the Azure portal, and then I saw it was in the Starting state, and then it was up & running again.How can I tell why my VM was shutdown? EDIT: I'm assuming you're talking about Virtual Machines (IaaS), and not Cloud Services (PaaS).Virtual Machines can, and will, restart, for several reasons. For example:Hardware failure, where your Virtual Machine will then be restarted on another server.Host OS refresh. This is the operating system running the ...

 azure                     2 answers                     44 view
 2018-10-22         Audrey

SVG `use` is rendering blank image

I am trying to use SVGs as CSS background images, and have everything working except for importing external files with use.Here is what I have:CSS and HTML:.shape1 { background: url("shapes/shape1.svg") no-repeat;}<div class="shape1"></div>Then the shapes/shape1.svg file:<svg viewBox="0 0 100 200" xmlns="http://www.w3.org/2000/svg"> <path d=" M 10 10 l 0 180 " fill="none" stroke="#000" stroke-width="1px"/> <use href="parts/part1.svg#build"/></svg>It references the parts/part1.svg file, which contains this:<svg viewBox="0 0 ...

 svg                     1 answers                     10 view

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