oracle blob text search

This is quite possible and easy to do. Simply use dbms_lob.instr in conjunction with utl_raw.cast_to_raw So in your case, if t1 is a BLOB the select would look like: select * from table1 where dbms_lob.instr (t1, — the blob utl_raw.cast_to_raw (‘foo’), — the search string cast to raw 1, — where to start. i.e. offset … Read more

How to optimally solve the flood fill puzzle?

As a heuristic, you could construct a graph where each node represents a set of contiguous, same-colour squares, and each node is connected to those it touches. (Each edge weighted as 1). You could then use a path-finding algorithm to calculate the “distance” from the top left to all other nodes. Then, by looking the … Read more

find svn revision by removed text

Building on khmarbaise’s script, I came up with this: #!/bin/bash file=”$1″ REVISIONS=`svn log $file -q –stop-on-copy |grep “^r” | cut -d”r” -f2 | cut -d” ” -f1` for rev in $REVISIONS; do prevRev=$(($rev-1)) difftext=`svn diff –old=$file@$prevRev –new=$file@$rev | tr -s ” ” | grep -v ” -\ \- ” | grep -e “$2″` if [ … Read more

O(klogk) time algorithm to find kth smallest element from a binary heap

Well, your intuition was right that we need extra data structure to achieve O(klogk) because if we simply perform operations on the original heap, the term logn will remain in the resulting complexity. Guessing from the targeted complexity O(klogk), I feel like creating and maintaining a heap of size k to help me achieve the … Read more

Fuzzy Searching with Mongodb?

I believe that to do “fuzzy” search you will need to use regex. This should accomplish what you’re looking for (escapeRegex function source here): function escapeRegex(text) { return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, “\\$&”); }; router.get(“https://stackoverflow.com/”, function(req, res) { if (req.query.search) { const regex = new RegExp(escapeRegex(req.query.search), ‘gi’); Jobs.find({ “name”: regex }, function(err, foundjobs) { if(err) { console.log(err); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)