TECH |
Techable(テッカブル) |
ポーラ化成工業ら、熱中症リスク判定AIカメラの実証試験を開始。建設現場での有用性を検証 |
https://techable.jp/archives/212870
|
dumsco |
2023-06-28 14:30:12 |
TECH |
Techable(テッカブル) |
人と仕事をDAO的につなげる!Web3時代の仕事マッチングプラットフォームのβ版リリース |
https://techable.jp/archives/212739
|
領域 |
2023-06-28 14:00:35 |
AWS |
AWS Management Tools Blog |
From Mainframe to AWS cloud: A comprehensive mapping guide |
https://aws.amazon.com/blogs/mt/from-mainframe-to-aws-cloud-a-comprehensive-mapping-guide/
|
From Mainframe to AWS cloud A comprehensive mapping guideMainframe systems are being utilized by companies worldwide since the s to operate their core business applications and operations In the digital transformation era businesses are increasingly transferring mainframe data and migrating their workloads into AWS Moreover the recent COVID pandemic has significantly impacted the modernization of mainframe systems due to remote access issues scalability … |
2023-06-28 14:06:15 |
AWS |
lambdaタグが付けられた新着投稿 - Qiita |
AWS lambda (arm) Python3.10.xにライブラリをLayerで追加する方法 |
https://qiita.com/kkml_4220/items/924c41b73e3a698f2a8a
|
awslambdaarm |
2023-06-28 23:40:46 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
SlackとDatabricksの連携に便利なPythonアプリをDatabricksクラスター上で動かす方法 |
https://qiita.com/maroon-db/items/c14d646a24b843172170
|
databricks |
2023-06-28 23:57:29 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
AWS lambda (arm) Python3.10.xにライブラリをLayerで追加する方法 |
https://qiita.com/kkml_4220/items/924c41b73e3a698f2a8a
|
awslambdaarm |
2023-06-28 23:40:46 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
[Python] ニューラルネットワークを用いた材料組織と機械特性の関係の可視化 |
https://qiita.com/yzrnb/items/a020655adbddbbeeacda
|
機械学習 |
2023-06-28 23:30:10 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
公開!週末研究ノート08 ー (実験準備)LATM: LLMs As Tool Makers のクラス化 |
https://qiita.com/tkosht/items/a844cf309e7da52cef2f
|
latmllmsastoolmakers |
2023-06-28 23:08:45 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Keynoteからの書き出しで変なcodeが入る |
https://qiita.com/daddygongon/items/f37becad8320b44442cf
|
converter |
2023-06-28 23:06:27 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS lambda (arm) Python3.10.xにライブラリをLayerで追加する方法 |
https://qiita.com/kkml_4220/items/924c41b73e3a698f2a8a
|
awslambdaarm |
2023-06-28 23:40:46 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
コンテナ開発のベストプラクティスで迷走した話 |
https://qiita.com/ysmb-wtsg/items/169495d458b5b95557f3
|
python |
2023-06-28 23:43:08 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
nodeのDockerイメージを使うと Text file busy エラーが発生する |
https://qiita.com/matoruru/items/80c97be533eb40c66cb8
|
docker |
2023-06-28 23:41:42 |
海外TECH |
Ars Technica |
Will Nintendo’s Switch successor be backward compatible? |
https://arstechnica.com/?p=1950554
|
future |
2023-06-28 14:03:58 |
海外TECH |
MakeUseOf |
How to Fix the “Cannot Read From the Source File or Disk” Error in Windows 11/10 |
https://www.makeuseof.com/cannot-read-source-file-disk-error-windows/
|
message |
2023-06-28 14:15:19 |
海外TECH |
DEV Community |
Setting a LAMP server on Digital Ocean + SSL |
https://dev.to/sarahcssiqueira/setting-a-lamp-server-on-digital-ocean-ssl-55l0
|
Setting a LAMP server on Digital Ocean SSLDisclaimer Although I had done this procedure several times through the years before I have never documented it until now I am writing this article with no pretension to make this an innovative tutorial everything that will be said below all commands and instructions are already available online in lots of other articles and documentation etc The host providers themself use to make available these instructions very clear My main goal in writing this is to register for my own future reference as we often forgot commands and end up spending lots of time googling to remember With some hope this can somehow help someone else too Steps to deploy Lamp in a VPS on Droplet on Digital OceanInitial Setup Create Droplet and set SSH KeysSetting firewallEnabling External AccessApacheInstallingAdjusting FirewallChecking Web ServerHandling Apache Basic CommandsVirtual HostsApache Files and directories overviewMySQLPHPSSL Initial SetupWe must have a Digital Ocean account If you still don t sign up through this link and get day credit After login in your account create a project and then create a Droplet Create Droplet and set SSH Keys Create a DropletTo create your Droplet you can choose among lots of configurations prices sizes memory processors etc Select the most suitable one for your project How to make this decision is completely out of the scope of this article because well it depends Create SSH keys Login to the consoleCreate a new useradduser usernameCreate password password It s necessary to grant privileges to the new user usermod aG sudo usernameNow when logged in as a regular user we can type sudo before commands to run them with superuser privileges Setting firewallufw app listThe expected output Available applications OpenSSH ufw allow OpenSSHEnable firewallufw enableufw statusThe expected output OutputStatus activeTo Action From OpenSSH ALLOW AnywhereOpenSSH v ALLOW Anywhere v Enabling External AccessWith SSH keysrsync archive chown username username ssh home usernameTo access ssh i keypub username ipThe keypub is the file with the SSH keys Apache Installing Apachesudo apt updatesudo apt install apache Adjusting firewallsudo ufw app listThe expected output Available applications Apache Apache Full Apache Secure OpenSSHAs indicated by the output there are three profiles available for Apache Apache This profile opens only port Apache Full This profile opens both port and port TLS SSL encrypted traffic Apache Secure This profile opens only port TLS SSL encrypted traffic sudo ufw allow Apache sudo ufw statusThe expected output OutputStatus activeTo Action From OpenSSH ALLOW Anywhere Apache ALLOW Anywhere OpenSSH v ALLOW Anywhere v Apache v ALLOW Anywhere v Checking the Web Serversudo systemctl status apacheThe expected output apache service The Apache HTTP Server Loaded loaded lib systemd system apache service enabled vendor preset enabled Active active running since Thu UTC h ago Docs Main PID apache Tasks limit Memory M CGroup system slice apache service ├ー usr sbin apache k start ├ー usr sbin apache k start └ー usr sbin apache k startAccess the default Apache landing page to confirm that the software is running properly through your IP address We should see something like this If you do not know your server s IP address try typing this at your server s command prompt hostname IYou will get back a few addresses separated by spaces Handling Apache Basic CommandsSome basic management commands to handle Apache using systemctl are necessary To stop your web server sudo systemctl stop apacheTo start the web server when it is stopped sudo systemctl start apacheTo stop and then start the service again sudo systemctl restart apacheReload without dropping connections sudo systemctl reload apacheBy default Apache is configured to start automatically when the server boots If this is not what you want disable this behavior by typing sudo systemctl disable apacheTo re enable the service to start up at boot sudo systemctl enable apache Virtual HostsWhile working with an Apache web server we can use virtual hosts see server blocks in Nginx to encapsulate configuration details and host more than one domain from a single server Apache on Ubuntu has one server block enabled by default that is configured to serve documents from the var www html directory Ee will create a directory structure within var www for a domain name site leaving var www html in place as the default directory to be served if a client request doesn t match any other sites Make sure to replace the domain name this with your own domain name Creating dir sudo mkdir var www domain name comAssign user to dir sudo chown R USER USER var www domain nameSet permissions sudo chmod R var www domain nameCreate index optional sudo nano var www domain name index htmlThe index html content lt html gt lt head gt lt title gt Welcome to domain name lt title gt lt head gt lt body gt lt h gt The domain name virtual host is working lt h gt lt body gt lt html gt Create the virtual hostFor Apache to serve this content it s necessary to create a virtual host file with the correct directives Instead of modifying the default configuration file located at etc apache sites available default conf directly let s make a new one at etc apache sites available your domain conf sudo nano etc apache sites available domain name confThe file content lt VirtualHost gt ServerAdmin webmaster localhost ServerName domain name com ServerAlias www domain name com DocumentRoot var www domain name ErrorLog APACHE LOG DIR error log CustomLog APACHE LOG DIR access log combined lt VirtualHost gt sudo aensite domain name confsudo adissite default confsudo apachectl configtestsudo systemctl restart apache Apache Files and Directories OverviewIt s interesting to be familiarized with a few important Apache directories and files Content var www html The actual web content can be changed by altering Apache configuration files Server Configuration etc apache The Apache configuration directory etc apache apache conf The main Apache configuration file This can be modified to make changes to the Apache global configuration This file is responsible for loading many of the other files in the configuration directory etc apache ports conf This file specifies the ports that Apache will listen on etc apache sites available The directory where per site virtual hosts can be stored Apache will not use the configuration files found in this directory unless they are linked to the sites enabled directory Typically all server block configuration is done in this directory and then enabled by linking to the other directory with the aensite command etc apache sites enabled The directory where enabled per site virtual hosts are stored Typically these are created by linking to configuration files found in the sites available directory with the aensite etc apache conf available etc apache conf enabled These directories have the same relationship as the sites available and sites enabled directories but are used to store configuration fragments that do not belong in a virtual host Files in the conf available directory can be enabled with the aenconf command and disabled with the adisconf command etc apache mods available etc apache mods enabled These directories contain the available and enabled modules respectively Files ending in load contain fragments to load specific modules while files ending in conf contain the configuration for those modules Modules can be enabled and disabled using the aenmod and adismod commands Server Logs var log apache access log By default every request to your web server is recorded in this log file unless Apache is configured to do otherwise var log apache error log By default all errors are recorded in this file The LogLevel directive in the Apache configuration specifies how much detail the error logs will contain Yay The web server is installed MySQLNow we have a web server up and running we need to install the database system MySQL is a popular option used within PHP environments Use apt to acquire and install this software sudo apt install mysql serverAccess the mysql sudo mysqlThis will connect to the MySQL server as the administrative database user root which is inferred by the use of sudo when running this command Expected output OutputWelcome to the MySQL monitor Commands end with or g Your MySQL connection id is Server version ubuntu Ubuntu Copyright c Oracle and or its affiliates Oracle is a registered trademark of Oracle Corporation and or itsaffiliates Other names may be trademarks of their respectiveowners Type help or h for help Type c to clear the current input statement mysql gt Exit mysql mysql gt exit PHPWith Apache installed to serve our content and MySQL installed to store and manage our data we need PHP that will process code to display dynamic content to the final user In addition to the php package we will need php mysql a PHP module that allows PHP to communicate with MySQL based databases We will also need libapache mod php to enable Apache to handle PHP files Core PHP packages will automatically be installed as dependencies sudo apt install php libapache mod php php mysqlCheck version php vExpected similar output OutputPHP cli built Mar NTS Copyright c The PHP GroupZend Engine v Copyright c Zend Technologies with Zend OPcache v Copyright c by Zend Technologies SSLThat s a plus section For securing Secure Apache on Ubuntu we will be using Let s Encrypt a Certificate Authority CA that facilitates obtaining and installing free TLS SSL certificates Installing CertbotTo obtain an SSL certificate with Let s Encrypt we need to install the Certbot software on our server and a plugin that integrates Certbot with Apache sudo apt install certbot python certbot apache Checking your Apache Virtual Host ConfigurationTo automatically obtain and configure SSL for your web server Certbot needs to find the correct virtual host within your Apache configuration files which we already did previously Checking just in case sudo apachectl configtestThe expected output should be OutputSyntax OK Allowing HTTPS Through the FirewallPreviously we enabled the UFW firewall so we ll need to adjust the settings to allow HTTPS traffic Verifying what kind of traffic is currently allowed on your server sudo ufw statusOur output should look something like this meaning that only HTTP traffic on port is currently allowed OutputStatus activeTo Action From OpenSSH ALLOW Anywhere Apache ALLOW Anywhere OpenSSH v ALLOW Anywhere v Apache v ALLOW Anywhere v To let in HTTPS traffic we have to allow the “Apache Full profile and delete the redundant “Apache profile sudo ufw allow Apache Full sudo ufw delete allow Apache Our status will now look like this sudo ufw statusExpected output OutputStatus activeTo Action From OpenSSH ALLOW Anywhere Apache Full ALLOW Anywhere OpenSSH v ALLOW Anywhere v Apache Full v ALLOW Anywhere v Obtaining an SSL CertificateCertbot provides a variety of ways to obtain SSL certificates through plugins let s use Apache sudo certbot apacheA series of questions will be prompted to configure our SSL certificate Valid e mail address which will be used for renewal notifications and security notices OutputSaving debug log to var log letsencrypt letsencrypt logPlugins selected Authenticator apache Installer apacheEnter email address used for urgent renewal and security notices Enter c tocancel you your domainHit ENTER to proceed to the next step Confirm if you agree to Let s Encrypt terms of service Please read the Terms of Service at You mustagree in order to register with the ACME server at A gree C ancel AWe ll be asked if you would like to share your email with the Electronic Frontier Foundation to receive news and other information Would you be willing to share your email address with the Electronic FrontierFoundation a founding partner of the Let s Encrypt project and the non profitorganization that develops Certbot We d like to send you email about our workencrypting the web EFF news campaigns and ways to support digital freedom Y es N o NInform Certbot of which domains we d like to activate HTTPS for The listed domain names are automatically obtained from your Apache virtual host configuration Which names would you like to activate HTTPS for your domain www your domain Select the appropriate numbers separated by commas and or spaces or leave inputblank to select all options shown Enter c to cancel We ll see output like this Obtaining a new certificatePerforming the following challenges http challenge for domain namehttp challenge for www domain nameEnabled Apache rewrite moduleWaiting for verification Cleaning up challengesCreated an SSL vhost at etc apache sites available domain name ssl confEnabled Apache socache shmcb moduleEnabled Apache ssl moduleDeploying Certificate to VirtualHost etc apache sites available domain name le ssl confEnabling available site etc apache sites available domain name le ssl confDeploying Certificate to VirtualHost etc apache sites available domain name le ssl confNext select whether or not you want HTTP traffic redirected to HTTPS Please choose whether or not to redirect HTTP traffic to HTTPS removing HTTP access No redirect Make no further changes to the webserver configuration Redirect Make all requests redirect to secure HTTPS access Choose this fornew sites or if you re confident your site works on HTTPS You can undo thischange by editing your web server s configuration Select the appropriate number then enter press c to cancel After this Certbot s configuration is finished and we will be presented with the final remarks about your new certificate Verifying Certbot Auto RenewalLet s Encrypt s certificates are only valid for ninety days to ensure that misused certificates or stolen keys will expire sooner rather than later We do not need to worry about this renewal process since the certbot package we installed previously takes care of this It has a script that runs twice a day and will automatically renew any certificate that s within thirty days of expiration To check the status of this service sudo systemctl status certbot timerThe expected output should be similar to this Output certbot timer Run certbot twice daily Loaded loaded lib systemd system certbot timer enabled vendor preset enabled Active active waiting since Tue UTC h ago Trigger Wed UTC h left Triggers certbot serviceApr fine turtle systemd Started Run certbot twice daily To test the renewal process manually sudo certbot renew dry runIf you see no errors you re all set When necessary Certbot will renew your certificates and reload Apache to pick up the changes If the automated renewal process ever fails Let s Encrypt will send a message to the email you specified warning you when your certificate is about to expire ConclusionFor further questions about using Certbot please refer to their documentation References Installing Lamp on Ubuntu Secure Apache with Let s EncryptThe process for setup LAMP in an EC is quite similar which I will write about soon |
2023-06-28 14:47:22 |
海外TECH |
DEV Community |
How did you become a developer? What was the magic moment? |
https://dev.to/philipjohnbasile/how-did-you-become-a-developer-what-was-the-magic-moment-5ecl
|
How did you become a developer What was the magic moment I ll go first Honestly the first time I touched a computer was when my parents brought home an Apple Plus computer at around I think it was They had no idea how to put it together I took one look at it and figured out how to hook everything together and it was like magic The video featured above although not my own resonates perfectly with the thrill that surged through me at that moment The feeling was simply electric Alongside the computer I was presented with a set of four programming books on Apple Basic and some software My curiosity led me to dissect and understand the code visible on the floppy disks In my excitement I modified and personalized the pre existing commercial software by editing its code Although on one occasion I messed up with a program due to the absence of undo options in those times However every step of this process felt like magic and marked the inception of my journey into the world of development |
2023-06-28 14:32:08 |
海外TECH |
DEV Community |
20 C# Interview Questions (for Experienced) 2023 |
https://dev.to/bytehide/20-c-interview-questions-for-experienced-2023-1hl6
|
C Interview Questions for Experienced Hey C Developer Do you know where you are Yes on Dev to but more specifically That s right You re in part of the most comprehensive C Interview Questions and Answers article series Little more to say if you re coming from a previous article As I said let s take the difficulty level up a notch and without further blah blah let s get started What are the differences between IEnumerable ICollection and IList interfaces in C AnswerIEnumerable ICollection and IList are interfaces provided by the NET framework libraries for working with collections of data They have the following differences IEnumerable Provides the basic functionality to iterate through a collection using a foreach loop It supports only read access Ideal for situations where you only need to iterate through a collection Defines only one method GetEnumerator which returns an IEnumerator ICollection Inherits from IEnumerable Represents a collective group of elements with the addition of functionalities like size enumeration and synchronization Adds basic collection manipulation like Add Remove and Clear Supports both read and write access Provides properties like Count and IsReadOnly Provides methods like Add Remove Clear and Contains IList Inherits from ICollection Represents a list of items that are accessible by index Provides advanced collection manipulation like insert and remove by index Supports random access to elements Contains properties like Item property to access elements by index and methods like Insert and RemoveAt Explain the concept of partial classes in C AnswerA partial class denoted with the partial keyword in C is a class whose definition can be split into multiple separate class definitions in the same namespace All the separate class definitions with the partial keyword are combined by the compiler into a single class at the compile time Partial classes can be used to logically organize a large class or to enhance classes generated by code generators e g for UI or web services Advantages of partial classes Provides better maintainability by dividing a large class into multiple logical files Enhances code generation in situations when you need to add your own code to a generated class Allows multiple developers to work on the same class simultaneously without conflicts Syntax File cspublic partial class MyClass public void Method implementation File cspublic partial class MyClass public void Method implementation At compile time these two files are combined into a single class What is boxing and unboxing in C Provide examples AnswerBoxing and unboxing are operations in C related to type conversions between value types and reference types Boxing is the process of converting a value type to a reference type System Object by wrapping the value type inside a new object and storing it on the heap The conversion is implicit Example int value object boxed value BoxingUnboxing is the process of converting a reference type back to a value type by extracting the value from the object and storing it on the stack after checking its type is compatible Unboxing requires an explicit type cast Example object boxed int value int boxed UnboxingNote that these operations come with a performance cost as they involve memory allocation and deallocation particularly when dealing with large data structures or frequent conversions How can you implement multithreading in C AnswerMultithreading is a technique for executing multiple threads concurrently to improve performance and responsiveness in applications In C there are several ways to implement multithreading including Using the Thread class from the System Threading namespace Creating a new Thread requires passing a method delegate as a parameter to its constructor that will be executed when the thread starts using System Threading class Program static void Main Thread thread new Thread new ThreadStart PrintNumbers thread Start PrintNumbers static void PrintNumbers for int i i lt i Console WriteLine i Using Task and Task lt TResult gt classes from System Threading Tasks Tasks provide better abstraction and integration with the ThreadPool eliminating the need to manually manage threads and their resources using System Threading Tasks class Program static void Main Task task new Task PrintNumbers task Start PrintNumbers task Wait Optionally wait for the task to complete static void PrintNumbers Same as example Using the async and await keywords for asynchronous programming This approach simplifies working with long running methods without blocking the calling thread class Program static async Task Main Task longRunningTask LongRunningOperationAsync Do other work while the long running task completes await longRunningTask static async Task LongRunningOperationAsync await Task Delay Placeholder for a long running operation Additionally you can use Parallel class for parallel operations on collections e g Parallel ForEach or Parallel For and ThreadPool for managing a pool of threads What is the concept of anonymous methods in C AnswerAnonymous methods in C are a way to define inline unnamed methods that can be assigned to delegate instances They provide a concise way to create small functions without declaring an entire named method Anonymous methods use the delegate keyword and do not require a separate method declaration Example public delegate void DisplayMessage string message class Program static void Main DisplayMessage display delegate string message Anonymous method Console WriteLine message display Hello Anonymous method In C and later anonymous methods can be replaced by lambda expressions which provide a more concise syntax The previous example can be rewritten as DisplayMessage display message gt Console WriteLine message What are the different types of delegates in C AnswerDelegates in C can be divided into three main types Singlecast Delegates These delegates reference a single method with a matching signature When the delegate is invoked it calls the referenced method public delegate void DisplayMessage string message class Program static void Main DisplayMessage display ShowMessage display Hello Singlecast delegate static void ShowMessage string message Console WriteLine message Multicast Delegates These delegates can reference multiple methods with a matching signature When the delegate is invoked it calls all the referenced methods in the order they were added Multicast delegates are created using the or operators public delegate void DisplayMessage string message class Program static void Main DisplayMessage display ShowMessage display ShowMessage display Hello Multicast delegate static void ShowMessage string message Console WriteLine Message message static void ShowMessage string message Console WriteLine Message message Generic Delegates These delegates use generic type parameters allowing them to work with multiple types without casting or boxing unboxing C provides three built in generic delegates Func Action and Predicate Func lt TResult gt A delegate that represents a function with a return type Action A delegate that represents a void returning method with no parameters Predicate lt T gt A delegate that represents a method that takes an input parameter and returns a boolean Example using Func and Action class Program static void Main Func lt int int int gt add x y gt x y Action lt string gt display message gt Console WriteLine message int sum add display Sum sum Explain the principle of encapsulation in C AnswerEncapsulation is a fundamental object oriented programming principle that refers to the bundling of data properties and behavior methods within a single class or object This concept aims to Hide internal implementation details from other parts of the application encapsulating inner workings Expose a well defined public interface for communication between objects Easily update or modify the implementation without affecting the external callers In C encapsulation can be achieved using access modifiers public private protected internal protected internal to restrict access to the class members and by combining fields properties and methods inside a class Example class BankAccount private double balance Private field representing the internal state public double Balance Public property exposing the balance with read only access get return balance public void Deposit double amount Public method for depositing funds if amount gt balance amount public void Withdraw double amount Public method for withdrawing funds if amount gt amp amp balance gt amount balance amount What is the benefit of using an extension method in C AnswerExtension methods in C are a way to add new methods to an existing type without modifying the original type inheriting from it or using any other type of customization Extension methods can be useful in situations where you do not have the source code of the type or you want to extend a sealed non inheritable class The benefits of using extension methods are Improved code readability and maintainability The ability to extend a class without modifying its code Adding functionality to a class without inheriting from it or using composition An extension method is defined as a static method in a static class and uses the this keyword before the first parameter to specify the type it is extending Example public static class StringExtensions public static string Reverse this string input char chars input ToCharArray Array Reverse chars return new string chars class Program static void Main string text Hello extension method string reversedText text Reverse Console WriteLine reversedText Here the Reverse extension method is added to the string type and can be called as if it was a native method of the string class How does C support operator overloading AnswerOperator overloading in C allows any custom class or struct to redefine the behavior of certain operators like etc for its instances This can provide a more intuitive and natural syntax when working with objects of the custom type To overload an operator you need to define a public static method in your class with the operator keyword followed by the operator symbol being overloaded The method must have the required parameters and return type as specified by the operator being overloaded Example public class ComplexNumber public double Real get set public double Imaginary get set public ComplexNumber double real double imaginary Real real Imaginary imaginary Overloading the operator public static ComplexNumber operator ComplexNumber a ComplexNumber b return new ComplexNumber a Real b Real a Imaginary b Imaginary class Program static void Main ComplexNumber a new ComplexNumber ComplexNumber b new ComplexNumber ComplexNumber sum a b Uses the overloaded operator What is the use of the base keyword in C AnswerThe base keyword in C is a reference to a class s immediate parent class base class and is used to access its members including properties methods and constructors The base keyword is often used in the following scenarios Calling base class constructors When creating an instance of a derived class you can call a base class constructor from the derived class constructor using the base keyword followed by the constructor parameters public class Animal public int Legs get set public Animal int legs Legs legs public class Dog Animal public Dog base Base class constructor is called with the argument Accessing base class methods In a derived class you may want to access the original implementation of an overridden or shadowed method from the base class In this case you can use the base keyword followed by the method name public class Animal public virtual void MakeSound Console WriteLine The animal makes a sound public class Dog Animal public override void MakeSound Call base class method base MakeSound Console WriteLine The dog barks class Program static void Main Dog dog new Dog dog MakeSound Outputs The animal makes a sound followed by The dog barks By using the base keyword you can extend or reuse functionality from the base class while maintaining the inheritance relationship between the classes Explain how LINQ queries work in C and give an example AnswerLanguage Integrated Query LINQ is a powerful feature in C that allows you to query data from various data sources directly from within the C language In LINQ query operations are performed using familiar language syntax This makes the query quite readable and easy to understand LINQ queries can work with anything that implements the IEnumerable interface such as arrays and collections Plus they are statically typed and use IntelliSense making writing queries error free Here is an example List lt int gt numbers new List lt int gt IEnumerable lt int gt evenNumbers from num in numbers where num select num In the above example evenNumbers will hold and The query determines the numbers in the input sequence that fulfill the condition num which are even numbers What is a Thread Pool in C How can it be beneficial than creating a new thread AnswerA Thread Pool in C is a collection of threads that are made available for use by various tasks Instead of each task creating starting and stopping a new thread tasks can use a thread from the thread pool greatly improving efficiency There are several benefits to using a thread pool Threads in a thread pool are reused avoiding the overhead of creating a new thread every time The number of threads in the application does not spike up avoiding the issue of too many threads which can slow down the system The system automatically manages the details of how and when tasks are assigned to threads in the thread pool Here is how you can use the ThreadPool ThreadPool QueueUserWorkItem new WaitCallback SomeMethod In the above line SomeMethod is a method that is executed on a separate thread What is a Nullable type in C and how do you use it AnswerIn C Nullable types are value types which can take null values This capability is crucial because the value types don t normally take null values A Nullable type is declared using the symbol after the value type For instance int is a Nullable type based on the int type You can assign any value which an int can take plus an additional null value Here is how you can use it int number null In the code above because int is a nullable type we re able to assign a null value to number How does C manage memory automatically AnswerMemory management in C is handled through the Garbage Collector GC an automatically enabled feature in the NET framework Here is how GC works When an object is created in NET it is stored in the heap memory The GC automatically reclaims the memory taken up by the unused objects or the ones that are no longer being used by the application The GC does this automatically without the programmer having to write any specific code for it This automatic feature saves the developer from various potential errors like memory leaks and invalid memory references The GC also compacts the space thus enhancing memory locality which in turn increases performance since objects that are referenced frequently end up being located close each other How do you use reflection in C to inspect an object s properties and methods AnswerReflection in C is a feature that enables you to obtain type information at runtime inspect the metadata of types create and manipulate instances of types and invoke methods Here s an example of using reflection to get an object s properties Person person new Person Type type person GetType PropertyInfo properties type GetProperties foreach PropertyInfo property in properties Console WriteLine Name Value property Name property GetValue person null In the example above GetType gets the type of the person object GetProperties gets all the properties of that type then we loop through the properties and for each property name and its value we write it out to the console Can you explain what a Lambda expression is and give an example of its use AnswerA lambda expression in C is an anonymous function or method that can be used wherever delegate types are required They provide a simple and concise way of defining methods Lambda expressions use the gt operator which can be read as “goes to For example here is a lambda expression that squares a number Func lt int int gt square x gt x x Here x is the input parameter can be more than one comma separated and x x is the method body that is returned from the function Lambda expressions can be used in a lot of cases but they are specially useful in LINQ queries event handling and creating expression trees How do you enforce thread safety in C AnswerThread safety ensures that data shared between threads are shielded from corruption due to the threads being executed in an overlapping manner In C you can enforce thread safety by using various techniques Locks The lock keyword can be used to ensure that a block of code is not executed by more than one thread at the same time private static object lock new object public void UpdateCounter lock lock counter Monitor Monitor class provides exclusive lock similar to lock keyword Monitor Enter lockObject try Code to execute finally Monitor Exit lockObject Mutexes and Semaphores Mutex and Semaphore classes can be used to control access over a pool of resources Thread Safe Collections NET provides inherently thread safe collections like ConcurrentBag ConcurrentQueue ConcurrentStack ConcurrentDictionary etc What are the differences between a struct and a class in C AnswerWhile structs and classes in C are quite similar there are many key differences between them Value Type vs Reference Type The most significant difference is that struct is a value type and class is a reference type When a struct is assigned to a new variable a completely new copy of the value is created and changes made to one will not affect the other However with classes assigning an instance of a class to a new variable doesn t create a new object but creates a new reference to the existing object Inheritance Structs in C cannot inherit from a class or struct but it can implement an interface But classes in C can inherit from a class or implement an interface Default Constructor Structs do not contain a default parameterless constructor and the compiler does not add one Classes however have a default constructor if no constructors are specified Nullability Structs cannot be null as they are a value type whereas classes being a reference type can have a null value What are Attribute classes and how are they beneficial AnswerAttribute classes in C are a way for adding declarative information to code It is a kind of metadata that can be added to the assemblies types methods fields etc at compile time and can be queried at runtime using reflection Benefits of Attribute Classes Code readability and maintainability With attribute classes you can control behavior of methods or classes without affecting their source code Metadata Access at Runtime You can access metadata at runtime for affecting the behavior or else for diagnostics inspection purpose Controlling behavior Custom attributes can be queried at runtime and accordingly certain behaviors can be enabled or disabled without hard coding them For example Conditional attribute in C is used for conditional compilation class Program Conditional DEBUG static void DebugMethod Console WriteLine Debug mode In this example DebugMethod will only be called if “DEBUG symbol is defined Well there you have it Those were the mid high level C interview questions Bet they got your brain cells working huh But remember each challenge faced is another step up the ladder Stick around as we continue to navigate through the complex world of C with more mind boggling challenges up our sleeves Until then keep learning keep growing |
2023-06-28 14:21:46 |
海外TECH |
DEV Community |
Handle optional input parameters in AWS Step Functions without Lambda |
https://dev.to/kumo/handle-optional-input-parameters-in-aws-step-functions-without-lambda-424m
|
Handle optional input parameters in AWS Step Functions without LambdaTL DRIf you want to apply data processing to an input object in your state machine without the well known struggle of dealing with optional parameters you can use the HandleOptionalParameters CDK construct as follows const transformInputValuesToItemArraysTask new HandleOptionalParameters scope Handle optional parameters requiredProperties requiredProperty optionalProperties optionalProperty optionalProperty Apply States Array intrinsinc function on every input values dataProcessing States Array value Other examples Encode every input values and return the object with same input keys but with encoded values dataProcessing States BaseEncode value Concatenate the value with the property name with the JsonPath propertyName dataProcessing States Format Current key is and associated value is propertyName value new StateMachine scope State machine using HandleOptionalParameters construct definition processObjectValuesTask Context AWS Step Functions throws if the provided JsonPath is not presentAWS Step Functions lets you do data processing on a state machine execution input thanks to its intrinsic functions For example let s say you need to put every values of an object input in an array To transform a value to an item array containing this value with Amazon State Language you can use the States Array intrinsic function To transform every values of an input object you can apply States Array on every properties However when dealing with object inputs you have to make sure that each property you want to process is present in the input otherwise the execution will fail An error occurred while executing the state Transform input values to array entered at the event id The function States Array optionalProperty had the following error The JsonPath argument for the field optionalProperty could not be found in the input requiredProperty Indeed if foo is actually undefined You thus need to handle these optional input parameters Choices the false good idea for large inputsChoice is another common flow state of AWS Step Functions that enables you to decide on which branch to continue the state machine execution based on a condition evaluated at run time You can thus use a Choice state to evaluate the optional property s presence in the input and apply the States Array function only if the property is defined in the input However if the input has many optional values your step function may look like this This causes scalability issues DX as you can see in the execution graph view debugging is painful in the AWS consoleAWS limitations in my case Cloudformation template hard size limit of MB is reached with optional propertiesCost in a standard workflow billing depends on the number of state transition which is proportional to the number of optional propertiesPerformance Choices are not parallelised which leads speed to decrease with the number of optional propertiesYou thus need to handle the scalability of your optional parameters Let the HandleOptionalParameters CDK construct handle the optional parameters for youThe HandleOptionalParameters CDK construct processes every defined values with whatever data processing you provide while ignoring the undefined ones And it does it in common flow tasks regardless of the number of optional parameters Let s break it down ConclusionFrom now on stop using Lambda for handling large state machine inputs with many optional parameters |
2023-06-28 14:15:57 |
Apple |
AppleInsider - Frontpage News |
EU law would let iCloud users transfer their data to rival platforms |
https://appleinsider.com/articles/23/06/28/eu-law-would-let-icloud-users-transfer-their-data-to-rival-platforms?utm_medium=rss
|
EU law would let iCloud users transfer their data to rival platformsThe European Union has agreed on rules that would make it easier for people to move their data between services including iCloud The Data Act involves data portabilityThe European Commission proposed the Data Act in intending to oversee the data produced by smart devices machinery and consumer goods This initiative forms part of a wider legislative endeavor to limit the influence of major technology companies in the US Read more |
2023-06-28 14:49:23 |
Apple |
AppleInsider - Frontpage News |
Deals: 14" MacBook Pro $1,799, M1 models from $890, $229 off Apple Watch Series 8 w/ AppleCare, $89 Apple Pencil 2, more |
https://appleinsider.com/articles/23/06/28/deals-14-macbook-pro-1799-m1-models-from-890-229-off-apple-watch-series-8-w-applecare-89-apple-pencil-2-more?utm_medium=rss
|
Deals quot MacBook Pro M models from off Apple Watch Series w AppleCare Apple Pencil moreToday s top deals include off a eufy security video doorbell off a Samsung ViewFinity K computer monitor off an iRobot Roomba robot vacuum off a Corsair gaming mouse and more Save on an Apple Watch Series bundleThe AppleInsider Deals Team searches the web for top notch deals at online retailers to create a list of excellent discounts on popular tech gadgets including discounts on Apple products TVs robot vacuums and accessories We share our best finds every morning to help you save money Read more |
2023-06-28 14:17:51 |
海外TECH |
Engadget |
A Samsung Galaxy S23 FE may be on the way later this year |
https://www.engadget.com/a-samsung-galaxy-s23-fe-may-be-on-the-way-later-this-year-143559312.html?src=rss
|
A Samsung Galaxy S FE may be on the way later this yearA Samsung Galaxy S FE may be on the way after the company declined to offer a mid range entry point for its previous gen flagship smartphone lineup Steve Hemmerstoffer aka OnLeaks who has a solid track record has provided a first look at renders of the Galaxy S FE The leaked images suggest Samsung s device will have a triple camera array Unusually for a mid range smartphone the sensors may include a telephoto lens The Galaxy S FE is said to have a screen size of around inches with a Hz AMOLED panel and an under display fingerprint reader Good Morning FutureSquad Here comes your very first look at the much anticipated Samsung GalaxySFE °video gorgeous K renders dimensions On behalf of Smartprix pic twitter com SgrDoFaiNーSteve H McFly OnLeaks June Details about the internals are less clear at this point as The Verge notes Rumors have pointed to the Galaxy S FE running on a Snapdragon Plus Gen chipset from in some markets and the Exynos elsewhere It could have GB and GB RAM options and GB or GB of storage The Galaxy S FE should arrive by the end of according to Hemmerstoffer We may not have to wait too much longer to find out about it either as Samsung will run its second Unpacked event of the year in July Steve Hemmerstoffer SmartprixThis article originally appeared on Engadget at |
2023-06-28 14:35:59 |
海外TECH |
Engadget |
OnePlus' first foldable phone will reportedly feature a 2K screen |
https://www.engadget.com/oneplus-first-foldable-phone-will-reportedly-feature-a-2k-screen-140426945.html?src=rss
|
OnePlus x first foldable phone will reportedly feature a K screenOnePlus might be the next company to jump into the foldable phone space and it could have a few ways to stand out Well known tipster OnLeaks and MySmartPriceclaim to have specs for the OnePlus Fold aka OnePlus V Fold a book style foldable and it will apparently deliver top end performance It will reportedly revolve around a inch quot K quot folding screen as well as a inch external display both Hz and would come with a speedy Snapdragon Gen chip as well as GB of RAM and GB of storage You d see megapixel regular and ultra wide cameras on the back a MP telephoto sensor a MP front cam for the external screen and a MP selfie shooter when the phone is open The mAh battery wouldn t be exceptional and you d have to be content with just W fast wired charging instead of the W from the OnePlus And yes the brand s signature alert slider would make the cut despite the relatively novel form factor OnePlus is rumored to be launching the Fold this August or about a month after Samsung is unofficially expected to debut the Galaxy Z Fold and Galaxy Z Flip There s no word on pricing but the claimed hardware could make it expensive The foldable phone category is still relatively small with North Americans largely having to choose between the Galaxy Z line Google s Pixel Fold and Motorola s Razr With OnePlus entering the arena though there are signs the field is heating up That s good news for customers as it might lead to more aggressive pricing and new entrants that were previously content to sit on the sidelines This article originally appeared on Engadget at |
2023-06-28 14:04:26 |
海外科学 |
NYT > Science |
The Crises of Heat and Smoke Share a Common Thread: Climate Change |
https://www.nytimes.com/2023/06/28/climate/heat-smoke-climate-change.html
|
catastrophic |
2023-06-28 14:39:35 |
海外科学 |
NYT > Science |
Pumping Groundwater Has Changed Earth’s Spin, Study Finds |
https://www.nytimes.com/2023/06/28/climate/groundwater-earth-spin-axis.html
|
sharp |
2023-06-28 14:50:47 |
金融 |
金融庁ホームページ |
審判期日の予定を更新しました。 |
https://www.fsa.go.jp/policy/kachoukin/06.html
|
期日 |
2023-06-28 16:00:00 |
金融 |
金融庁ホームページ |
(株)東京衡機における有価証券報告書等の虚偽記載に対する課徴金納付命令の決定について公表しました。 |
https://www.fsa.go.jp/news/r4/shouken/20230627.html
|
有価証券報告書 |
2023-06-28 16:00:00 |
金融 |
金融庁ホームページ |
金融仲介機能の発揮に向けたプログレスレポートを公表しました。 |
https://www.fsa.go.jp/news/r4/ginkou/20230628/20230628.html
|
Detail Nothing |
2023-06-28 16:00:00 |
金融 |
金融庁ホームページ |
「金融機関の取組みの評価に関する企業アンケート調査」について公表しました。 |
https://www.fsa.go.jp/common/about/research/20230628/20230628.html
|
金融機関 |
2023-06-28 16:00:00 |
金融 |
金融庁ホームページ |
金融庁が実施した「企業アンケート調査の結果」について公表しました。 |
https://www.fsa.go.jp/policy/chuukai/shiryou/questionnaire/230628/01.pdf
|
金融庁 |
2023-06-28 16:00:00 |
金融 |
金融庁ホームページ |
「顧客本位の業務運営を確保するための環境整備に関する調査」を公表しました。 |
https://www.fsa.go.jp/common/about/research/20230628-4/20230628-4.html
|
顧客 |
2023-06-28 16:00:00 |
ニュース |
BBC News - Home |
Thames Water in funding talks amid fears of collapse |
https://www.bbc.co.uk/news/business-66039170?at_medium=RSS&at_campaign=KARANGA
|
population |
2023-06-28 14:52:26 |
ニュース |
BBC News - Home |
Paris: Macron calls police killing of teen 'unforgivable' |
https://www.bbc.co.uk/news/world-europe-66040464?at_medium=RSS&at_campaign=KARANGA
|
paris |
2023-06-28 14:33:59 |
ニュース |
BBC News - Home |
Formal groping complaint made against mayor candidate |
https://www.bbc.co.uk/news/uk-england-london-66025378?at_medium=RSS&at_campaign=KARANGA
|
cabinet |
2023-06-28 14:21:03 |
ニュース |
BBC News - Home |
Kevin Spacey jury sworn in for sex offences trial |
https://www.bbc.co.uk/news/uk-66044727?at_medium=RSS&at_campaign=KARANGA
|
sexual |
2023-06-28 14:05:16 |
ニュース |
BBC News - Home |
Investigation into mental-health inpatient care in England |
https://www.bbc.co.uk/news/health-66044625?at_medium=RSS&at_campaign=KARANGA
|
people |
2023-06-28 14:09:39 |
ニュース |
BBC News - Home |
Illegal trade in AI child sex abuse images exposed |
https://www.bbc.co.uk/news/uk-65932372?at_medium=RSS&at_campaign=KARANGA
|
abuse |
2023-06-28 14:04:06 |
ニュース |
BBC News - Home |
Estimated 700,000 pupils in unsafe or ageing schools in England, says watchdog |
https://www.bbc.co.uk/news/education-66030635?at_medium=RSS&at_campaign=KARANGA
|
describe |
2023-06-28 14:26:29 |
仮想通貨 |
BITPRESS(ビットプレス) |
SBI VCトレード、2023/6/28から「シバイヌ(SHIB)・ダイ(DAI)・コスモス(ATOM)」の取扱開始 |
https://bitpress.jp/count2/3_10_13658
|
sbivc |
2023-06-28 23:40:37 |
仮想通貨 |
BITPRESS(ビットプレス) |
SBI VCトレード、2023年7月から暗号資産信託の業務開始 |
https://bitpress.jp/count2/3_10_13657
|
sbivc |
2023-06-28 23:38:27 |
コメント
コメントを投稿