Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit c77b685

Browse files
committed
Other captions 🚀
1 parent e7a00ad commit c77b685

File tree

2 files changed

+34
-57
lines changed

2 files changed

+34
-57
lines changed

_posts/2018-02-08-react-native-debug-on-device-rctbundleurlprovider.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,32 @@ class ReactNativeBridgeDelegate: NSObject, RCTBridgeDelegate {
4040
}
4141
```
4242

43-
{% include blog-lazy-image.html description="react native bridge delegate localhost" width="1500" height="891" src="/assets/images/posts/react-native-bridge-delegate-localhost.jpg" %}
43+
{% include blog-lazy-image.html description="The react native bridge delegate still uses the localhost url to load the bundled JS" width="1500" height="891" src="/assets/images/posts/react-native-bridge-delegate-localhost.jpg" %}
4444

4545
If we try to build this app on an iPhone, and we open one of the React Native screen we will receive the following error (obviously based on the fact that we are trying to access localhost from the iPhone, and our React Native node server is running on the MacBook Pro where we are building the app).
4646

47-
{% include blog-lazy-image.html description="react native error on device failed bundle" width="350" height="641" src="/assets/images/posts/react-native-error-on-device-failed-bundle.jpg" %}
47+
{% include blog-lazy-image.html description="If you run the app with the localhost url above, you will receive an error" width="350" height="641" src="/assets/images/posts/react-native-error-on-device-failed-bundle.jpg" %}
4848

49-
How can we build on a real device? First of all we need to add a new build phase to our project that let us run the `React Native Xcode Bundler` before the real build. The `React Native Xcode Bundler` is a shell script with name `react-native-xcode.sh` that you can find inside your react native npm package under `<you app root folder.>/node_modules/react-native/scripts/`. This script must take as input our React Native index.js.
49+
How can we build on a real device? First of all we need to add a new build phase to our project that let us run the `React Native Xcode Bundler` before the real build. The `React Native Xcode Bundler` is a shell script with name `react-native-xcode.sh` that you can find inside your react native npm package under `<you app root folder.>/node_modules/react-native/scripts/`. This script must take as input our React Native index.js.
5050

51-
{% include blog-lazy-image.html description="react native setup bundler" width="1500" height="891" src="/assets/images/posts/react-native-setup-bundler.jpg" %}
51+
{% include blog-lazy-image.html description="Add the release bundler script as an Xcode phase" width="1500" height="891" src="/assets/images/posts/react-native-setup-bundler.jpg" %}
5252

5353
Now we can change our `ReactNativeBridgeDelegate` implementation. Instead of returning an hard coded url, we use the `RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)` method. We need to pass `"index"` as bundle root parameter (the name of the main js file).
5454

55-
{% include blog-lazy-image.html description="React Native bundle url provider setup" width="1500" height="891" src="/assets/images/posts/react-native-bundle-url-provider-setup.jpg" %}
55+
{% include blog-lazy-image.html description="The ReactNativeBridgeDelegate gets the JS url from RCTBundleURLProvider" width="1500" height="891" src="/assets/images/posts/react-native-bundle-url-provider-setup.jpg" %}
5656

5757
Now we can try to build an run again the app on a real device. As you can see now everything works as expected.
5858

59-
{% include blog-lazy-image.html description="react native app working on device" width="350" height="641" src="/assets/images/posts/react-native-app-working-on-device.jpg" %}
59+
{% include blog-lazy-image.html description="Now the app works correctly on a real device" width="350" height="641" src="/assets/images/posts/react-native-app-working-on-device.jpg" %}
6060

61-
What's happening under the hood? Which kind of "magic" are we using here :smirk:? If we start to debug from the call
62-
to `RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)` and we go inside the React Native source code at some point we will see a call to a method named `guessPackagerHost`. In this method there's a piece of code that tries to open and read the content of a file named `ip.txt` (this file is supposed to be in the main bundle of the app). The string returned by this method is used as hostname in the url used by React Native to call the packager we are running on our mac.
61+
What's happening under the hood? Which kind of "magic" are we using here :smirk:? If we start to debug from the call to `RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)` and we go inside the React Native source code at some point we will see a call to a method named `guessPackagerHost`. In this method there's a piece of code that tries to open and read the content of a file named `ip.txt` (this file is supposed to be in the main bundle of the app). The string returned by this method is used as hostname in the url used by React Native to call the packager we are running on our mac.
6362
Who did create this `ip.txt` file? Previously we added the execution of the `React Native Bundler` script as build phase. If we look at the source code of this script you will find the following piece of code:
6463

65-
{% include blog-lazy-image.html description="react native ip txt generation" width="1500" height="1454" src="/assets/images/posts/react-native-ip-txt-generation.jpg" %}
64+
{% include blog-lazy-image.html description="The react-native-xcode.sh script source code" width="1500" height="1454" src="/assets/images/posts/react-native-ip-txt-generation.jpg" %}
6665

6766
What?!?!?!?!?!? :satisfied: This piece of code basically creates a file named `ip.txt` that contains the IP address of your computer, extracted using an `ifconfig` command, concatenated with the domain `xip.io`. So the file will contain a string like the following one: `<your computer IP address>.xip.io`. This is the string returned by the `guessPackagerHost` method. In the screenshot below you can find the source code of this method and the string that it returns.
6867

69-
{% include blog-lazy-image.html description="react native my local ip" width="1500" height="891" src="/assets/images/posts/react-native-my-local-ip.jpg" %}
68+
{% include blog-lazy-image.html description="The react native source that reads the ip from the ip.txt file" width="1500" height="891" src="/assets/images/posts/react-native-my-local-ip.jpg" %}
7069

7170
What is the `xip.io` string added after the IP address? [xip.io](http://xip.io/ "xip.io") is a public free DNS server created at [basecamp](https://basecamp.com "basecamp"). Below you can find a quote from the homepage of the service:
7271

@@ -75,10 +74,10 @@ What is the `xip.io` string added after the IP address? [xip.io](http://xip.io/
7574
> for any IP address. Say your LAN IP address is 10.0.0.1.
7675
> Using xip.io,
7776
>
78-
> 10.0.0.1.xip.io resolves to 10.0.0.1
79-
> www.10.0.0.1.xip.io resolves to 10.0.0.1
80-
> mysite.10.0.0.1.xip.io resolves to 10.0.0.1
81-
> foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
77+
>10.0.0.1.xip.io resolves to 10.0.0.1
78+
>www.10.0.0.1.xip.io resolves to 10.0.0.1
79+
>mysite.10.0.0.1.xip.io resolves to 10.0.0.1
80+
>foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
8281
>
8382
>...and so on. You can use these domains to access virtual
8483
>hosts on your development web server from devices on your
@@ -87,8 +86,7 @@ What is the `xip.io` string added after the IP address? [xip.io](http://xip.io/
8786
>
8887
>How does it work? xip.io runs a custom DNS server on the public Internet. When your computer looks up a xip.io domain, the xip.io DNS server extracts the IP address from the domain and sends it back in the response.
8988
90-
{% include blog-lazy-image.html description="react native xip.io" width="1500" height="1181" src="/assets/images/posts/react-native-xipio.jpg" %}
89+
{% include blog-lazy-image.html description="xip.io service" width="1500" height="1181" src="/assets/images/posts/react-native-xipio.jpg" %}
9190

92-
This basically means that xip.io is a domain name we can use to access our local packager environment on our mac from
93-
our iPhone and iPad, based on the fact that the devices are all on the same network.
91+
This basically means that xip.io is a domain name we can use to access our local packager environment on our mac from our iPhone and iPad, based on the fact that the devices are all on the same network.
9492
That's all, and as you can see everything works "like magic" :relaxed:.

_posts/2018-02-17-blender-tutorial-2-selecting-transforming-objects.md

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,27 @@ authors: [fabrizio_duroni]
1616

1717
---
1818

19-
In the [first post of the "Blender tutorial" series](/2018/01/31/blender-tutorial-1-user-interface.html "Blender
20-
tutorial: user interface") we learned how the user interface is composed and the most important commands to navigate
21-
inside a scene. This time we will be focus on selecting and moving objects inside the 3D view.
22-
We can **select an object** by using the *right button of your mouse*. If you're on the MacBook like me, the right
23-
mouse is emulated in some ways (my personal preferences is to use two fingers to emulate a right click). To *select multiple
24-
objects* we can hold the *shift button and select with a right click the objects* we want. The objects that we will
25-
select will be marked in the outliner editor, with a little circle, and in the 3D view with a little border. The
26-
color of the border will change based on the theme you selected. In the screenshot below we can see that I selected
27-
2 of the 3 objects in the scene. If we have multiple objects selected, the last one will have a different border.
28-
In my case the cube is the last object selected.
29-
30-
{% include blog-lazy-image.html description="blender selecting objects 1" width="1500" height="956" src="/assets/images/posts/blender-selecting-objects-1.jpg" %}
31-
32-
To deselect an object we can just right click on it again. We can also **select all the objects** in a scene,
33-
including cameras and lights, by pressing the *"a" key*.
34-
There's also a select menu that gives us more control over the selections we can do. In particular, we have the
35-
**Circle select**, that lets us select objects based on a circle pattern of selection, and the **Border select**, that
36-
lets us select objects based on a squared pattern of selection. There are also other option to select random objects
37-
or invert the current selection.
38-
39-
{% include blog-lazy-image.html description="blender selecting objects 2" width="1500" height="956" src="/assets/images/posts/blender-selecting-objects-2.jpg" %}
40-
41-
To **translate objects**, we can use the transform tools. We can find them under *Tools -> Transform*. As a
42-
consequence of the fact that we are trying to translate an object in 3D space using the mouse pointer that works in 2D space, it is
43-
difficult to understand in which direction we are doing our translation. We can **constraint the move** to just
44-
one axis by pressing:
19+
In the [first post of the "Blender tutorial" series](/2018/01/31/blender-tutorial-1-user-interface.html "Blender tutorial: user interface") we learned how the user interface is composed and the most important commands to navigate inside a scene. This time we will be focus on selecting and moving objects inside the 3D view.
20+
We can **select an object** by using the *right button of your mouse*. If you're on the MacBook like me, the right mouse is emulated in some ways (my personal preferences is to use two fingers to emulate a right click). To *select multiple objects* we can hold the *shift button and select with a right click the objects* we want. The objects that we will select will be marked in the outliner editor, with a little circle, and in the 3D view with a little border. The color of the border will change based on the theme you selected. In the screenshot below we can see that I selected 2 of the 3 objects in the scene. If we have multiple objects selected, the last one will have a different border. In my case the cube is the last object selected.
21+
22+
{% include blog-lazy-image.html description="Object selection in Blender" width="1500" height="956" src="/assets/images/posts/blender-selecting-objects-1.jpg" %}
23+
24+
To deselect an object we can just right click on it again. We can also **select all the objects** in a scene, including cameras and lights, by pressing the *"a" key*.
25+
There's also a select menu that gives us more control over the selections we can do. In particular, we have the **Circle select**, that lets us select objects based on a circle pattern of selection, and the **Border select**, that lets us select objects based on a squared pattern of selection. There are also other option to select random objects or invert the current selection.
26+
27+
{% include blog-lazy-image.html description="Selection menu in Blender" width="1500" height="956" src="/assets/images/posts/blender-selecting-objects-2.jpg" %}
28+
29+
To **translate objects**, we can use the transform tools. We can find them under *Tools -> Transform*. As a consequence of the fact that we are trying to translate an object in 3D space using the mouse pointer that works in 2D space, it is difficult to understand in which direction we are doing our translation. We can **constraint the move** to just one axis by pressing:
4530

4631
* *"x" key* for the x axis
4732
* *"y" key* for the y axis
4833
* *"z" key* for the z axis
4934

50-
{% include blog-lazy-image.html description="blender moving objects 1" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-1.jpg" %}
35+
{% include blog-lazy-image.html description="Translation of objects in Blender" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-1.jpg" %}
5136

52-
There's also the possibility to move an object with discrete values by using its location properties panel under the
53-
properties editor or using the object properties panel in the 3D window. Finally we can move objects using also the
54-
3D manipulator widget in the 3D window. We can activate it by pressing on its icon. After that when you select and
55-
object you will see three axes. Drag one of them to translate the object in that direction.
37+
There's also the possibility to move an object with discrete values by using its location properties panel under the properties editor or using the object properties panel in the 3D window. Finally we can move objects using also the 3D manipulator widget in the 3D window. We can activate it by pressing on its icon. After that when you select and object you will see three axes. Drag one of them to translate the object in that direction.
5638

57-
{% include blog-lazy-image.html description="blender moving objects 2" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-2.jpg" %}
39+
{% include blog-lazy-image.html description="Moving objects in Blender" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-2.jpg" %}
5840

5941
We can rotate and scaling an object using the same tools we used for the translation:
6042

@@ -63,7 +45,7 @@ We can rotate and scaling an object using the same tools we used for the transla
6345

6446
One important thing to consider when we are working with transformation is the transform orientation. This option defines the orientation of the transform operation. This is very important because it influences the final result of the transform operation. You can change the transform orientation in the 3D manipulator widget.
6547

66-
{% include blog-lazy-image.html description="blender moving objects 3" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-3.jpg" %}
48+
{% include blog-lazy-image.html description="3D manipulator widget" width="1500" height="956" src="/assets/images/posts/blender-translating-objects-3.jpg" %}
6749

6850
The 3D manipulator widget will place the start of the **transform based on the origin of an objects**. We can **change it** by selecting one of the option under Object -> Transform in object mode:
6951

@@ -73,13 +55,10 @@ The 3D manipulator widget will place the start of the **transform based on the o
7355
* *Origin to Center of mass (surface)*
7456
* *Origin to center of mass (volume)*
7557

76-
{% include blog-lazy-image.html description="blender change objects origin 1" width="1500" height="956" src="/assets/images/posts/blender-change-origin-objects-1.jpg" %}
58+
{% include blog-lazy-image.html description="Object transform" width="1500" height="956" src="/assets/images/posts/blender-change-origin-objects-1.jpg" %}
7759

78-
When we want to transform a group of objects at once we have a number of options to change the pivot point of the
79-
selection. We can choose it by selecting one of the option available from the list near the 3D transform manipulator
80-
widget.
60+
When we want to transform a group of objects at once we have a number of options to change the pivot point of the selection. We can choose it by selecting one of the option available from the list near the 3D transform manipulator widget.
8161

82-
{% include blog-lazy-image.html description="blender change objects pivot 1" width="1500" height="956" src="/assets/images/posts/blender-change-pivot-objects-1.jpg" %}
62+
{% include blog-lazy-image.html description="Pivot Change" width="1500" height="956" src="/assets/images/posts/blender-change-pivot-objects-1.jpg" %}
8363

84-
That's all for selection and transform of objects. In the next post we will start to explore the art of modeling in
85-
Blender.
64+
That's all for selection and transform of objects. In the next post we will start to explore the art of modeling in Blender.

0 commit comments

Comments
 (0)