|
It makes sense when you think of the pixel density on some of the cameras now.
The uncompressed file size from this beast: Canon 120MP DSLR Shows Off its Stuff at Canon Expo[^] doesn't bear thinking about! (Nor does it's price, I suspect)
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: "runs" of identical data - binary data such as an image does not generally exhibit this, except in unusual circumstances. Draw a bitmap in paint, 300x300 pixels. Make all pixels black.
The problem is that someone is trying to compress data that is already compressed.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
That's one of the unusual circumstances, yes!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Rıza Berkay Ayçelebi wrote: This algorithms are text based. What is your definition of "text based" ?
- As far as I know, Huffman and RLE can compress any kind of file.
- Rule of thumb: Nobody compress a compressed file because the compression algorithm become inefficient and the resulting file is bigger.
- I didn't check lately, but .bmp files were not compressed in early days of windows.
- RLE is efficient only with special kind of data that show very long runs of same values (like with fax).
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
modified 22-Nov-16 17:40pm.
|
|
|
|
|
Dear all
I create a method to play mp3 base on Text input. I create a playlist and import it to player. but the problem is that, the player plays only 3 files. (and i debugged and found that attributeCount always=3).
Please help for this case.
Below is my code:
private void PlayMP3()
{
try
{
string strLP = this.textBox1.Text.Trim();
string strPath = Application.StartupPath;
WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
WMPLib.IWMPPlaylist myplaylist = player.playlistCollection.newPlaylist("myplaylist");
myplaylist.clear();
foreach (char c in strLP)
{
string strFileName = "raw\\" + string.Concat(c, ".mp3");
string strFileLocation = Path.Combine(strPath, strFileName);
WMPLib.IWMPMedia media = player.newMedia(strFileLocation);
myplaylist.appendItem(media);
}
player.playlistCollection.importPlaylist(myplaylist);
player.currentPlaylist = myplaylist;
player.controls.play();
}
catch (Exception ex)
{
throw ex;
}
}
|
|
|
|
|
There can be many reasons for that, first one being that the player is initialized with only 3 tracks, or can run only three — i.e. filtered results. What is your playlist size? That controls how many tracks to play.
Using the Windows Media Player Control with Microsoft Visual Studio (Windows)[^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thanks Afzaal Ahmad Zeeshan!
my playlist size is more than 3 (often 10). and I user WMPLib. I'm trying to find out the problem but still not find!!!
|
|
|
|
|
Can you try and pass the songs, instead of passing the songs playlist to see if that works.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Are you using a trial version of a library with a hard (trial) limit? Seen this sort of behaviour before, along with only playing the first few seconds of a track
C# has already designed away most of the tedium of C++.
|
|
|
|
|
I am using a hyperlink in a datagrid. When clicked I want to open the file with Process.Start:
private void DG_Hyperlink_Click(object sender, RoutedEventArgs e)
{
Hyperlink link = (Hyperlink)e.OriginalSource;
var fileName = link.NavigateUri.AbsolutePath;
fileName = fileName.Replace("file:///", "");
fileName = Uri.UnescapeDataString(fileName);
Process.Start("notepad.exe", fileName);
}
For local files this works fine. With network files the path is different:
/n/folder/folder/folder/thefile.txt
The file is on the N: share. The path is somehow formatted to start with 'n/'.
What's wrong here?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'd start by looking at your original unmodified share path - if it is in the form /n/folder... or even file:///n/folder/... but it should be on the N: drive instead of the N folder of the current drive root then it's wrong: it doesn't specify a drive at all, and that probably needs looking at rather than "bodging around" to get it working.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Replace the : in the path with a pipe | :
file:
|
|
|
|
|
Try something like:
Hyperlink link = (Hyperlink)e.OriginalSource;
Uri path = link.NavigateUri;
string fileName = path.IsFile ? path.LocalPath : path.AbsoluteUri;
Process.Start("notepad.exe", fileName);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That did it. Thanks!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I've got this chuck of code. It looks for different phrases in a line of text being read from a file, then extracts the data at the end and stores it to various properties. The data will be either an IN RANGE or OUT OF RANGE message:
"Denature 1 RTD in range. Reading: 9.64241027832031"
or
"Detection 2 RTD out of range. Reading: 510"
I have 5 different properties that need to be set from the data. I would like to make this into a method call but how would you pass in the property?
The first word of the line determines which property to be set.
var index = line.IndexOf("Denature 1 RTD in range. Reading:");
if (index > -1)
{
var data = line.Substring(index + 33);
((RTDTestModel)model).Denature1ActualValue = Convert.ToDouble(data);
}
index = line.IndexOf("Denature 1 RTD out of range. Reading:");
if (index > -1)
{
var data = line.Substring(index + 37);
((RTDTestModel)model).Denature1ActualValue = Convert.ToDouble(data);
}
index = line.IndexOf("Extension 2 RTD in range. Reading:");
if (index > -1)
{
var data = line.Substring(index + 34);
((RTDTestModel)model).Extension2ActualValue = Convert.ToDouble(data);
}
index = line.IndexOf("Extension 2 RTD out range. Reading:");
if (index > -1)
{
var data = line.Substring(index + 38);
((RTDTestModel)model).Extension2ActualValue = Convert.ToDouble(data);
}
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Something like this:
private List<string> terms = new List<string>();
terms.Add("Extension 2 RTD out range. Reading:");
terms.Add("Denature 1 RTD in range. Reading:");
terms.Add("Denature 1 RTD out of range. Reading:");
foreach (string term in terms)
{
if (Parse(term))
{
break;
}
}
private bool Parse(string text)
{
int index = line.IndexOf(text);
if (index > -1)
{
string data = line.Subsctring(index + text.Length);
double value;
if (double.TryParse(data, out value))
{
((RTDTestModel)model).Extension2ActualValue = value;
}
}
}
This space for rent
|
|
|
|
|
Ya, but the problem is that there is a different property to set for each term
For example, for "Extension" there are two properties, Extension1, and Extension2. Same for Denature, Sample, Anneal, Detection, etc...
The structure of the file is the same for each setting. There are just different settings whose values need to be captured to various properties on the model.
A generic property reference would be nice. Something like:
void MyMethod(string term, T TheProperty)
{
.
.
.
}
where the property is passed as in
MyMethod("Anneal1", model.Anneal1);
MyMethod("Anneal2", model.Anneal2);
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
model.GetType().GetProperty( name ).SetValue( model, value );
|
|
|
|
|
Perfect.. Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
hello,
i really need help, i have created a dynamic datagridview, which the number of rows i write it in a xml file. When i save it for first time, in the xml file write the correct number of rows but when i save it again the "new" xml file write zero rows! i can understand why. i try to use datatable and dataset but nothing the problem is that datagridview hasnt rows.
Please some idies?
Thank you
public Form1(int cntC, int cntL)
{
InitializeComponent();
Create_dGV(cntC, cntL);
}
private void Create_dGV(int cnt, int cnt2)
{
for (int i = 0; i < cnt; i++)
{
CmbBx();
}
for (int i = dGV.RowCount; i < cnt2; i++)
{
dGV.Rows.Add();
}
for (int i = 0; i < dGV.Rows.Count; i++)
{
dGV.DefaultCellStyle.NullValue = " ";
dGV.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
}
dGV.AllowUserToAddRows = false;
}
private void CmbBx()
{
DataGridViewComboBoxColumn CmbBx = new DataGridViewComboBoxColumn();
List<string> data = new List<string>();
data.Add("0");
data.Add("3");
data.Add("5");
data.Add("9");
CmbBx.DataSource = data;
CmbBx.Width = 120;
CmbBx.FlatStyle = FlatStyle.Flat;
dGV.Columns.Add(CmbBx);
}
private void SaveBttn_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
{
for (int j = 0; j < dGV.ColumnCount; j++)
{
dt.Columns.Add((j).ToString(), typeof(String));
}
for (int i = 0; i < dGV.RowCount; i++)
{
DataRow d = new DataRow();
d = dt.NewRow();
for (int j = 0; j < dGV.ColumnCount; j++)
{
d[j] = dGV.Rows[i].Cells[j].Value;
}
dt.Rows.Add(d);
}
}
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.OmitXmlDeclaration = true;
settings.NewLineOnAttributes = true;
using (XmlWriter writer = XmlWriter.Create(name, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("dGV");
{
writer.WriteElementString("ColumnsCount", dt.Columns.Count.ToString());
writer.WriteElementString("RowsCount", dt.Rows.Count.ToString());
for (int i = 0; i < dt.Columns.Count; i++)
{
//string lttr= "a"+ i.ToString();
//writer.WriteStartElement(lttr);
//{
// for (int j = 0; j < dt.Rows.Count; j++)
// {
// lttr= "a"+ i.ToString()+ j.ToString();
// writer.WriteElementString(lttr, dt.Rows[j][i].ToString());
// }
//}
//writer.WriteEndElement();
}
}
writer.WriteEndElement();
writer.WriteEndDocument();
}
}
// other form
private void OpenBttn_Click(object sender, EventArgs e)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(name);
int C, R;
string hlps, hlps2;
hlps = xDoc.SelectSingleNode("dGV / ColumnsCount").InnerText;
C = Int32.Parse(hlps);
hlps = xDoc.SelectSingleNode("dGV / RowssCount").InnerText;
R = Int32.Parse(hlps);
Form1 f = new Form1(C, R);
}
}
}
modified 18-Nov-16 4:54am.
|
|
|
|
|
Yeah, there is no way anyone is going to be able to answer this because we can't see your code. Modify your question and post the relevant code that saves your data to the XML file.
Member 12856910 wrote: i try to use datatable and dataset but nothing the problem is that datagridview hasnt rows.
This last sentence didn't make any sense at all.
|
|
|
|
|
Hi,
I'm mostly asp.net/services soa/ server code .. I'm have done Win Form apps but installations is not something I have much XP with ..
Question : I have a config file and an encrypted file that I need to write during installation. The directory I was going to use is commonappdata(ProgramData) directory. I was just wondering if this is typical or has everyone found something better for reasons unknown to me .. Win7+
Thanks
Jon
|
|
|
|
|
I'd use the special folders: Where should I store my data?[^] - combining the standard "writable" folders with a GUID based app id for your installed app makes it easy for you, but harder for the user to find. Which is probably a good idea if you are writing an encrypted file as some kind of licence.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
hello sir I m Ramesh .net fresher I want to develop a desktop software in accounting software using c# . how to do this task please help me sir
|
|
|
|