Posts

Showing posts from March, 2013

javascript - What's a bad practice with refs in React? -

i'm getting learn react. guys of different sites tells using refs bad practice (yep, using them @ all). what's real deal it? bad attach to, example, child component (so can access inner stuff)? thanks! react requires think react way , refs kind of backdoor dom never need use. simplify drastically, react way of thinking once state changes, re-render all components of ui depend on state. react take care of making sure right bits of dom updated, making whole thing efficient , hiding dom (kinda). for example, if component hosts htmlinputelement, in react you'll wire event handler track changes input element. whenever user types character, event handler fire , in handler you'll update state new value of input element. change state triggers hosting component re-render itself, including input element new value. here's mean import react 'react'; import reactdom 'react-dom'; class example extends react.component { s...

c# - How do I create a datagrid with a string field and a combobox in one of the columns -

i have created wpf application , calling window display database table fieldnames. using datagrid display field names. second column of datagrid combobox items "include" , "exclude". know how datagrid , display field names. cannot figure out how this. not know go here. my xml far looks this: <datagrid headersvisibility="column" isreadonly="true" itemssource="{binding}" name="dtgrid" loaded="gridloaded" width="283" horizontalalignment="left" verticalalignment="top" height="365" margin="54,74,0,0" borderthickness="1" borderbrush="black"> <datagrid.columns> <datagridtextcolumn x:name="fieldname" header="field name" width="180" /> <datagridcomboboxcolumn x:name="comboboxcolumn" width="83" header="include field" selecteditembindi...

php - Laravel Collection keys modification -

i use filter method collection class remove objects collection. after operation, objects keys eg. 1, 4, 5 left. have elements order 0, 1, 2, 3 etc. after filter action. is there elegant way without rewriting table new one? thanks! you can use laravel collection's values() method make the keys of collection in serialized order this: // demonstration $collection = collect([ 10 => ['fruit' => 'apple', 'price' => 200], 11 => ['fruit' => 'mango', 'price' => 500] ]); $values = $collection->values(); $values->all(); /* result be: [ 0 => ['fruit' => 'apple', 'price' => 200], 1 => ['fruit' => 'mango', 'price' => 500], ] */ hope helps!

c# - Center drawn Ellipse origin -

i'm trying make simple animation circle expanding , fading away, problem have is expanding top left , want expand center, iv'e tried setting rendertransformorigin (0.5, 0.5) still don't works. this code: ellipse impact = new ellipse(); impact.width = 50; impact.height = 50; impact.strokethickness = 1.5f; impact.rendertransformorigin = new point(0.5, 0.5); maincanvas.children.add(impact); storyboard story = new storyboard(); doubleanimation anim = new doubleanimation(0, 60, timespan.fromseconds(0.9)); doubleanimation anim2 = new doubleanimation(0, 60, timespan.fromseconds(0.9)); doubleanimation anim3 = new doubleanimation(1, 0, timespan.fromseconds(0.9)); storyboard.settargetproperty(anim, new propertypath("(ellipse.height)")); storyboard.settargetproperty(anim2, new propertypath("(ellipse.width)")); storyboard.settargetproperty(anim3, new propertypath("(ellipse.opacity)")); story.children.add(anim); story.children.add(anim2...

string - Pointer and integer comparison warning C -

with –l largest , –s smallest number, if user enters invalid option, program should display error message. have code functioning. the current error comparison of pointer , integer within first , second if() statements. #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *numbers[]) { //variables needed int i,temp,max,min; //find largest (-1) if (!(strcmp(numbers[1],"-1"))) { max = atoi(numbers[2]); (i=2;i<argc;i++) { if(numbers[i] >= 'a' && numbers[i] <= 'z') { printf("bad input"); } else if(numbers[i] >= 'a' && numbers[i] <= 'z') { printf("bad input"); } else ...

Why bgez and bltz have the same function code in MIPS -

bgez , bltz have same function code in mips:000001, classified rt filed.however,bgtz , blez have different function code.why designer that? there many opcodes can encode 6 bits. in cases more 1 instruction use same opcode, , additional bits in instruction word used determine instruction. or mips32™ architecture programmers volume i: introduction mips32™ architecture puts it: opcode values not specify instruction instead specify instruction class. instructions within class further specified values in other fields. they list instruction classes , other relevant fields in section a.2 instruction bit encoding tables . you'll see e.g. opcode 000001 instruction class regimm , , instruction within class determined bits 20..16 according table (bits 20..19 on left, bits 18..16 on top): 000 001 010 011 100 101 110 111 0 00 bltz bgez bltzl bgezl * * * * 1 01 tgei tgeiu tlti tltiu teqi * tnei * 2 ...

python - Send message to web skype group via a Guest account -

i'm working on guest account bot joinable skype url's. example (join.skype.com/xxxxxxxxxxxxxxxx) i can connect chat using post request, can't post message group. can see here: http://prntscr.com/d6k5e6 connects, when try send messsage, returns 403. msgid = int(time.time()*1000) url3 = "https://client-s.gateway.messenger.live.com/v1/users/me/conversations/" + identifier + "/messages" headers3 = {'user-agent': 'mozilla/5.0 (windows nt 6.1; wow64; rv:40.0) gecko/20100101 firefox/40.1', 'content-type': 'application/json', 'host': 'client-s.gateway.messenger.live.com', 'accept': 'application/json, text/javascript', 'accept-language': 'en-us,en;q=0.5', 'accept-encoding': 'gzip, deflate, br', 'clientinfo': 'os=windows; osver=7; proc=win32; lcid=en-us; devicetype=1; country=n/a; clientname=skype.com; clientver=908/1.67.0.38//skype...

javascript - How to construct the code for the selection sort method -

i'm having trouble constructing line(s) of code selection sort method. under select() function sort random numbers outputted in id="demo" using selection method. i've tried think of code consist of in order so, after several failed attempts decided come here. explicit code welcome :), explanation accompanied w/ code me conceptualize going on! <input id="input1" type="number" min="10" max="100" onchange="first(); sortbutton();"> <p id="demo"></p> <!-- button appears here, once value entered input field --> <p id="buttons1" onclick="select();"></p> <p id="demo2"></p> <script> // once input1 value changes outputs random value less n (value of input1) n times, dumps out random numbers in id="demo" var arr = []; function first() { var n = document.getelementbyid("input1").value; while(arr.leng...

amazon web services - Django debug toolbar crashes when deployed on AWS Elastic Beanstalk -

i running django app on aws elastic beanstalk django debug toolbar causing following error: traceback (most recent call last): file "/opt/python/run/venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 235, in get_response response = middleware_method(request, response) file "/opt/python/run/venv/lib/python3.4/site-packages/debug_toolbar/middleware.py", line 123, in process_response response.content = insert_before.join(bits) file "/opt/python/run/venv/lib/python3.4/site-packages/django/http/response.py", line 315, in content value = self.make_bytes(value) file "/opt/python/run/venv/lib/python3.4/site-packages/django/http/response.py", line 235, in make_bytes return bytes(value.encode(self.charset)) unicodeencodeerror: 'utf-8' codec can't encode character '\\udcc3' in position 142917: surrogates not allowed i did not have problem locally or whe...

c++ - Cannot install Code::Blocks IDE on Debian 8 Jesse -

Image
i trying install codeblocks 16.01 on 64 bit debian jessie. reason cannot. downloaded file codeblocks_16.01_amd64_jessie.tar.xz codeblocks download page . inside file there many .deb files - i have tried install both amd64.deb , common_16.01_all.deb graphically right-click -> open -> package install when try not work. window pops saying "failed instal files: unspecified transaction error has occured. more information available in detailed report." if knew find detailed report paste here. helpful. something different happens when try install codeblocks-common_16.01_all.deb graphically. password prompted "installing packages" loading bar window appears. window disappears. when go program finder launch codeblocks there no icon launch program. assume means program not installed. any other .deb files same thing amd64.deb - "an unspecified transaction error has occured." i installing ide. maybe have install package in folder? downloa...

java - Fibonacci Numbers Array & another copy of Array whose elements are divisible by 2 (Euler Prob 2), swapping out null elements -

this program finds fibonacci numbers , set of fibonacci numbers divisible 2. problem code: i'm unable remove 2nd array's elements, namely contain zeroes or null. for example, following sample output has zeroes not qualify fibinacci nos. divisible 2 (i.e., under call of euler 2 problem): fib nos div 2 except 0s: 0 2 0 0 8 0 0 34 0 0 144 0 0 610 0 0 2584 0 0 0 output should be: 2 8 34 144 610 2584 and code: import java.util.scanner; public class fibonacci_arrays { public static void main(string[] args) { int limit = 0; scanner scan = new scanner(system.in); //number of elements generate in series system.out.println("enter how many fibonacci numbers generate: " + "\n"); limit = scan.nextint(); long[] series = new long[limit]; //contains of fib nos. limit specified. //create first 2 series elements series[0]...

swift - tests not working in vapor app -

i've been unable tests working in vapor app. seems linker doesn't find of app classes being tested. narrow problem down, i've tried creating simplest test possible using default app template. steps shown below. if can either tell me i'm doing wrong, or can replicate issue, i'd grateful. create new project. $ vapor new foo cloning template [done] $ cd foo $ mkdir -p tests/modeltests add dummy test references class in default project. $ cat > tests/modeltests/posttests.swift import xctest @testable import app class posttests: xctestcase { func testpost() { print(post.self) xctassertequal("a", "a") } } ^d build project. $ vapor build no packages folder, fetch may take while... fetching dependencies [done] building project [done] run tests. $ vapor test testing [failed] log: swift-test: error: no tests found execute, create module in `tests' directory oops, seems need remove "tests"...

Tensorflow 'IndexedSlices' object has no attribute 'get_shape' during backprop through while_loop -

i'm experimenting writing own dynamic_rnn() function. i'm getting following error when initialising model: attributeerror: 'indexedslices' object has no attribute 'get_shape' it's calculating gradients. here full stack trace (nb. happens if remove gradient clip - moves optimizer). attributeerror traceback (most recent call last) <ipython-input-8-c4ed7a228363> in <module>() ----> 1 model = model(args) <ipython-input-5-2ab152ab1152> in __init__(self, args, infer) 58 59 tvars = tf.trainable_variables() ---> 60 grads, _ = tf.clip_by_global_norm(tf.gradients(self.cost, tvars), 61 args.grad_clip) 62 optimizer = tf.train.adamoptimizer(self.lr) # tf.train.gradientdescentoptimizer(self.lr) # /usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gradients.pyc in gradients(ys, xs, grad_ys, name, colocate_gradients_with_ops, gate_gradients,...

ios - UIView animation causing label to twitch -

i have iconview class use custom image google maps marker. of print statements show code correctly executing. however, "12:08" uilabel in circleview keeps on growing , shrinking (i.e. twitching). can't figure out problem might be. i've tried manually setting the font in completion block, commenting out adjustsfontsizetofitwidth , changing circleview uibutton . import uikit class iconview: uiview { var timelabel: uilabel! var circleview: uiview! var clicked: bool! //constants let circleviewwidth = 50.0 let circleviewheight = 50.0 override init(frame:cgrect) { super.init(frame : frame) self.backgroundcolor = uicolor(red: 47/255, green: 49/255, blue: 53/255, alpha: 0.0) clicked = false if !clicked { //main circle print("init circle view") circleview = uiview(frame: cgrect(x:0, y:0, width:circleviewwidth, height:circleviewheight)) circleview.backgroundco...

Rstudio - How to show plot output in bottom right pane? -

Image
i used qplot, instead of plot showing in plots tab on bottom right, decides show in top left. how move outputs bottom right pane? i have version 1.0.44 of rstudio on mac - using rmarkdown, which, default in recent versions, causes output shown inline within markdown page. to undo behavior, open rstudio->preferences, , select r markdown group on left. uncheck box says "show output inline r markdown documents".

How to enable support for Jumbo size Ethernet frame in Linux? -

in order support send , receive jumbo isis control packet, need enable jumbo size ethernet handling in linux. for tcp, set below variables in /proc/sys/net/ipv4 tcp_mtu_probing (set 1 or 2, instead of deafult 0) tcp_base_mss (default 512, change per requirement). how enable same base ethernet packet. thanks

c - Makefile Executable Error -

i have following makefile: all: test.c test1.c gcc -o test test.c -lm gcc -o test1 test1.c ./test 1000 input.txt i getting error ./test 1000 input.txt make: *** [run] error 255 . makefile correct? ./test 1000 input.txt make: *** [run] error 255 this doesn't mean wrong makefile. means ./test program ran exited status 255. you haven't showed test.c , i'm assuming didn't write return 255; . since exit status 8 bits, it's possible (incorrectly) wrote return -1 . it's possible (incorrectly) omitted return statement main leads undefined behavior, , -1 happens in return value register ( eax on x86). you should always enable compiler warnings. force correct them, these warnings (which indicate broken code) should cause compilation fail well. cflags = -wall -wextra -werror test: test.c $(cc) $(cflags) -o $@ $^

web scraping - how to use python requests to login to website -

Image
im trying login , scrape job site , send me notification when ever key words found.i think have correctly traced xpath value of feild "login[iovation]" cannot extract value, here have done far login import requests lxml import html header = {"user-agent":"mozilla/4.0 (compatible; msie 5.5;windows nt)"} login_url = 'https://www.upwork.com/ab/account-security/login' session_requests = requests.session() #get csrf result = session_requests.get(login_url) tree=html.fromstring(result.text) auth_token = list(set(tree.xpath('//*[@name="login[_token]"]/@value'))) auth_iovat = list(set(tree.xpath('//*[@name="login[iovation]"]/@value'))) # create payload payload = { "login[username]": "myemail@gmail.com", "login[password]": "pa$$w0rd", "login[_token]": auth_token, "login[iovation]": auth_iovation, "login[redir]": ...

java - I am tring to jump to another host using JSch, but it is not working -

i use jsch connect server , works send command using exec , shell channel, want connect server through first connection, application crashes when trying connect second session, not sure if set code correctly or not public session connect() throws jschexception{ string host1 = "192.168.1.1"; string host2 = "192.168.2.2"; string username = "host"; string password = "pass"; jsch jsch = new jsch(); session s; s = jsch.getsession(username, host1, 22); properties config = new properties(); config.put("stricthostkeychecking", "no"); s.setconfig(config); s.setpassword(password); s.connect(); s.setportforwardingl(22, host2, 22); session secondsession = jsch.getsession(username, host2, 22); config.put("stricthostkeychecking", "no"); secondsession.setconfig(config); secondsession.setpassword(password); secondsession.connect(); return secondsession; } after declare , assign secondsession , didn...

html - Disable HTML5 form input tooptip -

Image
i added required attribute input tag. when valid , submit form, html tooltip popup. is there approach disable html5 tooltip? using augularjs 1 , not sure whether augularjs 1 provide function this. why adding required attribute when don't want html5 validation ? it's better if use validation provided angualar. i've attached demo var app = angular.module('form-example', []); app.directive('passwordvalidate', function() { return { require: 'ngmodel', link: function(scope, elm, attrs, ctrl) { ctrl.$parsers.unshift(function(viewvalue) { scope.pwdvalidlength = (viewvalue && viewvalue.length >= 8 ? 'valid' : undefined); scope.pwdhasletter = (viewvalue && /[a-z]/.test(viewvalue)) ? 'valid' : undefined; scope.pwdhasnumber = (viewvalue && /\d/.test(viewvalue)) ? 'valid' : undefined; ...

How can I parse JSON with C#? -

i have following code var user = (dictionary<string, object>)serializer.deserializeobject(responsecontent); the input in responsecontent json, not parsed json object. how should serialize it? i assuming not using json.net . if case, should try it. it has following features: linq json the jsonserializer converting .net objects json , again json.net can optionally produce formatted, indented json debugging or display attributes jsonignore , jsonproperty can added class customize how class serialized ability convert json , xml supports multiple platforms: .net, silverlight , compact framework look @ example below. in example, jsonconvert class used convert object , json. has 2 static methods purpose. serializeobject(object obj) , deserializeobject<t>(string json) : product product = new product(); product.name = "apple"; product.expiry = new datetime(2008, 12, 28); product.price = 3.99m; product.sizes = new string[] { "small...

java - MySQLSyntaxErrorException: Unknown column 'vehicle_vehicleId' in 'field list' -

trying run simple example. getting following error. might silly mistake. error : mysqlsyntaxerrorexception: unknown column 'vehicle_vehicleid' in 'field list' code : user.java public class user { @id @generatedvalue private long userid; @onetoone private vehicle vehicle; // getter , setter of userid , vehicle } vehicle.java: @entity public class vehicle { @id @generatedvalue private int vehicleid; private string vehiclename; // getter , setter of vehicleid , vehiclename } mainclass.java sessionfactory sessionfact = new configuration().configure().buildsessionfactory(); user user1 = new user(); session session = sessionfact.opensession(); transaction tx = session.begintransaction(); user1.setuseraddress("usa"); user1.setusername("john"); vehicle vehicle1 = new vehicle(); vehicle1.setvehiclename("ferrari"); user1.setvehicle(vehicle1); session.save(user1); session.save(vehicle1); t...

lisp - How to install a package with quicklisp -

i tried install lisplab asdf , quicklisp turned out fail. i use sbcl , slime. anyone can me installation. , want manipulate matrix within lisp:) thanks, lisper! the first thing installing lisp library using quicklisp, see if available via quicklisp: (note answer i'm using configuration roswell slime sbcl on antergos) cl-user> (ql:system-apropos "lisplab") ; no value in case project not included, can update quicklisp, in case not necessary. project not in quicklisp , maybe not in future. can choose continue installing or search atertnative thake quickdocs search math let's try install quicklisp says this: can load local project isn't part of quicklisp? yes. easiest way put project's directory in quicklisp's local-projects directory. example: $ cd ~/quicklisp/local-projects/ $ git clone git://github.com/xach/format-time.git the project loadable via (ql:quickload "format-time") also, system fil...

ios - execute function after function is not working swift 3 -

this function want execute after downloading details , function whcih update uielements after downloading. function inside "currentweather.swift" func downloadweatherdetails(completed: ( () -> () )){ // tell alimofire download let currentweatherurl = url(string: current_weather_url)! alamofire.request(currentweatherurl).responsejson{ response in let result = response.result if let dict = result.value as? dictionary<string, anyobject>{ if let name = dict["name"] as? string{ self._cityname = name.capitalized print(self._cityname) } if let weather = dict["weather"] as? [dictionary<string, anyobject>]{ if let main = weather[0]["main"] as? string{ self._weathertype = main.capitalized print(self._weathertype) } } if let main = dict["...

Angularjs filters OR conditions -

i trying create filter can conditionally select multiple attributes of same variable. example var list = [ {id: 1, state: 'u'}, {id: 2, state: 'p'} ] <div ng-repeat="item in list| filter:{state:'u'}> this result in id 1 being displayed. <div ng-repeat="item in list| filter:{state:'p'}> this result in id 2 being displayed. how can create filter display id's have state:'p' or state:'a' neither of below work: <div ng-repeat="item in list| filter:{state:'p' || 'a'}> <div ng-repeat="item in list| filter:({state:'p'} || {state:'a'})> hope below code snippet might ! run :) var app = angular.module('app', []); app.controller('ctrl', function($scope) { $scope.list = [{ id: 1, state: 'u' }, { id: 2, state: 'p' }, { id: 3, state: 'a' }]; $s...

c++ - Run-Time Check Failure #2 - s for array of C-Strings -

i have following 2 2d arrays of c-strings. trying copy first 1 onto second using strcpy() function. however, keep getting runtime error. #define _crt_secure_no_warnings #include <cstring> #include <iostream> using namespace std; int main() { char word1[3][3] = { "hello", "bonjour", "ni hao" }; char word2[3][3] = { "steve", "pei", "frank" }; char temp[] = ""; (int = 0; < 3; i++) { strcpy(temp, word1[i]); strcpy(word1[i], word2[i]); strcpy(word2[i], temp); } (int = 0; < 3; i++) { cout << word2[i] << " "; } cout << endl; } in code find several mistake. your char array word1 , word2 , temp isn't initialize properly.you need increase size of array . in loop use 3.it break output if word's length become grater 4. so here give little solution.but better use user input size o...

matlab - Progress indication in parfor -

i used track progress in parfor loop first generate line of dots , adding "|" every once while on new line (source: matlab: print progress parfor loop ). there way percentage of progress during parfor loop without additional pop progress bar (as in source well)? fprintf(['\n ' repmat('.',1,100) '\n']); parfor jj = 1:n if mod(jj,n/100)==0 fprintf('\b|\n'); end output= somefunction(input); end no, main matlab process inaccessible while using parfor . way around use process reports progress. fwiw, parfor progress monitor best solution i've found issue, though open new window.

java - Changing the format specifier in the printf() method results in IllegalFormatFlagsException -

in following code, after changing format specifier in printf() method %04d%n %0-4d%n , , running code results in exception in thread "main" java.util.illegalformatflagsexception: flags = '-0' the complete source code follows: public class minarray { public static void main(string[] args) { byte[] storeminimum = new byte[5]; byte[] trialarray = new byte[15]; for(byte bt=0; bt < storeminimum.length; bt++){ randomize(trialarray); storeminimum[bt] = findminimum(trialarray); } (byte minvalue : storeminimum) system.out.printf("%0-4d%n", minvalue); } private static byte findminimum(byte[] valarray) { byte minvalue = valarray[0]; for(byte bt=0; bt < valarray.length; bt++) minvalue = (byte) math.min(minvalue, valarray[bt]); return minvalue; } private static void randomize(byte[] valarray) { (b...

c# - Web api mvc configuration -

i'm trying figure out global.asax , lines in mean. i understood concept of global file can't seem figure out content of means. file: protected void application_start() { arearegistration.registerallareas(); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); } also, understood there importance order of these lines. this mvc frameworks bootstrap method hook asp.net framework on startup. application_start gets called when application domain loaded. can edit file see fit , depending on chose when created project of these lines may or may not included default. have there. arearegistration.registerallareas(); - registers areas, if have mvc application can configure areas ways further group functionality / views. see areas more detail. webapiconfig.register(globalconfiguration.configuration); - registers web api routing , additio...

html - Conditional comments syntax -

can explain me difference between first , second conditional comment syntax? <!--[if lt ie 8]><html class="no-js lt-ie8"><![endif]--> <!--[if gt ie 8]><!--><html class="no-js"><!--<![endif]--> why second 1 use use <!--> syntax before <html> tag? can use following syntax same result? <!--[if lt ie 8]><html class="no-js lt-ie8"><![endif]--> <!--[if gt ie 8]><html class="no-js"><![endif]--> thanks in advance! no, second setup not same first. in first, <!--[if gt ie 8]><!--><html class="no-js"><!--<![endif]--> used, let other browsers (the one's not understand conditional comments) have <html class="no-js"> , second setup won't src: https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx

python - Same values in two lists (pairs) -

so need have list going have 1 list load of values between 1 , 8 randomly generated , list load of values between 1 , 8 randomly also. have managed on code below: from random import * lista = [] listb = [] inp = int(input('number of values generated')) x in range(0,inp): num = randint(0,8) lista.append(num) if num == 0: numb = randint(1,8) else: numb = randint(0,8) listb.append(numb) print(lista) print(listb) the value in first list can't 0 , value in seond list can't 0 on same trial. have in code. problem have. [4, 5 , 2, 5 , 1] [1, 2 , 3, 2 , 4] in lista, 5 produced twice , 2 below on second list produced twice also. can't figure out solution these out lists, when create pair this. thanks. you can use helper function below generate unique number not in list , append list. this should work you: def generateunique(list, start, end): # helper function generate , return unique number not in list ...

apache storm - Topology spouts lag error -

Image
i getting strange error while after storm topology created. in "topology spouts lag error" part of storm-ui. says: unable offset lags kafka. reason: java.lang.nullpointerexception @ org.apache.storm.kafka.monitor.kafkaoffsetlagutil.getoffsetlags(kafkaoffsetlagutil.java:269) @ org.apache.storm.kafka.monitor.kafkaoffsetlagutil.main(kafkaoffsetlagutil.java:127) there topic inside kafka , check topic /bin/kafka-console-consumer.sh any idea? thank you

Android App get crashed when webview open -

i trying transfer variable (url_1) value main activity webview. when click button app crashed. use putextra doesn't work. please have on below code. public class customadapter extends baseadapter{ string [] result; context context; int [] imageid; private static layoutinflater inflater=null; public customadapter(mainactivity mainactivity, string[] prgmnamelist, int[] prgmimages) { // todo auto-generated constructor stub result=prgmnamelist; context=mainactivity; imageid=prgmimages; inflater = ( layoutinflater )context. getsystemservice(context.layout_inflater_service); } @override public int getcount() { // todo auto-generated method stub return result.length; } @override public object getitem(int position) { // todo auto-generated method stub return position; } @override public long getitemid(int position) { // todo auto-ge...

sql server - SSAS cube with date range records -

i have build cube based on date range records, , not sure best way proceed. imagine cube of cars , warranty periods. each car has start date, , end of warranty periods. there may extended warranty periods.. imagine car reg type warranty start warranty end car purchase 01/01/2016 31/01/2016 car extended 01/01/2017 30/06/2017 car extended 01/08/2017 30/01/2018 -- note, gap here car b purchase 01/01/2016 31/01/2016 car b extended 01/01/2017 30/06/2017 car b extended 01/08/2017 30/01/2018 -- note, gap here so multiple items, multiple date ranges. there main table (cars) car details (colour, model, etc). now want build cube, reportable @ month level, cars under warranty/warranty type, etc. so plan 1 build view explodes above out join date table, report month, , feed cube. but, number of cars multiplied months covered leads multi hundreds of milions of rows - means serve...

database - how to get Intersection of two query in mysql -

Image
i have table has 2 column 2 foreign key 2 different table. this relation table: i want select student can speak both language id 3 , 4. how can wrote query give me e.x 12 , 14 assume relation named "my-relation": select r1.student_id my-relation r1 join my-relation r2 on r1.student_id = r2.student_id r1.language_id = '3' , r2.language_id = '4'

php - jQuery - On click, check all checkboxes in class, if checked (do this) if not (then) -

i have php page populated mysql query. want filter table results based on checkboxes selected. when page loaded results show. on change of checkbox, results filter, hiding or showing rows based on checkboxes checked! can please me jquery code. have; $(function() { $(".filtercheck").change(function() { var checkarr = $('.filtercheck:checked').map(function() { $ = '.filter_' + this.value; $($).parents('tr').show(); return this.value; }).get(); $.each(checkarr, function(i, val) { alert('no values'); $v = ".filter_" + val; $($v).parents('tr').show() }); }); can explain how can edit code, if checkbox selected results in table shown ( $(this.value).parents('tr').show() ) or, if checkbox not selected, .hide(), if checkboxes unchecked, results shown.. the checkboxes created php code, $db_results = mysqli_query(database::$conn, ...

qt - QToolButton don't hide popup menu after triggering action -

Image
i have qtoolbutton popup menu on toolbar. popup menu has number of checkable actions, , looks this: problem - popup menu closes every time check/uncheck action, want stay opened can check number of actions no need reopen popup menu. how can achieve this? edited: found workaround - prevent qmenu closing when 1 of qaction triggered it looks bit different still ok me:

ios - Information about purchasing from Apple appstore -

i create python application on raspi switch light on or colore red every time purchased app on apple's app store or purchased in-app item. is there information apple delivers developers when app or iap sold in real-time? thanks inn advance!

windows - How to copy specific files from one folder to another from the command prompt -

i have large folder of pictures (thousands), , have long list of files, exact file name, need copy folder using windows commands, through cmd prompt only. use windows 7. i want know if there way can select several specific files folder, name, , copy them folder, using terminal, without copying them individually?. i know can xcopy want copy specific types of files 'jpeg','bmp',etc. try using xcopy /d /y /s "\your image folder\*.jpg" "c:\users\%username%\desktop\master image folder\" also can use copy *.<extension> <other folder> for example : copy c:\users\desktop\*.jpg d:\backup will copy files extension .jpg path c:\users\desktop\ d:\backup\

javascript - Building a table in react -

i'm trying build simple table using react , running small issue. here html: <div> <table> <tbody id="content"> <tr> <th>name</th> <th>email</th> </tr> </tbody> </table> </div> and react module: var friendscontainer = react.createclass({ getinitialstate: function(){ return { data: [ {'name':'lorem ipsum', 'email':'email1@gmail.com'}, {'name':'caveat broader', 'email':'email2@gmail.com'}, {'name':'runther brigsby', 'email':'email3@gmail.com'} ] } }, render: function(){ var listitems = this.state.data.map(function(person) { return( <tr> <td>{person['name']}</td> ...

compiler errors - "'errno' undeclared" when compile Linux kernel -

i'm trying compile , keep getting following error: enter image description here i've included asm-i386/errno.h once , didn't work. i've tried including linux/errno.h , didn't work ether. what file should include? there no errno variable in linux kernel: variable lives in user space only. if kernel function wants report error , specify error code, encapsulates error code returning value. there 3 possibilities of such encapsulation, dependent value type returned on success: function returns 0 on success, negated error code on fail. this used convention referenced 0/-err . function returns valid pointer on success, expression err_ptr(err) on fail. this expression evaluated pointer, can never points real kernel object . convention may used if null valid result. function returns positive integer on success, negated error code on fail: +val/-err . in case when 0 valid result, convention may used too: +val/0/-err . when user s...

javascript - Search for a value in nested objects -

i have check if object contains value in javascript , don't know how it. object looks this: match { player1: undefined, player2: undefined, childrenleft: match { player1: 'john', player2: 'mary', childrenleft: undefined, childrenright: undefined }, childrenright: match { player1: 'michael', player2: 'james', childrenleft: undefined, childrenright: undefined } } now it's competition final , 2 semi-finals bigger depending on number of players need traverse tree. have function supposes return next opponent doesn't work when search players on childrenleft. so, when execute match.nextopponent(james) got 'michael' result when execute match.nextopponent(mary) got 'undefined'. match.prototype.nextopponent = function (player) { if (this.player1 === player) return this.player2; if (this.player2 === player) return this.player1; if (!this.player2 && !...

javascript - jQuery carousel - any number of images -

i have flickity carousel of images that, when click image/slide, opens modal window show zoomed in version of said image. within modal have left , right buttons scroll through zoomed in images. my problem code breaks if have more or less 3 images in slider. need convert not break no matter how many images have, whether 1, 4, 2 or 8 etc. how do this? my js below has been reduced show relevant bits. have function right button too. see jsfiddle current situation: https://jsfiddle.net/293sh54n/6/ js var activedivimg; $( ".product--slider .slide" ).each(function( index ) { // show modal window $('#product-slider-flickity img').click(function(){ activedivimg = parseint($(this).parent().index()); console.log(activedivimg) $("#imageshow").html('<img src="'+$(this).attr('src')+'"/>'); $(".p-image-zoom").addclass("md-show"); }); }); // zoomed in controls - scroll left button ...

Alternatives to django-autocomplete-light and django-ajax-selects? -

i have dropdowns in project forms might include hundreds of values . spent time trying use django-autocomplete-light , django-ajax-selects packages doesn't work me , not getting answers on so. django ajax-selects package not working. missing? django-autocomplete-light displays empty dropdown in form is there pure django simple solution problem without js? popup search example.

deep learning - How to pretrain networks using Imagenet -

i want pretrain residual net using imagenet in caffe. wonder hyper-parameters should set when run training. specific,i want know probablyvalue parameters below (1)learning rate (2)learning policy (3)drop out (4)l1 or l2 regulation besides want know how many neurons of inner-product layers before 1000 output layer should set. sincerely thanks.

laravel 5.3 - Passport with SSL certificate -

i installed ssl certificate on site. however, administrator provides laravel passport not working should. see information not exist in database , can not create clients or delete ones listed in table. enter image description here if remove certificate site (added through forge), laravel passport works correctly. how can resolve issue between passport , ssl certified?

c++ - QT Read file, convert to int and use as initial slider value -

i've made horizontal slider, value being saved in text file. after app closed slider resets initial value of "1". using - ui->horizontalslider->setvalue(read()); i want read value of file using read() function , set initial value slider results in value being restored / saved. this read(); function- int read(){ std::fstream readfile; readfile.open("bin\ram.dat"); std::string value; readfile << value; int value2 = atoi(value.c_str()); return value2; } after lot of different variable types being used , few conversion not work. question- how set initial value of slider int located in "bin\ram.dat"? i'm beginner tips or clues more welcome. thanks! (i've googled before posting , found few codes did not work here)

Android- Integrating Google Sign In ->status{statuscode=developer_error, resolution=null} -

Image
i trying couple of days, still not able find solution. in end, used code here https://github.com/googlesamples/google-services . @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); mstatustextview = (textview) findviewbyid(r.id.status); // button listeners findviewbyid(r.id.sign_in_button).setonclicklistener(this); findviewbyid(r.id.sign_out_button).setonclicklistener(this); findviewbyid(r.id.disconnect_button).setonclicklistener(this); // [start configure_signin] // configure sign-in request user's id, email address, , basic // profile. id , basic profile included in default_sign_in. googlesigninoptions gso = new googlesigninoptions.builder(googlesigninoptions.default_sign_in) .requestemail() .build(); // [end configure_signin] // [start build_client] // build googleapiclient access google sign-in api...