Posts

Showing posts from July, 2015

c# - Handle Odata /entityset/key/navigation -

we have project based on dynamicedmmodelcreation project odatasamples-master odata examples. we have set routing convention handle request specific controller: [httpget] [enablequery] public edmentityobjectcollection get() { ... } [enablequery] public iedmentityobject get(string key) { ... } we try example /odata/hotels -> ok! /odata/hotels(1) -> ok! /odata/hotels(1)/room -> response: no routing convention found select action odata path template '~/entityset/key/navigation'. debuging see route convention handle request , redirect our controller no method executed. routing convention is: public class matchroutingconventionservice : iodataroutingconvention { public string selectaction( odatapath odatapath, httpcontrollercontext controllercontext, ilookup<string, httpactiondescriptor> actionmap) { return null; } public string selectcontroller(odatapath odatapath, httprequestmessage request) ...

mobile - Corona: Error on removing event listeners from runtime during destroy -

i cleaning scene in corona , attempting remove event listeners in destroy event scene. i've added events in show event scene, follows: function scene:show(event) runtime:addeventlistener("enterframe", onframe) runtime:addeventlistener("touch", ontap) runtime:addeventlistener("collision", oncollision) end function scene:destroy(event) runtime.removeeventlistener("enterframe", onframe) runtime.removeeventlistener("touch", ontap) runtime:removeeventlistener("collision", oncollision) end i'm getting null pointer in destroy event: ?:0: attempt index field '_super' (a nil value) stack traceback: ?: in function 'removeeventlistener' what "_super" trying access, , why nil? i've checked , of functions listed above (onframe, ontap, , oncollision) not nil. if has idea what's going on here, please let me know! seems you've mistyped when calling...

c# - Using 32 bit library from 64 bit project - .NET -

our application 64 bit. got adodb provider 3rd party database (nexusdb). it's 32 bit , consists of .net library (which reference fine) , beleive c .dll 32 bit. so, when compile in 32 bit works, in 64 complains can't find c .dll. how can solve issue without compiling our code 32 bit? edit: 3rd party dll's follow: adonet.dll - .net native dll reference , references fine. adonetprovider.dll - non-.net 32 bit dll keep in bin/ folder. i not want compile project x86 because reference many other projects , 64. i want make sure adonet.dll somehow called in "32 bit mode" you have use kind of surrogate process , ipc access 32 bit dll 64bit process. some time ago wrote legacywrapper project hides behind simple api call. may want see corresponding blog post technical details. edit: since version 2.1, legacywrapper supports loading 64bit dlls 32bit process.

mediawiki - get internal links from Introduction in article -

for given article on wikipedia, use mediawiki api extract internal links introduction section of article. eximilar prop=extracts&exintro= setting contents of links. get lead wikitext either extracts or revisions section 0 (the first has sanity checks against long intro / article no section headings @ all, might cut off @ awkward position), pass parse , set prop=links .

c# - multicasting Socket.RecieveFrom: can port be 0 -

good day all while going through msdn multicasting page , in "listener" part, in code, new endpoint create using ipaddress.any, port=0. the ipaddress.any understandable, port 0 confuses me. should not listening on mcastport? ipendpoint groupep = new ipendpoint(mcastaddress, mcastport); endpoint remoteep = (endpoint) new ipendpoint(ipaddress.any,0); <======this line try { while (!done) { console.writeline("waiting multicast packets......."); console.writeline("enter ^c terminate."); mcastsocket.receivefrom(bytes, ref remoteep); console.writeline("received broadcast {0} :\n {1}\n", groupep.tostring(), encoding.ascii.getstring(bytes,0,bytes.length)); } mcastsocket.close(); } read documentation carefully. initial value give in way, allow function call receivefrom grab packets coming in ipv4 remote ip addresses , ports. if specify dedicate ip address or port,...

java - bitmap set pixel/pixels does not work -

textview loadingtext = (textview)findviewbyid(r.id.loadingtext); loadingtext.settextsize(36); loadingtext.settext("morphing..."); bitmap leftbm = ((bitmapdrawable)leftimage.getdrawable()).getbitmap(); bitmap rightbm = ((bitmapdrawable)rightimage.getdrawable()).getbitmap(); bitmap newbm = leftbm.copy(bitmap.config.alpha_8, true); int[] pixels = new int[newbm.getheight() * newbm.getwidth()]; newbm.getpixels(pixels, 0, newbm.getwidth(), 0, 0, newbm.getwidth(), newbm.getheight()); if (!newbm.ismutable()) { log.d("mutable check", "" + newbm.ismutable()); return; } (int = 0; < newbm.getwidth(); i++) { (int j = 0; j < newbm.getheight(); j++) { newbm.sethasalpha(false); newbm.setpixel(i, j, color.rgb(0, 0, 255)); } } loadingtext.clearcomposingtext(); ((imageview)findviewbyid(r.id.morphview)).setimagebitmap(newbm); this code button click ...

javascript - sock.js not allowing POST method for node server -

trying bring node server uses sock.js websocket communication. can bring server fine , have established websocket communication. however, need post instance http can send message through websocket. message dependent on post payload... however, sock.js not seem accepting handler we're creating, , allowing method. causing 405 http code posts done server. please see following code. if remove sock.js implementation, i'm able process , post requests server. var app = require('http'); var sockjs = require('sockjs'); var sk = sockjs.createserver({ sockjs_url: '//cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js' }); sk.on('connection', function (conn) { console.log('connection' + conn); conn.on('close', function () { console.log('close ' + conn); }); conn.on('data', function (message) { console.log('message ' + conn, message); conn.write(message); ...

Python: Regex to match multiline C strings -

i'm attempting match multiline c strings via re module. i'd match strings of form: char * thestring = "some string \ want match."; i tried following regex, not work: regex = re.compile(r"\".*\"$", re.multiline) i thought match first ", continue searching next line until found closing ", not case. because $ requires there " @ end of line match? there way using regex? use dot flag. however, way parse c strings. (?s)"[^"\\]*(?:\\.[^"\\]*)*" if doesn't support (?s) inline modifier, set modifier in flags parameter. re.compile(r'"[^"\\]*(?:\\.[^"\\]*)*"', re.dotall) (?s) " [^"\\]* # double quoted text (?: \\ . [^"\\]* )* " ideally, should add (raw regex) (?<!\\)(?:\\\\)* @ beginning, make sure opening double quote not escaped.

javascript - Html toggle image and save the last status -

i in process of making page reporting street light faults, , want page open contributions public users. i need superimpose locations of lighting poles on map image (not google map) the images bulb 💡 2 different images (on , off) i want user have ability change status of light pole on clicking image. need page save last image selected user, when open page, last status of lighting pole on , off. i stuck in last part, saving last image selected user. any suggestions? first of question kind of implies have working concept of user making selection of bulb (maybe dropdown or something) , can change status either on or off , save changed status. if working come , ask question of how save process happen during click event , , how proper bulb images show either on or off on initial page load. since seems not have completed think may best re-write question more need , how going , , code have far. do have appropiate bulbs showing on or off on page load? do ha...

javascript - Toggle Class Based On Vertical Scroll -

fiddle below: https://jsfiddle.net/y0mj6v2d/5/ just struggling wrap head around best way calculate when add + remove class based on vertical scoll position. i'm looking add side panels (possibly contain banners etc) site, appear: between header & footer & left & right of main container the height of header + footer constant throughout site, i'm able add class based on scrolltop position, im requiring 'side panels' not go beyond start of footer. in example, fixed class removed once scroll position + window height greater document height, im wanting achieve these panels reach start (top) of footer & begin scroll page user scrolls down footer. ie fixed position switched absolution positioning + bottom:0?? the issue i've got how calculate as: the height of main panel vary across site plus height of banner vary aswell $(function() { var panels = $(".side-panels"); var pos = panels.offset().top; $(window).scroll(func...

symfony - Symfony2 Swap 2 objects primary key Doctrine -

i've got myself entity /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var integer * * @orm\column(name="position", type="integer") * @orm\generatedvalue(strategy="identity") */ private $position; the id primary key i'll sort array position. want make functions swap 2 of items when sorting or move them , down. how can make constructor increment each new object create automatically? i've tried: /** * constructor */ public function __construct() { $this->position = $this->id+1; } but id assigned after persisting object each 1 has position set 1. need use life cycle callbacks? lifecycle callbacks work want have aware if modify entity after flushing database you're gonna have flush again save new information.

javascript - <span> html duplicate print out -

i new using span . trying print out information javascript script twice on same page. i can print information once when decide print information second time doesn't display it this 1 works <div id="layer4" class="auto-style10" style="position: absolute; width: 300px; height: 427px; z-index: 2; left: 1020px; top: 90px"> <span class="auto-style8"><h4>incident details</h4><br /> </span> <br /> &nbsp;<h6> report id : </h6> &nbsp; <span id="reportid"></span> <br /> &nbsp;<h6> description : </h6> &nbsp; <span id="description"></span><br /> &nbsp;<h6> category : </h6> &nbsp; <span id="category"></span> <br/> &nbsp;<h6> date , time : </h6> &nbsp; <span id="datetime"></span> <br /> ...

Why can't my Android app see the database file? -

i'm creating android app, , want make registration. have written file c.r.u.d database. when start app , try add somebody, can see popup message: "unfortunately , application has been stopped". here database controller code: package com.example.lingwista.lingwista; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class db_controller extends sqliteopenhelper { public db_controller(context context, string name, sqlitedatabase.cursorfactory factory, int version) { super(context, "lingwista.db", factory, version); } @override public void oncreate(sqlitedatabase db) { db.execsql("create table users( id integer primary key autoincrement, username text unique, password text);"); } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { db.execsql(...

ruby on rails - How to Render Current User into Nav-Bar Button -

running: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux] rails 4.2.5 i want render current user name nav-bar button using dropdown-menu class. replace "account info" "hi "current_user". <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">account info <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <%= link_to "edit profile", edit_user_registration_path, class: "fa fa-pencil-square-o" %></li> <li> <%= link_to "sign out", destroy_user_session_path, method: :delete, class: "fa fa-sign-out" %></li> </ul> <ul class = "nav pull-right"> </ul> <% els...

Evaluating polynomial using python -

i'm trying create own polynomial class. want make function can evaluate polynomial x given. so far have this, answers giving me aren't right , cant figure out why? polynomials inputted using list. example [2, 0, 1, -7, 13] 2x^4+x^2-7x+13 class polynomial: def __init__(self, coefficients): self.coeffs=coefficients def evaluate(self, x): sum = 0 in range(len(self.coeffs)-1,0,-1): sum+=self.coeffs[i]*(x**i) return sum the i value you're using isn't right both index , exponent. you're evaluating reversed-coefficeint polynomial, evaluation results polynomial([2,3,4]) right value polynomial([4,3,2]) . here's how i'd define evaluate : def evaluate(self, x): return sum(coef * x**exp exp, coef in enumerate(reversed(self.coeffs))) note if want polynomial objects callable (as in p1(4) in example in comment), should rename evaluate function __call__ .

javascript - keyCode or which not working when using selection:cleared in fabric js -

i using fabric js , created designer user can design objects , delete objects. but reason, user not able delete object because of event before:selection:cleared so, want detect key user pressed, did is canvas.on('before:selection:cleared', function(e) { console.log(e.keycode); console.log(e.which); if(typeof(canvas.getactiveobject()) !== 'undefined') { if(jq.isemptyobject(previous_object)){ }else{ previous_object.moveto(prev_pos); previous_object={}; prev_pos=''; } loadlayers(); } }); but returns undefined. there other solution detect key?

javascript - Why does AngularJS directive work with hardcoded values but fail with http request/response? -

angular newbie question: i have simple angularjs test application shows how controller , directive work together. controller sets hardcoded values ab , ac on scope , directive displays these values in html. works. here jsfiddle . code below. when run it, can see console output expected: js line #63: this.ab = null js line #64: this.ac = goodbye js line #63: this.ab = hello js line #63: this.ac = world however, when change hardcoded values ones retrieved test api, fails. console output follows: js line #63: this.ab = null js line #64: this.ac = goodbye js line #63: this.ab = undefined js line #63: this.ac = undefined the change made (seen here in new jsfiddle ) in controller's myfunc function: replaced hardcoded values following: response = $http.post('http://jsonplaceholder.typicode.com/posts', { 'xxxxx': 'yyyyyyy' } ) self.scopeab = response.id; self.scopeac = response.id; i have tested api's respon...

c# - HangFire Server Enable - Disable manually -

during development of hangfire application c# asp.net, , decided implement functionally admin can manage state of server, jobs. list item server enable disable state. using enable button click event admin can start job server fire , forget , recurrent job can performed. , disable button stop activities of job. retrieve current state of server i want retrieve current state of job server, can show server on or off. retrieve state , enable / disable state of jobs (only recurrent). if want manage server/job created hangfire, can use monitoringapi or jobstorage there statuses. sample codes : var _jobstorage = jobstorage.current; // how recurringjobs using (var connection = _jobstorage.getconnection()) { var storageconnection = connection jobstorageconnection; if (storageconnection != null) { var recurringjob = storageconnection.getrecurringjobs(); foreach(var job in recurringjob) { // stuff ...

python 2.7 - insert data in sqlite3 when array could be of different lengths -

coming off nltk ner problem, have persons , organizations, need store in sqlite3 db. obtained wisdom need create separate tables hold these sets. how can create table when len(persons) vary each id. can zero. normal use of: insert table_name values (?),(t[0]) return fail. thanks cl.'s comment, figured out best way think rows in two-column table, first column id int, , second column contains person_names. way, there no issue varying lengths of persons list. of course, link main table persons table, id field has reference (foreign keys) story_id (main table).

javascript - Mithril - how to populate drop down list of view from API -

i'm trying populate drop down box rendered mithril's view methods being called outside of module (not sure if terminology correct, outside of property contains view, model , controller). this chrome extension adds new field existing page , depending on user select, drop down box should refresh items pertaining selected item. can stage of getting new list of items, cannot drop down list redraw new objects. the following shows module gets inserted inside existing page: var itemslist = { model: function () { this.list = function (id) { var d = m.deferred() // calls chrome extension bg page retrieval of items. chromeext.getitems(pid, function (items) { // set default values when controller called. if (items.length === 0) { items = [ {name: 'none', value: 'none'} ] } d.resolve(items || []) }) return d.promise } }, controller: function () { this.model = new item...

how to work with on onResume() in Android? -

i have 2 activities .first time run application have open popup in activity 1 when first start application. after want go activity 2 , make changes there. again come activity 2 , don't want open popup. problem whenever comeback 1st activity popup open.how solve issues? here code. db = dbhelper.getreadabledatabase(); string query = "select * inspector activestatus= '1' , followflag ='1'"; cursor cursor = db.rawquery(query, null); if (cursor.movetofirst()) { { string strinspectorename = cursor.getstring(cursor.getcolumnindex("inspector_name")); string strinspectorid = cursor.getstring(cursor.getcolumnindex("inspector_id")); if(!strinspectorid.equals(str_loginuserid)) { inspector_arraylist.add(strinspectorename); log.e("post ", " total followup users !!!...

AE2A dynamic programming -

i have been trying solve problem: http://www.spoj.com/problems/ae2a/ . know idea behind this, i'm getting wa. can me this? code is: https://ideone.com/rksw1p for( int i=1; i<=n; i++) { for( int j=1; j<=sum; j++) { for( int k=1; k<=6 && k<j; k++) { a[i][j] += a[i-1][j-k]; } } } let numbers on top of die faces x1,x2,x3... then have find ways in x1+x2+x3+...+xn=sum 1<=xi<=6 now, solution of integral equation (sum-1)c(n-1). hence probability ((sum-1)c(n-1))/(6^n). answer [((sum-1)c(n-1))/(6^n)x100] hope helps..

AppleScript using framework -

this stupid question, however need code within app, i've been using uibutton while not enough, app have .framework files, can use scripting ? example if want click on button listed, there anyway that? 1 button 1 button the applescript framework not available on ios

Create custom glyphicon and add into bootstrap in Yii2 -

Image
new updates asset file dashboardasset created inside asset directory. have several asset files in directory. <?php namespace app\assets; use yii\web\assetbundle; /** * @author qiang xue <qiang.xue@gmail.com> * @since 2.0 */ class dashboardasset extends assetbundle { public $basepath = '@webroot'; public $baseurl = '@web'; public $css = [ 'css/dashboard.css', 'css/transport.css', ]; public $js = [ ]; public $depends = [ 'yii\web\yiiasset', 'yii\bootstrap\bootstrapasset', ]; } updated folder structure calling transport icon final appearance of menu you must define new asset bundle file new fonts. put fonts folder under web called fonts , create style file of including web fonts on file under css folder (please careful address of fonts on css file. it's must address them ../fonts/transport.ttf ). structure this: -| web/ --| ...

Can Akka.NET and Original Akka communicate Using Remoting? -

can akka.net , original akka communicate using remoting? in other words can akka used connect jvm , clr in system? this issue on akka.net github https://github.com/akkadotnet/akka.net/issues/132 describes several reasons why doesn't work: 1) use different serializers user messages, akka uses default java serializer, akka.net uses json.net. solved using e.g. google protobuf, serializers pluggable. 2) helios (akka.net transport) , netty (akka transport) not compatible on binary level, both use 4 byte length prefix frame messages (afaik, @aaronontheweb ?) guess won't play nice together. and perhaps more fundamentally: the big issue here this: java bigendian, .net littleendian - @ least, it's littleendian on windows systems. endianness in .net can vary platform platform, true mono too. it appears there not appetite solving issues: i'm wondering how useful full protocol compatibility is. issues point out aside, imagi...

javascript - res.json not working inside callback function -

i'm working on api endpoint. upon posting data endpoint /authenticate , use plaidclient.getauthuser function user's account information, , i'm trying use res.json return account data. after running this: accounts = json.stringify(res.accounts); console.log('accounts: ' + accounts); i able see array of dictionaries containing account information. however, when attempt use res.json({accounts: accounts}) , error: res.json({accounts: accounts}); ^ typeerror: undefined not function when try run res.send(accounts) in place of res.json, receive same error: res.send({accounts: accounts}); ^ typeerror: undefined not function here's code: var public_token = ""; var access_token = ""; var accounts = []; app.post('/authenticate', function (req, res) { console.log('post'); public_token = req.body.public_token; console.log(public_token); console.log('plaid: ' + app.client); ...

matplotlib - Python list and time -

i trying current time , store when run os command ( runs once second) can plot graph of time vs output of command. when try store current time in list using: (timelist empty list) timelist.append (datetime.datetime.time(datetime.datetime.now())) i this: [datetime.time(23, 57, 8, 86885), datetime.time(23, 57, 8, 87091), datetime.time(23, 57, 9, 90906), datetime.time(23, 57, 10, 95045), datetime.time(23, 57, 10, 95110), datetime.time(23, 57, 10, 95148), datetime.time(23, 57, 10, 95166), datetime.time(23, 57, 10, 95178)] so in 1 second, instead of 1 list item current time, 2, or 3 items). how capture time @ instant , store in list can use pyplot plot this? i using this, , works fine (python 3.3+): from datetime import datetime time_list = [] time_list.append(datetime.now()) if want save or send other application without converting types can think use timestamp rather: from datetime import datetime time_list = [] time_list.append(datetime.now().timestamp()) ...

How to size table by number of rows in SQL Server -

Image
i have table want size of number records based on byte in sql server: the answer related this question can suggest this: select s.name schemaname, t.name tablename, p.rows rowcounts, a.total_pages * 8 totalspacekb, a.used_pages * 8 usedspacekb, a.total_pages * 8 / p.rows eachrowtotalspacekb, a.used_pages * 8 / p.rows eachrowusedspacekb, a.total_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb, a.used_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb sys.tables t inner join sys.indexes on t.object_id = i.object_id inner join sys.partitions p on i.object_id = p.object_id , i.index_id = p.index_id inner join sys.allocation_units on p.partition_id = a.container_id left outer join sys.schemas s on t.schema_id = s.schema_id s.name = 'dbo' , t.name = 'picturetable'; edit can length of data in field using datalength...

image processing - Determining resolution -

i read this: today digital ip camera resolution defined horizontal (h) , vertical (v) number of pixels (i.e. 640 x 480) or total number of pixels in sensor (h x v = 336k pixels). how calculation of hxv=336k pixels? is h = 640 , v = 480? if yes doesn't calculation suppose 307200 =~ 307k?

c# 4.0 - How do I call a getter or setter in C# -

i understand how create getters , setters public myclass { public int myval { get; set; } // more stuff } but don't understand how call later on. public myotherclass { public myotherclass() { myclass localmyclass = new myclass(); localmyclass.???set??? = 42; // intelisense doesn't seem give obvious options after enter // period. } } how should set value of myval in localmyclass? localmyclass.myval = 42; getters , setters let treat values public properties. difference is, can whatever want inside functions getting , setting. examples: store other variables private int _myval, myotherval; public int myval { get; set { _myval = value; myotherval++; } } make numbers / return constants public int myval { { return 99; } set; } throw away setter private int _myval; public int myval { { return _myval; } set { ; } } in each of these cases, user feel it's public data member, , type ...

javascript - Execute event before its natural behaviour -

is there way execute javascript-event before it's natural behaviour? for example, using code below, if press / key on keyboard, character printed in input field, , after 2 seconds, alert showed. that's obviuos. but there way make alert showed before / printed? <input></input> <script> document.queryselector("input").focus(); addeventlistener("keydown", function (e) { if (e.keycode === 191) { myfunc(e); } }); function myfunc(e) { settimeout(function() { alert("hello!"); }, 2000); } </script> unified solution inputted characters on keypress event: addeventlistener("keypress", function(e) { var val = e.which || e.keycode; e.preventdefault(); myfunc(e.target, val); }); function myfunc(target, val) { settimeout(function() { alert("hello!"); target.value = string.fromcharcode(val); }, 2000); } try it.

c++ - Will including new IDs require recompile? -

globals.h #define id1 1 #define id2 2 factory.h item* makeitem(int id); will including new ids in globals.h require recompile of files use makeitem old ids? also how know changes require recompile or re-linking of dependents? any change globals.h require recompile of files #include globals.h or include header files include globals.h. if list of ids changes often, , lots of files depend on it, , project big, might become nuisance. one way around split globals.h different h-files, each h-file used relatively small part of project. then, change in 1 of them not require recompiling. if this, typically face challenge of keeping of ids unique. if defined in different header files, developer making change in 1 file may not know causing collision id defined in file. 1 solution follow documented convention, in every h-file ids defined has associated range of ids, , ranges not overlapping.

java - MongoDB / Morphia update operation for document with many fileds -

i have entity contains lets 20 different keys / local variable. in case want update doc , can use updateoperations in order perform query , have go filed filed , set new value new object.. if there way update current doc in db new fields lets say: public class item { @id @getter @setter private objectid id; @getter @setter private string itemid; @getter @setter private string itemtitle; .. .. } so lets have item stored, got new dto gui, of fields , rest null. want create generic update operation take non nullable values dto object , update in existing doc in db. is possible? i think so! i see 2 possible ways: alternative 1: can use reflection iterate every field in dto , put value copy of document recovered db. @ end of loop can update document. alternative 2: update desired fields. mongo can update subset of fields in update operation: update data java driver

spring - How can I manage dynamic model with AngularJS and springdata mongodb -

i have created project using angularjs + spring-data-mongodb + mongodb. i'd manage crud operations model change dynamically according concept of object inheritance. the frontend: if user selects "vehicle" form contain attributes of vehicle. if user selects vehicle type "car" form contain attributes of "vehicle" plus attributes of "car". if user selects vehicle type "motorcycle" form contain attributes of "vehicle" plus attributes of "motorcycle". angularjs form model: <div ng-controller="vehicleformctrl"> <input type="text" class="form-control" id="inputfielda" ng-model="vehicle.name"> <select class="form-control" ng-model="vehicletype" ng-change="selectvehicletype()" ng-options="k v (k, v) in vehicletypes"> </select> ... <input type="text" class="f...

datetime - Applescript: Convert date into something useful, then perform calculation -

i'm trying create applescript script take date in form: 02/20/99 then, subtract 5 days date, , return date this: 02/15/99 here's basic applescript have, but, obviously, i'm missing logic around converting date can manipulate (and returning readable humans). set itempath quoted form of posix path of thefile set datestring shell script "awk 'nr == 10 {print $3}' " & itempath & " -" set myduedate datestring - (5 * days) set thetask "pay amex bill" tell application "omnifocus" tell front document set thecontext first flattened context name = "office" set theproject first flattened context name = "bookkeeping - pms" tell theproject make new task properties {name:thetask, context:thecontext, due date:myduedate} end tell end tell thanks in advance! i think these lines should sufficient need: set datestring "02/20/99" set thisdate date...

c# - "Hyperlink.Click" event not being fired for DataGridHyperlinkColumn -

i have wpf form datagrid containing multiple datagridhyperlinkcolumn , hyperlink.click handler set up. gamesgrid.xaml: <usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:steamwishlist" x:name="gamesgridcontrol" x:class="myprogram.gamesgrid" mc:ignorable="d" d:designheight="300" d:designwidth="300"> <grid> <datagrid x:name="datagrid" autogeneratecolumns="false" canusersortcolumns="false" selectionunit="cell" selectionmode="single" arerowdetailsfrozen="true...

facebook - How do I get the current User Id with GoViral ANE -

i using goviral ane integrating facebook, creating leaderboard display in game. i highlight current user's score, don't appear have access id returned via app_id/scores request. for example, data returned in following format: {"score":123,"user":{"name":"colin","id":"1234"}} the id portion looking match current user highlight score. i have tried goviral.goviral.getfbaccesstoken() wrong thing. have tried making call out current user's score, requires user id make call, little stumped on one. searching on google doesn't seem return useful results either. thank time. ah, seems don't need user id make call after all. the call attempting following: from facebook developer site: you can read score person playing game issuing http request /user_id/scores user access_token. with code: goviral.goviral.facebookgraphrequest( goviral.goviral.getfbaccesstoken() + "/scor...

Reset java certifications (on linux) due to Maven download issue -

i using ubuntu linux 15.10. few days ago cloned small git project using maven (i use version 3.3.3). after cloning wanted use mvn install command download dependencies error occurred. using same command -x parameter shows problem in detail: [error] plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-resources-plugin:jar:2.3: not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.3 from/to central (https://repo.maven.apache.org/maven2): java.security.nosuchalgorithmexception: error constructing implementation (algorithm: default, provider: sunjsse, class: sun.security.ssl.sslcontextimpl$defaultsslcontext): invalid keystore format -> [help 1] org.apache.maven.plugin.pluginresolutionexception: plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-reso...

php - I'm trying to change the value of a div with javascript -

<div id='right_side'> <div id='t' title='<?php echo $u; ?> friends'> <div id="f"> <h6> <?php echo $u; ?> friends </h6> </div> </div> <div id='users' onclick="chat();"> <?php echo $friend; ?> </div> javascript <script> function chat() { var chatbox = document.getelementbyid("chatbox"); var chatbox = document.getelementbyid("chatbox").value= "<?php echo $friend_username; ?>"; if(chatbox.style.display == "none"){ chatbox.style.display = "block"; $('#chatbox').attr("chatbox","<?php echo $friend_username; ?>"); } else { chatbox.style.display = "none"; chatbox.attr.value = "none"; } } </script> i want change div value user name of friend if cl...

Data File handling in classic c++ (much like C) -

i made following program. there mistake in bold part. value of count in output i'm getting zero. there no errors when compiled code. #include<iostream.h> #include<conio.h> #include<fstream.h> void main() { clrscr(); void count(); fstream file("story.txt",ios::in|ios::out); file<<"he playing in ground. she\nis playinbg dolls.\n"; file.close(); count(); getch(); } void count() { ifstream file("story.txt"); file.seekg(0);int count=0; while(!file.eof()) { char line[10]; **file.get(line,10,' '); cout<<line<<"\n"; if(line=="he") ++count;** } cout<<count; file.close(); } string comparison not done through == . merely compares address replace if(line=="he") with if(!strcmp(line, "he")) edit for case insensitive if(!strcmpi(line, "he")) ...

Use addition in database SQL -

can use addition in database? for example: have data inside database integer. has value of 5. is there query add 1 that? become 6. please me i'm beginner. this basic form of update statement: update the_table set the_column = the_column + 1 the_column = 5; note above update all rows the_colum has value 5. want change where clause different, e.g. selecting single row using condition on primary key column(s) of table. check manual of dbms details, e.g.: http://www.postgresql.org/docs/current/static/dml-update.html

javascript - trying to change the text of the button without editing the html code -

i'm trying change text of button without editing html code doesn't work here code: document.queryselector(".game-button").onclick = function knop(knop) { document.queryselector(".game-button").innerhtml = "reset spel"; } html: <button class="game-button">start spel</button> if may suggest: var gamebutton = document.queryselector(".game-button") gamebutton.onclick = function() { gamebutton.innerhtml = "reset spel"; } i've put gamebutton in variable referenced once. since function connected onclick event, naming function not needed. also, not passing or using arguments, there no need put between ().

Creating an auto logout timer of 30 minutes in PHP -

i need timer of 30 min auto logout quiz application coded in php. should forced one. if user doing activities.how implement that? php not work runtime application, doesn't have state. frontend via javascript or other means need send request server on interval check if user still authenticated. check using php if user expired or not, in case action using frontend logic. this way vague give definitive answer.

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

i'm trying follow this guide . i'm running both ubuntu 12.04.5 lts (gnu/linux 3.13.0-74-generic x86_64) on "real" hardware , 14.04.1 via virtualbox on mac. problem don't past step 1: hoffmann@angl99:~$ export ccprefix=/home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- hoffmann@angl99:~$ ${ccprefix}gcc -v i'm getting following error: -bash: /home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: no such file or directory however, file i'm told missing there: hoffmann@angl99:~$ less /home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc "/home/hoffmann/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc" may binary file. see anyway? this result of basic error/misconception. suggest solution? thanks! sebastian ok - i've worked out (with of person po...

php page called from Joomla menu unable to capture logged in user info -

we have application running in joomla . there menu option 'my data' - on clicking open php page in iframe . in target php want capture current logged in user details facing problem. we have used jfactory::getuser() not showing . although if specific id passed parameter getuser id's details coming . pfb code . can please us. in advance . /*******start of code*********/ define('_jexec', 1); define('ds', directory_separator); if (file_exists(dirname(__file__) . '/defines.php')) { include_once dirname(__file__) . '/defines.php'; } if (!defined('_jdefines')) { define('jpath_base', dirname(__file__)); require_once jpath_base.'/includes/defines.php'; } require_once jpath_base.'/includes/framework.php'; $app = jfactory::getapplication('site'); $app->initialise(); $user =& jfactory::getuser(); echo 'user name: ' . $user->username . '<br />'; echo ...

Windows Forms C# WMPLib Crashes while playing a mp3 file -

Image
i'm working on simple mp3 player. i'm using wmplib playing mp3 files. i'm displaying tracks in data grid view, double click plays selected track. program plays right song, once start scrolling or pressing buttons song stops playing. this method i'm using playing individual tracks: public static void playtrack(int t) { library l = new library(); wmplib.windowsmediaplayer song = new wmplib.windowsmediaplayer(); song.url = l.mylibrary[t].patch; song.controls.play(); } i call above method when datagridview1_cellcontentdoubleclick raised in separate class. do guys know why happening? do need use multi threading in order fix it? i thought program's ui "heavy" i'm using multiple nested panels in custom controls. i'm including print screen of running application. ok, found answer problem. needed declare library , wmplib field outside of method shown below: static library l; static wmplib.windowsmedi...

c# - Trackbar keeps stealing my focus -

it has been asked few times couldn't use of answers. problem everytime want change trackbars value keeps focused when i'm clicking on other parts of window. , when want use keys work in trackbarbox. what did try?: -i tried set causesvalidation / tabstop / topmost false / true -i tried use mouseleave / focusenter events set focus on form this.focus() -i tried put protected override bool isinputkey(keys keydata) { return true; } and/or protected override bool showwithoutactivation { { return true; } } into maincode here screenshot of programm understand problem: it's german doesn't matter. want press enter while i'm drawing line trackbar keeps focused , blocks it the usual way to override onkeydown event after setting keypreview = true : protected override void onkeydown(keyeventargs e) { base.onkeydown(e); // code here.. text = "testing: keycode" + e.keycode; } but can use previ...