Posts

Why we call the signal function in the start of the linux c program? -

the program simple, have handler function named fintr() , program is: void fintr(); int main() { int i; signal(sigint,fintr); while(1) { printf("*"); } return 0; } void fintr() { printf("signal received"); exit(1); } can put signal(sigint,fintr); @ end of function main() ? , why have put in beginning of main() ? putting @ end means come after while (1) ... loop, no, can't put in end, because never executed. also, pay attention code place inside signal handlers: not safe call printf() inside signal handler.

Python: How would I compare two strings using a function with only one of the strings as an argument? -

i've created class, , unsure how approach following problem. possible create function able in example? (for practical uses, comparing dates , returning true if day , month same not years same) example: >>>strvar1 = 'abc-123' >>>strvar2 = 'abc-456' >>>strvar1.myfunction(strvar2) true class code class date(object): def __init__(self, x0 = 1900, y0 = 1, z0 = 1): self.x = x0 self.y = y0 self.z = z0 def __str__(self): date = str(self.x) + "-" + str(self.y).rjust(2, '0') + "-" + str(self.z).rjust(2, '0') return date def myfunction(j): so example like: d1 = date(1999, 1, 1) //d1 = "1999-01-01" d2 = date(2000, 2, 2) //d2 = "2000-02-02" d3 = date(2001, 2, 2) //d3 = "2001-02-02" >>>d1.myfunction(d2) false >>>d2.myfuction(d3) true yes absolutely, reason having classes. read on https://d...

php - query inside while loop only shows 1 result -

i'm making while loop in php , goes problem don't want id of user other stuff inside table, when go ahead , make query inside while loop , select second table (where id equal id of result first query), returns 1 result... so code have: public function getfriends($id) { global $params; $get = $this->db->select("{$this->db['data']['friends']['tbl']}", "*", array( "{$this->db['data']['friends']['one']}" => $id ) ); if($get) { while($key = $get->fetch()) { $query = $this->db->query("select * {$this->db['data']['users']['tbl']} {$this->db['data']['users']['id']} = :id", array( ...

javascript - addition in angular js -

i'm new angular.js , have simple question. trying make calculator takes input , adds input value total. however, scope.add function not work. below code. appreciated. html code: <div class="card"> <div class="item item-text-wrap" style="font-size: 35px; text-align: right"> {{result}} total </div> </div> <div class="padding"> <label class="item item-input"> <input class="input-label" placeholder="add" type="tel" ng-model="t" style="font-size: 35px; text-align: right"> calories </label> </div> <div class="row"> <button class="button ion-refresh button-balanced col" ng-click="reset()" style="font-size: 40px"></button> <button class="button ion-plus-round button-calm col" ng-click="add(t)" style="font...

vb.net - Javascript alert for ASP.NET (VB) will not appear? -

for reason message box not show up. type in code 0 errors, run page, click button, , nothing happens. idea what's going on? here code: protected sub btncheckin(byval sender object, byval e system.eventargs) dim message string = "checked-in!" dim sb new system.text.stringbuilder() sb.append("<script type = 'text/javascript'>") sb.append("window.onload=function(){") sb.append("alert('") sb.append(message) sb.append("')};") sb.append("</script>") clientscript.registerclientscriptblock(me.gettype(), "alert", sb.tostring()) end sub

Automatically turn on enriched mode and make newlines between paragraphs hard in Emacs -

i want turn on enriched-mode in emacs default, *scratch* buffer open in mode. i've got *scratch* persistent across sessions ( http://dorophone.blogspot.com/2011/11/how-to-make-emacs-scratch-buffer.html ). i added (enriched-mode) .emacs file, every start need answer question: make newlines between paragraphs hard? (y or n) . tried add (use-hard-newlines) before or after (enriched-mode) , add 'yes , 1 , others both commands, doesn't work. c-h f enriched-mode shows no answer. i did today. first of loading of autosaved scratch file done shell's cat function , replaced insert-file . (enriched-mode) had added loading script. once scratch edited rich text ( m-x enriched-mode , answering hard-lines prompt) open in enrichment mode without prompting. here's function: (defun load-persistent-scratch () "load contents of persistent-scratch-filename scratch buffer, clearing contents first." (if (file-exists-p persistent-scratch-filenam...

dynamics crm - Workflow to send an email to the users within the record is shared -

i using microsoft dynamics crm 2015 on-premise version. i created custom entity(news). use of entity: system administrator can share records(news) selected system users. my question: how send email notification (to selected users) on record sharing? there isn't built in functionality run workflow on users selected in record sharing form/window. if wanted users able run workflow send email particular record based on shared to, need have crm plugin written and/or custom web resource built if wanted more of manual process sent when user says run workflow vs. plugin can setup run time when record shared user. below few links of example crm plugin code has been written send email out users whom record has been shared them. https://social.microsoft.com/forums/en-us/1b40cb49-d62c-4a71-9282-a9a8b255446d/send-email-to-shared-users?forum=crm https://social.microsoft.com/forums/en-us/68fc025e-360f-4afc-af72-d59c0665a099/to-send-email-to-shared-users-with-whom-the-lead...