|
Thanks Pete, I'll take a look
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Have you used this Alturos.Yolo before? It looks really promising, but as soon as I stat the app I get
Cannot found a valid dataset System.IO.FileNotFoundException: Cannot found pre-trained model, check all config files available (.cfg, .weights, .names)
at Alturos.Yolo.YoloConfigurationDetector.Detect(String path)
at Alturos.Yolo.TestUI.Main.Initialize(String path) in C:\Projects\Alturos.Yolo\Alturos.Yolo-master\src\Alturos.Yolo.TestUI\Main.cs:line 255
I'm guessing there's some kind of configuration that I need to do, but there isn't much documentation that I can see
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Object detection is an ML technique that uses pre trained models to identify objects. You need to download the trained models.
|
|
|
|
|
I have tried many things before I found costura.fody and I were hoping that would be the solution to create a single file exe of a cefsharp application that I'm doing.
So the help file for costura.fody says to set the copy local to true of the file you want to embed in the solution explorer. Done that.
So the exe got a little bit bigger when I did that but I notice that the size was not even close to cover libcef.dll so I suspected that this file was not embedded.
I tested this by renaming the dll in the output folder and yes I couldn't run the application.
I would really love for this to work but I'm kind of giving up. I was struggling with AppDomain.CurrentDomain.AssemblyResolve to tap into that event but it was never called. Even when defining it in the static constructor to make sure it is started before anything else.
I'm currently using this code:
[STAThread]
public static void Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly);
}
Just to clarify things, I'm using a windows forms project and I'm trying to make it as close to the examples I can find online. I would prefer to just add it in the Form1 constructor.
It should be calling this function
private static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
{
throw new NotImplementedException();
}
But it never does.
In the .csproj file tried this snippet.
<Target Name="Prebuild">
<CallTarget Targets="Clean" />
<MSBuild Projects="$(SolutionPath)" Targets="Build" Properties="Configuration=Debug;IgnoreRecursion=true" />
</Target>
<Target Name="BeforeBuild">
<ItemGroup>
<_IgnoreRecursion Include="$(IgnoreRecursion)"/>
</ItemGroup>
<CallTarget Targets="Prebuild" Condition="'%(_IgnoreRecursion.Identity)' != 'true'" />
<CreateItem Include="$(TargetDir)\**\*.*">
<Output TaskParameter="Include" ItemName="OutputFiles" />
</CreateItem>
<ItemGroup>
<EmbeddedResource Include="@(OutputFiles)" Condition="('%(OutputFiles.Extension)' == '.dll' Or '%(OutputFiles.Extension)' == '.pdb')">
<LogicalName>%(OutputFiles.DestinationSubDirectory)%(OutputFiles.Filename)%(OutputFiles.Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Message Importance="high" Text="Embedding: @(OutputFiles->'%(Filename)%(Extension)', ', ')" />
</Target>
This embeds the dll's fine. I just wish ResolveAssembly could be called. If it was I could have this code taking care of the lost dll's
Can anyone please help me with this?
Kind regards andla
|
|
|
|
|
|
I'm sorry this doesn't help me.
The resolve event should be triggered automatically when a dll is missing.
It doesn't trigger at all.
|
|
|
|
|
It is triggered automatically, on every assembly load.
The question is did you wire up the event correctly in your code?
|
|
|
|
|
I can't find any true answer to that only answers that have worked for other people with other setups different from mine.
So I have tried various solutions that have worked for others but it doesn't work for me.
Question is it possible that it is not triggered by recursive loads?
I mean if one dll that I see in the project needs another dll that is missing maybe then the resolve function is not triggered?
I mean in my cefsharp project (embedded chrome for c#) I have one dll named:
libcef.dll
This dll is not visible in the reference section but the application needs it anyway.
Costura.Fody doesn't embed this dll.
|
|
|
|
|
I did another test:
I renamed
CefSharp.Core.dll to something else.
This dll is listed in the references.
The resolve function was successfully triggered.
Okay, so the question is, how do I embed everything and create one stand-alone exe?
How can I embed all resources not only the dll's but everything needed in the exe?
This is what I originally wanted.
|
|
|
|
|
You can only embed .NET .DLL's. If it's a C/C++ library .DLL, it cannot be embedded into the executable.
The library .DLL's are not loaded through the .NET CLR binding mechanism, so they will not have a binding event triggered for them.
modified 21-Apr-20 10:21am.
|
|
|
|
|
I now have a net core api service up and running on a Linux box using Nginx as a reverse proxy server, I can call all of the controller methods that don't have parameters and they return collections of my custom classes. But I'm stuck on one get method that requires a custom class as an input parameter, the controller method code is below
[HttpGet]
[ActionName("GetBOM")]
public ActionResult<bomparam> GetBOM([FromBody] BOMParam bp)
{
// This calls my DAL which queries a database and returns the bp populated with various values
return businessLayer.APIGetBOM(bp);
}
What I can't figure out is how to pass a class instance as a parameter to the method using RestSharp
This is what I've tried
Hide Copy Code
RestClient client = new RestClient("http://IPOfRestService:Port/GetBOM");
RestRequest request = new RestRequest(Method.GET);
BOMParam bp = new BOMParam();
bp.ValveCode = "80044-08";
bp.Torque = 20;
bp.DirectFit = false;
bp.BarPressure = 6;
request.AddJsonBody(bp);
IRestResponse response = client.Execute(request);
I get a not found back in the response object.
Can't find anything googling so thought I'd try here
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
|
Hi Gerry, I followed that link and the only thing the guy was doing differently to me was issuing a Post whereas mine is a Get - apparently it's frowned upon to add a body to a Get request , so I modified my Controller and it worked - it's not returning what I expect but that's probably anther story - thanks for the heads up
Edit
Using the RestSharp deserializer doesn't map the property names that are in different case though , JsonSoft does
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
modified 19-Apr-20 7:30am.
|
|
|
|
|
How to get the status of files that are sent for Printing through VS 2015?
|
|
|
|
|
To monitor the status of a printer from an interactive application, add a reference to the System.Printing assembly, use the PrintServer class[^] to enumerate the print queues, and use the returned PrintQueue[^] instance to monitor the queue.
NB: This is not supported within a Windows Service or ASP.NET project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price p.qty
FROM tblProduct
as p inner join tblBrand
as b on b.id = p.bid inner join tblCategory
as c on c.id = p.cid
where p.pdesc like '%'
--------------------------------------
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
|
|
|
|
|
You're missing a comma between the last two columns:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price p.qty should be:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Im trying to make loadData to datagridview in c#. Is there something wrong on my code?
public void LoadRec()
{
try
{
int i = 0;
dgvProduct.Rows.Clear();
_sqlConn.Open();
_sqlCmd = new SqlCommand("SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty FROM tblProduct as p inner join tblBrand as b on b.id = p.bid inner join tblCategory as c on c.id = p.cid where p.pdesc like '" + txtSearchProd.Text + "%'", _sqlConn);
_sqlDR = _sqlCmd.ExecuteReader();
while (_sqlDR.Read())
{
i++;
dgvProduct.Rows.Add(i, _sqlDR[0].ToString(), _sqlDR[1].ToString(), _sqlDR[2].ToString(), _sqlDR[3].ToString(), _sqlDR[4].ToString(), _sqlDR[5].ToString());
}
_sqlDR.Close();
_sqlConn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
_sqlConn.Close();
}
|
|
|
|
|
Yes. Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
Also, don't store connection, command, or data reader objects in class-level fields. Create them as local variables when they're required, and wrap them in using blocks.
using (var sqlConn = new SqlConnection("..."))
using (var sqlCmd = new SqlCommand("SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty FROM tblProduct as p inner join tblBrand as b on b.id = p.bid inner join tblCategory as c on c.id = p.cid where p.pdesc like @SearchProd + '%'", sqlConn))
{
sqlCmd.Parameters.AddWithValue("@SearchProd", txtSearchProd.Text);
sqlConn.Open();
using (var sqlDR = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (sqlDR.Read())
{
i++;
dgvProduct.Rows.Add(i, sqlDR[0].ToString(), sqlDR[1].ToString(), sqlDR[2].ToString(), sqlDR[3].ToString(), sqlDR[4].ToString(), sqlDR[5].ToString());
}
}
}
Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When I try to execute the code Sir, there is no data displayed on my datagrid.
I also try the to run these query on my sqlserver.
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
FROM tblProduct
as p inner join tblBrand
as b on b.id = p.bid inner join tblCategory
as c on c.id = p.cid
where p.pdesc like '%'
but theres no data showed.
|
|
|
|
|
Then there is no matching data in your database.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Start by cutting it down and trying it in SSMS:
SELECT p.pcode, p.pdesc, b.brand, c.category, p.price, p.qty
FROM tblProduct p
INNER JOIN tblBrand b
ON b.id = p.bid
WHERE p.pdesc LIKE '%'
And see if you get any rows.
If you don't, remove the JOIN and see what p.pid values you do get, then look at tblBrand to see if they exist. Remember that an INNER JOIN requires a matching entry in BOTH tables to return ANY rows.
If you do, add the second JOIN and see what you get.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have two classes like this
public myclass1
{
public int Id {set;get;)
public myclass2 MyClass2{set;get;)
}
public myclass2
{
public int Id {set;get;}
public string Name {set;get;}
}
public list<myclass1> mylist = new List<myclass1>() ;
my list has been bonded to datagridview .
when displying the collection in the grid , the myclass1 is displaying the object name "DomaninName.myclass2"
how to display the propery "Name" of myclass2
|
|
|
|
|
you can overwrite the ToString function
|
|
|
|
|
thank you it works fine for me .
|
|
|
|