FAQ Database Discussion Community


CSS Styling alignment

html,css
good evening. The below code is for my navigation bar on my website.The two unordered lists are currently sat side by side (inline) which is what I wanted. However, I would like the second sat over on the right had side. I know there are several ways to achieve this....

Why Spring doesn't load index.html as welcome file

java,jsp
My Spring project doesn't load with index.html as welcome file but if I rename it to index.jsp then it works fine. Why? My web.xml <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <welcome-file-list>...

How do I create a bar chart instead of line chart with HighCharts?

c#,asp.net-mvc,highcharts
I'm using DotNetHighCharts to make HighChart's charts. This example I found makes a line chart of monthly data: Highcharts monthlyChart = new Highcharts("chart") .SetXAxis(new DotNet.Highcharts.Options.XAxis { Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } }) .SetSeries(new DotNet.Highcharts.Options.Series { Data = new...

How to update waitForDuration constant?

ios,sprite-kit,skaction
I have a flashing light that uses a SKAction sequence that hides and unhides a circle node. I want to be able to change the intervals at which it flashes based on two buttons. I declared a variable stdTime and I change it in the touchesBegan method but it's not...

Using ng-repeat and filter, how to tell which items are visible?

javascript,html,angularjs
I have an array of objects that I'm displaying in my Angular app using ng-repeat. I'm filtering out items using filter and the value of a search input. It works as expected. But, I have a "select all" / "deselect all" option and I only want to select the visibile...

How to tag Docker images with a Git tag in Jenkins?

git,jenkins,docker,jenkins-plugins
Hopefully I'm just missing something simple, but I cannot figure out how to tag a Docker image with a Git tag in a Jenkins job. I have been using the Docker Build and Publish plugin for building my images, but it's tag input only seems to accept token macros for...

Change x86 platform to Any CPU for .NET 3.5 throws COMException

c#,comexception,target-platform
I am trying to change my Platform target for a C# application from x86 to Any CPU. My application uses a _click method which runs a new thread which opens a viewer window using the following method to show the window: public void Show(string url, int entityId, string sessionId, int...

Python IDLE, Module Docs and Python(command line) can not pop out

python,python-2.7
I just installed python 2.7.10. Then, when I tried to open IDLE(Python GUI), Module Docs and Python(command line). I can only see "please wait while windows configures python 2.7.10". IDLE(Python GUI), Module Docs and Python(command line) never pops out. Then, I opened a command window under C:\Python27\Lib\idlelib and entered "python...

Aggregating lambda functions in pandas and numpy

python,numpy,pandas,lambda
I have an aggregation statement below: data = data.groupby(['type', 'status', 'name']).agg({'one' : np.mean, 'two' : lambda value: 100* ((value>32).sum() / reading.mean()), 'test2': lambda value: 100* ((value > 45).sum() / value.mean())}) I continue to get key errors. I have been able to make it work for one lambda function but not...

How to preserve margins and expand a div to fit its contents size?

html,css
I have a black rectangular header in my HTML/CSS file that must have the following behavior: It must expand whenever the text inside of it requires a larger space than its minimum height, 85 pixels The text inside must have a 20 pixel margin inside of the black rectangular header...

how to have svn fetch a file from another directory on updates?

svn
I have two repository folder. One in which the build.dll is set. There is another folder which needs this dll up to date. What I'd like to do is when I update the second directory on my computer, it would fetch the build.dll from the other one. So no physical...

Adding products on the fly to order

java,broadleaf-commerce
I would like to add products to cart on the fly. This means the products to add are not stored in the database and doesn't have to. But when I take a look into the cart endpoint how items added to an order the class org.broadleafcommerce.core.order.service.call.OrderItemRequestDTO requires a product id....

how to Select data from multiple tables with several conditions?

sql,oracle,table,select
There are tables FACULTIES (F_NUMB, F_NAME, F_TELEF) and STUDENTS (S_NUM, SURNAME, SPECIALITY, GROUP, FACULTY_NUMB). Please write SQL query to achieve faculties names in which the count of students are greater than in faculty “Computer science”. This is what i'm doing: select faculties.f_name, count(STUDENTS.S_NUM) from STUDENTS, FACULTIES where students.fac_num=FACULTIES.F_NUMB group by...

Lombok exclude property from builder

java,builder,lombok
I have a class called as "XYZClientWrapper" , which have following structure: @Builder XYZClientWrapper{ String name; String domain; XYZClient client; } What I want no build function generated for property "XYZClient client;" Does Lombok supports such use case?...

Getting return value from oracle function using SimpleJdbcCall

java,spring,oracle
I have Oracle function defined as: function get_user_by_term (inUserTerm number) return number; Now I wan to call this function using Spring SimpleJdbCCall but not sure how I can read return value since I don't have out param in function. I can't change the Oracle function code. Code I have so...

RoboMongo 0.8.5 Error inserting Date

mongodb,date,robomongo
Tried many formats like: manufactureDate : new Date("2009-8-2"), or manufactureDate : new Date(2009,8,2), or even manufactureDate : new Date("Feb 8, 2009"), Each validation try ends with: Unable to parse JSON Any Ideas?...

jQuery datatables columnDefs issues

javascript,jquery,datatables
Why isn't jQuery datatables columnDefs working with class names? The render callback is never fired. The documentation states: A string - class name will be matched on the TH for the column Also, if I change to target index [0] instead, I get an error. Also, it fires about 22...

event for runtime controls in c#

c#,events,runtime,controls
i try to make an controls in runtime (not one, "n" controls in runtime) but now i want to create event for every single controls i made one but it just work for the last control i create in runtime how can i create event for every controls? private void...

Bukkit ChatColor Translate Alternate Color Codes

java,bukkit
So I am making a plugin and in the plugin config file you can put things like &b or &a and I know that there's a bukkit chatColor function for this called ChatColor.translateAlternateColorCodes('&', AString) but I don't understand what to put in AString. Thanks for helping me.

Java get component dimension in constructor

java,panel
I have a Panel which needs to know its size inside the constructor: class Panneau extends JPanel { public Panneau() { super(); new Map(getSize()); } } Unfortunately, the size doesn’t seem to have been initialized yet and getSize() returns a Dimension with 0 for height and width. How to get...

Disable JRockit Optimzation per class

optimization,jvm-hotspot,jrockit
Is there anyway to do this? I have seen there is a -XnoOpt function, but that seems more global than only applying this to a particular class. Any help would be useful ... even if to tell me this is not possible. Thanks!...

How to explicitly state the types when grouping in LINQ?

c#,arrays,linq,group-by
I'm playing around with GroupBy(...) and I realize that, although working, I prefer not to use var. Call me anal but I like to know what type I have when I have it. (Of course, I'm not an ideologue and when the syntax is making ones eyes bleed, I do...

Can I use root-relative XPath expressions to get nodes in a cloned node?

java,xml,xpath
Consider this code, in which we: 1) Build a simple XML document; 2) Clone one of its nodes; 3) Search with xpath for attribute a in node in: @Test public void lookupInClonedNode() throws Exception { String xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><out a='1'><in a='2'/></out>"; Document document = DocumentBuilderFactory .newInstance() .newDocumentBuilder() .parse(new...

BASH: testing the number of arguments passed in an IF statement

bash,if-statement,arguments
i'm trying to send two arguments to .run file. $2 default should be 0. if $2 arg = 1 then grep -i a -1 --color -E $1 *.* else grep -i --color -E $1 *.* , something like this if [${2:-0} = 1] then grep -i a -1 --color -E...

calculate network address with perl

perl
How can I get the class c network address from an ipv4 address in perl? I tried already this: my $ipObject = new Net::IP("$ip/24"); return $ipObject->prefix(); leads to Can't call method "prefix" on an undefined value at /usr/share/awstats/plugins/geoipfree.pm line 101, line 1. ...

Java swing Timer loop slows down

java,swing,timer
So, I'm trying to create a small game using Swing in Java. The game loop I created uses a javax.swing Timer. This timer (normally) calls a loop every 5ms. Timer tm = new Timer(5, this); tm.start(); @Override public void actionPerformed(ActionEvent e) { game.tick(); repaint(); revalidate(); } My code can be...

Change specific index of string, padding if necessary

ruby,string
I have a string called indicators, that the original developer of this application used to store single characters to indicate certain components of a model. I need to change the 7th character in the string, which I tried to do with the following code: indicators[6] = "R" The problem, I...

Python extracting blocks of text from a file

python,regex,extract
I need to extract two blocks of text from several files and put them in separate lists using python. The first block starts from line 30, and isn't too hard to extract. The second block starts 2 lines after the first block; the issue is that the blocks can be...

How do I clearRect in my JS canvas?

javascript,html5,canvas,html5-canvas
I may be having a Homer moment here but I am trying to clear the canvas at every iteration to show the square rotating but the clearRect doesn't seem to work. Can anyone see what I am doing wrong? var canvas = document.getElementById('myCanvas'); var ctx = canvas.getContext('2d'); var angle =...

http.request in intern functional test

node.js,selenium,selenium-webdriver,intern
I am trying to post to a url to get a username and password so I can log into my website to do functional testing. I start up selenium server and run this basic test with a request to a posting service. define([ 'intern!object', 'runtime/testConfig', 'intern/dojo/node!nconf', 'intern/dojo/node!http' ], function(registerSuite, conf,...

local variable inside the loop or outside the loop

c++
void main(){ int a=1; for(int i=0;i<10;i++){ int b=2; } } In the loop, variable B will be created every time in the loop,right? If so, I check the address of variable b by using & operation and found that address is exactly the same. If it's not recreated, the b...

Java is drawing 2 boxes

java,swing
So I am making a little game to learn some graphical java and I am having trouble with a button. It is drawing 2, one is the correct size and in the correct location and then there is a very small button centered at the top of the application. THere...

Winform image toggle button

c#,winforms
Well after a long search on web and downloading few projects I landed here for an overall easy to use and small code to implement a toggle button on c# winform project. I want to have my button to be toggled i.e. two different image possibly with two different text,...

Find a word after a keyword, then, paste it after a different keyword.

python
For example, I have a multiple strings in a tex file that looks something like: "The conditions Heat_Transfer blah blah blah BC" Using python I would like to: Find the word after "conditions" (in this case Heat_Transfer) Then paste Heat_Transfer after BC. The output string should look like: "The conditions...

Automatically convert JSON to Object on Flask Request

java,python,json,spring-mvc,flask
In Spring MVC + Jackson (Java), I can have this: My Object (Java) public class Project { private long id; private String self; private String key; private String name; //Getters and Setters } Spring MVC Controller ... @RequestMapping(value="/doSomething", method=RequestMethod.POST) public String doSomething(@RequestBody Project project) { System.out.println(project.getName()); return "myPage"; } ......

Anchoring html framework

javascript,html,css
I'm using html/css/javascript as a game UI for a 3D game. I render the page on top of my game. Most game UI's have an anchoring concept (position widgets to Top, Left, Right, Bottom, Center, LeftCenter, RightCenter, TopCenter, BottomCenter). I'm wondering if anyone knows of any existing html/css framework out...

Angular-ui bootstrap datepicker won't openup twice

angularjs,twitter-bootstrap,angular-ui-bootstrap
I am using the angular-ui bootstrap datepicker component. on one view where I have two date fields, the datepicker opens up and after closed it opens up again when clicked fine. On another page, after once opened and closed, the datepicker does not open up anymore. Surely I'm missing something...

loop for and function in R

r
I want to do the following: #choosing one column called "z" from select select<-read.table(file='dane.txt', header=TRUE) n=select$z #defining f function f<-function(redshift) { 0.2*(sqrt(0.3*((1+redshift)^3)+0.7*((1+redshift)^2)+1))^(-1) } # for all values from column "z" I want to calculate the integral from 0 up to value from column "z" for(i in n){ int[i]<-integrate(f(i),0,i) } For...

Laravel 5 adding invalid chars at end of JS

javascript,laravel-5,assets
I'm including a JS file with the following tag in my app.blade.php: <script type="text/javascript" language="javascript" src="/js/colors.js"></script> Whenever that script loads in the browser, it contains a bunch of invalid characters at the end. I've verified that these characters are not present in the actual file. Has anyone seen this problem?...

Is it possible to import a pfx file with VB

vb.net,pfx
Is it possible to import a pfx with VB.NET? I can with the command line, but that's definitely not preferable. Edit: Using this code, I don't see my certificate under mmc snap-in. I don't get an exception or any errors during debugging. Imports System.Security.Cryptography.X509Certificates Module Module1 Sub Main() Try My.Computer.FileSystem.WriteAllBytes(Environment.CurrentDirectory...

find number in string, add 1 and replace

python,string,digit
I need to write a code where a string contains a number, then this number is incremented by 1, and then printed out within the initial string input. It should work like this >>>addNumber('I slept 3 hours') what number would you like to increment? 3 I slept 4 hours >>>addNumber('I...

Java char is also an int?

java,type-conversion,equivalence
I was trying to get some code done for class: public int getValue(char value) { if (value == 'y') return this.y; else if (value == 'x') return this.x; Since I might not be able to return anything in the end, it told me to do this at the end: return...

GCC 5.1.0-4 cross compiler build fail

gcc,osdev
I'm following the osdev.org bare metal tutorial, and I'm currently stuck at the cross compiler.! I'm building from an arch distro. It looks like it might be a problem with isl. I think the tutorial is based on an older version of gcc, cloog, isl, etc, so after a few...

VBScript to detect Facebook IE window, press Like and close the window

facebook,internet-explorer,vbscript
I tryed to make a script to detect the IE window that is opened on Facebook and hit the Like button. Let's say I have 10 IE opened. Only one of them is on a page on Facebook. I want my script to detect that IE window, click this button:...

Static global C-like variables in Ruby

ruby,global-variables
Does Ruby has static global variables? With this I mean global variables only accessible from the file where they were defined....

Not Able to Get Values of XML Elements Using .text()

jquery,html,xml
So at this point, I'm just trying to retrieve data from an XML file using JQuery. I'm able to load the file, but this simply returns an empty string: JQuery: $.get('data.xml','xml',function(data){ var names = $.parseXML(data), $names = $(names); alert($names.find('test').text()); }); XML: <names> <test>test</test> </names> <!-- end snippet --> I'd like...

Show drop down menu onmousedown without loosing onclick functionality

javascript,drop-down-menu,onclick,focus,onmousedown
I try to get a drop down menu to work as most drop down menus seem to work, i.e. as soon as the mouse button is pressed on the trigger the drop menu shows up. Seems rather easy with some css and javascript but it turns out to be a...

Unity3D: Moving a child to orbit a parent

c#,unity3d,position,transform
I have made a game where I make two spheres, one child sphere and one parent sphere. The parent sphere is bigger than the child sphere, and I am trying to make the child move around the parent sphere. In the following code, the child sphere moves in a circle....

how to create the bigram matrix in my code?

python,nltk
I want to make a matrix of the bigram model. How can I do it? Any suggestions which match my code, please? import nltk from collections import Counter import codecs with codecs.open("Pezeshki339.txt",'r','utf8') as file: for line in file: token=line.split() spl = 80*len(token)/100 train = token[:int(spl)] test = token[int(spl):] print(len(test)) print(len(train))...

When using resource in rails how can it work

ruby-on-rails
I understand when using resources :users It creates seven routes. Then localhost:3000/users/1: How it is mapped to "GET /users/1 show"? Why not to patch or delete?...

Create Multiple Objects Single LINQ EF Method

c#,database,linq,entity-framework
List<MyObject> objects = await item.tables.ToAsyncEnumerable() .Where(p => p.field1 == value) .Select(p => new MyObject(p.field1,p.field2)) .ToList(); ^ I have something like that, but what i'm wondering, is there anyway way to add a second object creation, in the same select? eg. new MyObject(p.field3,p.field4) ? and add it to the same list?...

how to get the city using Google Maps Geocoder

javascript,jquery,wordpress,google-maps,google-geocoder
I'm developing a website using Wordpress and I'm using a theme that allows to insert custom post called "Property"; this features is handled inside a custom page template. Inside this page I can add the address of the property, which has the autocomplete geocoder suggestion. Here is the code:...

Adding a rollover only works on one image div

html,css
I am creating a rollover on an image div where once you roll over, the image opacity goes down and text over the top appears. This works fine for just one image, but when trying it on more then one image the opacity doesn't work correctly and the text doesn't...

Excel to replace formulas with values

excel,vba,excel-vba
I have an Excel workbook (1) with around 9 sheets that is pulling in and manipulating data from a second workbook (2). After pulling in the data from workbook (2) I need to be able to replace the formulas in workbook (1) to the resulting values that the formulas have...

AS3 - How do you call previous currentTarget from within a different event?

actionscript-3,events
I have a dropdown menu that lets you select an item to be placed on the stage. The item is drag and droppable so I use event.currentTarget.startDrag(); to start the drag. Ok, everything works fine so far. However, I also need to be able to rotate the item while it...

How do I need to mark third party libraries/source with a license [closed]

android,licensing,apache-license
What do I have to do to comply with the licenses of the third party libraries/source I use? Do I have to mark (put the license in the comments) in the code or do I have to show it in the app?

Read uploaded pptx file with Open XML SDK

c#,asp.net,vb.net,visual-studio-2013,openxml-sdk
I'm trying to build a website where one can upload a .pptx file, and a few aspects would be checked (e.g. slide count). I have the Open XML SDK 2.5 and I have added a reference to it. Yet, when I try to use commands from the SDK, they are...

Filter kendo dropdownlist to remove options

javascript,jquery,asp.net-mvc,kendo-ui,kendo-dropdown
I want to filter security questions such that if I select questiona from the list of questions, for the next questions, I no longer see questiona in the list of security questions. This is to prevent duplicate selection of security questions. Here's a jsfiddle with a pure jquery implementation: http://jsfiddle.net/jbfbxvoo/...

Getting a “java.lang.NullPointerException” while working whith Maps

java,dictionary,nullpointerexception,hashmap
I am trying to write a simple Diet program using maps with this code. But I keep getting NPE which keeps interrupting the process at random. What is wrong with my code? Why is that that I keep getting this error and how do I fix it? class Diet {...

How to read multiple csv files in node.js

javascript,node.js,file,csv,asynchronous
I'm trying to read multiple csv files and then add them as properties to an object, but the async of node.js really prevents me from doing this. This is the code I tried. var Converter=require("csvtojson").core.Converter; var fs = require('fs'); var csvConverter=new Converter(); var data = {}; for (var i =...

Java socket receives byte array where each byte is 0

java,sockets,bytearray
I am making a program which takes a file, and sends it via socket to client. Client receives it and saves it to a file. That is what it is supposed to do. But somehow, byte array which client receives, contains only 0 bytes, so my output file is empty....

Div moves across the screen instead of stopping at specified point

jquery,html
I need to make the div move from its initial position to the new position using jQuery but once the div is interacted with, it scrolls across the entire page. I just want the div to move from point A to point B and stop at point B. var main=function()...

How to make sure a netcdf file is closed in python?

python,netcdf
It's probably simple, but I haven't been able to find a solution online... I'm trying to work with a series of datasets stored as netcdf files. I open each one up, read in some keys points, then move onto the next file. I am finding that I constantly hit mmap...

SQL Server or SSIS code for incrementing

sql-server,ssis,increment
Input ID 12345 12346 12346 12387 12568 12387 12387 Output ID - Value 12345 - 1 12346 - 2 12346 - 2 12387 - 3 12568 - 4 12387 - 5 12387 - 5 I have an input like shown above and I need an output also shown. So looking...

show menu when paused a game ins spritekit

swift,sprite-kit
I created a game like as tower defence. I can successfully "pause" all game. And then i can resume the game with these code: let startLocation = CGPoint(x: location.x, y: location.y); let myNodeName = self.nodeAtPoint(location) if(myNodeName.Name == "Start"){ self.view!.paused = false } if(myNodeName.Name == "pause"){ self.view!.paused = true self.showPausedMenu() }...

How do I prepend/append (concatenate) data to each row in a MySQL result or data set?

mysql,concatenation
Here's a query I'm making: SELECT sku FROM items With results of: 18972 81771 29883 I want to add data to the beginning and end of each row that is returned so it looks something like this: sku18972a sku81771a sku29883a What do I need to add to my SELECT statement...

SVN Update not applying. Despite files marked as out of sync

svn
I recently created a project structure in SVN. Checked my project into the app folder, then made a number of edits. I was editing a version of the project that was not checked out however (my original project that I copy/pasted into the new SVN repo). I guess I just...

Finding all tags and attributes in a HTML

python,html,xml-parsing,beautifulsoup,html-parsing
I am a newbie and looking at HTML code for first time. For my research I need to know the number of tags and attributes in a webpage. I looked at various parser and found Beautiful Soup to be one of the most preferred one. The following code (taken from...

zlib uncompress a .zip file [duplicate]

c++,zlib
This question already has an answer here: Simple way to unzip a .zip file using zlib 2 answers So I have an array of bytes that I would like to decompress using the uncompress function in zlib but it always returns Z_DATA_ERROR. So my question is, does zlib support...

What it means to use the default lifecycle in Maven [duplicate]

java,maven
This question already has an answer here: What is the default lifecycle in Maven 3 answers As per Maven docs, the doc explains as below for default lifecycle: These lifecycle phases (plus the other lifecycle phases not shown here) are executed sequentially to complete the default lifecycle. Given the...

AngularJS nav active class won't show

javascript,angularjs,angularjs-directive,angularjs-scope
I'm Quite new to AngularJS and I try to develop a nav bar, which changes the activeclass. So I tried to make a function in my controller to define the active class. My html code of the nav: The controller: I compiled with grunt and there are no errors/warnings. Every...

Joining multiple tables for a single report in Django

python,django,database,sqlite
From the example dataset below, how would I query, either through django.db or through the database API to get the request result? I want to query the data set to get all items new than a specified date in A, but I only want the name and color from B...

MVC: Using controller that is defined in a referenced project

jquery,model-view-controller
I have an MVC project A that references another project B. Is it possible to make an ajax call to an action method in a controller that is defined in project B? $.ajax({ url: "/ThatController/CountyJSON/?Country=" + $('#JobCountry').val()... What should I put in place of "ThatController"? Thanks....

MeteorJS: Callback after template helper was updated

javascript,templates,meteor,callback,helper
I'm new to Meteor.js, so hopefully this is an inability on my part rather than a limitation of the platform because it's pretty amazing otherwise. What I'm trying to achieve is pretty straightforward: run Javascript whenever a template helper gets updated with new data (but not from the db!). A...

Mocking assert_called_with in Python

python,unit-testing,mocking
I'm having some trouble understanding why the following code does not pass: test.py import mock import unittest from foo import Foo class TestFoo(unittest.TestCase): @mock.patch('foo.Bar') def test_foo_add(self, Bar): foo = Foo() foo.add(2, 2) Bar.add.assert_called_with(2, 2) if __name__ == '__main__': unittest.main() foo.py from bar import Bar class Foo(object): def add(self, x, y):...

Unable to query hstore attribute in Rails [duplicate]

ruby-on-rails,postgresql,hstore
This question already has an answer here: NoMethodError when I try to acces a field of an object taken from the DB 4 answers I've added a hstore attribute to my model: class ChangePerDayAverageInterestToHstore < ActiveRecord::Migration def change add_column :companies, :per_day_average_interest, :hstore end end Now when I generate the...

find common string in two text files using batch script

string,parsing,batch-file,search,replace
I'm trying to find common string in two text files. For example, first text file contains following 1.txt //documents #5 ##text //documents/A #6 //documents/B #7 second text file contains following: 2.txt //documents/A #3 output.txt //documents/A #6 If common string found, expected output last number taken from 1.txt file. try.cmd @echo...

Mapbox: Marker Nav links outside of map

javascript,navigation,mapbox,markers
I have been trying to use the example on Mapbox.com for link navigation. marker nav I want to be able to change the js innerHTML to different properties in my own geojson i.e. change title to "editorname". I can get the nav links to reflect the correct properties, but it...

Polymer google-signin element gets Cannot read property 'currentUser' of null

javascript,polymer,web-component,polymer-1.0
I'm trying to get the google-signin element to work with just adding this to my HTML: <google-signin clientId="[my-client-id]" scopes="https://www.googleapis.com/auth/drive"></google-signin> The Sign-in button shows up on the page, but when I click it, I get the error: Cannot read property 'currentUser' of null I'm testing it out on just localhost, so...

How to introduce string by keyboard in child after fork

c,concurrency,process,signals,scanf
I'm exercising over concurrency in C, I wrote a small and simple program in which a parent process creates two children, sender and receiver. Sender will read from stdin a string and then procede to send it in some way to receiver (not relevant). The real problem here is that...

Laravel Update Related Model with push?

php,laravel,laravel-5
I am stuck on updating a eagerloaded model that has a "hasMany" relation. I have one model like so: class UserGroup extends Model { public function enhancements() { return $this->hasMany('App\UserGroupEnhancement'); } } My controller is passing $userGroup to the view like so: $userGroup = $this->userGroup->with('enhancements')->whereId($id)->first(); and then in my view...

How to properly use Parse.query.equalTo?

javascript,node.js,parse.com
In my web application when the user logs in they should see all the documents they made. However when I test my application, I see all the documents including the ones that I didn't make. I believe this is because I am not using Parse.query.equalTo correctly. Here is my code:...

Support deprecated and new API

android,android-5.0-lollipop,deprecated
Is there any way I can support both deprecated and new API in the same method call for Android? I'm using the camera API which seems to be deprecated for the Lollipop version, so I tried to handle it like this: if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { //Before Lollipop, use the...

Insert data to ElasticSearch using NEST API

elasticsearch,nest
I am trying to insert\bulk insert data to Elastic using NEST API. Can someone provide me the example using NEST? Thanks, Sameer...

Hiding elements based on URL

javascript,url,hiding
I'm trying to hide an element that is created dynamically, below is the code I have tried but for some reason the menu still appears after the JavaScript has run. It works in an html page, but not in asp.net. <script type="text/javascript"> if (window.location.href.indexOf("http://www.test.com/xzy") != -1) { $("#Menu").hide(); } </script>...

How to add a SpatialPolygons to a bubble plot in R

r,geospatial,sp
I would like to use the function bubble from the packge sp to plot data and I would like to add a SpatialPolygons layer. I can easily plot the data using spplot but for some reason it doesn't work with bubble. For example: library(sp) # Create SpatialPolygons Sr1 <- Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))...

What's the easiest way to extract part of this line?

powershell
I am using PowerShell to insert data into a database but before I get to that step I need to pull the information from a log file. How can I extract the title of the project from this line in the log file? 1>Project "E:\Builds\1\IS_WSD\Lab1\src\Lab1.sln" on node 1 (default targets)....

javascript check if string contains any symbols

javascript
I have the following set of symbols: var a = '|\/~^:,;?!&%$@*+'; How can I check is the following string contains any of those symbols? var b = 'avguybdf'; ...

Read bytes from Dump in Masm

assembly,masm32
In one part of my application i need read a bytes invoke GlobalAlloc,GMEM_MOVEABLE or GMEM_ZEROINIT, eax; eax = size mov hMemory,eax invoke GlobalLock,hMemory mov pMemory,eax How can "move" the first 4 bytes of pMemory to eax?? and later move the next 2 bytes to ebx?? Example: 1A5288.... 12 34 56...

Getting List type of class from ParameterizedTypeImpl

java,generics,reflection
I have a field of Map I am trying instantiate that looks like this Map<Long, List<MyObj>> The code to convert it is this ParameterizedType targetMapParameterizedType = (ParameterizedType) targetMethodMap.get(targetMethodName).getGenericParameterTypes()[0]; Class<?> mapType = targetMethodMap.get(targetMethodName).getParameterTypes()[0]; if(mapType.isInterface()) { newMap = new HashMap<Object, Object>(); } else { try { newMap = (Map<Object, Object>) mapType.newInstance(); }...

Go + Protocol buffers acting really strange

go,protocol-buffers
I'm writing a service-based server for a project I'm working on, which is written in Go and uses Protocol Buffers for inter-service communication. Everything was working fine until I added protocols named DeviceRequest and DeviceResponse, now the compiler can't find them, while the go source of the protocol exists and...

Pattern rule with partial dependency

makefile,gnu-make
I have a makefile with a bunch of .R scripts that create .csv files as output. These files are then used in a python simulation. all: $(FILES) python simulation.py $(FILES): %.csv: %.R Rscript $< This is straightforward. My wrinkle is that one (and only one) of the .R scripts has...

Polymer Main Text is displayed on top of the drawer

html,polymer,drawer
I played around with polymer again, so I created a basic page with the help of some great tutorials on youtube but I always get this issue when opening the drawer. As you can see the menu icon and the "Polymer" title is from the bottom toolbar. Maybe somebody knows...

If textarea contains certain string then

javascript,jquery,keyup
I am creating a contact form for my website, and I am adding a few joke easter eggs which trigger if a user chooses a certain option or in this case happens to type a certain string into the message textarea. I would like to be able to trigger the...

Create and access dict in Ansible playbook

ansible,ansible-playbook
I'm trying to set a variable in an Ansible playbook based on an existing variable's value which could be one of many different strings. It's basically a case/switch statement and this is the logic (with incorrect syntax): if {{ existing_ansible_var }} == "string1" new_ansible_var = "a" else if {{ existing_ansible_var...

How can I call a specific CSS file based on a specific HTML class on the page?

php,html,css
For example, my site has 5 CSS files like this... <link rel="stylesheet" href="/templates/purity_iii/css/custom_marketing.css" type="text/css" /> <link rel="stylesheet" href="/templates/purity_iii/css/custom_gps.css" type="text/css" /> <link rel="stylesheet" href="/templates/purity_iii/css/custom_fleet.css" type="text/css" /> <link rel="stylesheet" href="/templates/purity_iii/css/custom_service.css" type="text/css" /> <link rel="stylesheet" href="/templates/purity_iii/css/custom_corporate.css"...

Trying to get the selection of a dropdown list

c#,asp.net,asp.net-mvc
I'm trying to get the selection from the drop-down list and save it into the database as its corresponding primary key. When the user makes a selection, I am unable to use that selection. I think I am not collecting the correct information in my controller. Here is my view:...

Perform an Association from one to many with code first entity framework

c#,sql-server,entity-framework,code-first
I am using EF 6.1 with code first, and trying to define a class of Invoice, which can consist of a number of Timesheet instances. What I would like it to do is INSERT a new Invoice row into the database (which it does), and update the Timesheet table so...

How to spool cells to different files?

oracle,oracle10g,sqlplus
Is it possible to spool the content of the different rows of a table to different files? The Number of rows of my table is not fixed and it has these columns: ID, NAME, CONTENT_TO_SPOOL I would like to create an output file per row, spooling the CONTENT_TO_SPOOL to files...

Laravel - Sorted collection output is not an array

php,mysql,sorting,laravel,eloquent
I'm trying to sort a collection by the column name. I am logging the ajax result and when I sort by name I get: Object: {0: Object, 1: Object, ...} But when I sort by the other field (locationId) I get: [Object, Object, ...] Any idea what I'm doing wrong?...