|
If you can use a DatePicker instead of a TextBox, life will become a whole lot easier.
1. It returns a DateTime object which can passed to your data access layer and saved to the database.
2. Users cannot enter invalid dates.
3. Date formats vary from country to country.
If the value is entered into a row currently displayed in the gidview, it may update automagically or the gidview may need refreshing.
You'll need to give more detail for the answer to be more specific. ASP.NET, MVC, WPF, MVVM, Winforms...
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: If you can use a DatePicker instead of a TextBox, life will become a whole lot easier.
Does that allow one to select a time value as well? The OP said "24/5/2012 2:30:00AM"
|
|
|
|
|
Maybe, I don't know what technology you are talking about. Best just google and find out. There are also Time pickers. It just depends on your needs and what is available
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: Maybe, I don't know what technology you are talking about.
The OP asked about storing a timestamp in a a database. You responded with a GUI component that only acts on a date.
|
|
|
|
|
I thought the OP was using a value entered into a textbox so giving advice or how best to validate that value before saving to DB. I should have mentioned a time picker as well. I wasn't aware it was a time stamp they were trying to save
"You get that on the big jobs."
|
|
|
|
|
Problem with HOGDescriptor
Hi everyone! I'm developing an object detection for a project interested in robotics. I've trained an Hog descriptor to be able to detect some boxes... When I've tried to use the constuctor public
HOGDescriptor(
Size winSize,
Size blockSize,
Size blockStride,
Size cellSize,
int nbins,
int derivAperture,
double winSigma,
double L2HysThreshold,
bool gammaCorrection
) hog;
-> HOGDescriptor des = new HOGDescriptor(new Size(64, 64), new Size(16, 16), new Size(8, 8), new Size(8, 8), 9, 0, -1, 0.2, true);
with a winSize(64, 64)[different from default size of (64, 128)] for use my vector of float in
hog.SetSVMDetector(vector)
Visual studio give me a "NullReferenceException"... but I've instantiated both hog than vector! So why? I've failed in writing the constructor?
Also the parallelism with openCV is different, in fact the costructor in openCV is
HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
double threshold_L2hys=0.2, bool gamma_correction=true,
int nlevels=DEFAULT_NLEVELS);
but derivAperture there isn't!!!
Please help me!
Sissi
|
|
|
|
|
Please use <pre> tags so your code looks readable, like this:
HOGDescriptor des = new HOGDescriptor(new Size(64, 64), new Size(16, 16), new Size(8, 8), new Size(8, 8), 9, 0, -1, 0.2, true);
hog.SetSVMDetector(vector)
Did you notice the difference between the two object names?
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
I try to explain...
I'm using EMGU, a wrapper for OpenCV's libraries. I'm trying to do an object detector (who detect boxes), starting from the Example "Pedestrian Detection" (it's inside the Emgu's packet http://www.emgu.com/wiki/index.php/Pedestrian_Detection_in_CSharp[^])
I know that the default constructor accept these values
HOGDescriptor des = new HOGDescriptor(new Size(64, 128), new Size(16,16), new Size(8, 8), new Size(8, 8), 9, 0, -1, 0.2, true);
The first value in constructor, (64,128), is the size of images used to create the HogDetector able to pursue a human figure.
But I've to use images (64, 64) to pursue boxes...and when I use these parameter, visual studio give me a null reference exception.
So, the wrapper may be used only with default value?
I talk with people who had used EMGU yet...Thanks!
|
|
|
|
|
I suggest you put a break point in your HogDescriptor constructor and step through the method. I would guess you are assigning a parameter to a property that has not been instantiated in the constructor.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I've used a break point yet....and, both the HogDescriptor and the vector of float are instantiated
|
|
|
|
|
Did you read my previous response? You are instantiating an object called des and then calling a method on an object called hog . Did you ever initialise hog ? You also omitted to explain clearly which line of code gave the exception.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
My code is only
1. float[] vector= ...
2. HOGDescriptor des = new HOGDescriptor(new Size(64, 64), new Size(16, 16), new Size(8, 8), new Size(8, 8), 9, 0, -1, 0.2, true);
3. hog.SetSVMDetector(vector)
And the exception is on line 3.)
The object 'hog' is only an example name, used to see the constructor....
|
|
|
|
|
OK, for the third time: you instantiate an object named des then call a method on an object named hog . If you still do not see a problem then I'm afraid I am at a loss as to how to make it more clear.
|
|
|
|
|
Sorry... I want to write like this:
1. float[] vector= ...
2. HOGDescriptor des = new HOGDescriptor(new Size(64, 64), new Size(16, 16), new Size(8, 8), new Size(8, 8), 9, 0, -1, 0.2, true);
3. des.SetSVMDetector(vector)
|
|
|
|
|
Why not stop posting what you think your code should look like and post the exact code as copied from your source file, and show the exact, full text of the exception or compiler message you receive?
|
|
|
|
|
I know that there's a problem with the EMGU wrapper constructor of HogDescriptor...I've posted this question hoping to find some people good with EMGU...
|
|
|
|
|
Sissi1987 wrote: I've posted this question hoping to find some people good with EMGU.
And you have studiously ignored my request that you post enough information for them to help you
|
|
|
|
|
A persone who has studied EMGU is able to respond...thanks...
|
|
|
|
|
Hey,
I have been struggling to bind a combo box and a text box.Finally it happened, but unfortunately the text that i have selected in the combo appears with additional wordings.
Ex : I select the word " FISH" from the combo , so i expect that word to appear in text box that i have bind.But instead of that System.Windows.Controls.ComboBoxItem: fish appears.How to solve this.Please tel me how to correct this in design view or by xaml.Thank you
|
|
|
|
|
you need to set the path to Selected value in the binding. refer below code
<TextBox Height="23" HorizontalAlignment="Left" Margin="126,167,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="{Binding ElementName=comboBox1, Path=SelectedValue}"/>
<ComboBox Height="23" HorizontalAlignment="Left" Margin="132,62,0,0" Name="comboBox1" VerticalAlignment="Top" Width="180" ItemsSource="{Binding CMBItems}" />
in the code expose property as
public List<string> CMBItems
{
get
{
return new List<string> { "a","b","c","d"};
}
}
Hope this will help!
Happy Coding
|
|
|
|
|
Thankx alot.I treid as you have said.But still the same mistake appears .I will paste my code lines
=================================================
class.cs
--------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace WpfApplication16
{
public class Class1
{
string lname = "Di";
public string MyProperty
{
get { return lname; }
set
{
lname = Convert.ToString(value);
Debug.WriteLine("----------------------------->>>" + lname);
}
}
}
}
======================================================
MainWindow.xaml
---------------
<Window x:Class="WpfApplication16.MainWindow"
xmlns="http:
xmlns:x="http:
xmlns:local="clr-namespace:WpfApplication16"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<local:Class1 x:Key="a" />
</Window.Resources>
<Grid>
<ComboBox Height="34" HorizontalAlignment="Left" Margin="82,24,0,0" Name="comboBox1" VerticalAlignment="Top" Width="318" SelectedItem="{Binding Path=MyProperty, Source={StaticResource a}}" DataContext="{Binding Source={StaticResource a}}" ItemsSource="{Binding Source={StaticResource a}, Path=MyProperty.Length}" DisplayMemberPath="{Binding Path=MyProperty}">
<ComboBoxItem Content="Cat"/>
<ComboBoxItem Content="fish" />
<ComboBoxItem Content="dog" />
</ComboBox>
<TextBox Height="58" HorizontalAlignment="Left" Margin="89,157,0,0" Name="textBox1" VerticalAlignment="Top" Width="338" DataContext="{Binding Source={StaticResource a}}" Text="{Binding Path=MyProperty, BindsDirectlyToSource=True}" />
</Grid>
</Window>
=======================================================
MainWindow.xaml.cs
-------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
namespace WpfApplication16
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();}
public string lname { get; set; }
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
}
}
This is the coding of my full test project example...If possible try to run this ad tel me what should be done.
Thank you
|
|
|
|
|
Code file:
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
}
public List<string> CMBItems
{
get
{
return new List<string> { "a","b","c","d"};
}
}
}
}
xaml
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="126,167,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="{Binding ElementName=comboBox1, Path=SelectedValue}"/>
<ComboBox Height="23" HorizontalAlignment="Left" Margin="132,62,0,0" Name="comboBox1" VerticalAlignment="Top" Width="180" ItemsSource="{Binding CMBItems}" />
</Grid>
</Window>
|
|
|
|
|
It worked... Thankx alotttt.It helped me alot.
|
|
|
|
|
welcome..please mark this as resolved.
|
|
|
|
|
AS i am new to this i dont know how to mark this as resolved.Can you tel?Your answer really helped me
modified 24-May-12 12:55pm.
|
|
|
|
|