I have a Snozberry object that looks like this: { "id":"3cbdb746-561d-4e21-82e0-b7cfcad3a094", "thingId":"7cbfb7a6-763d-6ef1-271b-b2a0cfc2fa43", "stuffId":81, "bits":"WooHoo" } Java class (constructor, getter & setters omitted for brevity): @Document(collection="Snozberry") public class Snozberry { @Id private UUID id; private UUID thingId; private Long stuffId; private String bits; } The repository looks like: public interface SnozberryRepository extends MongoRepository<Snozberry,UUID>{ Snozberry findByThingId(UUID Id); Snozberry findById(UUID id); } In the MongoDB collection, the _id & thing
In python I need to print a diff of two binary files. I was looking at difflib.Differ which does a lot. However differ assumes lines of text and so the output does not list the byte index and the hex value difference. What I need is output that has what byte is different, how the byte is different, the actual hex values of the two bytes. In Python, how do you compare two binary files (output: the byte diff index, the hex values of the two bytes)? I was doing something like: # /usr/bin/env python2 import difflib x = open('/path/to/file1', 'r').read() y = open('/path/to/file2', 'r').read() print
Say you have an array of unique values and want to push new elements from another array, that meet a condition, without creating duplicates. E.g. newArray.forEach(function(element){ if (condition) { oldArray.push(element); } }) With regards to performance in Javascript, is it better to check, in every iteration of the loop, if the element exists already before pushing to the array, or to add all the elements that meet the condition, and then run _.uniq from underscore.js? newArray.forEach(function(element){ if (condition && !oldArray.includes(element)) { oldArray.push(element); } }) versus: ne
I'm developing an app in my spare time and one of the elements requires a user to be able to create an event within the app but I want the event to be created and synced with the google calendar. I have followed the quickstart guide but that only shows a list of current events. I essentially want to add to this but allow a user to create an event as well as view their existing ones.
I am doing GUI programming using Tkinter on Python. I am using the grid manager to make widgets. I have created several buttons and I want to upload an image on top of them. When I enter this code, it gives me an escape sequence error. I heard using PIL is not a good idea? Is that true? cookImage = PhotoImage(file = "image/C:\Users\terimaa\AppData\Local\Programs\Python\Python36-32\cook.gif")
I have DB tables where there are no identity column. We have client data fetched from DB2 to SQL Server and unfortunately DB2 design doesn't have identity columns. Now we have some data inserted, updated and deleted from source (DB2/SQL Server) and these data I want to load to destination (SQL Server) using some incremental load concept. I tried SSIS lookups in Dataflow task however it's taking huge time to simply insert one new record. Please note that, in "lookup transformation editor" I'm mapping all "available input columns" to available "available lookup columns " as there is no identity
I have a link in my webpage to close window in javascript : <a href="#" onclick="window.close()">Close the window</a> But when I click it, I have this error in console : Scripts may close only the windows that were opened by it. I have done a search on google, and now, I know why. This is the normal behavior (for security reasons I think). But when I send the link of my page via Outlook, and then, I click to close the page : It works ! Why ???
I am trying to get rounded buttons for my script using tkinter. I found the following code in an answer to How to make a Button using the tkinter Canvas widget?: from tkinter import * import tkinter as tk class CustomButton(tk.Canvas): def __init__(self, parent, width, height, color, command=None): tk.Canvas.__init__(self, parent, borderwidth=1, relief="raised", highlightthickness=0) self.command = command padding = 4 id = self.create_oval((padding,padding, width+padding, height+padding), outline=color, fill=color) (x0,y0,x1,y1) = self.bbox("all") width = (x1-x0) + padding height = (y1-y0) + p
I'm working on an android application on tablet to draw every points touched by the finger or the hand. It is very important for the application to track not only the fingers but also the palm (even if it's not drawing the exact touched area but only a thin path, as long as we can see the movement of the palm it's fine). A good example of what I want to do is the "show pointer location" in the Android developer menu : if the drawing could be exactly like this, that would be perfect. I managed to code a multi-touch drawing app, but the problem I have here is that every time the touched area is
I know this error is common, I tried some solutions I looked up and still can't understand what is wrong. I guess it is due to the mutable form of row and row1, but i can't figure it out What am I trying to do ? I have 2 dataframes. I need to iterate over the rows of the first 1, and for each line of the first one iterate through the second and check the value of the cell for some columns. My code and different attempts : a=0 b=0 for row in Correction.iterrows(): b+=1 for row1 in dataframe.iterrows(): c+=1 a=0 print('Handling correction '+str(b)+' and deal '+str(c)) if (Correction.loc[row,['BO
I am not quite familiar with the google docs form. My sister requests to make her multiple choice options in her survey form appear horizontal just like this form (see image below) Now my question is, how can I make horizontal multiple choice options? If it is done with a script/markup language it's fine for me.
I'm working on a npm package called foobar, locally, to allow me to make changes or modifications in real time without having to publish/unpublish to improve development time and sanity. In projectTest, I have linked foobar by using the command npm link foobar. If you don't know, the npm link flag creates a symlink to your globals (you can read more about it here: https://docs.npmjs.com/cli/link) The projectTest happens to be a Reactjs project, written in ES2015, Webpack, babel, etc; and where I do import { x } from 'package', without any issues, etc. As mentioned, the package foobar exists in
I have a encoded string which was encoded using below command on linux machine, cat <file-name> | gzip | base64 -w0 And I am able to decode and string using below method, echo '<encoded-string> | base64 -di | zcat Is there any way to decode the same string on windows machine.
I'm trying to flatten a JSON consisting of nested objects. The top layer contains several key/value pairs, where each value is itself an array of a number of objects (the bottom layer). What I would like to get, using jq, is simply an array of objects containing all the objects of the bottom layer, each of which with an additional key/value pair identifying the top-layer key it originally belonged to. In other words, I would like to turn a JSON { "key1": [obj1, obj2], "key2": [obj3] } into a plain array [OBJ1, OBJ2, OBJ3] where each OBJi is simply the original object with an extra key/value pa
I use TF-IDF to affect weight that can help me to construct my dictionary. But my model is not really good enough, because I have unstructured text. Are there some suitable similar algorithms to TF-IDF?
I'm writing a powershell script to call a RESTful API and I need to parse the response. I'm having trouble parsing the response because there isn't a key name to the array. The API just returns contents of an array: [ { "ProfileId": "b9b4bf0b-fea3-4464-af91-b79b521d36ba", "SourcePhoneNumber": "8880001111", "FirstName": "Peter" }, { "ProfileId": "b9b4bf1b-cta3-4464-af91-b68c521d36ba", "SourcePhoneNumber": "8660001111", "FirstName": "Fred" } ] Here's how I'm calling the API and getting the response: $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("co
I am trying to run this below code, then I got code error: ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- selenium-webdriver (LoadError) I am not able to find what I am missing please help me with this require "selenium-webdriver" # Firefox browser instantiation driver = Selenium::WebDriver.for :firefox #Loading the assertselenium URL driver.navigate.to "http://www.assertselenium.com" #Clicking on the Follow link present on the assertselenium home page FollowButton = driver.find_element(:link, "Follow") FollowButton.click #Typing the UserName LoginButt
I have a powershell script which validate multiple tests in each windows image. But the below specific test require domain credentials to be used to run successfully when I use this script! Can anyone help me to fix ? if (($ImageName -like "*dev*") -or ($ImageName -like "*bare*")) { #$ADE1 = Invoke-Expression ('C:\ade\bin\ade.exe | select-string -pattern "begintrans"') | out-string ; $ADE = $ADE1.trim().split("")[1] Invoke-Expression ('C:\ade\bin\ade.exe | select-string -pattern "begintrans"') > C:\Temp\ade_check.txt $ADE1 = Get-Content C:\Temp\ade_check.txt | Select-String "begintrans" | out-
I tried to test one-to-many relationship for Hibernate. I defined Post and PostComment entities as below: Post.java import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "post") public class Post { @Id @Column(name="post_id") @GeneratedValue(strategy= GenerationType.IDENTITY) private Long postId; @Column(name="title") private String title; @OneToMany(cascade = CascadeType.ALL, mappedBy = "post", orphanRemoval = true) private List<PostComment> comments = new ArrayList<>(); public Post() {}; public Post(String title) { this.title = title; } // Add g
I am trying to trigger gradle command in execute shell of a particular node from jenkins master and it's trowing an exception as- gradle: command not found Build step 'Execute shell' marked build as failure However, gradle command works if am trying to execute shell in the same node itself under local workspace. What I understood- Triggering any job from remote by default try to search executable like 'adb', 'gradle' in /usr/local/bin of node machine (Macintosh) read-write access should be there for '.gradle' folder What I have done- added .gradle inside /usr/local/bin of slave granted read-wr
Im new to angularjs and im trying to export the data xlsx format but my data is not coming can any one help me out in this how to export since i have parse the json data csv also but still if any can help it would easy for please make it in fiddle and send me, thanks in advance. <html ng-app="myApp"> <script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script> <script src="http://alasql.org/console/alasql.min.js"></script> <script src="http://alasql.org/console/xlsx.core.min.js"></script> <button ng-click="exportData()" class="btn btn-primary" s
I have created a Swing application in Netbeans that is basically a chat system (between multiple clients and server using socket programming). Now I wanted to run this application on a webpage. Is this possible without changing any code?
I am having trouble while trying to understand the concept of semi-join and how it is different from conventional join. I have tried some article already but not satisfied with the explanation, could someone please help me to understand it?
I have recently been working on a few algorithms and have gotten stuck on the following problem: Given an undirected unweighted possibly disconnected graph G(V, E), find k partitions of G, such that each partition has the same number of vertices (assume the total number of vertices is a multiple of k) and that there is a minimum number of edges in G that connect vertices in different partitions. I am not looking for a polynomial time algorithm for this problem (as it is probably NP-hard anyway), but rather an algorithm that will find a solution for 150 vertices and 1200 edges in under 24 hours
So I have this Company entity, I'm having an error every time I add a company. I'm using PostgreSQL for my database and I use double quote literals to map the columns of the table in pascalcase. Company entity: @Entity @XmlRootElement public class Company { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="\"Id\"") private Long id; @Column(name="\"Name\"") private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } Company Endpoint: @Sta
Hi,I build a project with spring boot & spring security. Now, I want to provider the login restfull service for Jquery.ajax({...}); And I want to: process the login request from HTML page (like the <form> submit). automatic to check session timeout when HTML page request, redirect timeout to login page. process the login request from Ajax. automatic to check the login state when Ajax request. I coding like this SecurityConfig extends from WebSecurityConfigurerAdapter @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.exceptionHandling().authent
I have a workbook with some protected sheets. Users enter data into specific cells of each sheet. I want the active cell background color to change - for example to red - when it is highlighted and back to the original color when deselected. I would like to find a macro to assign it to the workbook instead of each worksheet. I think this code is useful but since I'm a beginner I don't know which parameter should be changed to fit my demand. Sub ColorCells() Dim Data As Range Dim cell As Range Set currentsheet = ActiveWorkbook.Sheets("Ekandari") Set Data = currentsheet.Range("C5:D5,F5:M5,L9") F
I installed Icecast 2.4.3 on my server using direct download to get the latest version available. In this way, I don't use the version distributed by my distribution (debian 8) and thus don't have the daemon activated by default. I found a script that I modified with my corresponding paths, but the execution is in error. The script icecast.sh : #!/bin/bash # # Init file for Icecast server daemon # # chkconfig: 345 55 25 # description: Icecast streaming mp3 server daemon # # processname: icecast # config: /etc/icecast.xml # pidfile: /var/run/icecast.pid # source function library # . /etc/rc.d/i
I want to get data from SharePoint list by CSOM library on .Net Core MVC application. There are absolutely no problem to achieve that on .Net Framework aplication because Microsoft.SharePoint.Client library contains ExecuteQuery method. Unfortunately .Net Core equivalent not. I've made Async function public async Task<ActionResult> GetRequests() { ClientContext context = new ClientContext("https://xxx/sites/xxx/"); List certificatesList = context.Web.Lists.GetByTitle("Items"); CamlQuery query = CamlQuery.CreateAllItemsQuery(100); ListItemCollection items = certificatesList.GetItems(query); con