Posts

Showing posts from September, 2012

Html submit value based on which button is clicked -

is possible submit hidden name value pair based on button clicked? here's form: <form action="post" action=""> <button> <input type="hidden" name="vote" value="up"/> vote up! </button> <button> <input type="hidden" name="vote" value="down"/> vote down </button> </form> for reason, name value pair received latter (the first 1 got replaced). example user clicked on 'vote down', still $input['vote'] = up does know how fix this? this because put both of them in form parameters received server like vote=up&vote=down assume access using php associative array received latest value in entries having same key. aside, why not just <form action="post" action=""> <button> <input type="hidden" name="vote" value=&quo

c++ - Resolve build errors due to circular dependency amongst classes -

i find myself in situation facing multiple compilation/linker errors in c++ project due bad design decisions (made else :) ) lead circular dependencies between c++ classes in different header files (can happen in same file) . fortunately(?) doesn't happen enough me remember solution problem next time happens again. so purposes of easy recall in future going post representative problem , solution along it. better solutions of-course welcome. a.h class b; class { int _val; b *_b; public: a(int val) :_val(val) { } void setb(b *b) { _b = b; _b->print(); // compiler error: c2027: use of undefined type 'b' } void print() { cout<<"type:a val="<<_val<<endl; } }; b.h #include "a.h" class b { double _val; a* _a; public: b(double val) :_val(val) { } void seta(a *a) { _a = a; _a->print();

php - Laravel Eloquent: filtering model by relation table -

i have places , locations tables. place have many locations. location belongs place. place: id title location: id place_id floor lat lon class location extends model { public function place() { return $this->belongsto('app\place'); } } and class place extends model { public function locations() { return $this->hasmany('app\location'); } } and need find places, belongs 1st floor. select * places inner join locations on places.id = locations.place_id locations.floor = 1 how should done in eloquent? is similar place::where('locations.floor', '=', 1)->get() exists? yes, know there wherehas : place::wherehas('locations', function($q) { $q->where('floor', '=', 1); })->get() but generates bit complex query counts: select * `places` (select count(*) `locations` `locations`.`place_id` = `places`.`id` , `floor` = '1') >= 1

list - R programming: save three dimensional outputs after loop -

i new r , save out puts after loop (i in 1:5) { (d in 1:10) { fonction1 fonction2 fonction3 } } at end have 1 list-> contains 5 list-> contains 1*10 data frame -> contains number*3 numeric data. (i dont know if im saying correctly, want have is: in matlab, there 1*5 structure -> contains 5 1*10 structure -> contain number*3 numeric data). thanks in advance looks looking after following: out <- list() (i in 1:5) { outlist <- list() (d in 1:10) { outvect <- c() outvect[1] <- fonction1() outvect[2] <- fonction2() outvect[3] <- fonction3() outlist[[d]] <- outvect } out[[i]] <- outlist } then can at: str(out) to see structure of answer

Python 3: AttributeError: 'module' object has no attribute '__path__' using urllib in terminal -

my code runnning in pycharm, have error messages while trying open in terminal. what's wrong code, or made mistakes? import urllib.request urllib.request.urlopen('http://python.org/') response: html = response.read() print(html) output terminal: λ python desktop\url1.py traceback (most recent call last): file "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked attributeerror: 'module' object has no attribute '__path__' during handling of above exception, exception occurred: traceback (most recent call last): file "desktop\url1.py", line 1, in <module> import urllib.request file "c:\users\przemek\desktop\urllib.py", line 1, in <module> import urllib.request importerror: no module named 'urllib.request'; 'urllib' not package you called file c:\users\przemek\desktop\urllib.py , need rename it. importing not actual module. rename c:\users\p

git pull origin master is still ahead of origin/master by 1 commit -

Image
i made commit on local copy of master , added commit separate branch / pull request. i'm on local master, start here: git:(master) git status on branch master branch ahead of 'origin/master' 1 commit. (use "git push" publish local commits) nothing commit, working directory clean i want out of commit, since merge branch, i: git: (master) git pull origin master https://github.com/basho-labs/the-riak-community * branch master -> fetch_head up-to-date. and i'm still in same state. out of this, i: git:(master) git checkout head~1 note: checking out 'head~1'. in 'detached head' state. can around, make experimental changes , commit them, , can discard commits make in state without impacting branches performing checkout. if want create new branch retain commits create, may (now or later) using -b checkout command again. example: git checkout -b new_branch_name head @ abd0327... but what's cleanest way ha

Execute Macro inside SQL statement -

the situation: i have table mytable 2 columns: tablename , tablefield : |-----------|------------| | tablename | tablefield | |-----------|------------| | table1 | id | | table2 | date | | table3 | etc | |-----------|------------| my core objective here basically, make select for each of these tablenames, showing max() value of corresponding tablefield. proc sql; select max(id) table1; select max(date) table2; select max(etc) table3; quit; ps: solution have pull data table, whether table change values, solutions make changes also. what have tried: from of attempts, sofisticated , believe nearest solution: proc sql; create table table_associations ( memname varchar(255), dt_name varchar(255) ); insert table_associations values ("table1", "id") values ("table2", "date") values ("table3", "etc"); quit; %macro max(field, table); select max(&field.) &table.; %me

php - Symfony2 nothing happens when I display my form inside a class -

so following documentation , making form inside own class: <?php namespace mp\shopbundle\form\type; use symfony\component\form\abstracttype; use symfony\component\form\formbuilder; use symfony\component\form\formbuilderinterface; use symfony\component\form\formview; use symfony\component\form\forminterface; use symfony\component\optionsresolver\options; use symfony\component\optionsresolver\optionsresolverinterface; use symfony\component\propertyaccess\propertyaccess; class registerformtype extends abstracttype { public function registerform(formbuilderinterface $builder, array $options) { $builder >add('title', 'choice', array( 'choices' => array('-' => '-', 'mr' => 'mr.', 'mrs' => 'mrs.', 'mss' => 'miss.'), 'label' => 'title * ', 'attr' =>

reporting services - Open subreport depending on column value in SSRS -

Image
i have 6 possible subreports , 6 possible values in 1 column. want click on column , open subreport associated value. found couple places recommending =iif(fields!datatype.value = "xxx","<path>", iif(fields!datatype.value = "yyy","<path>",nothing) with format, won't anything, no clicking option on column my path on server it's /homefolder/reports/subreports/report returns item containing invalid char , doesn't show report this expression have not work. returns databox invalid error. iif(fields!datatype.value = "ple",/reports/subreports/plereport,nothing) right click on column field> text box properties

eclipse plugin - Why are sonarqube runners giving me different number of violation errors? -

i tried running code analysis against different sonnar runners: with ant tried: sonar-ant-task-2.2.jar sonar-ant-task-2.0.jar with maven tried: sonarqube-eclipse plugin sonar:sonar maven task why giving me different violations count though use same quality profile? wild guess here given few information available (please share configuration of analysis) can due fact bytecode not provided when running ant whereas done automatically when running maven.

c++ - Change the values of OpenGL's z-buffer -

i want pass matrix depth values z-buffer of opengl. somewhere found can use gldrawpixels(640,480,gl_depth_component,gl_float,normalizedmappeddepthmat.ptr()); where mat opencv mat.is possible change z-buffer values in opengl using texture binding?if so,how? with programmable pipeline, can write gl_fragcoord in fragment shader, setting per-pixel z value. feature, can implement render-to-depth-buffer feature quite rendering full-screen quad (or else, if want overwrite sub-region of whole buffer). reasonably modern gl, able use single-channle texture formats enough precision gl_r32f. older gl versions, can manually combine rgb or rgba channels of standard 8bit textures 24 or 32 bit values. however, there little details have take account. writing depth buffer occurs if gl_depth_test enabled. of course might discard of fragments (if depth-buffer not cleared before). 1 way around setting gldepthfunc() gl_always during depth-buffer rendering. you must keep in mind rende

How to refresh Jquery datatables in order to account for newly added rows? -

i json request , fill table in dom rows , call .datatable() make datable. instead of ajax call various reasons. now want add rows table (by manipulating dom , adding rows manually). how can 'refresh' or 'reload' datatables account these new rows? thanks! when need reinitalise datatable, use destroy() method. re-initialise normal. var table = $("#table").datatable(); // table updated addrow(); // destroy outdated table table.destroy(); // create new instance of datatables table = $("#table").datatable();

Not able to activate HTTP & HTTPS in google CLICK TO DEPLOY LAMP VM Instance -

i not able activate http external ip of lamp vm in google compute engine ... installed new lamp server vm instance and deployment successfull , shown external ip . when wanted enable http vm getting error and failing " invalid value field 'resource.network': ' https://content.googleapis.com/compute/v1/projects/ ***********-4758/global/networks/default'. must url compute resource of correct type (** hidden privacy ) the steps followed view virtual machine instances in compute engine instances page. 1. in external ip column, click external ip address lamp server name. 2. in dialog box opens, select allow http traffic check box. 3. click apply close dialog box.

Querying between two date values in asp.net mvc5 -

Image
i have treatmentdate column in database dates treated patients submitted. if need generate report of total sum between january 01 2015 , jan 30 2015 particular company, how construct query. below have done , i'm having errors var treatmentsum = (from s in db.treatments (s.companyid == companyid) s.treatmentdate >= fromdate && s.treatmentdate <= todate select s.amount).sum(); viewbag.treatmentsum = treatmentsum; here's treatment date column want search through. your guidance highly appreciated. you didn't post error message. trying compare strings using <= , >= , instead try handle of date , time variable datetime properties. here's piece of code linq expression: datetime fromdate= convert.todatetime("04/20/2015"); datetime todate= convert.todatetime("04/28/2015"); viewbag.tr

Android bitmap processing - no leak but still OOM? -

i'm writing camera app , when take picture, receive byte [], decode bitmap , rotate before saving jpeg. i'm rotating photo using native library, bitmap still decoded byte[] memory (still, allows me keep 1 bitmap instead of 2). there's 1 place in code require lot of memory , oom on devices heap low , cameras stupid-megapixels. suggestions how fix without on loosing image quality? i don't think want use largeheap="true" should forget rotation , set exif? also i'm not keen on trying 'predict' if oom math's not adding up: android outofmemory when gc reports free memory? any suggestions how fix without on loosing image quality? use android:largeheap="true" . or, use other native library allows hand on byte[] , rotation , saving disk you, avoid bitmap , java-level processing of huge thing. or, if minsdkversion 19, , rest of logic supports it, use inbitmap on bitmapfactory.options try reuse already-allocated

excel - Powershell script not running on Task Scheduler -

i have ps script opens excel (com object), processes bunch of information, re-saves, , sends critical information via e-mail. script runs great, , when run run console, works great well. however, when schedule task in task scheduler not working properly. task seems "successfully run" every single time, not output e-mail supposed get. have run many other ps scripts without problem using same configuration in task scheduler. have opening excel part of script scheduled? thoughts welcome.

Ruby interpreted variables is_a? -

i looking check variabe type based on value held in variable struggling it. i'm new ruby can tell me how have value of variable interpreted in expression? current code looks like:- if variable.is_a?("#{variable_type}") puts variable end where variable contain , variable_type contains type of variable string or fixnum. code gives me typeerror: class or module required. thoughts? your code sends string object #is_a? method , #is_a method expects class. for example, string vs. "string" : variable = "hello!" variable_type = string "#{variable_type}" # => "string" # code: if variable.is_a?("#{variable_type}") puts variable end #is_a? expects actual class (string, fixnum, etc') - can see in the documentation #is_a? . you can adjust code in 2 ways: pass class, without string. convert string class using module.const_get . here example: variable = "hello!" variable_

php - Inserting a JSON object into a blank database -

i have close 120 json fields in objects. whole bunch of various versions of sample json object i don't have time map every field, nor care if field title called array 0 or other default. i want data stuffed database, maintaining it's structure in indexable format. json valid data structure, why not use it? i did find -> https://github.com/adamwulf/json-to-mysql , hypothetically job. software broke (no error nothing ever gets populated). other alternatives such https://doctrine-couchdb.readthedocs.org/en/latest/reference/introduction.html involve mapping. don't have time map 120 fields , nothing should require mapping, use existing. whats easy way stuff large json objects mysql, auto building structure existing format?

php - Remove indexing from an array -

this question has answer here: how convert 2 dimensional array 1 dimensional array in php5 [duplicate] 5 answers i have following array: array(3) { [0]=> array(1) { ["theme_loader_plugin"]=> string(4) "_run" } [1]=> array(1) { ["user_plugin"]=> string(4) "_run" } [2]=> array(1) { ["sessions_plugin"]=> string(4) "_run" } } is there way remove indexing using predefined php function , instead format this: array(3) { ["theme_loader_plugin"]=> string(4) "_run", ["user_plugin"]=> string(4) "_run", ["sessions_plugin"]=> string(4) "_run" } loop through array , merge them new array. hope - $arr = array( array("theme_loader_plugin"=> "_run" ) , array(&qu

Google embed api set chart background color -

i trying edit background colour of chart isnt working can edit background colour of full thing not chart area, code below var sessions = { query: { dimensions: 'ga:date', metrics: 'ga:sessions' }, chart: { type: 'line', options: { width: '100%', title: 'sessions', titletextstyle: { color: '#0f55c4', fontsize: '16', bold: true } } } }; i have tried following combinations none have worked; backgroundcolor: 'red', (changed background colour not chart colour) chartarea: { backgroundcolor:'red' } (again background colour only) chartarea: { backgroundcolor: { fill: 'red' } } (again background colour only) chartarea: { fill: 'red' } (doesn't

ruby on rails - Test order in has_many relationship with RSpec -

i'm not experienced rails , rspec , have troubles writing tests. so, next trouble don't know how test order in model's relationship properly. let's have simple model this: class kitchen < activerecord::base has_many :orders, -> { order(completed_at: :desc) } end and simple test model: require 'rails_helper' rspec.describe kitchen, :type => :model before { @kitchen = factorygirl.create(:kitchen) } subject { @kitchen } describe "orders" before @kitchen.orders.build(description: "test description 1", completed_at: 1.day.ago.localtime) @kitchen.orders.build(description: "test description 2", completed_at: time.now) end "should sorted completion date in descending order" expect(@kitchen.orders.first.completed_at).to > @kitchen.orders.last.completed_at end end end as result have got error: failure/error: expect(@kitchen.orders.first.comp

android - Skipped xx-frames! The application may be doing too much work on its main thread -

i'm quite new android, tried making simple apps. 1 getting worse me. searched lot, should use "asynch" method or use "new runnable method", still not getting exact solution. here mainactivity.java: package com.example.mit; import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; public class mainactivity extends activity implements onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } public void onclick(view v) { switch(v.getid()) { case r.id.addition:

python - Why the below piece of regular expression code is returning comma(,) -

please let me know why following piece of code giving below result >>> pattern = re.compile(r'[!#$%&()*+-.]') >>> pattern.findall("a,b") [','] there no comma(,) symbol in re.compile method, why matching comma also? [+-.] single character in range + (ascii 43) . (ascii 46). between 2 characters find , (ascii 44) , - (ascii 45). i guess wanted \- instead of - .

c++ - Is "#define TYPE(x) typename decltype(x)" a bad idea? -

is bad idea define #define type(x) typename decltype(x) as fast way member type of class of variable in c++11? justification: consider following (oversimplified) example: #include <iostream> #define type(x) typename decltype(x) class { public: typedef int mtype; void set(mtype const& x) { foo = x; } mtype get() { return foo; } private: mtype foo; }; make() { return a(); } int main() { auto = make(); type(a)::mtype b = 3; a.set(b); std::cout << a.get() << "\n"; return 0; } that is, have class member type "mtype" , function returns me instance of class. auto, don’t have worry name of class long know function job. however, @ 1 point or another, have define variable of specific type, which, convenience, has typedef "mtype" in class. if have variable name "a" around know variable has class, can do typename decltype(a)::mtype b; to define variable b of type a::mtype. is bad idea put &qu

java - How to synchronize / limit certain async http calls in android -

i making use of android async http library in app make async http requests. i have come situation in android app following happens. web api makes use of access token , refresh token. on every request make check if access token still valid. if not issue http post go new access token using refresh token. now have noticed following situation. user of app leaves phone inactive enough time access token expire. when wake phone up. in onresume() function fire off 2 separate http requests. request 1 checks access token , determines not valid. issues refreshaccesstoken request. while request 1 waiting response, request 2 checks access token , determines not valid. , issues refreshaccesstoken request. request 1 returns , updates access token , refresh token values. request 2, gets 401 response api refresh token provided has been used. application thinks there error refreshtoken , logs user out. this incorrect , avoid it. have in mean time, done double check in refreshacces

javascript - How to open google login dialog in the same window instead of popup window? -

i have website users can login google account. using javascript google api.login method display google login dialog. default, triggers displaying new popup window how open google login dialog displayed in same window user clicked on google login button? code like-- <link href="https://fonts.googleapis.com/css?family=roboto" rel="stylesheet" type="text/css"> <script src="https://apis.google.com/js/client:platform.js?onload=render" async defer></script> <script type="text/javascript"> function render() { gapi.signin.render('custombtn', { 'callback': 'onsignincallback', 'clientid': 'my-client-id', 'cookiepolicy': 'single_host_origin', 'requestvisibleactions': 'http://schemas.google.com/addactivity', 'scope': 'https://www.googleapis.com/auth/plus.l

javascript - Trying to centralise a div inside another which is dynamic using JS -

Image
http://jsfiddle.net/dad4avvj/1/ everytime try align doing inline-block , text-align:center throws numbers class out of position , looks wrong. these circles animated fill on course of few seconds. need add text under each 1 , equally pad them out within container. problem on site wish implement it, has max-width of 900px; how can centralise without messing rest of text? give text-align: left; .numbers , text-align:center; .bar , remove float:left .radial-progress solved issue. .numbers { text-align: left; } check fiddle here. hope helps.

How do I save a URL, a web page addess as a shortcut to the desktop using vba -

i've been googling 2 hours now; seems simple enough question i'm getting every thing but if have web page open, go file menu on iexplorer, there command "send > shortcut desktop" i same thing using vba. above command need give authorization. avoid in vba code if possible. also, may obvious, need saved html shortcut if double click on web page open. seems simple. possible?, maybe not. i appreciate anyone's help. i'm sure can answer in 2 seconds, honestly, google simple possible, google several different ways. there isn't answer. lol. gotta laugh, , no, i'm not drunk, wish were! thanks awsmitty

c# - TabIndex for dynamically create -

Image
i have few controls creating @ runtime , add form of container (in case panel). while creating controls set tabindex of each one. now, start @ last control (textbox #4) , work forward first control ends @ top. i taking account i'm doing in reverse when setting tabindex , when run code , press tab key jumps #4 -> #3 -> #2 -> #1 (in order created, not top bottom want). when debugging can see each controls tabindex set correctly (textbox#1.tabindex = 1, ..., textbox#4.tabindex = 4) missing or there workaround? code: panel pnl = new panel(); (for int = fields.count -1; <= 0; i--) { label lbl = new label(); //do stuff label lbl.tabindex = (i + 1); pnl.controls.add(lbl); } from: https://msdn.microsoft.com/en-us/library/bd16a8cw%28v=vs.80%29.aspx?f=255&mspperror=-2147217396 by default, first control drawn has tabindex value of 0, second has tabindex of 1, , on. so can assume +1 incorrect. panel pnl = new panel(); (for int = field

Eclipse color themes not working -

i have followed clear instructions install eclipse color themes 1.0.0 in eclipse luna 4.4.0, ubuntu 10.04.2 64bits, , whenever check of themes: no preview shown. the theme not applied when click apply , accept. i have checked other questions such as: how can change eclipse theme? eclipse color theme not working not problems. no errors. update: turns out editor working, rest of windows original aspect. any advice welcome. thank you! i found answer: known bug eclipse version: https://github.com/guari/eclipse-ui-theme/issues/73 basically, have enable gtk3 when launching it, can done in .desktop file: [desktop entry] name=eclipse comment=eclipse luna exec=env swt_gtk3=1 ~/apps/eclipse/eclipse icon=~/apps/eclipse/eclipse-1.png startupnotify=true terminal=false type=application and requires set global dark theme on on gnome tweak tool.

generics - Nested class cannot be cast to java.lang.reflect.ParameterizedType -

i trying implement model structure this: generic (abstract) tplinsurance (extends generic) tplinsurancedoctor (nested class in tplinsurance extends tplinsurance) unfortunatelly getting runtime error when trying create object of tplinsurancedoctor , wich nested class: caused by: java.lang.classcastexception: java.lang.class cannot cast java.lang.reflect.parameterizedtype that errors points generic contructor: public generic() { entityclass = ((class) ((class) ((parameterizedtype) getclass().getgenericsuperclass()).getactualtypearguments()[0])); } here model classes: public abstract class generic<t extends generic> { protected class<t> entityclass; public generic() { entityclass = ((class) ((class) ((parameterizedtype) getclass().getgenericsuperclass()).getactualtypearguments()[0])); } public long id; } public class tplinsurance extends genericdictionary<tplinsurance> { public class tplinsurancedoctor extends tplins

sql server - ASP.NET Membership on .NET 4.0 Multi-Tenant app. Default or Custom? -

this first attempt, trying integrate membership on existing shop in production. i'm not quite sure, based on scenario, if should use build-in aspnet-providers or custom implementations of them in order integrate membership. here's few details: i have multi-tenant, single database, single schema web app based on subdomain. the app in production , later want link newly registered users existing anonymous orders email. the development continue after membership integration, new features added, meaning new columns , linked tables users table. this answer got thinking of using membership deafult profile in order extend users table created aspnet providers, since don't have users yet. though not clear me how link users orders , other tables/entities might later added when app going extended. maybe define entities related users user-defined profile properties not have associations on database. another overhead i'm thinking of how associate users different t

TypeError: object of type 'NoneType' has no len() python fix this? -

how can fix this........ full code below should search members of form , print them , save them csv file import csv import time def main(): mylist = [ ] mylist = read_csv() ##mylist = showlist(mylist) searchlist = searchqueryform(mylist) if searchlist: showlist(searchlist) else: print("i have nothing print") if len(searchlist) == 0: typeerror: object of type 'nonetype' has no len() have no idea means can fix this.. neeed asap it means searchlist empty. function searchqueryform resulting in empty object. can try print , see

android - Debugin ionic with wifi and chrome -

i trying debug oneplus 1 wifi , chrome can connected device, 1 plus in on debug mode , adb on network ip , port. on chrome opened chrome://inspect/#devices insert ip , port port , ip+port nothing happening.... thanks help! i found simples solution , debugging without wifi connect usb , done.

c# - Metadata contains a reference that cannot be resolved. Error while trying to connect to CRM Online 2015 -

Image
background: using windows service connect crm online 2015 specific data there , move local sql database reporting purposes. this tested code running on server of our client. service stopped , when debugged got following error. this otherwise working on local machine not on server service installed on. reason this? client says there no firewall on server. domain credentials using? here piece of code using connect crm i error @ organizationserviceproxy serviceproxy=neworganizationserviceproxy(organizationuri, null, credentials, null); note: when try open website or crm instance browser shows me following: any guys? i think client installed new set of rules on sonicwall or started use sonicwall. if see right sonicwall blocks request.

bash - Alias for SSH and run command in a Vagrant VM -

i have 2 vagrant machines in folder, , i'm having ssh in both , run same command. do: $ vagrant ssh machine1 [vagrant@machine1 ~]$ sudo rm -rf /tmp/cache/* [vagrant@machine1 ~]$ exit $ vagrant ssh machine2 [vagrant@machine2 ~]$ sudo rm -rf /tmp/cache/* [vagrant@machine2 ~]$ exit i'd create alias or little script can run , things, don't need type again , again... ideas? to this, can add alias: alias vssh="vagrant ssh machine1 -c 'sudo rm -rf /tmp/cache/*'; vagrant ssh machine2 -c 'sudo rm -rf /tmp/cache/*'" add profile (i.e. ~/.bash_profile or similar file), reload running: . ~/.bash_profile

sonarqube - Missing sonar.properties file post starting up the Sonar applicaiton -

i have installed sonarqube 5.1 mysql db. issue facing after start application, "sonar.properties" supposed under "/conf/" directory not seen @ all. see "wrapper.conf" file , nothing else.i need configure ldap/ad , need modify sonar.properties file this. struck here unable locate sonar.properties. please suggest it? do need sonar runner? i have never see sonar.properties file disappear probable did something. anyway, original sonar.properties have modified in order run sonarqube connexion db, still in sonarqube file have downloaded, can reinstall it. there different ways run analysis, sonar runner or not: http://docs.sonarqube.org/display/sonar/analyzing+source+code

android - google play services 7.3.0 causes crash -

i using google play services 6.5.87 until wanted use android place picker in app. requires play services version 7.0.0 , above. i changed google play services version 7.3.0(latest, tried 7.0.0 well), started causing crash on kit kat , below devices. following errors came up: the google play services resources not found. check project configuration ensure resources included. noclassdeffounderror java.lang.verfiyerror i tried googling solution. suggested changing jdk 1.8 1.7(tried didn't work). when change play services version 7.x.x 6.5.87 works fine. somewhere read wear doesn't support 7.3.0 reason. tried specifying screen sizes, , didn't help. any lead of immense help. i think have found root cause it, in build.gradle(app) file inside defaultconfig, set multidexenabled flag true ( multidex ) put compile dependency compile 'com.android.support:multidex:1.0.0' under dependencies now, in application class, add @override protec

python - How to get cmd in Tkinter widget -

Image
i'm creating tkinter gui , want add windows cmd tkinter widget. use console connect database. did research , found pyconsole module, bugs: cls not going expect; edit not going show editor (try start edit instead); prompt fails too; the color command not implemented; the great ^c isn't supported (it copies text, instead of interrupting process). especially ^c command ommited huge limitation sql scripts want run. i'm able open console this: popen(["cmd.exe"], creationflags=create_new_console) but approach don't know how interact gui (is possible?) also text widget can read output command line, need write in command line, not read it... is there possibility regular cmd tkinter widget, react rest of widgets in gui? desired behaviour cmd console on right side can see on picture below (in tkinter window), interact listbox on left. i'm not looking exact code (that's why no code stated here), method/solution how put cmd tkinter. pho

oleDB connection: getting exception querying MDX from C# -

please: receive following exception when trying run code: object reference not set instance of object... using (oledbconnection conn = new oledbconnection(@"provider=msolap.4; data source=<mysource>; initial catalog=analysis componetreport;")) { conn.open(); var mdxquery = new stringbuilder(); mdxquery.append("select non empty { [measures].[afr] } on columns, [dim_component_basic].[kp mat nr].children on rows (select [dim_component_basic].[kp mat nr].&[" + partnumber + "] on columns [cub componenten])"); using (oledbcommand cmd = new oledbcommand(mdxquery.tostring(), conn)) { //dataset ds = new dataset(); //ds.enforceconstraints = false; //ds.tables.add(); datatable dt = new datatable(); dt.load(cmd.executereader()); try { part.partnumber =

android - Converting image url to bitmap quickly -

i need display list of images api in list page. used 2 approaches. first approach: converting url byte array , converting bitmap.please find below code.. url imageurl = new url(url); urlconnection ucon = imageurl.openconnection(); inputstream = ucon.getinputstream(); bufferedinputstream bis = new bufferedinputstream(is); bytearraybuffer baf = new bytearraybuffer(500); int current = 0; while ((current = bis.read()) != -1) { /* approach slowdown process*/ baf.append((byte) current); } byte[] img_ary= baf.tobytearray(); converting byte array bitmap: bytearrayinputstream imagestream = new bytearrayinputstream( imgurl); bitmap theimage = bitmapfactory.decodestream(imagestream); second approach: image scaling based on height , width private static final string tag_iamge = "image"; private static final int io_buffer_size = 4 * 1024; public static bitmap loadbitmap(string url) { bitmap bitmap = null; inputstream in = n

javascript - Add dynamic data to line chart from mysql database with highcharts -

Image
i want add data point line chart ajax or json, must reload whole webpage show new data on chart. want show live data adding point these link: jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/stock/demo/dynamic-update/ www.highcharts.com/studies/live-server.htm i try retrieve data mysql add on chart json nothing happened. code in live-server-data.php : <?php header("content-type: text/json"); include_once 'include/connection.php'; $db = new db_class(); $query = "select distinct idchip datatable "; $result = mysql_query( $query ); $rows = array(); $count = 0; while( $row = mysql_fetch_array( $result ) ) { $sql1 = "select datetime,temperature `datatable` idchip=".$row['0']." datetime desc limit 0,1 "; $result1 = mysql_query($sql1); while ($rows = mysql_fetch_array($result1)) { $data[] = $rows['1'];

android - How can i implement seek bar to change contrast -

i trying implement seek bar change contrast of image in android. me implement please.there other options image processing ? know solution please me thanks in advance. code: public class mainactivity extends actionbaractivity { imageview imviewandroid; private seekbar seekbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); seekbar = (seekbar) findviewbyid(r.id.seekbar); imviewandroid = (imageview) findviewbyid(r.id.imviewandroid); seekbar.setonseekbarchangelistener(new seekbar.onseekbarchangelistener() { @override public void onprogresschanged(seekbar seekbar, int i, boolean b) { } @override public void onstarttrackingtouch(seekbar seekbar) { imviewandroid.setimagebitmap(takecontrast(bitmapfactory.decoderesource(getresources(), r.drawable.dicom), 10

AngularJS : why button hide after click? -

i trying open menu menu opening on button click .i able show menu option .but facing 1 issue button hide when menu option display.menu should display below button.i need show button menu when user click on button.i need menu should display below button here code http://codepen.io/anon/pen/rpaokj var app = angular.module("ionicapp", ['ionic']); app.directive('custommenu', function () { return { restrict: 'a', scope: { }, link: function (scope, element, attr) { $(element).menu(); } } }) app.controller('cnt', function ($scope) { $scope.ismenuvisible = false; $scope.showmenu = function () { $scope.ismenuvisible = true; } }) the button not hide. try add margin-top: 30px; .menu http://codepen.io/anon/pen/xbdqgn

git revert - How to undo changes in a file after multiple commits in Git? -

i'm working on branch have changed file in several commits , want revert changes file a's state same initial state had when had first created branch. easiest way achieve this? git checkout <sha1_of_commit> file/to/restore revert file state after <sha1_of_commit> commit. if want revert state before commit use git checkout <sha1_of_commit>~1 file/to/restore .

javascript - Undefined key coming -

Image
below code: var xx=[]; xx['1'] ={'a':'bb','c':'dd'} debugger; document.log(xx); when print xx says undefined key https://jsfiddle.net/kjuhpgn2/ can let me know why "undefined" coming instead of "1" key? edit: i got that, should {} instead of [] var xx={}; array indexing start @ 0 . what it's saying have nothing @ index 0 . when set xx[1]=something starting array of size 0 , set length of array 2 , @ index 1 , undefined "filling" position @ index 0. if want store dictionary, don't use array object map: var xx={}; xx['1'] ={'a':'bb','c':'dd'} this way wouldn't create sparse array.

ios - Trouble sorting custom objects in an NSArray numerically -

if i'm trying sort bl_player playerscore property: nsarray *sortedplayers = [players sortedarrayusingcomparator: ^(bl_player *a1, bl_player *a2) { return [a1.playerscore compare:a2.playerscore options:nsnumericsearch]; or nsarray *sortedplayers = [players sortedarrayusingcomparator:^nscomparisonresult(id a, id b) { nsinteger first = [(bl_player *)a playerscore]; nsinteger second = [(bl_player *)b playerscore]; return [first compare:second options:nsnumericsearch]; }]; both of return bad receiver types. what's wrong doing comparisons on ints or nsinteger? try one: nsarray *sortedplayers = [players sortedarrayusingcomparator: ^(bl_player *a1, bl_player *a2) { if (a1.playerscore > a2.playerscore) { return nsorderedascending; } else if (a1.playerscore < a2

php - Remove wordpress action inside class definition function of a theme -

i need in removing action of wordpress within public function of class. want remove old function , want define new function against it. code looks below function hook_link($c){ return apply_filters('hook_link', $c); } class blue_themes { public function blue_themes(){ add_action( 'hook_link', array($this, 'old') ); function old($val){ //want remove action return $val; } } } use function remove old function , add new function . remove_filter('remove function name', 1); add_filter('add function name', 1);

oop - Explain what happened in following code in c# -

is creates 1000 person objects? public class person { public string firstname; public string lastname; } person person; for(int = 0; < 1000; i++) { person = new person(); } the code creates 1000 person objects, keeps reference last-created one. others exist in memory while, unreferenced , unusable , therefore @ point reclaimed garbage collector. (to precise, code given doesn't tell how long last reference alive. if person not referenced @ point other code given, become eligible collection after loop , collected @ time thereafter.)

Sharepoint 2013 - Timer job is not running -

i have server farm configuration 2 web server, 1 app servers , 1 database server. what trying timer job loop through web applications present in server farm , perform action against web-applications. i have timer job provisioned central admin web application , locktype contentdatabse passed parameter, , have scheduled job run every 2 minutes. timer job provisioned feature has farm scope. central admin site hosted on web servers not on app server. my timer job never runs. in central admin, see job scheduled run 2 web servers not app server. in sharepoint app server log see 1 interesting log says "job definition testjob, id 779b3ccf-df47-4c4d-aaea-7b3ae2f6502a has no online instance service microsoft.sharepoint.administration.spwebservice, id db200214-6eb2-4696-bb3b-53cb12119650, ignoring" if stop sharepoint timer service running in app servers timer job runs, after job has run once, if start timer service in app server, job runs every 2 minutes expected. blog

ember.js - Changes to initializers in Ember 1.12.0 -

i using ember cli , have read 1.12.0 release blog entry here: http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_instance-initializers and article: http://emberjs.com/deprecations/v1.x/#toc_deprecate-access-to-instances-in-initializers but although believe have followed instructions correctly still getting following deprecation warning: deprecation: lookupfactory called on registry. initializer api no longer receives container, , should use instanceinitializer objects container. see http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers more details. i have initializer injects service called "ui" , therefore believe application initializer rather instance initializer (though have tried both). initializer code sits under /app/initializers/ui.js , follows: export function initialize(registry, application) { application.inject('route', 'ui', 'service:ui'); application

restore - Restoring git directory while preserving history -

i know can restore removed directory follows git checkout {revision} -- {dir} however, history of files in restored directory gone. seen 'new' files. is there way restore directory while still preserving files' history? git tag originalhead # in case git rebase -i <id of parent of commit deleted file> # change pick edit commit git checkout <id of previous commit> <filename> git commit --amend git rebase --continue git tag -d originalhead i found here

linq - Is AsQueryable method departed in new Mongodb C# driver 2.0rc? -

first of i'm new mongodb. in mongodb c# driver 1.9.x, can take collections queryable asqueryable method this. var db = client.getserver().getdatabase("test"); var col = db.getcollection("video"); var qrlist = col.asqueryable(); i installed new driver 2.0rc , while using it, cannot use asqueryable method because missing. departed or there way accomplish this? (i have included mongodb.driver.linq). var db = client.getdatabase("test"); var col = db.getcollection<contact>("contact"); //getcollection without <t> missing to. var qrlist = col.asqueryable(); // asqueryable missing here. how can entities queryable in new driver, need mongodb gurus. thank you. 19 october update: mongodb 2.1 driver out https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.1.0 it supports linq: linq csharp-935 linq support has been rewritten , targets aggregation fra

.net - Host ASP.NET Application in Amazon Web Service -

i have asp.net c# application , want host in cloud using amazon web service , ms sql 2008 database. should host application in cloud ? suggestion appreciated. guys ... i highly recommend elastic beanstalk new in aws. easy start , gives lot's of managed service. in case: beanstalk support latest iis/c#/.net framework combination . see also: supported .net platforms there visual studio plugin aws has 1-click beanstalk deployment capability. beanstalk supports have rds (aws managed) database. rds supports ms-sql, mysql, oracle. here start: creating , deploying elastic beanstalk applications in .net using aws toolkit visual studio what don't see: out of box solution. can choose between 1 instance , ha setup. can have several (dev,test,prod) systems. easy manage them. follows of aws architectural, security best practices default. personal note: i'm using visual studio + aws plugin + visual studio online + elastic beanstalk current project. works well!

record - Asterisk recording all sound in a call -

i have asterisk, want record sound(tone, ring, pressing number...) in call not conversation between 2 endpoints. is there solution requirement? thanks lot helping me! you can use that exten => _x.,1,mixmonitor(filename_here.wav) exten => _x.,2,dial(sip/something); or other processing recording start after mixmonitor. record all.

rust - Newtype pattern of the combinations of Rc, RefCell and Box -

because don't want type code rc::new(refcell::new(box::new(mytype::new(args...)))) again , again, decided create newtype rcrefbox below: use std::rc::rc; use std::cell::refcell; struct rcrefbox<t>(rc<refcell<box<t>>>); impl<t> rcrefbox<t> { fn new(value: box<t>) -> rcrefbox<t> { rcrefbox(rc::new(refcell::new(value))) } } trait interface {} struct a; impl interface {} fn main() { let iface: rcrefbox<interface> = rcrefbox::new(box::new(a)); } the code doesn't compile errors below: (playpen: http://is.gd/itir8q ) <anon>:19:16: 19:35 error: trait `core::marker::sized` not implemented type `interface` [e0277] <anon>:19 let iface: rcrefbox<interface> = rcrefbox::new(box::new(a)); ^~~~~~~~~~~~~~~~~~~ <anon>:19:16: 19:35 note: `interface` not have constant size known @ compile-time <anon>:19 let iface: rcrefbox<interface> = r

javascript - Jquery preventDefault not working on android 4.4 default browser -

i working angular , jquery based website. have text input field validating array of floating numbers. requirement restrict user entering alphabets, etc. the problem using e.preventdefault() not working in android default browser working in android chrome. i have searched lot unable solution. my sample code :- $('#test').keydown(function (e) { e.stoppropagation(); e.preventdefault(); e.returnvalue = false; e.cancelbubble = true; return false; }); i have tried :- $('#test').keydown(function (e) { if (e.preventdefault) { e.preventdefault(); } else { e.returnvalue = false; } }); working fiddle note:- cannot use keypress event android default browser cannot listen event. i had problem default browser on android. preventdefault didn't me, used .on jquery function. $('#test').on('input',function () { var inputtext = $(this).val(); var resulttext = inpu

c# - I have a scenario I am unable to understand, regarding the session variables -

note:-the question pertains asp.net , c#. i have 3 functions getdatabysearchcriteria. getdata. getgriddata. the first function called when page loaded. second function gets called when user makes change on page , and presses btn (getdata) set session variable holds search criteria data griddata object. third function called second function data griddata object griddata user defined class. later in calling function converted json object used render grid table(jqgrid). problem:- maintain session in order facilitate temporary search criteria holder use when intended user navigates 1 page in same module. in code set session variable when user presses getdata , according current requirement had put hard code changes change data session particular pages. in doing session data automatically changing. unable figure out why. please help. here's code :- [system.web.services.webmethod] public static string getdatabysearchcriteria(int reportid) // called when page loaded {