Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

metadata

How can I add macOS “Tags” to files programmatically?

April 1, 2024 by Tarik

Check out tag, “a command line tool to manipulate tags on Mac OS X 10.9 Mavericks files, and to query for files with those tags”. The GitHub repository has installation instructions (there are Homebrew and MacPorts packages).

Categories macos Tags cocoa, command-line-tool, macos, metadata Leave a comment

What are some uses of Clojure metadata?

January 6, 2024 by Tarik

Docstrings are stored as metadata under the :doc key. This is probably the number 1 most apparent use of metadata. Return and parameter types can be optionally tagged with metadata to improve performance by avoiding the overhead of reflecting on the types at runtime. These are also known as “type hints.” #^String is a type … Read more

Categories functional-programming Tags clojure, functional-programming, metadata Leave a comment

How can I get the definition (body) of a trigger in SQL Server?

December 31, 2023 by Tarik

sp_helptext works to get the sql that makes up a trigger. The text column in the syscomments view also contains the sql used for object creation.

Categories sql-server Tags metadata, sql-server, triggers Leave a comment

What is the origin of __author__?

December 17, 2023 by Tarik

My guess is, it’s from the old times when packaging meta data was not common then. In PEP 8 one is encouraged to use the _version_ top level variable to hold the revision id of the versioning system in use. This dates back to 2001-05-01. PEP 396 is superseding this for module _version_ attributes. For … Read more

Categories python Tags metadata, python Leave a comment

How do you embed album art into an MP3 using Python?

December 13, 2023 by Tarik

Here is how to add example.png as album cover into example.mp3 with mutagen: from mutagen.mp3 import MP3 from mutagen.id3 import ID3, APIC, error audio = MP3(‘example.mp3’, ID3=ID3) # add ID3 tag if it doesn’t exist try: audio.add_tags() except error: pass audio.tags.add( APIC( encoding=3, # 3 is for utf-8 mime=”image/png”, # image/jpeg or image/png type=3, # … Read more

Categories python Tags albumart, id3, metadata, mp3, python Leave a comment

How to extract metadata from an image using python?

December 11, 2023 by Tarik

Use Pillow, it’s a fork of PIL that is still in active development, and supports python3. Here I use a dict generator to map the exif data to a dict from PIL import Image, ExifTags img = Image.open(“/path/to/file.jpg”) exif = { ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS }

Categories python Tags extract, image, metadata, python Leave a comment

Is there a way to alter column type in hive table?

December 7, 2023 by Tarik

Found the solution: ALTER TABLE tableA CHANGE ts ts BIGINT AFTER id; See this for complete details: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-AlterColumn

Categories hive Tags hive, metadata Leave a comment

Can matplotlib add metadata to saved figures?

December 5, 2023 by Tarik

I don’t know of a way using matplotlib, but you can add metadata to png’s with PIL: f = “test.png” METADATA = {“version”:”1.0″, “OP”:”ihuston”} # Create a sample image import pylab as plt import numpy as np X = np.random.random((50,50)) plt.imshow(X) plt.savefig(f) # Use PIL to save some image metadata from PIL import Image from … Read more

Categories python Tags matplotlib, metadata, python Leave a comment

Is it possible to add a description/comment to a table in Microsoft SQL 2000+

December 2, 2023 by Tarik

Use extended properties. For example to add an extended property to a table in the dbo schema you can use: EXEC sys.sp_addextendedproperty @name=N'<NameOfProp>’, @value=N'<Value>’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’,@level1name=N'<Table>’ You can update them: EXEC sys.sp_updateextendedproperty @name=N’MS_Description’, @value=N’My Description’ , @level0type=N’SCHEMA’,@level0name=N’dbo’, @level1type=N’TABLE’ ,@level1name=N'<YOUR TABLE NAME>’ You can read them like: SELECT * FROM fn_listextendedproperty (NULL, ‘schema’,’dbo’, ‘table’, ‘<yourtable>’, … Read more

Categories sql-server Tags metadata, sql-server Leave a comment

Finding a list of all double-underscore variables?

November 29, 2023 by Tarik

If you want to see magic names whether documented or not, go to the Lib directory and run: egrep -oh ‘__[A-Za-z_][A-Za-z_0-9]*__’ *.py | sort | uniq That produces: ‘__all__’ ‘__args__’ ‘__author__’ ‘__bases__’ ‘__builtin__’ ‘__builtins__’ ‘__cached__’ ‘__call__’ ‘__class__’ ‘__copy__’ ‘__credits__’ ‘__date__’ ‘__decimal_context__’ ‘__deepcopy__’ ‘__dict__’ ‘__doc__’ ‘__exception__’ ‘__file__’ ‘__flags__’ ‘__ge__’ ‘__getinitargs__’ ‘__getstate__’ ‘__gt__’ ‘__import__’ ‘__importer__’ ‘__init__’ ‘__ispkg__’ … Read more

Categories python Tags conventions, metadata, python Leave a comment
Older posts
Page1 Page2 … Page7 Next →

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa