Posts

Showing posts from April, 2010

javascript - Play Local Video on PhoneGap/Cordova in Windows Apps -

i'm developing windows/windows phone 8.1 apps using phonegap(html, js, css, jqm) , native/windows runtime component. want play video in html page. video file located inside application folder. don't know what's wrong. please me. in html, have added: <div id="content"> <button onclick="domainobject.playvideo()" type="button" data-theme="b">play video</button> <video id="video" src='' type='video/mp4' width="400" autoplay="autoplay" controls></video> </div> and in js: var domainobject = { playvideo: function () { var vidpath = windows.storage.applicationdata.current.localfolder.path + "\\test.mp4"; var video = document.getelementbyid('video'); var source = document.createelement('source'); source.setattribute('src', vidpath); video.appendchild(source

angularjs - When changing states browser doesn't find project js files -

i trying create new state in angular using ngrouter. have index.route.js file contains following: (function() { 'use strict'; angular .module('testapp') .config(routeconfig); /** @nginject */ function routeconfig($stateprovider, $urlrouterprovider) { $stateprovider .state('home', { url: '/', templateurl: 'app/main/main.html', controller: 'mainctrl' }) .state('tools', { url: '/tools/:category', templateurl: 'app/tools/tools.html', controller: 'toolsctrl', controlleras: 'tsctrl' }); $urlrouterprovider.otherwise('/'); } })(); then, have created tools.html , tools.controller.html . tools.html : hello world tools.controller.js : (function(){ 'use strict'; angular .module('testapp') .controller('toolsctrl', toolscontroller); /** @nginject */ function

MySQL Create Trigger if no exists? -

select trigger_schema, trigger_name information_schema.triggers; +------------------------+------------------+ | trigger_schema | trigger_name | +------------------------+------------------+ | tv_client1 | public_id | +------------------------+------------------+ i want added existing trigger public_id tv_client2. how create trigger if not exists? the final result should be: select trigger_schema, trigger_name information_schema.triggers; +------------------------+------------------+ | trigger_schema | trigger_name | +------------------------+------------------+ | tv_client1 | public_id | +------------------------+------------------+ | tv_client2 | public_id | +------------------------+------------------+ the query select trigger_schema, trigger_name information_schema.triggers; shows database name , trigger name. in case public_id trigger has been created in tv_client1 database. i

openstack - Fiware Keystone API Create User -

we trying create users in fiware idm using keystone identity api. we sending following curl command curl -s \ -h "x-auth-token: e746971040657101bb1e" \ -h "content-type: application/json" \ -d '{"user": {"name": "newuser", "password": "changeme"}}' \ http://localhost:35357/v3/users | python -mjson.tool the token have used 1 configured in keystone.conf admin_token=e746971040657101bb1e but result getting following { "error": { "code": 401, "message": "the request have made requires authentication.", "title": "unauthorized" } } does have idea can happen? a couple of ideas you. one port value 35357 not admin api calls, it's intended user calls. also since using v3 api believe token can't used when creating user unless indicating domain. however can't tell curl command acti

Android: keyboard numeric changes automatically to keyboard text alone -

i have simple item renderer standard listview. in item renderer have 2 edittext configure that: <edittext android:layout_width="40dp" android:layout_height="wrap_content" android:inputtype="number" android:selectallonfocus="true" android:text="8"/> when click first on 1 of these edittext, numeric keyboard appears 1 second, changes automatically standard text keyboard... don't know why! if click new time on 1 of these, numeric keyboard appears , it's ok (no change). actually, problem appears if there no open keyboard. have got idea? thank much! how check if java code have setinputtype() on edit first? if still have no clues, try method profile app or keyboard , check who's calling setinputtype() kind-a method can helpful.

python - Error using pytest tutorial -

i read unit-test brilliant feature write better code , assert features of target code stay same. wanted use it... i using anaconda on linux machine. i started using pytest working through manual's starter guide on homepage . after successful installation there appears first (unintended) error: strpeter@linuxcomputer:~$ py.test ================================================== test session starts =================================================== platform linux2 -- python 2.7.8 -- py-1.4.25 -- pytest-2.6.3 collected 0 items / 1 errors ========================================================= errors ========================================================= ___________________________________________________ error collecting . ___________________________________________________ anaconda/lib/python2.7/site-packages/py/_path/common.py:331: in visit x in visitor(fil, rec, ignore, bf, sort).gen(self): anaconda/lib/python2.7/site-packages/py/_path/common.py:377: in gen

knockout.js - restore page status, knockout site tutorial section -

this how knockout site restore page status. every time go page http://learn.knockoutjs.com/#/?tutorial=intro , type in click run button, , go site, click button browser go tutorial page. page prompt window saying "you've been on introduction before. continue left off?". how implement that? in advance.

AngularJS: Is it possible to do post-processing of ng-bind-html without $watch? -

i have html content should output ng-bind-html directive, , after manipulations content(for example dom manipulations, jquery plugins, etc). stackoverflow provides me such solution : <div ng-app="myapp" ng-controller="myctrl"> <div ng-bind="sometext" my-directive>before</div> </div> so create custom directive higher priority , watch inside: angular.module('myapp').directive('mydirective', function() { return { priority: 10, link: function(scope,element,attrs) { scope.$watch(attrs.ngbind, function(newvalue) { console.log("element ",element.text()); }); } }; }); and demo but far i'm not going change content don't want use $watch . possible without $watch ? option 1 (avoid $watch requested): one option skip ng-bind-html , $compile or $parse html yourself. angular's ngbindhtm

Why is it needed for us to calibrate the depth camera and color camera of a Kinect? -

i new kinect. used see on internet joint depth camera , color camera calibration of kinect has been finished when goes out of factories. what's meaning of calibration second time? on other hand, know there applications such many somatosensory games use kinect, how these applications finish calibration? seems impossible game players uses kinds of calibration algorithms done. thanks! the kinect has indeed internal calibration. in software can therefore use coordinatemapper functions go xyz world coordinates uv color image coordinates. now imagine following, send xyz data , color image else (or different computer later processing). have no contact kinect anymore, can't ask coordinatemapper how relate 2 dataset. this why people own kinect calibration. because calibration parameters available , can shipped xyz , uv data. that said, if don't need this, stick coordinatemapper! calibration of kinect not easy realize.

c# - json.net error (windows 10) -

i have app in windows 8.1 universal app working fine. in upgrade windows 10, have error: assenbly 'newtonsoft.json' invokes 'attribute.getcustomatributtes(assembly)' not in windows store profile. and assenbly 'newtonsoft.json' invokes 'attribute.getcustomatributtes(memberinfo, bool)' not in windows store profile. and assenbly 'newtonsoft.json' invokes 'attribute.getcustomatributtes(parameterinfo, bool)' not in windows store profile. json.net not compatible windows 10? yes json.net works windows 10, had use source code github , add code windows 10 class library few warnings compiles fine, , warnings regards method decorators, nuget package did produce errors similar got work fine.

angularjs - Show JSON data from URL w/ Parameter -

i'm having trouble displaying information rest api. each location_id (2-7) have own json data. how can data display each individual location_id. below code: controller: countryapp.controller('viewlocation', function($scope, $http, $routeparams) { $scope.localeid = $routeparams.localeid; $http.get('http://localhost/slimtest2/location/' + $scope.localeid).success(function(data) { $scope.location = data; }); ); view individual item <div ng-controller="viewlocation"> stuff <div ng-model="location in location.location"> {{ location.location_id }} </div> </div the json data http://localhost/slimtest2/location/(location_id) . have location_ids 2-7. { "location" :[{"location_id":"2","location_reference":"657821349","location_title":"guam premier outlet,? ???? ??

Spring batch - causing possible deadlock -

i have batch job multiple steps. each step involves reading 5-6 tables joined, , writing report_table. in step 8, after reading , writing 450000 records, failed exception - caused by: java.sql.sqlexception: not indexed read next row. understand exception caused deadlock. there no other step running in parallel , step that's writing report_table. have caused deadlock ? on time crunch finish job , appreciated. structure of job step1 step2 split [ step2a, step2b ] running in parallel step 3 step4 split [ step4a , step4b, step 4c] running in parallel step5 split [ step5a , step5b, step 5c] running in parallel step6 step7 step8 step9 my configuration follows : <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

Making Http Call from c# -

there classic asp application makes calls .shtml files using asphttp.conn. makes request appending input , reads response reading values in response length. here example strmessage= "test.shtml" set httpobj = server.createobject("asphttp.conn") httpobj.url = url & strmessage httpobj.postdata = "testarea=" & strrequestdata httpobj.timeout = 60 httpobj.requestmethod = "post" strresponsedata = httpobj.geturl response.write mid(strresponsedata,3,1) response.write mid(strresponsedata,4,3) if need rewrite this, best way this. using mvc , rewriting ui. best approach make httpcall c#?. backend request sent not changed. please suggest. using .net framework 4.5 can make request as public static async task<int> htmlloadasync(string url/*, bool adduseragent = false*/) { try { var client = new httpclient(); //if (adduseragent) optional //{ // client.defaultrequest

javascript - AngularJs DOM manipulation inside Directive without Jquery -

let's start right away, let's directive: appdirectives.directive('mydirective', function () { return{ restrict: 'a', templateurl: 'directives/template.html', link: function (scope, element, attr) { // maybe element or attr access dom inside template } }; }); and template: <div class='col-md-12 videoholder' id="slidercontainer"> <canvas id="mycanvas"></canvas> <div class="mylangaugesholder"></div> </div> normally use (but that's bad practice in angular) document.getelementbyid('mycanvas').style.opacity = 0.6; my question how access id (for example mycanvas) inside directive without jquery . tried element parameter access <div data-mydirective></div> . best practices, code examples welcome! there plenty native dom methods. in case can use queryselector /queryselectorall

Extending sbt-native-packager (Docker) -

i'm having problem sbt-native-packager's docker module. uses (overridable) bash template template has ${{template_declares}} substitutes important project information bash file. my problem can't use bash--i'm using busybox, uses ash. of generated stuff sbt incompatible ash. code dropped in ${{template_declares}} incompatible , need have generate different. i see there both windows , bash "generators" predefined. how can make ash generator modifies bash version? i can clone repo , make ash generator i'm hoping extend rather clone. i've never extended sbt plugin. how done? things have changed since op first opened question. there ashscriptplugin better suited docker container running alpine. enableplugin(ashscriptplugin) you can find out more in current docs

python - paper rock scissor - Global Variable? -

why not working? need assign global variables? it's saying player1 not defined! options=["p", "s", "r"] def valid1(): validationa = true while validationa==true: player1=input("player 1.. take go") if player1 not in options: print ("invalid") else: validationa==false return player1 def valid2(): validationb = true while validationb==true: player2=input("player 2.. take go") if player2 not in options: print ("invalid") else: validationb==false return player2 valid1() valid2() if player1=="p" , player2 =="p": print("draw") else: print("works unfinished") your functions return values, never assign them anything. player1 = valid1() player2 = valid2() in fact, these functions exact same thing, if make text either

javascript - How to grab the ajax call (the url) sent from a form using ng-submit? -

Image
i have form submits data rails backend. when submitted, form run ajax call. url use : http://localhost:3000/panel/vehicles?utf8=%e2%9c%93&q%5bcode_cont%5d=66 . how can grab url form sends using ng-submit ? <input type="hidden" ng-value="geturl()"/> $scope.geturl = function(){ return $location.absurl(); }

rotation - Rotate a image and fill screen in python -

Image
i trying rotate photo fill whole frame (in case 720x480 window). when use default image.rotate function pil/pillow in code fragment below: file = image.open("test.jpg") out = file.rotate(45, expand = 1) out.save(work_dir+foreground,quality=100) i result in photo 1 rotates photo within box. i'd rotate fills whole box (i dont mind cropping) in photo 2 there way that? found cheap solution square images: def rotate_image_square(im, deg): im2 = im.rotate(deg, expand=1) im = im.rotate(deg, expand=0) width, height = im.size assert (width == height) rads = math.radians(deg) new_width = width - (im2.size[0]-width) left = top = int((width - new_width)/2) right = bottom = int((width + new_width)/2) return im.crop((left, top, right, bottom))

php - NetBeans, code completion for PHPUNit not working. (Windows) -

i've followed these steps phpunit working in netbeans in windows: download phpunit.phar , save c:\phpbin follow instructions under windows heading here set path variables , netbeans global/project settings everything's working, except don't have code completion working phpunit. example, if type: $this->asser i expect show list of various assert statements. doesn't. i tried following this guide working, don't know phpunit source files are, cannot add netbean's php global include path per instructions. where source files? or there way autocompletion correctly configured? thanks you should have php windows installation . when last did using pear (which deprecated) phpunit installed under root of php web server. bet phar puts in same place. once done, typically have set bootstrap tells netbeans executables, directories , such. oddly enough the netbeans tutorial doesn't mention have extend phpunit class test. should giv

c - getchar() continues to accept input after including Ctrl+Z in same line -

Image
simple c program accept , print character. int c; while((c=getchar())!=eof) { putchar(c); } i not getting why accept input when press ctrl+z @ end of line ex hello(press ctrl+z) hello (some symbol) work after leaving line pressing ctrl+z. , using window 7 when call getchar() in turn ends making read() system call. read() block until has characters available. terminal driver makes characters available when press return key or key signifying end of input. @ least looks like. in reality, it's more involved. on assumption ctrl-z mean whatever keystroke combination means "end of input", reason way read() system call works. ctrl-d (it's ctrl-d on unixes) character doesn't mean "end of input", means "send current pending input application". when you've typed in before pressing ctrl-d, input gets sent application blocked on read() system call. read() fills buffer input , returns number of bytes put in buffer

angularjs - Eclipse EE can't expand folder called 'services' -

Image
i developing mobile application using ibm mobile first using angularjs in eclipse ee. have basic file structure containing folders 'controllers', 'directives', 'filters' , 'services'. problem eclipse: in project explorer can't seem expand 'services' folder. can see content of folder in windows explorer sublime text file three. when rename folder else can expand in eclipse. what cause? there solution problem or have live with? suggestions on alternative names then? have use eclipse due policies @ workplace. there special treatment eclipse versions folders named "services". default, @ least in views such folders hidden. you can modify view settings turn off annoying behaviour. bring view menu clicking little triangular icon, top right select customize view , in content tab unselect services navigator content. your services folder visible.

javascript - How to take screenshot of entire page in Protractor? -

following protractor api documentation there should way take screenshot of entire page, not visible frame. in fact should default behaviour. when takescreenshot() called like browser.takescreenshot().then(function (png) { // writing down image }); then in file saved option 3. documentation - 'visible portion of current frame'. how force webdriver take full page screenshot? this respective browser driver server. e.g if using chrome, chromedriver server responsible deliver screenshot of entire page. it has nothing webdriver client libraries or protractor.

javascript - Which is better: mobile/desktop code in same file, or in separate files? -

say example have markup... <p class="remove-mobile remove-tablet add-desktop">this desktop</p> <p class="add-mobile add-tablet remove-desktop">this mobile device</p> ...paired css... @media , (//code goes here) { //code goes here } would better (in terms of page speed, page load , forth) above, or better have mobile code in different file desktop code, , use kind of javascript "hey, you're on mobile device. i'm going show file" or "hey, you're on desktop, here's different file"? i've seen professional companies former latter, i'm confused more optimal. quote google : it's better have responsive webpage not 2 different layouts google says recommended have mobile ready page , not redirect ( or warn user change other design ). , webpage speed there not difference between non responsive layout , responsive one. p.s. : forgot place read tip in mobile ready checker or webm

jquery - Enable button only if start and end dates are not empty -

initially button in disabled mode. when user selects both start , end dates should enabled download. the below code enables button when start or end date selected. how enable download button when both inputs not empty applying class $('#btn_download').attr('class','btn-general'); ? //enable 'download' button if start-end dates not empty var enabledisablebtn = function(){ var startval = $('#datepicker_start').val().trim(); var endval = $('#datepicker_end').val().trim(); var disablebtn = startval.length == 0 || endval.length == 0; $('#btn_download').attr('disabled',disablebtn); $('#btn_download').attr('class','btn-general'); } $('#datepicker_start').datepicker({ enabledisablebtn(); }); $('#datepicker_end').datepicker({ enabledisablebtn(); }); <button class="btn-general disabled" id="btn_download" type="button"

asp.net - How to redirect all non-www URLs to https://www. in IIS? -

i want add proper 301 permanent redirect rule in iis 8.5. i've added following rules not working. <rule name="redirect top domains non-www www" stopprocessing="true"> <match url="(.*)" /> <conditions logicalgrouping="matchall" trackallcaptures="false"> <add input="{http_host}" pattern=".*localhost.*" negate="true" /> <add input="{http_host}" pattern=".*stage\..*" negate="true" /> <add input="{http_host}" pattern=".*dev\..*" negate="true" /> <add input="{http_host}" pattern="^(http:\/\/){0,1}(www\.){0,1}([^\.]+)\.([^\.]+)$" ignorecase="true" /> </conditions> <action type="redirect" url="https://www.{c:3}.{c:4}" redirecttype="permanent" />

python - Issue with numpy.concatenation -

i have defined 2 numpy array 2,3 , horizontally concatenate them a=numpy.array([[1,2,3],[4,5,6]]) b=numpy.array([[7,8,9],[10,11,12]]) c=numpy.concatenate((a,b),axis=0) c becomes 4,3 matrix tried same thing 1,3 list as a=numpy.array([1,2,3]) b=numpy.array([4,5,6]) c=numpy.concatenate((a,b),axis=0) now expecting 2,3 matrix instead have 1,6. understand vstack etc work curious why happening? , doing wrong numpy.concatenate? thanks reply. can result suggested having 1,3 array , concatenation. logic have add rows empty matrix @ each iteration. tried append suggested: testing=[] in range(3): testing=testing.append([1,2,3]) it gave error testing doesnot have attribute append of none type. further if use logic of 1,3 array using np.array([[1,2,3]]) how can inside loop? you didn't wrong. numpy.concatenate join sequence of arrays together.which means create integrated array current array's element in 2d array elements nested lists , in 1d array elements vari

concat - Less like middleware for javascript files -

i have less javascript files. know grunt-contrib-concat thing, making .map file many .js files. don't want use grunt success task. know other package? have searched others without success. webpack or systemjs recommendation. both build javascript, resolving dependencies , allowing use es6 or commonjs module loading. more modern , preferred approach concatenating files.

c# - Treeview (nested dropdown) menu is not expanded on page reload bootstrap mvc4 -

Image
i'm trying implement treeview menu in application , works fine except once click on item in expanded list, reloaded page loads contracted list, makes navigation difficult users. causing this? html.actionlink in code? code menu below. please explain can done here. in advance. <li class="treeview"> <a href="#"> <span>leave management</span> <i class="fa fa-angle-left pull-right"></i> </a> <ul class="treeview-menu"> <li class="@html.isactive("leave", "index")">@html.actionlink("my leave information", "index", "leave")</li> <li class="@html.isactive("leave", "newleaverequest")">@html.actionlink("new leave request", "ne

How to make an image move using the keyboard in java? -

Image
i have maze need ball move through, don't know code need use move image of ball around maze. have been given hint need swap images round. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class cballmaze extends jframe implements actionlistener { //below have declared different objects have used throughout program private jbutton buttonright, buttonleft, buttonup, buttondown, buttontl, buttontr, buttonbl, buttonbr, buttoncenter, optionone, optiontwo, optionthree, optionexit, scenarioact, scenariorun, scenarioreset, compassph; private jbutton [] game = new jbutton [208]; private jpanel panelcentre, panelright, panelbottom, buttonpanel, compasspanel, optionspanel, selectionpanel, panelact, panelrun, panelreset, panelslider; private jtextfield optiontf, squaretf, directiontf; private jlabel option, square, direction, compassdirection; private jslider speedslider; private string firstoption = "1", secondoption = "2", thirdoption = &q

javascript - angularJs animate ng-repeat entrance -

i've got simple list of countries , i'm trying them animate on entrance can't seem find what's stopping working? <ul> <li ng-repeat="country in countries" type="country" class="slide"> <a ui-sref="state5"> {{country.name}}</a> </li> </ul> css file: .slide.ng-enter { transition:0.5s linear all; transform:translatey(-100px); } .slide.ng-enter.ng-enter-active { transform:translatey(0); } animate.js file: countryapp.animation('.slide', [ function() { return { enter: function(element, donefn) { jquery(element).slidein(1000, donefn); } } }] can perhaps clarify me? thanks your css style working firefox. if want chrome use -webkit prefix .slide.ng-enter { transition:0.5s linear all; transform:translatey(-100px); -webkit-transition:0.5s lin

c# - how to get column Index by column name? -

i have datagrid having few columns- the header of grid hyperlink , setting value @ runtime follows- string strq1 = "<a href='somepage.aspx?id=1'>gfgytyty<a>"; dtgrid.columns[0].header = strq1; string strq2 = "<a href='somepage.aspx?id=2'>yhtryrtuyu<a>"; dtgrid.columns[1].header = strq2; , on... it working properly. suppose want index of perticular column of datatgrid name not able it. tried int colindex = dtgrid.columns.indexof(dtgrid.columns[strq2]); this should return 1 columnindex returning -1, also, dtgrid.columns[strq2] giving me null value. what doing wrong here? try use linq firstordefault object first , use .indexof(object) : dtgrid.columns.indexof(dtgrid.columns.firstordefault(c => c.header == strq2));

javascript - manipulating a Play controller parameter in a template -

in play app(java) have table different columns, if user clicks on title of each column, table sorted based on column. each time user clicks on it, sorting should change "asc" "desc" , vice versa. i need solution this: each time user clicks on link, order changes "asc" "desc" , vice versa. , controller should called. <a href="@routes.application.changeorder(order)">test</a> is possible write scala function inside template this? or how javascript? you can use if-clause: @if(order.equals("asc")){ <a href='@routes.application.changeorder("desc")'>test</a> } else{ <a href='@routes.application.changeorder("asc")'>test</a> }

python - In solr search, solve the error: model 'X' has an empty model_attr 'company' and doesn't allow a default or null value -

i using solr search in django. when rebuilding index solr, following error: model 'x' has empty model_attr 'company' , doesn't allow default or null value. does know mistake made, , how can solve issues. you need add indexes.charfield(model_attr='company', null=true) and if want allow blank add blank=true indexes.charfield(model_attr='company', blank=true, null=true)

c# - More succinct code example -

is there more succinct way of writing this? articlecount += 1; if (articlecount > 4) { // reset counter 1 articlecount = 1; } yes: if (++articlecount > 4) articlecount = 1;

Android.KeyStore getEntry() returning null -

i using keystore generate key encryption. working fine somehow stopped generate key. please find below code: private void createkey() throws nosuchproviderexception, nosuchalgorithmexception, invalidalgorithmparameterexception { // create start , end time, validity range of key pair that's // generated. calendar start = new gregoriancalendar(); calendar end = new gregoriancalendar(); end.add(calendar.year, 1); context context = sncontext.getinstance().getcontext(); // keypairgeneratorspec object how parameters key pair passed // keypairgenerator. fun home game, count how many classes in sample // start phrase "keypair". keypairgeneratorspec spec = new keypairgeneratorspec.builder(context) // you'll use alias later retrieve key. it's key key! .setalias(fnconstants.alias) // subject used self-signed certificate of generated pair

r - How can I have the full range in the x- and y-axis labels in a plot? -

Image
i have 2 variables, x , y x = runif(8, 0, runif(1, 1, 5)) y = x^2 that want plot. note range of x (and hence y=x^2 ) not same. so, command plot(x, y, pch=19, col='red') produces however, don't want borders around graph, use bty='n' parameter plot: plot(x, y, pch=19, col='red', bty='n') which produces this bit unfortunate, imho, since i'd y-axis go way 4 , x-axis way 2. so, ue xaxp , yaxp parameters in plot command: plot(x, y, pch=19, col='red', bty='n', xaxp=c( floor (min(x)), ceiling(max(x)), 5 ), yaxp=c( floor (min(y)), ceiling(max(y)), 5 ) ) which produces this bit better, still doesn't show full range. also, thought nice default axis labaling uses steps 1,2,3,4 or 0.5,1,1.5,2 , not arbitrary fractions. i guess r has parameter or mechanism plot full range in axis in "humanly" fashion (0.5,1,1.5 ...) didn't

Update Rails model without touching timestamp temporary -

i have tweet model. want update model attributes without updating timestamp. i've read/tried links , didn't work me: how update single attribute without touch updated_at attribute? http://blog.bigbinary.com/2009/01/21/override-automatic-timestamp-in-activerecord-rails.html i tried override activerecord::base mentioned in second link, creating new file active_record_base_patches.rb inside lib directory. but, engine said method not found in tweet model. so, tried move update_record_without_timestamping tweet model. method found timestamp updated. is there simple method disable timestamp in rails while? laravel 4 has this: https://stackoverflow.com/a/18906324/3427434 . ps: use ruby on rails 4.2.3 on ruby 2.2.0. you create concern in model/concern , named model_timestamp.rb require 'active_support/concern' module modeltimestamp extend activesupport::concern module classmethods def without_timestamps old = activerecord::b

svn - Cache busting and Subversion -

in our web application, whenever change in javascript or css file, there following workflow: make change. test it. commit change in subversion. file has not date postfix because lose change history. in html file, changed javascript or css resource referenced, change file in question, instance "core_2015_07_01.js" "core_2015_07_14.js". the tiresome excercise change date in every html file referenced. when create new html file needs javascript file, need place informs me, date have add in order right (because not see in source in subversion). i'm content cache busting technique itself, i'm not content handling of files in subversion , on way deployment. has found better way of managing files in , around subversion? in past projects, have solved problem in 2 ways: i using grunt project. has plugin asset versioning. https://www.npmjs.com/package/grunt-assets-versioning i using apache defined rewrite rule javascript/css

php - How to select models where all relations have a specific property set to a specific value with Laravel? -

normally, i'm dealing queries have 2 models , need select 1 model wherehas query, greedy condition selects many matches possible. here 2 models: class part extends eloquent { protected $table = 'parts'; protected $primarykey = 'part_id'; public function partflights() { return $this->hasmany('partflights'); } } and class partflight extends eloquent { protected $table = 'part_flights_pivot'; protected $primarykey = 'part_flight_id'; public function part() { return $this->belongsto('spacecraft'); } } as can see, there's 1:m relationship between part , partflight . what want non-greedy match select part 's partflight 's have attribute landed set true . how can achieve this? instead of trying find out if true suggest check if none false ;) $parts = part::wheredoesnthave('partflights', function($q){ $q->where('landed',

Save TextInput on button press - kivy/python -

i have class button "save game", opens popup textinput widget , button save users text input. tried doesn't work. if print out filename after "modifying" it, prints out filename defined beforehand: .txt, not game1.txt or this. class something(widget): filename = ".txt" # code game def save(self,*args): def on_text(instance, value): return value name = textinput(text="") name.bind(text=on_text) self.filename = "{}.txt".format(name.text) b = boxlayout() save_button = button(text="save file") b.add_widget(save_button) b.add_widget(name) popup = popup(title="enter name:", content=b) save_button.bind(on_release=popup.dismiss) name.bind(on_text_validate=popup.on_dismiss) # wanted save when user closes popup popup.open() where doing wrong? (i know won't save it, want create name here, h

android - Making mobile app for a responsive site -

i have responsive web site , need make android , ios app published in each platform store asking process/steps or tool that. can use twebbrowser component in delphi xe 8 firemonkey project make these apps , make site adjust layout automatically according device used ? or there other steps should use ? or should use different tool delphi ? i'm no web developer, know making website responsive done on server site. way, if mobile user opens safari or chrome, site responsive , adjust limits device. if need make native apps each platform, have replicate website in native code , use api calls or use whatever framework (like firemonkey). still, if make app webview , load website, still won't responsive.

opencart2.x - how to use default options for product in opencart 2 -

i using open cart 2.x , need add multiple options every product. can advise how can it? how use use default options this? if looking default options, can create them under catalog > options, , selecting them when creating / editing product.

java - Spring jpa - can't use more than one EntityManagerFactory -

i'm working on java spring mvc application uses hibernate , jpa persistence layer. have 2 databases , want map entity tables in database1 , in database2. have defined 2 configuration classes this: first: @configuration @enabletransactionmanagement @enablejparepositories(value = "com.mycompany.project.persistence.orm.module.common",entitymanagerfactoryref = "commonentitymanagerfactory",transactionmanagerref = "commontransactionmanager") public class persistenceconfigcommon { public persistenceconfigcommon() { } properties additionalproperties() { return new properties() { { setproperty("hibernate.dialect", "org.hibernate.dialect.mysqldialect"); setproperty("hibernate.hbm2ddl.auto", "update"); setproperty("hibernate.show_sql", "true"); setproperty("hibernate.enable_lazy_load_no_trans

javascript - Apps Script Custom Function- Internal Error -

i've started playing around apps script. opened new spreadsheet, accessed script editor, , wrote following simple function: function doubles(num) { return num * 2; } i saved script, refreshed browser , used function in cell: =doubles(1) the correct answer (2) appeared in cell, replaced 1 argument 2. gets weird. upon changing said argument, got #error answer: "internal error executing custom function." when changed argument 1, however, error persisted. then, when decided try 2 again, got correct 4 response. having tried multiple times, refreshing/replacing spreadsheet, , scratching head i'm leaving trenches, i'm unsure why function appears work 30-50% of time. i've tried other cells, other argument numbers, etc. seems toss-up whether i'll end answer or error. there appears recently-introduced bug in handling of google apps script custom functions. this apparently subject of issue 5222 . (i "apparently" because issu

jquery - Javascript - Block that should disappear on click reappear elsewhere -

i trying 3 squares (put ramdomly) on page disappear on click reason don't understand, of them (usually 2nd or 3rd one) reappear elsewhere on page when click on them. they should disappear. i made jsffidle: https://jsfiddle.net/dtchh/9949/ the code: html <div class="container"> <div id="square-zone"> <!-- here appear squares --> </div> </div> javascript //randomly place squares $(function() { var numinfosquares = 3; var $squarezone = $("#square-zone"); var $toappend = $('<div class="info-square"><span class="square" data-toggle="modal"></span></div>'); (var c = 0; c < numinfosquares; c++) { $squarezone.append( $toappend.clone() .find('.square').attr("data-target", "#myinfomodal" + (c + 1)) .end() ); };

mysql - The way to save streaming file (video or audio or both) through database and its effective -

i plan make rtsp server provides video or audio, saved live, such camera video data. so i'm searching how save these data. it quite lot of files, 10 ~ 10000. each of file size around 4gb. first time, think each of files made files , write index data db. best simple , easy work think. but how save data directly db??? such using blob. seemed looks more easier first thing if deal db well. of course searched in case of mysql, mssql. most of them negative. how big database? such hadoop or nosql? i decided index in db! there disadvantages insert video data in db.

mongodb - How to serialize a Scala Collection List into json using Gson lib -

i have class named inbox contains int , list of messages . message class. the problem want store objects of inbox class in mongodb. have serialize these objects using gson, throws exception on deserialization. java.lang.runtimeexception: failed invoke public scala.collection.immutable.list() no args here inbox class : @serialversionuid(1) class inbox(val uuid: int, var messagelist: listbuffer[message]) extends serializable { adduuidtolist(uuid) /* * auxiliary constructor */ def this() { this(0, listbuffer[message]()) } def addtomessagelist(addmessage: message) = { messagelist += addmessage } var idlist = new mutablelist[int]() def adduuidtolist(uuid : int) = { idlist += uuid } /* * getters */ def getuuid: int = uuid /* * returns sorted list based on datetime attribute of message class */ def getmessagelist : listbuffer[message] = { //var sortedlist = messagelist.sorted messagelist } d