Posts

Showing posts from September, 2011

html - how to make banner responsive and scale properly - by not using background property -

is there way can make banner responsive , image scale properly..i.e height remains same following structure <div class="banner"> <img src="/img/banner1.png" alt="banner"> </div> i know css can make image background image class banner. possible have effect of background-position, background-size with above structure. remove img try add css .banner : .banner { background-image: url('/img/banner1.png'); background-repeat: no-repeat; background-position: center; background-size: cover; }

Why `time_range` doesn't work in request to Facebook API? -

i try data facebook marketing api. result correct have problem data. seems parametr time_range doesn't work. https://graph.facebook.com/v2.7/act_<my_act>/ads?fields=name,adcreatives{object_story_id},insights{spend,unique_clicks},effective_status&params=time_range={%22since%22:%222016-11-15%22,%22until%22:%222016-11-17%22}&limit=2000&access_token=<my_token> result: { "data": [ { "name": "xx", "adcreatives": { "data": [ { "id": "xx" } ] }, "effective_status": "disapproved", "id": "xx" }, { "name": "xx", "adcreatives": { "data": [ { "id": "xx" } ] },

vba - Zoom on MTEXT object AutoCAD -

i got access database, contains records regarding objects have static location on our terrains can locate them querying db. eg: code              description              location   "e1-050505"         "concrete posts"         "street #" now struggle know go on our terrains (cause big), have refer autocad map, there check "street #" located searching text "e1-050505". have found vba code able open autocad file, document. found no way or command set focus on specific control or object. the procedure this: click button on access form, vba launch cad file, search text "e1-050505" , set view visual location in autocad drawing of object. i able search , find mtext object, haven't found way move "camera" or view focus it. i need command or code move view mtext object. you can use object option of zoom command: acadapp.activedocument.sendcommand "_zoom" & vbcr & "_o&quo

javascript - creating and destroying shieldUI widgets -

i coming different development background little jquery and/or shieldui knowledge. can please shortly explain how remove/destroy shieldui components or widgets? don't see special widget method therefore assume done jquery. destroying mean removing down (including) markup. also, happenes widget when calling hide()? see markup somehow stripped down (removed), wrappers remain. safe call widget setup same "id" ? overwrite? cause object orhpans? as see missing basic "how works". quick learner please, few basic pointers do. thank :) edit: found destroy widget method under "swidget()"...what swidget? swidget() gives reference component instance, through can access methods , properties, such height , width , refresh() , destroy() , etc. further, respect question @ hand, regarding destroy method , approach - ideas is, whenever need refresh data on component, can recreate it, rather calling method such rebind. demonstrated in following dem

SQL Server - Issue with UPDATE inside while loop in a function? -

i have 1 table , willing fill 2 columns values generated using other column value using function. note: working .mdf file in visual studio , not sql server. like if employeename 'xyz' password 'xyz@123' , mailid 'xyz@gmail.com' here procedure create function [dbo].[fntempsetallemployeemailidandemployeepassword]() returns @outputtable table ( employeename nvarchar(250), tempemployeemailid nvarchar(250), tempemployeepassword nvarchar(250) ) begin declare @initialiser int = 1, @numberofrowsintable int, @tempemployeeid int, @tempemployeename nvarchar(250); select @numberofrowsintable = count(*) tbemployee; while(@initialiser <= @numberofrowsintable) begin select @tempemployeename = [employeename], @tempemployeeid = [employeeid] (select row_number() over(order [employeeid] asc) rownumber, [employeeid], [employeename]

java - Retrieving the title, artist/author and duration of a .wav file -

i trying properties of .wav file using in java project using following code. when run code methods format.getproperty("title") , format.getproperty("author") , , format.getproperty("duration") return null. should getting these details in different way? audioinputstream audioinputstream = audiosystem.getaudioinputstream(wavfile); audioformat format = audioinputstream.getformat(); object[] temp = {false, format.getproperty("title"), format.getproperty("author"), format.getproperty("duration")}; wav files hard work with, though they can hold several metadata types . depending upon software , encoder used ( 16/32-bit pcm ) can have different configurations file , java sound api face problems read metadata. i tried lot of tools , libs focused in audio metatagging (such apache tika , jd3lib , mp3agic , beaglebuddy , etc.) , of them work fine mp3 or other audio formats, not wav files. app

android - CoutDownTimer inside a fragment -

Image
i'm trying make android app has many selectable countdown timers. created app has main activity , uses several fragments load different countdown timers. i'm using navigation drawer , each menu item loads different fragment (the layout of every fragment textview , button @ moment). should put countdowntimer code inside each fragment? 1 fragment have timer of 30 seconds, 1 has 60 , 90. examples found online work if put them inside main activity (if i'm not using fragments).

Visualize gRPC and Protocol Buffers -

we close 100 .proto files, every may define around 10 idl structures (like service or message ). is there way visualize of of them, including references (from 1 file other). example similar uml class diagram. possibly there configurable visualizer java/c++. quote https://developers.google.com/protocol-buffers/docs/overview protocol buffers google's lingua franca data – @ time of writing, there 48,162 different message types defined in google code tree across 12,183 .proto files. i wonder how handle this.

html5 - Send value with submit from output element -

i using output element in html show oninput calculations have put in workes - when submitting, input values sent - , not output value. how sent output value or oninput value? <form action='upload.php' nmethod='post' enctype="multipart/form-data" oninput="price.value = (5 * product.value)"> <output type="number" id="totalprice" name="totalprice"></output> <input id='sendprice' type='submit' value='send'> </form> add hidden input field form contains data so: <input type="hidden" name="oninput" value="--your oninput value--" />

bash - Pass code file as part of object JSON using Curl -

i'm trying write small script upload snippets of code service provider use requires pass code inside json object. file_content=$(<my_file.js) curl -x post -h "content-type: application/json" -d '{"name":$file_name","script":"$file_content"}' https://someservice.com/api/endpoint where file_content javascript code inside my_file. problem printed that, payload invalid. i'm trying find way read file in way it's valid json. know it's rather specific wondering if such command exists. edit: option place entire json object in file, avoid if possible. except in simplest of cases, can't build json that, i.e. string interpolation. putting file's content json string not simple case. json needs built actual json serializer. python has such serializer, easy let python job. # http://stackoverflow.com/a/13466143 json_escape () { printf '%s' $1 | python -c 'import json,sys; prin

android - Realm doesn't write the data in IntentService -

i have realm database in app. when app active have no problem writing data if start intentservice , close app, have nothing in realm database. my intentservice: @override protected void onhandleintent(intent intent) { realmresults<hashtagobject> hashtags; subscriberobject subscriber = new subscriberobject(); realm realmforthisthread = realm.getdefaultinstance(); hashtags = realmforthisthread.where(hashtagobject.class).findall(); for(int i=0;i<hashtags.size();i++){ getrecentlytag(constants.api_url); } realmforthisthread.begintransaction(); (map.entry entry : hm.entryset()) { if(realmforthisthread.where(subscriberobject.class) .equalto(subscriberobject.id,entry.getkey().tostring()).findall().isempty()) { subscriber.setid(entry.getkey().tostring()); subscriber.setusername(ent

Javascript: send object with object inside trought post method -

i'm pretty new javascript , i'm trying send object other object inside trought post method: $.post('/posttest', {tablename : 'wstest', data : {name : "rachid", age : 42, ville : "tokyo"}}).done(function(data) { console.log("data posted : ", data); }); i can retrieve tablename req.body.tablename req.body.data give me undefined. when console.log(req.body) got: { tablename: 'wstest', 'data[name]': 'rachid', 'data[age]': '42', 'data[ville]': 'tokyo' } as far understand it, javascript takes data dico ? how can make data object ? standard form encoded data flat data structure. key/value pairs. a non-standard extension syntax introduced php allows describe nested data, parser doesn't appear recognise it. to access data need mention square brackets. req.body["data[name]"] // etc alternatively, find parser recognise square br

javascript - Labels on features - ajax call -

i using leaflet 0.7 , want add static label using leaflet.label plugin. i data ajax call. not sure put oneachfeature function populate labels. relatively new javascript , think got bit confused on one. this code works long use layer.bindlabel('static label'). cannot populate data ajax call. know layer created before ajax call , not have access data. how can arrange code populate label data ajax call? any appreciated var pointlayer= new l.geojson(null, { pointtolayer: function (feature, latlng) { return l.marker(latlng, {icon: sandicon}); }, oneachfeature: function (feature, layer) { layer.bindlabel(feature.properties.id, //dynamic label {nohide:true,direction:'auto'}); }, oneachfeature: function (feature, layer) { layer.bindpopup('test' + feature.properties.id); } }).addto(map); $.ajax({ url: "url", datatype: 'jsonp', cache: fals

r - Not able to send HTML report in mail body using mailR package -

i trying send html report generated rmarkdown in body of email, email appearing always. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="generator" content="pandoc" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="author" content="ravindra" /> <meta name="date" content="2016-11-11" /> <title>ods appds data comparison</title> <link rel="stylesheet" href="ink.css" type="text/css" /> </head> <body> <h1 class="title toc-ignore">ods appds data comparison</h1> <h4 class="author"><em>ravindra</em></h4> <h4 class="date&qu

ember.js - Ember refresh models from another controller -

i have applicationcontroller in when "ember.select" change value want refresh models. app.applicationcontroller = ember.objectcontroller.extend({ needs: ['abstractauth', 'widgets', 'modalwindows', 'chatcompose', 'chatmodal', 'about', 'contacts'], selecteddomainalias: {}, selecteddefaultvalue: { id: 2 }, onselecteddomainaliaschange: function () { var self = this; var getselecteddomain = this.get("selecteddomainalias.domainname"); $.get('/setcookies/cookies?domains=' + getselecteddomain, false) .then(function() { self.send("domainchanged"); self.get('model').reload(); var contacts = app.controllerfor('contacts').store.find('contact'); self.get('controllers.contacts').set('model', contacts); }); }.observes('selecteddomainalias.length')}); self.send("domainchang

sql - Local SSRS Report Execution is Caching Dynamic Variable, Even After Deleting .rdl.data -

Image
i have report i've deployed ssrs, each month, meant generate report of results previous month. i begin dynamically generating variables determine month/year generate report results : declare @reportingmonth int set @reportingmonth = month(getdate()) - 1 declare @reportingyear int set @reportingyear = year(dateadd(month,-1,getdate())) then, in clause filter results month(datecolumn) = @reportingmonth , year(datecolumn) = @reportingyear the first month ran report october, results 9-2016. include field in use cast(@reportingmonth nvarchar)+'-'+cast(@reportingyear nvarchar) [report period] to verify results. ran report again locally, , since november, @reportingmonth should = 10. @reportingmonth still set = 9 however. copy/pasted data source query directly ssms check hadn't made error, , no - when query executed directly, results return 10-2016. i've seen weird caching results happen local runs of reports in ssrs before, , deleting .rdl.data file, re

javascript - angularjs split json array into different arrays -

in app using http.post json array has been formed, on server, multiple arrays. problem should split array 4 separate arrays, i'll explain: json array example : [{"day", "11/17/2016", "time": "09:45"}, { "day", "17/11/2016", "time": "16:50"}, (.....) { "day", "18/11/2016", "time": "11:25"}, { "day", "18/11/2016", "time": "12:30"}, (.....) { "day", "11/21/2016", "time": "16:10"}, { "day", "11/21/2016", "time": "17:25"}] now array should create 4 array, first in stored several days, example (17.11.2016, 11.18.2016, 21.11.2016), second in times stored " belonging "to first day example (09:45, 16:50), third in stored all" belonging "times second day, example, (11:25, 12:30) , fourth in stored times "belonging" thi

How to initialize specific fields in a Go struct -

if had go struct long list of fields. there built-in way initialize instance while providing value specific fields only? you have write structtype{fieldname: value} !

security - Retrieve user groups in google for work -

i'm building backoffice aplication , want leverage our companies google work directory authentication. there way retrieve groups user belongs within organization? maybe them in claims when authenticating via openid? while question little unclear (what using build application? mean "the groups user belongs to"?), can retrieve user information using directory api . for actual authentication, can use google oauth identity provider .

continuous integration - Scalable and extensible cross-platform architecture for a mostly solo development pipeline? -

i'm looking solid foundation development infrastructure utilizes ci/cd tools in accordance today's best practices (dated end-of-year 2016). want have setup solo development environment, appreciate tips on extending higher throughput , higher availability eventually; if start company, best foundation @ moment in time allow dynamic growth? i understand broad question, , there different ways different work flows across different stacks. want keep things open sourced , virtualized, though don't mind answers aren't well. long it's modular in terms of tooling, kill server , redeploy different 1 relative ease (e.g. if wanted switch puppet chef, i'd kill puppet server , provision chef one). some tools i'm familiar (that i'm studying) fulfills role in devops architecture: configuration management: puppet, ansible ci: jenkins, travis ci packaging/deployment: docker, lxc version control:git, github logging: elk stack virtualization/provisioning: vag

HTML - Javascript - input condition -

ive been looking cant seem find clarification... creating form - if user select option contact "email", user must enter text value email input type. here fiddle- https://jsfiddle.net/4s3blf65/ if ($("input[name='option']").val()=='email') &&($("input[name='email1']").val() == '') { alert('enter email'); return false; } i cant seem figure out proper syntax js... suggestions? try way: if ($("input[name='option']:checked").val()=='email' && $("input[name='email1']").val() == '') { alert('enter email'); return false; }

bash - shell script: count lines and sum numbers from multiple files -

i want count number of lines in .csv file, , sum last numeric column. need make crontab , so, has script. this code counts number of lines: egrep -i string file_name_201611* | \ egrep -i "cdr,20161115" | \ awk -f"," '{print $4}' | sort | uniq | wc -l this code sums last column: egrep -i string file_name_201611* | \ egrep -i ".cdr,20161115"| \ awk -f"," '{print $8}' | paste -s -d"+" | bc lines looks like: comgprs,cgsco05,comgprs_cgsco05_400594.dat,processed_cdr_20161117100941_00627727.cdr,20161117095940,20161117,18,46521 the expected output: cgsco05,sum_#_lines, sum_$8 cgsco05, 225, 1500 this should work... #!/usr/bin/awk -f begin{ k=0; fs="," } { if ($2 in counter){ counter[$2] = counter[$2] + 1; sum_8[$2] = sum_8[$2] + $8; }else{ k = k + 1; counter[$2] = 1; sum_8[$2] = $8; name[k] = $2; } } end{ (i=1; i&

android - USB HOST not displaying text (Nexus 6p and stm32) -

i trying write serial /dev/ttyacm0 ( stm32). andorid see stm32 /dev/bus/usb/001/002. i have rooted phone nexus 6p , stm32 connected via usb. i saw google usb host example try same. i have connection stm , granted permissions usbdeviceconnection connection = mmanager.opendevice(mdevice); string simpletext = "a"; byte[] data = simpletext.getbytes(charset.forname("utf-8")); int timeout = 10; and trying usbendpoint endpoint = mdevice.getinterface(0).getendpoint(0); connection.claiminterface(mdevice.getinterface(0), true); connection.bulktransfer(endpoint, data, data.length, timeout); and have small program in stm reading serial #include "mbed.h" #include "lcd_disco_l476vg.h" lcd_disco_l476vg lcd; serial pc(usbtx, usbrx); digitalout led_green(led1); char c; uint8_t buff[1]; int main() { lcd.clear(); while(1) { if(pc.readable()) { buff[0] = pc.getc(); lcd.displaystring(buff); } } } but

How to get GET (query string) variables in HTTP on Node.js? -

how can variables query string in node.js them in $_get/$_post in php? here code, have passed parameters through xmlhttprequest. dont know how parameters. please give me suitable solution. want insert values in database. server.js var http = require('http'), fs = require('fs'), url = require('url'); var db = require('../db'); http.createserver(function(request, response){ var url = require('url'); var url_parts = url.parse(request.url, true); var query = url_parts.query; console.log('name: ' + query.name); }).listen(8001); index.hjs function calling() { xmlhttp = new xmlhttprequest(); xmlhttp.open("get","http://localhost:8001/name=user_name&cell=01234-1234567", true); xmlhttp.onreadystatechange=function(){ if (xmlhttp.readystate==4 && xmlhttp.status==200){ string=xmlhttp.responsetext; } } xmlhttp.send(); } output name: undefined looks request wrong u

Azure Search - Creating a dedicated search table in SQL, for using with an Indexer -

i'm building assets search engine. data need indexed each assets scattered multiples tables in sql database. also, there many events in application trigger update asset indexed fields (in draft, rejected, produced, ...). i'm considering creating new denormalized table in sql database exist solely azure search index. exact copy of azure search index fields. application responsible fill , update sql table, through various event handlers. use azure sql indexer schedule automatically import data azure search index. pros: we used deal sql table operations, application code remains standard, no need learn azure search api both transactional , search model updated in same sql transaction (atomic). indexer update index in eventual consistent manner, , handle retry logic. built-in support change detection sql integrated change tracking policy cons: indexed data space usage duplicated in sql database delayed index update (minimum 5 minutes) do see other pros , con

ios - UIAccessibilityIsGuidedAccessEnabled returns wrong value -

i using uiaccessibilityrequestguidedaccesssession function lock ipad in single app mode. when device restarts checking whether ipad in single app mode or not using function uiaccessibilityisguidedaccessenabled() alway returning no , if device in single app mode

pass a json string as an argument to Python script causes quotes problems -

i want write script takes in single argument, string contains json data, , (for sake of simplicity) prints something. import argparse import json parser = argparse.argumentparser(description='json load , print') parser.add_argument('-i','--inputstring', help='input string in json format',required=true) args = parser.parse_args() inp = parser.parse_args() data = json.loads(inp) print(data['employees']) when run command line error because of double quotes use wrap string ending matching double quotes in json: python myscript.py -i "{ "employees": "name name"}" unrecognized arguments employees... if switch json double quotes single quotes, json parser not work. how handle this? your code work expected if change how assign input variable. change line: inp = parser.parse_args() to inp = args.inputstring parse_args() returns argparse.namespace object, need retrieve input object prior pa

java - For Loop only printing/storing last iteration -

hope can make myself clear enough. i'm trying measure how long take program multiply couple of matrices , storing result 1 (called c). i need record time going 1 100, 1 200, 1 300, etc. i'm measuring time , storing result .dat file ploting later on (using gnuplot) thing is... when run it, last iteration n times wanted measure. let's i'm trying 1 100, 100 iterations, in .dat file, last iteration. i'm sorry if i'm not making myself clear. here's code , can understand. thank you!! import java.util.timer; import java.util.scanner; public class matrixmult { public static void main(string[] args) { //creating new scanner input stdin// scanner input = new scanner(system.in); //creates variable store nxn dimension of matrices// int ms = input.nextint(); //initializing matrices , giving them dimensions provided stdin// int [] [] = new int [ms] [ms]; int [] [] b = new int [ms] [ms];

linux - Use grep to find the words that have two 's' separated by a space -

i'm trying use grep find words have 2 's' separated space, 2 's' or more in words, , words contain 2 's'. i tried these commands ls|grep -e 's+' ls|grep -e 's+'|grep \s ls|grep -e s{2,\} the 2 first commands print words contains 1 's' or more, isn't i'm looking for, , last command prints words contain 2 's' side side ... btw, i'm having trouble find exact same output of "grep -c", without "-c" argument ... for example ls -r| grep s prints 14k approximately, , want find same result, without -c thanks in advance grep "s s" grep "s.*s" grep -e "^[^s]*s[^s]*s[^s]*$"

ruby on rails - Why are these tests not working? -

i ran problem , found this answer believe solve problem, can't work. here's code: setup # hell put def main_app rails.application.class.routes.url_helpers end @routes = engine.routes end test "should index" :index assert_response :success end blaine@vm:~/sizzle-chisel$ rake test started run options --seed 60111 error["test_should_get_index", blog::admin::articlescontrollertest, 0.3109516409999742] test_should_get_index#blog::admin::articlescontrollertest (0.31s) actionview::template::error: actionview::template::error: undefined method `root_path' #<actiondispatch::routing:: routesproxy:0x00000006eda278> blog::engine.routes.draw root "articles#index" resources :articles namespace :admin resources :articles root to: 'articles#index' end end i keep getting root_path undefined, because within layout, there's code: <%= link_to "some link", main_app.root

java - "Checkbox editor" for JTable -

what best way add "checkbox editor" jtable? far have jtable use custom abstracttablemodel , use 2 collections data: 1 hashmap add each row checkbox "false" value. second collection framework simple arraylist integers. abstracttablemodel has custom method delete selected rows arraylist , abstracttablemodel. problem if "check" chceckbox in table, checked value stays in same row. think problem in overriding setvalueat. piece of code: package checkboxeditor; import java.awt.borderlayout; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jscrollpane; import javax.swing.jtable; import javax.swing.table.abstracttablemodel; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.arraylist; import java.util.hashmap; import javax.swing.jbutton; public class checkboxeditor extends jpanel { public checkboxeditor() { super(new borderlayout()); mytablemodel mytablemodel = new mytablem

arrays - Rails: PG::SyntaxError: ERROR: syntax error at or near ":" -

i'm trying write query: @myquery = event.where("reservations.map(&:first)= ?", current_user.id) but error: actionview::template::error (pg::syntaxerror: error: syntax error @ or near ":" line 1: ...ect "trips".* "events" (reservations.map(&:first)= 1... ^ the goal of query find user ids in first element of array of arrays like: [["2","1"],["4","1"]] 2, 4 user ids. tried different solutions still have problem! a little confused i'm guessing you're trying create many-to-many relationship between users , events (i.e. user has many events , event has many users ). if not want storing user_ids in event model , vice versa. want to create join table holds ids each #database table create_table "user_events", force: :cascade |t| t.integer "user_id" t.integer "event_id&quo

apache camel - how to setup a fuse/blueprint cxf test - NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I -

my camel-blueprint project contains simple rest endpoint provide status. works fine. but want create integration test , need run rest route within junit test. have many working tests extend camelblueprinttestsupport . but can't working test serves rest endpoint. fought through many exceptions added many dependencies. added stuff mentioned in this example (i using current versions). exeptions occurred on booting context gone now. but on fireing request against configured endpoint still exception: nosuchmethoderror: javax.servlet.http.httpservletresponse.getstatus()i here stacktrace: org.apache.cxf.interceptor.fault: !(jetty || servlet 3.0 || continuationfilter) while invoking public abstract java.lang.string ...servicestatusinterface.requestget() params []. @ org.apache.cxf.service.invoker.abstractinvoker.createfault(abstractinvoker.java:166) @ org.apache.cxf.service.invoker.abstractinvoker.invoke(abstractinvoker.java:140) @ org.apache.cxf.jaxrs.jaxrsinvo

entity framework - ef core: There is already an object named in the database -

hi working on aspnet core app, using ef core version : "microsoft.entityframeworkcore.design": "1.1.0", "microsoft.entityframeworkcore.sqlserver": "1.1.0" and dotnet standard 1.6.1. here scenaro: 4 dbcontext database dbset or anyother may shows in 2 or 3 contexts, example acontext contains tablea, bcontext contains tablea. none of them include tables want specific context focus on purpose. many foreigne keys between tables this causes dup table in database, resolve this, have done below create migrationdbcontext include dbset add migration on migrationdbcontext here get successfully create database , tables right schema , name error when call : servicescope.serviceprovider.getservice().database.migrate(); error message: there object 'a' named in database. unfortunitly, update-database command in ef core -v not show sql script, script-migration shows simple cr

Python: Replace line clearing everything after line -

the following replace line function: def replace_line(file_name, num, replaced): f = open(file_name, 'r', encoding='utf-8') lines = f.readlines() lines[num] = replaced f.close() f = open(file_name, 'w', encoding='utf-8') f.writelines(lines) f.close() i using following line run code: replace_line('store.txt', int(line), new) when run code, replaces line removes after line. example, if list: to honest, i'm not sure wrong original function. tried redoing , seems work fine: def replace_line(file_name, line_num, text): open(filename, 'r+') f: lines = f.read().splitlines() lines[line_num] = text f.seek(0) f.writelines(lines) f.truncate() please note overwrites entire file. if need handle large files or concerned memory usage, might want try approach.

sql server - How to UPDATE TOP(n) with ORDER BY giving a predictable result? -

i'm trying read top 100 items of database table being used queue. i'm trying mark items done this: update top(@qty) queuetable (readpast) set isdone = 1 output inserted.id, inserted.etc queuetable isdone = 0 order createddate asc; the problem is, according update (transact-sql) on msdn , order by not valid in update and: the rows referenced in top expression used insert, update, or delete not arranged in order. how can achieve need update items @ top of queue while selecting them? sql server allows update derived table, cte or view: update x set isdone = 1 output inserted.id, inserted.etc ( select top (n) * queuetable isdone = 0 order createddate asc; ) x no need compute set of ids first. faster , has more desirable locking behavior.

storing variable in twig? -

i starting play twig, noob @ it. sorry if question sounds utterly stupid, well.. looked bit everywhere, , didn't find anything. so, how can store string input user variable in twig? like in template have: <input type="text" name="name"/> what shall store "value" of input variable? here direct way it? or shall different? if so, should for? you need pass variable controller template, <?php $twig->render('template.twig', [ 'name' => isset($_post['name']) ? $_post['name'] : '', ]); template.twig <input type="text" name="name" value="{{ name }}" />

ruby on rails - Empty associations for fields_for if the content is added dynamically via jquery -

i built form_for 4 associated models. created nested fields_for can added dynamically code below. form works if call 'edit' method if use method below add new data fields_for remains empty , not shown. def link_to_add_fields(name, f, association) new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.fields_for(association, new_object, child_index: id) |builder| render(association.to_s.singularize + "_fields", f: builder) end link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")}) end this works fine if wants add 1 form of model. if added content have fields_for nested fields_for text_fields not created. in opinion because not build associations. how can fix method this? i have similar method (based on itay grudev's blog post ), in set child_index nil , use jquery replace timestamp (so many records can added avoiding t

c# - RegexOptions.Multiline seems to ignore \n -

Image
i'm trying search string using regex. here's string looks in text visualizer: 0 -12.67 td /helv 14 tf (source: abc / xyza) tj 0 -15.624 td (job source no.: grqx id 27299) tj 0 -15.624 td when view value hovering on it: 0 -12.67 td\n/helv 14 tf\n(source: abc / xyza) tj\n0 -15.624 td\n(job source no.: grqx id 27299) tj\n0 -15.624 td i'm using regex.matches() following pattern , regexoptions.multiline : ^(?<=[(]).+(?=[)]) this returns no matches. when omit caret, this: (?<=[(]).+(?=[)]) then regex.matches() returns both matches: source: abc / xyza job source no.: grqx id 27299 how can match on first character in line? a lookbehind in regex pattern checks characters left of current position, in pattern ^(?<=[(]) requires ( before ^ (the start of line). before start of line, there either nothing (at start of string), or there newline char. thus, never match string. actually, not need lookarounds substrings need. use following re

Twilio - Number Lookup -

i trying lookup carrier of phone number using twilio php sdk. however, getting certification error. not sure doing wrong. if can give me advice, appreciate! thank you. $lookup_client = new lookups_services_twilio( $this->twilio_sid, $this->twilio_token ); $number = $lookup_client->phone_numbers->get( '1-416-333-1111', array( 'type' => 'carrier', "countrycode" => "us", ) ); echo $number->carrier; services_twilio_tinyhttpexception: ssl certificate problem, verify ca cert ok. details: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed in twilio-php\services\twilio\tinyhttp.php on line 119 i made while ago. made can raw input phone number. hope helps! import sys import os twilio.rest.lookups import twiliolookupsclient try: client = twiliolookupsclient() phone = raw_input (" enter targ

java - JFrame background color not working -

my code public static void main(string[] args) throws interruptedexception { jframe frame = new jframe("flappy bird"); frame.setsize(1200, 800); flappybird game = new flappybird(); frame.getcontentpane().setbackground(color.yellow); frame.add(game); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setresizable(false); while (true) { game.moveball(); game.gameover(); game.moverect(); game.repaint(); thread.sleep(14); } } why isn't frame.getcontentpane().setbackground(color.yellow); working? i've tried rearrange order, setting color after making frame visible. it works alright, cannot see background color because flappybird instance drawn on top of it. can verify replacing game class empty canvas so: public static void main(string[] args) throws interruptedexception { jframe frame = new jframe("flap

iis - Same application started in multiple app pools -

i expierienced in iis can't understand, , i'm hoping else might :) ? i have 1 site in iis, multiple applications. of them configured serviceautostartprovider, , set this: -production (site, points c:\prod) * app1 (uses apppool 1, points c:\prod\app1) * app2 (uses apppool 2, points c:\prod\app2) * app3 (uses apppool 3, points c:\prod\app3) the applications mapped different paths on disk (like above), , applications have different assemblies in /bin folder. have nothing in common except "common" .net assemblies autostartprovider. once deployed app3, see started automaticaly (since it's configured autostartprovider), booted twice!? once in apppool3 (as expected) , once in apppool1. i see in logs since autostartprovider reads appsetting (the applications name) web.config , log's w3wp processid. in other words, logs showed: "booted app3, processid: {apppool3's id}" "booted app3, processid: {apppool1's id}" ho

Intellij - Git Push via UI fails when private key contains a passphrase -

it seems when use ssh key passphrase, unable push changes github via intellij ui. following error: "push failed: failed error: fatal: not read remote repository." but when push through command line, works because prompted input passphrase. i have tried setting git_ssh environment variable point tortoisegitplink.exe (i'm using ssh agent) still same error. is there other way making work? i ran same issue. ssh-agent , ssh-pageant work commandline not intellij. the final solution me create ssh key pairs without passphrase (just press "enter" when prompted "entering passphrase" window). if security 1 of main concerns, can use commandline git plus ssh-agent.

python - Celery Error: no module name [django app name] - Have checked the if the celery file is correct but still get issue? -

when run celery -a uno worker -l info in terminal error file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) importerror: no module named uno here celery.py in uno app django settings.py file is. from __future__ import absolute_import import os celery import celery django.conf import settings os.environ.setdefault('django_settings_module', 'uno.settings') app = celery('uno') # reads, e.g., celery_accept_content = ['json'] settings.py: app.config_from_object('django.conf:settings') # autodiscover_tasks work, must define tasks in file called 'tasks.py'. app.autodiscover_tasks(lambda: settings.installed_apps) @app.task(bind=true) def debug_task(self): print("request: {0!r}".format(self.request)) i using ubuntu experience same error on mac. install celery via pip in virtualenv i not sure wrong or missing here. if use same celery file in different proje

mysql - SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 -

im trying understand how mysql 5.7 works. in query bellow select r.*, concat(u.fname, ' ', u.lname) name `events` r left join `users` u on r.user_id = u.id r.event_id = 1 group r.user_id order r.date ; i'm getting error " select list not in group clause , contains nonaggregated column 'r.id' not functionally dependent on columns in group clause; incompatible sql_mode=only_full_group_by [code: 42000] " but query works fine: select r.id, r.event_id, r.user_id, r.date concat(u.fname, ' ', u.lname) name `events` r left join `users` u on r.user_id = u.id r.event_id = 1 group r.user_id, r.event_id, r.id, r.date order r.date ; since i'm working on localhost, can make changes my.ini file , set sql_mode "strict_all_tables,error_for_division_by_zero,no_auto_create

inheritance - Angular 2 Typescript inheratance state-pattern issue -

i'm uning typescript inheritance implement state pattern i'm getting runtime error when new superclass. hoping find out why or what's wrong, thanks. working plunker: https://plnkr.co/edit/xscxr4?p=preview vehicle.ts import { car } "./car"; export class vehicle { description: string = "generic vehicle"; swap(app: appcomponent): void { app.vehicle = this.iscar(app) ? new vehicle() : new car(); } /* helper demo purposes */ private iscar(app: appcomponent) { return app.vehicle instanceof car; } } car.ts import { vehicle } "./vehicle"; export class car extends vehicle { description: string = "car"; } it's state-pattern. vehicle type 'vehicle' or 'car' can swap instance in 'appcomponent' app.component.ts import { component, oninit } '@angular/core'; import { vehicle } "./vehicle"; import { car } "./car"; @component({ moduleid: mo