Author Topic: Things that make you go "Hmmmmmmm...."  (Read 5950 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Things that make you go "Hmmmmmmm...."
« Reply #15 on: October 16, 2012, 04:32:32 PM »
I like it ... what a fun little piece of code.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

BlackBox

  • King Gator
  • Posts: 3770
Re: Things that make you go "Hmmmmmmm...."
« Reply #16 on: October 16, 2012, 04:41:07 PM »
I like it ... what a fun little piece of code.

Thanks Keith... Hopefully it is received in kind.

Besides, what's life without a bit a levity (and logic) every now and then?  :-)
"How we think determines what we do, and what we do determines what we get."

SGP2012

  • Guest
Re: Things that make you go "Hmmmmmmm...."
« Reply #17 on: October 17, 2012, 01:33:38 AM »
Yes Renderman - very cutting code, but it did make me smile (despite the jetlag) :laugh:. Based on your logic, I'm waiting for line 16 to execute.

I was hoping Tony would reply, but I'll follow up anyway with a very simple offer ...

- Tony complained to Jim about a problem in 2001. Jim immediately fixed it.
- Tony complained about a problem on this forum 3 weeks ago, which I only noticed this week because he had chosen not to contact the ADN team to make us aware of it. Once I was aware of the problem, I immediately fixed it.

Those actions (and help I've given to others on this forum in the past) demonstrate that if you make us aware of an issue then we fix it.  But we can only fix something if we know about it. So, Tony -

- If you have a problem with anything anyone in my team does in the future, then please email me and I will quickly take action to fix the problem.

(That offer obviously applies to everyone reading this post).

Conversely, if you complain about my team on this forum again, then I hope that someone who has been reading this thread will reply to ask "Have you emailed Stephen about this?".

Here's some pseudo-code to summarize that (with due credit to RenderMan, of course   ;-)) ...

Code: [Select]
if (you.WantTheProblemFixed) {
  you.Contact(stephen@autodesk);
  ProblemFixed = true;
}
else if (you.JustWantToBlowOffSteam) {
  you.Contact(noone@autodesk);
  you.EnjoyBlowingOffSteam();
  ProblemFixed = false;
}

Draftek

  • Guest
Re: Things that make you go "Hmmmmmmm...."
« Reply #18 on: October 17, 2012, 09:45:32 AM »
heh. Favorite Thread - EVER!

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Things that make you go "Hmmmmmmm...."
« Reply #19 on: October 17, 2012, 09:48:40 AM »
Stephen and Renderman,
 
Am I missing some dll's or what namespaces do I need to reference.
I tried both of your samples but could not get them to compile.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Things that make you go "Hmmmmmmm...."
« Reply #20 on: October 17, 2012, 09:52:30 AM »
Stephen and Renderman,
 
Am I missing some dll's or what namespaces do I need to reference.
I tried both of your samples but could not get them to compile.

Read the doc's Jeff  :angel:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Things that make you go "Hmmmmmmm...."
« Reply #21 on: October 17, 2012, 10:12:11 AM »
Stephen and Renderman,
 
Am I missing some dll's or what namespaces do I need to reference.
I tried both of your samples but could not get them to compile.

Read the doc's Jeff  :angel:
Actually I get more information from the methods name used than what is normally in docs

BlackBox

  • King Gator
  • Posts: 3770
Re: Things that make you go "Hmmmmmmm...."
« Reply #22 on: October 17, 2012, 12:28:25 PM »
Stephen and Renderman,
 
Am I missing some dll's or what namespaces do I need to reference.
I tried both of your samples but could not get them to compile.

Jeff -

Shucks... I'm awfully sorry for any confusion this may have caused you, or others.

In an effort to assist you in your request for the missing Namespace and assembly reference, starting with the latter, be sure to add a reference to Microsoft.CSharp in your project, and then add the following pseudo-code snippet (should be enough to get you going).

I truly hope this helps, as this is the best I could whip up in a few minutes (having never actually created a framework before)... Being relatively new to .NET, I am sure there's much room for improvement on my part. However, the assembly compiles fine for me, and successfully NETLOADs using Civil 3D 2011, and 2012.

Happy coding!  :-)

Code - C#: [Select]
  1. //
  2. // https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQRzgHBKFOgt1WhWupkoO8YeHzusIlxY5zclfyC74pwKvwpFSAF
  3. //
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Net.Mail;
  7.  
  8. using acApp = Autodesk.AutoCAD.ApplicationServices.Application;
  9. using devTech = Autodesk.DeveloperNetwork.Organization.DeveloperTechnicalServices;
  10.  
  11. namespace Autodesk
  12. {
  13.     internal class DeveloperNetwork
  14.     {
  15.         public static string Country(string key)
  16.         {
  17.             if (CountryCodes.ContainsKey(key))
  18.             {
  19.                 return CountryCodes[key];
  20.             }
  21.  
  22.             return "";
  23.         }
  24.  
  25.         internal class ADNMember
  26.         {
  27.             public static DateTime AutoDeskProductUserSince { get; set; }
  28.             public static string Biography { get; set; }
  29.             public static string Country { get; set; }
  30.             public static MailAddress EmailAddress { get; set; }
  31.             public static bool IsNotPresumptuous { get; set; }
  32.             public static string Title { get; set; }
  33.             public static string Membership { get; set; }
  34.             public static string Name { get; set; }
  35.             public static string Organization { get; set; }
  36.             public static string PrimaryField { get; set; }
  37.  
  38.             public Employee() { }
  39.  
  40.             public static void MightActuallyGetAnApology()
  41.             {
  42.                 throw new DontHoldYourBreathException();
  43.             }
  44.             public static void CanSodOff()
  45.             {
  46.                 throw new CanSodOffException();
  47.             }
  48.             public static void Says()
  49.             {
  50.                 acApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage(
  51.                     "\n** RenderMan and I agree, that \"Bow ties are cool\" ** ");
  52.             }
  53.  
  54.             internal class RequestForAnApology
  55.             {
  56.                 public static bool IsSincere { get; internal set; }
  57.  
  58.                 public RequestForAnApology() { }
  59.             }
  60.         }
  61.  
  62.         internal class Organization
  63.         {
  64.             public Organization() { }
  65.  
  66.             internal class DeveloperTechnicalServices
  67.             {
  68.                 public static string FullName
  69.                 {
  70.                     get { return "Developer Technical Services"; }
  71.                 }
  72.  
  73.                 public static string CommonName
  74.                 {
  75.                     get { return "DevTech"; }
  76.                 }
  77.  
  78.                 public static List<string> Members
  79.                 {
  80.                     get
  81.                     {
  82.                         return new List<string>()
  83.                         {
  84.                             DeveloperNetwork.StephenPreston.Name
  85.                             // others
  86.                         };
  87.                     }
  88.                 }
  89.             }
  90.         }
  91.  
  92.         internal class StephenPreston : ADNMember
  93.         {
  94.             public StephenPreston()
  95.             {
  96.                 AutoDeskProductUserSince = new DateTime(2000, 1, 1, 6, 32, 0);
  97.                 Biography =
  98.                     // source: http://au.autodesk.com/?nd=public_profile&account_id=116657
  99.                     "Stephen Preston has been a member of the Autodesk Developer Technical Services (DevTech) Team since 2000, supporting the AutoCAD®, ObjectARX®, .NET and ActiveX® APIs, and also AutoCAD OEM, and RealDWG®. Currently, he manages the DevTech Americas Team and serves as workgroup lead, working closely with the AutoCAD Engineering Team on future improvements in the AutoCAD APIs. Stephen started his career as a scientist, and has a PhD in atomic and laser physics from the University of Oxford. ";
  100.                 Country = DeveloperNetwork.Country("USA");
  101.                 EmailAddress = new MailAddress("stephen.preston@autodesk.com", "Stephen Preston");
  102.                 Title = "Senior Americas Manager";
  103.                 Membership = devTech.CommonName;
  104.                 Name = "Stephen Preston";
  105.                 Organization = devTech.FullName;
  106.                 PrimaryField = "Other";
  107.             }
  108.         }
  109.  
  110.         #region "CountryCodes"
  111.        
  112.         private static Dictionary<string, string> CountryCodes =
  113.             new Dictionary<string, string>()
  114.             {
  115.                 { "AFG", "AF" },    // Afghanistan
  116.                 { "ALB", "AL" },    // Albania
  117.                 { "ARE", "AE" },    // U.A.E.
  118.                 { "ARG", "AR" },    // Argentina
  119.                 { "ARM", "AM" },    // Armenia
  120.                 { "AUS", "AU" },    // Australia
  121.                 { "AUT", "AT" },    // Austria
  122.                 { "AZE", "AZ" },    // Azerbaijan
  123.                 { "BEL", "BE" },    // Belgium
  124.                 { "BGD", "BD" },    // Bangladesh
  125.                 { "BGR", "BG" },    // Bulgaria
  126.                 { "BHR", "BH" },    // Bahrain
  127.                 { "BIH", "BA" },    // Bosnia and Herzegovina
  128.                 { "BLR", "BY" },    // Belarus
  129.                 { "BLZ", "BZ" },    // Belize
  130.                 { "BOL", "BO" },    // Bolivia
  131.                 { "BRA", "BR" },    // Brazil
  132.                 { "BRN", "BN" },    // Brunei Darussalam
  133.                 { "CAN", "CA" },    // Canada
  134.                 { "CHE", "CH" },    // Switzerland
  135.                 { "CHL", "CL" },    // Chile
  136.                 { "CHN", "CN" },    // People's Republic of China
  137.                 { "COL", "CO" },    // Colombia
  138.                 { "CRI", "CR" },    // Costa Rica
  139.                 { "CZE", "CZ" },    // Czech Republic
  140.                 { "DEU", "DE" },    // Germany
  141.                 { "DNK", "DK" },    // Denmark
  142.                 { "DOM", "DO" },    // Dominican Republic
  143.                 { "DZA", "DZ" },    // Algeria
  144.                 { "ECU", "EC" },    // Ecuador
  145.                 { "EGY", "EG" },    // Egypt
  146.                 { "ESP", "ES" },    // Spain
  147.                 { "EST", "EE" },    // Estonia
  148.                 { "ETH", "ET" },    // Ethiopia
  149.                 { "FIN", "FI" },    // Finland
  150.                 { "FRA", "FR" },    // France
  151.                 { "FRO", "FO" },    // Faroe Islands
  152.                 { "GBR", "GB" },    // United Kingdom
  153.                 { "GEO", "GE" },    // Georgia
  154.                 { "GRC", "GR" },    // Greece
  155.                 { "GRL", "GL" },    // Greenland
  156.                 { "GTM", "GT" },    // Guatemala
  157.                 { "HKG", "HK" },    // Hong Kong S.A.R.
  158.                 { "HND", "HN" },    // Honduras
  159.                 { "HRV", "HR" },    // Croatia
  160.                 { "HUN", "HU" },    // Hungary
  161.                 { "IDN", "ID" },    // Indonesia
  162.                 { "IND", "IN" },    // India
  163.                 { "IRL", "IE" },    // Ireland
  164.                 { "IRN", "IR" },    // Iran
  165.                 { "IRQ", "IQ" },    // Iraq
  166.                 { "ISL", "IS" },    // Iceland
  167.                 { "ISR", "IL" },    // Israel
  168.                 { "ITA", "IT" },    // Italy
  169.                 { "JAM", "JM" },    // Jamaica
  170.                 { "JOR", "JO" },    // Jordan
  171.                 { "JPN", "JP" },    // Japan
  172.                 { "KAZ", "KZ" },    // Kazakhstan
  173.                 { "KEN", "KE" },    // Kenya
  174.                 { "KGZ", "KG" },    // Kyrgyzstan
  175.                 { "KHM", "KH" },    // Cambodia
  176.                 { "KOR", "KR" },    // Korea
  177.                 { "KWT", "KW" },    // Kuwait
  178.                 { "LAO", "LA" },    // Lao P.D.R.
  179.                 { "LBN", "LB" },    // Lebanon
  180.                 { "LBY", "LY" },    // Libya
  181.                 { "LIE", "LI" },    // Liechtenstein
  182.                 { "LKA", "LK" },    // Sri Lanka
  183.                 { "LTU", "LT" },    // Lithuania
  184.                 { "LUX", "LU" },    // Luxembourg
  185.                 { "LVA", "LV" },    // Latvia
  186.                 { "MAC", "MO" },    // Macao S.A.R.
  187.                 { "MAR", "MA" },    // Morocco
  188.                 { "MCO", "MC" },    // Principality of Monaco
  189.                 { "MDV", "MV" },    // Maldives
  190.                 { "MEX", "MX" },    // Mexico
  191.                 { "MKD", "MK" },    // Macedonia (FYROM)
  192.                 { "MLT", "MT" },    // Malta
  193.                 { "MNE", "ME" },    // Montenegro
  194.                 { "MNG", "MN" },    // Mongolia
  195.                 { "MYS", "MY" },    // Malaysia
  196.                 { "NGA", "NG" },    // Nigeria
  197.                 { "NIC", "NI" },    // Nicaragua
  198.                 { "NLD", "NL" },    // Netherlands
  199.                 { "NOR", "NO" },    // Norway
  200.                 { "NPL", "NP" },    // Nepal
  201.                 { "NZL", "NZ" },    // New Zealand
  202.                 { "OMN", "OM" },    // Oman
  203.                 { "PAK", "PK" },    // Islamic Republic of Pakistan
  204.                 { "PAN", "PA" },    // Panama
  205.                 { "PER", "PE" },    // Peru
  206.                 { "PHL", "PH" },    // Republic of the Philippines
  207.                 { "POL", "PL" },    // Poland
  208.                 { "PRI", "PR" },    // Puerto Rico
  209.                 { "PRT", "PT" },    // Portugal
  210.                 { "PRY", "PY" },    // Paraguay
  211.                 { "QAT", "QA" },    // Qatar
  212.                 { "ROU", "RO" },    // Romania
  213.                 { "RUS", "RU" },    // Russia
  214.                 { "RWA", "RW" },    // Rwanda
  215.                 { "SAU", "SA" },    // Saudi Arabia
  216.                 { "SCG", "CS" },    // Serbia and Montenegro (Former)
  217.                 { "SEN", "SN" },    // Senegal
  218.                 { "SGP", "SG" },    // Singapore
  219.                 { "SLV", "SV" },    // El Salvador
  220.                 { "SRB", "RS" },    // Serbia
  221.                 { "SVK", "SK" },    // Slovakia
  222.                 { "SVN", "SI" },    // Slovenia
  223.                 { "SWE", "SE" },    // Sweden
  224.                 { "SYR", "SY" },    // Syria
  225.                 { "TAJ", "TJ" },    // Tajikistan
  226.                 { "THA", "TH" },    // Thailand
  227.                 { "TKM", "TM" },    // Turkmenistan
  228.                 { "TTO", "TT" },    // Trinidad and Tobago
  229.                 { "TUN", "TN" },    // Tunisia
  230.                 { "TUR", "TR" },    // Turkey
  231.                 { "TWN", "TW" },    // Taiwan
  232.                 { "UKR", "UA" },    // Ukraine
  233.                 { "URY", "UY" },    // Uruguay
  234.                 { "USA", "US" },    // United States
  235.                 { "UZB", "UZ" },    // Uzbekistan
  236.                 { "VEN", "VE" },    // Bolivarian Republic of Venezuela
  237.                 { "VNM", "VN" },    // Vietnam
  238.                 { "YEM", "YE" },    // Yemen
  239.                 { "ZAF", "ZA" },    // South Africa
  240.                 { "ZWE", "ZW" },    // Zimbabwe
  241.             };
  242.  
  243.         #endregion
  244.     }
  245.  
  246.     public class ForThePurposesOfLevityException : System.Exception
  247.     {
  248.         public ForThePurposesOfLevityException(string msg) : base(msg) { }
  249.     }
  250.  
  251.     public class DontHoldYourBreathException : ForThePurposesOfLevityException
  252.     {
  253.         public DontHoldYourBreathException() : base("Too few arguments") { }
  254.     }
  255.  
  256.     public class CanSodOffException : ForThePurposesOfLevityException
  257.     {
  258.         public CanSodOffException() : base("Jeff stirs pots") { }
  259.     }
  260. }
  261.  
  262.  



... You pot stirrer, you. :-P
« Last Edit: October 17, 2012, 01:24:34 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

SGP2012

  • Guest
Re: Things that make you go "Hmmmmmmm...."
« Reply #23 on: October 24, 2012, 04:29:27 AM »
Sorry Jeff. I don't have full source code for you for my pseudo-code. Here's a video of a snail crossing the street instead:

http://www.youtube.com/watch?v=aqrBYRCxy2E.

 :-P