I know this question has been asked before, but I cannot find a solution to the issue of combo boxes. I have the following code:  ... JComboBox startingCombo = new JComboBox(); startingCombo.setModel(new DefaultComboBoxModel(new String[] {"USD", "EUR", "GBP"})); ...   I get an error when running from commandline:  Note: ConverterFrame.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.  When I do recompile with -Xlink:Unchecked I receive several of the following errors:  ConverterFrame.java:88: warning: [unchecked] unchecked call to DefaultComboBoxModel(E[]) as a member of the raw type DefaultComboBoxModel  This line then points to "new" on the second line in the code provided. I understand that I need to add an object type, but I am unsure where to add it and how.
3732
For example:  javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
66803
I am trying to call my Apex class from a trigger:  trigger newCrossSellAccounts on Account (before insert) {    crossSellModule.insertAfterAccount2(trigger.new); }   On the class I have:  public void insertAfterAccount2(list&lt;account&gt; accountList){   When I try to save trigger I get error:  Method does not exist or incorrect signature: crossSellModule.insertAfterAccount2(LIST&lt;Account&gt;) at line 2 column 4    Now from  it says .new "Returns a list of the new versions of the sObject records." I tried to change the function on class to:  public void insertAfterAccount2(sObject&lt;account&gt; accountList){   But I get error:  Invalid type: sObject&lt;account&gt;    Should I loop thru and create a list in trigger first? Or is there are workaround. Also, how one would test such trigger/class combination?
9423
I have just discovered this feature.   Declaring an interface using the "@interface" syntax allows you to put a default value.  public @interface HelloWorld {       public String sayHello() default "hello world"; }   This is something new for me. How is that default value suppose to be used.  I cannot find references to that, because the www is full of java interface documents prior to "@" addition in Java 1.5 ( was it on .5 or in .4? )     EDIT  Thanks for the answers ( I was somehow close to "annotation", for I use the tag already )  :P   I knew I should've read that document years ago!!!... let's see...      Many APIs require a fair amount of boilerplate code. For....
113807
Why does the following code not work?  I want to instantiate prefabs in a list and then use  it as a GameObject like that :  public GameObject prefab;  void Start() {   ArrayList players = new ArrayList();    for(int i=0; i&lt;5; i++)   {         players.Add( (GameObject)Instantiate(prefab));   }    players[2].transform.position = new Vector3(1, 1, 1);  }   there is an error message
79701
I'm used to work with Java where large amounts of examples are available. For various reasons I had to switch to C# and trying to do the following in SharpDevelop:  // Form has a menu containing a combobox added via SharpDevelop's GUI  // --- Variables languages = new string[2]; languages[0] = "English"; languages[1] = "German"; DataSet myDataSet = new DataSet();  // --- Preparation DataTable lTable = new DataTable("Lang"); DataColumn lName = new DataColumn("Language", typeof(string)); lTable.Columns.Add( lName ); for( int i=0; i&lt;languages.Length; i++ ) {     DataRow lLang = lTable.NewRow();     lLang["Language"] = languages[i];     lTable.Rows.Add(lLang); } myDataSet.Tables.Add(lTable);  // --- Handling the combobox mnuActionLanguage.ComboBox.DataSource = myDataSet.Tables["Lang"].DefaultView; mnuActionLanguage.ComboBox.DisplayMember = "Language";   One would assume to see some values in the dropdown, but it's empty. Please tell me what I'm doing wrong ;(  EDIT: mnuActionLanguage.ComboBox.DataBind() is what I also found on the net, but it doesn't work in my case.  SOLUTION  mnuActionLanguage.ComboBox.BindingContext = this.BindingContext;   at the end solved the problem!
96218
I came across this code and wanted others to provide their point of view... is it good or bad ? ;)  Class ReportClass {  public string ReportName {get; set;} }   Then it was used as follows in code:  displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToString())   That is about the simplest form example I can give you. Quetion is... why can't I find examples ? What would this be called? Is this just asking for trouble?  EDIT: I'm referring to the inplace assignment. Which I wasn't aware of until today
113159
I'm not sure why I'm getting this error, but shouldn't this code compile, since I'm already checking to see if queue is getting initialized?   public static void Main(String[] args) {     Byte maxSize;     Queue queue;      if(args.Length != 0)     {         if(Byte.TryParse(args[0], out maxSize))             queue = new Queue(){MaxSize = maxSize};         else             Environment.Exit(0);     }     else     {         Environment.Exit(0);     }      for(Byte j = 0; j &lt; queue.MaxSize; j++)         queue.Insert(j);     for(Byte j = 0; j &lt; queue.MaxSize; j++)         Console.WriteLine(queue.Remove()); }   So if queue is not initialized, then the for loops aren't reachable right? Since the program already terminates with Environment.Exit(0)?  Hope ya'll can give me some pointers :)  Thanks.
38323
This code compiles but in preview, it shows an error Invalid selectOptions found. Use SelectOption type in Apex.   public list&lt;student__c&gt; myStud = new list&lt;student__c&gt;();    List&lt;student__c&gt; stud_qry = new List&lt;student__c&gt;();     public list&lt;student__c&gt; getStud(){         stud_qry =  [select Id, First_Name__c, name from Student__c];          for(student__c getEm : stud_qry){           myStud.add(new student__c(Name = getEm.first_name__c+' ' + getEm.name));            }            return myStud;    }   VFP  &lt;apex:outputText &gt;Select Student:&lt;/apex:outputText&gt;                 &lt;apex:selectList size="1"&gt;                      &lt;apex:selectOptions value="{!Stud}"/&gt;                 &lt;/apex:selectList&gt;
78597
I keep getting the System.NullPointerException: Attempt to de-reference a null object on my trigger at line 21. I've attempted to add != null to that line and I get an error too. Please see the code below.  trigger UpdateDMAAccount on Account (before insert, before update) { //get set of Postal Codes from leads to be inserted or updated Set&lt;String&gt; BillingpostalCodes = new Set&lt;String&gt;(); for(Account l : trigger.new){ if(l.BillingPostalCode != null){     BillingpostalCodes.add(l.BillingPostalCode);  } } if(BillingpostalCodes.size() &gt; 0){ //create Map of custom object records with Name (PostalCode) as key Map&lt;String,DMA_Value__c&gt; validBillingPostalCode = new Map&lt;String,DMA_Value__c&gt;(); for(DMA_Value__c obj : [SELECT Id, Name, DMA_Value__c FROM DMA_Value__c WHERE Name IN :BillingpostalCodes]){     validBillingPostalCode.put(obj.Name,obj); } for(Account l : trigger.new){     if((Trigger.isInsert || trigger.oldMap.get(l.Id).BillingPostalCode != l.BillingPostalCode) &amp;&amp; validBillingPostalCode.containsKey(l.BillingPostalCode)){          l.DMA__c = validBillingPostalCode.get(l.BillingPostalCode).DMA_Value__c;     }     else if(trigger.oldMap.get(l.Id).BillingPostalCode != NULL || l.BillingPostalCode &amp;&amp; !validBillingPostalCode.containsKey(l.BillingPostalCode)){         //blank value if new PostalCode does not match a record in the Map         l.DMA__c = Null;     }   }  } }
85931
I want to open an Excel file through an Apex dialog box, then browse the information in my file line and display it with visualforce. I show you my code  public class ImportExcel {       public String fileName{get; set;}     public Blob contentFile{get;set;}     public String[] csvFileLines{get;set;}     public List&lt;String&gt; acclist{get;set;}     public String[] data{get;set;}     public ImportExcel(){         csvFileLines = new String[]{};         acclist = New List&lt;String&gt;();      } public void readFile(){         try         {             fileName=contentFile.toString();         }catch(Exception e){         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please upload a valid CSV document');         ApexPages.addMessage(myMsg);              return ;          }         csvFileLines=fileName.split('\n');          system.debug(csvFileLines);         for(Integer i=0;i&lt;csvFileLines.size();i++){             data=csvFileLines[i].split(',');             acclist.add(data[i]);         }     } }   Once I execute my code, it puts me this error:     13:52:13:012 VARIABLE_ASSIGNMENT   [15]|e|"common.apex.runtime.impl.ExecutionException: BLOB is not a   valid UTF-8 string"|0x4e4728
24218
Is this functionality going to be put into a later Java version?  Can someone explain why I can't do this, as in, the technical way Java's switch statement works?
26323
I have an ArcGIS JavaScript API Web App that uses multiple combo boxes.  I would like to create an if-else conditional statement between two fields in my feature layer.  If one field is chosen in combo box one is 1  then combo box three should automatically populate to 3.    Below is my validate function for my request type.    function changeonevent() {   (dijit.byId("cbRequestType").on('change'), changeonevent (MFValue) {     if (MFValue == 'Electronic Waste') {    dijit.byID("cbMFSubType"). set ('value', 'Copy Machine');     } else if MFValue == '...'{    dijit.by.ID('cbMFSubType').set('value', 'Printer');     }
33779
I came across some very strange behaviour when working with a Map with Decimal keys today. It seems like the Decimal type can't handle Integer assignments properly, but allows them nonetheless. I've written some example code demonstrating the problem:  Map&lt;Decimal, String&gt; m = new Map&lt;Decimal, String&gt;(); m.put(1234, 'Integer key');  m.put(1234.0, 'Decimal key'); m.put(1234.5, 'Decimal Unique key');  System.debug(m.get(1234));      // =&gt; Integer key, why was this not overwritten if 1234 == 1234.0? System.debug(m.get(1234.0));    // =&gt; Decimal key System.debug(m.get(1234.5));    // =&gt; Decimal Unique key  System.debug(m);        //Order of insertion matters, newest value does not override existing one but is not shown on map printout... for(Decimal d : m.keySet()){     System.debug(d);    //...unless you print it out yourself, because this loop shows all the keys }  //Sanity check System.debug(1234 == 1234.0); //True  //Digging deeper Decimal fake_d = 1234; Decimal real_d = 1234.0; Integer real_i = 1234; //Integer fake_i = 1234.0; //Illegal assignment, typechecking only works one way, it seems  //More sanity checks System.debug(fake_d == real_d); //True (Except when used in a Map, apparently) System.debug(fake_d == real_i); //True  System.debug(m.get(real_i)); // =&gt; Integer key System.debug(m.get(fake_d)); // =&gt; Integer key, even with fake_d explicitely declared as a Decimal type, it still pretends to be an Integer. System.debug(m.get(real_d)); // =&gt; Decimal key   I found this behaviour when I tried to fetch a value from a map using a Decimal sObject field, only to find that the keys I used to populate the Map (coming from a different Decimal field) were interpreted as Integers since they had no real decimal digits.  Maybe using Decimals as Map keys is not supported for some reason? Is it expected behaviour for 1234 and 1234.0 being distinct values in this case or is this an oversight in the Map implementation?
47989
Okay, we know that the following two lines are equivalent -    (0 == i) (i == 0)   Also, the first method was encouraged in the past because that would have allowed the compiler to give an error message if you accidentally used '=' instead of '=='.  My question is - in today's generation of pretty slick IDE's and intelligent compilers, do you still recommend the first method?    In particular, this question popped into my mind when I saw the following code -   if(DialogResult.OK == MessageBox.Show("Message")) ...    In my opinion, I would never recommend the above. Any second opinions?
58546
I'm new to pyqgis and I'm tryig to make a combobox with list of fields (from layer also selected in combobox).      layers = self.iface.legendInterface().layers()     layer_list = []     for layer in layers:         layer_list.append(layer.name())     self.dlg.comboBox.addItems(layer_list)       selectedLayerIndex = self.dlg.comboBox.currentIndex()     selectedLayer = layers[selectedLayerIndex]     fields = selectedLayer.pendingFields()     fieldnames = [field.name() for field in fields]     self.dlg.comboBox_2.addItems(fieldnames)   The problem is, that in second combobox there are fields from first on layerlist layer, not the selected one.
53255
In my spring application context file, I have something like:  &lt;util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String"&gt;     &lt;entry key="some_key" value="some value" /&gt;     &lt;entry key="some_key_2" value="some value" /&gt;    &lt;/util:map&gt;   In java class, the implementation looks like:  private Map&lt;String, String&gt; someMap = new HashMap&lt;String, String&gt;(); someMap = (HashMap&lt;String, String&gt;)getApplicationContext().getBean("someMap");   In Eclipse, I see a warning that says:  Type safety: Unchecked cast from Object to HashMap  What did I do wrong? How do I resolve the issue?
44444
What else, other than insert/update/upsert/delete, can cause "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out"?  I've search the debug logs multiple times, and there absolutely is not a DML statement executed between the startTest and the failing callout.  Are there any other commands, or perhaps another callout (even though it's only an inquiry), that can cause this?  Does anyone know how to get around this problem?