My new app AfsaneDB (Beta) is now in PlayStore!

Those who love reading classic literature can now enjoy literary masterpieces in this beautifully designed app.

Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Thursday, 31 December 2020

iPhone Users! Here's a Web App for Qaafiyah Expert

Tldr;

If you are in a hurry, here's the link to Qaafiyah Expert - Web:

The Web App and its Journey

Right from the beginning when I launched an android app for Qaafiyah Expert (an app to assist Urdu poets with rhymes, meter, dictionary, diary, designing and much more), people were requesting the same for iPhone users. As I was using the cross-platform approach for the app, building the same thing for iPhone wouldn't have taken so long. But the problem was, apple AppStore's pricing. I couldn't afford it. Well, most of us can't.

Anyway, after some research on pricings, I decided to go for a PWA (Progressive Web App), which is an installable app, but you don't need to pay a single penny to Google or Apple whatsoever. 

It does bring some drawbacks, but there are alternatives for most of the incompatible native-app functionalities. For a naïve user though, PWAs and native Android/ios apps are indistinguishable. For instance:

  • Visiting a Progressive Web App asks you to "Add it to Home Screen", which is alternative to "Installing an app"
  • It does have an icon, just like a native app
  • It can work offline using service workers etc.
This PWA for Qaafiyah Expert had been hosted on my domain 'q.shakeeb.in' for quite a while now, as you can see in the "first commit" here. But some of the features were not working as expected, so I didn't announce it "officially." Now that the android app has been completely rewired, performance is improved and speed is optimized, I decided to use the new code-base, modified it for the web-app and deployed it. iPhone users can now finally use this app.

If you are an android user though, I strongly recommend the android version, which has some cool extra features and obvious UX advantages.

Once again, here's the link to the web-app:

Qaafiyah Expert - Live Demo

Hope this will assist in your poetry-writing journey. 

Rab raakha! 👋

Thursday, 24 December 2020

Rekhta Content Scraper by Shakeeb Ahmad | For Programmers Only

Note: This is not yet available for non-programmers. Soon I'll make an easy-to-use version for all, iA.

This scraper with Node.js works for both prose and poetry. Check the GitHub repo for installation instructions.

You would need a text file with all the links you want to download the contents from. To get the list of links, you could manually collect all which interests you, or use the following to scrape all links from an author/poet page.

Bookmarklets - One Click Solution to get the links etc.

Rekhta loads 50 links at a time, and if user scrolls, it adds more content to the DOM. This extra fetch has not been automated in my code yet. (Well I tried, but parsing it wasted so much time that I preferred using manual scroll. Just let the page load, then press "end" on your keyboard. Wait for a moment, it will add all the remaining links.)

Anyway, once you have the complete list on the page, you can use the bookmarklets below to copy all of them with a click.

I've been testing this in browser console for a while now, i.e. open browser console, then paste the script, then change the page text to only what I need, then select and copy them manually. 

Later on I decided to use magic of bookmarklets to automate these tasks I've been doing repeatedly: 

  • Copy all the links from the Poet/Author page.
  • For LitUrdu specifically, turn them into an "object" with required properties (title, author, link, description, text) and copy it.
  • Use the "object" to automatically fill-in text-boxes on new Blogger post.
Ultimate plan is to use Blogger API and post it directly, but this bookmarklet approach doesn't hurt much because most of the things I'm doing are just a click away.

Bookmarklets
Drag and drop the links to the bookmarks bar in your browser. (Ctrl+Shift+b to toggle the bar)
Use on author/poet's page to copy all the links to their enlisted work
Use on individual poem/story page to copy an object with properties (title, author, link, description, text). Modify as per your needs.
Use on a new Blogger post after pasting the "object" from rekhta in console. This will fill in all the required fields in the new post automatically.

Saturday, 3 October 2020

Magic of Browser Bookmarks - Automate Simple Tasks using JavaScript

Automation using Bookmarklet

As I promised in #LearnedToday, I'm going to show you how much you can achieve with this little bookmark feature in the browsers.

Ever wondered how to easily remove citations from a Wikipedia page? 

What are bookmarks?

The bookmarks in the browsers are to save the links to the pages you wish to visit again, or you just find them useful and save them for later. 

Instead of creating a text file "Imp Links" and saving all the links there (I've done it a lot), you could use the browser's bookmark feature.

The shortcut to bookmark a webpage in most browsers is ctrl+b.

What more can they do?

To sum up, they can run JavaScript on a page. So instead of opening the browser console to do run a couple lines of code, you could create a bookmark and click that instead.

Example?

Whenever I needed to copy something from Wikipedia, I usually had to deal with the references/citations they have. You must've seen those, with squared brackets around numbers, something like this [1] or with a disclaimer like [citation needed], etc. I needed to remove all those. 

Initially, I used to do it in MS Word manually, by Find and Replace. I don't remember that now, doesn't matter anyway. 

Finally, I came to know about these browser bookmarklets, and then a simple regex was enough to do the work for me.

Now I have a simple bookmark. I go to any Wikipedia page, select the text I need, and click the bookmark. Viola! Citations are removed.

How to create a bookmarklet?

Got to Bookmarks Manager

1. Click three vertical dots in the upper right corner > Bookmark > Bookmark Manager

Or chrome shortcut: ctrl+shift+o

Or type in the address bar: chrome://bookmarks/

2. Click three vertical dots in the upper right corner of Bookmark manager (Shows tooltip: Organize) 

3. Add new bookmark

4. It will show a popup with two fields: Name and URL. 

5. Give any appropriate name, and in the URL bar, paste the JavaScript code you want to execute.

6. Click Save. 


You have your bookmarklet ready. 

Show/Hide Bookmarks bar with ctrl+shift+b. Clicking on the name of your bookmark will run the underlying code. 

Any easier way to do this?

If you don't want to go through all those steps, there's a simple tool called Bookmarkleter. Paste your JS code, it will generate a link that you can drag and drop to the bookmarks bar. 

For example, drag and drop the following link to your bookmarks bar. This will allow you to change fonts on any website. 

Which bookmarklets am I using?

  1. Citation Remover: Removes citations from a Wikipedia page. Drag&drop this link to the bookmarks bar: Citation Remover
  2. Set Font: If a website is using bad font, use this. As I use Urdu a lot, and Urdu without Nastaleeq font looks ugly. So I apply any font to the page available in my system. Payami Nastaleeq is the default one for me.
  3. Calci: A tiny calculator which returns results of simple arithmetic operations.
  4. StyleStripper: Strips all CSS styles from a webpage. Helpful if I don't want to load an entire page I want to copy something from. Also works on most of the sites which disable copying using JavaScript. Click StyleStripper and you can copy the text. 

Misc. bookmarklets I created

QuoraSkip: Skip Quora-enforced 'login' popup by removing added elements and blur overlay.

To those who requested, don't complain now. (Abuzar :D) I have shared it finally. More such tips will follow. Keep visiting! And I know you will. :wink:

Rab Raakha!

Saturday, 29 February 2020

Qaafiyah Expert (Android) - Release


Links:


Download Qafia expert
Qaafiyah Expert is a simple tool which contains

  1.  A rhyme generator, with support of diacritics, filter for Urdu poetic meters and 3 scripts for search. Works offline.
  2.  A lightweight diary with offline "save" support.
  3.  An online portal for awesome literary posts, updated periodically.


For those who were waiting for this

Why did it take so long?

Like always, I'd list many reasons (excuses?)
  1. God's wish.
  2. Learning android development takes some time.
  3. The basic structure had been completed in September 2019, which I had had on my mobile phone. I used to suggest qawaafi to people asking for them using the tool. But I wasn't satisfied. At the time of Windows software version (in 2016) I was new in the programming world. Not a pro now either, but whatever I've learned in these years, I thought to improve at least few things in it and add few features of my own interest. So, the app has seen many phases before being released to the public. The basic version had the same options I'd put in Windows app.
Now, those who used to constantly poke me via email or social media to provide the basic version at least, may say unspeakable things to me; but as I've said many times:
I have a constant urge to present the things in the best way possible.
So I delayed it. Although I've recently read in a gyaani's article that this bug of perfectionism should be killed ASAP.

One more reason for releasing it late is that nobody likes to update the app too many times. So, changing few things and releasing an update would do no good. And Google PlayStore, MashaAllah, bombards you with questions in every release, making it further difficult.

Requests

The app is still in the dev mode, so if you find any bug or want something to be included in the next version, please leave a review. If the response is good, I'll try to roll out next release soon.

Few features in upcoming versions

  • App interface language switch, for those who don't know Urdu script (Complete Internationalization)
  • Meanings and thesaurus on word-click
  • Taqti (Poetic Meter calculation)
  • Poetry workshop
I've two requests for you. First, to report bugs if you find any and if you want any other feature to be included in this app (other than the 4 mentioned above) then comment on the Play Store's rating page.
Second, If you have an idea for a new app, go to "online" section of this app and submit your idea on "Ek app aisi bhi."

I've few app ideas of my own interest, have to finish them too. Remember me in your supplications. 

Shakeeb Ahmad
February 16, 2020
Telegram: ShakesVision

Saturday, 18 March 2017

Programming Challenge #1: Add Up To Second Number

Hello programmers. I am starting a series of programming challenges for beginners here. I'll post the problems with some explanation, screenshot of the final output and a little bit of hint if it is really needed. Solve your problems using any programming language you are comfortable with.

Here goes the first problem.

Programming Challenge #1: Add Up To Second Number

Details: Write a program which asks users to input two numbers. Your task is to add all the consecutive numbers from first number to second.
Example: 
Input 1: 1
Input 2: 10
Answer: 55

Additional Task(optional): Show the numbers being add. 

Final Output Screenshot: