Posts

Showing posts from August, 2011

sql server - SQL Azure raise 40197 error (level 20, state 4, code 9002) -

i have table in sql azure db (s1, 250gb limit) 47.000.000 records (total 3.5gb). tried add new calculated column, after 1 hour of script execution, get: the service has encountered error processing request. please try again. error code 9002 after several tries, same result. script simple table: create table dbo.works ( work_id int not null identity(1,1) constraint pk_works primary key, client_id int null constraint fk_user_works_clients2 references dbo.clients(client_id), login_id int not null constraint fk_user_works_logins2 references dbo.logins(login_id), start_time datetime not null, end_time datetime not null, caption varchar(1000) null) script alter: alter table user_works add delta_secs datediff(second, start_time, end_time) persisted error message: 9002 sql server (local) - error growing transactions log file. but in azure can not manage param. how can change structure in populated tables? azure sql database has 2gb transac

javascript - What's wrong with this treatment of ReactJS properties? -

in code react.createclass() class, have getdefaultprops() method returns dictionary initial_text set text value. getdefaultprops: function() { return { initial_text: "**i *terribly* " + ... then, in render(), try access this.props.initial_text: render: function() { var tokenize = function(original) { var workbench = original; var result = []; while (workbench) { if (workbench[0] === '<') { length = workbench.indexof('>'); if (length > -1) { length = 1; } } else { length = 1; } result.push(workbench.substr(0, length)); workbench = workbench.substr(length);

c - How to create options button with ncurses -

ehlo i c , ncurses on linux creation of installer , kinda new on this. have seen installers linux(especially anaconda) can display windows, buttons "ok""next""back" on link https://hurley.files.wordpress.com/2008/01/snack-popcorn-snapshot.png?w=500 , need information it, have found menu examples not "buttons" call it. greetings. the example shown 1 of slang-based applications such whiptail. anaconda uses python scripts load newt library , run those. far know, there no documentation of (other source code), , longstanding issue, instance comment , , this . whiptail application "like" dialog, simpler. dialog curses-based application can run using shell-scripts (such bash). can find more information dialog on homepage .

sql - Without PIVOT, display data where GROUP BY column are the column names -

i have data looks following: name date hr min amt joe 20150320 08 00 5 joe 20150320 08 15 3 carl 20150320 09 30 1 carl 20150320 09 45 2 ray 20150320 13 00 8 ray 20150320 13 30 6 a simple group [name], [date], [hr] display total hour each salesman. without using pivot or dynamic sql, how can display data hours columns? pivot need detail each hour, if data above data, there 3 columns data (8, 9, 13), , 21 empty columns. the reason want because create ssrs report columns hours. unfortunately, can't use matrix because can't sort column detail (ie. click on "8" , display smallest largest); i've confirmed limitation ms expert. so appreciated. have sql server 2008 r2. thanks. select name ,[date] ,sum(case when hr = '00' amt end) [00] ,sum(case when hr = '01' amt end) [01] ,sum(case when hr = 

c# - How to structure my unit test? -

i new unit test , wondering how start testing. application working on, not have unit test. winform application , interested test data layer of application. here example. public interface icalculatesomething { someoutout1 calculatesomething1(someinput1 input1); someoutout2 calculateosomething2(someinput2 input2); } public class calculatesomething : icalculatesomething { someoutout1 icalculatesomething.calculatesomething1(someinput1 input1) { someoutout1.prop1 = calculatefrominput1(input1.prop1, input1.prop2); someoutout1.prop3 = calculatefrominput2(input1.prop3, input1.prop4); return someoutout1; } someoutout2 icalculatesomething.calculateosomething2(someinput2 input2) { someoutout2.prop1 = calculatefrominput1(input2.prop1, input2.prop2); someoutout2.prop3 = calculatefrominput2(input2.prop3, input2.prop4); return someoutout2; } } i test these 2 methods in calculatesomething. methods impleme

c# - Is there any way to place multiple links in the LinkLabel control in Windows Forms -

is there way place multiple links in linklabel control in windows forms? if set this this.linklabel.text = ""; foreach (string url in urls) { this.linklabel.text += url + environment.newline; } it merges 1 link. thanks in advance. yes, though there isn't way can tell directly designer, easy manage via code: var linklabel = new linklabel(); linklabel.text = "(link 1) , (link 2)"; linklabel.links.add(1, 6, "link data 1"); linklabel.links.add(14, 6, "link data 2"); linklabel.linkclicked += (s, e) => console.writeline(e.link.linkdata); basically, links collection on label can host bunch of links in linklabel . linkclicked event contains reference specific link clicked can access link data associated link, among other things. the designer exposes linkarea property defaults include of text of linklabel . first link add links collection automatically change linkarea property reflect first link in collection.

javascript - Why isnt my slider showing up? -

i'm working on making custom button drops down jquery ui slider beneath it. idea can slide slider , changes background color of button. reason, slider isn't appearing , cant figure out why. <div id="button-container"> <div id="button"> <div id="inner_triangle_button"></div> </div> <div id="slider_container"> <div id="slider_container_triangle"></div> <div id="shadow_slider"></div> </div> </div> <script> $('#button').click(function() { if ( !$('#slider_container').is(":visible") ) $('#slider_container').fadein(100); else $('#slider_container').fadeout(100); }); $(function() { $('.shadow_slider').slider({ min: 0, max: 255, change: updatecolor, slide: updatecolor }); }); function updat

vbscript - VBS Read Variable NAME and Data from file -

i creating script contain variables need set user. created ini file variables can defined user without having mess script itself. need vbs script able read file , create variable based on first part of line , set value of variable based on second part of line. the ini file looks this path=c:\users\whatever filename=whatever.txt filetypes=txt,doc,mp3,etc in batch file, easy, can do: for /f "delims=" %%x in (config.ini) (set "") i love if there equally simple answer in vbs, here have (working) filename = "config.ini" set fso = createobject("scripting.filesystemobject") set f = fso.opentextfile(filename) until f.atendofstream linearray = split(f.readline , "=") select case linearray(0) case "path" path = linearray(1) case "filename" fname = linearray(1) case "filetypes" filetypes = linearray(1) end select loop f.close this

r - How to create legend text elements being different colours in a ggplot? -

i'm trying made text in legend same colour line in ggplot. line female green , male blue text saying female green , male blue. df1 <- data.frame( sex = factor(c("female","female","male","male")), time = factor(c("lunch","dinner","lunch","dinner"), levels=c("lunch","dinner")), total_bill = c(13.53, 16.81, 16.24, 17.42)) ggplot(data=df1, aes(x=time, y=total_bill, group=sex, shape=sex, colour=sex)) + geom_line()+ scale_color_manual("sex",values=c("green", "blue")) test code taken from: http://www.cookbook-r.com/graphs/legends_(ggplot2)/

Rails: manipulate URL query param keys before request hits controller -

i need pass params in url 3rd-party service user#new . due strong parameters controller expecting params in form user[name], user[email]. however, 3rd-party service blocking use of square brackets in param key. what's easiest rails-y way work around this? perhaps in rails router? i'd take email=abc@example.com , convert user[email]=abc@example.com before request gets rejected controller. thoughts? thanks! i think simple, manual solution best. def user_params permitted_params = [:name, :email, :first_name, :last_name] params[:user].reverse_merge!(params.keep_if { |k,v| k.to_sym.in? permitted_params }) params.require(:user).permit(*permitted_params) end if params[:user] nil, can either this: params[:user] ||= {} somewhere before merge. or this: params[:user] = (params[:user] || {}).reverse_merge(params.keep_if { |k,v| k.to_sym.in? permitted_params }

Monogame Window opens in inconvenient location (Visual Studio 2013) -

Image
i working on monogame opengl project in visualstudio 2013 , whenever compile project, window opens down on lower-right hand corner of screen. this extremely annoying, given working on laptop without defined right/left click points on trackpad, computer responds weirdly when try drag back. what causes this? screen resolution issue? how can fix it? set position of gamewindow position property. according current source , work desktop opengl export. it should use similar coordinates in-game positions, (0, 0) @ top-left.

python - Global Variables in Django Admin Site -

this original question, not answered , thought id post again of strategies have tried, , little more specific. i want create dynamic admin site, based on if field blank or not show field. have model has set number of fields, each individual entry not contain of fields in model , want exclude based on if field blank. project bridges, , put in practical terms have model has every bridge part in (this equivalent 100), each individual bridge (mapped each unique brkey) not have 100 bridge parts. , so, can prepopulate of fields have, admin site has 100 other fields, , not display fields not used on admin site specific bridge, fields differ pretty every bridge. like said before, have unique bridge identifier(a unique 15 digit string), correlates each bridge, , of various different variables describe bridge. i have set user go url unique bridgekey , create entry of bridge. (as testing on local machine) localhost/home/ brkey , code in views.py corresponds url is final route ha

javascript - jQuery: Cannot upload file via input click -

an area of page allows users drag , drop files , have upload (for debugging, having console.log filename. trying add ability click on div bring file dialog window can upload file through there. reason, not work. using event.datatransfer.files incorrectly? here jsfiddle code. the important bits are: droparea.addeventlistener('click', handleclick, false); function handleclick(event) { $("#fileupload").trigger('click'); console.log(event.datatransfer.files[0]['name']); } i figured out. per comments, had bind on change event. following solved issue: $("#fileupload").on('change',function(){ //console.log(this.files); processfiles(this.files); }); this.files contains filelist of files

Array includes string ruby? -

how check if array includes string element? address = 'london capital of gb' def get_location(address) all_cities = ['amsterdam','moscow','krakow','london'] city = all_cities.index {|x| x.match /address/ } if city return all_cities[city] else address end end but returns me full address i needs return city's name string use include? to check whether string contains substring . address = 'london capital of gb' def get_location(address) all_cities = ['amsterdam','moscow','krakow','london'] city = all_cities.index { |x| address.include? x } if city return all_cities[city] else address end end puts get_location address # output: london

c++ - Is this true about inheritance? -

regardless of whether public, private or protected inheritance, private members of base class not accessible functions exclusive derived class. this conclusion. correct? related notes appreciated. also, in private inheritance, public members of base class private in derived class new functions of derived class can still access them directly. correct? why not test it? class base { private: int a; }; // private inheritance. class : private base { public: a() { = 0; } }; this gives me: error: 'int base::a' private the type of inheritance not matter when comes ability class access it's base-classes private variables.

tomcat - .properties file read by Java web app disappears -

we've been facing problem time , have no idea what's going on. hope i'm missing obvious. here's situation: we've got bunch of windows computers out there , each 1 of them running apache tomcat. webapps folder of these tomcats contains, among other things, war file java web app ( myapp.war ), directory tree corresponds deployment of web app, , simple folder (not web app deployment) contains .properties file. webapps |--myfolder | `--myfile.properties |--myapp | |--meta-inf | |--web-inf | |--img | ... |--myapp.war ... the myapp application reads file myfile.properties time time. not read often. when should quick operation: open file, read couple properties, close. code clean , simple, file stream should closed in face of exceptions. the myapp application hot redeployed overwriting myapp.war file. finally, computers aren't in friendly environment: suffer power outages or they're not shut down properly. the problem we

sql server - SQL Grouping with a logic check on another column? -

lets have following table: id param result 1 aaa true 1 aaa false 1 aaa false 1 bbb true 1 ccc true 2 aaa true 2 ccc true 3 aaa false 3 aaa false 3 aaa false 3 ccc true 3 bbb true is there way group [param] column [result] show true if of corresponding results true , show false if none true? below example of aiming for: id param result 1 aaa true 1 bbb true 1 ccc true 2 aaa true 2 ccc true 3 aaa false 3 ccc true 3 bbb true here sketch of code work. need put in right constants result : select id, param, (case when sum(case when result = true 1 else 0 end) > 0 true else false end) table t group id, param; sql server not have native boolean type , doesn't understand "true" , "false". representations (such 'true

java - Standard approach to pass data among chain of fragments -

i new android , want understand best way write clean code. have following example: activitya ---> fragmenta (main ui window user sees) then on user's action fragmenta --->starts---> activityb-->fragmentb (the next window user sees , hides previous one) then on user's click: fragmentb---> starts ---> activityc-->fragmentc (the next window user see hides rest) so @ last step user sees layout of framentc. in fragmentc in order populate widgets of layout need data available in fragmenta . what is: pass data extras in intent fragmentb . of these needed fragmentb others not, , passed fragmentb subsequently passed fragmentc via fragmentb (again intent/extra) if user presses button opens fragmentc 's layout question: 1) works wondering if fact pass in extras of intent fragmentb data not need wrong/hack , there better/standard solution 2) when passing data among fragments these data copies or single copy passed arround

SonarQube rule squid:S1200 counts java.* classes in its limit of 20? -

how sonarqube rule squid:s1200: classes should not coupled many other classes (single responsibility principle) count coupling number towards limit of 20? it seems counts classes standard java packages java.lang.* , java.text.* , java.util.* in rule's limit of 20. if use java integer class, i've used 1/20 of rule's limit. additional info: sonarqube version: 4.5.1 the best way answer question directly @ source code of rule : https://github.com/sonarsource/sonar-java/blob/c1f15b81bcd9d643ab403aeea6e1606040f84eac/java-checks/src/main/java/org/sonar/java/checks/classcouplingcheck.java so counts every declared type. , indeed if use java.lang.integer count 1 type 1/20 of rule's limit. the news can configure '20' magical number in quality profile.

content management system - is there any difference in load time for /images/img.jpg vs //domain.com/images/img.jpg vs http://domain.com/images/img.jpg -

we had issue our navigation menu images not using https on otherwise secure contact page (sporadically) , suggested changing path , removing protocol , domain name images load without further issue, since developer working on problem had trouble reproducing it. removed protocol left domain name intact, work, brought question i've been wondering awhile , not being able find definitive answer. question: there difference in load time file path /images/img.jpg vs //domain.com/images/img.jpg vs http://domain.com/images/img.jpg . i'm leaning towards first 1 possibly being faster since might not have domain lookup, don't know, brought me here...

c# - .NET Create struct property getter delegate -

i have method create property getter delegate: private static delegate createpropertygetter(propertyinfo propertyinfo) { methodinfo propertygetter = propertyinfo.getgetmethod(); dynamicmethod dyngetter = new dynamicmethod ( string.concat("dm$member_getter_", propertyinfo.name), propertyinfo.propertytype, new type[1] { propertyinfo.declaringtype }, propertyinfo.declaringtype, true ); ilgenerator ilgen = dyngetter.getilgenerator(); ilgen.emit(opcodes.ldarg_0); ilgen.emitcall(propertyinfo.declaringtype.isvaluetype ? opcodes.call : opcodes.callvirt, propertygetter, null); ilgen.emit(opcodes.ret); return dyngetter.createdelegate(typeof(membergetter<,>

c - How can I pipe a string that the user input? -

i need pipe string that's been split individual arguments. example, cd foo | cat bar.txt has been parsed , stored array char *arr[]; arr = {"cd", "foo", "|", "cat", "bar.txt"} my initial thought traverse array until see pipe , store commands array run it. there way approach this? yon can use awk : str="cd foo | cat bar.txt" command_first= echo $str | awk -f "|" '{print $1}' command_second= echo $str | awk -f "|" '{print $2}' eval $command_first eval $command_second

Calculate D-efficiency of an experimental desgin in R -

i have experimental design. want calculate d-efficiency. thought r package algdesign help. found function optfederov generates design , - if user wants - returns d efficiency. however, don't want use optfederov generate design - have design! tried eval.design(~.,mydesign). metrics gives me are: determinant, a, diagonality, , gmean.variances. maybe there way determinant or d-efficiency (i not mathematician, not sure). or maybe other way calculate d-efficiency "manually" say? thanks lot hint! i working on similar project. found out formula deff = (|x'x|^(1/p))/nd in link . x model matrix, p number of betas in linear model , nd number of runs experiment has. make code , trick. det(t(x)%*%x)^(1/beta)/(numruns) i tested results using jmp project believe correct formula

javascript - Close link not working and opening modal window instead -

i have 'a' tag, when clicked, removes thumbnail gallery calling jquery click event. if dynamically add thumbnail image , remove on same page without refreshing, click event doesn't triggered. triggers modal window pop (as if clicking on image). if press 'x' (to close) modal window triggers jquery click event remove image. works fine on non dynamically added thumbs or if page has been refreshed. $('a.close').click(function () { var imageid = $(this).attr('id'); $.post( '/managespaces/removeimage', { id: imageid } ); $(this).parents('li').remove(); }); <div id="row"> <ul id="sortable"> @foreach (var image in model.images.orderby(i => i.ordering)) { <li id="@image.yogaspaceimageid" class="col-sm-6 col-md-4 imagethumbs" data-yogaspaceid="@model.yogaspaceid"> <div class="t

c - Why is !0 equal to 1 and not -1? -

the following code printf("!%d = %d\n", 0, !0); printf("!%d = %d\n", 1, !1); printf("!%d = %d\n", -1, !-1); gives !0 = 1 !1 = 0 !-1 = 0 now, considering 0 = 0x00000000 , shouldn't !0 = 0xffffffff = -1 (for signed representation)? messes using int / long in bitfield , inverting @ once. what reason behind this? avoid !1 considered boolean true ? the reason in standard c, has been specified operators returning boolean return either 1 or 0. !0 calculates logical not of 0, i.e. 1. logical not of 1 0. what want use bitwise not operator, i.e. ~0 should 0xffffffff == -1 .

python - Django messages refuse to display -

i've been trying display alert whenever user posts invalid comment on site (such blank post). decided use messages framework, doesn't seem work. i've made sure app, middleware, , template context processors correct, , views using requestcontext object. if use {% debug %} in template, can see "messages" variable set, nothing in there. settings.py installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'polls', ) middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddlew

assembly - c++ Assembler File Reading -

i working on sic/xe assembler in c++. how should go reading sic/xe code text file? (label - opcode - operand) copy start 0 first stl retadr ldb #length how getline() adapt 3rd line there no "label"? (tabbed space) you need read line @ time, , parse different components of each line. can check if line starts "whitespace" ( isspace(line[0]) ), in case doesn't have label [assuming rule labels, of course!] (or can, of course, parse individual characters tokens, in same way free-form compiler c/c++ compiler works, since format looks it's rather simple, it' easier read line @ time , reject whole thing suitable error if it's not "right")

Linking Up Google Sheets and Google Calendar -

i trying figure out how work shifts created in google sheet automatically entered each individual employees google calendar. here link test google sheet (accessible link): https://docs.google.com/spreadsheets/d/1ljkwzmhavesba6xrxkwweuizvtfgfakdk9si39on95g/edit?usp=sharing i assume can enter code google script, not programmer, have no clue begin - if possible. here brief description of seeing in google sheet: each person has 2 weeks of shifts run left right. each letter represents different shift, corresponding day @ top. need separate email associated person1, person2, etc. i appreciate help! if have questions @ all, ask! thanks, cory you need permission access these people's calender's. can grant permission when code runs. if user has more 1 calender, , don't want program change/use default calender, you'd need know name of calender want updated. information in spreadsheet need "parsed". basically, need data out of spreadsheet.

tfs - Using features (portfolio backlog) after finished in agile -

in case have feature completed , after time, there's new requirement add value feature, use same feature or new 1 ? example: feature: user registration user stories: visitor want able register web site. visitor want able register web site using facebook. visitor want able register web site using twitter. registered user want able connect account facebook. registered user want able connect account twitter. registered user want able create username , password login. after stories gets implemented, , feature completed, 1 month later, have new requirement registration process. (increasing security, or add additional social login, whatever) should add them finished feature "user registration" or best create new one? i'm using tfs scrum , feature terminology, applies process template you create new one. features , pbi's time limited placeholders desired functionality. 1 done, done. i'd have new functionality not captured , implemented duri

How do I do a "word count" command in Windows Command Prompt -

i know command in unix/linux systems "wc" doesn't work in windows. the closest know of powershell equivalent measure-object.

dictionary - Java map value returns null -

i have kind of strange problem. have simple map called vectors store strategypairs keys , vectors values. when print it, result: {net.softwarepage.facharbeit.normalgame.logic.strategypair@131e56d7=(1.0;2.0), net.softwarepage.facharbeit.normalgame.logic.strategypair@1e1bc985=(2.0;2.0), net.softwarepage.facharbeit.normalgame.logic.strategypair@d5415975=(0.0;2.0), net.softwarepage.facharbeit.normalgame.logic.strategypair@5bf8c6e7=(2.0;1.0)} as can see strategypair@131e56d7 mapped vector (1,2). create new strategypair. when print strategypair@131e56d7 (the same 1 before). however, if call vectors.get(strategypair) returns null. somehow strange key same (at least prints exact same thing out when print it...) the problem arises when rename strategy, e.g. change property name in class "strategy". map contains strategypairs (a wrapper class 2 strategies) messed explained before... edit: when print hashmap still same result above, following code: for(strategypair pair

directx - How do I stretch a sub-region of a ID3D11Texture2D? -

my component given source id3d11texture2d buffer that, of time, copy staging id3d11texture2d buffer using id3d11devicecontext::copyresource . these 2 buffers same size. sometimes, want copy rectangular sub-region of source buffer staging buffer , stretch staging buffer still same size. rectangular sub-region has same aspect ratio source. the staging buffer never used rendering. it's saved media file.

Bootstrap reordering columns on small Devices -

i have simple layout 2 columns in twitter bootstrap. on large devices large colum should on left side , small on right one. when view page on mobile device smaller screen , pages stacked have left colum on top of right one. large devices: ----- colum 1 --- colum 2---- small devices: ----- colum 2 ----- ----- colum 1 ----- my code @ moment following: <div class="row clearfix"> <div class="col-md-9 column"> <div class="col-md-3 column"> </div> if understood correctly, need this: <div class="container"> <div class="row"> <div class="col-xs-12"> <div class="col-md-3 pull-right">field2 - width 3</div> <div class="col-md-9 pull-right">field1 - width 9</div> </div> </div> </div> bootply demo the base approach mobile first . set smallest screen first , apply adju

ruby - Rails belongs_to relationship with multiple possibilities -

i'm trying make relationship model, information , belongs_to either user or client . i thought putting in information.rb belongs_to :user belongs_to :client and in user.rb , client.rb has_one :information but makes information belong_to both user , client . is there way make can belong either or without leaving 1 of fields blank? p.s. if needed i'm using rails 4.2, ruby 2.2.1, , devise account authentication. thanks! this sounds unusual association it's fit polymorphic association . in case, declare name association class information < activerecord::base belongs_to :informational, polymorphic: true #or class user < activerecord::base has_many informations, :informational class client < activerecord::base has_many informations, :informational and need add 2 columns information informational_id, :integer , informational_type, :string and client , user need integer called informational_id indexed.

How to centre a javascript element using inline css? -

i've got javascript code want centring on webpage, if enclose <div align="center"> works perfectly, validator says not valid html5. i've tried changing "margin: 0 auto;" no luck. i've tried using "text-align: center" , doesn't work either. i've added .center {margin: 0 auto}; stylesheet , doesn't work either. just curious why code won't centre correctly using of techniques. my working code follows. <div align="center"> <script type="application/javascript"> var mycountdowntest = new countdown({ month : 5, day : 19, width : 300, height : 50, hideline: true, rangehi :"months"

vba - run-time error '1004': method 'range' of object '_global' failed for method that works error-free in another context -

i have issue following lines giving me run-time error referenced in title, first line of if statement being highlighted culprit: sub setupfirstworksheet() = 0 worksheets(1).usedrange.rows.count if range("h" & i).value = 1010 or range("j" & i).value < 0 or range("k" & i).value = false [some code or blank] end if next end sub however, putting in similar code below, have no issues: sub test() = 0 worksheets(1).usedrange.rows.count next msgbox range("h" & i).value end sub any appreciated. thank you. you starting loop @ 0, means generating range references h0,j0 & k0. these invalid because there no such thing row 0. change loop start @ 1 , okay. the reason test works because msgbox line executed after loop has finished, , equal worksheets(1).usedrange.rows.count . if move msgbox statement loop, find fail.

Swapping CSS with a Click addEventListener in JavaScript -

i having trouble getting click event work on page. have div id of 'icon', , class of 'lock', , want able click on div's background image change class 'lock' 'locked'. before confusion happens, have both classes in external css file, , add background image div. also, don't want use jquery, addeventlistener function. far, js looks like: var ellock = document.getelementbyid('icon'); function changelock(){ var imgswitch = ellock.getattribute('class'); if(imgswitch !== 'unlock'){ ellock.classname = 'unlock'; }else{ ellock.classname('lock'); } } ellock.addeventlistener('click', changelock, false); the desired result in youtube video: https://www.youtube.com/watch?v=oi2srcn7cim any appreciated. love learn mistakes i've made. i use element.classlist property rather you're doing here ... then do: ellock.addeventlistener('click', func

javascript - How to make flat buttons in webix -

Image
as far can tell, webix's default buttons looks this: i saw in demo , however, "flat" type buttons this: how go making navigation buttons that? not see in documentation. the component on screenshoot tree actually. in common case, may use "menu" or "list" { view:"menu", layout:"y", select:true, width:150, data:[ "firts", "second", "third" ]}, http://webix.com/snippet/07fa93b6

Beginner with parallel arrays in python -

i've been stuck program week. i'm trying create program inputs names of salespersons , total sales month in 2 parallel arrays (names , sales) , determine salesperson has greatest sales(max) names = [" "]*3 sales = [0]*3 index = 0 max = 0 k = 0 names[k] = input("enter salesperson's name , monthly sales: (to exit enter * or 0)") sales[k] = int(input("enter monthly sales:")) while (names[k] !="*"): if sales[k] > max : index = k max = sales[index] k = k + 1 print("max sales month: ",max) print("salesperson: ",(names[index])) it doesn't prompt user 3 times name , salary instead asks once , error: enter salesperson's name , monthly sales: (to exit enter * or 0)jon enter monthly sales:3 traceback (most recent call last): file "c:\users\user\downloads\sales.py", line 18, in <module> while (names[k] !="*"): indexerror: list index out of range

C++ Find string of string in list<string>variable name -

in declaration, make list follow list<string> abc; and have saved in it. and want keyword search. int counter = 0; list<string>::iterator it; key = "something" (it = abc.begin(); != abc.end(); it++){ if(*it.find(key) != std::string::npos) counter++; } and gives error " no member named 'find' in std::_1::_list_iterator, void*>'; did mean use -> instead of .? " so changed if(*it->find(key) != std::string::npos) , gives error " indirection requires pointer operand('size_type'(aka 'unsigned long') invalid) " do know problem? also have tried cout type of list " cout << type of (*it) " comes out error... you want first dereference iterator , then call find : if(it->find(key) != std::string::npos) which equivalent to: if((*it).find(key) != std::string::npos) what wrote first, *it.find(key) , parsed compiler *(it.find(key)) , i.e. first call

multithreading - Processing multiple files concurrently in c++ -

i working on vc6 project run on multicore processor pc. require process large number of files. going use multiple threads process them. need experts' advice go ahead. knowledge case of data parallelism. plot this. description of files := file structure same names arbitrary. size of around 100 kb each. file number few hundreds few thousands. each file processed same way. for each file, i read hdd -> process -> write hdd saving may in same file or may different folder same name ( not decided ignore ) i thinking use multiple threads process files. 1 file processed per core. (i know file processing,thread creation, getting number of cores) doubt 1. now given 1500 files , 2/4/8 cores how should divide files (appox.) equally among multiple threads, each file gets processed once. doubt 2. have 1 hdd i/o how many threads create. one thread doing both input , output or 2 threads, 1 reading , 1 writing. thank in advance kanade unless dat

Crystal Reports Pie Chart - How to show 0 values in legend -

Image
i creating pie charts in crystal reports show number of grades awarded student in various tests throughout year. student can awarded grade 5, 4, 3, 2 or 1 only. here example of pie chart 1 student. this student did 5 assessment points in class shown in 2014. got grade 5 1 assessment, grade 4 3 assessments , 1 grade 3 assessment. is there way, in legend, of showing colours used grades 2 or 1 , showing them 0%. is, how can show 5 grades in legend, and, if student hasn't received grade, still shows in legend count of 0 , 0% next it? any appreciated.

dataset - How to generate multidimensional data with specific clustering properties? -

in section 5.a of research paper researcher used following synthetic datasets: gauss consisted of 6 gaussian clusters identity covariance, each 500 points in 5 dimensions. means randomly assigned value 0 10 in each dimension. cluster means required @ least 4 euclidean distance apart, , points required within 2 euclidean distance of cluster mean. paired consisted of 3 pairs of gaussian clusters identity covariance, each 500 points in 5 dimensions. each pair of gaussians placed around mean randomly assigned value in each dimension 0 20 such euclidean distance between paired gaussian clusters between 4 , eight, , euclidean distance between non-paired gaussians @ least 12. additionally, points required within 2 euclidean distance of cluster mean. elong consisted of 5 gaussian clusters identity covariance, each 300 points in 5 dimensions. means randomly assigned value 0 50 in each dimension. create elongated clusters in different dimensions, multiplied values of single, distinct di

java - Underlying object and underlying implementation -

what terms "underlying object" , "underlying implementation" mean? (english not native language). by underlying object, meant object going put map going same. by underlying implementation means, using map interface, inject hashmap or treemap or other map long implements map using runtime polymorphism , making code loosely coupled , designing contract rather implementation.

ios - Xcode IB auto sizing? -

Image
everything looks fine in ib. when run app using iphone5/iphone6/ipad sims, it's mangled. in ib: in iphone6 sim: in above sim, buttons cut. textfield , textview cut. tf & tv, aligned center trail off edges on both sides. i have buttons width set editor > pin > widths equally the title label set horizontal center in container constraint the textfield , textview have horizontal center in container and editor > pin > width is there way fix this? -- edit -- after few tries constraints, looks have working except 2 buttons. current listing of constraints: as suggested others, should consider using auto-layout feature if plan on constructing views using ib. here tutorial links: raywenderlich.com part one youtube video 1 covers bit of size clases hope help. updated: i've read updated post, need add width , height constraints. view see in ib right 600 600 points, , simulator 1 smaller,

scala - Mapping over a JSON array with Argonaut -

i'm having hard time slogging through argonaut documentation, figured i'd ask simple example. val input = """{"a":[{"b":4},{"b":5}]}""" val output = ??? // desired value: list(4, 5) i can cursor down array: parse.parse(input).map((jobjectpl >=> jsonobjectpl("a") >=> jarraypl)(_)) // scalaz.\/[string,option[scalaz.indexedstore[argonaut.argonaut.jsonarray, // argonaut.argonaut.jsonarray,argonaut.json]]] = // \/-(some(indexedstoret((<function1>,list({"b":4}, {"b":5}))))) but what? on right track? should using cursors this? edit - here's progress, guess. i've written decoder list: parse.parse("""[{"b": 4}, {"b": 5}]""") .map(_.as(ilistdecodejson(decodejson(_.downfield("b").as[int])))) // scalaz.\/[string,argonaut.decoderesult[scalaz.ilist[int]]] = // \/-(decoderesult(\/-([4,5]))) edit -

zend framework2 - can't get Container's value in Zend2 -

actually storing on value in container in index action fetching value in same action not able fetch value in action of same controller in controller...am missing something? this code.. indexcontroller class indexcontroller extends abstractactioncontroller { public function indexaction() { $session=new container('temp'); $session->username="bhavik"; error_log("in index controller value=$session->username"); return new viewmodel(); } public function welcomeaction() { $session = new container('temp'); error_log("in index controller welcome action value==".$session->username); $username = $session->username; return new viewmodel(); } } this configuration in module.php public function initsession($config) { $sessionconfig = new sessionconfig(); $sessionconfig->setoptions($config); $sessionmanager = new sessionmanager($sessionconfig); $sessionmanager->start(); cont

asp.net mvc - Remove / Delete a dynamically created partial view mvc -

i trying add remove/delete dynamically created partial view. add script. $("#btnadd").on('click', function () { $.ajax({ async: false, url: '/employees/add' }).success(function (partialview) { $('#addschedule').append("<tbody>" + partialview + "</tbody>"); }); }); this add controller public actionresult add() { var schedviewmodel = new facultyschedviewmodel(); return partialview("~/views/employees/_dynamicview.cshtml", schedviewmodel); } this partial view _dynamicview.cshtml @using(html.begincollectionitem("new")){ <td> @html.actionlink("delete", "deletethis", "mycontroller", null) </td> <td> @html.editorfor(model => @model.schedule, new { htmlattributes = new { @class = "form-control" } }) </td> } what can't figu

java - Parallelize a collection with Spark -

i'm trying parallelize collection spark , example in documentation doesn't seem work: list<integer> data = arrays.aslist(1, 2, 3, 4, 5); javardd<integer> distdata = sc.parallelize(data); i'm creating list of labeledpoint s records each of contain data points ( double[] ) , label (defaulted: true/false). public list<labeledpoint> createlabeledpoints(list<esrecord> records) { list<labeledpoint> points = new arraylist<>(); (esrecord rec : records) { points.add(new labeledpoint( rec.defaulted ? 1.0 : 0.0, vectors.dense(rec.todatapoints()))); } return points; } public void test(list<esrecord> records) { sparkconf conf = new sparkconf().setappname("svm classifier example"); sparkcontext sc = new sparkcontext(conf); list<labeledpoint> points = createlabeledpoints(records); javardd<labeledpoint> data = sc.parallelize(points); ... } the

c++ - How to receive the signal from child -

write program creates child process using fork (). child prints parent’s name, parent id , own id while parent waits signal child process. parent sets alarm 10 seconds after child termination. the below code not receive alarm signal child , not go in alarm handler i.e. ding function. what should do? using namespace std; static int alarm_fired = 0; void ding(int sig) { sleep(10); cout<<"alarm\n"; } int main() { int cpid,i,ppid; int status = 0; cpid=fork(); switch(cpid) { case -1: cout<<"error"; break; case 0: cout<<"child block"<<endl; cout<<"parent\n"<<"parentid: "<<getppid()<<"\nchildid: "<<getpid(); kill(getppid(), sigalrm); default: cout<<"parent waiting"<<endl; wait(&status); cout<<"parent waiting finished"<<endl; signal(siga

ajax - When using @response and @request for json, I meet with some problems -

logincontroller.java: @controller @requestmapping("/user") public class logincontroller { @requestmapping(value="receive", method=requestmethod.post, consumes="application/json") @responsebody public reginfo receivedata(@requestbody reginfo info){// system.out.println("come here"); system.out.println(info.getrealname()); return info; } } register.xml: $("#sub").click(function(){ var m = { "realname": $("#real_name").val(), "phonenumber": $("#phone_number").val() }; $.ajax({ type:"post", url:"/demo/user/receive", data:m, datatype:"json", contenttype:"application/json; charset=utf-8", async:false, success:function(data){ alert("nihao"); }, erroe:function(data){

javascript - multichart line d3.js transform json -

i have diagram: http://bl.ocks.org/mbostock/3884955 , want change file .tsv .json i change method : d3.json("data2.json", function(error, data) { color.domain(d3.keys(data[0]).filter(function(key) { return key !== "date"; }); and change date format format json this file example json: [ {"date": 20111001, "new york": 63.4 }, {"date": 20111002, "new york": 58.0 }, {"date": "20111003", "new york": 53.3 } ] but now, dont show diagram. problem?? need change other method? if json data correctly formatted , evaluates same data structure tsv data, shouldn't need make other change.

sql server - Set Transaction Isolation Level Disappears From table-valued function T-SQL In Management Studio -

i have table-valued function added: set transaction isolation level read uncommitted; and executed alter function. however, when open said tvf in management studio again, above line not appear, has been removed. design or doing wrong? here table-valued function i'm trying save above isolation level. use [playerspace] go set transaction isolation level read uncommitted /****** object: userdefinedfunction [dbo].[udf_get_games_by_date_league_id_group_id] script date: 3/21/2015 8:59:32 ******/ set ansi_nulls off go set quoted_identifier off go alter function [dbo].[udf_get_games_by_date_league_id_group_id] (@league_id int, @group_id int, @division_id int, @tournament_division_id int, @season_id int, @date1 datetime, @date2 datetime) returns table return events_by_date_cte (event_type, str_event_address, str_event_title, str_event_description, str_event_location, f_score_set_by, int_game_status, f_home_team_id, f_group_id, f_visitor_team_id,

matlab - Changing colorbar numbers -

i have dataset has scatter3 plot matrix colourspace ranging between -2.5 , 0. blue part of colourspace associated values lower therefore -2.5. ok. i able edit colorbar can change value associated ends of colourbar manually. on figure can set -2.5 0 , 0 2.5. changes need cosmetic only. is there way of doing using caxis command? thanks! here example in same kind, set cbtics ("-2.5" -2.5, "-1.5" -1.5, "0" 0, "1.5" 1.5, "2.5" 2.5) set palette defined (-2.5 "color1", -1.5 "color1", -1.5 "color2", 0 "color2", 0 "color3", ...) plot data note:- each color repeat twice 1 starting , ending.

How do I group documents in elasticsearch by a single field? -

if have bunch of documents in elaticsearch want returned grouped 1 field of document, how do it? need consistently return fixed number of results (using set maxresults) for example if have bunch of documents each document representing person , fields of document containing attributes of person. let's each person has city field in document. query elasticsearch in way return 50 results grouped city. 50 results want know how possible return 50 cities mapped people in cities. i found implementation in: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html but want apply pagination these results well. dont see setoffset , setlimit possibility in es. ideas? how possible return 50 cities mapped people in cities. query looking looks this: curl -xget 'http://localhost:9200/users/user/_search?pretty' -d '{ "aggs": { "users-by-city": { "terms

python - Why does appending a list to itself show [...] when printed? -

when appended list in using following code. a = [1, 2, 3, 4] print a.append(a) print i expecting output be... [1, 2, 3, 4] [1, 2, 3, 4, [1, 2, 3, 4]] but this... [1, 2, 3, 4] [1, 2, 3, 4, [...]] why? you adding a a itself. second element of a a only. so, if tries print a , wanted it print first element [1, 2, 3, 4] it print second element, a it print first element [1, 2, 3, 4] it print second element, a it print first element [1, 2, 3, 4] it print second element, a ... you see how going, right? doing infinitely. when there circular reference this, python represent ellipsis within pair of square brackets, [...] , only. if want insert copy of a is, can use slicing create new list, this >>> = [1, 2, 3, 4] >>> a.append(a[:]) >>> [1, 2, 3, 4, [1, 2, 3, 4]]

networking - Capturing windows XP localhost TCP traffic -

i have done fair amount of reading on subject - capturing windows xp localhost tcp traffic. there seem couple of methods: 1/using rawcap.exe wont work windows xp handles localhost not through normal network stack 2/using tool socketsniff @ winsock calls particular process (i may try this) 3/using proxocket dlls output cap file winsock traffic particular application (may not work depending on version of application or version of windows. 4/wireshark wont work in scenario same kind of reason rawcap.exe wont work i have read in detail article on wireshark https://wiki.wireshark.org/capturesetup/loopback , question references section: so let's decide install windows loopback adapter. next need : 1. go ms loopback adapter properties, set ip 10.0.0.10, mask 255.255.255.0 2. ipconfig /all , @ mac-id new adapter. 3. arp -s 10.0.0.10 <mac-id> 4. route add 10.0.0.10 10.0.0.10 mask 255.255.255.255 5. test: "telnet 10.0.0.10" now there things dont und

chome devtools 'go to member' shortcut overriden by bookmark manager -

any idea on how force chrome devtools - sources - ' go member ' ctrl+shift+o take preference on bookmark manager? chrome version [41.0.2272.101 m] on windows 8.1 the go member shortcut works when have javascript file open already.

git - Rails : why is there .keep file in every directory -

this question has answer here: random 'concerns' folders , '.keep' files 3 answers i see .keep file in every directory in rails skeleton. file for? significance? this not rails actually, git. git doesn't track "empty" directories, so, directories eg. "/logs" wouldn't end in repository. having .keep in it, makes directory tracked.

Why won't my game pause when an iAd is tapped on in Swift? -

what doing wrong? i'm trying game pause when ad tapped on still working in background. how pause? tried other ways pause scene it's not working me. func didloadad(banner: adbannerview) { adbannerview.hidden = false } func bannerviewwillloadad(banner: adbannerview!) { println("ad load") } func bannerviewdidloadad(banner: adbannerview!) { adbannerview.center = cgpoint(x: adbannerview.center.x, y: view.bounds.size.height - view.bounds.size.height + adbannerview.frame.size.height / 2) adbannerview.hidden = false println("displaying ad") } func bannerviewactiondidfinish(banner: adbannerview!) { /* un-pause when ad closed */ if let scene = gamescene.unarchivefromfile("gamescene") as? gamescene { let skview = self.view skview skview.paused = false println("close ad") } } func bannerviewactionsh

android - Non-Lollipop Material Flat Buttons -

Image
i want material style flat buttons systems before lollipop. i'm using android 4.4.4 , play store looks following: the buttons , icons neatly arranged in apps, games, books. the more button shows buttons button without icon. so how do cute buttons this, glow when clicked, have icon neatly arranged there, , have little rounded corners. using drawableleft doesn't work because icons big. i'm guessing there's way put style sheet, because google seems quite consistently across other apps. button without icon <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/sign_up" android:background="@drawable/action_button" android:textcolor="@color/primary_text" android:textappearance="?android:attr/textappearancemedium" android:layout_marginright="5dp" android:id="@+id/fl_btn_signup" /> in drawable can use action_button.xml