|
Hi to all.
Did anyone already work on C# wrapper for PocketSphinx for converting speech to text and will ing to share some ideas?
Thank you!
|
|
|
|
|
It's very unlikely you're going to find anyone who has used that library here.
Try asking your question in the Forums on the SrouceForge site for it, here[^].
|
|
|
|
|
There is a C# wrapper for Sphinx, called SharpSphinx, here: [^].
I've never tried it.
«If you search in Google for 'no-one ever got fired for buying IBM:' the top-hit is the Wikipedia article on 'Fear, uncertainty and doubt'» What does that tell you about sanity in these times?
|
|
|
|
|
hello
I implement Breadth First Search (BFS)in AI, but I receive the following error message: Exception of type 'System.OutOfMemoryException' was thrown.
Can't get rid of error message to do anything?
Help.
my code is:
try
{
while (FIFO.Count != 0)
{
node = (Node)FIFO.Dequeue();
if (node.State.GoalTest())
{
while (node.ParentNode != null)
{
txtResult.Text += node.Actions + Environment.NewLine;
txtResult.Text += node.State.AsString() + Environment.NewLine;
txtResult.Text += "============================" + Environment.NewLine;
node = node.ParentNode;
}
return;
}
else
{
action[] a = new action[4];
s = node.State.Succ(out a);
for (int i = 0; i < 4; i++)
{
if (s[i] != null)
{
n.State = s[i];
n.Actions = a[i];
n.Depth = node.Depth + 1;
n.ParentNode = node;
FIFO.Enqueue(n);
n = new Node();
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
|
|
|
|
"txtResult" would become rather big, wouldn't it? Write the output directly to the console, as opposed to building a lot of strings. And look up a StringBuilder.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Without your data and debugging this it's kinda difficult to tell - but if you enqueue a node whose State causes GoalTest to return false and as a result the new node that creates has the same state, then your FIFO count will always be nonzero and you will add nodes until the system runs out of memory.
I'd start by using the debugger to step though the code and work out where it is going.
Eddie's suggestion of a StringBuilder is a very good one, though!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
First, If you continuously generate data, and mostly objects, they took lot of space, even though you destroy any link to object data
that's what i previously experience with win form game, which had many frame rendering in a second, the memory slowly became full, and in about 90% it generate such error.
so what i done was to call Garbage Collector manually, GC.Collect() took some time to process, so you better run it in separate trade , and also not per any cycle of your loop...
Once you call it, lot of memory goes free... (as i mention before, it only work for objects which there are no link to, and are lost in memory without any reference from your application to)
Second, you also don't seem to clear your result string, it always got a +=, mean it just keep on growing, though if it's just that simple loop i don't think it gonna matter, but since i don't see your variable declaration, I'm afraid it growth too much big, through other processes, or a loop contain this process, which cause you run out of memory.
modified 23-Nov-14 2:07am.
|
|
|
|
|
Hello,
I am running into some problems with a program that I've written and I need some help. It is a C# .NET 2.0 Winforms application. It is being executed from a network drive, and runs under Windows XPand Windows 7. The platform target is x86. It does some SQL queries, reading and writing to a file stored on a network using SQLite. There are certain operations, which are not repeatable, in which the
user will click and the program will simply stall, going into the hourglass (or spinning circle). Usually when this happens, the program will crash with "The application has stopped working" error. I have an
exception handler, but apparently it is not catching the problem.
What measures can I take to find out the problematic code? Or to correct the errors? The users of the program get frustrated when the crashes occur as it slows down their work.
Thanks
Mike
|
|
|
|
|
Intermittent errors are the worst to try and find: if you can't duplicate it, you can't fix it.
And "The application has stopped working" tells you (and I) nothing at all about why it stopped - it's a generic message that you app did something it wasn't supposed to.
So the first thing you need is information!
You are going to have to add logging to your app - to try and work out roughly where it is when it crashes. I'd suggest starting at a high level, and logging the rough areas the user is using: enter and exit event handlers to a file until you can get a "feel" for which handlers are causing the problem. Then you can focus more logging into the methods that calls to try and work out what it's doing. Using File.AppendAllText is the simplest method, and should be relatively unobtrusive (util you get down into the nitty-gitty of low level methods, anyway). Try to keep old log files by renaming them when your app starts.
Going to take a while, I'm afraid - but there isn't a lot else you can do until you know roughly what area it is crashing in.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Those kinds of errors typically happen in non-UI portions of your code, otherwise you'd get the familiar 'Unhandled Exception' dialog with the continue or quit buttons.
If I were a betting sort, I'd look closely at how you're handling (and likely not) exceptions within portions of code where your SQL queries are run.
Sounds like some attempt(s) made to connect fail or abort, and then the code crashes due to the unhandled exception taking place (likely in another thread or class).
The madman is not the man who has lost his reason; the madman is the man who has lost everything except his reason.
--G.K. Chesterton
|
|
|
|
|
The only thing you can do in situations such as this, is to try and do some debugging to find out where it is hanging, and what circumstances are occurring at the time. What operations are the users doing, and what does that cause the application to do? Is it perhaps getting stuck accessing the network drive?
|
|
|
|
|
I have a GridView control with a few ButtonFields. What I want to achieve is to avoid the full post back when the user clicks one of these buttons. My idea is to use AsyncPostBackTrigger, but the problem is that it requires a ControlID and the ButtonField doesn't have an ID. I tried to add a regular Button to the Controls collection of the ButtonField, but it still doesn't invoke the RowCommand event.
|
|
|
|
|
Hi all,
I am looking at performing sentimental analysis on a group of files using C#. All files are reports about a student.
1) I wanted to know per student sentimental analysis score.
2) Who has the maximum positive score and maximum negative score
3) Lastly i want the files sentimental score shown in a graphical manner so that rather than going through excel and finding out score, we can have that displayed as some graphs or other means.
I just need the reference materials that i can go through to understand the concepts and doing the above
Thanks
|
|
|
|
|
What do you mean by sentimental analysis?
|
|
|
|
|
Richard MacCutchan wrote: sentimental analysis I suspect a troll, a subtle form of trollism.
Or he could be looking for the sentimental girls in the student body!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: a subtle form of trollism. Is that like troillism, but you do it on your own?
|
|
|
|
|
Be careful, Mycroft, someone could mistake that for the paraphilia troilism.
«If you search in Google for 'no-one ever got fired for buying IBM:' the top-hit is the Wikipedia article on 'Fear, uncertainty and doubt'» What does that tell you about sanity in these times?
|
|
|
|
|
I had to look that up, strange object huh!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Welcome to CodeProject. The problem I, and, I believe many people here, will have with your question is that is very general.
You have a group of files: what format are those files in ? What do you think is involved in getting the data you want to analyze out of those files ?
It would be helpful if you said more about what "sentimental analysis" means: for all we know it could be directly related to content in the files, or very indirectly related so that it would require almost "artificial intelligence" to analyze, and calculate a "score."
Charting and graphing ideas are easy to come by if we know what the data is, and how you want to display it.
«If you search in Google for 'no-one ever got fired for buying IBM:' the top-hit is the Wikipedia article on 'Fear, uncertainty and doubt'» What does that tell you about sanity in these times?
|
|
|
|
|
which person can tell me whether the method I used is correct? If not, please tell me what I should do.
i write a code that can convert cross table to vertical table
cross table :
=====================
Name,Sex,City
=====================
jason,male,hk
---------------------
vivia,Female,dk
---------------------
vertical table
=====================
Name,jason,vivia
=====================
Sex,male,Female
---------------------
City,hk,dk
---------------------
public static DataTable ConvertDataTable(DataTable source)
{
try
{
DataTable _dtResult = new DataTable(source.TableName, source.Namespace);
for (int i = 0; i < source.Columns.Count; i++)
{
List<string> _lstItems = new List<string>();
if (i == 0)
{
_dtResult.Columns.Add(source.Columns[i].ColumnName);
}
else
{
_lstItems.Add(source.Columns[i].ColumnName);
}
for (int ii = 0; ii < source.Rows.Count; ii++)
{
if (i == 0)
{
_dtResult.Columns.Add(source.Rows[ii][i].ToString());
}
else
{
_lstItems.Add(source.Rows[ii][i].ToString());
}
}
if (_lstItems.Count > 0)
{
_dtResult.Rows.Add(_lstItems.ToArray());
}
}
return _dtResult;
}
catch
{
return source;
}
}
|
|
|
|
|
What results do you expect, and what do you actually get?
|
|
|
|
|
I have a Grid inside another Grid, both Binded to a Model, the Parent Grid works well, but the child Grid Binding doesn't, I can't find the error, this is the object:
<pre lang="c#">using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace SAE_Connector
{
[XmlRoot("Configuracion")]
public class clsConfig
{
[XmlElement]
public Config config { get; set; }
[XmlArrayItem]
public List<PrePoliza> PrePolizas { get; set; }
public clsConfig()
{
config = new Config();
PrePolizas = new List<PrePoliza>();
}
}
public class Config
{
[XmlAttribute]
public string RutaDB { get; set; }
public Config()
{
Impuestos = new clsImpuestos();
}
private string _numEmp = "";
[XmlAttribute]
public string NumEmp
{
get
{
return NumeroEmpresaGet();
}
set
{
_numEmp = NumEmp;
}
}
[XmlAttribute]
public string InstanciaCompacSQL { get; set; }
[XmlAttribute]
public string EmpresaContPAQ { get; set; }
[XmlAttribute]
public string PassWord { get; set; }
[XmlElement("Impuestos")]
public clsImpuestos Impuestos { get; set; }
private string NumeroEmpresaGet()
{
string _result = "";
string _emp = string.IsNullOrEmpty(RutaDB) == false ? Path.GetFileNameWithoutExtension(RutaDB) : string.Empty;
if(string.IsNullOrEmpty(_emp)==false)
{
_result = _emp.Substring(_emp.Length - 2);
}
return _result;
}
}
#region impuestos
public class clsImpuestos
{
[XmlElement("Impuesto1")]
public clsImpuesto1 impuesto1 { get; set; }
[XmlElement("Impuesto2")]
public clsImpuesto2 impuesto2 { get; set; }
[XmlElement("Impuesto3")]
public clsImpuesto3 impuesto3 { get; set; }
[XmlElement("Impuesto4")]
public clsImpuesto4 impuesto4 { get; set; }
public clsImpuestos()
{
impuesto1 = new clsImpuesto1();
impuesto2 = new clsImpuesto2();
impuesto3 = new clsImpuesto3();
impuesto4 = new clsImpuesto4();
}
}
public class clsImpuesto1
{
[XmlAttribute]
public string Nombre { get; set; }
[XmlAttribute]
public double Tasa { get; set; }
}
public class clsImpuesto2
{
[XmlAttribute]
public string Nombre { get; set; }
[XmlAttribute]
public double Tasa { get; set; }
}
public class clsImpuesto3
{
[XmlAttribute]
public string Nombre { get; set; }
[XmlAttribute]
public double Tasa { get; set; }
}
public class clsImpuesto4
{
[XmlAttribute]
public string Nombre { get; set; }
[XmlAttribute]
public double Tasa { get; set; }
}
#endregion
public enum eTipoPol { Ingresos, Egresos, Diario }
public class PrePoliza
{
[XmlAttribute]
public int Id { get; set; }
[XmlAttribute]
public eTipoPol tipoPol { get; set; }
[XmlAttribute]
public string Nombre { get; set; }
[XmlAttribute]
public string Concepto { get; set; }
[XmlArrayItem]
public List<Cuenta> Cuentas { get; set; }
public enum eCargoAbono { Cargo, Abono }
public enum eProporcion { SubTotal, Impuesto1, Impuesto2, Impuesto3, Impuesto4, Total }
public enum eReferenciaConcepto { Vacio, Observaciones, Folio, Texto }
public PrePoliza()
{
Cuentas = new List<Cuenta>();
}
public class Cuenta
{
[XmlAttribute]
public int Id { get; set; }
[XmlAttribute]
public string CuentaCod { get; set; }
[XmlAttribute]
public string Descripcion { get; set; }
[XmlAttribute]
public bool EsCuentaCte { get; set; }
[XmlAttribute]
public eCargoAbono CargoAbono { get; set; }
[XmlAttribute]
public eProporcion Proporcion { get; set; }
[XmlAttribute]
public eReferenciaConcepto Referencia { get; set; }
[XmlAttribute]
public string RefText { get; set; }
[XmlAttribute]
public eReferenciaConcepto Concepto { get; set; }
[XmlAttribute]
public string ConcText { get; set; }
}
}
}
This is the complete XAML
<pre lang="c#"><Window x:Class="wpfSaePolizas.xWindows.wPrePolizas"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Pre-Polizas" Height="600" Width="1000" Background="{StaticResource brBlue}" WindowState="Maximized" Loaded="Window_Loaded" >
<Grid>
<Grid.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource xTextBlockWhiteS}" >
<Setter Property="FontWeight" Value="Normal" />
</Style>
<Style TargetType="TextBox">
<Setter Property="Template" Value="{StaticResource TextBoxRoundCorners}" />
</Style>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderThickness="2" BorderBrush="{StaticResource brBorder}" Margin="5" >
<Border.Resources>
<Style TargetType="StackPanel" >
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style TargetType="Image">
<Setter Property="Height" Value="20" />
</Style>
</Border.Resources>
<ToolBar Margin="5" Background="Transparent">
<Button Name="btnNva" Background="#FFFFD801" Width="90" Height="30" Click="btnNva_Click" >
<Button.Content>
<StackPanel>
<Image Source="..\img\Add1.png" />
<TextBlock Text="Nueva" />
</StackPanel>
</Button.Content>
</Button>
<Button Name="btnEliminar" Background="#FFFFD801" Width="90" Height="30" Click="btnEliminar_Click" >
<Button.Content>
<StackPanel>
<Image Source="..\img\Del.png" />
<TextBlock Text="Eliminar" />
</StackPanel>
</Button.Content>
</Button>
<Button Name="btnGuardar" Background="#FFFFD801" Width="90" Height="30" Click="btnGuardar_Click" >
<Button.Content>
<StackPanel>
<Image Source="..\img\Save.png" />
<TextBlock Text="Guardar" />
</StackPanel>
</Button.Content>
</Button>
<Button Name="btnSalir" Background="{StaticResource gradGris}" Width="90" Height="30" Click="btnSalir_Click">
<Button.Content>
<StackPanel>
<TextBlock Text="Salir" />
</StackPanel>
</Button.Content>
</Button>
</ToolBar>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DataGrid Name="dgCuentas" Grid.Column="1" Background="Transparent" AutoGenerateColumns="True" ></DataGrid>
<Border Name="brConfig" Grid.Column="0" BorderThickness="2" BorderBrush="{StaticResource brBorder}" Margin="5" >
<Viewbox VerticalAlignment="Top" Margin="5">
<Grid Name="gridPrePoliza">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="Pre-Póliza:" Grid.Row="0" Grid.Column="0" />
<ComboBox Name="cmbPrePolizas" Grid.Row="0" Grid.Column="1" Margin="5" SelectionChanged="cmbPrePolizas_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Nombre}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Text="Nombre:" Grid.Row="1" Grid.Column="0" />
<TextBox Name="txtNombre" Grid.Row="1" Grid.Column="1" Text="{Binding Nombre, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="Tipo de Póliza:" Grid.Row="2" Grid.Column="0" />
<ComboBox Name="cmbTiposPoliza" Grid.Row="2" Grid.Column="1" Margin="5" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding }" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Text="Concepto Póliza:" Grid.Row="3" Grid.Column="0" />
<TextBox Name="txtConceptoPol" Grid.Row="3" Grid.Column="1" Text="{Binding Concepto, UpdateSourceTrigger=PropertyChanged}" />
<Grid Name="gridCuenta" Grid.Row="4" Grid.ColumnSpan="2" Margin="0, 20" IsEnabled="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="Cuenta:" Grid.Row="0" Grid.Column="0" />
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
<TextBox Name="Cuenta" Width="157" Text="{Binding Path=CuentaCod, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" TextChanged="Cuenta_TextChanged"/>
<Button Name="btnCuentaBuscar" Content="..." Style="{StaticResource MetroButton}" Width="35" Click="btnCuentaBuscar_Click" Margin="0,0,0,3" VerticalAlignment="Bottom" />
</StackPanel>
<TextBlock Name="lblCuentaNombre" Text="{Binding Path=Descripcion, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Grid.Row="1" Grid.ColumnSpan="2" TextWrapping="Wrap" HorizontalAlignment="Center" />
<CheckBox Name="chbEsCteProv" Grid.Row="2" Grid.ColumnSpan="2">
<CheckBox.Content>
<TextBlock Text="Es Cuenta de Cliente/Proveedor" />
</CheckBox.Content>
</CheckBox>
<TextBlock Text="Cargo/Abono:" Grid.Row="3" Grid.Column="0" />
<ComboBox Name="cmbCargoAbono" Grid.Row="3" Grid.Column="1" Margin="5" SelectionChanged="cmbCargoAbono_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Text="Proporción:" Grid.Row="4" Grid.Column="0" />
<ComboBox Name="cmbProporcion" Grid.Row="4" Grid.Column="1" Margin="5" SelectionChanged="cmbProporcion_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Text="Referencia:" Grid.Row="5" Grid.Column="0" />
<ComboBox Name="cmbRefer" Grid.Row="5" Grid.Column="1" Margin="5" SelectionChanged="cmbRefer_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBox Name="txtRefer" Grid.Row="6" Grid.ColumnSpan="2" IsEnabled="False"
Text="{Binding Path=RefText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
<TextBlock Text="Concepto:" Grid.Row="7" Grid.Column="0" />
<ComboBox Name="cmbConcepto" Grid.Row="7" Grid.Column="1" Margin="5" SelectionChanged="cmbConcepto_SelectionChanged" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBox Name="txtConcepto" Grid.Row="8" Grid.ColumnSpan="2" IsEnabled="False"
Text="{Binding Path=ConcText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Grid>
<Border Name="brCtasBotones" Grid.Row="5" Grid.ColumnSpan="2" BorderThickness="2" BorderBrush="{StaticResource brBorder}"
Padding="5" CornerRadius="5">
<StackPanel Name="stackBotones" Orientation="Horizontal" HorizontalAlignment="Center" IsEnabled="False" >
<Button Name="btnNvaCta" Background="#FFFFD801" Width="80" Height="30" Grid.Row="4" Click="btnNvaCta_Click" >
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="..\img\Nvo.png" Width="18" />
<TextBlock Text="Nueva" />
</StackPanel>
</Button.Content>
</Button>
<Button Name="btnEliminarCta" Background="#FFFFD801" Width="80" Height="30" Grid.Row="4" Click="btnEliminarCta_Click" >
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="..\img\Del.png" Width="18" />
<TextBlock Text="Borrar" />
</StackPanel>
</Button.Content>
</Button>
<Button Name="btnGuardarCta" Background="#FFFFD801" Width="80" Height="30" Grid.Row="4" Click="btnGuardarCta_Click" >
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="..\img\Save.png" Width="18" />
<TextBlock Text="Guardar" />
</StackPanel>
</Button.Content>
</Button>
</StackPanel>
</Border>
</Grid>
</Viewbox>
</Border>
</Grid>
</Grid>
This is for setting DataContext to Child Grid
PrePoliza.Cuenta _cta = new PrePoliza.Cuenta();
gridCuenta.DataContext = _cta;
And this is for setting DataContext to DataGrid
dgCuentas.ItemsSource = _prepoliza.Cuentas;
This is the Window of the UI:
http://postimg.org/image/ik94x4iwd/
|
|
|
|
|
|
I need to implement a mechanism that will display the latest or newly record entry from a SQL database on a silverlight application. I used a mousemove event plus a timer to send a query to the database, but it is too expensive and I think it can be done in more efficient way. Thanks suggestions or pointers? Thanks
|
|
|
|
|
The timer I can understand but why the mouse move?
I use a timer and a counter, lets the user know when the next refresh is due and does the refresh. The duration of the counter can be set by the admin.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|