Posts

broadcastreceiver - Need to run my app before the unlock screen in android -

i need run app user clicks on unlock screen. have used action_user_present intent in broadcastreceiver check. used following code. need show app before unlock screen. app visible after unlock screen. appreciated. my broadcastreceiver package com.progressindicator; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.view.windowmanager; public class receive extends broadcastreceiver { @override public void onreceive(context context, intent intent) { // todo auto-generated method stub if (intent.getaction() != null) { if (intent.getaction().equals(intent.action_user_present)) { intent s = new intent(context, progressindicator.class); s.setflags(intent.flag_activity_brought_to_front); // s.setflags(windowmanager.layoutparams.flag_dismiss_keyguard); s.setflags(intent.flag_activity_clear_top); s.a...

Git : Confuse after merge -

this question has answer here: git merge left head marks in files 3 answers i new git. recently, merged code feature master branch. after merging .gitignore file looks this <<<<<<< head gen/ bin/ ======= gen/ >>>>>>> master now question is if want change content of file, should follow special instruction or can change file , commit ? what meaning of sign <<<<<<< head >>>>>>> master ? if remove head , master file. generate error ? it shows in current head , , in master branch. if want choose in head should leave only gen/ bin/ in file. if decide choose in master should ahce only gen/ in file. you may need write here else. after merge file commit now. i believe it's no practical case when not deleted special lines =======

fs - Node.js check exist file -

how check existence of file ? in documentation module fs there's description of method fs.exists(path, callback) . but, understand, checks existence of directories. , need check file ! how can done? why not try opening file ? fs.open('yourfile', 'a', function (err, fd) { ... }) anyway after minute search try : var path = require('path'); path.exists('foo.txt', function(exists) { if (exists) { // } }); // or if (path.existssync('foo.txt')) { // } for node.js v0.12.x , higher both path.exists , fs.exists have been deprecated using fs.stat: fs.stat('foo.txt', function(err, stat) { if(err == null) { console.log('file exists'); } else if(err.code == 'enoent') { // file not exist fs.writefile('log.txt', 'some log\n'); } else { console.log('some other error: ', err.code); } });

php - How do I use regex with vQmod? -

once again, stuck regex , don't know start. i using vqmod build opencart extension , want able search files have code: if (file_exists(dir_template . $this->config->get('config_template') the problem is, code above has more code in line in each file. there regex function lets me search part of line of code vqmod? here have tried far: <search position="before" regex="true"><![cdata[~if \(file_exists\(dir_template . $this->config->get\('config_template'\)~]]></search> thanks, peter to search every catalog controller file (which of these are) use <file name="catalog/controller/*/*.php"> if want search regex, use regex="true" , place regex in cdata tags <search position="before|after|replace" regex="true"><![cdata[~regex-here-including-delimiters~]]></search>

c - I am unable to compile a program which has assembly language instructions -

i compiled c program (which has assembly language instructions) this. tcc -emasm.exe protect.c it gives error unable execute masm.exe . should or can find masm.exe ? you need microsoft assembly compiler, called masm.

Excel VBA timestamp and username -

the code below detects data when inputted column , automatically inserts current user cell right. code add timestamp well. need log user name , time. suggestions? private sub worksheet_change(byval target excel.range) dim rcell range dim rchange range on error goto errhandler set rchange = intersect(target, range("a:a")) if not rchange nothing application.enableevents = false each rcell in rchange if rcell > "" rcell.offset(0, 1) .value = username() end else rcell.offset(0, 1).clear end if next end if exithandler: set rcell = nothing set rchange = nothing application.enableevents = true exit sub errhandler: msgbox err.description resume exithandler end sub public function username() username = environ$("username") end function you use date & " ...

android - How to structure this DB in SQLite? -

i creating form saves input in sqlite database in android. first part relatively simple , common database rows (name, age, occupation, etc.). the last part, however, depends on user's choice. example: if user chooses hobby hiking, form display unique questions unique table entries. if chooses hobby gardening, there different table entries , on. how can achieved in best way? suspect has other tables , foreign keys, can point me in right direction? a simple key value set of tables may easy solution: selected topic | associated question key question key | question # | question this 2 table structure allow based off of selected topic , questions topic. depending on how survey structured, database schema need change (for example multiple different paths, fixed # questions, etc). basic outline should provide basis dynamic form