I'm doing my first application on Android, it consists of a &quot;To do Task&quot;. My problem is when I want to check the text of my TextView, which contains the date (array of strings), with the date on which the information is saved. This if I do to run the check never works. // Write date in Array SimpleDateFormat formatdate = new SimpleDateFormat(&quot;dd-MM-yyyy&quot;, Locale.getDefault()); Calendar calendar = new GregorianCalendar(); String[] date = new String[6]; for(int i = 0; i &lt; 6;i++){     calendar.add(Calendar.DATE  , 1);     date[i] = formatdate.format(calendar.getTime()); }  tvdate2.setText(date[0]); // 16-03-2021 ...  // When clicking on the button, it checks and then displays the corresponding information btn2.setOnClickListener(new View.OnClickListener() {     public void onClick(View view) {                         String test =&quot;16-03-2021&quot;;         if (tvdate2.getText().toString() == test){             testing.setText(&quot;It works!!&quot;);         }                     } });
93
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
60004
Is it possible to convert a timestamp to a date format in a query?  This is the code I am using.  $query = db_select('my_submissions', 's'); $query-&gt;fields('s', array('sid','name','company','email','phone','is_customer','submitted','count')); $entries = $query-&gt;execute();  $rows = array(); foreach ($entries as $entry) {   $row = array_map('check_plain', (array) $entry);   $row['submitted'] = $row['submitted'] ? date('d.m.Y H:i', $row['submitted']) : "";   $rows[] = $row; }
7024
As title says, How do I assign dynamic Ids for ui:inputDate elements inside aura:iteration?  Here is the reproducible version of the problem I am facing:  HelloWorldApp.app  &lt;aura:application &gt;     &lt;c:inputDateExample /&gt; &lt;/aura:application&gt;   inputDateExample.cmp  &lt;aura:component &gt;     &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;     &lt;aura:attribute name="datesList" type="List" /&gt;     &lt;table&gt;         &lt;aura:iteration items="{!v.datesList}" var="dateItem"&gt;             &lt;tr&gt;                 &lt;ui:inputDate aura:id="date-id"                                value="{!dateItem}"                                displayDatePicker="true"                               blur="{!c.fldChanged}"/&gt;             &lt;/tr&gt;         &lt;/aura:iteration&gt;     &lt;/table&gt; &lt;/aura:component&gt;   inputDateExampleController.js  ({     fldChanged : function(component, event, helper) {         console.log('Value changed');         //How do I find from which date element, event is fired??         //The below method finds both date elements because the Id is not unique         var dateComponent = component.find('date-id');         console.log(dateComponent);         console.log(dateComponent[0].get("v.value"));     },     doInit : function(component,event,helper){         var datesArray = [];         datesArray.push("2017-01-01");         datesArray.push("2017-01-31");         component.set("v.datesList",datesArray);     } })   This produces the below output and I need to find which element user is clicking on??    Notes:   I can assign unique Id for tr element but not sure how to use that inside component.find() method. I can assign dynamic id for plain input tags but there is too much markup involved for making these similar to lightning date element. I tried giving html5 data attributes for ui:inputDate but it doesn' accept.   Any workarounds or anything I am missing here?
120799
I'm currently using the below script to timestamp when an edit is made to column 7 on a sheet named "Sheet 1".  function onEdit(e) {    if ([7].indexOf(e.range.columnStart) != -1) {    e.range.offset(0, 7).setValue(new Date()).setNumberFormat("dd.MM.yyyy at HH:mm");    }   }     I have a second sheet "Sheet 2" which I need to run the same script on but against column 5.  function onEdit(e) {    if ([5].indexOf(e.range.columnStart) != -1) {    e.range.offset(0, 7).setValue(new Date()).setNumberFormat("dd.MM.yyyy at HH:mm");    }   }     I've tried .getSheetByName("Sheet1") but just cant seem to get it working correctly.
28842
This must be a simple question for a native speaker.  I know that we use "on" with dates: I'll see you on January 1st.  And we use "at" with times: I'll see you at 17:30.  But what preposition has to be used when we speak for date and time:  I'll see you on January 1st at 17:30. looks ok.  But what in this case: It happened on 2014-01-01 17:30.  Is "on" correct when we are specifying the date and the time?   The date-time comes as a ready text as 2014-01-01 17:30 and I cannot modify it. I can only put text before the date-time string or after it.
97660
I am trying to have a dynamic Date in my SMS, called PaymentDueDate. The date is in a DE, that will be the source of the journey that I am using.  The code that I am using when building the message is:  %%[  SET @id = [_subscriberkey]  SET @date = Lookup('payment_reminder_teste','PaymentDueDate','ContactId', @id)  ]%%   %%=Format(@date, "MM/dd/yyyy")=%%   But, when I send it, it doesnt appear any Date. If I use only the PaymentDueDate dynamic word, the date that appears is the modifying date of the message and not the date that is in the PaymentDueDate field.
67969
I have a custom search form that I posts a year + month, such as 2014-04 I would like to get all nodes created that month, when I create the timestmap I use: "SELECT .......         AND changed >= 'strtotime($date)'"  This is the code for form date:  $form['aqar_date'] = array( '#type' =&gt; 'date_select',  '#title' =&gt; t('Date'), '#prefix' =&gt; '&lt;div id="space_replace" class="search-title-date"&gt;   &lt;h2&gt;Node date&lt;/h2&gt;', '#suffix' =&gt; '&lt;/div&gt;',      '#date_format' =&gt; 'Y-m', '#default_value' =&gt; date('Y-m'), '#date_year_range' =&gt; '-4:+0',  );   This is the form submit:  $start_date = strtotime($date); $query = " SELECT `nid` FROM `node` WHERE  `type` = 'custom'  AND `changed` &gt;= '$start_date'";   But I'm not getting, I need a way to specify to only this month period not this month and newer!  Thanks!
106050
Hi I'm pretty new to Stack Overflow so I hope that I'm doing this correctly and that someone out there has the answer I need.  I'm currently coding a program in Java with Eclipse IDE an my question is this:  I need a snippet of code that does the following  It's supposed to get a .TXT file containing text and from that .TXT file  count the number of rows and print it,  count the number of words and print it,  count the number of characters and print it. And finally make a list of the top 10 words used and print that.  Allt the printing is done to system outprintln  I'm pretty new to Java and am having some difficulties.  Anyone out there who can provide me with these lines of code or that knows where i can find them? I want to study the code provided that's how I learn best=)  Thanks to all   Didnt find the edit button sorry...  I Added this to my question:  Hehe it´s an assignment but not a homework assignment ok i see well i could provide what i've done so far, i think im pretty close but it´s not working for me. Is there anything i have missed?  // Class    Tip   import java.io.*; import java.util.*;  class Tip {     public static void main(String [] args) throws Exception     {          String root = System.getProperty("user.dir");            InputStream is = new FileInputStream( root + "\\tip.txt" );         Scanner scan = new Scanner( is );          String tempString = "";         int lines = 0;         int words = 0;         Vector&lt;Integer&gt; wordLength = new Vector&lt;Integer&gt;();         int avarageWordLength = 0;          while(scan.hasNextLine() == true)         {                 tempString = scan.nextLine();                 lines++;         }          is.close();          is = new FileInputStream( root );         scan = new Scanner( is );          while(scan.hasNext() == true)         {                 tempString = scan.next();                 wordLength.add(tempString.length());                 words++;         }          for(Integer i : wordLength)         {                 avarageWordLength += i;         }         avarageWordLength /= wordLength.size();           System.out.println("Lines : " + lines);         System.out.println("Words : " + words);         System.out.println("Words Avarage Length : " + avarageWordLength);          is.close();          } }
38563
I'm trying to create two cells that will update my query: A >= date"A1" and A &lt;= date "B1".  My goal is to create a search page for the data, where the end user could insert a date or the =today() function and it would update the query. I am currently getting a formula parse error from:  =QUERY(Data!6:1397,"SELECT A,B,C,D,E,F,G,H,I,J,K,L WHERE A &gt;= date"A1"and  A &lt;= date"B1"")
18236
Steps to Reproduce   Tap faster on the code. or Tap once on a huge code.   but happens only when  setupForGeneric() is called, might be a bug related to   private void setupForCode()   { String str = getIntent().getStringExtra("com.stackexchange.marvin:code_block"); PrettyWebView localPrettyWebView = (PrettyWebView)findViewById(R.id.code); localPrettyWebView.setPostBody("&lt;pre&gt;&lt;code&gt;" + TextUtils.htmlEncode(str) + "&lt;/pre&gt;&lt;/code&gt;", false); localPrettyWebView.setBackgroundColor("#eeeeee"); }  private void setupForGeneric() { String str = getIntent().getStringExtra("com.stackexchange.marvin:web_url"); PrettyWebView localPrettyWebView = (PrettyWebView)findViewById(R.id.code); localPrettyWebView.getSettings().setBuiltInZoomControls(true); localPrettyWebView.getSettings().setLoadWithOverviewMode(true); localPrettyWebView.getSettings().setUseWideViewPort(true); localPrettyWebView.loadUrl(str); localPrettyWebView.setBackgroundColor("#eeeeee"); }   Log  09-05 03:54:30.312: E/AndroidRuntime(26264): FATAL EXCEPTION: WebViewCoreThread  09-05 03:09:39.522: E/Crittercism(18318): java.lang.NullPointerException: [v0.1.22]  09-05 03:09:39.522: E/Crittercism(18318):   at android.content.ComponentName.&lt;init&gt;(ComponentName.java:75) 09-05 03:09:39.522: E/Crittercism(18318):   at android.content.Intent.&lt;init&gt;(Intent.java:3156) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.ViewPopupActivity.showCode(ViewPopupActivity.java:25) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.question.QuestionFragment$1.onCodeClicked(QuestionFragment.java:67) 09-05 03:09:39.522: E/Crittercism(18318):   at com.stackexchange.marvin.ui.common.PrettyWebView$WebAppInterface.codeClicked(PrettyWebView.java:197) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.nativeTouchUp(Native Method) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.nativeTouchUp(Native Method) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore.access$4000(WebViewCore.java:59) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1449) 09-05 03:09:39.522: E/Crittercism(18318):   at android.os.Handler.dispatchMessage(Handler.java:99) 09-05 03:09:39.522: E/Crittercism(18318):   at android.os.Looper.loop(Looper.java:137) 09-05 03:09:39.522: E/Crittercism(18318):   at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:790) 09-05 03:09:39.522: E/Crittercism(18318):   at java.lang.Thread.run(Thread.java:856)
45055
If you provide 0 as the dayValue in Date.setFullYear you get the last day of the previous month:  d = new Date(); d.setFullYear(2008, 11, 0); //  Sun Nov 30 2008   There is reference to this behaviour at . Is this a reliable cross-browser feature or should I look at alternative methods?
113471
I'm working on making a spreadsheet in Google Sheets, and I'm attempting to have a column of names and then a column of dates adjacent to it.   I'd like to set up some sort of conditional formatting that checks if a cell's date has past or not, and if it has, formats the corresponding cell in the name column with a strikethrough.      Names  |  Dates | Etc. Name Here |  Date  | --- Name 2    |  Date2 | ---   So if the second date listed under "Dates" already passed (aka 1/10/16 as opposed to 2/19/16 compared to today's date, 1/19/16), then the second name listed under "Names" would appear formatted with strikethrough (like you had crossed it out).
48707
I need this date format in a visualforce page: "December 14, 2013". I can't seem to find the format options for visualforce. I read that it's the same as the java messageformat class options, but I cannot find a list for that either.  A little help would be much appreciated
90551
This is not about system autocomplete, it's about an autocomplete internal to Calendar (autocompletion of the name of the event when you create one) - and is there any way to turn it off.  I have many hundreds of events in ical as I've been using it for about the past five years.     Problem is whenever I create a new event, then start typing in the event name field, as I work out what I want to call the event (or reminder), a giant list of similar past events that I've entered pops up and is annoyingly distracting. I'm simply not interested in those past events anymore and I don't want to know about them. I use ical as a reminders system for tasks, i.e. as a todo list as well as calendar. I find that better than using a separate task app in addition.  I'd love to find a way to turn these suggestions off, without having to delete all past events from my calendar history (which it looks like I might have to resort to).  Haven't found a way to do this but would be very grateful if someone knows how.
54712
In my scenario I'm trying to display a flag (Font Awesome icon) in Views Global Text Field if another field in the same row of a type "Date" has a value of, say, a week from now. I tried  but it has some bugs with filters I'm using, so I thought that using the above approach would be better.
129
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
120517
I'm using classicthesis to write my document. I don't use the option drafting but I can see on the bottom of the page the date (there is a part of the date that is not readable, but when I copy and paste this part I obtain [ December 1, 2011 at 20:50 ]). This is my code:  \documentclass[a4paper]{scrreprt}   % classe report di KOMA-Script  \usepackage[english]{babel}     % Per scrivere in inglese \usepackage[T1]{fontenc}        % Imposta la codifica dei font \usepackage[utf8]{inputenc}     % Lettere accentate da tastiera \usepackage{classicthesis-preamble} % Preambolo classicthesis \usepackage{classicthesis}      % Classicthesis  \begin{document}  \input{Chapters/0_Introduction} [...]  \end{document}   I would like to avoid this little issue.  I use TeXworks in Windows7 x64.