[Solved] How can I still optimize the code?

You can slightly improve your code by removing queue, you don’t need this. The rest of the code looks algorithmically optimal. #include <map> #include <iostream> using namespace std; int main() { int a,b; map<int, int> AB; map<int, int>::iterator it; std::ios::sync_with_stdio(false); while (1) { cin >> a; if (a == -1)break; cin >> b; AB.insert(pair<int, int>(a, … Read more

[Solved] C# Help – Check file exists and update SQL table with result [closed]

if (File.Exists(“your file path”)) { // connect to database SqlConnection objSqlConnection=new SqlConnection(“server=127.0.0.1;uid=sa;pwd=;database=test”); objSqlConnection.Open(); try { SqlCommand sqlcom=new SqlCommand(“your update sql statement here,objSqlConnection); sqlcom.ExecuteNonQuery(); } catch (System.Exception ex) { } finally { objSqlConnection.Close(); } } 4 solved C# Help – Check file exists and update SQL table with result [closed]

[Solved] File copy only x file extension

Solved it! In the last methode: Copyall: foreach (FileInfo fi in source.GetFiles(“*.MP4”)) { fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true); total += (int)fi.Length; copied += (int)fi.Length; copied /= 1024; progressBar1.Step = copied; progressBar1.PerformStep(); label1.Text = (total / 1048576).ToString() + “MB van de ” + (maxbytes / 1024).ToString() + “MB gekopieĆ«rd”; label1.Refresh(); } solved File copy only x file extension

[Solved] Datetime does not contain definition for “ToTimeStamp”

The docs state here (see also here) that extension methods [need to be] defined inside a non-nested, non-generic static class so in order to make the code example work, we need to put the ToTimestamp method inside a static class. public static class DateTimeExtensions { private static readonly DateTime _jan1St1970 = new DateTime(1970, 1, 1, … Read more

[Solved] how to code “hello” == obj without overload the operator==? [closed]

Issue with: template <typename T> bool operator== (const String<T>& a, const String<T>& b ) is the deduction of T, and for “hello” == String<char>(“hello”), “hello” doesn’t match const String<T>&, so that overload is discarded. What you can do is to make it non template: template <typename T> class String { // non template function. friend … Read more

[Solved] Creating abstract ViewModels wpf

Ok, I found the glitch. Int the MainViewModel class, the TestViewModel property should be changed from: public IViewModel TestViewModel { get { return m_testViewModel; } set { m_testViewModel = value; OnPropertyChanged(“NewViewModel”); } } To: public IViewModel TestViewModel { get { return m_testViewModel; } set { m_testViewModel = value; OnPropertyChanged(“TestViewModel”); } } solved Creating abstract ViewModels … Read more

[Solved] Convert string into float in C++ with full Significant figures [Fixed working in Dev C++]

If you want to control the precision then include #include <iomanip> and use std::cout << std::setprecision(17); to set the number of digits you want. Also float has 6 significant bits precision whereas double has 12. So whenever your string has more than 6 digits in decimal there is a possibility of loosing the precision. 7 … Read more