Posts

Showing posts from March, 2014

php - Symfony using external parameters in assert and routing -

we working on big symfony2 project should portable , configurable possible. security super important in our project use many validation , on. example use assert in entity , check requirements in routing. example in entity: @assert\range( min = 1, max = 3, minmessage = "common.moderation.status.range_min", maxmessage = "common.moderation.status.range_max" ) and in routing: requirements: status: "[1-3]" we find way store these range values separately , use them in entities , routes. @ moment these (and other consts) statuses stored in entity constants project grows need more , more constants , fields , routes validation these values cause many duplications this. if 1 of our customers want change range can cause headaches. possible not manually rewrite necessary asserts , route requirements external parameter? thx in advance. i think should create custom validation constraint .

How can I test Eddystone beacons using the Proximity Beacon API on Android or iOS and are there any dependencies? -

i saw announcement google made regarding eddystone , want start testing on smartphone devices. can please provide links can started , need download particular dependencies? help! here's tutorial wrote on how build basic eddystone-capable app: http://developer.radiusnetworks.com/2015/07/14/building-apps-with-eddystone.html this app run on android phone version 4.3+. dependency need free , open source android beacon library . library documentation includes lots of details on how use all of different eddystone frames , , how program detection of each one . a few other things might find useful: developer kits hardware eddystone beacons can purchased radius networks (my company) here . you can use free android locate app detect , decode of frames transmitted eddystone. you can use same locate app above act free eddystone transmitter

java - jdbc connection string with c3p0 -

i have jdbc configured c3p0. however, worried possible conflicts, since of parameters in jdbc string , c3p0 similar. here jdbc string: jdbc:mysql://1.1.1.1:3306/db?usessl=true&requiressl=true&connecttimeout=15000&sockettimeout=30000&autoreconnect=true we decided include connecttimeout, sockettimeout, autoreconnect because otherwise took long switch replica if master crashes. ( using mysql rds multi-az ). here c3p0 properties: <property name="acquireincrement" value="3"/> <property name="minpoolsize" value="5"/> <property name="maxpoolsize" value="10"/> <property name="maxidletime" value="3600"/> <!-- 1 hour --> <property name="maxconnectionage" value="7200"/> <property name="maxidletimeexcessconnections" value="600"/> <property name="idleconnectiontestperiod" value="180"/&

javascript - Starting Out In LiveWeave -

i have been trying make cute little games in javascript, using liveweave html/css/javascript playground. however, can't seem figure out how insert javascript. blocks use? put script in html? reason i'm asking tested out making few rects around screen, yet none showed up. help, please go http://liveweave.com . best regards, dominic

performance - Java: Find similar strings -

i have java list (it map if necessary) lot of strings. list(hello,hell,car,cartoon,...) i want find similar strings given string in efficient way. i think should use levenshtein distance, don't want iterate through list. do think idea divide main list in pieces common prefix? then have map prefixes key , list value: hel -> list(hello,hell,...) car -> list(car,cartoon,...) in way search strings same prefix searched one. apply levenshtein distance strings , not main-list. is idea? thanks you once calculate soundex code of every entry, , map soundex list of original word. soundex reducing code 1 single key similar sounding words. map<string, set<string>> soundextowords = ... (string word : words) { string sdex = soundex(word); set<string> similarwords = soundextowords.get(sdex)); if (similarwords == null) { similarwords = new hashset<>(); soundextowords.put(sdex, similarwords); } sim

css - change image existing color from one to another one -

Image
i have calendar image want change color. dont have photoshop edit color. possible change color css? i want apply color color: #26416c; if it's image, you're limited editing image editor, or using experimental css technology using filter property : img { -webkit-filter: hue-rotate(90deg); filter: hue-rotate(90deg); } <img src="http://i.stack.imgur.com/v96i5.png" />

rotation - Rotate individual shape -

i'm working on replicating piece of art in processing. i'm having issue rotate functionality. so image can found here . below can see code processing. can see differing part rotating of ellipses. i've tried changing origin e.g: translate(midpoint - (position*tenth + layer*tenth/2.0), i*tenth + layer*tenth/2.0,) then rotating , creating shape @ (0,0), doesn't i'd to! any ideas appreciated this changes origin x, y position want ellipse drawn at. void setup(){ size(550,550); background(187,182,179); midpoint = height/2.0; tenth = height/10.0; circle_radius = 20.0; } float circle_radius = 15.0; float midpoint; float tenth; float base_colour = 0; float getcolour(float x_value){ float colour_val = ((x_value - 50.0)*255.0)/(450.0-50.0); if(floor(colour_val/255.0)%2 == 0){ return colour_val%255.0; } return 225.0 - (colour_val%255.0); } void draw(){ nostroke(); background(187,182,179); base_colour += 5.0; for(int layer =

r - ShinySky select2Input Bug -

here code basic shiny app. of requires packages shiny shinysky library github: https://github.com/analytixware/shinysky here reproducible example: testing <- function() { shinyapp(ui = fluidpage( sidebarlayout( sidebarpanel( select2input("select2input3", "multiple select 2 input", choices = c("a","b","c"), selected = c("b","a"), type = "select") ),mainpanel( )) ), server = function(input, output){}) } testing() i confused why though have choices c("a", "b", "c"), dropdown select b , have no other choices. have tried selected = "b", no luck. looked @ examples shiny sky , can't see missing. video tutorial showed same type of dropdown had "b" selected, yet user click on "a" or "c" in dropdown: https://www.youtube.c

multithreading - Concurrent threads in Vector (Java) -

i designing multi-threaded piece of code includes part several sensors queried (through socket), , data stored first in vector , subsequently written db. the entire process time sensitive since each sensor updates every few seconds new data. if data not retrieved in time, lost. currently, have vector of (custom sensor data) class stores information obtained , each of sensors. the plan open thread each sensor (say, 40-50 in total, not want limit number in case more sensors added later) , have access , fill particular (set index of vector) cell of vector. is such operation on vector allowed , prudent? also, knowing peculiarities of tcp/ip sockets, drastically speed process introducing threads (as opposed to, say, running in single thread)? there better or more elegant way of doing this? from write seems queue beffer fit; threads push sensor data on queue , later (perhaps thread) can take elements queue , process them. java (at least version 7 , 8) offers different qu

How to autostart my app with windows 8.1 or windows phone -

is possible autostart app @ device boot having windows 8.1 or windows phone 8.1? if yes, how? it possible android using broadcastreceiver it isn't possible automatically launch application @ foreground on windows phone , windows 8.1 (be @ startup or @ other time). however, application can execute in background (given limitations) using background agents, , interact in ways user (for instance, using toast notifications).

Passing Array of Bool to C++ Code from C# -

i'm working on project few other people, sadly no longer available reference material. project uses c# gui, , c++ updating our archaic database. @ moment, have function in c#: [dllimport("synch.dll", charset = charset.unicode, callingconvention = callingconvention.cdecl)] //synch bool synch(void * voidptr, const tchar * databasedir, const tchar * truckdir) static extern int32 synch(intptr psync, string databasedir, string destdir, ref bool[] wholefiles); wholefiles array of booleans used determine if files should synced or not, based on user input. the c++ supposed take in array, , able flip of bools true or false conditions met. if (numsyncrecords > 0){ log::writeverbose(_t(" %d recs, %d differences found"), (int) numrecsused, (int) numsynrecords); if(wholefiles[sourcefileid]){ cstring temppath = _t(""); temppath += destdir; temppath += filename; deletefile(temppa

javascript - AngularJS - ngClick is blocking submit key action -

the user of web should enter simple code using buttons in form , after should click ok or hit enter , continue proccess. the thing enter key not submiting form, executing other method called ng-click . how can avoid enter key call ng-click method? myapp.js var myapp = angular.module('myapp',[]); myapp.controller('myformcontroller', ['$scope', function ($scope){ // procesing data form. $scope.signin = function () { } }]); myapp.controller('mycontroller', ['$scope', function ($scope){ $scope.do = function() { alert('ng-click pressed!'); } }]); myform.html <div ng-controller="myformcontroller"> <form name="myform" role="form" ng-submit="signin()" novalidate> <input type="text"/> <div ng-controller="mycontroller"> <a href="javascript:void(0);&q

hide - Mouseenter not works in jquery -

i have got simple script , cant figure why div doesnt show when hovering it. $(document).ready(function (){ $(".hidden").hide(); $('.moje').mouseenter(function () { $(".hidden").show("fast"); }); }); you cant find whole setup here https://jsfiddle.net/xbs75yhq/1/ class="moje" not exist in html! try using .main e,g, $(document).ready(function (){ $(".hidden").hide(); $('.main').mouseenter(function () { $(".hidden").show("fast"); }); }); https://jsfiddle.net/trueblueaussie/xbs75yhq/2/

ios - How to call the -(void)update:(CCTime)delta method in Objective-C -

is there way call -(void)update:(cctime)delta method in objective-c? know (using sprite builder) can create scene , have attached custom class when scene loaded through ccbreader, class's update method automatically called. i loading scene through code without custom class still update method "start" (for lack of better word.) there way this? call scheduleupdate from, example, onenter method. [self scheduleupdate]; however if using cocos2d-objc or cocos2d-spritebuilder version 3.0 or later, update: methods scheduled automatically. https://github.com/cocos2d/cocos2d-objc/blob/v3.0/cocos2d/ccnode.m#l1190 -(cctimer *) schedule:(sel)selector interval:(cctime)interval repeat: (nsuinteger) repeat delay:(cctime) delay { nsassert(selector != nil, @"selector must non-nil"); nsassert(selector != @selector(update:) && selector != @selector(fixedupdate:), @"the update: , fixedupdate: methods scheduled automatically.");

javascript - Is a function return value possible as an array key? -

i made lazy utility function wanted pass arrays key getting syntax errors, possible pass function inside array it's key? function encloseattrselector(attr, value) { return '[' + attr + '="' + value + '"]'; } .. example (typically more 1 pair): var data = { encloseattrselector('name', 'username'): row.first().text() }; in es6 es2015 (the newest official standard language) yes, in real-life contexts no. can this: var data = {}; data[encloseattrselector('name', 'username')] = row.first().text(); the new es2015 syntax is: var data = { [encloseattrselector('name', 'username')] : row.first().text() }; that is, square brackets around property name in object initializer expression. inside square brackets can expression.

ruby - Rails "undefined method for ActiveRecord_Associations_CollectionProxy" -

i have models: class student < activerecord::base has_many :tickets has_many :movies, through: :tickets end class movie < activerecord::base has_many :tickets, dependent: :destroy has_many :students, through: :tickets belongs_to :cinema end class ticket < activerecord::base belongs_to :movie, counter_cache: true belongs_to :student end class cinema < activerecord::base has_many :movies, dependent: :destroy has_many :students, through: :movies has_many :schools, dependent: :destroy has_many :companies, through: :yard_companies end class school < activerecord::base belongs_to :company belongs_to :student belongs_to :cinema, counter_cache: true end class teacher < activerecord::base belongs_to :movie, counter_cache: true belongs_to :company end class contract < activerecord::base belongs_to :company belongs_to :student end class company < activerecord::base

PDF not showing on visitors browser -

i have webpage ( http://optiswissopen2015.ch/page/noticeboard ) pdfs on it. of them linked same way. on browsers (ie8 sure) shown text instead of open pdf viewer. <a href=" /files/noticeboard/1436883318_sism2015.pdf" download runat="server" class="button color3"> my first thought was, may have problem in header. converting them .ps , doesn't help. what can do, open right browsers? last option, zip them :-( yes, the issue in file content type returned pdf files on server. verify use curl -i [url] or wget -s [url] or online tool . for example, 1436883318_sism2015.pdf returns (incorrect): http/1.1 200 ok etag: "[omitted]" last-modified: tue, 14 jul 2015 14:15:18 gmt content-type: text/plain content-length: 1188394 date: mon, 27 jul 2015 17:19:21 gmt accept-ranges: bytes server: litespeed connection: close and anmedleguide.pdf returns correct header: http/1.1 200 ok date: mon, 27 jul 2015 17:21:25 gm

node.js - How to write a typescript corresponding to following javascript ? -

var _ =require('lodash'); var controller=function(){}; controller.prototype.index=function(req,res){ res.ok(); }; controller.extend=function(object){ return _.extend({},controller.prototype,object); }; i have tried following typescript adds extend controller.prototype.extend instead of controller.extend() var _ = require('lodash'); class controller { index(){ console.log("hi"); } extends(object) { return _.extend({}, controller.prototype, object); } } how can change typescript obtain above javascript? you defining instance method, part of object's prototype, should using static method (part of class). all need change declaration of extends(object) to: static extends(object) { ... }

asp.net mvc 4 - Jquery Tabs MVC 4 - Redirect to to tab from controller -

i have following code 'selectedtabtofind' set in controller. used validation, correct tab displayed. $("#tabs").tabs( { active: $("#selectedtabtofind").val(), cache: false }); <div id="tabs"> <ul> <li><a href="#tabs-1" title="view">view</a></li> <li><a href="#tabs-2" title="update">update</a></li> <li><a href="#tabs-3" title="validate">validate</a></li> <li><a href="#tabs-4" title="notes">notes</a></li> </ul> <div id="tabs-1"> @html.partial("view",model) </div> <div id="tabs-2"> @html.partial("update",model) </div> <div id="tabs-3"> @html.partial("validate",model.validatemodel) </div> <div id="tabs-4"> @htm

How to allow guest access to some actions in Yii2 Controller? -

i'd know how configure controller allow actions executed guest , able show view guest in yii2. i've tried rule in behaviour 'access' => [ 'class' => accesscontrol::classname(), 'rules' => [ [ 'actions' => ['create','update'], 'allow' => true, 'ips' => ['127.0.0.1'], ] ], ] edit: config tried : 'access' => [ 'class' => accesscontrol::classname(), 'rules' => [ [ 'allow' => true, 'action

r - Converting over 24 hours into Date_Time -

i have data frame of cross channel swimming times. these range 6:35:00 43:00:00+ . when try , convert date time using: as.posixlt(as.character(swims$times) r returns nas times greater 23:59:59 . i have tried searching online etc. have not found solution. what best way of handling this? pierre here sample of data uniqueid time 1 187500001 21:45:00 2 191100001 22:35:00 3 192300001 26:50:00 4 192300002 16:33:00 5 192300003 16:58:00 6 192600001 14:39:00 nrussell: suggest instead of posixt? the lubridate package has duration type. can convert times duration can work in conjunction dates. in case can convert time listed hours:minutes:seconds seconds , coerce using: library(lubridate) as.duration(as.double(substr(swim$time,1,2)) * 3600 + as.double(substr(swim$time,4,5)) * 60)

c# - Copy file contents without copying file properties -

Image
before read on there similar question asked me @ how remove special characters file metadata c# . question not specific file type(image, video, audio, text, word, excel.). not asking how file's extended properties , how set them. is possible copy file contents 1 file without copying file's extended properties. please check following image mean extended properties. note: ignore highlighting. doesn't mean here. i want file contents don't want title, subject, rating, tags, comments, authors etc. (none of properties, irrespective of file type.). thanks. you'll find easier modifying extended properties after file has copied. take @ file class, has methods setting modified date, etc. for title etc. have use com, shell32.dll allow this: http://www.codeproject.com/cs/files/detailedfileinfo.asp to alter these properties have use com component. looks dsofile.dll you. there ms kb article on here you might take @ taglib# although don't kn

python - Trouble installing scipy in virtualenv on a amazon ec2 linux micro instance -

i have installed scipy in default python compiler on amazon ec2 micro instance (ubuntu 13.04). not able install scipy in virtualenv. pip install scipy ends error scipy/sparse/sparsetools/csr_wrap.cxx: in function ‘void init_csr()’: scipy/sparse/sparsetools/csr_wrap.cxx:73303:21: warning: variable ‘md’ set not used [-wunused-but-set-variable] c++: internal compiler error: killed (program cc1plus) please submit full bug report, preprocessed source if appropriate. see <file:///usr/share/doc/gcc-4.7/readme.bugs> instructions. ---------------------------------------- cleaning up... command /home/ubuntu/pnr/bin/python -c "import setuptools;__file__='/home/ubuntu/pnr/build/scipy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t8drvd-record/install-record.txt --single-version-externally-managed --install-headers /home/ubuntu/pnr/include/site/python2.7 failed error

jquery - How to use the HTML button inside the canvas page? -

hi i'm planning make drag , drop method using html5 canvas j query i'm stuck how use html button inside canvas page. has of i'm able image inside canvas page , capable of doing drag , drop. plan use button drag , drop. here html page. <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /> <!-- reset css --> <script src="http://code.jquery.com/jquery.min.js"></script> <style> body{ background-color: ivory; padding:20px; } canvas{ border: 1px solid #808080; } </style> <script> $(function(){ var canvas1 = document.getelementbyid("cvs1"); var canvas2 = document.getelementbyid("cvs2"); var contexts=[]; contexts.push(canvas1.getcontext('2d')); contexts.push(canvas2.getcontext('2d')); function clearall(){

typescript - Run TSC Task on Save Automatically in Visual Studio Code 0.5.0 -

i migrating webstorm vscode , , 1 thing can't get, , seems basic. upon saving, want run typescript task. can't yet use tsconfig.json because can't exclude folders yet filesglob way done in atom (it chokes on node_modules folder). i have ctrl+shift+b every time now, red underlines go away after every save. there must way? after lots of fiddling, came this, works way expect. tasks.json { "version": "0.1.0", "command": "tsc", "isshellcommand": true, "args": [ "-p", "." ], "showoutput": "silent", "iswatching": true, "problemmatcher": "$tsc-watch" } tsconfig.json { "compileroptions": { "target": "es5", "module": "amd", "watch": true, "inlinesourcemap": true }, exclude: [ 'node_modules'] } ultimate vis

Stitching sub-images in MATLAB to form the final image -

i looked thoroughly in internet see how stitch sub-images none corresponds need. in need of explanation before understand how whole programming process might go. i have taken images of line camera @ fixed distance , varying camera position along line steps of 5mm , taking image. continue until take final image of end of line. i have images stored in excel files (35files). have converted files (images) array of 2d matrices. so question is: how stitch images first sub-image last sub-image in matlab final exact image of line? how treat different sub-images? not understand basics of stitching! how dimensions of line gets preserved on final image?

mysql - Errorcode 22 while running mysqldump -

yesterday run mysqldump , worked find, today running same commad same parameters throws error: mysqldump: error: 'can't create/write file 'c:\windows\servic~2\networ~1\appd ata\local\temp#sqlb98_13b9_2.myi' (errcode: 22)' when trying dump tablespaces mysqldump: couldn't execute 'show fields tblinvmat ': can't create/write t o file 'c:\windows\servic~2\networ~1\appdata\local\temp#sqlb98_13b9_4d.myi' (er rcode: 22) (1) os: windows server 2012 mysql 5.5.28 what happening , why because using heidisql can export database properly? edit: i've tryed see server status using mysql workbench tool throws messageboxes same error code. make sure if have acces path/file , mysql temp files dir.

vb.net - ManagementException: Not found -

i have program runs on wearable terminals in our warehouse. these terminals connect via remote desktop our server hosts , runs program. this program takes scan of product, launches program (if isn't running current user) handles processing, additional processing once finished. 1 issue i'm running checking if second program running. i've tried lot of different code settled on seemed work fine. private function checkprintlabelrunning() boolean dim selectquery string = "select * win32_process name = 'vbprintlabel.exe'" dim searcher new system.management.managementobjectsearcher(selectquery) dim processlist system.management.managementobjectcollection = searcher.[get]() each obj system.management.managementobject in processlist dim arglist string() = new string() {string.empty, string.empty} dim returnval integer = convert.toint32(obj.invokemethod("getowner", arglist)) if returnval = 0 if a

Three python modules, calling one another -

i working on project have 3 python modules ( a.py , b.py , c.py ). module a calling module b , module b calling module c , , module c calling module a . behaviour bizzare when runs. here 3 modules: a.py print('module a') def a() : print('inside a') return true import b b.b() b.py print('module b') def b() : print('inside b') return true import c c.c() c.py print('module c') def c() : print('inside c') return true import a.a() when run a.py , output observed : module module b module c module inside b inside inside c inside b whereas expected behavior is: module module b module c module inside b why happen? there alternative way such implementation? this has stack frames , how functions , imports called. you start running a.py . 'module a' first thing happens: import b : 'module b' within b , c.py imported: 'module c' module c

javascript - Set "this" to an selector inside if statement when no event listeners triggered -

i trying set "this" selector inside if statement via jquery when there no event listeners triggered. @ moment have write alot of code achieve behaviours seen below function show(){ if($('input#q1male').is(":checked")){ //do something... } else { //do else... } if($('input#q1female').is(":checked")){ //repeated something... } else { //repeated else... } }show(); if "this" can applied inside if statement if simplify , clean javascript. tried looking .call() , .apply() without luck. you use jquery.bind before calling function set context(='this'), or said, use apply/call when calling function. apply/call accept first argument context of function, e.g : show.apply(wantedcontext, [arg1, arg2,...]); or : show.call(wantedcontext, arg1, arg2,...); in case wantedcontext $('input#q1male'), function : function show(){ i

javascript - Windows Phone 8.1 Battery Info -

hi need functionality windows phone 8.1 winrt app (javascript). 1. api detect when device under charging 2. api detect battery percentage under limit. there no actual way see if battery charging can use following code: debug.writelineif(battery.getdefault().remainingdischargetime > timespan.fromdays(5),"battery charging"); in order check battery level need following: debug.writeline(battery.getdefault().remainingchargepercent.tostring() + "% battery remiaining");

Purpose of simple wrapper function in C -

in ex26 of 'learn c hard way' in db.c file zed defines 2 functions: static file *db_open(const char *path, const char *mode) { return fopen(path, mode); } static void db_close(file *db) { fclose(db); } i have hard time understanding purpose/need wrapping these simple calls fopen , fclose . are, if any, advantages of wrapping simple functions, example given above? in particular case wrapper used hide detail db_open , db_read or db_close map file operations. this approach implements abstraction layer through database related functions accessed. provides modularity , may later allow adding more methods open/read/close databases. as explained michael kohne in comments, wrapper should improved totally hide e.g. type of file *db , substituting struct db_context *context; .

Solr indexing structure with MySQL -

i have 3 5 search fields in application , planning integrate apache solr. tried sams single table , working fine. here questions. can create index multiple tables in same core ? or should create separate core each indexes (i guess concept wrong). suppose have 4 tables users, careers, education , location. have 2 search boxes in php page 1 search simple locations (just autocomplete box) , 1 search keyword should check on tables careers , education. if multiple indexes possible under single core; 2.1 how define query here ? 2.2 can specify index name in query (like table name in mysql) ? links can answer concerns enough. if you're expecting query same data part of same request, such auto-completing users, educations , locations @ same time, indexing them same core want. the term "core" identical term "index" in usage, , having multiple sets of data in same index achieved through having field indicates type of document (and applying filter

jquery - javascript - Full screen -

if (!document.fullscreenelement && !document.mozfullscreenelement && !document.webkitfullscreenelement && !document.msfullscreenelement) { if (document.documentelement.requestfullscreen) { document.documentelement.requestfullscreen(); } else if (document.documentelement.msrequestfullscreen) { document.documentelement.msrequestfullscreen(); } else if (document.documentelement.mozrequestfullscreen) { document.documentelement.mozrequestfullscreen(); } else if (document.documentelement.webkitrequestfullscreen) { document.documentelement.webkitrequestfullscreen(element.allow_keyboard_input); } } else { if (document.exitfullscreen) { document.exitfullscreen(); } else if (document.msexitfullscreen) { document.msexitfullscreen(); } else if (document.mozcancelfullscreen) { document.mozcancelfullscreen(); } else if (document.webkitexitfullscreen) { documen

autohotkey - How to use my custom COM dll with Auto HotKey -

i writing app , want give ahk access it. the library written in vb.net , contains 1 class , 1 method. snippet below. public class myappconnect ‘this method want call public sub findit(byval afn string) ‘here work done end sub end class this library registered , working fine. example can use library project or vba office program access or word. means registering correctly in registry. i know nothing ahk how can use library ahk? i believe function in autohotkey looking is: dllcall here's tutorial's on usage of dllcall: http://www.autohotkey.com/board/topic/88313-my-dllcall-tutorial-for-beginnersmessagebox/ http://ahkscript.org/boards/viewtopic.php?t=406

How to delete MySql database row with PHP button -

i have backend website setup displays users on site in organised table, should able edit , delete users php page. cannot delete function work, here code. data_display.php <?php include('session.php'); ?> <?php include ("db.php"); ?> <?php $sql = "select * username order usernameid desc"; $query = mysql_query($sql) or die(mysql_error()); if (isset($_get['usernameid'])) { $id = mysql_real_escape_string($_get['usernameid']); $sql_delete = "delete users id = '{$usernameid}'"; mysql_query($sql_delete) or die(mysql_error()); header("location: data_display.php"); exit(); } ?> <!doctype html> <html lang="en"> <head> <link rel="icon" type="image/ico" href="favicon.ico"> <title>network tv - records</title> <meta charset="utf-8" />

c# - Show Drawing.Image in WPF -

i´ve got instance of system.drawing.image. how can show in wpf-application? i tried img.source not work. i have same problem , solve combining several answers. system.drawing.bitmap bmp; image image; ... using (var ms = new memorystream()) { bmp.save(ms, system.drawing.imaging.imageformat.png); ms.position = 0; var bi = new bitmapimage(); bi.begininit(); bi.cacheoption = bitmapcacheoption.onload; bi.streamsource = ms; bi.endinit(); } image.source = bi; //bmp.dispose(); //if bmp not used further. @peter from this question , answers

php - visitor ip changes within 10 seconds -

when visitor enters website, keep track of ip address. when open video on website, send ip address part of encoded url request server streams video. able stream video ip address in decoded url parameter should same url requesting stream. now noticed not same. understand clearly, if there lot of time between entering website , streaming video, ip can have changed due nat, gateways, etc. happening within time-frame of several seconds. see log file below. the difference in code between website , streaming server is: website written in .net -> detect ip using: request.userhostaddress streaming server uses php stream video. --> detect ip using: $_server['remote_addr'] . what want achieve,that video stream urls on website, surely collected spiders, remote websites etc., can not used downloading or playing video remotely. aware of temp url solution want implement if there no easy way tackle current issue. my questions: why happen? using wrong code detect

excel - Pull a random value from a list if another column has a value in same row -

i have list of named entities , chart of how have been audited: name may june july aug alpha 2 1 1 beta 1 1 gamma 1 1 1 delta 1 1 i'm trying have cell display in given month wasn't audited @ least once. the best have managed has been using 2 cells, 1 named "randnum" =index(a2:a5,randbetween(1,counta(a2:a5))) and cell use random returned value, if value returned has been audited month says "try again." in example 4 column july. when hit delete on blank cell updates. =if(vlookup(randa,a2:e5,4)>=1,randnum,"try again") i'd rather not resort vba if can i'm open it. =index($a$1:$a$5,large((index($b$2:$e$5,,match(d9,$b$1:$e$1,false))=0)*(row($a$2:$a$5)),randbetween(1,countif(index($b$2:$e$5,,match(d9,$b$1:$e$1,false)),""))),1) put month want in d9 , enter above array formula (ctrl+shft+enter) index($b$2:$e$5,,match(d9,$b$1:$e$1,false)) this part in 2 places.

sql server - How to find last 10 years using sql query -

i working on sql query have find last 10 years. suppose 2015 then query should return 2015,2014,2013... , on. have used following query- select top 10 datepart(year,getdate()) order datepart(year,getdate()) desc but above query returning single query current year. please me here. try this: with yearlist ( select (datepart(year,getdate())-10) year union select yl.year + 1 year yearlist yl yl.year + 1 <= year(getdate()) ) select year yearlist order year desc;

mysql - finding values between given inputs using sql -

am curious there way extract specific elements database in specified range based on 2 inputs. ex: select books minimum price = 10 , maximum price = 35, using mysql? you can use select find rows values in ranges. example: select * books price >= 10 , price <= 20; or may use between instead: select * books price between 10 , 20; both queries above return rows price between 10 , 20.

android - Decoding RAW protobuf data in Charles Proxy -

i have captured traffic between android application , website using charles proxy. charles identifies traffic protocol buffer stream. the structure shown in charles: - site.com | -- sub | --- message.proto the raw message: post site.com/sub/message.proto http/1.1 token: random id: random authorization: basic oti[..] user-agent: dalvik/1.6.0 (linux; u; android 4.3; galaxy nexus build/jwr66y) host: site.com connection: keep-alive accept-encoding: gzip content-type: application/x-www-form-urlencoded content-length: 580 ��hï õÜÕñ6iaõ*|{6¤oqiùk*դž¼ s_½ª¥8.3ÝÎu öÚ´êvfbeùõÈî¿;µ¼ö%s [...] i have tried few things decode content, in vain. command proton decode_raw < message.txt results in fail message failed parse input . not sure if message protobuf message since content-type in headers not indicate protobuf used. have saved traffic .bin file. charles has capability display contexts of protobuf message, requires corresponding descriptor file. descriptor file need actu

javascript - Jwplayer is cuting part of streaming video (MAC) -

jwplayer cutting part of live streaming video (at bottom or right), , happing mac browsers. same windows browsers working well. jwplayer code: jwplayer('player').setup({ sources: [{ file: 'http://stream.streamexample.com/live/ngrp:live/jwplayer.smil', }, { file: 'http://stream.streamexample.com/live/ngrp:live/playlist.m3u8', }], rtmp: { bufferlength: 6 }, title: 'live', width: '854', height: '480', skin: 'jwplayer/glow-rtmp.xml', autostart: true, androidhls: true, }); jwplayer size same streaming video size i trayed add stretching:"exactfit" not helped for streaming use wowza. video coded h.264 , streaming different qualities jwplayer version 6.10 chrome console give error [.ppapicontext]gl error :gl_invalid_enum : glteximage2d: target gl_texture_rectangle_arb it's posible solve or there better alternative jwpla

asp.net core - How to get the project type of MVC 6 project? -

i'm using context menu mvc projects. i'm using value of project enable add-in. mvc3,mvc4 , mvc5 working fine. mvc 6 (asp.net 5) project doesnt have value in project file (.xproj) , cant value using method getaggregateprojecttypeguids() can used older mvc projects. there other way find project type? need find whether project mvc6 or not change add-in visibility. there's no such thing mvc 6 project. there's project dependency on mvc 6. if want check need @ package references.

objective c - Change placeholder colour -

i used code change placeholder colour it's not working. i used method in category. -(void) drawplaceholderinrect:(cgrect)rect { [[uicolor bluecolor] setfill]; [[self placeholder] drawinrect:rect withfont:[uifont systemfontofsize:16]]; } error: category implementing method implemented : 'drawinrect:withfont:' deprecated: first deprecated in ios 7.0 - use -drawinrect:withattributes: try: [[self placeholder] drawinrect:rect withattributes:@{ nsfontattributename: [uifont systemfontofsize:16], nsbackgroundcolorattributename: [uicolor bluecolor], nsforegroundcolorattributename: [uicolor greencolor], //font color }]; instead of 'drawinrect:withfont:' *attributes nsdictionary attributes want, , there can specify font want, among stuff, color, etc.

classification - R - factor examcard has new levels -

i built classification model in r using c5.0 given below: library(c50) library(caret) = read.csv("all_srn.csv") set.seed(123) intrain <- createdatapartition(a$anatomy, p = .70, list = false) training <- a[ intrain,] test <- a[-intrain,] tree <- c5.0(anatomy ~ ., data = training, trcontrol = traincontrol(method = "repeatedcv", repeats = 10, classprob = true)) treepred <- predict(tree, test) the training set has features - examcard, coil_used, anatomy_region, bodypart_anatomy , anatomy (target class). features categorical variables. there total of 10k odd values, divided data training , test data. learner worked great training , test set partioned in 70:30 ratio, problem comes when provide test set new values given below: treepred <- predict(tree, test_add) here, test_add contains present test set , set of new values , on executing learner fails classify new values , throws following er

r - control order of updates in shiny -

here mwe: library(shiny) runapp(shinyapp( ui = pagewithsidebar( fluidrow( column(3, wellpanel( numericinput("numfields", "select number of fields", 2, min = 1), br(), uioutput("fields"), br(), actionbutton("gobutton", "go!") )), column(3, wellpanel( uioutput("morefields") )), column(3, wellpanel( numericinput("numfields2", "select number of fields 2", 2, min = 1), br(), actionbutton("gobutton2", "go2!") )) ), server = function(input, output, session){ output$fields <- renderui({ numfields <- as.integer(input$numfields) lapply(1:numfields, function(i) { textinput(paste0("field", i), paste0("type in field ", i)) }) }) output$morefields <- renderui({ if (input$gobutton == 0) return(null) isolate({ numfields <-

javascript - Jquery .load() only for first 6 elements, with data-value -

i have 7 html div's. how can load dynamically data first 6 div's using data-recentviewes load-url each element? html: <div id="recentviewes" data-recentviewes="/123/"></div> <div id="recentviewes" data-recentviewes="/456/"></div> <div id="recentviewes" data-recentviewes="/789/"></div> <div id="recentviewes" data-recentviewes="/321/"></div> <div id="recentviewes" data-recentviewes="/654/"></div> <div id="recentviewes" data-recentviewes="/987/"></div> <!-- 6 --> --- <div id="recentviewes" data-recentviewes="/abc/"></div> <!-- dont load --> js (work first element): window.addeventlistener('load', function () { var recentviewes = $("#recentviewes").data('recentviewes'); $(&

c# - Error parentkey and childkey are identical in Stimulsoft -

i want created master-detail report. i have 2 classes paystub & payments payments have foreignkey of paystubid . public class paystub { public int paystubid { get; set; } public int code { get; set; } public string name { get; set; } } public class payment { [foreignkey("paystub ")] public int paystubid { get; set; } public paystub paystub { get; set; } public int amount{ get; set; } public string description{ get; set; } } i've tried 2 ways: business object.insert parent business object & child business object , in wpf. report.regbusinessobject("paystub", paylist); report.regbusinessobject("payments", paymentlist); this show master , don't show detail. datatable.insert 2 datatable , relation this. in wpf: report.regdata("paystub", paylist); report.regdata("payments", paymentlist); i error parentkey , childkey identical . i change models this. public class paystub { publi

How to distinguish the which callback run rails -

i using same method in 2 callbacks before_destroy , before_update . inside method how can check callback called method? my callbacks: before_destroy :set_manager_to_true_of_any_trainee before_update :set_manager_to_true_of_any_trainee this callback method: def set_manager_to_true_of_any_trainee if destroy_callback # code here else # code here end end i doing because 90% code same both callback before_destroy need skip 1 condition. thanks in advanced. we can find action transaction belongs to see method transaction_include_action? however can't find callback i.e after_create or before_create makes sure transaction belongs create action. in case can used follows, if transaction_include_action?(:update) ... else transaction_include_action?(:destroy) ... end note:- method deprecated in rails4. , new method introduced transaction_include_any_action?(actions) accepts array of actions. see here all best!