Skip to main content

Home/ Computer Science Knowledge Sharing/ Group items tagged C#

Rss Feed Group items tagged

Abdelrahman Ogail

CodeProject: C# vs C/C++ Performance. Free source code and programming help - 0 views

  • is compiled twice. Once while the program is written and second when the program is executed at the user's site. The first compilation is done by your C# builder and the second by the .NET Framework on the user's machine. The reason why C# compiled applications could be faster is that, during the second compilation, the compiler knows the actual run-time environment and processor type and could generate instructions that targets a specific processor.
  • A well designed C# program is more than 90% as fast as an equivalent "well-designed" C++ program
  • The problem with "not-freeing" the memory at the right time is that the working set of the application increases which increases the number of "page faults"
  • ...1 more annotation...
  • That's a nice question. Except for writing time-critical blocks of code, prefer C#. Write all your algorithmic code in C++ (not VC++ .NET), compile it into a dll and call that using a Dll Interop through C#. This should balance the performance. This technique is not new or not invented by me or anyone. It's similar the old age C programming vs Assembly, where people on one camp fight assembly programming is faster and the other camp stating C is easier to develop and then people started using assembly embedded within a C program for time-critical applications using an asm block.
  •  
    C# is compiled twice. Once while the program is written and second when the program is executed at the user's site. The first compilation is done by your C# builder and the second by the .NET Framework on the user's machine. The reason why C# compiled applications could be faster is that, during the second compilation, the compiler knows the actual run-time environment and processor type and could generate instructions that targets a specific processor
Abdelrahman Ogail

Simulated annealing - Wikipedia, the free encyclopedia - 1 views

  • Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics, namely locating a good approximation to the global minimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more effective than exhaustive enumeration — provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. By analogy with this physical process, each step of the SA algorithm replaces the current solution by a random "nearby" solution, chosen with a probability that depends on the difference between the corresponding function values and on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the current solution changes almost randomly when T is large, but increasingly "downhill" as T goes to zero. The allowance for "uphill" moves saves the method from becoming stuck at local minima—which are the bane of greedier methods. The method was independently described by S. Kirkpatrick, C. D. Gelatt and M. P. Vecchi in 1983 [1], and by V. Černý in 1985 [2]. The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by N. Metropolis et al. in 1953 [3].
  • Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics, namely locating a good approximation to the global minimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more effective than exhaustive enumeration — provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. By analogy with this physical process, each step of the SA algorithm replaces the current solution by a random "nearby" solution, chosen with a probability that depends on the difference between the corresponding function values and on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the current solution changes almost randomly when T is large, but increasingly "downhill" as T goes to zero. The allowance for "uphill" moves saves the method from becoming stuck at local minima—which are the bane of greedier methods. The method was independently described by S. Kirkpatrick, C. D. Gelatt and M. P. Vecchi in 1983 [1], and by V. Černý in 1985 [2]. The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by N. Metropolis et al. in 1953 [3].
  • Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics, namely locating a good approximation to the global minimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more effective than exhaustive enumeration — provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. By analogy with this physical process, each step of the SA algorithm replaces the current solution by a random "nearby" solution, chosen with a probability that depends on the difference between the corresponding function values and on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the current solution changes almost randomly when T is large, but increasingly "downhill" as T goes to zero. The allowance for "uphill" moves saves the method from becoming stuck at local minima—which are the bane of greedier methods. The method was independently described by S. Kirkpatrick, C. D. Gelatt and M. P. Vecchi in 1983 [1], and by V. Černý in 1985 [2]. The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by N. Metropolis et al. in 1953 [3].
  • ...1 more annotation...
  • Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics, namely locating a good approximation to the global minimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more effective than exhaustive enumeration — provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. By analogy with this physical process, each step of the SA algorithm replaces the current solution by a random "nearby" solution, chosen with a probability that depends on the difference between the corresponding function values and on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the current solution changes almost randomly when T is large, but increasingly "downhill" as T goes to zero. The allowance for "uphill" moves saves the method from becoming stuck at local minima—which are the bane of greedier methods. The method was independently described by S. Kirkpatrick, C. D. Gelatt and M. P. Vecchi in 1983 [1], and by V. Černý in 1985 [2]. The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by N. Metropolis et al. in 1953 [3].
  •  
    Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of applied mathematics, namely locating a good approximation to the global minimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more effective than exhaustive enumeration - provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one. By analogy with this physical process, each step of the SA algorithm replaces the current solution by a random "nearby" solution, chosen with a probability that depends on the difference between the corresponding function values and on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the current solution changes almost randomly when T is large, but increasingly "downhill" as T goes to zero. The allowance for "uphill" moves saves the method from becoming stuck at local minima-which are the bane of greedier methods. The method was independently described by S. Kirkpatrick, C. D. Gelatt and M. P. Vecchi in 1983 [1], and by V. Černý in 1985 [2]. The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by N. Metropolis et al. in 1953 [3].
  •  
    A natural AI approach
Abdelrahman Ogail

Mutation testing - Wikipedia, the free encyclopedia - 1 views

  • Mutation testing (or Mutation analysis) is a method of software testing, which involves modifying program's source code in small ways.[1] These, so-called mutations, are based on well-defined mutation operators that either mimic typical programming errors (such as using the wrong operator or variable name) or force the creation of valuable tests (such as driving each expression to zero). The purpose is to help the tester develop effective tests or locate weaknesses in the test data used for the program or in sections of the code that are seldom or never accessed during execution.
  • For example, consider the following C++ code fragment: if (a && b) c = 1; else c = 0; The condition mutation operator would replace '&&' with '||' and produce the following mutant: if (a || b) c = 1; else c = 0;
  • Many mutation operators can produce equivalent mutants. For example, consider the following code fragment: int index=0; while (...) { . . .; index++; if (index==10) break; } Boolean relation mutation operator will replace "==" with ">=" and produce the following mutant: int index=0; while (...) { . . .; index++; if (index>=10) break; }
Hassan Ibraheem

Const-Correctness in C++ - 0 views

  •  
    "While it is true that using the object-oriented features of C++ requires more thought (and hence, more opportunities to make mistakes), the language provides features that can help you create more robust and bug-free applications. One of these features is const, the use of which I will address in this article. "
fili el sayed

Introduction to Model View Control (MVC) Pattern using C# - 3 views

  • we need to figure out what the heck it is.
    • fili el sayed
       
      LOOOOOOOL, this is a good aproach to start analysis
Islam TeCNo

OpenGL - Wikipedia, the free encyclopedia - 0 views

shared by Islam TeCNo on 10 Jun 09 - Cached
  • OpenGL (Open Graphics Library) is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992[1] and is widely used in CAD, virtual reality, scientific visualization, information visualization, and flight simulation. It is also used in video games, where it competes with Direct3D on Microsoft Windows platforms (see Direct3D vs. OpenGL). OpenGL is managed by the non-profit technology consortium, the Khronos Group.
    • Mohamed Abd El Monem
       
      just some info about OGL :)
    • Islam TeCNo
       
      fe so2al bytra7 nafso !! ...ezaii el developers by3mlo API byshta3'l ma3 ay lo3'a !! ...ya3ni men el python OpenGL men el C++ OpenGL men el C# OpenGL!!
  • Mark Segal and Kurt Akeley authored the original OpenGL specification
    • Islam TeCNo
       
      2 Names to remember :D
    • Islam TeCNo
       
      LOL @ Book Names
  • ...2 more annotations...
  • (which actually has a white cover)
    • Islam TeCNo
       
      Realy LOL :D :D
  • The OpenGL standard allows individual vendors to provide additional functionality through extensions as new technology is created. Extensions may introduce new functions and new constants, and may relax or remove restrictions on existing OpenGL functions. Each vendor has an alphabetic abbreviation that is used in naming their new functions and constants. For example, NVIDIA's abbreviation (NV) is used in defining their proprietary function glCombinerParameterfvNV() and their constant GL_NORMAL_MAP_NV.
Abdelrahman Ogail

Common Mistakes in Online and Real-time Contests - 0 views

  • Dynamic programming problems are to be solved with tabular methods
    • Ahmed Mansour
       
      Dynamic programming, like the divide-and-conquer method, solves problems by combining the solutions to subproblems. ("Programming" in this context refers to a tabular method, not to writing computer code) y3ney 3bara 3n 2nene bn2sem el problem el kbirr le shwit probelsm so3'ira .. we ne solve el problems deh we ngma el yab2a dh 7l lel problem el kbira :D;d see introduction to algorithms book . chapter 15
  • breadth-first search
    • Ahmed Mansour
       
      In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root node and explores all the neighboring nodes. Then for each of those nearest nodes, it explores their unexplored neighbor nodes, and so on, until it finds the goal. ya3ney be el 3arby keda lw ana 3ndy tree maslan we el tree dh bettkwen mn shwit levels 3ady gedan.. lama hagey 23mel search 3la node mo3ina fi el tree deh hamsk el tree mn el root bet3ha ely hwa level 0 we habda2 2mshy level by level y3ney hanzl 3la el level 1 we hakaz le 3'it mal2y el node bet3ty ,,,, see this ,, it's a tutorial show how BFS algorithm is work!! http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/GraphAlgor/breadthSearch.htm
  • Memorize the value of pi You should always try to remember the value of pi as far as possible, 3.1415926535897932384626433832795, certainly the part in italics. The judges may not give the value in the question, and if you use values like 22/7 or 3.1416 or 3.142857, then it is very likely that some of the critical judge inputs will cause you to get the wrong answer. You can also get the value of pi as a compiler-defined constant or from the following code: Pi=2*acos(0)
    • Islam TeCNo
       
      hhhhhhhhhhh ...... awl mara a3rf el mawdo3 dah we awl mara a3raf en el Pi = 2*acos(0)
    • Abdelrahman Ogail
       
      Thanks Islam for the info, really useful
  • ...4 more annotations...
  • You cannot always check the equality of floating point numbers with the = = operator in C/C++. Logically their values may be same, but due to precision limit and rounding errors they may differ by some small amount and may be incorrectly deemed unequal by your program
  • #define swap(xxx, yyy) (xxx) ^= (yyy) ^= (xxx) ^= (yyy)
    • Islam TeCNo
       
      I remember someone told me that it's impossible to do swaping using macros :D ...but i think it's possible
  • But recursion should not be discounted completely, as some problems are very easy to solve recursively (DFS, backtracking)
    • Islam TeCNo
       
      Some problems are much easier when using recursion
  • Having a good understanding of probability is vital to being a good programmer
  •  
    for bignner acmers hoping to be useful !
  •  
    in this article the author discuss the common problems that faced teams in ACM contests .. and how to avoid it !
Islam TeCNo

Ternary relation - Wikipedia, the free encyclopedia - 0 views

  • n mathematics, a ternary relation or triadic relation is a finitary relation in which the number of places in the relation is three. Ternary relations may also be referred to as 3-adic, 3-ary, 3-dimensional, or 3-place. Just as a binary relation is formally defined as a set of pairs, i.e. a subset of the Cartesian product A × B of some sets A and B, so a ternary relation is a set of triples, forming a subset of the Cartesian product A × B × C of three sets A, B and C.
    • Abdelrahman Ogail
       
      Well known relation types is binary relation. Also ternary relation is a basic relation type
    • Islam TeCNo
       
      thanks zikas .... we bardo fe 7aga esmaha Ternary Search zaii ma fe binary search
Janos Haits

Arch Mission - 0 views

  •  
    'The Arch Mission Foundation™ is a 501(c)(3) tax-exempt non-profit corporation designed to continuously preserve and disseminate humanity's most important knowledge across time and space.'
Islam TeCNo

XML-RPC Home Page - 0 views

  • It's a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet. It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.
    • Islam TeCNo
       
      ya3ni a2dar men program C# maslan andah 3ala function PHP mawgoda 3ala server tani !! :D
  •  
    This is a protocol that is used to call functions over internet using HTTP protocol as the transport and XML as the encoding
Islam TeCNo

Assembly in .NET - 0 views

  • An assembly can be a single file or it may consist of the multiple files. In case of multi-file, there is one master module containing the manifest while other assemblies exist as non-manifest modules. A module in .NET is a sub part of a multi-file .NET assembly
  • The .NET assembly is the standard for components developed with the Microsoft.NET. Dot NET assemblies may or may not be executable, i.e., they might exist as the executable (.exe) file or dynamic link library (DLL) file. All the .NET assemblies contain the definition of types, versioning information for the type, meta-data, and manifest. The designers of .NET have worked a lot on the component (assembly) resolution.
    • Rock Fcis
       
      @ ISlam ma fel wiki katb aho kda The .NET assembly is the standard for components developed with the Microsoft.NET. Dot NET assemblies may or may not be executable, i.e., they might exist as the executable (.exe) file or dynamic link library (DLL) file.
  •  
    tb ana delwa2ty fhmt 2n el assembly 7agteen ya 2emma .Exe file 2w el Dll ft7t brdi fel wiki la2et 2n hoa by2ol 2n feh fel assembly ya 2emma single file or multi file 7d yfhmny eah asdo b single 2w multi hal ya3ni asdo 2n el dll feh mmkn kaza class w kda walla a
  •  
    ma3takdsh ya Rock eno y2sod bel DLL Multifile
Islam TeCNo

Inheritance and Interfaces - 0 views

  • object composition, which is often the best choice of all.
    • Abdelrahman Ogail
       
      In Software Engineering Design Patterns there's a rule that states: Favor Composition Over Inheritance
  • Familiarity with Microsoft Visual Basic 6.0
    • Islam TeCNo
       
      mafesh 7aga C# ?? lazem at3aml ya3ni !
1 - 15 of 15
Showing 20 items per page