Posts

Showing posts from September, 2011

git - Is there any way to get Phabricator to push diffs to a repository? -

our team has started experimenting using phabricator code reviews. apart phabricator, have test-system automatically builds , tests code pushed specific branch on our main git repo. there way arc diff automatically push diff specific branch? tests take couple of hours, , prefer if possible people review code while being tested. somehow integrated unit test not have complete before diff sent fo review? the purpose of arc diff allow tests/code review performed without landing code on branch. here through herald rules, harbormaster build plans, , jenkins. when diff created/updated, herald rule watching repo triggers harbormaster build plan triggers jenkins via http post request. try detail out basics but, recommend looking @ additional materials build process, if choose go route. please note - harbormaster listed "prototype". meaning, there limited support it. but, aside writing own custom code, there no other way i'm suggesting here. i hope have

java - Making the getX() and getY() methods to get the locations of the panel, not the frame -

i'm using getx() , gety() methods in mouselistener class location of panel, it's getting location of frame instead, , includes top of title bar , sides, it's not getting location want. have the: @override public dimension getpreferredsize() { return new dimension(300, 300); } method in paint class override frame when paint in graphics, , set paint location of x, , y, sets panel location, , not frame location, don't know how make mouselistener class same. please help. thanks. code mouselistener class: package events; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class events implements actionlistener, mouselistener, mousemotionlistener { static events events = new events(); int x; int y; public void actionperformed(actionevent e) { } public void mousepressed(mouseevent e) { } public void mousereleased(mouseevent e) { } public void mouseentered(mouseevent e) { } public

java - Generate a random interger within a case: in a Loop() -

i have functioning script game, uses java client. i trying generate random number upon loop each time case: comes up. public int onloop() throws interruptedexception { switch (getstate()) { case attack: entity seagull = npcs.closest("seagull"); if(seagull.exists()) { seagull.interact("attack"); sleep(random(1500, 2000)); } break; case attacking: int decide = random(1, 3); if(myplayer().isanimating()) { getskills().hoverskill(skill.strength); log("checking stats..."); sleep(random(1000, 9000)); }else if(decide == 3) { getmouse().moveoutsidescreen(); sleep(random(5000, 30000)); log("afking"); } break; here using generate random int: i

How to make a SignalR connection *after* the page loads and reconnect after timeout -

i have been using signalr while in current versions of chrome, ie , ios safari. i've noticed "spinner" indicates page loading continues spin. we doing further testing , seeing signalr connect running until times out. /signalr/connect?transport=serversentevents&clientprotocol=1.5&connectiontoken=xxxx&connectiondata="%"5b"%"7b"%"22name"%"22"%"3a"%"22chathub"%"22"%"7d"%"5d&tid=1 in older browsers, looks user if page has not finished loading. moreover, when connect times out, application stops working (or in cases throws error). i've been able reproduce tutorial ms in both version provided , after upgrading tutorial signalr 2.2.0 , jquery 2.1.3 via nuget here's link tutorial: http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr 1) there best practices making connection signalr such connection doesn't

javascript - angularjs ng-repeat determine what item is clicked -

im loading objects clickable boxes using ng-repeat . want return objects title when user has clicked item-box put in ng-model since im using ng-repeat model reused in every created box... i searching way check selected objects title. , put in ng-model re-use later on. code now: creation of object boxes in html: <div class="row form-group product-chooser"> <a href="#drop"> <div id="catagories" ng-repeat="catagories in main.catagories" class="col-xs-12 col-sm-12 col-md-4 col-lg-4" value="{{catagories.title}}"> <div class="product-chooser-item"> <img src="{{catagories.image}}" class="img-rounded col-xs-4 col-sm-4 col-md-12 col-lg-12" alt="catagories"> <div class="col-xs-8 col-sm-8 col-md-12 col-lg-12"> <span class="title">{{catagories.tit

java - How to see GHResponse on map by using GraphHopperWeb -

i trying use graphhopperweb in order see route response on web. not know how use it, don't wrong. using following code (in java) in order find path 1 point other point following: ghrequest req = new ghrequest(32.070113, 34.790266, 32.067103, 34.777861). setweighting("fastest") .setvehicle("car"); graphhopperweb gh = new graphhopperweb(); gh.load("http://localhost:8989/route"); gh.setinstructions(true); ghresponse response = gh.route(req); system.out.println(response); i following print screen: nodes:24: (32.07012,34.79021), (32.07011,34.7902), (32.07006,34.79019), (32.07028,34.78867), (32.07029,34.78852), (32.07029,34.78847), (32.06994,34.78814), (32.06942,34.78761), (32.06931,34.7875), (32.06912,34.78731), (32.06862,34.78667), (32.06756,34.78546), (32.06627,34.78391), (32.06617,34.78375), (32.06604,34.7836), (32.06622,34.78317), (32.06768,34.78009), (32.06769,34.77998), (32.06767,34.77992)

java - Jdbc sql syntax error for date -

resultset resultobj = statementobj.executequery("select employee_id job_history start_date > convert(datetime, '2001-01-13' )"); i error while iam executing program: java.sql.sqlsyntaxerrorexception: ora-00904: "datetime": invalid identifier if using oracle, use oracle syntax: select employee_id job_history start_date > date '2001-01-13'; the date keyword allows use iso-standard syntax date constants.

python - Is it possible to pass a list of numbers as argument using <? -

i wondering how pass , retrieve list of numbers script using syntax: python3 program.py < 1 2 3 4 i know can pass arguments using following syntax: python3 program.py 1 2 3 4 and retrieve arguments using sys.argv : print(sys.argv) # list of arguments i have seen around, reason not able it. note wondering if it's possible or not, not asking ways read standard input different first example above. you've misunderstood syntax of proposed command. here's simple python program prints out contents of standard input , command-line arguments: # program.py import sys print("stdin:", sys.stdin.read()) print("args:", sys.argv) ... , here's happens when call proposed syntax: $ python3 program.py < 1 2 3 4 stdin: content of file '1'. args: ['program.py', '2', '3', '4'] in other words, syntax redirects content of file '1' standard input, , supplies arguments '2',

android - Floating Action Button not working over ListView -

i have floating action button on listview, can't click on button when list fills button , list overlap. in situation list item clickable. how rectify issue? in advance. xml code below. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="3dp" android:paddingbottom="10dp" android:paddingleft="10dp" android:paddingright="10dp" android:paddingtop="10dp" card_v

Android-Java Point(android.graphics.point) in Point cannot be applied to (Double, Double) -

Image
i using arcgis solution current location of user. whenever want getlongitude , getlatitude gives error point cannot converted double. how solve problem? point curlocation; final spatialreference wm = spatialreference.create(102100); final spatialreference egs = spatialreference.create(4326); public void onlocationchanged(location location) { if (location == null) return; boolean zoomtome = (curlocation == null); curlocation = new point(location.getlongitude()); if (zoomtome) { point p = (point) geometryengine.project(curlocation, egs, wm); mmapview.zoomtoresolution(p, 5.0); } } a point takes 2 ints parameters. you're passing single double. can use pointf takes 2 floats, lose data. are using different library (arcgis comes in web search) uses custom point class? if so, make sure you're importing the correct version of point : import com.esri.core.geometry.point;

css - How do I force a table row to word-break? -

Image
i have following element hierarchy: and, here rendering: i want rid of horizontal scroll , replace word break (so, not split on word boundaries). what correct css settings enable this? if right, you're trying rid of scroll bar, maintain width , add word break .igv-popovervalue span span on right side. if can accomplish floating .igv-popovername left , .igv-popovervalue right , give them width fit on column side, this example <td class="igv-popover-td"> <div class="igv-popovernamevalue"> <span class="igv-popovername">name</span> <span class="igv-popovervalue">nup210l</span> </div> </td> and css .igv-popovername { float: left; width: 45px; } .igv-popovervalue { word-break: break-all; float: right; width: 45px; }

c# - Using RavenDb FilesStore from F# Interactive hangs -

i trying access ravendb file system f# script. i have code: #r "libs/raven.abstractions.dll" #r "libs/raven.client.lightweight.dll" open raven.client.filesystem let fs = new filesstore(url = "http://localhost:8080", defaultfilesystem = "testfs") let s = fs.initialize() printfn "%a" s.identifier if execute script using fsi on file or compiling script fsc runs , prints http://localhost:8080 expected if execute in f# interactive inside visualstudio hangs on fs.initialize() line now, if call initialize method false (ensurefilesystemexists) runs ok in interactive. why work this? this piece of filesstore.cs code : if (ensurefilesystemexists && string.isnullorempty(defaultfilesystem) == false) { try { asyncfilescommands.forfilesystem(defaultfilesystem) .ensurefilesystemexistsasync() .wait(); } catch(exception

.net - Can you load local content with awesomium or chromium using c#? -

using awesomium (or chromium), possible load content file system? maybe using ajax or other method? websites in awesomium/chromium, normal websites, operate in sandbox. means without user explicitly "giving" file, there no way access it. however, wpf application read such file , pass contents web page using awesomium control. you use calljavascriptfunction : jsvalue filetext = new jsvalue(filetext); webview.calljavascriptfunction("somemethod", filetext ); related (and got base of code from): calling javascript c# using awesomium if want go other way, see can call application methods javascript in awesomium?

grails - Gorm cascaded operations -

i'm trying understand gorm's cascaded deletion. default gorm behavior without modifiers. understand if owning instance of domain class owner owns several instances of owned domain class, when owner instance deleted, owned instances deleted well. if owned instances owned simultaneously 2 different owners , 1 owner deleted. owned instances not deleted because still owned other not deleted owner? edit: tried perform experiment (at least first part of it) did not achieve expected results. being newbie, i'm quite sure i'm doing wrong. don't know what. class maincontroller { def index() { // creating few instances of owned domain class def owneda = new owned(name: 'owned a') def ownedb = new owned(name: 'owned b') def ownedc = new owned(name: 'owned c') // make these instances belong instance of ownera // first create instance of ownera def ownera = new ownera(name: 'ow

ruby on rails - how to build a bootstrap popover in helper method for a view that will show a collection -

i create view show collection of objects rendered common partial template. template have helper method supposed return html code show link bootstrap popover containing list of each object addition attributes. going details, helper method def data_popover(status) title = session[:switch] ? status.order.sim_rev : order_status.order.logo_code content_for :details content_tag :dl, class: 'dl-horizontal' content_tag :dt, 'client' content_tag :dd, status.order.logo.client end end return link_to title, order_path(status), :rel => :popover, :data => { :delay => { show: 100, hide: 300 }, :no_turbolink => true, :trigger => "hover", :placement => "top", :html => true, :original_title => status.order.so, :content => content_for(:details) } end is not working expected. having trouble content_for :details block, not rendering correct

php - CodeIgniter: Include a controller outside the application environment -

so basically, load codeigniter controller contents outside codeigniter's environment, is, traditional php page. i have tried following doesn't suit requirements: <?php require('/application/controller/error?type=not_found'); ?> it gives following error: message: require(/application/controller/error?type=not_found): failed open stream: no such file or directory to clarify, i'm trying change default /application/errors/error_404.php page contents display custom http 404 error page i've built in "error" controller & view. the problem is, pages under /application/errors/ treated normal php pages codeigniter means can't use $this->load-view('error'); inside error_404.php page. i appreciate other suggestions ways create custom error pages in codeigniter. you should set 404 page in route.php page in application/config folder: $route['404_override'] = 'your-error-controller/your-error-view&#

c# - LINQ collapse multiple rows into List -

i have following objects manage sending emails groups: public class groupemailrecipients { public string groupname { get; set; } public list<emailrecipient> emailrecipients { get; set; } public groupemailrecipients() { emailrecipients = new list<emailrecipient>(); } } public class emailrecipient { public string email { get; set; } public string firstname { get; set; } public string lastname { get; set; } } i have table called groupcontacts contains: groupname | email | firstname | lastname name01 | john.smith@test.com | john | smith name01 | jane.doe@test.com | jane | doe name02 | bill.smith@test.com | bill | smith is possible create linq statement populates list<groupemailrecipients> groupcontacts table? the list<groupemailrecipients> populated as: first groupemailrecipients object: groupname = "name01" emailrecipients = { email= "john.smith@test.com", firstname="jo

ruby - Test presence of javascript code/snippet with rspec capybara (Rails 4) -

i'd create test make sure third party tools (js scripts) present (for example, make sure nobody in team removed accident!) here 2 javascript third party tool loaded on homepage view presence i'd test: <script type="text/javascript"> var clicky_site_ids = clicky_site_ids || []; xxxxxxxxxxxxxxxxxxxxxxxxx (function() { var s = document.createelement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//static.getclicky.com/js'; ( document.getelementsbytagname('head')[0] || document.getelementsbytagname('body')[0] ).appendchild( s ); })(); </script> <script src="//src.melvinize.io/r.js"></script> here rspec test (i'm using capybara webkit driver) describe "third party tools present inside source code", js: true 'should have js trackings' visit(root_path) all('script').find { |s| s[:src].match /getclicky\.js$/ }.shoul

javascript - Rails 4: Dynamically rendering a form on the same page with AJAX -

i seem having trouble finding information on how go dynamically presenting forms on same view. mean is, example, user clicks "add sub-element" link on show view "element", , presented small form adding sub-element, , of course same type of thing editing existing sub-elements, on same show view using ajax/js/jquery or something. i trying rest-in-place, no avail, have several nested objects (some within other nested objects), , doesn't seem work in-line-editing. i believe lack of information coming using incorrect search terminology, appreciated point me in right direction. thanks in advance. there lot of different ways it, 1 using remote forms, railscasts example or detailed answer on question . call controller jquery , render (similar code here): in javascript: $(document.body).on('click', '#user-list-body', function (e) { var url = '/get_user_list/ $.ajax({ url: url, datatype: 'html',

Coq case analysis and rewrite with function returning subset types -

i working simple exercise writing certified function using subset types. idea first write predecessor function pred : forall (n : {n : nat | n > 0}), {m : nat | s m = n.1}. and using definition give funtion pred2 : forall (n : {n : nat | n > 1}), {m : nat | s (s m) = n.1}. i have no problem first one. here code program definition pred (n : {n : nat | n > 0}) : {m : nat | s m = n.1} := match n | o => _ | s n' => n' end. next obligation. elimtype false. compute in h. inversion h. qed. but cannot workout second definition. trying write these definition program definition pred2 (n : {n : nat | n > 1}) : {m : nat | s (s m) = n.1} := pred (pred n). i managed prove 2 first obligations next obligation. apply (gt_trans n 1 0). assumption. auto. qed. next obligation. destruct pred. simpl. simpl in e. rewrite <- e in h. apply gt_s_n in h; assumption. qed. but last obligation stuck because when try case analysis return ty

Swift: How to resize UIView and keep contents centered? -

i have uiview ("myuiview") in viewcontroller ("mainview") has uilabel ("myuilabel") inside, centered vertically autolayout constraints. i'm animating uiview change height. originally, thought auto layout keep track of animation/change , keep uilabel centered, instead uilabel acts though constrained top of uiview. the uilabel isn't in animation code itself. code reference: uiview.animatewithduration(currentanimationtime, delay: 0.0, options: .curveeaseout, animations: { self.myuiview.frame = cgrectmake(0, self.mainview.frame.height * 0.2, self.mainview.frame.width, self.mainview.frame.height * 0.6 ) }, completion: nil) how can increase uiview's height , keep uilabel entered vertically? need add directly affects uilabel itself, or going resize (cgrectmake) wrong? i have had luck calling layoutifneeded on animated view inside animation. it preferable create outlet height constraint of view , set constant of constraint rat

python - How to support all REST operations for an endpoint in django rest framework -

i have subscription model looks this class subscription(models.model): name = models.charfield(max_length=100) quantity = models.integerfield(max_length=20) stripe_id = models.charfield(max_length=100) user = models.foreignkey(user) i create endpoint allows post, patch, delete, get so did following things views.py class subscriptiondetail(viewsets.modelviewset): serializer_class = subscriptionserializer permission_classes = (isauthenticated,) queryset = subscription.objects.all() serializers.py class subscriptionserializer(serializers.modelserializer): class meta: model = subscription fields = ('name','quantity', 'stripe_id') def update(self, instance, validated_data): print "in update" #how write create , delete? urls.py subscription = subscriptiondetail.as_view({ 'patch': 'update' }) url(r'^rest-auth/subscription/$', subscription, na

java - Generic vs wildcard unknown types -

when recommended do: public <e> boolean haspropertyx(list<e extends user> alist); versus public boolean haspropertyx(list<? extends user> alist); it appear both work well. without typed return value, difference can think of explicit typing of first way of declaration during method call. so example using inside typed class c<k extends string> list<v extends string> input = ...; boolean var = obj.hasproperty<k>(input); will raise compiler error. why 1 want so... nice question if answer both same.

java - com.badlogic.gdx.utils.Array parameters for Constructor -

public array (boolean ordered, int capacity, class arraytype) how call constructor? trying below array<float> red = new array<float>(false,1,float); gives me error on float, isn't float class? i think need float.class bud, returns object represents float class.

java - Sessions keep getting lost on mobile browsers -

currently, setting user sessions on java (with jsp on struts 2 framework) following code: httpsession session = request.getsession(true); sessionbean sessionbean = new sessionbean(); session.setmaxinactiveinterval(604800); sessionbean.setuserbean(userbean); session.setattribute("sessionbean", sessionbean); this session terminated when user explicitly logs out following code: httpsession session = request.getsession(true); session.removeattribute("sessionbean"); while sessions automatically expire after 1 week (604800 seconds) of user inactivity. the above works fine , dandy on desktop browsers. however, on mobile browsers (observed on iphone safari , android's default browser), session expires after page idle 30 minutes or more . i replicated problem following steps: opened page on iphone safari, left page idle , closed iphone safari (with still running in background). reopened iphone safari 30 minutes later. the page refreshed , when did so

objective c - iOS Framework build including Project headers when explicitly set as "Project" and not "Public" -

i have ios static library working on separate target called 'framework' handles build script package library .framework. however within last day or must have messed since there 5 or 6 private "project" headers getting included visible headers in framework. positive "headers" section includes proper headers in public , private sections. why xcode including project headers in framework build? how can fix it?

android - GLSL ERROR: No vertex attrib is enabled in a draw call -

i writing app android in opengl es 2.0 , have problem shader code. here is: attribute vec4 vposition; vec4 tempposition; void main() { tempposition = vposition; tempposition.x = 2 - tempposition.x; gl_position = tempposition.yxzw; } the line causes error one: tempposition.x = 2 - tempposition.x; i enabling , disabling vertex atrrib arrays each time want draw something. before draw call this: gles20.glenablevertexattribarray(sposition); , after drew call gles20.gldisablevertexattribarray(sposition); what doing wrong? how substract x 2? edit: if change line causes error this: tempposition.xz = vec2(2,0) - tempposition.xz; than works, why cant substract single number? in glsl version used es 2.0 (which mysteriously version 1.00), there no implicit type conversions. can't add value of type int value of type float , or vector of floats. this specified in introduction of chapter 4 "variables , types" of spec: the opengl es s

java - How to make multiple dependent TextBox on Dropdown value from database in jsp -

please need how make dependent textbox on dropdown value come form database in jsp. below code work fine 1 textbox.but don't know how make multiple dependent textbox.so me. thanks. tender.jsp: <% connection conn = null; statement st = null; resultset rs = null;* conn = jdbcconnectionutil.getconnection(); if(conn != null) { try { string woodsql = "select fsa_wood_type_master_wood_type, fsa_wood_type_master_wood_weight,fsa_wood_type_master_wood_length,fsa_wood_type_master_wood_width,fsa_wood_type_master_wood_standard_rate fsa_wood_type_master"; st = conn.createstatement(); rs = st.executequery(woodsql); } catch(sqlexception e) { e.printstacktrace(); } } %> <td> <select id="woodtype" onchange="populatewoodid();"> <%while(rs.next()){ %> <option value="<%=rs.getstrin

c++ - How to find n where k = 2^n -

this question has answer here: position of least significant bit set 21 answers if know integer k = 2^n , how can efficiently find n ? in other words, if know single bit in integer set, how can location of bit? an idea find hamming weight of k-1 there other simpler ways i'm not thinking about? bit twiddling hacks have lot of amazing (and obscure, performance oriented) bit hacks. best 1 use seems using multiply , lookup. unsigned int v; // find number of trailing zeros in 32-bit v int r; // result goes here static const int multiplydebruijnbitposition[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; r = multiplydebruijnbitposition[((uint32_t)((v & -v) * 0x077cb531u)) >> 27]; this page provides detailed analysis of problem focus on chess prog

android - Collapse on Scroll with Recycler View -

i using collapse on scroll library , have replaced list view recycler view, not scroll although header effects working. how make recycler view scrollable can have example recycler view touch/ scroll events implemented? try library https://github.com/h6ah4i/android-advancedrecyclerview , guessing should give looking in terms of functionality , can read through library's code.

Client-side authentication with google+ for iOS on azure mobile service backend -

i'm trying integrate server-side side google+ sign-in ios app. this did: func application(application: uiapplication, openurl url: nsurl, sourceapplication: nsstring?, annotation: anyobject) -> bool { return gppurlhandler.handleurl(url, sourceapplication: sourceapplication, annotation:annotation) } // in view controller @iboutlet weak var gploginview: gppsigninbutton! googleplus = gppsignin.sharedinstance() googleplus.shouldfetchgoogleplususer = true googleplus.clientid = "client-id" googleplus.homeserverclientid = "home-client-id" googleplus.scopes.append(kgtlauthscopepluslogin) googleplus.delegate = self; func finishedwithauth(auth: gtmoauth2authentication!, error: nserror!) { if error != nil { println("[googleauthentication] error: \(error)") } else { var servercode = gppsignin.sharedinstance().homeserverauthorizationcode if servercode == nil {

properties - Truncating takes too much time hsqldb -

i use hsqldb 2.3.2 , i've got following issues: my database has cached table 10 000 000 records without constraints , indexes. size ~900mb. turn off autocommit mode , when try execute "truncate table tablename", execution hangs dbname.backup growing. , here's why: trace engine:? - copyshadow [size, time] 2246252 9721 trace engine:? - setfilemodified flag set trace engine:? - cache save rows [count,time] totals 24801,9921 operation 24801,9921 txts 96 trace engine:? - copyshadow [size, time] 4426920 7732 trace engine:? - cache save rows [count,time] totals 49609,17775 operation 24808,7854 txts 96 trace engine:? - copyshadow [size, time] 6574796 9024 it takes 1500-2000 seconds , can either empty table or exception this: tests run: 0, failures: 0, errors: 0, skipped: 0, time elapsed: 1,525.509 sec org.apache.maven.surefire.util.surefirereflectionexception: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.i

excel - How to use VLOOKUP result as COUNTIF criteria -

i want able determine how many times person's particular id (e.g. #123 ) has appeared in separate column (e.g. column c ) given name (e.g. bob ). i have: let column consist of several names. ( bob ) let column b consist of ids relating person's name. ( #123 ) let column c consist of same ids, may contain duplicates of ids (might have 3 #123 s) the ids side-by-side each person's respective name. how can use result of vlookup criteria (second argument) of countif function? if use vlookup separately returns correct value i'm trying count. =vlookup(bob, column a:column b, 2, false) return #123 if use countif separately returns correct count value well. =countif(column c, #123 ) return 3 i've tried =countif(column c, vlookup(bob, column a:column b, 2, false)) returns 0 . i've tried referring criteria countif separate cell vlookup formula still returns 0 . so seems stops working when combine 2 together. might problem be, ,

asp.net - Microsoft Owin OAuth 1.0 -

all examples included in microsoft.owin.security.* packages oauth 2.0. trying build provider oauth 1.0, specifically, bitbucket. can provide me pointers, examples, implementations, or tell me if it's possible microsoft's library acceptable effort?

eclipse - The import com.google.android.gms.common.GooglePlayServicesClient cannot be resolved -

when update google play service error message: the import com.google.android.gms.common.googleplayservicesclient cannot resolved and imported new google play service , no thing changed it's obsoleted, , please use googleapiclient instead.

mysql - SQL query to identify pairs with duplicates -

i'm trying write query pair impressions , conversions same ip address in database. have table of impressions , ip addresses, , impression can of type 'view' or 'conversion' (defined in column 'name'). so basically, need identify groups of records same ip address, contain both view , conversion. after hour of googling i've got far below, isn't far should give idea of objects involved: select ip_address, name, count(1) cnt impressions group ip_address, name; can advise on best way this? you need use having clause conditional count. need remove name group by treat 2 different types separately. select ip_address, count(case when name = 'view' 1 end) views, count(case when name = 'conversion' 1 end) conversions, count(1) cnt impressions group ip_address having count(case when name = 'view' 1 end) > 0 , count(case when name = 'conversion' 1 end) > 0;

Java MigLayout - help getting it up and running -

i've spent night trying accomplish thought simple task. i use latest version of miglayout , believe 5.1 @ point settle 4.2, project i'm doing school. it seems can not find correct file (.jar) download because think correct 1 never works when use in project. fyi using netbeans 8.1 , know how go project properties , add .jar file library. it seems closet i've managed working library turned out empty classes. had class names functionality stripped out. guess demo library? snapshot? i have searched night long installing/ initializing miglayout in project , not find single video or document remotely called tutorial on how miglayout , running. can me out? need spoon feed on 1 step. once have working library i'm go. easiest solution use dependency management system maven or ivy. not using such thing can find correct jars: maven repo miglayout . pom.xml files tell dependencies need. i guess writing swing application , need swing version: miglayout swing

android - Contents in ListView not centered -

Image
my app retrieves user details db , displays in listview. contents displayed in listview not formatted properly. this how layout rendered: this layout file activity: <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:background="#000000" android:paddingbottom="16dp" android:paddingleft="16dp" android:paddingright="16dp" android:paddingtop="16dp" tools:context=".leaderboard" > <linearlayout android:id="@+id/column" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <textview android:id="@+id/column_header1"

pointers - How to pass objects to functions in C++? -

i new c++ programming, have experience in java. need guidance on how pass objects functions in c++. do need pass pointers, references, or non-pointer , non-reference values? remember in java there no such issues since pass variable holds reference objects. it great if explain use each of options. rules of thumb c++11: pass by value , except when you not need ownership of object , simple alias do, in case pass const reference , you must mutate object, in case, use pass non- const lvalue reference , you pass objects of derived classes base classes, in case need pass reference . (use previous rules determine whether pass const reference or not.) passing pointer virtually never advised. optional parameters best expressed boost::optional , , aliasing done fine reference. c++11's move semantics make passing , returning value more attractive complex objects. rules of thumb c++03: pass arguments by const reference , except when they changed inside

javascript - Is it bad to execute a jQuery script on an event that doesn't always happen? -

i have page may or may not have alerts like: <div class="alert">some alert</div> and hiding them after 5 seconds with: <script type="text/javascript"> $(document).ready(function () { window.settimeout(function() { $(".alert").fadeto(1500, 0).slideup(1500, function(){ $(this).remove(); }); }, 5000); }); </script> so i'm wondering, should put alert hiding function general functions executed when page loads , if there no alert hide? or put in html code right below actual alert div code happens when alert shows? the upside of first option code more organized. downside may execute if there no alert. the upside of second option executes when alert shows, downside code messier. which better? there's nothing bad more efficient removing settimeout : $(".alert").delay(5000).fadeto(1500, 0).slideup(1500, function(){ $(this).remove(); }); this way, nothing done, , no call

Is it a good thing to write logic based on the hex value of id generated in R.java android -

this have seen in android application. have number of image buttons ids r.java : public static final int img1=0x7f090080; public static final int img2=0x7f090081; public static final int img3=0x7f090082; public static final int img4=0x7f090083; public static final int img5=0x7f090084; public static final int img6=0x7f090085; public static final int img7=0x7f090086; public static final int img8=0x7f090087; in 1 of activity traversing loop below: for (int = 0; < noofbuttons; i++) { if (i == pos) { ((imageview) vi.findviewbyid(r.id.img1 + i)).setimageresource(r.drawable.circular_pagination_red); } else { ((imageview) vi.findviewbyid(r.id.img1 + i)).setimageresource(r.drawable.circular_pagination_brown); } i want know how safe , advisable is. 1 thing working absolutely fine. been part of months , never seen problem in logic. still irks me bit. note : not getting error , know alternate s

python 2.7 - Error in exponential PDF -

i need complete function exponentialpdf error: 'indexerror: index 0 out of bounds axis 0 size 0' the function looks this: def uniformpdf(x,a=0.0,b=4.0): p = 1.0/(b-a)*ones((len(x),)) p[x<a] = 0.0 p[x>b] = 0.0 return(p) def exponentialpdf(x,a=1.0): """ call: p = exponentialpdf(x,a) input argument: vals: float (array) output argument: p: float (array) examples: in[1]: exponentialpdf([1,2],3) out[1]: array([ 0.14936121, 0.03332699]) """ p = * exp(-a*x) p[x<0] = 0.0 return(p) can me error? sounds list passing in function empty. read python lists , see following post: indexerror: list assignment index out of range i found function works using numpy array, e.g. p = exponentialpdf(np.array([1,2]),3). hope help, should check out homework post , ask again if you're still stuck. edit: using numpy, add explicit convert numpy array in function follows: def exponentialpdf(x

c++ - Modern high res timer for periodic calls -

a huge amount has been said high resolution timers on stackoverflow. it's clear solution bit of moving target , best practices changing. i need create high resolution timer has callback every 10ms achieve consistent 100hz. target platform windows 7 , later. this exact question asked in 2009 , believe things have moved on. multimedia timers looked great solution, msdn says depreciated , replaced createtimerqueuetimer. other answers on stackoverflow suggest createtimerqueue timer not accurate timesetevent. all answers consistently point out requirement setting windows timer resolution low value using timebeginperiod. so said, best approach achieve above desired goal in c today . but msdn says depreciated it pretty important able read between lines when see deprecation warning this. yes, microsoft stop using multimedia timers. heavily abused , bad business. getting programmers stop using them pipe dream, createtimerqueuetimer() not alternative. bad b

rabbitmq - Running rabbitmqadmin in docker fails -

i cant rabbitmqadmin work in rabbitmq docker. i have dockerfile: from rabbitmq:3-management run apt-get update && apt-get install -y python add rabbitmqadmin /usr/local/bin/rabbitmqadmin add rabbitconf.json /rabbitconf.json run chmod 755 /usr/local/bin/rabbitmqadmin cmd ["/usr/local/bin/rabbitmqadmin -q import /rabbitconf.json"] build this: docker build --tag=myrabbit . run this: docker run -d -p 8080:15672 myrabbit it not work... log shows: /docker-entrypoint.sh: line 8: /usr/local/bin/rabbitmqadmin -q import /rabbitconf.json: no such file or directory what doing wrong ? br you've mixed shell , exec formats cmd instruction. cmd /usr/local/bin/rabbitmqadmin -q import /rabbitconf.json should work. for more information see http://docs.docker.com/reference/builder/#cmd . i'll leave following else debugging similar problems: the parent image rabbitmq:3-management declares entrypoint runs docker-entrypoint.sh s

java ee - WAR: Should web pages be inside WEB-INF directory or out of it -

Image
java ee 7 documentation https://docs.oracle.com/javaee/7/tutorial/packaging003.htm suggest web pages should out side of web-inf directory while of times see them in places root/web-inf/view or root/web-inf/jsp etc. could body describe strategy should followed , not? i recommend pages stored under web-inf. if they're outside may open security hole. web container protects web-inf users not able access contents unless application directs them there. aligned web (java) frameworks when resolve views , generate actual web contents. storing plain view files outside web-inf may work (for example if serve plain html or old school jsp files) may alleviate processing web layer does. best keep view files (not pages!) inside web-inf , have web framework (jsf, spring mvc, struts, ...) deal them.

client - Cannot resolve com.google.android.gcm.GCMBaseIntentService; Android studio -

edit: solved problem:) cause of error : in tutorial implementing gcm client , there link download full source code demo. downloaded reference , added google_play_service library in build.gradle. did recommended changes sender_id,server_url,.. etc synch project gradle , got error. how solved! after lot of google found class not in google_play_service library in gcm.jar deprecated now. dont know why google has given link old code , explained latest code in document. then include gcm.jar and error gone, got push notification:) hope got in trouble! my old question i new android studio. dont understand build.gradle. today implementing gcm-demo-client following instructions given here https://developer.android.com/google/gcm/client.html when import suggested open source code got below errors. /home/shani/desktop/gcm-76908409d9d5/samples/gcm-demo-client1/app/src/main/java/com/google/android/gcm/demo/app/gcmintentservice.java:28: error: cannot find symbol import

Using StringSets Amazon DynamoDB Android -

i have android application uses amazon dynamodb. table of users this: @dynamodbtable(tablename = const.test_table_name) public static class user { private int userid; private string username; private string password; private string email; @dynamodbhashkey(attributename = "userid") public int getuserid() { return userid; } public void setuserid(int userid) { this.userid = userid; } @dynamodbattribute(attributename = "username") public string getusername() { return username; } public void setusername(string username) { this.username = username; } @dynamodbattribute(attributename = "password") public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } @dynamodbattribute(attributename = "email") public string getemail() { return email;