Wednesday, March 28, 2018

Chrome - if jquery-simple-combobox is inside a modal collapses when mouse dragging

Leave a Comment

I'm trying to learn to work with jquery.scombobox but I'm stuck when adding the scombobox to a modal

<div id="modalA" class="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">         <div class="modal-dialog">                 <div class="modal-header">                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>                     <h4 class="modal-title">My Modal</h4>                 </div>                 <div class="modal-body">                     <select id="combo-021">                         <option value="1">item 1</option>                         <option value="2">item 2</option>                         <option value="3">item 3</option>                         <option value="4">item 3</option>                         <option value="5">item 3</option>                         <option value="6">item 3</option>                         <option value="7">item 3</option>                         <option value="8">item 3</option>                         <option value="9">item 3</option>                         <option value="10">item 3</option>                         <option value="11">item 3</option>                         <option value="12">item 3</option>                         <option value="13">item 3</option>                         <option value="14">item 3</option>                         <option value="15">item 3</option>                         <option value="16">item 3</option>                         <option value="17">item 3</option>                         <option value="18">item 3</option>                         <option value="19">item 3</option>                         <option value="20">item 3</option>                         <option value="21">item 3</option>                         <option value="22">item 3</option>                         <option value="23">item 3</option>                         <option value="24">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                         <option value="3">item 3</option>                     </select>             </div>         </div>     </div>    $('#combo-021').scombobox({ showDropDown: true // this is what is set by default }); 

For multiple items it adds a scrollbar in the right. I can scroll trough the items by using the mouse scroll wheel but when trying to click on the scrollbar and dragging it, the dropdown collapses. Did anyone encounter the same problem? Why is this happening?

JSFiddle

1 Answers

Answers 1

Problem is

tabindex="-1" 

When you delete this attribute, it work correct.

Here is info about atribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

http://jsfiddle.net/d3fr0aeo/

Read More

Xamarin Android linking cannot access file

Leave a Comment

I have a Xamarin Android project that I am trying to use Sdk and User Assembly linking with.

If I set the Android project to Sdk Assembly Linking only, the APK is created and deployed successfully and works.

However, when I set Sdk and User Assembly linking, with no other changes, I get the following error only when I deploy. The solution builds succesfully.

The "LinkAssemblies" task failed unexpectedly.     System.IO.IOException: The process cannot access the file '<path-to-project>\AppName\AppName.Android\obj\Release\android\assets\AppName.Core.dll' because it is being used by another process.     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)     at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)     at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)     at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)     at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)     at Mono.Linker.Steps.BaseStep.Process(LinkContext context)     at Mono.Linker.Pipeline.Process(LinkContext context)     at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)     at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)     at Xamarin.Android.Tasks.LinkAssemblies.Execute()     at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()     at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() 

AppName.Core.dll is another library project in my solution that is set to build as NetStandard 2.0.

I have looked through many other bug reports and forum posts regarding a similar issue to this, but most seem related to an earlier bug with Visual Studio 15.5.1 that has since been fixed.

Regardless, I have tried just about every solution suggested in those links including:

  • closing and reopening Visual Studio
  • deleting /bin and /obj folders
  • opening Visual Studio as Administrator
  • running MsBuild from a command prompt with VS closed

As well as various combinations of the above.

My custom linker.xml contains an exception for my library project:

<?xml version="1.0" encoding="utf-8" ?> <linker>         ...         <assembly fullname="AppName.Core" ></assembly>             ...         </linker> 

As this point I seem to have exhausted all available options and am no closer to a workable solution. Suggestions on solutions, workarounds, or other debugging paths to follow would be most appreciated.

My Android Options config:

Android Options

Version Information:

  • Visual Studio Version: 15.5.6
  • Xamarin Forms Version: 2.5.0.280555
  • Xamarin Version: 26.1.0.1

1 Answers

Answers 1

Please refer this link :

https://forums.xamarin.com/discussion/32976/updating-xamarin-broke-the-build-process-the-process-cannot-access-the-file-appname-dll-mdb

There are two solutions :

  1. Close Visual Studio
  2. deleting all the files in the bin\Debug folder
  3. delete the .suo file
  4. open Visual Studio in Administrator mode

If you have Xamarin Studio try this :

  1. Open the solution in XamarinStudio and deploy it to the Android phone
  2. Close the XamarinStudio
  3. Open the solution in VisualStudio and deploy it to Android Phone

Hope this helps!!

Read More

Tuesday, March 27, 2018

Add JIRA OAuth to my WebApp

Leave a Comment

I am developing a web app. I want to add JIRA based Authentication to the app. Just like "Login with Google" or "Login with Facebook", I am trying to implement "Login with JIRA". I am following this article https://developer.atlassian.com/server/jira/platform/oauth to configure OAuth using "Application Link". In Step 2. Do the “OAuth dance”, point 4, the user will be redirected to JIRA and he will be asked to allow access. Now we will get verification token. In normal OAuth flows like "login with Google", we won't get this verification token. We will be automatically redirected to the web app. So what is this Verification token? How to avoid this step and make user redirect to web app after approving the access? Is there a library to make this JIRA OAuth simple to use?

1 Answers

Answers 1

Verification step is mandatory in OAuth1

Read More

Is there an equivalent for using matplotlib.image in ruby

Leave a Comment

Been experimenting with using Ruby inside a jupyter notebook. With Python I can do this

import matplotlib.image as mpimg 

Does anyone know the equivalent with Ruby, I have not been able to find it in any of the iRuby or sciruby documentation?

To clarify a little, In my gemfile I have this

gem 'iruby' gem 'cztop' gem 'matplotlib' 

But cannot seem to get access to the image part of matplotlib that I am use to using in python.

I am trying to find the Ruby version of what, in Python, I would write like this

#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg ...  %matplotlib inline  #reading in an image image = mpimg.imread('test_images/solidWhiteRight.jpg')  #printing out some stats and plotting print('This image is:', type(image), 'with dimesions:', image.shape) plt.imshow(image)  #call as plt.imshow(gray, cmap='gray') to show a grayscaled image 

Thanks so much for any suggestions

1 Answers

Answers 1

This is how far I can get it to work in jupyter notebook on MacOSX:

require 'matplotlib/pyplot' plt = Matplotlib::Pyplot  image = plt.imread 'test.png'  puts "This image's dimensions: #{image.shape}"  plt.imshow(image) plt.show() 

I used your Gemfile with the additional gem rbczmq to avoid the kernel dying (hint found here):

gem 'iruby' gem 'cztop' gem 'matplotlib' gem 'rbczmq' 

Note that I used a .png because matplotlib can only read PNGs natively without PIL installed.

This is how the result will look like:

enter image description here

Displaying the result inline as in the python version:

enter image description here

seems to be impossible.

Read More

Protractor find parent element

Leave a Comment
<label class="radio inline check">              <input class="input ng-new ng-valid" name="BookType" required="" type="radio">              <!---->              <!---->             Fiction </label>  <label class="radio inline check">                 <input class="input ng-new ng-valid" name="BookType" required="" type="radio">              <!---->              <!---->             NonFiction </label>  <label class="radio inline check">              <input class="input ng-new ng-valid" name="BookTypeReal" required="" type="radio">              <!---->              <!---->             Fiction </label>  <label class="radio inline check">                 <input class="input ng-new ng-valid" name="BookTypeReal" required="" type="radio">              <!---->              <!---->             Fantasy </label> 

http://www.protractortest.org/#/api?view=ElementArrayFinder.prototype.filter

If I use

element.all(locator).filter(filterFn)  

the text returned is empty.

How can I go to parent element <label> to get the text?

label[class="radio inline check"]  

returns 60 elements where more than one getText will return same text so it won't be unique.

input[name="BookType"]  

returns two elements where each element is unique.

5 Answers

Answers 1

To click on the <input> tag whose <label> has text as Fiction and <input> tag has name as BookType you can use the following xpath :

"//label[@class='radio inline check' and contains(normalize-space(), 'Fiction')]/input[@class='input ng-new ng-valid' and @name='BookType']" 

Answers 2

If you need to click a radio button with @type="BookType" and parent label with text "Fiction", you can try below code:

element(By.xpath("//label[.='Fiction']/input[@name='BookType']")).click(); 

Answers 3

You have two options to do it:

  1. To get the parent element, as you mentioned. For this you can use xpath's ancestor for it like this:

    .//*[@name='BookType']/ancestor::label

  2. To get the text as the sibling of the element with @name='BookType':

    .//*[@name='BookType']/following-sibling::text()[normalize-space()]

Answers 4

In Xpath if you want parent of input you can use //input[name="BookType"]/..

Answers 5

i have framed this based on available details over the net. Please give a try.

element.all(by.css('.radio inline check')).filter(function(elem){         return elem.element(by.xpath("//*[text()[contains(.,'Fiction')]]")).getText()          }).then(function(filteredElements){         filteredElements.first().element(by.css('input[name=BookType]')).click();         }); 

Note: You may have some format issue in this.

Read More

JavaConfig format of TransportGuarantee.CONFIDENTIAL related code for Tomcat 8.5

Leave a Comment

My goal is to have my Tomcat 8.5 application serve pages soley through https. In my ApplicationInitializer, I have this block of code:

ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/");  if (Environment.PRODUCTION.getValue().equals(EnvironmentUtil.getEnvironmentName())) { //checked that the flow of control reaches here.  yes, I know it should be using spring profiles instead    HttpConstraintElement forceHttpsConstraint = new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL);    ServletSecurityElement securityElement = new ServletSecurityElement(forceHttpsConstraint);            dispatcher.setServletSecurity(securityElement); } 

However, now I can't get the same effect unless I specifically add this to the web.xml:

<security-constraint>     <web-resource-collection>         <web-resource-name>Automatic Forward to HTTPS/SSL         </web-resource-name>         <url-pattern>/*</url-pattern>     </web-resource-collection>     <user-data-constraint>         <transport-guarantee>CONFIDENTIAL</transport-guarantee>     </user-data-constraint> </security-constraint> 

Are these two blocks equivalent? If so, why would the latter work and not the former?

I am trying to figure out why this would be the case. We recently switched from Tomcat 8 to Tomcat 8.5, so wondering whether that would be the issue. We also upgraded from Spring 4.3.11 to 4.3.14, but I don't know whether that would cause it either.

0 Answers

Read More

live MySQL db accepts 'CURRENT_TIMESTAMP" as datetime value - local does not

Leave a Comment

I've picked up on a project that's a few years old, and noted CURRENT_TIMESTAMP is being sent with a lot of the php calls to update the datetime field in a lot of rows. This works perfectly on the live environment - however, on my local setup, it does not.

Both the Live DB, and my local version from the WAMP64 download are running on MySQL5.7.19.

A PHP script running a query that involves inserting CURRENT_TIMESTAMP will return back with the following error;

Invalid default value for 'last_update' timestamp 

Again though, on the live server, this works without issue. Both are using MySQLi to carry out these insert queries.

Is there something I'm missing here? Some sort of server-side config setting that allows CURRENT_TIME to be inserted into the timestamp field?

4 Answers

Answers 1

The CURRENT_TIMESTAMP field automatically pick the current time of server.or will only accept the timestamp values.

So DATETIME fields must be left either with a null default value, or no default value at all - default values must be a constant value, not the result of an expression.

relevant docs: http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html

You can work around this by setting a post-insert trigger on the table to fill in a "now" value on any new records.

Answers 2

The specific column must be missing in the insert statement because the error message stated Invalid default value. Please take a look at: Invalid default value for 'create_date' timestamp field (and read the helpful comments here). ;-)

Answers 3

Perhaps database lost the default value for the date. You can try either of the following:

ALTER TABLE mydb.mytable MODIFY myfield datetime DEFAULT CURRENT_TIMESTAMP; 

Or

ALTER TABLE mydb.mytable MODIFY myfield datetime DEFAULT NOW(); 

Answers 4

  1. If you are inserting the last_update value manually from php code then make the mysql filed as var-char as you passing the date is not recognize by database as date and this error is occurring.

  2. Or you can just set the default value as CURRENT_TIMESTAMP and set attribute as on update insert CURRENT_TIMESTAMP. enter image description here

So that when ever any update on filed it will update the CURRENT_TIMESTAMP automatically.

Read More