convert

Convert Datatable to Object with Linq and Group by

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to convert datatable into JSON with special format Data in DataTable is as follow col1 col2 col3 col4 --------------------- A B c D1 A B c D2 A B c D3 Try to convert it to a object array like class obj { var col1; var col2; var col3; list<string> col4; } I try to use linq, but kinda get stuck. var result = from row in dt.AsEnumerable() group row by new { c1 = row["col1"], c2 = row["col2"], c3 = row["col3"] } into section select new { item = section.Key }; 回答1: var result = from row in dt.AsEnumerable() group row by new { c1 = r.Field

Laravel, convert JSON array to Array and only get one object from the Array

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Vinelab\Http\Client as HttpClient; use App\Requests\SearchRequest; use App\Http\Requests; use App\Http\Controllers\Controller; class SearchResults extends Controller { public function index() { return view('results.search-results'); } public function store(Requests\SearchRequest $request) { $search_phrase = $request->input('search'); $client = new HttpClient; $response = $client->get('https://www.reddit.com/search.json?q='. $search_phrase .''); $responseArray = $response-

How to convert canvas to SVG with embedded image base64 in fabricjs

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have fabricjs canvas with image, which I loaded by fabric.Image.fromURL() method. I need export it to SVG, but I want to export image as embedded source in base64, not as a link. How can I do it? Is it any way to load image as a source not as a link? Example code: Loading image: fabric.Image.fromURL('./assets/people.jpg', function (image) { image.set({ left: 10, top: 30 }); canvas.add(image); }; Exporting to SVG: canvas.toSVG(); In exported SVG I have: <image xlink:href="http://localhost:8383/app/assets/people.png" /> But I want it in

Convert System.Drawing.Font.Size to WPF FontSize

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to convert a GDI Font in a WPF "Font". myGdiFont As System.Drawing.Font in _Family As Windows.Media.FontFamily _Style As Windows.FontStyle _Weight As Windows.FontWeight _Size As Double In particularry, I need to Convert _Size = myGdiFont.Size (???) The size in WinForms font is in Units or Points... In WPF is in Pixels... How to convert from one to another? PS. Follwing the Clemens indications, is it correct? Dim myDrawingFont As New System.Drawing.Font("Arial", 10) Dim myWpfLabel As New Windows.Controls.Label myWpfLabel.FontSize =

SSIS Package: convert between unicode and non-unicode string data types

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am connecting to an Oracle DB and the connection works, but I get the following error for some of the columns: Description: Column "RESOURCE_NAME" cannot convert between unicode and non-unicode string data types. Value for RESOURCE_NAME: For Oracle: VARCHAR2(200 BYTE) For SQL Server: VARCHAR(200 BYTE) I can connect to the Oracle DB via Oracle SQL Developer without any issues. Also, I have the SSIS package setting Run64BitRuntime = False . 回答1: The Oracle data type VARCHAR2 appears to be equivalent to NVARCHAR in SQL Server, or DT_WSTR in

Modelmapper to convert from String to LocalDate

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My DTO is having date field in String format. My entity is having date as LocalDate. Currently I am skipping it from map and then later manually explicitly setting it (String to Date and vis-versa). is it possible to convert it automatically? I tried Converter inside spring bean but it gives me lot of compile errors (type Converter does not take parameters, does not override convert method - also lot of error for convert() as well). @Bean public ModelMapper studentModelMapper() { .... Converter<String, LocalDate> toStringDate = new

How do I convert a cli::array to a native array from native code?

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm writing a native wrapper around a managed component written in C++\CLI. I have the following function in managed code: array<Byte>^ Class::Function(); I want to expose this function from a native C++ class with the following signature: shared_array<unsigned char> Class::Function(); I've gotten as far as calling the managed function from native code, but I'm not sure how to safely copy the managed array into an unmanaged one. gcroot<cli::array<System::Byte>^> managedArray = _managedObject->Function(); 回答1: There are two usual approaches:

How to convert dataURL to file object in javascript?

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to convert dataURL to file object in javascript in order to send it over using ajax. Is it possible? if yes, please tell me how. Thanks. UPDATE: Thanks for all the answers fellas. However, this is a very old question, and I think it has collected enough answers by now. 回答1: If you need to send it over ajax, then there's no need to use a File object, only Blob and FormData objects are needed. As I sidenote, why don't you just send the base64 string to the server over ajax and convert it to binary server-side, using PHP's base64_decode

How to convert fixed size dimension to unlimited in a netcdf file

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm downloading daily 600MB netcdf-4 files that have this structure: netcdf myfile { dimensions: time_counter = 18 ; depth = 50 ; latitude = 361 ; longitude = 601 ; variables: salinity temp, etc I'm looking for a better way to convert the time_counter dimension from a fixed size (18) to an unlimited dimension. I found a way of doing it with the netcdf commands and sed. Like this: ncdump myfile.nc | sed -e "s#^.time_counter = 18 ;#time_counter = UNLIMITED ; // (currently 18)#" | ncgen -o myfileunlimited.nc which worked for me for small files,

Cordova Image Picker convert to base64

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am having trouble converting an image to base64 format that has been selected using the ngCordova imagePicker . To keep things simple, the code provided on the Cordova site (which works) is this: module.controller('ThisCtrl', function($scope, $cordovaImagePicker) { var options = { maximumImagesCount: 10, width: 800, height: 800, quality: 80 }; $cordovaImagePicker.getPictures(options) .then(function (results) { for (var i = 0; i < results.length; i++) { console.log('Image URI: ' + results[i]); } }, function(error) { // error getting photos