category:primary is:unread
Friday, August 16, 2019
Thursday, August 15, 2019
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...>?
class App extends React.Component {
render() {
return (
<Header />
<Content/>
);
}
}
This code throw error as follow :
./src/App.js
Line 9: Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
7 | return (
8 |
> 9 |
| ^
10 | );
11 | }
12 | }
to solve that error that you need to put your component tags into elclosing tagslike thisreturn ( <div> <Comp1 /> <Comp2 /> </div> )
or you can use the
<React.Fragment>return ( <React.Fragment> <Comp1 /> <Comp2 /> </React.Fragment>
)https://reactjs.org/docs/fragments.html
Error : verbose stack Error: ENOENT: no such file or directory, open 'Roaming\npm-cache\_npx\1768\package.json
When running npx (with any arguments, but -v is easiest to test) from the global install folder, the following error is produced.
The above error is due the white space contain in your username of PC. The command npx create-react-app doesn't work in this situation and shows error.
Solution :
- run
npm config edit
to edit your config - change
cache
path,e.g.
fromcache=D:\program file\npm-cache
tocache=D:\progra~1\npm-cache
Thursday, August 13, 2015
how-can-i-remove-duplicate-rows
;WITH cte
AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col1, Col2, Col3
ORDER BY ( SELECT 0)) RN
FROM #MyTable)
DELETE FROM cte
WHERE RN > 1
nth max salary in sql
WITH CTE AS
(
SELECT EmpID,EmpName,EmpSalar,
RN = ROW_NUMBER() OVER (ORDER BY EmpSalary DESC)
FROM dbo.Salary
)
SELECT EmpID,EmpName,EmpSalar
FROM CTE
WHERE RN = @NthRow
Monday, August 10, 2015
interface with same method name in c#
interface IPrinter
{
void print(string a);
}
interface IPrinter1
{
void print(string a);
}
class Program
{
static void Main(string[] args)
{
IPrinter p = new Printer();
p.print("rahul");
Printer p1 = new Printer();
((IPrinter)p1).print("overlaoded");
}
}
class Printer : IPrinter, IPrinter1
{
void IPrinter.print(string a)
{
Console.Write(a + "Printer");
Console.ReadLine();
}
void IPrinter1.print(string a)
{
Console.Write(a+"Printer1");
Console.ReadLine();
}
}
Thursday, July 9, 2015
difference between save and insert in mongodb
If the document contains an _id field, then the save() method performs an upsert querying the collection on the _id field: If a document does not exist with the specified _id value, the save() method performs an insert with the specified fields in the document. |
Tuesday, May 26, 2015
Child Actions in ASP.NET MVC
Child Actions are the action methods which can be invoked within the view. This is used to work with the data in the view, which are not related to the main action method. For example, if you want to create a data driven widget in the view using data that is not related to the main action method, you will need to use the child action method.
In ASP.NET MVC any action can be used as a child action. However, to use an action only as a child action and attribute it with the ChildActionOnly. It will make sure the action is not called by any user request and will only be used in the view. A child action can be created as shown below:
1
2
3
4
5
|
[ChildActionOnly]
public ActionResult CurrentTime()
{
return PartialView(DateTime.Now);
}
|
CurrentTime.cshtml
1
2
3
|
@model DateTime
<p>Current time : @Model.ToShortTimeString() </p>
|
1
|
@Html.Action("CurrentTime");
|
1
2
3
4
5
|
[ChildActionOnly]
public ActionResult CurrentTime(object name)
{
return PartialView(name);
}
|
1
|
@Html.Action("CurrentTime", new { name = "Steve" });
|
- To use data in the view which is not related to the main controller
- To create data driven widgets to be used on different views
Subscribe to:
Posts (Atom)
ASP.NET Core
Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...
-
The error message you encountered ("DeleteService FAILED 1072: The specified service has been marked for deletion") indicates tha...
-
For inserting multiple rows using one insert statement you can do as following example : declare @dept table ( DeptId int identit...
-
replace html of a div using jquery this is simple . just use .html() method of jquery to set new html for a div . $ ( "#divID&q...