<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Suhana</title>
    <description>The latest articles on Forem by Suhana (@suhana).</description>
    <link>https://forem.com/suhana</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F920774%2F13dbf1dc-c2f5-4e62-94ec-4ea863495f1b.png</url>
      <title>Forem: Suhana</title>
      <link>https://forem.com/suhana</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/suhana"/>
    <language>en</language>
    <item>
      <title>In IntelliJ remove those classes which have 0 uses</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sun, 10 Mar 2024 13:51:10 +0000</pubDate>
      <link>https://forem.com/suhana/in-intellij-remove-those-classes-which-have-0-uses-2naa</link>
      <guid>https://forem.com/suhana/in-intellij-remove-those-classes-which-have-0-uses-2naa</guid>
      <description>&lt;p&gt;In my project, I have too many classes which are not in usage at present. so I have to remove those classes with 0 usages(class should not be used in another class or any declaration). Do I have any shortcut to do as my project has 300+ classes&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DataSource issue in spring Batch 5 - mongodb</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Mon, 04 Dec 2023 15:51:42 +0000</pubDate>
      <link>https://forem.com/suhana/datasource-issue-in-spring-batch-5-mongodb-33me</link>
      <guid>https://forem.com/suhana/datasource-issue-in-spring-batch-5-mongodb-33me</guid>
      <description>&lt;p&gt;Hey, I am trying to implement spring batch 5 with mongodb&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SodRepository sodRepository;

@Bean
public ItemReader&amp;lt;Sod&amp;gt; csvFileReader() {
  FlatFileItemReader&amp;lt;Sod&amp;gt; reader = new FlatFileItemReader&amp;lt;&amp;gt;();
  reader.setResource(new ClassPathResource(file)); // Specify your CSV file
  reader.setLineMapper(new DefaultLineMapper&amp;lt;Sod&amp;gt;() {{
    setLineTokenizer(new DelimitedLineTokenizer() {{
      setNames(new String[]{"groupCode","original", "conflictsWith", "level", "relationship", "validFrom", "validTo"});
    }});
    setFieldSetMapper(new BeanWrapperFieldSetMapper&amp;lt;Sod&amp;gt;() {{
      setTargetType(Sod.class);
    }});
  }});
  return reader;
}


@Bean
public ItemWriter&amp;lt;Sod&amp;gt; mongoItemWriter() {
  return items -&amp;gt; sodRepository.saveAll(items);
}

@Bean
public Job job(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
  return new JobBuilder("myJob",jobRepository)
          .start(step1(jobRepository,transactionManager))
          .build();
}

@Bean
public Step step1(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
  return new StepBuilder("myStep",jobRepository)
          .&amp;lt;Sod, Sod&amp;gt;chunk(100)
          .reader(csvFileReader())
          .writer(mongoItemWriter())
          .transactionManager(transactionManager)
          .build();
}

and mongo config:
@Configuration
@EnableConfigurationProperties
@EnableMongoRepositories(
        basePackages = {"com.airtel.africa.ums.client.config"},
        mongoTemplateRef = "mongoTemplate"
)
@EnableTransactionManagement
public class MongoConfig extends AbstractMongoClientConfiguration{

    @Value("${spring.data.mongodb.database}")
    private String databaseName;

    @Value("${spring.data.mongodb.uri}")
    private String mongoUrl;

    @Bean
    MongoTransactionManager transactionManager(MongoDatabaseFactory dbFactory) {
        return new MongoTransactionManager(dbFactory);
    }

    @Override
    protected String getDatabaseName() {
        return databaseName;
    }

    @Override
    public MongoClient mongoClient() {
        final ConnectionString connectionString = new ConnectionString(mongoUrl);
        final MongoClientSettings mongoClientSettings = MongoClientSettings.builder()
                .applyConnectionString(connectionString).build();
        return MongoClients.create(mongoClientSettings);

    }

    @Bean(name = "mongoTemplate")
    public MongoTemplate mongoTemplate(MongoDatabaseFactory mongoDatabaseFactory) {
        return new MongoTemplate(mongoDatabaseFactory);
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;am getting error - Parameter 0 of method csvProcessingStep in com.airtel.africa.ums.client.excel.ExcelUploadConfig required a bean named 'dataSource' that could not be found.&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>springbatch</category>
      <category>mongodb</category>
      <category>excel</category>
    </item>
    <item>
      <title>Password encryption while login</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Wed, 11 Oct 2023 17:45:29 +0000</pubDate>
      <link>https://forem.com/suhana/password-encryption-while-login-649</link>
      <guid>https://forem.com/suhana/password-encryption-while-login-649</guid>
      <description>&lt;p&gt;We have a centralized application where the are some clients to it where their data will be stored in our application db. Now, I have to encrypt the password while logging in to avoid security issues. But our clients also need to send their password-encrypted and I can't share static secret key with them through which they can encrypt. Any better suggestions are appreciated.&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>spring</category>
      <category>encryption</category>
      <category>java</category>
    </item>
    <item>
      <title>HOW TO DO Password encryption while login?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Wed, 11 Oct 2023 17:45:26 +0000</pubDate>
      <link>https://forem.com/suhana/password-encryption-while-login-1o88</link>
      <guid>https://forem.com/suhana/password-encryption-while-login-1o88</guid>
      <description>&lt;p&gt;We have a centralized application where the are some clients to it where their data will be stored in our application db. Now, I have to encrypt the password while logging in to avoid security issues. But our clients also need to send their password-encrypted and I can't share static secret key with them through which they can encrypt. Any better suggestions are appreciated.&lt;/p&gt;

</description>
      <category>springboot</category>
      <category>spring</category>
      <category>encryption</category>
      <category>java</category>
    </item>
    <item>
      <title>How to decide to have one endpoint or different?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sun, 17 Sep 2023 11:05:33 +0000</pubDate>
      <link>https://forem.com/suhana/how-to-decide-to-have-one-endpoint-or-different-295e</link>
      <guid>https://forem.com/suhana/how-to-decide-to-have-one-endpoint-or-different-295e</guid>
      <description>&lt;p&gt;Actually, i have an endpoint which takes Jwt token and returns user from the token(decrypting). Now i have to write other endpoint which gives user details but in request i also get identity source(thirdparty soruce) and id. so in this case i will get details from third-party source if i get request like this.the Response details data will not same in both the cases. Now, i couldn't decide if i need to have different endpoints or not??    &lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>development</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to set the header's Accept-Language with locale value</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sat, 15 Oct 2022 13:35:28 +0000</pubDate>
      <link>https://forem.com/suhana/how-to-set-the-headers-accept-language-with-locale-value-4job</link>
      <guid>https://forem.com/suhana/how-to-set-the-headers-accept-language-with-locale-value-4job</guid>
      <description>&lt;p&gt;I have a request header &lt;code&gt;Accept-Language&lt;/code&gt; which can have "en" or "fr" locale. Now one application sends a header where header key will be &lt;code&gt;locale&lt;/code&gt;. So, to be in the same pace i should set their &lt;code&gt;locale&lt;/code&gt; value to &lt;code&gt;Accept-Language&lt;/code&gt;. I cannot do it commonly in localeResolver method. It should be for partucular api so i need to do this in controller. How to achieve this? &lt;br&gt;
Thanks in advance &lt;/p&gt;

</description>
      <category>microservices</category>
      <category>java</category>
      <category>webdev</category>
      <category>springboot</category>
    </item>
    <item>
      <title>How to find latest document for all ids in the list of ids?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sun, 09 Oct 2022 17:27:04 +0000</pubDate>
      <link>https://forem.com/suhana/how-to-find-latest-document-for-all-ids-in-the-list-of-ids-1md</link>
      <guid>https://forem.com/suhana/how-to-find-latest-document-for-all-ids-in-the-list-of-ids-1md</guid>
      <description>&lt;p&gt;I have a database Book(id, author, createdAt, updatedAt) in mongodb. Now, I have list of authors and want to find their latest book of every author in the list.&lt;br&gt;
Can anyone help me resolve this? Thanks in advance&lt;/p&gt;

</description>
    </item>
    <item>
      <title>how to validate email with special characters |, :, &amp;?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Thu, 29 Sep 2022 18:41:07 +0000</pubDate>
      <link>https://forem.com/suhana/how-to-validate-email-with-special-characters--142o</link>
      <guid>https://forem.com/suhana/how-to-validate-email-with-special-characters--142o</guid>
      <description>&lt;p&gt;I have a regex &lt;code&gt;^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$&lt;/code&gt;. Now i want to allow all special characters(|,&amp;amp;,:) in it with out changing whole regex&lt;/p&gt;

&lt;p&gt;thanks in advance&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>java</category>
      <category>regex</category>
    </item>
    <item>
      <title>What is a regex for a email?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sun, 25 Sep 2022 10:14:55 +0000</pubDate>
      <link>https://forem.com/suhana/what-is-a-regex-for-a-email-1n7m</link>
      <guid>https://forem.com/suhana/what-is-a-regex-for-a-email-1n7m</guid>
      <description>&lt;p&gt;My email can also contain special characters including @,&amp;amp;,-,_,:,(),|&lt;br&gt;
I have wrote&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

But it doesn't seem efficient. Any suggestions?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>What is an XSS Filter?</title>
      <dc:creator>Suhana</dc:creator>
      <pubDate>Sun, 25 Sep 2022 08:28:20 +0000</pubDate>
      <link>https://forem.com/suhana/what-is-an-xss-filter-2gf6</link>
      <guid>https://forem.com/suhana/what-is-an-xss-filter-2gf6</guid>
      <description>&lt;p&gt;I have a requirement to make an email field supporting all special characters. But while I am giving tes(t)&lt;a class="mentioned-user" href="https://dev.to/test"&gt;@test&lt;/a&gt;.com in email, I am getting "XSSFilter error found" and when I skip the XSS filter for this particular URL it works fine. But what actually XSS filter do?&lt;/p&gt;

</description>
      <category>spring</category>
      <category>java</category>
      <category>springboot</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
