Posts

Showing posts from February, 2010

c++ - Find pointer to derived class in a table after the object was destroyed -

i have derived class derived class base i have std:: container of derived* pointers (such vector, set, etc...). have base* pointer , know if container contains pointer. rtti , dynamic_cast<derived*>(base) not usable @ point, object may have been destroyed, or may in destructor call chain. how can check if container contains base pointer? if static_cast works, possible. cppreference : static_cast . if new_type pointer or reference class d , type of expression pointer or reference non-virtual base b, static_cast performs downcast. such static_cast makes no runtime checks ensure object's runtime type d, , may used safely if precondition guaranteed other means, such when implementing static polymorphism. safe downcast may done dynamic_cast. there no checks, static_cast should make correct pointer adjustment. reinterpret_cast relies on &base == &derived static_cast allows compiler return adjustment base if derived class not @ start of

authentication-provider error in spring-security.xml -

Image
can tell me what's wrong code? i'm trying authenticate user using mysql database in intellij ide 14 shows me error inside 'authentication-manager' saying 'element authentication provider not allowed here'. did watching video tutorial. in tutorial works fine. i'm using spring security 3.2.0.release. after built using maven , tried log app couldn't. in tomcat log there errors. there's screenshot of app. jan 07, 2016 7:09:24 pm org.springframework.security.web.authentication.abstractauthenticationprocessingfilter dofilter severe: internal error occurred while trying authenticate user. org.springframework.security.authentication.internalauthenticationserviceexception: not jdbc connection; nested exception java.sql.sqlexception: access denied user 'supun'@'localhost' (using password: yes) @ org.springframework.security.authentication.dao.daoauthenticationprovider.retrieveuser(daoauthenticationprovider.java:126) @ org.sprin

python sqlalchemy - map a table to a certain data structure -

i have table defined relationships , noticed though don't use joins in query, information still retrieved: class employee(base): __tablename__ = "t_employee" id = column(identifier(20), sequence('%s_id_seq' % __tablename__), primary_key=true, nullable=false) jobs = relationship("employeejob") roles = relationship("employeerole") class employeejob(base): __tablename__ = "t_employee_job" id = column(integer(20), sequence('%s_id_seq' % __tablename__), primary_key=true, nullable=false) employee_id = column(integer(20), foreignkey('t_employee.id', ondelete="cascade"), primary_key=true) job_id = column(integer(20), foreignkey('t_job.id', ondelete="cascade"), primary_key=true) class employeerole(base): __tablename__ = "t_employee_role" id = column(integer(20), sequence('%s_id_seq' % __tablename__), primary_key=true, nullable=fals

sql server - Responsive web design and database access -

i new both responsive web design , angular , working on building web page access database , display things based on data in 1 of sql server tables. please point me in right direction of can use grab data database? need web service? data component? technology best use? for responsive aspect, can use simple css, media queries or library designed purpose (like twitter-bootstrap example). angularjs won't access database directly since it's client-side language. need build server-side application access database. then, angular components can call server-side application retrieve data. angularjs modules + any-technology web-service can suitable solution. the choice of technology on highly depends on needs , constraints. unless can ask more precise questions, cannnot much.

wcf - Timestamp must be signed error in response -

for starters, know you'd think duplicate if read them you'll notice people deleting timestamp fix , others tell otherwise. i'm trying connect java soap webservice certificates using .net 3.5 when receive response throws error : "the security header element 'timestamp' 'timestamp-984' id must signed." var b = new custombinding(); b.name = "avbinding"; b.closetimeout = new timespan(0, 1, 0); b.opentimeout = new timespan(0, 1, 0); b.receivetimeout = new timespan(0, 10, 0); b.sendtimeout = new timespan(0, 1, 0); asymmetricsecuritybindingelement security = new asymmetricsecuritybindingelement(); security.includetimestamp = true; security.messagesecurityversion = messagesecurityversion.wssecurity11wstrust13wssecureconversation13wssecuritypolicy12; security.recipienttokenparameters = new x509securitytokenparameters(x509keyidentifierclausetype.any, securitytokeninclusionmode.alwaystoinitiator); security.initiatortokenparameters = new x5

logging - How can I list all new processes as they are created? -

i'm familiar tools such ps , top , knowledge, don't catch new processes. top has log mode, if process short-lived enough (e.g. echo 'hello, world!' , process won't logged. this being said, there way list newly-created processes created? it sounds want "process accounting". if using linux, there package called psacct can install , start.

elasticsearch - Logstash not working with multiple files wildcard path -

logstash doesn't seem read path wildcard here config file input { file { path => "c:\logs\app*.log" type => "mytype" } } filter { } output { elasticsearch { } } i able resolve issue replacing backslash slash. c:/logs/app*.log

java - android - reset progress bar on back pressed button -

since android 5.0 api 22 have problem on app. i have activity called "time progress" (its not main activity). on activity have chronometer circular progress bar, time goes 15 0 , progress bar filling up. when click on button go main menu , go again "time progress" progress bar not empty (has value, 15 or 3 or 8, random values) , want progress bar empty. i tried onstop(); flag_activity_no_history, flag_activity_new_task, flag_activity_clear_top, set progressbar 0 nothing works. here code int j = 0; public void timetest() { countdowntimer countdown = new countdowntimer(15000, 1000) { textview timetext = (textview) findviewbyid(r.id.timetext); progressbar progresstime = (progressbar) findviewbyid(r.id.progresstime); @override public void ontick(long millisuntilfinished) { timetext.settext(long.tostring(millisuntilfinished / 1000)); j = j + 1; progresstime.setprogress(j); } } @override

java - Equivalent Component for outputPanel in core jsf -

i facing situation have use component wrapper, or same "outputpanel" in primefaces. know ? since asked equivalent component wrapper, suggest using panelgrid columns value of one. <h:panelgrid id="grid" columns="1"> </h:panelgrid>

php - MySQL Varchar to store dates, unsortable at years end? -

mysql database has years worth of records beginning in 2015, queries need use entries date having issue crossing 2015 2016. looking in database, date has been stored varchar. now, running query select sum( salesprice ) total sales salesdate >= '01-01-2016' , salesdate <= '02-07-2016' the 'total' incorrect. correctly queries entries salesdate of 01-01-2016 through 01-07-2016 (the current day), continues add total using items last year. what reasonable way convert column , reword query stop bug? use str_to_date select sum( salesprice ) total sales str_to_date(salesdate,'%m-%d-%y') >= '2016-01-01' , str_to_date(salesdate,'%m-%d-%y') <= '2016-02-07' note mysql uses date format y-m-d default, that's expects.

ruby on rails 4.2 - How to make MiniTests run tests in alphabetical order of Test classes? -

in minitest know can make test methods run in alphabetical order, not feasible test classes . there way in can make minitest run in alphabetical order of test classes? i know there shouldn't dependency between test classes not approach, there @ possible way can achieve this? we figured out solution in case looking 1 take @ following thread: https://github.com/seattlerb/minitest/issues/514 here gist thread in case link broken: correct. can see in gist, test methods still running in alphabetical order, test classes not. test order dependencies bugs in tests can , lead errors in production code. should consider fixing tests each 1 order independent. full randomization 100% success should goal. if have lot of tests, can daunting task, https://github.com/seattlerb/minitest-bisect can absolutely that. if you're reason absolutely 100% dead-set on keeping test order dependency (errors), you'll have monkey patch minitest.__run. add initializ

ios - How to put an image in the center of navigationBar of a UIViewController? -

i have snippet of code used in viewdidload of uiviewcontroller. i'va no errors. images exists. background not image. image sort of logo. if ([self.navigationcontroller.navigationbar respondstoselector:@selector(setbackgroundimage:forbarmetrics:)] ) { /* background of navigationbar. */ uiimage * navigationbarimage = [uiimage imagenamed:@"01_navbar_portrait.png"]; [self.navigationcontroller.navigationbar setbackgroundimage:navigationbarimage forbarmetrics:uibarmetricsdefault]; /* image in navigationbar */ uiimage * logoinnavigationbar = [uiimage imagenamed:@"01_logo.png"]; uiimageview * logoview = [[uiimageview alloc] init]; [logoview setimage:logoinnavigationbar]; self.navigationcontroller.navigationitem.titleview = logoview; } the uinavigationcontroller manages navigation bar looking @ navigationitem property of top-most view controller on navigation stack. change view logo, need set in view controller uses log

c# - iTextSharp doesn't work with PDF generated by Fax machine? -

i have class extract images pdf file, using itextsharp. i tested pdf generated scan machine, worked fine. then, tested pdf generated fax machine, got ioexception: .pdf not found file or resource. i don't have clue why didn't work pdf fax machine. itextsharp not support pdf fax machine or something? any thought appreciated. thanks edit public list<image> extractimagesfromfax(string sourcepdf) { var imglist = new list<image>(); try { var pdfreader = new pdfreader(sourcepdf); //error here ... (var = 0; <= pdfreader.xrefsize - 1; i++) { //code here } pdfreader.close(); } catch(exception ex) { console.writeline(ex.message); } return imglist; } i tried read pdf itextsharp.text.pdf.pdfreader, got ioexception couldn't go further (only happened pdf generated

neo4j - cyhper combine two columns into a single -

i couldn't find similar post, if know 1 or if question not proper one, please let me know. i have query match (t:taxi {name:'taxi1813'})<-[:assigned]-(u2:user)-[rd2:drop_off]-> (g2:grid)-[r:to*1..2]-(g:grid)<-[rd:drop_off]-(u:user)-[:assigned]->(t) id(u2) < id(u) , rd2.time >= '04:38' , rd2.time <= '04:42' distinct u2, g2, u, g, rd2, rd match p=shortestpath((g2)-[r:to*1..2]-(g)) rd2, rd,u2, g2, u, g, p, reduce(totaltime = 0, x in relationships(p) | totaltime + x.time) totaltime totaltime <= 4 return u2.name, u.name so @ end got 2 columns u2.name u.name user179 usertest user177 user179 is there way or function merge both columns single 1 , remove duplicates users user179 user177 usertest any suggestions? thank you you can combine 2 collections single collection , return distinct items. with ['user179', 'user177'] list1 , ['usertest', 'user179'] list2 unwind list1 + lis

Java regex: match expression delimited by whitespaces -

phone number like: +38097-12-34-123 +380971234-123 380971234-123 i should match phone numbers in string assuming separated whitespaces. not matched strings: 45+38097-12-34-123 +38097-12-34-123=test number:38097-12-34-123 working regex phone number without whitespace delimiter requirements is: \\+?380\\d\\d(?:-?\\d){7} i try tests \b / \b boundary matcher don't work if leading + sign used. update fixed examples because type memory , forget put 8 sign. update2 @washington guedes regex (i strip \ \- ): \b(\+?\d{4}(?:-\d{2}-|\d{2})\d{2}-\d{3})\b doesn't work because when + in matching string: bash# groovysh groovy:000> "45 +8097-12-34-123".matches(".*\\b(\\+?\\d{4}(?:-\\d{2}-|\\d{2})\\d{2}-\\d{3})\\b.*") ===> true groovy:000> "45+8097-12-34-123".matches(".*\\b(\\+?\\d{4}(?:-\\d{2}-|\\d{2})\\d{2}-\\d{3})\\b.*") ===> true i expect expession without whitepsace before + sign should fail. @stri

php - how to populate the textbox value on the selection of a combo box -

i have form has 1 combo box , 3 textboxes. 3 textboxes meant calculation purpose. first textbox amount, second 1 received , last 1 read shows balance , combo has values - full, part , none. if user selects full the received textbox should become read , amount entered in amount textbox should come in the received textbox. if user selects part textbox should available user enter amount. if user selects none balance textbox should populated value entered in amount textbox. <select id="pay" name="pay" tabindex="12"> <option value=""></option> <option value="1">full</option> <option value="2">part</option> <option value="3">none</option> </select> <input type="text" id="amt" name="amt" value="" size ="8"

How to call "__call__()" method of python class from matlab -

i'm working class this: class select(object): def __init__(self, interface): ... def project(self, id): ... def __call__(self, datatype_or_path): ... when try call method (basically functor) matlab like: select = select(blah); select('blah'); i following error: array formation , parentheses-style indexing objects of class 'py.pyxnat.core.select.select' not allowed. use objects of class 'py.pyxnat.core.select.select' scalars or use cell array. edit: select.('__call__')('blah') not seem work either from matlab tech support: my name sai , writing in reference technical support case #01708094 regarding 'calling python functors through matlab'. i understand experiencing issues while invoking functor defined in python matlab. i see using matlab r2014b. please note this known issue in matlab r2014b has been fixed in matlab r2015a , there no kn

What is the difference between GamepadButtonFlags and GamepadKeyCode in SharpDX.XInput? -

i'm adding gamepad support app , i'd make sure i'm not misusing either of determining whether key has been pressed. purpose of either gamepadbuttonflags , gamepadkeycode ? there guidelines should used in cases, or interchangeable? turns out (at least version using), gamepadbuttonflags has fewer key flags wants full controller support want. gamepadkeycode has keycodes, couldn't find way make them work, , googling gave me 9 search results, including (my own) post. so swapped sharpdx slimdx , same methods worked flawlessly gamepadkeycode.

Send Javascript value to PHP with Phaser framework -

i want send javascript variable php, , php store in database. now when search on google, lot of information visible this. times see ajax, when use ajax code doesn't run. tried example http://www.tutorialspoint.com/ajax/ajax_database.htm , tried answers on stackoverflow. maybe won't work because use phaser, framework. maybe i'm trying long , don't think anymore, need fresh @ this. on phaser game have different prefabs. 1 called gameover.js , can have access score line of code: var score = this.game_state.score; that's easy. ok, have send php. used jquery selector (jquery.post() , jquery.ajax()) , tutorial above, without success. at moment have in javascript: game.gameover.prototype.submitscore = function () { var ajaxrequest; // variable makes ajax possible! try{ // opera 8.0+, firefox, safari ajaxrequest = new xmlhttprequest(); }catch (e){ // internet explorer browsers try{ ajaxrequest = new activexobj

python - How to use sequence unpacking with a sequence of variable length? -

if know length of list in advance, can use sequence unpacking assign variable elements of list thus: my_list = [1,2,3] x, y, z = my_list if don't know length of list in advance, how can assign variables elements of list using sequence unpacking? if argument's sake don't care how variables named, can first length of list , unpack amount of arbitrarily-named variables? certainly not recommend possible: my_list = [1, 2, 3] counter, value in enumerate(my_list): exec 'a{} = {}'.format(counter, value) print a0, a1, a2 output: 1 2 3 or use python 3: >>> a, *rest = my_list >>> 1 >>> rest [2, 3]

change canvas image on button click in wpf -

on button click want change canvas image(background image) image in folder(images folder name). have tried: private void button_click_2(object sender, routedeventargs e) { drawingcanvas.children.clear(); imagebrush imagebrush = new imagebrush(); imagebrush.imagesource = new bitmapimage((new uri(@"../images/canvas.png", urikind.relative))); drawingcanvas.background = imagebrush; } first i'm clearing contents of canvas, deleting previous image. want set background image. error: uri not handled exception. solutions appreciated. thanks. an image resource loaded resource file pack uri : imagebrush.imagesource = new bitmapimage( new uri("pack://application:,,,/images/canvas.png")); in addition, build action of image file has set resource , shown in this answer .

java - creating squares on event -

i trying create game same system snake. have created window jpanel on it, given background , drawn lines show user squares. board 600x600 (601x601 visible). squares 20x20. now trying add way put coloured squares onto board , detect if coloured square there ideally. public class createwindow extends jframe { jpanel gamearea; static jlayeredpane java_window; image background; public void createwindow() { dimension panel_size = new dimension(800, 800); this.setsize(800,800); this.setdefaultcloseoperation(jframe.exit_on_close); this.setvisible( true ); this.settitle("linerage"); getcontentpane().setbackground(color.white); java_window = new jlayeredpane(); this.add(java_window); java_window.setpreferredsize(panel_size); gamearea = new jpanel() { @override public void paint(graphics g) { g.setcolor(color.black);

javascript - Jquery input number in multiples (keyup) -

how can make input element accept numbers in multiples of 50? i know can specify step="50" attribute, prefer solution triggered the keyup event . i found code, prevents users entering number less 50. question : how can adjust code multiples of 50 can entered ? $('#numberbox').keyup(function(){ if ($(this).val() < 50){ alert("minimum quantity: 50"); $(this).val('50'); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input id="numberbox" type='number'> use modulo operator var multiple = 50; $('#numberbox').keyup(function(){ if (parseint($(this).val()) % multiple ) { alert("only multiples of " + multiple + " allowed"); $(this).val(multiple); } });

sql - GROUP BY with summing null values to every group -

i want group values , sum them category value - or none. example, have following table: +-------+----------+ | value | category | +-------+----------+ | 99 | | | 42 | | | 76 | [null] | | 66 | b | | 10 | c | | 13 | [null] | | 27 | c | +-------+----------+ my desired result should this: +-------+----------+ | sum | category | +-------+----------+ | 230 | | | 155 | b | | 126 | c | | 89 | [null] | +-------+----------+ i tried group category doesn't bring right numbers. any ideas? i'm using sql server 2012. edit: ok, requested, can explain intents , give query far, although not helpful think. i need sum value given categories , add sum of values without category [=> null] in example, sum 99 + 42 + 76 + 13 = 230 category 66 + 76 + 13 = 155 category b 10 + 27 + 76 + 13 = 126 category c 76 + 13 = 89 no category i hope gives idea of goal. query far:

coldfusion - Duplicating and Renaming a file and storing name in Database -

i have register page asks information employee_number, user_name, user_pass, firstname, lastname, position, email, phone_extension, department, picture . once fill information out , hit register gets uploaded database. is possible have create profile page specific user based on information in database? for example, if registered have create davidbriertonprofile.cfm template profile.cfm , have add davidbriertonprofile.cfm in database can use name reference later. possible take template profile.cfm , rename based on there name , have added profiles/(therenameprofile).cfm i have been playing cffile in order create path need behind scenes selecting template file user never sees of this. <cffile action = "upload" file = "#expandpath("/webapps/dash/profiles/profile.cfm")#" destination = "#expandpath("/webapps/dash/profiles/")#" nameconflict = "makeunique" result =

python - Odoo - How to acess recordsets on web controller -

i using web controller in odoo 8 make rest api data , return values database. problem not able database builtin orm. tried call osv.pool.get() gave me error: attributeerror: type object 'model' has no attribute 'pool' odoo 8 apparently uses recordsets, can't use too, , couldn't find usefull on docs. how can browse database data on web controller? my code: class testwebservice(http.controller): @http.route('/test', type='http', auth='none') def test(self): objects = osv.osv.pool.get("some_table") # need objects some_table , search them return "hello world" try following myobj = request.env['some.table']

Should I use C++ for network-programming? -

i started learning c++ last year , feel comfortable point i've started using other libraries , making games , stuff. when first started learning because fed problems couldn't fix in major game engines , thought, why not learn how make own. i've advanced point wanna learn networking sake of games (multiplayer , etc.). i've been doing research , i've learned there easier languages learn networking , c++ isn't language offers support this. i'd make websites interact games. guess i'm asking path should take? learning new language caters more i'm trying or trying extend current knowledge in c++ , if why 1 on other?. edit : know there libraries out there network-programming in c++, i'm not asking names of them i'm asking if it'd easier learn , use them versus learning , using language more tailored it. i think c/c++ valid language start learning network programming in. allow control packets large extend. for reading recommend h

asp.net - Add dll to MVC6 or use old web service -

i need reference dll calls old web service (not svc, older one). i'm not quite sure how go doing that. i'm using rc1 version. call web service directly i'm not sure how either in mvc6. if add dll directly error: the name '*' not exist in current context fieldops.dnx core 5.0 here's part of project.json looks library added called "mylibrary": "frameworks": { "dnx451": { "frameworkassemblies": { "system.runtime.serialization": "4.0.0.0", "system.servicemodel": "4.0.0.0" }, "dependencies": { "mylibrary": "2.2.0" } }, "dnxcore50": { "dependencies": { "system.runtime.serialization.primitives": "4.1.0-beta-23516", "system.servicemodel.primitives": "4.1.0-beta-23516", "system.servicemodel.http": &quo

sql - Update audit database name in triggers and views of main database? -

i have a system 2 databases, main database , audit database. lot of triggers , table views in main database , audit database referencing 1 database other. no needed change both databases names unfortunately failed work because still have old names in code. is there code search , replace old name used referencing or in dependence? thank you, you have manually fix references can leverage sql find offending objects. select object_name(id) objectname , text objectcode sys.syscomments text '%yourreplaceddatabasename%' that give list of functions, procedures, views etc have old database name in code. have recompile each object after have updated code. utilize dynamic sql around nervous changes on scale automatically.

Generate Scripts in SQL Server (big files) -

i in process of moving database sql server 2012 sql server 2008. since can't restore them if moving 2008 2012 have use generate scripts data , schemas. problem have huge database files. 1 of files generate becomes 19gb. there not seem way move file because think size makes file corrupt. cant open file in sql server management studio , using .bat script fails (it freezes). other tables have no problem much smaller. what fix if there way split data in several files each file 100mb or whatever, make script execute them all, possible? if not guys suggest? i suggest create database same name in sql server 2008 (and possibly tables) , try replication between 2 database sql server 2008 subscriber, once should

visual studio - Code Aligment and Resharper 10 together in VS 2015 -

i read of people using extension "code aligment" , resharper together. cannot find option prevent reshparper removing spaces in declarations. simplest case, this: [inject] public inputcontroller inputcontroller { private get; set; } [inject] public icommandfactory commandfactory { private get; set; } [inject] public networkmachinemanager machinemanager { private get; set; } always becomes this: [inject] public inputcontroller inputcontroller { private get; set; } [inject] public icommandfactory commandfactory { private get; set; } [inject] public networkmachinemanager machinemanager { private get; set; } is there way keep alignment, not loosing other formatting features? the feature not implemented in resharper. added in wishlist.

javascript - Change jquery mouseover to window mouseover -

i want change (which gets span name in table): $('span').on('mouseover', function () { if (this.id.match(/_zuserid/)) { alert(this.id); } } to use: window.onmouseover=function(e) { ... ... } but couldn't figure out how span name e.target . don't know put after e.target span name. here jsfiddle example. window.onmouseover=function(e) { if (e.target.id=='myspan') { alert(e.target.id); } }

c# - silverlight MatchTimeoutInMilliseconds bug : resolve DomainServiceClientCodeGenerator -

silverlight 5 .net framework 4 i trying implement workaround recent bug in ria code generator "matchtimeoutinmilliseconds not found" https://connect.microsoft.com/visualstudio/feedback/details/1988437/generated-code-for-silverlight-references-matchtimeoutinmilliseconds-which-does-not-exist i'm trying use workaround lazebnyy , can't seem domainserviceclientcodegenerator resolve. lazebnyy writes: install riaservices.t4 nuget in webproejct or class library contain the code generation classes. pm> install-package riaservices.t4 create 2 classes [domainserviceclientcodegenerator(typeof(myservicesentitygenerator),"c#")] public class myservicesclientcodegenerator : csharpclientcodegenerator { protected override entitygenerator entitygenerator { { return new myservicesentitygenerator(); } } } public class myservicesentitygenerator : csharpentitygenerator { protected override void g

Permission Error when installing pygame on python 3.5 -

when install pygame-1.9.2a0-cp35-none-win32.whl python 3.5 permission error: permissionerror: [winerror 5] access denied and says error in site package of pygame. fixed reinstalling python outside program files.

php - Cheapest way of managing relational SQL data -

i'm trying find best method managing huge-relational game data. let me explain data structure. there 3 main data field. user, bets , coupons. +----------------------------------------------------+ | bets | +----------------------------------------------------+ | id | status | yes | no | +----+-----------+-----------------+-----------------+ | 1 | 0 | 1.45 | 2.52 | +----+-----------+-----------------+-----------------+ | 2 | 1 | 3.00 | 1.08 | +----+-----------+-----------------+-----------------+ | 3 | 2 | 2.43 | 1.42 | +----+-----------+-----------------+-----------------+ +----------------------------------------------------+ | coupons | +----------------------------------------------------+ | id | played_by | bets | status

excel - Delete duplicates between two sheets "Case Sensitive" -

i want compare 2 sheets in excel , if vba found duplicates delete them. have searched while , have find want here. " how delete duplicates between 2 excel sheets vba " but in case didn't work me. because script consider abc , abc duplicates. there anyway modify script case sensitive letters. change comparemode of dictionary. detailed information have here: http://msdn.microsoft.com/en-us/library/a14xez73(v=vs.84).aspx dim dict object set dict = createobject("scripting.dictionary") ' add line: dict.comparemode = binarycompare

Permission change based on file extension using ansible -

i want change permission of file based on it's extension using ansible, example have directory test , within directory have lot of shell script(.sh) , python(.py) files. want change permission of shell script 0700 , python files 0644. can please me how can achieve this. thanks there many ways this. should work. tweak needs. - file: path={{item}} mode=0644 with_fileglob: - <full_path>/*.py - file: path={{item}} mode=0700 with_fileglob: - <full_path>/*.sh if files on remote, this: - shell: ls /test/*.py register: py_files - file: path={{item}} mode=0644 with_items: py_files.stdout_lines

Is it possible to parse only one JSON key/field/property in programming language C -

is possible c program 'read' (by using c json parser) 1 property of json object stored in char[]? want read 1 strig field of json object, because need know value decide kind of struct deserialize whole json object. i have tried deserialize json objects containing int , double types. deserialize them 'predefined' struct having such declaration example: struct obj{ int a; int b; double c; }; but want use 2 different structs example: struct obj1{ int a; char b[40]; double c; char d[15]; }; struct obj2{ int a; struct in b; double c; char d[15]; }; struct in1{ int ina; int inb; char inc[20]; }; which structure use deserialize json object determined value of 'string' char d[15] . , before deserializing json need know value. the json string like: {"a":"...", "c":"pure string or object", "c":"...", "d":"info type"}

android - Inject uplink audio in call with Snapdragon MSM8960 SoC -

i've been investigating on topic specific msm8960 time. looked alsa hardware module google . michael's answer in post did mention msm8960 supported in-call uplink audio injection @ "hardware , device driver" level. did refer level @ alsa module? from alsa config file on phone, seems in call voice playback done through /dev/snd/pcmc0d0p, or @ least comply alsa paradigm. possible play 1 of file descriptor achieve purpose? see interesting use_case definition in libalsa-intf. the msm8960 provides alsa control named incall_music audio mixer , can connect cpu dais multimedia1 , multimedia2 (which correspond alsa devices pcmc0d0p , pcmc0d1p , respectively). (see msm-pcm-routing source code) so if had voice call running , wanted play audio on uplink through pcmc0d0p through adb shell (assuming you've got root access): amix 'incall_music audio mixer multimedia1' 1 aplay -dhw:0,0 mono_8khz_audio.wav more elegant way create new use-case i

javascript - Getting data from client Nodejs -

i made simple server in nodejs. want connect server other application (app in c++) on rasppserypi. i'm making connection , sending datastring raspberry node server. so there question: how can "catch" data raspberry sending server? you can use multiple options: make simple http server. express 1 of used modules http servers in node.js. fast setup , easy use. http://expressjs.com/en/starter/hello-world.html boost easy use c++ part. how send http request , retrieve json response c++ boost make tcp connection between them both. can make tcp connection between them both. use boost c++ part , internal net module of node.js https://gist.github.com/tedmiston/5935757 use node.js on raspberrypi well. can run node.js raspberrypi , make client server communication in snippet above. node.js can call c++ program child process. there many other options should easiest ones. depends on actual use case, want build.

r - Why does one-row xts object not get a timezone? (why does it ignore/override the default argument) -

frustrated unit test complaining, narrowed down 1 xts object has timezone set "utc", other has set "". and i've narrowed down further seems creating xts object 1 row, compared 2+ rows: > str(xts( c(1,2), as.posixct("2015-01-01 00:00:00")+0:1)) ‘xts’ object on 2015-01-01/2015-01-01 00:00:01 containing: data: num [1:2, 1] 1 2 indexed objects of class: [posixct,posixt] tz: utc xts attributes: null > str(xts( c(1), as.posixct("2015-01-01 00:00:01"))) ‘xts’ object on 2015-01-01 00:00:01/2015-01-01 00:00:01 containing: data: num [1, 1] 1 indexed objects of class: [posixct,posixt] tz: xts attributes: null below xts constructor. can see tzone argument gets initialized sys.getenv("tz") , evaluates "utc". i'm confused why tzone ever end "", based on contents of x . function (x = null, order.by = index(x), frequency = null, unique = true, tzone = sys.getenv("tz"),

javascript - Leaflet maps crashes the App( via PhoneGap/Android) on Zoom -

so i'm using leaflet.js mapping library(with openstreetmaps, now) in html5 app (a simple example, doubt posting code needed.), , using phonegap( v4.2.0...i think). i'm deploying/testing android. works enough, until zoom/pinch-zoom, in case app crashes(not , on different zoom-levels). i've tried finding out happens(using abd), no avail, after wild-goose chase results inconclusive: f/libc ( 1902): fatal signal 11 (sigsegv) @ 0x00000000 (code=1), thread 1915 (webviewcorethre) i/debug ( 787): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** i/debug ( 787): build fingerprint: 'unknown' i/debug ( 787): pid: 1902, tid: 1915, name: unknown >>> package.mypackage <<< i/debug ( 787): signal 11 (sigsegv), code 1 (segv_maperr), fault addr 00000000 not helpful. gonna try using latest version of phonegap next...little hope. have ideas? thanks see issue: https://github.com/leaflet/leaflet/issues/909 it appears is

java - Getting CheckBox Data into a Bundle -

i've done before. it's not rocket science. beautiful activity containing perfect form. edittext here... spinner there. time there checkbox 'es. this should easy: setup onclick() method declared in xml, grab id of view... ...thing is, i've been using bundle gather data in form , send intentservice drop sqlite database. /** * called when user changes state of checkbox * @param view view checked/unchecked */ public void oncheckboxchng(view view) { // view checked? boolean checked = ((checkbox) view).ischecked(); string mfield = new string(); // check checkbox clicked switch(view.getid()){ case r.id.dlg_add_ply_chk1: mfield = "platinum"; break; case r.id.dlg_add_ply_chk2: mfield = "gold"; break; case r.id.dlg_add_ply_chk3: mfield = "silver"; break; case r.id.dlg_add_ply_chk4: mfield = "bronze"; break; case r.id.dl

pca - RDA analysis in R gives error "attempt to set an attribute on NULL" -

i'm running analysis in r vegan package. it's simple in way want summary extract values. keeps telling me error message. why? i have dataset feed.raw1 =structure(c(0l, 0l, 2l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 5l, 0l, 2l, 0l, 0l, 0l, 0l, 0l, 0l, 2l, 0l, 7l, 11l, 3l, 1l, 0l, 1l, 0l, 0l, 0l, 0l, 0l, 0l, 1l, 2l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 3l, 0l, 5l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 2l, 0l, 0l, 8l, 7l, 5l, 1l, 0l, 0l, 1l, 0l, 0l, 0l, 0l, 0l, 10l, 5l, 0l, 0l, 1l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 1l, 5l, 0l, 0l, 8l, 9l, 0l, 0l, 5l, 0l, 0l, 0l, 1l, 0l, 0l, 0l, 1l, 0l, 0l, 0l, 1l, 0l, 0l, 0l, 15l, 0l, 51l, 10l, 0l, 0l, 0l, 0l, 2l, 0l, 0l, 0l, 0l, 2l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 1l, 3l, 0l, 1l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 45l, 203l, 17l, 54l, 4l, 1l, 0l, 0l, 0l, 0l, 10l,

.net - RESTful and Repository returning values from another type architecture -

in short, have 2 database tables: languages , frameworks. important thing there one-to-many relation between tables(one language has many frameworks). designing restful(webapi2) service consume information these tables. using repository pattern. using ef, i've made navigational property language reach frameworks. however, how should implemented in repositories. correct return framework collection in language repository? want reach frameworks of language using same webapi controller because gives more simple route , i'm not sure if correct way @ all. public class languagescontroller : apicontroller { private readonly iprogramminglanguagerepository languages; public languagescontroller() : this(new programminglanguagerepository(new cvsystemdbcontext())) { } public languagescontroller(programminglanguagerepository languagesrepository) { this.languages = languagesrepository; } [httpget] [route("api/languages")] pu