What will you be learning?
We're getting ready for Summer School 2! Our experienced development team are working hard to create the type of content that would get them signing up to this course. Some of your instructors would like to share some tips with you to give you a taster.
In Depth Unicode - A tip from Fraser Gordon
Sometimes you need to handle letters such as the Turkish İ. This has a dot over it in uppercase and not in lowercase, unlike the English i.
The LiveCode "toUpper" and "toLower" functions are language-neutral and designed for parsing. This means they sometimes do the wrong thing for human-readable text - and they won't get the Turkish i you were looking for
Here is how you can define a function that will handle this in LiveCode
function uppercase pText, pIsTurkish local tOutput repeat for each codepoint c in pText local tUpper if pIsTurkish is true and c is "i" then -- Dotted i put "İ" into tUpper else if pIsTurkish is true and c is "ı" then -- Dotless i put "I" into tUpper else put codepointProperty(c, "Uppercase Mapping") into tUpper end if put tUpper after tOutput end repeat return tOutput end uppercase
Fraser is a LiveCode Software engineer and has played a crucial part in delivering the following projects. Have a question about UniCode? Fraser is your guy.
- Unicode refactoring
- Engine restructuring
- Right to left language support
- Unicode ICU library integration
- Rasberry PI port
Unicode Best Practice - A tip from Ali Lloyd
You may know that processing Unicode is expensive in terms of engine time and resources. If you have a string with unicode in it and a bunch of native characters at the end such as "Snežana Rodić 2385762738", speed up access to the native characters by using the codepoint chunk and a negative index:
So if you wanted to get all the ID numbers from this list
Snežana Rodić 2385762738 Snežana Rodić 9487421094 Snežana Rodić 7652496092 Snežana Rodić 7653432890
without the performance hit of resolving the unicode names you could use:
local tIdList repeat for each line tLine in tUserData put codeunit -10 to -1 of tLine & return after tIdList end repeat
Ali is a LiveCode Software developer and has worked extensively on the restructuing of the LiveCode engine following the KickStarter campaign. Ali is also very heavily involved in the LiveCode 7 project.
- Engine restructure
- Unicode support
- Unicode performance optimisation
- Release note generation
App Structure - A tip from Michael McCreary
Problem: I have a good grasp on the basics of programming with LiveCode but don't know how to structure larger projects. I often find that as soon as I'm doing something that is non-trivial, my code quickly becomes confusing and hard to maintain.
Solution: A good starting point is to utilise the LiveCode message path. Try to split up your app into layers, and then use each level of the message path to implement one of those layers. A good example of this is separating out UI code from the code that does the processing. Consider a simple login interface. Maybe you have various custom controls - buttons with hover states, password fields that obfuscate user entry, auto-complete username fields. Keep the code for these operations at the control/group level. The next layer would be the extraction of data from the UI - pulling out the user name and password along with feeding back the result of the login process. Have the code for this at the group/card level. Finally, the actual login process. Again, keep this a separate process, possibly at the card/stack level.
Michael is one of our most senior LiveCode developers and has been involved in delivering some of the features that make LiveCode what it is today. Michael's projects include:
- Rewriting of the LiveCode graphics layer
- Implementing of graphics effects
- Optimising the LiveCode engine
- Proxy support
- Secure sockets
- Implementing a number of iOS / Android features
- Writing of the build system.
Resolution Independance - A tip from Ben Beaumont
The resolution independence features allow LiveCode developers to create apps at a specific size and instruct LiveCode on how to display that on a target device. This allows developers to quickly develop apps by removing the need to write code to resize all the UI for a particular device.
LiveCode is cleverly working behind the scenes to scale everything in your application and choose the best assets for the target system screen size and pixel density. For best results in terms of both performance and appearance we recommend following a few rules.
For example, when using images, you can provide the same image at a variety of sizes and LiveCode will choose the best one to use for the target device. If running on a mobile with a small screen, LiveCode will select a smaller asset increasing performance. If running on a device high resolution screen, LiveCode will select a larger asset making your app look beautiful and crisp.
Ben is the LiveCode Product Manager and he plans and designs LiveCode development with the technical team. Ben is involved in every step of delivering LiveCode and has a variety of tasks including:
- Writing requirements docs
- Prototyping ideas
- Visual design of new product features
- Planning projects with the tech team
- Planning product direction
- Supporting the marketing team
- Supporting the web team
- Developing strategies to improve the quality and robustness of the product.
- Planning the workload of the development team to ensure we get the best out of our talented dev team.
Let's say your html defines an input button with the following code:
<input id="clickMe" type="button" value="clickme" onclick="liveCode.browserButtonClick("Hello, world!");" />
You can then catch the button click in LiveCode with the handler:
on browserButtonClick pBrowser, pArg answer "Button click on browser" && pBrowser && "with message:" && pArg end browserButtonClick
Ian is a LiveCode Senior Developer and was very heavily involved in delivering the resolution independence project. Ian's projects include:
- Resolution independence
- Stack scaling
- Fullscreen scale mode
- Image caching
- Webkit browser