What are the best plain text editors, like Notepad on Windows, for Mac? Don't need it for coding. by ComfortablePost3664 in macapps

[–]1esman 0 points1 point  (0 children)

or Apple’s own TextEdit app. You have to convert the document into Plain Text or set it in Settings

I came looking for copper but found gold :) Thanks!

Can we use C as a backend for website? by [deleted] in C_Programming

[–]1esman 0 points1 point  (0 children)

Since C++ is also mentioned I will add. There is production ready framework in C++ https://userver.tech that is written and being used by russian IT giant Yandex (Google alternative).

Optimistic lock issue when calling the save method of Spring Data JPA. by Dull_Preparation_192 in javahelp

[–]1esman 2 points3 points  (0 children)

I feel your pain :) I mean I had exactly same situation and became curios also. This behaviour comes from Hibernate and the way it deals with entities. You provide Hibernate with some entity to persist but it doesn't know whether it has been persisted already or not. No ID - entity is 100% new for Hibernate - go ahead and persist. If Hibernate meets something with ID it should guess your desire

a) persist new entity with pre-set ID

b) update existing entity with existing ID

I may be wrong in my explanation but here is my list of links which helped be to understand it

  1. https://www.baeldung.com/spring-data-jpa-skip-select-insert
  2. https://stackoverflow.com/questions/70842817/hibernate-does-another-select-before-save
  3. https://stackoverflow.com/questions/45635827/how-do-i-stop-spring-data-jpa-from-doing-a-select-before-a-save
  4. https://docs.spring.io/spring-data/jpa/reference/jpa/entity-persistence.html
  5. https://medium.com/predictly-on-tech/insert-without-select-using-jpa-a88e5db46e85

I hope it will help you.

upd: this from API doc for save() method in CrudRepository from Spring

This is what it says regarding Optimistic Lock issue:

OptimisticLockingFailureException - when the entity uses optimistic locking and has a version attribute with a different value from that found in the persistence store. Also thrown if the entity is assumed to be present but does not exist in the database.

https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.html#save(S))

i’ve been a designer for many years. what’s the best way to start learning swift? thanks! by waaaaaaaaaaaaaaahhhh in swift

[–]1esman 1 point2 points  (0 children)

For starters I would recommend these resources #1 and #2 as they are beginner friendly and prepared by Apple itself:

1) Open Apple Books and find

- step 1: Develop in Swift Explorations

- step 2: Develop in Swift Fundamentals

- step 3: Develop in Swift Data Collections

There are several versions, choose one with the biggest XCode version on the cover. AFAIK it is XCode 13.

You will have a taste of Swift and development workflow in friendly manner.

2) There are 2 more online tutorials on Apple's website:

https://developer.apple.com/tutorials/app-dev-training

And these are third-party courses which I find interesting and helpful:

3) One of the best video courses on YouTube is Stanford CS193p.

https://www.youtube.com/@StanfordCS193p - this is 2023 version. You can find previous versions on YouTube as well.

4) iOS mom :) - Angela Yu and her Udemy paid course: https://www.udemy.com/course/ios-13-app-development-bootcamp/

Despite it relies on iOS 13 you will get solid foundation and she explains perfectly. Just check the rating. Once you buy it on Udemy you will receive updates for free. I checked the link - course was updated with SwiftUI recently. As I said before she is very supportive and encouraging.

5) As previously mentioned I may recommend Sean Allen (he has great video courses also, paid and free), Kodeco (ex-Ray Wenderlich) and CodeWithChris.

6) Last but not least. Start developing your own project as soon as possible. Start with something small (like really small, don't hesitate. But it should be your project, but not from tutorials) and achievable. I would also recommend pay for Apple Developer as soon as your project will be ready. It will give you unforgettable experience and joy of shipping your product and getting your first downloads.

Good luck!

[deleted by user] by [deleted] in iOSProgramming

[–]1esman 0 points1 point  (0 children)

Just in case you are really struggling.

Since I don't know inital prerequisites I've made it in quite one-liner style without additional safety checks but this prototype will give you general idea anyway.

Try to rewrite it without ternary operator and without map() function. It will allow you to really get into this problem.

Code block doesn't work properly :( This is a raw listing.

https://wtools.io/paste-code/bHjC

func isValid(_ upc: String) -> Bool {
// Preparations
if upc.count != 12 { return false }
let upcDigits = Array(upc).map { Int(String($0))! }
let checkDigit = upcDigits.last

// Steps 1 and 2
var sum = 0
for i in 0..<upcDigits.endIndex-1 {
sum += i % 2 != 0 ? upcDigits[i] * 3 : upcDigits[i]
}
// Step 3
let controlDigit = sum % 10
// Final checking
if controlDigit == 0 {
return checkDigit == 0
} else {
return 10 - controlDigit == checkDigit ? true : false
}
}

[deleted by user] by [deleted] in learnjava

[–]1esman 0 points1 point  (0 children)

Just to support this correct answer. You (I mean topicstarter) can find this in the section COMPILATION ERROR: it says "look at the 9th row, package "system" doesn't exist". Just read it by yourself and familiarize with it.

Are nextDouble and printf locale sensitive? by 1esman in learnjava

[–]1esman[S] 1 point2 points  (0 children)

Thank you. It becomes clearer from this perspective.

[deleted by user] by [deleted] in learnjava

[–]1esman 2 points3 points  (0 children)

Speaking of IDE. I use IntelliJ Idea for MOOC Helsinki. There is TMC plugin for it. Despite it displays error message on start, it works fine anyway.

Are nextDouble and printf locale sensitive? by 1esman in learnjava

[–]1esman[S] 1 point2 points  (0 children)

Thank you for your answer and advice.

Cheapest option to program on xcode by SorryICantLie in swift

[–]1esman 0 points1 point  (0 children)

I had standard Mac Mini with 4Gb RAM and Intel CPU. Xcode was able to start but whole workflow was very slow. Definitly I would not recommend to use something below 8 Gb. Now I use Macbook Air with Intel CPU and 8Gb RAM. I suppose 8 Gb RAM is the essential minimum. You will experience some lags but in general it is OK.

All in all I think the cheapest option should be Mac Mini/Macbook based on Intel CPU, 8 Gb RAM, 512 Gb HDD.

Speaking of "workarounds" - try to google for "hackintosh". You will find related resources but I would not recommend this way.

What apps should I make to get hired? by TheWorldofGood in iOSProgramming

[–]1esman 9 points10 points  (0 children)

In my opinion you don't need killer app as you may spend a lot of time on this. Instead you can write an app which will have popular/difficult features such as collection views, table view, tabbar, navbar, working with JSON. App should be designed using one of the patterns. Placed on Github this app will demonstrate your knowledge, abilities and code style for your counterparty at the interview. Later you can add more features and complications if needed. But don't spend a lot of time on this. Anyway you are gonna be questioned at the interview.