2018-10-22         Marguerite

Get data from two tables(join) with linq and return result into view

I have two tables: Projects and ProjectsData and I want to execute query with join and get the result in the View.In the Controller I have this code:ViewBag.projectsData = (from pd in db.ProjectsData join p in db.Projects on pd.ProjectId equals p.ID where pd.UserName == this.HttpContext.User.Identity.Name orderby p.Name, p.ProjectNo select new { ProjectData = pd, Project = p });What I should use in the View to extract this data. I tried th...

 asp.net                     1 answers                     90 view
 2018-10-22         Marguerite

Resize images without retaining the original aspect ratio using CarrierWave

I am using CarrierWave to add versions to my uploaded images. resize_to_fit is resizing the image to fit within the specified dimensions while retaining the original aspect ratio.How can I resize my images without retaining the original aspect ratio nor croping them? You need to define custom processing method in uploader using Carrierwave's manipulate! method. Here's an example I have just tested:class Uploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file process :force_resize => [160, 160] def force_resize(width, height)...

 ruby-on-rails                     1 answers                     66 view
 2018-10-22         Marguerite

How does cp command work in Hadoop?

I am reading "Hadoop: The Defnitive Guide" and to explain my question let me quote from the book distcp is implemented as a MapReduce job where the work of copying is done by the maps that run in parallel across the cluster. There are no reducers. Each file is copied by a single map, and distcp tries to give each map approximately the same amount of data by bucketing files into roughly equal allocations. By default, up to 20 maps are used, but this can be changed by specifying the -m argument to distcp.and in a footnote Even for a single file copy, the distcp variant...

 hadoop                     1 answers                     93 view
 2018-10-22         Marguerite

How do target an API level for android from config.xml for phonegap?

I used to build apps with the basic config.xml file for phonegap for play store until recently when my apps were being rejected because they did not target API level 26. I did some research and and tried a few solutions and did this: <platform name="android"> <allow-intent href="market:*" /> <preference name="android-minSdkVersion" value="26" /> <preference name="android-targetSdkVersion" value="26" /></platform>which went from bad to worse, my apps in debug mode (after xompilation on phonegap build) won't even be parsed on android any...

 android                     1 answers                     74 view
 2018-10-22         Marguerite

Manipulating JSON Array PHP - Find Value in array

I have a JSON array that comes in via API. I am looking to print out the data however the values that are returned are not always in the same place for each of the items. Below is an example of the JSON that is return - This is only one part of the JSON, it is a large file:"standardSpecification": [ { "Technical": [ { "id": 13501, "name": "Performance", "description": "XXXXX", "value": "standard", "items": [ { "id": 13502, ...

 php                     2 answers                     6 view
 2018-10-22         Marguerite

Catch External API Error Message as in Postman Body

I am using the following code to complete an External API call. WebResponse response = request.GetResponse(); string JSONResult = null; var data = response.GetResponseStream(); using (var reader = new StreamReader(data)) { JSONResult = reader.ReadToEnd(); }When there is an exception on the external API, the request.GetResponse throws an error. However, I cannot get the message that is displayed, e.g. { "Message": "No HTTP resource was found that matches the request URI '<site>/Foo'.", "MessageDetail": "No type was found that matches the control...

 c#                     1 answers                     80 view
 2018-10-22         Marguerite

Dynamically created JPG image using AWS Lambda service

I am trying to create a dynamically created graph as a JPG file that I could use in Alexa Skill standard cards as part of response. The following code creates a JPG image when I run it locally on my computer, when using browser with URL "http://localhost:5000/image.jpg".from flask import send_filefrom flask import Flaskfrom PIL import Image, ImageDrawfrom io import BytesIOapp = Flask(__name__)app.config['DEBUG'] = Truedef serve_pil_image(pil_img): img_io = BytesIO() pil_img.save(img_io, 'JPEG', quality=70) img_io.seek(0) return send_file(img_io, mimetype='image/...

 dynamic                     2 answers                     32 view
 2018-10-22         Marguerite

Adding newlines in the middle of a sed substitute in a python script

I am exploring a porting a big project from python 2 to 3.Because I am presently just testing, and some other reasons. I change to change all#!/usr/bin/pythonor#!/usr/bin/env pythonor#!/usr/bin/env python2.6to python3. In addition to this i wish to add two newlines and a comment. So that every python file that started with one of the above now starts with:#!/usr/bin/env python3# 4 spaces is the indentation standard. Make sure that Tab equals 4 spaces. My current code will walk all directories and change python files one at a time and to this and several other changes. My pr...

 python                     1 answers                     35 view
 2018-10-22         Marguerite

Implementing Domain Events (DDD-CQRS) on Azure

Microsoft docs provides an article on "Domain events: design and implementation" for DDD & CSRS.How could domain events be implemented on Azure. In particular which Azure services are suitable, and how do you combine them.Relatively little has been written on this topic so far. This presentation seems good. In part it talks about possible implementations; e.g. Azure Functions vs Azure Logic Apps; and Azure Service Bus vs Azure Event Grid. I suspect you are talking about integration events, not domain events. In the second paragraph of the article you linked to it...

 azure                     2 answers                     8 view
 2018-10-22         Marguerite

How can I update to the latest Python version using conda?

I am new to Python. I was asked to update to the latest Python version using conda.So far, I have installed Anaconda on my Mac. So I am mainly using the Terminal.Thank you in advance. Hi and welcome to the community. Please note that the tool is called conda not condo. conda can be used as python virtual environment manager and I believe what was requested from you is to create a virtual environment with the latest python version. You can do by executing the command:conda create -n my_env python=3.7Here my_env is simply the name of the environment so you can replace it w...

 python                     2 answers                     26 view
 2018-10-22         Marguerite

JS Remove Entries from 2D array

Totally newbie to JS so apologise for the probably obvious solution to this issue!I'm trying to write a bit of code for use in google sheets that basically removes elements of a 2D array if the 3rd value in each nested array is empty eg.[[1,2,3],[4,5,,],[7,8,9],[,,,]would become[[1,2,3],[7,8,9]]I've currently got:if (bkLoc=='HALL'){ var sumRng = sh.getRange('MIC_SUMM').getValues(); for (var i =0; i<sumRng.length ; i++){ if(sumRng[i][2] !== (undefined || '' || null)){ micSumm.push(sumRng[i]); } } }But the output seems to contains l...

 javascript                     4 answers                     51 view
 2018-10-22         Marguerite

vb.net Passing a list through a function without list value changed

This question already has an answer here: Argument passed ByVal to VB.NET Function and manipulated there 2 answers You need to do some reading on value types and reference types and passing method arguments by value and by reference. They are related but not the same thing. When you pass a method argument by value, you create a copy of the variable being passed. If the variable is a value type, i.e. a structure, then that means creating a copy of the value. If the variable is a refe...

 vb.net                     1 answers                     98 view
 2018-10-22         Marguerite

Retriveing data from Firebase database is showing null pointer exception. How?

This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers As you said that you want to update the data in TextView txtMsg when it is changed in the database. So the method you used will give following results which is not appropriate.I am considering single name i.e. Akshay txtMsg.append((CharSequence) postSnapshot.child("name").getValue());It will give results - AkshaySuppose you changed the name from Akshay to Punitt. So the name Punitt ...

 android                     2 answers                     37 view
 2018-10-22         Marguerite

Cannot unzip inside AWS Fargate container

I have Java application that extracts content from zip archive.When launching it as a Fargate task, it produces the following error:java.util.zip.ZipException: invalid block typeI could get similar zlib error while running an app locally and setting non-writable directory to extract zip archive content to. It works otherwise.Using various directories inside Docker layer did not help (i tried /tmp and WORKDIR, I also tried User: root in ContainerDefinition), neither did an approach with mounting writable volume in ContainerDefinition.According to documentation, Fargate provi...

 amazon-web-services                     1 answers                     22 view
 2018-10-22         Marguerite

Creating a zip file in situ within azure blob storage

I have files stored in one container within a blob storage account. I need to create a zip file in a second container containing the files from the first container.I have a solution that works using a worker role and DotNetZip but because the zip file could end up being 1GB in size I am concerned that doing all the work in-process, using MemoryStream objects etc. is not the best way of doing this. My biggest concern is that of memory usage and freeing up resources given that this process could happen several times a day.Below is some very stripped down code showing the basi...

 c#                     2 answers                     86 view
 2018-10-22         Marguerite

how to align correctly menu sandwich bootsrap 4

i have problems with my code to align correctly the menu sandwich in my header. The problem is that when i set my bowser width to minimum size, the menu sandwich is locate under the logo instead of to the right of the logo. Plus i want it to be at the very right of the header when the bowser is larger. I do research but i've problems to know how to manipulate this menu. The codes i saw are all about the same about the menu sandwich but it doesn't behave the way it's behaving in my site.My code : HTML<!doctype html><html><head> <meta charset="utf-8"&g...

 html                     2 answers                     89 view

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