|
Did you even look at the link I put above?
This space for rent
|
|
|
|
|
I saw the link.I dont have a problems how to code huffman .I aldready coded but ı didnt comrpess image.Can this huffman code compress an image ?
|
|
|
|
|
You obviously didn't read the link. It's encoding images.
This space for rent
|
|
|
|
|
I aldready created huffman code just ı want to learn why my codes compress only text.Can ı use your codes?
|
|
|
|
|
What do you mean with "cannot compress image"? What kind of image? How large, how many colors?
Something like a jpg would already be compressed, so I would not be surprised if it does not actually compress much there.
If you have a bitmap with large repeating spaces, then huff may puff a few bits of it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
As Eddy has already said: most images are already compressed, and pretty solidly. Compressing compressed data rarely achieves significant result, and often increases the size of the output file, due to the overhead the compression algorithm has to add.
And if you think anyone is going to download your whole project just to tell you that again, you need to rethink your position in the world - it's not as high as you seem to believe...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Rıza Berkay Ayçelebi wrote: I can comrpess text wiht this program but how can ı compres picture ? You compress pictures in the same way as text.
The computer does not distinguish between text and pictures on that level. You may be interested in the Wikipedia articles that explain how JPEG works, since it is a different approach to achieve a similar endresult.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
In my current project, I need to do some calculations in 3d space, like calculating intersection points of lines with planes, determining if a point is inside a triangle / rectangle / (flat) polygone etc.
The Systems.Windows.Media.Media3D namespace offers some functionality for those purposes like cross and dot products of 3d vectors. Sadly, I cannot find good tutorials on the functionality of that namespace - most tutorials deal with drawing which is not relevant for me. And many Google searches point to functionality of the Xna namespace - which seems unavailable on Windows 8 / 10.
Are there other "common" namespaces in the .Net framework for such calculations?
Or do you know good tutorials for calculations with Media3d?
|
|
|
|
|
You might want to look at Math.NET[^] - particularly Math.NET Spatial[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks. That looks great. I will delve into it.
|
|
|
|
|
In C#, suppose you have the variable dt type DataTable and a loaded list of employees for variable dt, the question of his possible save data directly from the variable dt down Table data access in 2000, ie not using the loop to add new users each data record access, no other way to save the quicker this way ? in SQL Server have command in order SqlBulkCopy so Access2000 command similar this?
|
|
|
|
|
Access does not support Bulk operations.
You can use a OleDataAdapter to manage saving the changes to the DataTable back to the database, but it's also going to do it one row at a time.
|
|
|
|
|
I want to make program in C# that shows system information of PC.How can I get all this information for PC like: OS version,cpu info,cpu temperature....
https://postimg.org/image/4pyh4xbwl/
https://postimg.org/image/u5t2epylb/
https://postimg.org/image/5dtg7hhen/
https://postimg.org/image/yhho3q5i7/
https://postimg.org/image/cwclg48rj/
https://postimg.org/image/79g8in68v/
https://postimg.org/image/cywh2ycf3/
https://postimg.org/image/jdvhzmj4v/
https://postimg.org/image/hncgy51lr/
https://postimg.org/image/6p17fyd0f/
https://postimg.org/image/5b9kkndr3/
|
|
|
|
|
|
Use WMI to get the information
In your class define following const
const string WMI_SCOPE = "root\\CIMV2";
const string WMI_CLS_Win32_ComputerSystem = "Win32_ComputerSystem";
const string WMI_CLS_Win32_OperatingSystem = "Win32_OperatingSystem";
const string WMI_CLS_Win32_VideoController = "Win32_VideoController";
const string WMI_CLS_Win32_Processor = "Win32_Processor";
try
{
string sQuery = string.Format("SELECT * FROM {0}", WMI_CLS_Win32_OperatingSystem);
ObjectQuery objectQuery = new ObjectQuery(sQuery);
ManagementScope managementScope = new ManagementScope(WMI_SCOPE);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(managementScope, objectQuery);
ManagementOperationObserver results = new ManagementOperationObserver();
results.ObjectReady += new ObjectReadyEventHandler(ManagementObjectResultReady);
results.Completed += new CompletedEventHandler(ManagementObjectResultCompleted);
searcher.Get(results);
}
catch (....)
You will get wmi results in ManagementObjectResultReady event handler. Hope this helps.
|
|
|
|
|
I have a class like so:
public class BaseRef
{
public int id {get; set;}
public string listID {get; set;}
public string Name {get; set;}
}
And have a data column that is of type BaseRef that I added to a DataTable:
this.Columns.Add(new DataColumn("ParentRef", typeof(BaseRef)));
I am using OdbcDataAdapter to get a query, but in this case my query has three separate columns for the id, listID and Name fields of the Parent:
SELECT id, listID, Name FROM ParentTable
I tried to setup a DataAdapterTableMapping and add ColumnMappings, but it doesn't appear that I can map a source column to a property of a class column. I tried:
mapping.ColumnMappings.Add("id", "ParentRef.id");
mapping.ColumnMappings.Add("listID", "ParentRef.listID");
mapping.ColumnMappings.Add("Name", "ParentRef.Name");
Is there a way to get the mapping to map to the properties of my class?
|
|
|
|
|
I don't think that's possible. The DataAdapter wasn't designed to load columns to/from nested classes.
You'd probably have better luck using Dapper[^] instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I am trying to use Entity Framework Code First, when I am trying to create a table on the already existing database I'm getting the following error: Invalid object name 'etl.PDFBlob'.
Here I am trying to create my Table on the etl schema not on the dbo, I'm not sure what am I missing in this code.
Thanks.
public partial class FileWatcherEntities : DbContext
{
public FileWatcherEntities()
: base(WatcherDB.GetConnectionStringForEnvironment())
{
}
public virtual DbSet<DtsConnection> DtsConnections { get; set; }
public virtual DbSet<DtsVariable> DtsVariables { get; set; }
public virtual DbSet<ErrorLog> ErrorLogs { get; set; }
public virtual DbSet<FileWatcherLog> FileWatcherLogs { get; set; }
public virtual DbSet<ImportedDBDetails_NotUsed> ImportedDBDetails_NotUsed { get; set; }
public virtual DbSet<ImportedSourceDetail> ImportedSourceDetails { get; set; }
public virtual DbSet<PDFBlob> PDFBlobs { get; set; }
public virtual DbSet<PriorityLookup> PriorityLookups { get; set; }
public virtual DbSet<SSIS_Configuration> SSIS_Configurations { get; set; }
public virtual DbSet<ImportMetaData> ImportMetaDatas { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<ErrorLog>()
.Property(e => e.ApplicationName)
.IsUnicode(false);
modelBuilder.Entity<ErrorLog>()
.Property(e => e.Version)
.IsUnicode(false);
modelBuilder.Entity<ErrorLog>()
.Property(e => e.DateTS)
.HasPrecision(2);
modelBuilder.Entity<ErrorLog>()
.Property(e => e.AppUsername)
.IsUnicode(false);
modelBuilder.Entity<PDFBlob>()
.Property(e => e.FileName)
.IsUnicode(false);
var config = modelBuilder.Entity<PDFBlob>().ToTable("PDFBlob", schemaName: "etl");
modelBuilder.Entity<PDFBlob>().HasKey(x => x.Id);
}
}
Here is my Entity Class
[Table("PDFBlob", Schema = "etl")]
public partial class PDFBlob
{
public long Id { get; set; }
[Required]
[StringLength(8000)]
public string FileName { get; set; }
[Required]
public byte[] Content { get; set; }
public long Size { get; set; }
}
And here is how I am trying to access it and its failing at context.SaveChanges method
private static long WritePdfFile(string path)
{
var fInfo = new FileInfo(path);
while (IsFileLocked(fInfo))
Thread.Sleep(500);
var byts = File.ReadAllBytes(path);
using (var context = new FileWatcherEntities())
{
var blb = context.PDFBlobs.Add(new PDFBlob
{
Content = byts,
FileName = Path.GetFileName(path),
Size = byts.Length
});
context.SaveChanges();
return blb.Id;
}
return 0;
}
I have been trying to search online, changing the code and trying to solve in all possible ways, any help is going to be much appreciated.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote: Invalid object name 'etl.PDFBlob'.
That error means that the EF configuration is working - it's trying to query the table in the etl schema - but either the table doesn't exist, or the user you're connecting as doesn't have permission to access it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am trying Code First approach hence if the table doesn't exist it should create one if table exists it can update the data into it. Can you give me some idea why is it throwing me exception instead of creating a table?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
You said you're using an existing database. In which case, EF will not create or modify the database.
If you want EF to create the database, then you have to let EF create the whole database.
Entity Framework Code First Migrations[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
indian143 wrote: var config = modelBuilder.Entity<PDFBlob>().ToTable("PDFBlob", schemaName: "etl");
I think it should be this...
modelBuilder.Entity<ClassName>().ToTable("TableName", "SchemaName");
|
|
|
|
|
Yeah I tried as you said but still its giving me the following Exception my friend.
Here is the Exception:
An unhandled exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll
I tried in the following way:
modelBuilder.Entity<PDFBlob>().ToTable("PDFBlob", "etl");
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi,
I am building an application which does work of Active Directory object creation and update. I need to remove mailbox associated with a domain id without deleting the AD object?
Any inputs will be appreciated.
Regards,
Anchal
|
|
|
|