Ant and Buffalo
Sunday, September 24, 2023
Quick Note Privacy Policy
Privacy Policy for Quick Note
Last updated: 24 Sep 2023
This Privacy Policy explains how Ant and Buffalo collects, uses, and protects the information you provide when you use Quick Note (the "App"). By using the App, you consent to the practices described in this policy.
Information We Collect
The App does not collect or transmit any personal or user data to external servers or third parties. All notes and text entered in the App are stored locally on your device.
How We Use Information
We do not collect or use any information from the App, as it is designed to work exclusively on your device without the need for external data storage or transmission.
Security
We take reasonable precautions to protect the data stored on your device through the App. However, please be aware that no method of transmission or storage over the internet is entirely secure, and we cannot guarantee the security of your data.
Changes to this Privacy Policy
We may update this Privacy Policy from time to time to reflect changes in our practices or for other operational, legal, or regulatory reasons. Any updates will be posted in the App, and the "Last updated" date at the top of this policy will be revised accordingly.
Contact Us
If you have any questions or concerns about this Privacy Policy or your use of the App, please contact us at antandbuffalo@gmail.com.
Friday, May 1, 2020
Chakra Vyugam and Asymmetric Encryption
#RandomThoughts
The Chakra Vyugam is a military formation used to surround enemies, depicted in the Hindu epic Mahabharata (Wikipedia)
I personally like this Vyugam. I searched a lot to find out, how it actually works. But couldn't find any article. Everywhere people are explaining what this formation is all about. No one explains how it actually works.
May be it is not explained in Mahabharata itself. I am not sure.
According to the epic, only 3 people know how to destroy this formation. How to go inside the formation and come out of it. The three great warriors: Bheeshmar, Dronar and Arjunan.
Abhimanyu (Son of Arjuna) knows how to go inside the formation but he doesn't know how to come out of it. I was thinking, how does a person know to go inside but doesn't know to come out of it?
Then I started comparing this Vyugam with Asymmetric encryption, where we use one key to encrypt the data and another key to decrypt. Then I was quite confident, this kind of formation is definitely possible.
At this point I am beginning to think Asymmetric encryption is similar to the concept of Chakra Vyugam. One kind of technique to go inside the formation and another kind of technique to come out of the formation.
So if we directly compare, the Chakra Vyugam itself the Asymmetric algorithm.
The public key used to encrypt the data is the technique to go inside the formation.
The private key used to decrypt the data is the technique to come out of the formation.
If we encrypt the data without knowing the private key, then there is no way to decrypt it. The data is lost forever. Same way, without knowing the technique to come out of the formation, Abhimanu went inside the formation and the great warrior lost his life.
Give me your thoughts in comments. Thanks.
Thanks to my friends, for correcting some mistakes :)
Previous (Observer Pattern in AngularJS)
The Chakra Vyugam is a military formation used to surround enemies, depicted in the Hindu epic Mahabharata (Wikipedia)
I personally like this Vyugam. I searched a lot to find out, how it actually works. But couldn't find any article. Everywhere people are explaining what this formation is all about. No one explains how it actually works.
May be it is not explained in Mahabharata itself. I am not sure.
According to the epic, only 3 people know how to destroy this formation. How to go inside the formation and come out of it. The three great warriors: Bheeshmar, Dronar and Arjunan.
Abhimanyu (Son of Arjuna) knows how to go inside the formation but he doesn't know how to come out of it. I was thinking, how does a person know to go inside but doesn't know to come out of it?
Then I started comparing this Vyugam with Asymmetric encryption, where we use one key to encrypt the data and another key to decrypt. Then I was quite confident, this kind of formation is definitely possible.
At this point I am beginning to think Asymmetric encryption is similar to the concept of Chakra Vyugam. One kind of technique to go inside the formation and another kind of technique to come out of the formation.
So if we directly compare, the Chakra Vyugam itself the Asymmetric algorithm.
The public key used to encrypt the data is the technique to go inside the formation.
The private key used to decrypt the data is the technique to come out of the formation.
If we encrypt the data without knowing the private key, then there is no way to decrypt it. The data is lost forever. Same way, without knowing the technique to come out of the formation, Abhimanu went inside the formation and the great warrior lost his life.
Give me your thoughts in comments. Thanks.
Thanks to my friends, for correcting some mistakes :)
Previous (Observer Pattern in AngularJS)
Tuesday, October 20, 2015
Observer pattern in AngularJS
I have implemented Observer pattern to solve an issue that I was facing in my project. This post is regarding my implementation.
In my current project, when there is a change in URL, the controller will call angular service to get the data from server. But during the start of the application, URL redirect happens multiple times, which makes the controller to call the service multiple times.
I tried many options to prevent it from controller itself (from where it is getting called); but that made my code ugly and complex.
So I left the controller as it is and tried to implement my logic in angular service. I decided to use observers to prevent multiple calls to the server.
Have a look at the example in plunker (http://plnkr.co/edit/IBK7xX?p=preview)
The basic design of the example application is,
- It has an angular service, which makes request to server and gets the data (services.js - myService)
- It has a controller, which calls angular service to get the data and bind to the view (script.js - MyController)
- It has a html view, which bind with the controller (index.html)
To simulate the issue, I will call the service inside a for-loop from my controller. The loop will call the function 3 times. Without observers, the service hits the server 3 times and gets the response. Below is the console from Firebug.
This example gets the latitude and longitude of given location using Google api.
Our ultimate aim is to decrease the number of request to server; the immediate thing comes into our mind is Cache. But Cache will not help here, as all the requests are hitting the server at the same time.
The next option is Observer pattern.
I have created a local variable "observers" (array) in services.js. Whenever the service get multiple requests, the service will send only one request to server and add the references of all other requests to the observers array (have a look at services.js file). When the service receive response from the server, it will also send the response to all the observers who requested the same data and remove its reference from the observers array.
Click "Send Multiple Request" in the example and check the console in Firebug or Networks tab in Chrome. You will see 3 requests.
Click "Send Multiple Request With Observer" in the example and check the console in Firebug or Networks tab in Chrome. You will see only one request sent to server. But all the 3 requests are resolved properly once the response is received.
One more example is here (http://plnkr.co/edit/xzUV2U?p=preview) which supports multiple functions in the service.
-Jeyabalaji
In my current project, when there is a change in URL, the controller will call angular service to get the data from server. But during the start of the application, URL redirect happens multiple times, which makes the controller to call the service multiple times.
I tried many options to prevent it from controller itself (from where it is getting called); but that made my code ugly and complex.
So I left the controller as it is and tried to implement my logic in angular service. I decided to use observers to prevent multiple calls to the server.
Have a look at the example in plunker (http://plnkr.co/edit/IBK7xX?p=preview)
The basic design of the example application is,
- It has an angular service, which makes request to server and gets the data (services.js - myService)
- It has a controller, which calls angular service to get the data and bind to the view (script.js - MyController)
- It has a html view, which bind with the controller (index.html)
To simulate the issue, I will call the service inside a for-loop from my controller. The loop will call the function 3 times. Without observers, the service hits the server 3 times and gets the response. Below is the console from Firebug.
This example gets the latitude and longitude of given location using Google api.
Our ultimate aim is to decrease the number of request to server; the immediate thing comes into our mind is Cache. But Cache will not help here, as all the requests are hitting the server at the same time.
The next option is Observer pattern.
I have created a local variable "observers" (array) in services.js. Whenever the service get multiple requests, the service will send only one request to server and add the references of all other requests to the observers array (have a look at services.js file). When the service receive response from the server, it will also send the response to all the observers who requested the same data and remove its reference from the observers array.
Click "Send Multiple Request" in the example and check the console in Firebug or Networks tab in Chrome. You will see 3 requests.
Click "Send Multiple Request With Observer" in the example and check the console in Firebug or Networks tab in Chrome. You will see only one request sent to server. But all the 3 requests are resolved properly once the response is received.
One more example is here (http://plnkr.co/edit/xzUV2U?p=preview) which supports multiple functions in the service.
-Jeyabalaji
Tuesday, June 24, 2014
Column specific filter – AngularJS
Hi Guys,
Recently I started working on AngularJS.
We got a requirement that we have to filter a table specific to columns.
I thought I get something directly from internet, so I can copy, paste. But I didn’t get any :(
The options that are available in default AngularJS filters are,
- Search the entire table using the given search string.
- Specify particular columns to search. (This looks like solving our problem. But it didn’t)
The problem in this available approach is, the filter always search the columns with AND condition.
ie., If I have 4 columns in my table say, “Id, Name, City, Country”. I can configure the filter like {name:my_search_string, city:my_search_string} to search in “name” and “city” column alone. (Leaving Id and Country)
Eg:
Sample data:
Id: 1 Name: Balaji City: Chennai Country: India
Id: 2 Name: Goutham City: Kansas Country: America
Id: 3 Name: Dinesh City: Dubai Country: UAE
Id: 4 Name: Satheesh City: Helsinki Country: Finland
If my_search_string = ‘b’, this configured filter search for b in Name AND in City. So it will not return any record.
But according to our requirement it should search the columns using OR condition and should return two records (which has ‘b’ in Name or in City)
Id: 1 Name: Balaji City: Chennai Country: India
Id: 3 Name: Dinesh City: Dubai Country: UAE
(try it out in plunker)
This is also useful when we have hidden columns. Like, if we have 10 columns in my data and I want to display only 5 to the user.
In this case we will get weird results, as the normal filter consider all the 10 columns instead of only the visible 5 columns.
I didn’t get any filter options to solve this problem. So I tried to put lot of fixes and make it work. But my architect didn’t accept those fixes and told me to write a custom filter (my mind voice: therija elutha maatoma) which accepts the column keys as inputs and search only in that column. Finally I have written one column specific filter (after lot of googling).
Column Specific Filter:
Syntax: columnSpecificFilter: my_input_string (String): column_keys_to_search(String Array)
Eg: columnSpecificFilter: ’b’: [“name”, “city”]
You can find an example here.
Monday, January 20, 2014
Designing reusable component – iOS
Hi All,
I created UIFormattedTextField as a component. I would like to provide the gist of conversation between me and the Architect during development here.
The Architect of my project always encourages the team to develop reusable components and use that in the project.
Current project requirement is to get the amount as input from the user.
Demo1:
So I started working on it. I created a normal textfield which accepts both number and character. But while submitting the form it gives an error, “Please enter only number”. I demoed it.
Architect: Hey we are developing this for mobile device. The current implementation will annoy the user. So modify the text field, which accepts only number instead of giving the error at last.
Demo2:
The real development, googling, coding everything starts here. Changed the text field to accept only numbers and dot and it will format the number by putting commas.
Architect: Good work man. This is a currency field right. why can’t we put a currency symbol?
Me: We can place a label before the text field and put the symbol, simply we can hard code and finish it off.
Architect: Then its not dynamic. Put the symbol in the text Field itself. Also make it localized. So when I change the device location to India it should show Rupee symbol and format the number according to Indian format.
My mind voice: Super. Google will help me.
Demo3:
Done all the comments given in demo2. So now the text field will format and show the currency symbol according to current location.
For India:
For US:
Architect: Super. Its looking good. So why can’t we make it as a component so that I can set the type of the text field as Currency, Number, PhoneNumber, SSN etc and text field should behave according to the given type.
Me: Yes we can.
Demo4:
Everything done. Now we can set the type of the text field.
Architect: Ya good. Ok now we can start using this. Circulate this to all our team members.
Me: Ya sure. But while working on this, I thought, instead of giving the type separately, like PhoneNumber, SSN etc. I will remove all these types and give an option dynamic. So you can set the type “Dynamic” and define your own pattern in the format xxx-xxx-xxxx (for US Phone number), xxx-xx-xxxx (for SSN) so we can avoid lot of options.
Architect: That is also good option. Do that and distribute across team.
Everything done. Now the text field accept the types,
1. Currency
2. Number
3. FormattedNumber
4. Percentage
5. Dynamic
If you look at the code, you can see some other types too which is used before the introduction of Dynamic. Now you can achieve the same using Dynamic and FomatPattern.
After this entire development, I learnt how to think and design before actually start our coding. Thanks to my Architect who taught me how to think “Mobile” while developing each and every feature.
How to use the component in your iOS projects:
1. Drag and drop the “UIFormattedTextField.h” and “UIFormattedTextField.m” files to your project.
2. Import the header in your class, where do you want to use it.
#import “UIFormattedTextField.h”
3. If you are using xib or storyboard, change the class of the text field in the “Identity inspector” to UIFormattedTextField.
4. Create an instance variable to access the text field.
IBOutlet UIFormattedTextField *currency;
5. Set the type and delegate of the text field. Don’t forget to import the delegate <UITextFieldDelegate>
currency.type = @”Currency”;
currency.delegate = self;
currency.numberOfDecimalPlaces = 3;
6. You have to change the delegate function ,
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return YES;
}
to
-(BOOL)textField:(UIFormattedTextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return [textField shouldChangeCharactersInRange:range replacementString:string];
}
7. You are done.
You can download the sample project here FormattedTextFieldDemo.
Screenshot:
I created UIFormattedTextField as a component. I would like to provide the gist of conversation between me and the Architect during development here.
The Architect of my project always encourages the team to develop reusable components and use that in the project.
Current project requirement is to get the amount as input from the user.
Demo1:
So I started working on it. I created a normal textfield which accepts both number and character. But while submitting the form it gives an error, “Please enter only number”. I demoed it.
Architect: Hey we are developing this for mobile device. The current implementation will annoy the user. So modify the text field, which accepts only number instead of giving the error at last.
Demo2:
The real development, googling, coding everything starts here. Changed the text field to accept only numbers and dot and it will format the number by putting commas.
Architect: Good work man. This is a currency field right. why can’t we put a currency symbol?
Me: We can place a label before the text field and put the symbol, simply we can hard code and finish it off.
Architect: Then its not dynamic. Put the symbol in the text Field itself. Also make it localized. So when I change the device location to India it should show Rupee symbol and format the number according to Indian format.
My mind voice: Super. Google will help me.
Demo3:
Done all the comments given in demo2. So now the text field will format and show the currency symbol according to current location.
For India:
For US:
Architect: Super. Its looking good. So why can’t we make it as a component so that I can set the type of the text field as Currency, Number, PhoneNumber, SSN etc and text field should behave according to the given type.
Me: Yes we can.
Demo4:
Everything done. Now we can set the type of the text field.
Architect: Ya good. Ok now we can start using this. Circulate this to all our team members.
Me: Ya sure. But while working on this, I thought, instead of giving the type separately, like PhoneNumber, SSN etc. I will remove all these types and give an option dynamic. So you can set the type “Dynamic” and define your own pattern in the format xxx-xxx-xxxx (for US Phone number), xxx-xx-xxxx (for SSN) so we can avoid lot of options.
Architect: That is also good option. Do that and distribute across team.
Everything done. Now the text field accept the types,
1. Currency
2. Number
3. FormattedNumber
4. Percentage
5. Dynamic
If you look at the code, you can see some other types too which is used before the introduction of Dynamic. Now you can achieve the same using Dynamic and FomatPattern.
After this entire development, I learnt how to think and design before actually start our coding. Thanks to my Architect who taught me how to think “Mobile” while developing each and every feature.
How to use the component in your iOS projects:
1. Drag and drop the “UIFormattedTextField.h” and “UIFormattedTextField.m” files to your project.
2. Import the header in your class, where do you want to use it.
#import “UIFormattedTextField.h”
3. If you are using xib or storyboard, change the class of the text field in the “Identity inspector” to UIFormattedTextField.
4. Create an instance variable to access the text field.
IBOutlet UIFormattedTextField *currency;
5. Set the type and delegate of the text field. Don’t forget to import the delegate <UITextFieldDelegate>
currency.type = @”Currency”;
currency.delegate = self;
currency.numberOfDecimalPlaces = 3;
6. You have to change the delegate function ,
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return YES;
}
to
-(BOOL)textField:(UIFormattedTextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return [textField shouldChangeCharactersInRange:range replacementString:string];
}
7. You are done.
You can download the sample project here FormattedTextFieldDemo.
Screenshot:
Friday, May 3, 2013
Speech to Text Apis
Hi All,
Most of the people don’t prefer to write. Instead, they search for alternate options in order to save time. If nothing is feasible, then only they choose to write. This paved way for lot of technological advancements like Xerox machine, Scanner, Printer etc. Same way, when it comes to mobile device, people don’t prefer to type because of the smaller size keyboard and other constraints.
One of my friends recently bought a big screen smartphone. It is not comfortable to place the phone in pocket because of the size. I asked him why didn’t you buy a normal size phone. He replied that in this big screen itself he had difficulties in keying-in the keypad letters. Seems most of the time he touched two letters instead of one.
Same way, when you are driving or doing some other work, you will find it difficult to pick the phone and type. This is the place where speech to text conversion plays an important role. I used couple of speech to text APIs in my iOS apps. Here are some frameworks which might be useful for you too.
1. OpenEars
This is a open source framework available for iOS. We can directly download the framework and start developing the apps. It supports both speech to text and text to speech conversion. This works completely offline. The only downfall is since it works offline, you have to define a dictionary of words you want it to recognize.
This library is very much useful when we want to pick only certain words from speech. e.g.: I used this library for navigating views and filling datas in an application. When the user says “Go to Home”, the app will navigate to home page. Also I can fill the form data (refer screenshot of the app) as, “set current age 25″, “set gender male” so the app will fill the data properly.
Here I created the dictionary with the words I want the app to recognize. For directly converting all the speech to text, we have to build the dictionary containing all the words so that it will recognize the speech and convert it into text. Words database are already available in the net. We can directly use that or we can use our own set of words.
http://www.politepix.com/openears/
2. SpeechKit
This is another framework which will convert speech to text using a server. Implementing this framework is much easier than OpenEars. We don’t have to define dictionary of words or anything, just open the view already available with the framework. (it will give us the UI also). It will recognize the speech and send us the text in a callback function. The only drawback is that it needs internet connectivity.
http://dragonmobile.nuancemobiledeveloper.com/public/Help/DragonMobileSDKReference_iOS/SpeechKit_Guide/Basics.html
Also there are lot of other frameworks available for converting speech to text. We have to decide the one which fulfills our needs.
Bye Till Next,
- Jeyabalaji
Most of the people don’t prefer to write. Instead, they search for alternate options in order to save time. If nothing is feasible, then only they choose to write. This paved way for lot of technological advancements like Xerox machine, Scanner, Printer etc. Same way, when it comes to mobile device, people don’t prefer to type because of the smaller size keyboard and other constraints.
One of my friends recently bought a big screen smartphone. It is not comfortable to place the phone in pocket because of the size. I asked him why didn’t you buy a normal size phone. He replied that in this big screen itself he had difficulties in keying-in the keypad letters. Seems most of the time he touched two letters instead of one.
Same way, when you are driving or doing some other work, you will find it difficult to pick the phone and type. This is the place where speech to text conversion plays an important role. I used couple of speech to text APIs in my iOS apps. Here are some frameworks which might be useful for you too.
1. OpenEars
This is a open source framework available for iOS. We can directly download the framework and start developing the apps. It supports both speech to text and text to speech conversion. This works completely offline. The only downfall is since it works offline, you have to define a dictionary of words you want it to recognize.
This library is very much useful when we want to pick only certain words from speech. e.g.: I used this library for navigating views and filling datas in an application. When the user says “Go to Home”, the app will navigate to home page. Also I can fill the form data (refer screenshot of the app) as, “set current age 25″, “set gender male” so the app will fill the data properly.
Here I created the dictionary with the words I want the app to recognize. For directly converting all the speech to text, we have to build the dictionary containing all the words so that it will recognize the speech and convert it into text. Words database are already available in the net. We can directly use that or we can use our own set of words.
http://www.politepix.com/openears/
2. SpeechKit
This is another framework which will convert speech to text using a server. Implementing this framework is much easier than OpenEars. We don’t have to define dictionary of words or anything, just open the view already available with the framework. (it will give us the UI also). It will recognize the speech and send us the text in a callback function. The only drawback is that it needs internet connectivity.
http://dragonmobile.nuancemobiledeveloper.com/public/Help/DragonMobileSDKReference_iOS/SpeechKit_Guide/Basics.html
Also there are lot of other frameworks available for converting speech to text. We have to decide the one which fulfills our needs.
Bye Till Next,
- Jeyabalaji
Labels:
api,
ios,
ipad,
iphone,
speech to text,
text to speech
Subscribe to:
Posts (Atom)