Posts

Showing posts from May, 2011

Force terminate a WPF application -

this question has answer here: how exit wpf app programmatically? 14 answers i need terminate running wpf application (e.g. wpf.exe). app did override onclosing event doing following protected override void onclosing(canceleventargs e) { e.cancel = true; } i tried "taskkill /f /im wpf.exe" still doesn't terminate it. how can force terminate app? rather doing protected override void onclosing(canceleventargs e) { e.cancel = true; } try void window_closing(system.componentmodel.canceleventargs e) { iclosing context = datacontext iclosing; if (context != null) { e.cancel = !context.onclosing(); } }

python - TypeError: __init__() got an unexpected keyword argument error -

i have 6 tables in sqlite database , i'm trying add new row in 1 of tables using sqlalchemy. here tables: class dsource(base): __tablename__ = 'dsource' source_id = column(integer, primary_key=true) subjects= relationship("subject") class subject(base): __tablename__ = 'subject' subject_id = column(integer, primary_key=true) source_id=column(integer, foreignkey("dsource.source_id"),nullable=false) sequences= relationship("sequence") class sequence(base): __tablename__ = 'sequence' sequence_id = column(integer, primary_key=true) subject_id=column(integer, foreignkey("subject.subject_id"),nullable=false) here code i'm using add new sequence table: engine = create_engine('sqlite:////desktop/emotion_data/test.db',echo=true) session = sessionmaker(bind=engine) session = session() new_sequence=sequence(sequence_id=0,subject_id=1) session.add(new_sequence...

unicode - Why is it that "using anything but a utf-8 decoder...might be insecure" in a URL percent decoding algorithm? -

i implementing url parser , have question w3c url spec (at http://www.w3.org/tr/2014/wd-url-1-20141209/ ) in section "2. percent-encoded bytes" has following algorithm (emphasis added): to percent decode byte sequence input, run these steps: using utf-8 decoder when input contains bytes outside range 0x00 0x7f might insecure , not recommended. let output empty byte sequence. for each byte byte in input, run these steps: if byte not '%', append byte output. otherwise, if byte '%' , next 2 bytes after byte in input not in ranges 0x30 0x39, 0x41 0x46, , 0x61 0x66, append byte output. otherwise, run these substeps: let bytepoint 2 bytes after byte in input, decoded , , interpreted hexadecimal number. append byte value bytepoint output. skip next 2 bytes in input. return output. in original spec, word "decoded" (in bold above) link utf-8 decoding algorithm. assume "utf-8 d...

c++ - Maintaining common source code for 32/64 bit build and use the correct libs -

environment: visual studio 2008 professional we porting our 32 bit windows application 64 bit. our application uses number of microsoft dlls htmlhelp.dll. added import libraries project. now have 32 , 64 bit version of htmlhelp.lib (surprisingly both have same name). why ms gave them same name. how application select right .lib current build platform. looking general guideline handle type of situation. put them in different directories : how use correct unmanaged dll file according cpu architecture? (32 / 64 bits) the setdlldirectory function affects subsequent calls loadlibrary , loadlibraryex functions. disables safe dll search mode while specified directory in search path. after calling setdlldirectory, standard dll search path is: the directory application loaded. directory specified lppathname parameter. system directory. use getsystemdirectory function path of directory. name of directory system32. 16-bit system directory. there no function ...

HTML and CSS progress bar -

i want create progress bar in below image: progress bar - image no idea how create it. would please give me creating progress bar? you can use html5 progress element html <progress max="100" value="80"></progress> css progress { height: 16px; width: 400px; -moz-appearance: none; -webkit-appearance: none; appearance: none; border-radius: 24px; background: #fff; border: solid 2px #e5e5e5; } progress::-webkit-progress-bar { height: 16px; background: #37cc7d; border-radius: 20px; } progress::-webkit-progress-value { height: 16px; background: #37cc7d; border-radius: 20px; } progress::-moz-progress-bar { height: 16px; background: #37cc7d; border-radius: 20px; } major modern browsers run progress element - caniuse demo here

documentation - Collapsible Table of Contents sidebar in Sphinx rtd theme -

i using sphinx document python code, i've opted use built in sphinx_rtd_theme (read docs theme) shown in my documentation purely local, in no way connected internet, looks fine except in demo table of contents(sidebar) expands , collapses when hit [+] or [-] symbols. mine not, expand on first click, subsequent clicks open path index.html folder in windows explorer. double clicking same. question how can prevent behaviour , make table of contents work in demo nicely expandable/collapsible toc. setting in conf.py file? i did read docs sphinx website points themeing options, seem apply classic theme. understanding correctly?

String is not being filled with random chars (C)? -

i'm trying fill string characters string 'reset\0' randomized. reason gives me 1 character back: #define str_len 6 char *inputstring() { char *string[str_len + 1] = {0}; const char *digits = "reset\0"; int i; (i = 0; < str_len; i++) { string[i] = digits[ rand() % 5 + 0 ]; } printf("string: %s\n", string); } prints 1 character 't' or 'e' console. doing wrong? if mean making random permutation of characters, not using source string alphabet, consider fisher–yates shuffle . implementation this: char s[] = "reset"; (size_t = strlen(s) - 1; > 0; i--) { size_t j = rand() % (i + 1); char t = s[i]; s[i] = s[j]; s[j] = t; } printf("%s\n", s); the idea go right left, , on every step swap element @ index i element @ random index j between 0 , i , inclusive.

HighCharts moves screen position on load -

i have 4 highcharts on page, stacked vertically. in each of these charts have buttons change data range , re-load chart. this works fine top two, when chart re-loads on bottom 2 moves screen page, same point. with testing found doesn't matter order charts in, , if click button on top form , scroll down page, moves page same position. it's highcharts has lower limit on page , moves position when chart loaded. i can't find settings within highcharts or on google sort this. i thank in advance help paul it's because chart container height moment gets smaller on chart reload. can fix setting fixed container height.

javascript - how to refactor this multi-nested if else block -

i have kind of multi-nested if-else block. understanding there 'data-driven' approach can eliminate need , trim down code, however, i'm not experienced in large way yet, can me refactor code work in 'data-driven' approach? function (arg1) { if(this.thing[arg1]){ // there valid property arg1 if(this.thing.a){ // there exists 'a' propertie if(this.thing.a.arg1 == arg1){ // property has property same arg1 // if 'a' has number higher 0, avoid doing if(this.thing.a.number > 0){ }else{ // 'a' number 0 or lower, this.thing.a = this.thing[arg1]; this.thing.a.arg1 = arg1; } }else{ // the' a' not arg1 // want use current arg1! // if 'number' lower 1 if(this.thing.a.number > 0){ }else{ // 'a' number 0 or lower, this.thing.a = this.thing[arg1]; this....

node.js - mongodb not responding after save -

i using mongoose express.js project. here article model: var articleschema = new schema({ type: string ,title: string ,content: string ,comments: [{ type: schema.objectid ,ref: 'comment' }] ,replies: [{ type: schema.objectid ,ref: 'reply' }] ,feedbacks: [{ type: schema.objectid ,ref: 'feedback' }] ,meta: { tags: [string] //anything ,apps: [{ store: string //app store, google play, amazon app store ,storeid: string }] ,category: string } , status: string ,statusmeta: { createdby: { type: schema.objectid ,ref: 'user' } ,createddate: date , updatedby: { type: schema.objectid ,ref: 'user' } ,updateddate: date ,deletedby: { type: schema.objectid, ref: ...

javascript - Problems with if-else statements with platform detection -

i tried make somekind of mobile platform detection if-else , then, depending of result, launch 1 function or another. if-else statments, detect mobile platform, works fine, if-else statement, must launch functions desktop (if ismobile = false ) or mobile, return else statement no matter, if ismobile = false or true . doing wrong? var ismobile = false; if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|android|silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.useragent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da...

Pairing html tags using c#? -

trying create html checker using c#, can't figure out how check if 2 html tags correctly paired <body></body> . managed relevant tags dictionary (the closing tags / in front), in order appeared in input. can check opening tags don't close (or vice versa). but can't figure out how check if pairs of tags overlapping. e.g. <body><title></body></title> |____________| |______________| (there many many pairs) to clarify, question pair matching , not else html, thanks! if want match pairs of tags (non-paired tags aside), consider following: go left right, enumerating tags; if see opening tag, put in on stack; if see closing tag, check if corresponding opening tag on top of stack; if yes - pop it, otherwise report error; at end, check if stack empty. let me illustrate idea using brackets instead of tags simplicity. function checks if brackets ()[]{} balanced. static bool checkstring(string s) { ...

php - Matrix select from database -

i'm trying receive informations table , information used divided in groups. know if there way of receiving data in sort of 3d matrix. i'm doing code in php , on oracle sql developer, can in php, appreciate if information came more "organized". example: let's data come out database. $m = array ( array("field1"=>1, "field2"=>'1', "field3"=> somedata), array("field1"=>1, "field2"=>'2', "field3"=> somedata), array("field1"=>2, "field2"=>'3', "field3"=> somedata), array("field1"=>2, "field2"=>'4', "field3"=> somedata), array("field1"=>2, "field2"=>'5', "field3"=> somedata) ); i came out this: $m = array ( array("1" => $m = array ( array("field2"=>'1', "f...

javascript - React mixin used to add multiple subscribes to component -

i trying use mixin subscribe/ unsubscribe messages in component, have below code, can please tell me if there better way rather push each subscription? updated: keep getting error, uncaught typeerror: this.subscribetochannel not function thanks in advance var icon = require('../partials/icon'); var react = require('react'); var postal = require('postal'); var basketchannel = postal.channel("basket"), basketservice = require('../../services/basketservice'), subscriptionsmixin = require('../mixins/subscriptiontochannelsmixin'); var basketlauncher = react.createclass({ mixins: [subscriptionsmixin], render: function() { return ( <button classname="pull-right" onclick={this.props.handleclick}> <icon type="user" /> {this.getpeoplecount()} people </button> ); }, updatebaskettotal: function() { basketservice.getbaskettotal(function(data){ this....

Get data from android app & Uploading it to localhost server -

i new in android app development task upload data localhost server user (fill form & press submit button to) upload.tell if library needed. thanks in advance. are using html page? if normla html page have form fields , submit button. if have, instead, ui , wants upload data remove server there several options: manually using library (okhttp or volley) if want manually: httpurlconnection con = (httpurlconnection) ( new url(url)).openconnection(); con.setrequestmethod("post"); con.setdoinput(true); con.setdooutput(true); con.connect(); con.getoutputstream().write( ("name=" + name).getbytes()); inputstream = con.getinputstream(); byte[] b = new byte[1024]; while ( is.read(b) != -1) buffer.append(new string(b)); con.disconnect(); hope helps you! if wrote post in my blog

java - CMS collector not keeping pace with Old Gen -

Image
on moderately busy production server (50 app threads, 30% cpu utilisation), we're seeing scenario cms collector doesn't keep pace objects promoted old generation. my initial thoughts these objects still referenced, not eligible collection - when old gen fills , prompts serial collection, 5.5 gib of 6 gib recovered. the eden space sized @ 3 gib, , takes around 20-30 seconds fill enough prompt young collection. survivor space usage fluctuates between 800 - 1250 mib, 1.5 gib maximum (each). with objects in old gen eligible collection, , server having plenty of (apparent) resources, don't understand why cms collector isn't keeping on top of old gen size: what cause scenario , there solutions? i'm aware of occupancy fraction, don't understand implications of cmsincrementalsafetyfactor - i've read oracle documentation, don't know "add[ing] conservatism when computing duty cycle" means..? alternatives switching parallel / throughp...

java - native library for attach API not available in this JRE -

i attempting build new project gradle, junit, , jmock. when run build, stack trace: com.heavyweightsoftware.daybook.ws.typecodewstest standard_error java.lang.illegalstateexception: native library attach api not available in jre @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.ru ntestclass(junittestclassexecuter.java:80) @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.ex ecute(junittestclassexecuter.java:49) @ org.gradle.api.internal.tasks.testing.junit.junittestclassprocessor.p rocesstestclass(junittestclassprocessor.java:64) @ org.gradle.api.internal.tasks.testing.suitetestclassprocessor.process testclass(suitetestclassprocessor.java:50) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiond ispatch.java:35) @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiond ispatch.java:24) @ org.gradle.messaging.dispatch.contextclassloaderdispatch.dispat...

bash - New to OSX and commands are never found so I 'export' them. Is there a way to fix it for good? -

i'm new bash , mac (about week) , 3 months programming. i've been running problem ends being in bash profile. like changing environment variables in python commands like path="/applications/postgres.app/contents/versions/9.4/bin:$path” export database_url=“postgresql://localhost/cheese” export app_settings=“config.developmentconfig" or postgres in python work have this export path=/applications/postgres.app/contents/versions/9.3/bin/:$path recently installed virtualenvwrapper , had sudo pip install virtualenvwrapper , running code in bash not find unless did export workon_home=$home/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh so did research , think can permanatly add them 'bash profile'. if case have 2 questions. is there way can avoid having manually add exports in first place. can have commands working right after installing how add them profile. opened .bash_profile.swp , looked intimidating didn't touch because thou...

C++ concept example from "Simplifying the use of concepts" -

i reading bjarne stroustrup's mini-paper "simplifying use of concepts" , came across following snippet (page 9), reproduce below: concept abx<typename t> { void a(t&); void b(t&); }; concept ax<typename t> { void a(t&); }; obviously, every type that’s abx ax , so: template<ax t> void f(t); template<abx t> void f(t t); void h(x x) // x type a(x) valid { f(x); // ambiguous } in other words, in general, have protect against acx ’s [sic] a() being different ax ’s a() . if these 2 a() s can different cannot accept call g(t) above because call “the wrong a() .” i having difficulty understanding example; in particular, don't understand discussion @ end. did bjarne mean abx rather acx ? (where marked [sic]) did bjarne mean x type a(x) , b(x) valid? if a(x) valid, not think template<abx t> void f(t t); should apply, there no ambiguity. i don't know bjarne means when claims 2 a() ...

sql server - query for retrieving information from 3 tables in sql? -

Image
i have 3 tables 1) news_table nid tilte 1 hi 2 hello 2) product_table pid name 2 abc 3 def 4 rty 5 zxc 6 poj 7 lkj 3) temp nid pid 1 2 1 3 1 4 2 5 2 6 2 7 i want output nid pids names title 1 2,3,4 abc,def,rtj hi 2 5,6,7 zxc,poj,lkj hello this full working example run on sql server 2012 : declare @news_table table ( [nid] tinyint ,[title] varchar(8) ); insert @news_table ([nid], [title]) values (1, 'hi') ,(2, 'hellow'); declare @product_table table ( [pid] tinyint ,[name] varchar(8) ); insert @product_table ([pid], [name]) values (2, 'abc') ,(3, 'def') ,(4, 'rty') ,(5, 'zxc') ,(6, 'poj') ,(7, 'lkj'); declare @temp table ( [nid] tinyint ,[pid] tinyint ); insert @temp ([nid], [pi...

How to convert array object to JSON string . IOS 8 . Swift 1.2 -

i got array of object var auditactivitydaylistjson = array<auditactivitydaymodel>() class auditactivitydaymodel : serializable { var daynumber : int var daytype : int var daydatedisplay : string var daydate : string override init() { daynumber = 0 daytype = 0 daydatedisplay = "" daydate = "" } } how can convert json string [{"daytype":1,"daynumber":1,"daydate":"2015-06-30", "daydatedisplay":""},{"daytype":1,"daynumber":2,"daydate":"2015-07-01","daydatedisplay":""}] thanks answer . please help. if want use builtin functions nsjsonserialization ( https://developer.apple.com/library/ios/documentation/foundation/reference/nsjsonserialization_class/ ) need convert objects arrays, dictionaries, strings , numbers in case should work, converting objects dictio...

python - Matplotlib can't render multiple contour plots on Django -

whenever (at least) 2 people try generate contour plot in application, @ least 1 of them receive random error depending on how far first person managed draw.. ("unknown element o", "contourset must in current axes" 2 of possibilities) the following cut down test can produce error, if try load page in 2 or more tabs @ once, first render correctly whilst second produce error. (easiest way found click refresh page button in chrome middle mouse button couple times) views.py def home(request): return render(request, 'home.html', {'chart': _test_chart()}) def _test_chart(): import base64 import cstringio import matplotlib matplotlib.use('agg') matplotlib.mlab import bivariate_normal import matplotlib.pyplot plt import numpy np numpy.core.multiarray import arange delta = 0.5 x = arange(-3.0, 4.001, delta) y = arange(-4.0, 3.001, delta) x, y = np.meshgrid(x, y) z1 = bivariate_norma...

mysql - SQL Server return NULL (or value) in case entry does not exist - Multiple Columns -

i have populated table 'number' pk . query searches specific number, , if not found return "null" not no value. i have managed 1 return: select (select risk_impact [dbo].[rfc] number = 'rfc-018345') however select multiple columns like: select (select risk_impact, risk_impact, bi_testingoutcome [dbo].[rfc] number = 'rfc-018345') however giving me error: "msg 116, level 16, state 1, line 1 1 expression can specified in select list when subquery not introduced exists." can please assist? thank in advance try select p.* (select 1 t ) v left join (select * [dbo].[rfc] number = 'rfc-018345') p on 1=1

php - How to insert multiple rows of student records scores in a while loop in a database table? -

i want create table input fields student records can inserted. name of students in first column of table fetched database while loop. other columns contain fields inputing student scores. challenge i'm facing how insert records of students in different row of table called result_sec database. i've search similar post couldn't suitable answer. below code. in advance. <?php require('header.php'); ?> <?php $query_form = sprintf("select * regform limit 2"); $form = mysqli_query($conn, $query_form) or die(mysqli_error($conn)); $formdata = mysqli_fetch_assoc($form); if(isset($_post['submit'])) { $exes = $_post['exe']; $asss = $_post['ass']; $ca1s = $_post['ca1']; $ca2s = $_post['ca2']; $exams = $_post['exam']; foreach($exes $key => $exe) { $sql = "insert result_sec (exe, ass, ca1, ca2, exam) values ('$exe', '$asss[$key]', '$ca1s[$key]', '$ca2...

javascript - Instagram API redirect uri -

i attempting access token instagram's api having trouble, , believe issue because of redirect uri. i have redirect uri as: http://socialmediasnapshot.net however, user signing in http://socialmediasnapshot.net/instagram.html i tried entering in above address redirect uri, not work. there way make users can authenticate html page? using following code: $.ajax({ url: 'https://instagram.com/oauth/authorize/?client_id=' + client_id + '&redirect_uri=' + redirect_uri + '&response_type=token', datatype: 'jsonp', success: function(req) { alert('yay') alert(json.stringify(req)) }, error: function(req) { alert('boo') alert(json.stringify(req)) } }) according documentation, https://instagram.com/developer/authentication/ note host , path components of redirect uri must match (including trailing slashes) registered redirect_uri. may include additional que...

java - Skipping element in a for loop and reassigning it -

i'm filling parameters in jaspersoft. in report have parameters: parameter_1, parameter_2, parameter_3 int a; (a = 0; < headers.length; a++) { parameters.put("parameter_" + a, headers[a]); } i populating parameters in fashion , works. want add new parameter, parameter_groupby determined index (let's want parameter_2 parameter_groupby) did this: int a; (a = 0; < headers.length; a++) { if (a == groupby) { parameters.put("parameter_groupby", headers[groupby]); continue; } parameters.put("parameter_" + a, headers[a]); } the problem code (assuming groupby value 2) parameter_2 blank want have content of parameter_3 for example parameter_1= name parameter_2= date parameter_3= street what second code bit parameter_1 = name parameter_2= parameter_groupby= date parameter_3= street i want group date (parameter_2) want parameter_1 = name parameter_2= street ...

2 filters with query not working in elasticSearch, java -

this old code working fine qb = querybuilders.querystring(query.replaceall(" ", " or ").replaceall(",", " , ").replaceall("!", " not ")); filterbuilder fb = filterbuilders.andfilter(filterbuilders.rangefilter("experiance").from(smonth).to(emonth)); filteredquerybuilder fqbuilder = querybuilders.filteredquery(qb, fb); org.elasticsearch.action.search.searchresponse searchhits = node.client() .preparesearch(name) .setquery(fqbuilder) in piece of code, searching data experience between smonth , emonth. now need add more filters in search, move 'nativesearchquerybuilder'. after modification, write code:- qb = querybuilders.querystring(query.replaceall(" ", " or ").replaceall(",", " , ").replaceall("!", " not ")); filterbuilder fb = filterbuilders.andfilter(filterbuilders.rangefilter("expe...

machine learning - Advantages of RNN over DNN in prediction -

Image
i going work on problem needs addressed either rnn or deep neural nets. in general, problem predicting financial values. so, because given sequence of financial data input, thought rnn better. on other hand, think if can fit data structure, can train dnn better because training phase easier in dnn rnn. example, last 1 month info , keep 30 inputs , predict 31'th day while using dnn. dont understand advantage of rnn on dnn in perspective. first question proper usage of rnn or dnn in problem. my second questions somehow basic. while training rnn, isnt possible network "confused"? mean, consider following input: 10101111, , our inputs 1 digits 0 or 1 , have 2-sequences (1-0,1-0,1-1,1-1) here after 1, comes 0 several times. , @ end, after 1 comes 1. while training, wouldnt become major problem? is, why system not gets confused while training sequence? thank help i think question phrased bit problematically. first, dnns class of architectures. convolutional ...

Load module from python string without executing code -

i'm trying similar with: load module string in python sometimes read source code provided user: module = imp.new_module('appmodule') exec_(s, module.__dict__) sys.modules['appmodule'] = module return module and import file module = __import__(module_name, fromlist=_fromlist) return module these modules loaded map objects , it'll used inside ide. my problem is: if there method call outside if __name__ == '__main__': code being executed , can interact ide. how can import modules ignoring methods being executed? the process of importing module requires code executed. interpreter creates new namespace , populates executing module's code new namespace global namespace, after can access values (remember def , class statements executable). so maybe have educate users not write modules interact ide?

javascript - Closing a webpage running in a WPF WebBrowser -

first bit of background i'm working on web application, running within webbrowser, within wpf application. this temporary necessity while we're gradually moving functionality web app. long that's not finished, wpf client still needed. wpf client phase out completely. now issue @ hand when user closes client (webpage), webbrowser should catch event , close window child to. i found link describing need: webbrowser , javascript window.close() alas, don't think answer described there still work, it's not possible window.close(), because i'm not 1 opening window i'm running on. browsers have (rightfully) tightened security since then. the question is there way trigger window close client, bubbles wpf? thanks. i have used webbrowser control call methods in wpf application javascript before using webbrowser.invokescript , webbrowser.objectforscripting see msdn article how to: implement two-way communication between dhtml code , cli...

c# - MVC Remote Validation Additional fields naming -

i have remote validation postal code field , country id passed additional field. following code: public jsonresult isvalidpostalcodeforcountry(string companypostalcode, string companycountryid) { //my validation code return json(true, jsonrequestbehavior.allowget); } model: [postalcoderemotevalidation("isvalidpostalcodeforcountry", "common", "", additionalfields = "companycountryid")] [required(errormessageresourcename = "valpostalcoderqrd")] public string companypostalcode { get; set; } [required(errormessageresourcename = "valcountryrqrd")] public int companycountryid { get; set; } can names action parameter , names in model property different? why want this? call same remote validation method different models name of property can different.

mysql - Select users and order them by their article total views -

i have article table stores user id, article id , article views. want users table , order them total article views (sum). see table below. id | user_id | article_id | views 1 2 1 34 2 2 2 6 3 3 3 39 4 3 4 20 i want this. user_id | views 3 59 2 40 i can views of 1 user using select sum(views) articles user_id = 2 , want users , order them total views. add group by clause , order by clause: select user_id, sum(views) sum_of_views articles group user_id order sum(views) desc

javascript - How do I remove an object inside a JSON object in Angular? -

my question goes this. have json object below. want remove object has assignment 1. looped through , best of me cannot seem remove particular object. 0: object teller_id: 1 details: cash assignments: array [2] 0: object <---- remove object , elements indside service_id: 1 status: 1 assignment: 1 1: object service_id: 1 status: 1 assignment: 2 1: object teller_id: 2 details: emp assignments: array [2] 0: object service_id: 2 status: 3 assignment: 4 1: object service_id: 2 status: 4 assignment: 6 remove object assignment of 1 0: object teller_id: 1 details: cash assignments: array [2] 1: object service_id: 1 status: 1 assignment: 2 1: object teller_id: 2 details: emp assignments: array [2] 0: object service_id: 2 status: 3 assignment: 4 1: object service_id: 2 status: 4 assignment: 6 in removes object[0] foun...

r - How to correct - selectizeInput getting displayed above the absolutePanel -

Image
given below code used displaying selectizeinput , absolutepanel . selectizeinput not getting merged page background. displaying above absolutepanel . pls help ui.r library(shinydashboard) shinyui( fluidpage( dashboardpage(skin = c("blue"), dashboardheader(title = "r tools" ), ## sidebar content dashboardsidebar( sidebarmenu( menuitem("dashboard", tabname = "dashboard", icon = icon("dashboard")), menuitem("widgets", tabname = "widgets", icon = icon("th")) ) ), dashboardbody( box( title = "tools", status = "primary", solidheader = true, colla...

sql - Order-dependant multi-row update in Oracle -

i need update row based on input value example : in table data this **lotnumber quantity** 0000001 30 0000002 30 0000003 20 0000004 20 0000005 10 input value -20 then i need fetch latest lot number , update lot number 0000005 0 , 0000004 10 then output be **lotnumber quantity** 0000001 30 0000002 30 0000003 20 0000004 10 0000005 0 thanks in advance. you can combine window functions, ctes , correlated updates achieve this, it's ugly , possibly horribly inefficient. i'm no oracle expert. update data u set quantity=( d ( select lotnumber l , greatest(0,quantity - greatest (0, 20 + quantity - sum(quantity) on (order lotnumber desc))) v data ) select v d u.lotnumber=d.l ); that "20" in middle input value fiddle here: http://sqlfiddle.com/#!4/cce2a

html - Can i use addon code in jquery content script file (Firefox addon sdk)? if yes how? -

i started learning addon-sdk plugin development , stucked in problem. in plugin have used togglebutton , panel now. in panel have loaded html file "myform.html" . when fill form i.e loaded in panel , click submit button, this, ajax request sends post data server , response returns. ajax code in jquery file named "script.js" . now, after receiving response want access current tab page components (eg. form, input type text etc.). when use chrome objects self, panel etc in ajax success function, gives me errors. searched alot rid of error nothing found useful me. tell me if going in wrong direction or missing in it. i doing (script.js) : $(document).ready(function(e) { $('#form').on('submit',function(login){ $.ajax({ ..... ..... success:function(result){ self.port.emit(...); } }); }); }); you can specify 1 or more cont...

java - Used Tapestry template, reverted, but now not referencing actual index.tml file -

i royally messed trying push changes github repository , did weird in intellij. automatically reverted me original tapestry framework boilerplate index.tml page. after reverting older versions, got files original state. so, now, if access app in command line run mvn jetty:run however keep getting error below, not represent file accessing (totally different). how mvn access right file, or intellij/tapestry issue go away. :( thanks! william the solution has been found nice colleague of mine. resolve issue: mvn clean compile jetty:run this solved issues.

android - How to display a substring in a Button -

i have string value called string names; which received ble device. need display substring textview named line2. shows nothing, how can achieve this. my code is. string names; string i=(names.substring(1, 2)); string.valueof(i); line2.settext(i); first try use methods assigned value names variable- string names = "0102151200". if works, there problem in program not assigning value in names variable.

c# - How to avoid the View being disposed -

i'm using contentcontrol im wpf application show different views user. <contentcontrol content="{binding currentpageviewmodel}"/> by pushing button user can switch value of currentpageviewmodel viewmodel object and, of datatemplate , switch view . <datatemplate datatype="{x:type viewmodel:administrationviewmodel}"> <view:administrationview /> </datatemplate> <datatemplate datatype="{x:type viewmodel:healthviewmodel}"> <view:healthview /> </datatemplate> so far good. my problem starts whenever view switched. old view discarded , framework deletes/disposes view object. grid sort settings therefore lost , what's worse, of views values set null. null values propagated viewmodel databinding, totaly messes viewmodel data! how can prevent view object deleted/discarded? simplest powerfull solution control views' life using converter instead of datatemplates: ...

javascript - Cordova Geolocation --- Altitude Not Work -

i using plugin geolocation of cordova , works , except altitude . problem or not possible have value ? plugin code , my: var onsuccess = function (posizione) { alert ('latitudine:' + position.coords.latitude + '\ n' + 'longitude:' + position.coords.longitude + '\ n' + 'altitudine:' + position.coords.altitude + '\ n' + 'precisione:' + position.coords.accuracy + '\ n' + 'altitude precisione:' + position.coords.altitudeaccuracy + '\ n' + 'intestazione:' + position.coords.heading + '\ n' + 'speed:' + position.coords.speed + '\ n' + 'timestamp:' + position.timestamp + '\ n'); }; // onerror callback riceve un oggetto positionerror // funzione onerror (errore) { alert ('codice:' + error.code + '\ n' + 'messaggio:' + error.message + '\ n'); } ...

loops - Python iterate and write to second file -

i trying iterate through tab delimited text file , write rows contain value second text file. attempt below. calling print(line) on original file after line 3 prints correct rows, , same issue 151 message (shown below) when use open & close instead of i'm assuming problem relates way i've used file.write(line). i'm pretty new @ this... with open("file_1.idx", "r") file_1: line in file_1: if "abc" in line: open("file_2.rtf", "w") file_2: file_2.write(line) 151 151 151 you reopen (and overwrite) second file. should work: with open("file_1.idx", "r") file_1, open("file_2.rtf", "w") file_2: line in file_1: if "abc" in line: file_2.write(line)

c# - read an xml file with complex struct asp.net mvc -

i'm beginner on asp.net , want read red data xml file complex structure. works when structures simple. this xml file <flights> <flight> <content>gds</content> <currency>mad</currency> <amount>11777</amount> <duration>02h30m</duration> <stops>0</stops> <officeid>oooo01</officeid> <itineraries> <itinerary> <ref>1</ref> <duration>02h30m</duration> <stops>0</stops> <availableseats>7</availableseats> </itinerary> </itineraries> </flight> </flights> i extract models [serializable] [xmlroot("flights"), xmltype("flights")] public class flights { public string content { get; set; } public string currency { get; set; } public int amount { get; set; } public string ...

python - Combine multiple csv files -

Image
i using q transform csv file: log.csv (file linked). it's format is: datapath,port,rxpkts,rxbytes,rxerror,txpkts,txbytes,txerror 4,1,178,25159,0,40,3148,0 4,2,3,230,0,213,27897,0 4,3,3,230,0,212,27807,0 4,4,4,320,0,211,27717,0 4,5,3,230,0,212,27807,0 4,6,3,230,0,212,27807,0 4,7,4,320,0,211,27717,0 4,8,4,320,0,211,27717,0 4,9,4,320,0,211,27717,0 4,a,4,320,0,211,27717,0 4,b,3,230,0,212,27807,0 4,fffffffe,7,578,0,209,27549,0 3,1,197,26863,0,21,1638,0 3,2,3,230,0,215,28271,0 3,3,5,390,0,215,28271,0 3,4,2,140,0,216,28361,0 3,5,4,320,0,214,28181,0 3,6,3,230,0,215,28271,0 3,fffffffe,7,578,0,212,28013,0 5,1,208,27401,0,6,488,0 5,fffffffe,7,578,0,208,27401,0 2,1,180,24228,0,18,1368,0 2,2,2,140,0,195,25366,0 2,3,2,140,0,195,25366,0 2,4,3,230,0,194,25276,0 2,5,3,230,0,194,25276,0 2,6,2,140,0,195,25366,0 2,fffffffe,7,578,0,191,25018,0 1,1,38,5096,0,182,23602,0 1,2,42,5419,0,179,23369,0 1,3,61,7152,0,159,21546,0 1,4,28,4611,0,192,24087,0 1,5,46,6022,0,174,22676,0 1,fffffffe,7,578,0,214,...

c# - How to Save relation table data using EF6 -

[datacontract] public class commodity { [datamember] [key] public long id { get; set; } [datamember] [datatype(datatype.text)] [stringlength(40)] public string name { get; set; } [datamember] public virtual list<dailyprice> comoditydailyprices { get; set; } [datamember] public virtual list<dailyproduction> commoditydailyproduction { get;set; } } //==========================// [datacontract] public class currency { [datamember] [key] public long id { get; set; } [datamember] [datatype(datatype.text)] [stringlength(10)] public string name { get; set; } [datamember] public virtual list<dailyprice> dailyprices { get; set; } } //==========================// [datacontract] public class dailyprice { [datamember] [key] public long id { get; set; } [datamember] public long commodityid { get; set; } [d...

java - sync between mysql and sql server for multiple users -

i developing android application. have used xampp server making use of mysql.when run app should sync mysql , retreive values , store in sqlite. tries example in link http://programmerguru.com/android-tutorial/how-to-sync-remote-mysql-db-to-sqlite-on-android/ . in same way developed code,but in example in link used has column called syncsts in mysql keep track of sync.but problem sync gets updated when 1 user uses app , status gets updated.again if other user uses app sync not happens. my doubt is i want sync in such way when multiple user use app sync between mysql , sqlite should happen everytime , multiple users should access app.how modify code that. i using localhost here,problem runs emulator when tried real device doesnt work.only when pc , mobile in same network works.i want make multiple users use app different network.how do this.please help my code is mainactivity.java public class mainactivity extends activity implements onclicklistener { textview update,u...