profile
viewpoint
Yuzhou Zhu codingrhythm SafetyCulture Sydney http://blog.cmsight.com Mobile & Web Developer

codingrhythm/ios-rise 11

Colorful gradient background based on time of the day, inspired by Rise Alerm Color App

codingrhythm/ios-motion-background-view 3

iOS motion background component similar to iOS 7 home screen effect.

codingrhythm/aws-s3-browser-multipart-uploader 1

Upload large files to s3 in multipart from browser

codingrhythm/PyAPNs 1

Python library for interacting with the Apple Push Notification service (APNs)

codingrhythm/radius-progress-bar 1

HTML5 Radius Progress Bar jQuery plug-in

codingrhythm/12income 0

Expense Management Software built with Django and Bootstrap

codingrhythm/5coins-website 0

Website for 5coins

codingrhythm/Alamofire 0

Elegant HTTP Networking in Swift

codingrhythm/blog 0

personal blog

codingrhythm/bootstrap 0

The most popular front-end framework for developing responsive, mobile first projects on the web.

push eventcodingrhythm/Countdown

Yuzhou Zhu

commit sha a49cb4e296201e5e51a27dbf050d5ce7feae8577

Update for Xcode 11

view details

push time in 8 hours

fork codingrhythm/Countdown

Mac screensaver for counting down to a date

fork in 8 hours

created tagSafetyCulture/s12-proto

tagv1.10.3

Protocol Buffer tools

created time in 8 days

release SafetyCulture/s12-proto

v1.10.3

released time in 8 days

delete branch SafetyCulture/djinni

delete branch : PS-1006

delete time in 8 days

push eventSafetyCulture/djinni

Yuzhou Zhu

commit sha 1dedd7c46b86588bf8281e2b6095acc69b3faed1

PS-1006 Return empty string instead of nil (#2) * PS-1006 Return empty string instead of nil * PS-1006 Add comment

view details

push time in 8 days

PR merged SafetyCulture/djinni

PS-1006 Return empty string instead of nil

Currently if it fails to convert the std::string into NSString*, it returns nil. This can be a problem for NSDictionary as it does not allow nil to be the value, thus will have runtime crash when following line is called. https://github.com/SafetyCulture/djinni/blob/6de462b3ef701a9a2103c8ee269c575fb6d96524/support-lib/objc/DJIMarshal%2BPrivate.h#L348

According to https://developer.apple.com/documentation/foundation/nsstring/1407339-initwithbytes?language=objc

[[NSString alloc] initWithBytes:string.data()
                         length:static_cast<NSUInteger>(string.size())
                       encoding:NSUTF8StringEncoding];

If the length of the byte string is greater than the specified length a nil value is returned.

In order to prevent it from crashing, we return an empty string instead of nil. Since we already lose the value if a nil is returned, this change should not make things worse.

Please note, this is not the fix for the crash, I tried multiple options, but only this change can give me high confidence. I will explain more in following Crux PR. Also, feel free to raise any concerns.

+10 -3

3 comments

1 changed file

codingrhythm

pr closed time in 8 days

push eventSafetyCulture/djinni

Yuzhou Zhu

commit sha 02df4174406ecb6259b2509becbb269f5d8edaa5

PS-1006 Add comment

view details

push time in 8 days

pull request commentSafetyCulture/djinni

PS-1006 Return empty string instead of nil

Do we know when and why it fails to convert std::string into NSString 🤔

I will have more details in Crux PR that tries to explain why we may end up a string like that.

codingrhythm

comment created time in 8 days

PR opened SafetyCulture/djinni

PS-1006 Return empty string instead of nil

Currently if it fails to convert the std::string to NSString*, it returns nil. This can be a problem for NSDictionary as it does not allow nil to be the value, thus will have runtime crash when [map setObject:Value::Boxed::fromCpp(kvp.second) forKey:Key::Boxed::fromCpp(kvp.first)]; is called.

According to https://developer.apple.com/documentation/foundation/nsstring/1407339-initwithbytes?language=objc

If the length of the byte string is greater than the specified length a nil value is returned.

In order to prevent it from crashing, we return an empty string instead of nil.

+8 -3

0 comment

1 changed file

pr created time in 8 days

create barnchSafetyCulture/djinni

branch : PS-1006

created branch time in 8 days

created tagSafetyCulture/s12-proto

tagv1.10.1

Protocol Buffer tools

created time in 18 days

release SafetyCulture/s12-proto

v1.10.1

released time in 18 days

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha 5d5ba073025639de1fc1f8e2e4d7b025f3fb6a5b

PS-965 Fix the boxed java class name (#56)

view details

push time in 18 days

delete branch SafetyCulture/s12-proto

delete branch : PS-965

delete time in 18 days

PR merged SafetyCulture/s12-proto

PS-965 Fix the boxed java class name

The generated Java class name for nested message looks like this

com.safetyculture.s12.inspections.v1.GetInspectionsResponse.InspectionsListItem

instead of

com.safetyculture.s12.inspections.v1.GetInspectionsResponse$InspectionsListItem

The boxed Java class name should not have the $ sign as the nested message separator. The correct symbol should be ..

+8 -3

0 comment

3 changed files

codingrhythm

pr closed time in 18 days

PR opened SafetyCulture/s12-proto

PS-965 Fix the boxed java class name

The boxed Java class name should not have the $ sign as the nested message separator. The correct symbol should be ..

+8 -3

0 comment

3 changed files

pr created time in 18 days

create barnchSafetyCulture/s12-proto

branch : PS-965

created branch time in 18 days

created tagSafetyCulture/s12-proto

tagv1.9.9

Protocol Buffer tools

created time in 22 days

release SafetyCulture/s12-proto

v1.9.9

released time in 22 days

delete branch SafetyCulture/s12-proto

delete branch : PS-953

delete time in 22 days

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha ecf521a8a2c3ad13337ea28b083dee1e02fd6a8d

PS-953 Fix the nested className for JNI (#53)

view details

push time in 22 days

PR merged SafetyCulture/s12-proto

PS-953 Fix the nested className for JNI

The nested class name for JNI should be

"com/safetyculture/s12/tasks/v1/TimelineItem$ActivityCreator"

instead of

"com/safetyculture/s12/tasks/v1/TimelineItem_ActivityCreator"
+19 -15

1 comment

4 changed files

codingrhythm

pr closed time in 22 days

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha 20dd94bbcd1a0af6fd89f511c35406ec9cf0ece7

PS-953 Fix the djinni file

view details

push time in 22 days

pull request commentSafetyCulture/s12-proto

PS-953 Fix the nested className for JNI

@tmoura10 good pick up

codingrhythm

comment created time in 22 days

Pull request review commentSafetyCulture/s12-proto

PS-953 Fix the nested className for JNI

 struct Translator { #include "routeguide/v1/message.pb.h" namespace djinni::routeguide::v1::RouteSummary::Details { struct JNIInfo {-  const GlobalRef<jclass> clazz { jniFindClass("io/grpc/examples/routeguide/RouteSummary_Details")  };+  const GlobalRef<jclass> clazz { jniFindClass("io/grpc/examples/routeguide/RouteSummary$Details")  };   const jmethodID method_toBytes { jniGetMethodID(clazz.get(), "toByteArray", "()[B") };   const jmethodID method_byteSize { jniGetMethodID(clazz.get(), "getSerializedSize", "()I") };-  const jmethodID method_fromBytes { jniGetStaticMethodID(clazz.get(), "parseFrom", "([B)Lio/grpc/examples/routeguide/RouteSummary_Details;") };+  const jmethodID method_fromBytes { jniGetStaticMethodID(clazz.get(), "parseFrom", "([B)Lio/grpc/examples/routeguide/RouteSummary$Details;") };

@tmoura10 does this change to generated code looks good to you?

codingrhythm

comment created time in 22 days

PR opened SafetyCulture/s12-proto

PS-953 Fix the nested className for JNI

The nested class name for JNI should be

"com/safetyculture/s12/tasks/v1/TimelineItem$ActivityCreator"

instead of

"com/safetyculture/s12/tasks/v1/TimelineItem_ActivityCreator"
+9 -6

0 comment

3 changed files

pr created time in 22 days

create barnchSafetyCulture/s12-proto

branch : PS-953

created branch time in 22 days

created tagSafetyCulture/s12-proto

tagv1.9.8

Protocol Buffer tools

created time in 25 days

release SafetyCulture/s12-proto

v1.9.8

released time in 25 days

delete branch SafetyCulture/s12-proto

delete branch : PS-941

delete time in 25 days

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha ba7ecf9f5fc9a7b768a8652e83b2d2cc6576d8e3

PS-941 Free the allocated memory (#52)

view details

push time in 25 days

PR merged SafetyCulture/s12-proto

PS-941 Free the allocated memory

The generated code for passing protobuf message from c++ to objective-C contains memory leaks. The allocated memory malloc is not released after it’s used.

A free() needs to be used before return.

This fix has been verified working in the iAuditor using the Instrument tool to profile the app.

+8 -0

0 comment

2 changed files

codingrhythm

pr closed time in 25 days

PR opened SafetyCulture/s12-proto

PS-941 Free the allocated memory

The generated code for passing protobuf message from c++ to objective-C contains memory leaks. The allocated memory malloc is not released after it’s used.

A free() needs to be used before return.

+8 -0

0 comment

2 changed files

pr created time in 25 days

create barnchSafetyCulture/s12-proto

branch : PS-941

created branch time in 25 days

created tagSafetyCulture/s12-proto

tagv1.9.7

Protocol Buffer tools

created time in a month

release SafetyCulture/s12-proto

v1.9.7

released time in a month

delete branch SafetyCulture/s12-proto

delete branch : PS-923

delete time in a month

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha 0fdb5bbd33b3675440f7308539414c6eab0dd3e5

PS-923 Add prefix to nested type (#51)

view details

push time in a month

PR merged SafetyCulture/s12-proto

PS-923 Add prefix to nested type

To avoid conflicts

+23 -23

0 comment

4 changed files

codingrhythm

pr closed time in a month

PR opened SafetyCulture/s12-proto

PS-923 Add prefix to nested type
+23 -23

0 comment

4 changed files

pr created time in a month

create barnchSafetyCulture/s12-proto

branch : PS-923

created branch time in a month

created tagSafetyCulture/s12-proto

tagv1.9.6

Protocol Buffer tools

created time in a month

release SafetyCulture/s12-proto

v1.9.6

released time in a month

delete branch SafetyCulture/s12-proto

delete branch : PS-923

delete time in a month

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha 29638fbfef1c4f55e5eaaff9d4b498e3ca733af7

PS-923 Generate for nested messages (#50)

view details

push time in a month

PR merged SafetyCulture/s12-proto

PS-923 Generate for nested messages

Currently the cruxclient code generator doesn't handle the nested messages, this PR adds support to it

+1513 -28

0 comment

9 changed files

codingrhythm

pr closed time in a month

PR opened SafetyCulture/s12-proto

PS-923 Generate for nested messages
+1513 -28

0 comment

9 changed files

pr created time in a month

create barnchSafetyCulture/s12-proto

branch : PS-923

created branch time in a month

push eventSafetyCulture/grpc

Yuzhou Zhu

commit sha 478f7944bbeb99599b74986159735c3b0a621cbd

Update gRPC-Core.podspec

view details

push time in a month

push eventSafetyCulture/grpc

Yuzhou Zhu

commit sha 5d6c0125daaad6167074f1313558b494ee8ef930

Update gRPC-C++.podspec

view details

push time in a month

startedlabuladong/fucking-algorithm

started time in 2 months

issue openedh2non/bimg

When is the next release?

https://pkg.go.dev/gopkg.in/h2non/bimg.v1?tab=versions the latest release in go module is like 2 years ago...

created time in 2 months

startedjwasham/coding-interview-university

started time in 2 months

created tagSafetyCulture/s12-proto

tagv1.9.5

Protocol Buffer tools

created time in 2 months

release SafetyCulture/s12-proto

v1.9.5

released time in 2 months

delete branch SafetyCulture/s12-proto

delete branch : PS-757

delete time in 2 months

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha 4ec1c1ec7b0652b7eadc12fd9ab75800d81e4884

PS-757 generate djinni support files for messages (#49)

view details

push time in 2 months

PR merged SafetyCulture/s12-proto

PS-757 generate djinni support files for messages

Fix the code to generate djinni support file for proto contains no services as well

+2914 -50

0 comment

10 changed files

codingrhythm

pr closed time in 2 months

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha d1e1e515c168e86be1c49d2e4fbb59051504cbbe

PS-757 Fix the JNI type sig

view details

push time in 2 months

push eventSafetyCulture/s12-proto

Yuzhou Zhu

commit sha a22f80073945d823a5e20e0df51f54ed61e4dce9

PS-757 Fix the code

view details

push time in 2 months

create barnchSafetyCulture/s12-proto

branch : PS-757

created branch time in 2 months

issue commentprotocolbuffers/protobuf

Question about file name for objective-c code generation

Thanks for the update. Correct me if I am wrong, I cannot see how it will affect non-framework users as this option is opt-in only. If users are not using framework or don't need flat output directory, they won't need to provide any options, and everything should just behave as it is. Only when users run into this situation would need to change the output behaviour by providing this option.

codingrhythm

comment created time in 3 months

more