Posts

Showing posts from July 1, 2018

Virus Scanning on File Upload C# ASP Core 1.1 Multipart file

Virus Scanning on File Upload C# ASP Core 1.1 Multipart file Working on a file upload that will allow clients from outside to upload large files (well, containing 10000 rows in a text file). I'm using the multipart file stream upload that I have found on many helpful posts because IFomrFile couldn't seem to handle more than 1000 rows. My questions is, as this is working fine, Does anyone know how we can scan the file for virus's etc during the fileupload process? Can things like virus's be sent like this (I'm guessing yes)? Any other security concerns? Many thanks By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Tree shakeable static methods (using rxjs and lodash in alongside)

Tree shakeable static methods (using rxjs and lodash in alongside) I want to use rxjs and lodash or ramda in the same project. I am using typescript with ECMAScript module import statements. (In an ionic project with webpack as the module bundler) rxjs lodash ramda webpack rxjs and lodash-es propagate import statements like this, to enable tree shaking: rxjs lodash-es import { map } from 'lodas-es' import { map } from 'rxjs/operators As you can see, this approach has two problems: Name clashes (I could use an alias, but I think this will lead to more confusion) Very general method names like map , filter etc. are in both libraries present and you always have to look in the import statement, which one is meant and where it came from. map filter The static method approach is much more readable in my opinion, because it is so explicit. I want to keep the syntax like it is in commonjs and also enable tree-shaking. Is this possible somehow? Which alternatives do I have he

Summernote not working properly on popup modal

Image
Summernote not working properly on popup modal I am using summernote.js for html editor in bootrap modal popup. the Editable are in the editor not working by default. But it becoming working when when browser screen is resized or inspect element dev tool is opened . Any idea how to fix this $(".summernote").summernote({ height: 150, toolbar: [ ['style', ['bold', 'italic', 'underline', 'clear']], ['fontsize', ['fontsize']], ['color', ['color']], ['para', ['ul','ol','paragraph']], ["view", ["fullscreen", "codeview"]] ], }); $('i.note-recent-color').each(function(){ $(this).attr('style','background-color: transparent;'); }); And HT

i am facing an error in asp.net report viewer

i am facing an error in asp.net report viewer I'm facing an error in asp.net report viewer The request failed with HTTP status 401: Unauthorized. Working in vs2015 and i have tried by adding <identity impersonate="true" /> in web.config but still my error not resolved. My report is not running now. <identity impersonate="true" /> I've tried the below process also: By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Pandas: How to group (and sum) by category and retain information from subcategory

Pandas: How to group (and sum) by category and retain information from subcategory This is a follow-up question to Pandas: How to subset (and sum) top N observations within subcategories? There it was demonstrated how you could find the sum of the top 3 months for each year in this dataframe: Example dataframe year month passengers 0 1949 January 112 1 1949 February 118 2 1949 March 132 3 1949 April 129 4 1949 May 121 5 1949 June 135 . . . 137 1960 June 535 138 1960 July 622 139 1960 August 606 140 1960 September 508 141 1960 October 461 142 1960 November 390 143 1960 December 432 So that you'd end up with this: year passengers 0 1949 432 1 1950 498 2 1951 582 3 1952 690 4 1953 779 5 1954 859 6 1955 1026 7 1956

Compensate scrollbar space when hiding them with padding with CSS

Compensate scrollbar space when hiding them with padding with CSS The issue I've looked through a lot of SO questions, yet still fail to achieve desired results. A common trick to hide scrollbars is described in this question: use overflow: hidden on parent and hide scrollbar with padding-right: <x>px . But here is the pitfall: if you try to use full width of parent - you can't, because even though you can hide scrollbars with padding-right , their space is still taking parent width, so child can only use 100% - scrollbarWidth , which depends on browser and OS. overflow: hidden padding-right: <x>px padding-right 100% - scrollbarWidth Fiddle of the problem from linked question. What I wonder about is if there is a way to use CSS tricks to be able to use that width. * { margin: 0; } #container1 { height: 200px; width: 200px; border: 1px solid green; overflow: hidden; } #container2 { width: 100%; height: 99%; border: 1px solid blue; overflow: auto;

Unable to concatenate two IEnumerable lists [duplicate]

Unable to concatenate two IEnumerable lists [duplicate] This question already has an answer here: I am creating a WEB API . I have two IEnumerable lists. And at the end I want to concatenate them. WEB API IEnumerable IEnumerable result; IEnumerable prodDetails = new List<tj_xhqd>(); IEnumerable mainDetails= new List<tj_xhqd>(); int prodInterval, prodCount = 0; int mainInterval, mainCount = 0; prodCount = giveProdCount(msn, dt); if(prodCount==0) { prodDetails = ""; } else if (prodCount<=500) { prodDetails = mdcEntitites.tj_xhqd .Where( m => (m.zdjh == msn) && (m.sjsj >= dt) ) .Select( x => new { MSN = x.zdjh, PingDateTime = x.sjsj, PingValue = x.xhqd } ) .ToList(); } else { prodInterval = prodCount / 500; prodDetails = mdcEntitites.tj_xhqd .AsNoTracking() .Where( m => (m.zdjh == msn) && (m.sjsj >= dt) ) .AsEnumerable() .Select( (x, i) => new { MSN = x.zdjh

I am not getting FCM message probably FirebaseMessagingService is not running

I am not getting FCM message probably FirebaseMessagingService is not running I am using FCM for notification. Due to some issue, i am not getting notification when i am sending using FCM Cloud console. <service android:name=".MyInstanceIDService" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name=".MyMessagingService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> This is my both classes. public class MyInstanceIDService extends FirebaseInstanceIdService { private static final String TAG = "MyInstanceIDService"; @Override public void onTokenRefresh() { String refreshedToken = FirebaseInstanceId.getInstance

Asp .net MVC Dropdownlist validation not working

Asp .net MVC Dropdownlist validation not working Here is my Code, Am in learning stage please some one help me. Have three issue 1)validation not working. 2)In controller side modelState is invalid. 3) How to reset dropdownlist after submit. public List<mstrClient> getCountry() { mstrClient objClientList = new mstrClient(); DataSet ds = new DataSet(); string sQuery = "SELECT * FROM INV_mstrCountry WHERE CStatus = 'Y'"; SqlDataAdapter da = new SqlDataAdapter(sQuery, con); con.Open(); da.Fill(ds); con.Close(); List<mstrClient> CountryList = new List<mstrClient>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { mstrClient objClient = new mstrClient(); objClient.CountryCode = ds.Tables[0].Rows[i]["CountryCode"].ToString(); objClient.Country = ds.Tables[0].Rows[i]["CountryName"].ToString(); Count

Your push would publish a private email address error

Image
Your push would publish a private email address error I'm very new to Github/VCS. When I try to share my project on Github, I get the following error message. Can't finish GitHub sharing process Successfully created project 'myproject' on GitHub, but initial push failed: remote: error: GH007: Your push would publish a private email address. failed to push some refs to 'https://github.com/me/myproject.git' I've googled the error message, and got no hits. I've also searched stackexchange, but no cigar. Any ideas on how to solve this issue? I removed references to pycharm as the error has to do with github and not pycharm. – Burhan Khalid May 9 '17 at 7:26 4 Answers 4 I experienced the same error: GH007 m

How can I find the randomly Xpath using Selenium?

How can I find the randomly Xpath using Selenium? I am a newer in Selenium and use python to build it. Recently, I found a question which want to ask someone who can help me to figure it. The question is the Xpath I want to get is randomly, for example: '//*[@id="wiki-edit-wikiEdit26"]/div/div/div/div[2]/a[1]' '//*[@id="wiki-edit-wikiEdit27"]/div/div/div/div[2]/a[1]' '//*[@id="wiki-edit-wikiEdit28"]/div/div/div/div[2]/a[1]' These three xpath are used on the same button, but the number after wikiEdit will be changed every time. Therefore, are there any way which can help me to run my script more smoothly? Thank you very much! xpath Here is my python code: broswer.find.element_by_xpath('//*[@id="wiki-edit-wikiEdit26"]/div/div/div/div[2]/a[1]') .click() do you want to change no. in wikiEdit ? – Raghav Patnecha 33 mins ago

Refresh(recreate) the activities in back stack when change locale at run time

Refresh(recreate) the activities in back stack when change locale at run time I have an Activity say ActivityMain from this activity I moved to another activity called ActivitySettings and in settings activity I'm changing the App locale by clicking on a button, and using recreate I achieved the change I need in current activity but when I press back my `ActivityMain' will resume but locale is not updated. ActivityMain ActivitySettings Can some one tell me how to 'Recreate' backstack activities? what will be the correct approach. I can't call recreate on refresh as it will be infinite loop Look at here developer.android.com/training/basics/intents/result – VolkanSahin45 2 days ago 1 Answer 1 In each Activity's onCreate() you

Use system variable in spring boot [duplicate]

Use system variable in spring boot [duplicate] This question already has an answer here: I have defined a variable in my .bash_profile like this : export PROFILE=local Now, I want to get this value in my spring boot application to load different configuration files according to this value. To do this, I used the annotation @Value but spring can't resolve the value of profile : @Value("${profile}") private String environment; What have I missed ? EDIT : This code is launched from a JUnit test inside Eclipse (launched as desktop application) This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. did you try ${PROFILE} – pvpkiran 2 days ago ${PROFILE} Yes and it doesn't work ! – midix

How do I document a multipart request with apiary?

How do I document a multipart request with apiary? I want to document a multipart request like the following: Content-Length: 477 Content-Type: multipart/form-data; boundary=---BOUNDARY -----BOUNDARY Content-Disposition: form-data; name="image[file]"; filename="image.jpg" Content-Type: image/jpeg Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAABAAEDASIA AhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEB AAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AL+AD//Z -----BOUNDARY-- A curl to reproduce this same request would be something like: curl curl -F "image[file]=@file.jpg" http://localhost/images This doesn't seem to be supported yet. There's an issue here discussing how

Action Script 3 - ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller

Action Script 3 - ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller I'm following this tutorial for Action Script 3 on http://markbennison.com/actionscript/as3-space-shooter/2-coding-projectiles/ I'm on part 2 Coding projectiles I don't know why its saying Error all the time when I press play "ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller." Here's the exact code im trying to work through to shoot bullets when spacebar is pressed, there are more but idk how to fix the Argument Error. function addBullet(startX, startY): void { //declare an object instance from the bullet Class var b: Bullet = new Bullet(); //set the new bullet's x-y coordinates b.x = startX; b.y = startY; //add the new bullet to the stage stage.addChild(b); //store the object in an array bullets_arr.push(b); } function moveBullet(): void { //loop through all instances of the bullet //loop from '0' to 'num

Finding the sum of numbers in an array - excluding the number 13 and the number directly after it

Finding the sum of numbers in an array - excluding the number 13 and the number directly after it I would like to write a program in Java which, given an array, finds the sum of all the numbers in the array - with an exception! Since the number 13 is very unlucky, I propose that we shall completely exclude the number 13, and the number directly after 13, if it exists, from the total sum. The program, which I shall call sum13 , should produce the following results from the following inputs (these are just a few examples): sum13 sum13([1,2,2,1]) = 6 This one is normal; no 13's here. sum13([1,2,2,1]) = 6 sum13([5, 13, 2]) = 5 The 13 and the number directly after the 13 are excluded. sum13([5, 13, 2]) = 5 sum13([13, 13]) = 0 The array contains only 13's, so neither of them are included. sum13([13, 13]) = 0 sum13([1, 2, 13, 2, 1, 13]) = 4 A slightly longer example of the expected output. sum13([1, 2, 13, 2, 1, 13]) = 4 Here is the code which I came up with for sum13 : sum13 pu

Load csv file data into tables

Load csv file data into tables Created tables as below : source:([id:`symbol$()] ric:();source:();Date:`datetime$()) property:([id:`symbol$()] Value:()) Then i have two .csv files which include two tables datas. .csv property.csv showing as below : property.csv id,Value TEST1,1 TEST2,2 source.csv showing as below : source.csv id,ric,source,Date 1,TRST,QO,2017-07-07 11:42:30.603 2,TRST2,QOT,2018-07-07 11:42:30.603 Now , how to load csv file data into each tables one time csv 2 Answers 2 You can use the 0: to load delimited records. https://code.kx.com/wiki/Reference/ZeroColon The most simple form of the function is (types; delimiter) 0: filehandle (types; delimiter) 0: filehandle The types should be given as their uppercase letter representations, one for each column or a blank space to ignore a column. e.g using "SJ" for source.csv would mean I wanted to read in the id column as a sy