View trie.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import total_ordering | |
@total_ordering | |
class TreeNode: | |
""" | |
General purpose multi-children Tree Node class. | |
""" | |
def __init__(self, data): |
View approach2-crontab-monitoring-thread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JobRunnable implements Runnable | |
{ | |
private final Job job; | |
public JobRunnable(Job job) | |
{ | |
this.job = job; | |
} | |
@Override | |
void run() |
View approach1-crontab-monitoring-thread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
void run() | |
{ | |
while(true) | |
{ | |
newJob = getNewJobFromCrontabFile() // blocking call | |
JobThread newJobThread = new JobThread(newJob); | |
newJobThread.start(); | |
} | |
} |
View approach3-queue-producer-thread-incorrect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
void run() | |
{ | |
while(true) | |
{ | |
newJob = getNewJobFromCrontabFile() // blocking call | |
jobQueue.push(newJob) | |
} | |
} |
View approach3-queue-producer-thread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
void run() | |
{ | |
while(true) | |
{ | |
newJob = getNewJobFromCrontabFile() // blocking call | |
jobQueue.push(newJob) | |
if(newJob == jobQueue.peek()) | |
{ | |
// The new job is the one that will be scheduled next. |
View approach3-queue-consumer-thread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void goToSleep(job, jobQueue){ | |
jobQueue.push(job); | |
sleep(job.nextExecutionTime() - getCurrentTime()); | |
} | |
void executeJob(job, jobQueue){ | |
threadpool.submit(job); // async call | |
job = job.copy(); | |
job.setNextExecutionTime(getCurrentTime() + job.getExecutionInterval()); | |
jobQueue.add(job); |
View approach1-dedicated-thread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
void run() | |
{ | |
while(true) | |
{ | |
Thread.sleep(job.getNextExecutionTime() - currentTime()); | |
job.execute(); | |
job.setNextExecutionTime(currentTime() + job.getExecutionInterval()); | |
} | |
} |
View ad.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A room is available in a 3 BHK apartment in 'Pramuk Aqua Heights Apartments', Electronic City Phase 1. | |
It is available on both, private as well as on a sharing basis. | |
**About the room** : | |
- Attached wardrobe. | |
- Dressing table with mirror. | |
- Attached bathroom with Geyser and all other fittings. | |
- Lake facing (balcony side). | |
- Dimensions = 156 x 116 in. |
View add_cmd_autorun.reg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor] "Autorun"="%USERPROFILE%/Documents/cmd_autorun.cmd" |
View cmd_autorun.cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cls | |
doskey /macrofile=%USERPROFILE%\Documents\cmd_aliases.txt |
NewerOlder