Posts

Showing posts from June, 2012

java - Scaling drawable resources -

i have done image editing of application want make fit every device scaling them different sizes. have found site put image scales different screen densities when put in project not adapt screen. here's code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:background="@drawable/backgroundapp" android:orientation="vertical"> <imagebutton android:id=...

osx - voiceover issue on mac -

in project when launched voiceover running , user tries use control-option-m access menu not work (meaning apple logo not highlighted). quitting voiceover , relaunching works fine. have confirmed (at least most) other apps not have problem. idea on why happen? never did intentionally cause behavior. thanks! rc

java - Cannot find the declaration of the element 'diops' -

i'm new on xml stuff, , i'm having 1 issue location of element diops. here xml <diops xmlns:ans="ttp://dados.wsh.com.br/diopsxml-2016/xsd/2016/xsd/2016" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://dados.wsh.com.br/diopsxml-2016/xsd/2016 diops2016.xsd"> and here xsd <xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:tns="http://www.ans.gov.br/ws/diops/financeiro/schema/v2016" elementformdefault="qualified" targetnamespace="http://www.ans.gov.br/ws/diops/financeiro/schema/v2016" version="1.1"> <xs:include schemalocation="diopscomplextypes2016.xsd"/> <xs:element name="diops"> <xs:complextype> <xs:sequence> <xs:element ref="tns:ident...

What parser generator does Dart use? -

i see in "analyzer_experimental" package of dartlang, there generated dart code parsers: https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/?r=24255#dart%2fpkg%2fanalyzer_experimental%2flib%2fsrc%2fgenerated i wonder parser generator uses? from readme , looks it's not generated parser generator, rather machine-translated existing (presumably human-coded) java implementation: this code part of experimental port of editor's analysis engine java dart. while continue support java version of analysis engine , services built on it, intend provide same services dart-based applications. code , expect change, possibly in significant ways. while eager see other people make use of analysis engine, want clear, in case interested in doing so, current api's should in no way considered stable. in particular, code automatically translated java implementation. java implementation translated still under development ...

javascript - Dynamic variables in HTML and Angular? -

i'm using ng-repeat through list of objects consist of displaynames , variables. example, here example fields list: "fields": [ {"displayname": "company name", "variable": "name"}, {"displayname": "location of product", "variable": "location"}, ] currently i'm doing this: <div ng-repeat="field in fields"> <label class="control-label">{{field.displayname}}</label> model.{{field.variable}} </div> i want model.{{field.variable}} display value of model.variable value. example, if field.displayname "company name", want display model.name . i tried wrapping in curly braces {{model.{{field.variable}}}} didn't work. thanks! you need use bracket notation when have dynamic key. <div ng-repeat="field in fields"> <label class="control-label">{{ field.displaynam...

ipad - Elaboration idea movement ajax wicket elements -

i trying optimize webapplication ipad use. implementing user interaction , related action / feedback. have following idea , wondering if possible achieve this. detect user-interaction javascript determine element touched. determine movement. communicate wicket send movement touched element if implements interface, i.e., touchable. the element reacts user-interaction implementing, in interface, defined methods. an example of touchable element following: public class mypanel extends panel implements touchableelement @override public void react(int x, int y, int movement) { .... } } could tell me if possible and/or give me tips, drawbacks et cetera. every piece of feedback helpfull. could tell me if possible and/or give me tips, drawbacks et cetera. this possible creating own ajax behavior extending abstractdefaultajaxbehavior "listens" on user's clicks via javascript , sends information calculated wit...

css - Jquery resizable reposition handle after scroll -

i have html table within container. container has height, , overflow y set auto create scrollbar .table-container { height: 175px; border-bottom: 2px solid #eeeeee; overflow-y: auto; } i have made container resizable using jquery ui resizable. $(function () { $(".table-container").resizable({ handles: "s" }); }); unfortunately when use scrollbar resizable handles moves. stay @ bottom of container. here fiddle. https://jsfiddle.net/oyb3r6u8/1/ enter link description here you use jquery maintain position of handle during drag based on position of drag. here full update code: https://jsfiddle.net/k3e5ma2s/ $(function () { $(".table-container").resizable({ handles: "s", resize: updatehandle }); $( ".table-container" ).scroll(function() { updatehandle(); }); updatehandle(); }); function updatehandle() { table = $('.table-container'); var bottom = table.s...

Keep this as context of base object in properties of javascript object -

i wondering need maintain type of (var self = this) coupling within sub properties of java script object. example, if had following object: var t = { helpers: { getname: function(){ //how preserve or mbase object instance here... //so can example following: var self = this;//this helpers object, how base object? return self.nickname + "..."; }, gettime: function(){ } }, nickname: 'test' } from understand currently, reference when in object, directly passed down function if property of object. since scenario 2 objects don, base or "helpers" object when reference (var self = this) , if so, how reach base object property such "nicknam" within obj.helpers.getnickname()? thanks in advance.

Ruby: blank? without Rails -

i want have test: if (line.blank?) do_stuff ...but i'm in straight ruby, not rails. what's accepted idiom accomplishing same effect? i'm doing string, testing .empty? not same testing .blank? (an whitespace string not empty, blank.) from activesupport line !~ /[^[:space:]]/

Swift startIndex from string -

i'm having weird bug in code. i'm building ios app in swift. code contains following function: func generateattrstring(path: string?) { { let content = try string(contentsoffile: path!, encoding: nsutf8stringencoding) let array = content.componentsseparatedbystring("\n¶") let attrstyle = nsmutableparagraphstyle() attrstyle.linespacing = 8 attrstyle.paragraphspacing = 12 element in array { var string = element var attributes = [ nsparagraphstyleattributename: attrstyle, nsfontattributename: uifont(name: "myriadpro-light", size: 17.0)! ] var attrstring = nsmutableattributedstring(string: string, attributes: attributes) if string[string.startindex] == "•" { string.removeatindex(string.startindex) attributes[nsfontattributename] = uifont(name: "myriadpro-regular...

parsing - How can I parse HTML from a url for a logged in user -

suppose logged-in youtube. see videos specific logged-in user account. so, want parse html of youtbe page video ids of current logged-in user in browser. i tried jsoup parses html of page if no user logged-in. hope got query...!!! solution ? i tried jsoup parses html of page if no user logged-in. you have tell jsoup login youtube. more importantly, have store eventual cookie(s) provided youtube , reuse them web request it. once logged in, jsoup able parse html of youtube page video ids of current logged-in user. here interesting article describing how login website jsoup . article comes example login github. however, write down here whole process. read article full details. what need? a browser developer tool enabled the form data used when login process starts the required cookies how process? open private browsing window. this window ensures don't have cookies set. fire developer tool bar. the toolbar gives login form details , ...

c++ - Can the exit code of a process overflow for small values? -

i writing testing framework , in main() return number of failed tests. example: int main() { int failedtests = runtests(); return failedtests; } so can "int" overflow? can %error_level% == 0 when returned different 0? depend on host operating system? usual maximum values? can sure integer < 32768 (2^16 - short) fit? edit: i've had problems python sys.exit uses 0-127 range (almost) careful now it depends upon operating system. on linux, restricted 8 bits, can 0 (for success) or positive integer not greater 255. see _exit(2) & wait(2) . only 2 values standardized (by name): exit_success (usually 0) , exit_failure (often 1). notice standard defines name (and behavior of exit(0); ...) not value. you write number (of failed tests) stdout or file specified thru program argument. freebsd has defined in sysexits(3) set of exit names , codes, not standardized, e.g. in posix. see posix documentation on exit .

Excel VBA maxter data -

i used code copy cells master data. data in cell contains formulas. how can paste data in other sheet changing format of cell number.?? sub maxterdata() sheets("sheet1").range("b2:e2").copy dim lastrow long lastrow = range("a65536").end(xlup).row sheets("summary info").activate cells(lastrow + 1, 1).pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false end sub try this: sub maxterdata() dim lastrow long sheets("summary info") lastrow = .range("a" & rows.count).end(xlup).row .cells(lastrow + 1, 1).resize(, 4).value = sheets("sheet1").range("b2:e2") .cells(lastrow + 1, 1).resize(, 4).numberformat = "general" end end sub try avoid using .select , .activate . of time not needed , slows done code. also when wanting values assign values directly target.

datetime - date difference in hours with python (excel data import) -

i need calculate hour difference between 2 dates (format: year-month-daythh:mm:ss potentially transform data format (format: year-month-day hh:mm:ss) huge excel file. efficient way in python? have tried use datatime/time object (typeerror: expected string or buffer), timestamp (valueerror) , dataframe (does not give hour result). thank help! excel file: order_date received_customer column3 2000-10-06t13:00:58 2000-11-06t13:00:58 1 2000-10-21t15:40:15 2000-12-27t10:09:29 2 2000-10-23t10:09:29 2000-10-26t10:09:29 3 ..... .... datatime/time object code (typeerror: expected string or buffer): import pandas pd import time t data=pd.read_excel('/path/file.xlsx') s1 = (data,['order_date']) s2 = (data,['received_customer']) s1time = t.strptime(s1, "%y:%m:%d:%h:%m:%s") s2time = t.strptime(s2, "%y:%m:%d:%h:%m:%s") deltainhours = (t.mktime(s2time) - t.mktime(s1time)) print deltainhou...

java - Why could I receive a ClassNotFoundException in a background thread created by me on Tomcat 8? -

i'm having issue micro-service deployed on tomcat 9 java 8. explaining better, have rest service webapp (war) deployed on tomcat 9, webapp has 2 parts: one rest service itself, once it's called, receive parameters , creates object mypackagedto (serializable) class them, calls rabbitmq queue , publish object queue, part works well. the second part conformed weblistener creates background thread connects queue on rabbitmq consumer. part failing when throws classnotfoundexception when dequeue object (mypackagedto) queued first part. the thing is, packed on same jar. there classes of war packed on jar located on web-inf/lib, not unpacked on web-inf/classes. (i'm using maven "archiveclasses" true) so, after reading while, found this post talk this, , i'm thinking problem related class-loader used thread created in weblistener @ application deploy. it's little hard understand this, because inside same jar , same war, there's 1 tomcat server (...

xml - ipad - pass data from NSMutableDictionary to another ViewController -

i have ipad app (master-detail app) , in masterviewcontroller , have xml parser, parse data nsmutabledictionary. after it, need data viewcontroller viewcontroller called adhoc. first idea #import detailviewcontroller.h , use detailviewcontroller.dictionary call , write uitableview. when run code, in table view cell (null). can me, how pass data there? thanks!

c# - Setting up a recurring subscription service for an ASP.NET website -

i have asp.net website similar yellow pages in functionality , want offer recurring subscription service users enables business profiles priority listed, or brought top if subscribed. each user has "subscriptionlevel" integer tied account on database side , need modify field depending on subscription service select. there c# libraries out there can use set quick? prefer users pay through paypal. sure can this. there's lots of 'out of box' subscription services if here i'm assuming developer why not integrate api. paypal provides recurring payment api keep in mind can test inside of sandbox environment

objective c - Print object pointer address passed by reference -

nsstring *str = @"hello"; nslog(@"pointer = %p", str); [self dosomthingwithstring:&str]; - (void)dosomthingwithstring:(nsstring **)str { *str = @"world"; nslog(@"pointer = %p", *str); } maybe it's kind of obvious question, expect have same address printed out: pointer = 0x104ce9f40 pointer = 0x104ce9fa0 no, should not see same address printed, because dosomthingwithstring assigns new object str caller. not modify nsstring in place. the nsstring content "hello" referenced str no longer referenced after assignment *str = @"world" , hence different printout. perhaps better illustration separate string "world" , this: nsstring *str = @"hello"; nslog(@"pointer = %p", str); // prints @"hello"'s address ad [self dosomthingwithstring:&str]; - (void)dosomthingwithstring:(nsstring **)str { nslog(@"pointer = %p", *str); ...

bash - Environment variables for docker-compose inside of Jenkins -

i've following setup: jenkins environment running docker-compose need pass environment variables yml file: sample docker-compose.yml version: '2' services: logon_server: build: . image: my_server:0.0.1 ports: - "9200:9200" command: ${docker_cmd_exec} networks: - my_ntwrk networks: my_ntwrk: when run following script shell prompt on mac, can pass different commands executed , works: exec-tests.sh #!/bin/bash chmod 755 docker/exec-*.sh # setup env variables export docker_cmd_exec=/ci_e2e.sh # optional: record current versions docker -v && docker-compose -v echo `whoami` echo `sudo -e -u admin printenv` # build, deploy , run e2e test cases sudo -e -u admin docker-compose --no-color --abort-on-container-exit when run script inside of jenkins job, under 'build environment' -> 'execute shell' -> 'command', here image of i'm talking about: example of shell command...

node.js - nodejs - multiple async http requests -

i have started journey nodejs , create simple nodejs app needs to: - first request/get initial data via http, - use received json set of requests (some can done in parallel, needs executed first , data received used create valid url). taking account nodejs asynchronous , based on callbacks, wondering best way achieve in order have 'clean code' , not mess code much. thanks hints / guidelines, mark maybe check out async library. has lot of built in functionality seems accomplish you're looking for. couple of useful ones right off bat might "async.waterfall" , "async.map". async.waterfall async.map

javascript - Google Maps stops loading when the code is moved to my JS file from script tags in index.html -

my map worked fine when had in script tags on index page, when tried move js file use variable in it, nothing worked. any appreciated, html <div id="map"></div> <script async defer src="https://maps.googleapis.com/maps/api/js?key=aizasyd9utzeckd8pv-iwfik5jvgttg84qhdjfi&callback=" type="text/javascript"></script> <script type="text/javascript" src="js/index.js"></script> javascript var im = 'http://i.imgur.com/aconaai.png'; function initmap(position) { var map = new google.maps.map(document.getelementbyid('map'), mapoptions); var mylatlng = new google.maps.latlng(position.coords.latitude, position.coords.longitude); var mapoptions = { zoom: 16, center: { lat: 43.4678683, lng: -79.7006069 }, maptypeid: google.maps.maptypeid.satellite, ...

What is the best way to store nested data in a python class? -

i have simple python program meant operations on c source code. extract header files #include in .c file , store them, take function declarations .h files , store too, , take variables functions. the problem is, how can nest these class keep them linked? i.e. .c files contain lists of .h files, .h files contain lists of function declarations, function declarations contains lists of variables. so far i've got is: class c_file: file_count = 0 def __init__(self, file_name): self.file_name = file_name c_file.file_count += 1 def headerfile(self, header_name, functions): self.header_name = header_name self.functions = [] x in functions: self.variables.append(x) i'm not sure if dictionaries better option? or need class @ all? (this first python program, i'm used working in c) make object, , each object acts container sub-objects. when instantiate class, it's responsible parsing object find ...

wordpress - How can I run 2 sites on Apache? Complex situation -

my goal host 2 different sites same vm , both on port 80. 1 wordpress site on domain.com , other web-based app on app.domain.com. if can't done, alternate goal wordpress site running on domain.com port 80. my registrar 1and1.com , dns settings (below). please note don't allow cname record primary domain, subdomain. here record (ip address , domain names in post not real ones): type: record value: 123.456.789.10 my host azure have vm running virtual ip address of 123.456.789.10. azure vm has endpoints configured this: tcp public port 8080 private port 8080 tcp public port 80 private port 80 tcp public port 2121 private port 21 tcp public port 22 private port 22 on azure have dns zone configured this: name: www type: ttl: 3600 value: 123.456.789.10 my apache default file configured this: # wordpress website (domain.com) listen 80 <virtualhost *:80> documentroot /var/w...

java - Hibernate criteria to have multiple restrictions on the child collection -

i have write criteria query clause match both first & last names in child collection. both names in different rows tried this, not return when matching data present, because it's trying match both restrictions on same row. criteria criteria = getcurrentsession().createcriteria(form.class); criteria.createalias("responses", "r"); criteria.add(restrictions .conjunction() .add(restrictions.eq("r.id", "firstname")) .add(restrictions.eq("r.value", getfirstname()))); criteria.add(restrictions .conjunction() .add(restrictions.eq("r.id", "lastname")) .add(restrictions.eq("r.value", getlastname()))); tried , gives exception org.hibernate.queryexception: duplicate association path: responses criteria criteria = getcurrentsession().createcriteria(form.class); criteria.createalias("responses", ...

jquery - Dropzone.js remove button with php -

i use dropzone.js nice upload form. linked php code upload files , setted addremovelinks=true have remove button. i need idea how efectivly delete filse uploaded php code when hit remove button. the php simple need t know how relate them. tryed using $.post in function removedfile: function(file) no succes. removedfile: function(file) { $.post("test.php"); var _ref; return (_ref = file.previewelement) != null ? _ref.parentnode.removechild(file.previewelement) : void 0; }, first off, shouldn't overwrite default removedfile event handler, rather register own handler along it. you need first id server (so know how relate it) , use setup delete call. dropzone.options.mydropzone = { init: function() { this.on("success", function(file, response) { file.serverid = response; // if return id when storing file // can return json object line // this: // // file.serverid = response.id; // ...

android - HTML5 video buffers backwards -

i implemented buffer bar html5 videos. when watch them via browser, buffers fine, via android app works buffer bar jumping. percentage goes example 0.10 -> 0.25 -> 0.20 -> 0.30 -> 0.35 -> 0.30 , on. looks twitching reason. what cause problem? i using shared hosting pulling out of vps server, same result , via phone's browser. chrome browser on phone or webview on app causes same result... edited: as mentioned, have no idea causes on browser works fine..but that's js: var startbuffer = function(buffer,myvideo) { var maxduration = myvideo.duration; var currentbuffer = myvideo.buffered.end(0); var percentage = 100 * currentbuffer / maxduration; $('.'+buffer).css('width', percentage+'%'); if(currentbuffer == maxduration){ cleartimeout() } else { settimeout(function(){startbuffer(buffer,myvideo);}, 100); } console.log("maxduration:"+maxduration); console.log("buffer:"+currentbuffer); console.log(...

C: List aliases of current shell (not subshell!) -

i'm trying find aliases current shell possesses (in c program). i've tried system("alias") , popen("alias", "r") , execvp("alias", ...) , latter of doesn't work @ (because alias shell-specific command) , first 2 of run command in subshell (which sh , not bash ) -> there, aliases disabled because defined in ~/.bashrc . executing bash , reading output of alias isn't possible either because bash go alias definitions if in interactive mode. if do run bash in interactive mode, huge delay time , prompt output want avoid . basically, want, have similar behaviour time(1) . looks current aliases without executing command! (it fork once, is, passed command) crawling internet no avail. question: how aliases in current shell ? there portability issues? if yes, how avoid them? regards. you can't. time built-in , can access aliases stored internally shell instance running. if need work out shell execute, ...

About interacting and testing with django tastypie -

i read many tutorial django testing don't know how can test function insde resource , example user resource signin function , obj_create. appreciate helps because can not figure out how test them. k thanks. class userresource(modelresource): school = fields.toonefield('frittie.app.api.api.locationresource', 'user') class meta: queryset = userprofile.objects.all() resource_name = 'user' allowed_methods = ['get','post'] serializer = serializer(formats=['json', 'plist']) authorization= authorization() #models.signals.post_save.connect(create_api_key, sender=user) #fields = ['username', 'email'] def obj_create(self, bundle, request=none, **kwargs): if not request.method == "post": raise badrequest('object not found or not allowed create new one.') username, email, password = bundle.data['username'], bundle.data['passw...

android - IllegalStateException : ScrollView can host only one direct child -

i have fragment, comprises of scrollview has single linearlayout(i have wrapped other linearlayouts this) fragment_details.xml <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".detailsactivityfragment"> <linearlayout...> </scrollview> in detailsactivity i'm adding fragment detailsactivity.java detailsactivityfragment fragment = new detailsactivityfragment(); fragment.setarguments(b); getsupportfragmentmanager().begintransaction() .add(r.id.movie_details,fragment) .commit(); activity_details.xml <fragment android:id="@+id/movie_details" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com...

python - How to use group by pandas to fetch a column corresponding to a max column? -

my data set looks this playerid,position,points 1,pos1,10 1,pos2,15 1,pos3,4 i want return position players scored points. can group_by find points particular player, how position? data.groupby(['playerid']).agg(np.max)['points'] i want return both playerid , position 1,pos2 one way (among many) that: in [133]: df out[133]: playerid position points 0 1 pos1 10 1 1 pos2 15 2 1 pos3 4 3 2 pos1 2 4 2 pos2 10 5 2 pos3 18 in [134]: df.loc[df.groupby('playerid')['points'].idxmax(), ['playerid','position']] out[134]: playerid position 1 1 pos2 5 2 pos3

C Filling Chess board with T and H, somehow there are gaps and only 7 rows instead of 8 -

i had previous question closed broad, decided write code in parts , ask if had specific problem. my code far sees parts of chess board filled knights (in code 'h') , fill parts dominate 't'. goal fill parts of chess board 'h' , 't' , have not dominated blocks left @ '0'. program tests if fields either 't' or 'h', if yes returns 1, if no 0. prints out chess board. however prints out 7 rows (still 8 columns though), , though filled board 12 knights in position dominate entire board, somehow there still 0s left. here code: #include <stdio.h> #include <stdlib.h> int filling(char array[7][7]) { int i, j; (i = 0;i < 8;i++) { (j = 0; j < 8;j++) { if(array[i][j] == 'h') { if(i-1>-1 && j+2<8) array[i-1][j+2]='t'; if(i+1<8 && j+2<8) array[i+1][j+2]='t'; if(i-2...

javascript - zebra striping rows in a flex container with flex-wrap:wrap -

let's i'm using flexbox container flex-direction:row , flex-wrap:wrap . depending on size of browser window, might have 2, 3, 4 or more items in each row. i want put grey background in items in every other row, mimicking table layout. there easy way this? example fiddle here: https://jsfiddle.net/mqf7nouc/1/ html: <div class="container"> <div class="item"> item 1 </div> <div class="item"> item 2 </div> <div class="item"> item 3 </div> <div class="item"> item 4 </div> <div class="item"> item 5 </div> <div class="item"> item 6 </div> <div class="item"> item 7 </div> </div> css: .container { display:flex; flex-direction:row; flex-wrap:wrap; } .item { height:50px; width:100px; text-align:center; vertical-align:middle; ...

Date in mysql select -

i have table a: a.date | a.price 2013-10-01 | 5000 2013-10-02 | 5000 2013-10-03 | 5000 2013-10-04 | 5000 2013-10-05 | 5000 and table b: b.date | b.price 2013-10-01 | 3500 2013-10-03 | 1600 in output receive following information: 2013-10-01 | 3500 2013-10-02 | 5000 2013-10-03 | 1600 2013-10-04 | 5000 2013-10-05 | 5000 how it, help! you can use left join, , can try join table table b: select a.date, coalesce(b.price, a.price) left join b on a.date=b.date if join doesn't succeed, b.price null, otherwise have value. using coalesce() can first non null value. please see fiddle here .

ranking - Excel - Rank date range with similar criteria -

what have column criteria range 1 column b criteria range 2 column c criteria range 3 column d date range what want: column e return ranking number (1,2,3,...) oldest newest of dates appear in column d have same value in 3 criteria columns. assuming data table a1:d6, array formula in e1: =match(d1,aggregate(15,6,(($d$1:$d$6)/(($c$1:$c$6=$b$1:$b$6)*($b$1:$b$6=$a$1:$a$6))),row($d$1:indirect("$d$"&3))),0)*((c1=b1)*(b1=a1)) you must input formula ctrl+shift+enter, not enter, or not work this makes use of aggregate function, introduced in excel 2010, not work in earlier versions dates in rows there not matching criteria in columns b , c return error - can wrap entire formula in iferror return blank, if preferred: =iferror(match(d1,aggregate(15,6,(($d$1:$d$6)/(($c$1:$c$6=$b$1:$b$6)*($b$1:$b$6=$a$1:$a$6))),row($d$1:indirect("$d$"&3))),0)*((c1=b1)*(b1=a1)),"")

php - Change and configure of App\User to a new directory -

there lots of questions question. explanations never complete. steps should take move file app\user app\entities\user i have installed laravel 5.2 , have moved default app\user (app/user.php) folder app\entities , therefore changing namespace in user.php file namespace app\entities; access user model have use app\entities\user have changed setting in config\auth.php 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => app\entities\user::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], the problem packages not work new directory wondering whether there other settings missing. example have installed package tymondesigns/jwt-auth getting error: reflectionexception in container.php line 738: class app\user not exist the package unable locate app\...

django - Key error 'request' in serializer -

i'm trying current user in serializer, evaluate condition (did user post?), this answer tried doesn't seem work: def current_user(self): return self.context['request'].user class postserializer(serializers.modelserializer): liked = serializers.serializermethodfield() def get_liked(self, obj): return str(current_user(self)) class meta: model = track fields = ('foo', 'liked') and simple view: @api_view(['get']) def post_item(request, pk): serializer = postserializer(post) return response(serializer.data) when trying get_liked error raised: keyerror @ /api/posts/1 'request' am missing here? you can send context view serializer this: @api_view(['get']) def post_item(request, pk): serializer = postserializer(track, context={'request': request}) return response(serializer.data)

mysql - inner join with COUNT() and GROUP BY -

i using phpmyadmin test query keep getting syntax error. i've tried looking in mysql manual , trying other syntactical possibilities i've gotten older in process. help select image_title, image_id, count(other_sales.*) art inner join other_sales on (art.image_id=other_sales.image_id) group (other_sales.image_id); mysql said: documentation documentation 1052 - column 'image_id' in field list ambiguous ultimately, want count number of times specific number (image_id) occurs in 'other_sales' table to troubleshoot these 1064 errors: the error message gives snippet of query. first character of snippet first character mysql interpreter not understand. so in case of query, it's select image_title, image_id, count(other_sales.*) art inner join ... ggggggggggggggggggggggggggggggggggggggggggggggggbbbbbbbbbbbbbbbbbbbbbbbbbbb where g means , b means bad. your actual problem: can't put more 1 value in count() function. tried pu...

string - Fortran: how to remove file extension from character -

i have fortran code asks user input file name. code processes file , write out file based on original file name. think if can understand how remove file extension can concatenate whatever want end of that. how strip off file extension in character? character(len=256):: input_file, output_file original file: anyname.xxx output file: anyname_output.csv you can use scan locate position of last dot in string input_file. can use position extract input_file no extension , concatenate new one. character(len=256):: input_file, output_file integer :: ppos character(len=3) :: new_ext="csv" ppos = scan(trim(input_file),".", back= .true.) if ( ppos > 0 ) output_file = input_file(1:ppos)//new_ext

Formatting date and time in powershell -

i want yesterday's date "mmdd" "0418"todays date is"0419" tried this: $d=(get-date).adddays(-1)|select -property month,day $e=$d.day $d=$d.month $total="$d"+"$e" write-host $total but output "418" as can see 3 letter string want 4 letter one. because want search files have format , created day before. the date object has method tostring , allows specify format: $d = (get-date).adddays(-1); $d.tostring("mmdd"); i calling on april 20th, , output is 0419 see this link description of available date format strings.

ruby on rails - Devise Reset Password POSTs instead of PUT -

i'm using non customized version of devise in app , running issues reset password functionality. the default reset password form's method put upon submitting form, posts causes give me error missing email field. post/create method in passwordscontroller of devise emailing user password reset link. put/update method actual resetting of password. none of devise stuff altered in way. devise version 3.5.7 , rails 4.2.6 i've put of relevant code in gist here: https://gist.github.com/dsarhadian/a7950e480bffc2906f77b0e542792f5a any appreciated... in logs says: rendered devise/passwords/edit.html.erb within layouts/application (3.3ms) are sure edit.html.erb file renders form.html.erb view? because when @ source.html file, seems rendering different form has path post method. form.html.erb uses put method. seems me wrong form rendered.

php - Magic method get and set values dynamically from array -

iam sorry if kind of question has been asked before, couldnt find according question. i've got class uses magic method , set. want use property of array set "name", later access property using "name". what now: $arr = array('name' => 'value') $this->obj->name = $arr['name']; what want , doesnt work try: $arr = array('name' => 'value'); foreach($arr $item) $this->obj->[$item] = $item['name']; echo $this->obj->name; // result should 'value' php pretty magic methods, seems syntactic thing. should able you're after just foreach ($arr $key => $item) $this->obj->$key = $item; echo $this->obj->name; // results in 'value'

java - JavaFX Dialog and Alert appear behind main stage in RedHat -

i making use of javafx's built in alert , dialog classes work great in windows , when running eclipse within windows, appear behind parent window when running on target hardware running redhat 6. have tried tweaking various things including: primarystage.initstyle(stagestyle.undecorated); primarystage.setfullscreen(true); alert.initowner(primarystage) , alert.initowner(primarystage.getowner()) alert.initmodality(modality.window_modal) , alert.initmodality(modality.application_modal) alert.initstyle(stagestyle.***) *** being possible styles. the way have been able alerts , dialogs remain on top calling alert.initstyle(stagestyle.utility) creates window cross button not want. ideally prefer bordered window without additional buttons, or undecorated window should able style achieve bordered look. i have read of similar issues in using windows doesn't work ubuntu does. haven't been able find open issues or solutions in case. i using java 8 update 77. ...

Oracle Analytics Window Function -

if have data so: mydate level 01jan2016 5.1 02jan2016 6.2 03jan2016 8.0 04jan2016 5.8 how can use windowing function return date highest level ? thinking: select max(mydate) on (order level) x ... doesnt seem work. tried using partition still no luck. want max(level). select mydate, level (select mydate, level, row_number() on (order level desc) rn x) rn = 1

javascript - jvectormaps customize onMarkerClick -

i'm drawing map using jvectormaps, user clicks on marker have alert triggering. i'd able add custom item within markers array serve record id. can modify alert(id); line in code below accesses current marker's id? here entire script: $(function(){ var markers = [ {id: 1, latlng: [33.44838, -112.07404], name: 'phoenix, az', style: {r: 12, fill: '#76c043'}}, {id: 2, latlng: [39.73924, -104.99025], name: 'denver, co', style: {r: 30, fill: '#ffdd85'}}, {id: 3, latlng: [37.33821, -121.88633], name: 'san jose, ca', style: {r: 30, fill: '#f58a78'}} ]; var map = new jvm.map({ container: $('.map'), map: 'us_aea_en', labels: { regions: { render: function(code){ var donotshow = ['us-ri', 'us-dc']; if (donotshow.indexof(code) === -1) { return code.split('-')[1]; } }, off...

javascript - Need to call function 1 time no matter which checkbox is clicked first - some variation of .one() -

i have page many products on it, , products of same type. have built filtering function checkboxes products. when page loads, products load, , checkboxes default un-checked. goal: when user first clicks checkbox filter products, no matter box clicked, specific function run 1 time, in case, hiding products. when use .one(), working once each checkbox, not desired outcome. need run 1 time, period. no matter checkbox clicked. below html , jquery, appreciated, , thank time. html: <div class="col-md-3 test-one"><label><input id="fourth-cbox" type="checkbox" value="fourth_checkbox" />fourth collection</label></div> <div class="col-md-3 test-one"><label><input id="first-cbox" type="checkbox" value="first_checkbox" />first collection</label></div> <div class="col-md-3 test-one"><label><input id="second-cbox...

jquery - How to set up CORS properly on IIS? -

i've started working on phonegap mobile application authenticate , work asp.net webapi web services. 1 of issues on enable cors in iis using setting in web.config: <system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" /> </customheaders> </httpprotocol> this setting in part of .net webapi application. looking @ above, appears opens access control absolutely everyone, i'm not sure else possibly go value portion of header. mobile apps (html, javascript, etc) on mobile devices, making jquery calls api on server. my api / html seem work expected above setting in place. if remove it, cors errors. above normal, or should more specific? hi try put code webapiconfig below code public static class webapiconfig { public static void register(httpconfiguration config) { config.routes.maphttproute( name: ...

php - SELECT 1 FROM table, weird print_r result -

from have read, when executing following sql command , fetchall() on table 6 rows , 11 columns: $sql = "select 1 table"; $sqlprepared = $conn->prepare($sql) $sqlprepared->execute() $result = $sqlprepared->fetchall(); $print_r($result); i should getting 6 rows of 1 value in each row, value 1 inside each of values. however, getting 6 rows of 2 values in each row, value 1 inside each of values: array ( [0] => array ( [1] => 1 [2] => 1 ) [1] => array ( [1] => 1 [2] => 1 ) [2] => array ( [1] => 1 [2] => 1 ) [3] => array ( [1] => 1 [2] => 1 ) [4] => array ( [1] => 1 [2] => 1 ) [5] => array ( [1] => 1 [2] => 1 ) ) question 1: why getting 2 values each array instead of 1? question 2: instead of inner arrays being array ( [1] => 1 ... why doesn't start [0]?: array ( [0] => 1 ... if don't ...

performance - Windows CPU Scheduler - very high kernel time -

Image
we trying understand how windows cpu scheduler works in order optimize our applications achieve maximum possible infrastructure/real work ratio. there's things in xperf don't understand , ask community shed light on what's happening. started investigate these issues when got reports servers "slow" or "unresponsive". background information we have windows 2012 r2 server runs our middleware infrastructure following specs. we found concerning 30% of cpu getting wasted on kernel, started dig deeper. the server above runs "host" ~500 processes (as windows services), each of these "host" processes has inner while loop ~250 ms delay (yuck!), , each of "host" processes may have ~1..2 "child" processes executing actual work. while having infinite loop 250 ms delay between iterations, actual useful work "host" application execute may appear every 10..15 seconds. there's lot of cycles wasted unne...

html - Controlling Menus within Internet Explorer with AutoIT -

i have been struggling on past 48 hours create script can basic things within internet explorer: log website select option dropdown menu select checkbox click "ok" button i have no problem logging website, cannot seem menus working once logged in. have feeling them being dynamically created html experience limited not know sure. have tried range of different functions(_ieformelementgetobjbyname,_ieformgetcollection,_ieformgetobjbyname) among others cannot seem make work. cannot post full script contains passwords cannot post publicly, here user/password removed: ;created syd-jamest code found at: ;http://solubletech.blogspot.com.au/2011/02/use-autoit-v3-to-make-auto-login-script.html #region ;*** variables const $dispatchsite = "https://equipmentrepaircas.interasset.com/cas/login?service=https%3a%2f%2fwww.iasdispatchmanager.com%2fdispatchmanager%2fj_acegi_cas_security_check" const $uname="user" const $pwd="pass%" #endregion #inc...

arrays - Convert Decimal to Binary in c++ with correct Bit Size -

i writing program takes in numbers entered user , stores them array. program convert values decimal , store in new array. having trouble converting binary value correct bit size. for example user enters 3 , 4 . program stores , converts them binary resulting in 11 , 100 . how can store 011 , 100 ? i believe i'll need convert char array or string of sort have no idea steps should follow. i think you’re trying this: void convert(int number, char *array, int bits) { int bit; (bit = 0; bit < bits; bit++) { if ((number & (1 << (bits - (bit + 1)))) > 0) { array[bit] = '1'; } else { array[bit] = '0'; } } }