Posts

Showing posts from February, 2014

unit testing - TDD - How to test .Read() without .Write()? -

we're trying use tdd create our system , we've come situation can't figure out right tdd course of action is. we've hidden file io behind interface so: public interface ifileio { byte[] read(string filename); void write(string filename, byte[] data); } and we're creating inmemoryfileio can use in place of real systemfileio class we'll use production. we want make sure inmemoryfileio works correctly , there may cases want use in lieu of actual file system, should "production quality". the question is, doing "right tdd way", how can create test either .read() or .write() don't depend on each other? in order test .read() worked correctly, have needed made call .write() first, , similarly, test .write() works correctly need call .read() afterwards. doing this, we've created same test twice (arrange, write, read, asserts). lets have 2 tests, 1 tests .read() , 1 tests .write() . if either of functions doe

c# - Get nodes from xml files -

how parse xml file? <?xml version="1.0" encoding="utf-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>link</loc> <lastmod>2011-08-17t08:23:17+00:00</lastmod> </sitemap> <sitemap> <loc>link</loc> <lastmod>2011-08-18t08:23:17+00:00</lastmod> </sitemap> </sitemapindex> i new xml, tried this, seems not working : xmldocument xml = new xmldocument(); //* create xml document object. xml.load("sitemap.xml"); xmlnodelist xnlist = xml.selectnodes("/sitemapindex/sitemap"); foreach (xmlnode xn in xnlist) { string loc= xn["loc"].innertext; string lastmod= xn["lastmod"].innertext; } the problem sitemapindex element defines default namespace. need specify namespace when select nodes, otherw

Creating an alternating dictionary with a loop in Python -

i'm trying create dictionary loop, alternating entries, although entries not need alternating, long in dictionary, need simplest solution them in 1 dictionary. simple example of i'm trying achieve: normally, creating dictionary loop this: {i:9 in range(3)} output: {0: 9, 1: 9, 2: 9} now i'm trying follwing: {i:9, i+5:8 in range(3)} syntaxerror: invalid syntax the desired output is: {0:9, 5:8, 1:9, 6:8, 2:9, 7:8} or, output fine, long elements in dictionary (order not matter): {0:9, 1:9, 2:9, 5:8, 6:8, 7:8} the context i'm using theano.clone(cloned_item, replace = {replace1: new_item1, replace2: new_item2}) where items want replace must given in 1 dictionary. thanks in advance! comprehensions cool, not strictly necessary. also, standard dictionaries cannot have duplicate keys. there data structures that , can try having list of values key: d = {} d[8] = [] in range(3): d[i] = 9 d[8].append(i)   >>> d {8: [0, 1,

Javascript Failing to Correctly Compare Two Strings -

i first create list of characters, , save 2 of them strings dependent on user input. unsure issue lies copied full code here https://jsfiddle.net/mboguslaw97/6w6xj1f3/3/ . top left card , 1 2 below both 'l's. click card after activate alert statements. var letters = 'abcdefghijkl'.repeat(2).split(''); user_input = 11; cards_flipped.push(user_input); user_input = 23; cards_flipped.push(user_input); letter1 = letters[cards_flipped[0]]; letter2 = letters[cards_flipped[1]]; alert(letter1 == 'l'); alert(letter2 == 'l'); alert(letter1 == letter2) //alerts true, true, false could please explain me how detect if strings equal , why strings cannot compare way? console.log(typeof letter1, letter1 instanceof array); object true letter1 , letter2 both single value arrays. reason either of them "equals" letter 'l' because of type conversion: tostring() method being called on array when comparing string literal. if compar

java - log4j2 + slf4j configuration for JDBC connection -

Image
i'm new log4j , i'm having hard time getting started. have decided use log4j2 in project , started replacing apache shiro's logging implementation jcl log4j2. i managed work on console, not on jdbc. database connection works nulls inserted. literal values work, not patterns. pom.xml <!-- logging api + implementation: --> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.12</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-slf4j-impl</artifactid> <version>2.3</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-api</artifactid> <version>2.3</version> </dependency> <dependency>

sql server - Simplify Row Values in SQL Output -

Image
i have sql code (abridged) select replace(replace(replace(replace(dbo.identity_map.name,'my company\',''),'-vlan2',''),'.vlan2\',''),'.instr\','') site, count (case when dbo.sem_agent.agent_version '11.%' , dbo.sem_computer.operation_system 'windows%' 1 ............ group replace(replace(replace(replace(dbo.identity_map.name,'my company\',''),'-vlan2',''),'.vlan2\',''),'.instr\','') order site my output looks this but wish this, row values corresponding site '7' summed, etc i believe regex help, because ^\w+(?:\s+\w+)?\\|[a-z].*$ would isolate number after '\' but when attempt replace statement regex select replace(replace(replace(replace(replace(dbo.identity_map.name,'my company\',&

excel - One to many relationship to fetch values in an alternate rows -

i trying fetch dates sheet1 common id (there multiple occurrences in sheet1) using array formula in cell (then dragging right side have dates belong specific id): =if(columns($e2:e2)<=$d2,index(sheet1!$b$2:$b$13,small(if(sheet1!$a$2:$a$13=sheet2!$a2, row(sheet1!$a$2:$a$13)-row(sheet1!$a$2)+1),columns($e2:e2))),"") but, whenever try insert 1 column (for counting purposes) in b/w columns, formula doesn't work. can't figure out issue, appreciate help? thank you. assuming first formula in e2, , cells in row 2 of newly-inserted columns blank, replace 2 instances of: columns($e2:e2) in formula in e2 with: count(1/len($d2:d2)) as way of explanation, take formula in f2, part be: count(1/len($d2:e2)) (the part having changed naturally being end range reference.) and let's assume 3 new columns inserted left of column e, means e2, f2 , g2 blank, h2 contain entry in e2, and, formula in i2, above part be: count(1/len($d2:h2)) clearly wish

c# - Outlook add-in failed to read attachment path -

i trying obtain attachment path before mail sent outlook. when try so, result null . here code: public partial class thisaddin { private void thisaddin_startup(object sender, system.eventargs e) { application.itemsend += new outlook.applicationevents_11_itemsendeventhandler(application_itemsend); } void application_itemsend(object item, ref bool cancel) { outlook.mailitem mail = item outlook.mailitem; var atts = mail.attachments; foreach (outlook.attachment attachment in atts) { messagebox.show(attachment.pathname); // pathname null ! } } private void thisaddin_shutdown(object sender, system.eventargs e) { } } the user creates new mail , adds attachments on hard-disk. how can obtain path information of chosen files ? that information not stored in outlook. on low level (extended mapi) attachment not have come file. imagine file dragged outlook message - there no physic

excel - Return output in separate cells (2) -

same issue as: return output in separate cells i trying use the solution suggested alexp , doesn't work. error message saying "expected )" in line: my_location = left(loc.cells(vlocs(v, 2), 1), len(loc.cells(vlocs(v, 2), 1), 1) - 2)

Localhost Apache server unavailable for devices connected over LAN -

i have apache server hosted on laptop, devices able connect , cannot connect because resource unavailable. devices on wifi network run netgear n600 router. same device connected 10 minutes ago says not able find resource. why happening?

ruby on rails - Where does ActiveRecord::Associations::CollectionProxy get the .each instance method? -

let's have models topics , posts, topic has_many :posts , post belongs_to :topic. have stuff in database @ point. if go rails console , type topic.find(1).posts i believe collectionproxy object. => #<activerecord::associations::collectionproxy [#<post id:30, ......>]> i can call .each on enumerator object. => #<enumerator: [#<post id: 30, ......>]:each> i'm confused how collectionproxy handling .each. realize it's inherited @ point i've been reading api docs , don't make clear collectionproxy inheriting unless i'm missing obvious. this page doesn't seem tell me much, , neither this page . activerecord::associations::collectionproxy is inherited relation , , relation forwards each , many other methods to_a . from activerecord/lib/active_record/relation/delegation.rb#l45 delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to_ary, :join, to: :to_a see understandi

internet explorer - Remote debug WP8 Cordova app like Android or iOS? -

is possible remote debug cordova application easy android (in chrome) or ios (in safari)? i don't need c# debugger in visual stuido, need webview remote debugger. did not find option in internet explorer. no, not easy android or ios. however, can still remote debugging work far ideal. check out weinre . allows debug windows phone 8 app inserting javascript library in html pages.

c - segmentation fault (dumped core) -

i tried run following program got error message "segmentation fault (dumped core)" my code: #include <stdio.h> #include <stdlib.h> #include "serialsource.h" int main() { file *pfile; char *filename="/home/menen/datafiles/t2.txt"; pfile=fopen(filename, "r"); if (pfile == null) { printf("can not open file /home/menen/datafiles/t2.txt"); exit(1); } int i; char ch; char val[4]; for(i=0 ;i<10;i++) { int count=0, j=3; ch=getc(pfile); while (ch != '\n') { count++; if (count>=62) { val[j]=ch; printf("%c ", val[j]); j--; } ch=getc(pfile); } putchar('\n'); } fclose(pfile); exit(0); } can me finding issue in code? in case, val[j]=ch; with unbound value decrement of j , can go - ve, , acces

excel - Prices based on quarter returned -

Image
i using table below pricing individual using excel . using formula below see today's date , month , give quarter month in. information on sheet one. formula, =roundup(month(today())/3,0) , returns quarter in. know if match number retuned can match number above month range , pick price. changed automatically. table 1 | |price sudtent | ac | pricr sudtent | mc | pricr table 2 | 2 | 3 | 4 | 1 | from| april june | july sept | oct dec |jan march student | ac | 130 | 97.50 | 65.00 | 162.50 student | mc | 180 | 135.00 | 90.00 | 225.00 to quarter (e.g. ³⁄₁₂ of year) divide 4 , not 3. =roundup(month(today())/4, 0) 'alternate =ceiling(month(today())/4, 1) an index / match function pair can provide return pricing data matrix if supply bo

Unable to communicate with bluetooth devices on Android -

is there return code "unable communicate ..." bluetooth devices can catch somehow handle these occasions? i building bluetooth handling activity pair/unpair, in occasions if discoverable device unreachable message(toast) system(android) , want able handle somehow.

How to pull cell values from Excel document into HTML table with VBA Macro with ForEach Loop -

i'm looking create excel macro vba generates html table weekly webpage update. table quite large , several of table cells link values. research has lead me far. sub export_ab_table() each row in rows vala = ("a" & activecell.row) valb = ("b" & activecell.row) valc = ("c" & activecell.row) vale = ("e" & activecell.row) valg = ("g" & activecell.row) vali = ("i" & activecell.row) tablehtml = "<body><tbody>" tablehtml = "<tr><td>" vale tablehtml = "</td><td>" vala valb tablehtml = "</td><td>" val tablehtml = "</td></tr>" tablehtml = "</tbody></body>" next table_cell end sub i'm wanting run through 6 column table and, each row, pull out several table cell values, inserting them html table row

c - Precedence of operators in infix to postfix conversion -

i'm creating program in c converts expression in infix form postfix form using reverse polish algorithm through stack implementation. however, i'm having trouble how incoming token having same precedence topmost element of stack should placed. example, given infix form: (a+b-c/d+e^f^2), postfix form should be: ab+cd/-ef2^^+. however, program outputs: ab+cd/-ef^2^+. think problem lies part of code: while(priority(token) <= priority(top_elem(&s)) && !isstackempty(&s)){ x = pop(&s); printf("%c", x); } push(&s, token); by way, part executes operator tokens ('+', '-', ' ', '/', '^) , open parenthesis. priority function returns 0 open parenthesis, 1 '+' , '-', 2 ' ' , '/', , 3 '^'. i wondering should change in program. executes fine other inputs, though. you have problem of associativity: while (a * b) * c == * (b * c) holds true, same not hol

c# - Is AesCryptoServiceProvider.GenerateKey safe to use? -

maarten bodewes ' comments on this question , suggest aescryptoserviceprovider.generatekey() unsafe use key generation. we using method generate cryptographically secure keys. looking @ underlying implementation on reference source , generatekey() calls cryptgenkey in win32 api. i cannot find resources suggest cryptgenkey compromised. safe use implementation? generatekey safe, implementation on linked question not. you can not call key = system.text.encoding.ascii.getstring(provider.key); string random byte array, getstring can not used on random binary data used on byte array generaded calling ascii.getbytes . if want store key in string format need use formatting designed store binary data key = convert.tobase64string(provider.key);

How can i set proxy using selenium webdriver with browser HtmlunitDriver for Java? -

my name leo , java bot developer, using selenium webdriver , browser htmlunitdriver headless, question title says: know how set proxy using firefoxdriver don't wanna use ui browser because it's slow execute, so, searching in google , page don't found similar, if know how open url proxy using htmlunitdriver, please answer useful me, thanks. i using firefoxdriver, wanna same htmlunitdriver. org.openqa.selenium.proxy proxy = new org.openqa.selenium.proxy(); proxy.sethttpproxy("198.2.202.49:80") .setftpproxy("198.2.202.49:80") .setsslproxy("198.2.202.49:80"); desiredcapabilities cap = new desiredcapabilities(); cap.setcapability(capabilitytype.proxy, proxy); webdriver driver = new firefoxdriver(cap); this answer own question, method "@raghav n" told me, lot! :d (y) i , work perfectly, , can tested because open www.find-ip.net , scrapped proxy active, , same put. here code working, if

vb.net - random number generator without repetaion -

i new programming. making application in vb.net . want on loading of particular form, random number generated 1 or 2 or 3 . when form loaded 2nd time, random number generated 1, 2 or 3 different generated earlier. , when form loaded 3rd time, random number generated 1, 2 or 3 different previous 2 times, i.e. no repetition of random numbers. for example if on first time form load, random number 3, second time should either 1 or 2. , if second time form load rn 2, third time form load should 1. i thankful if me in writing code in vb.net. you can next random list , remove can't picked again. dim rndlist new list(of integer) {1,2,3} static rnd new random until rndlist.count = 0 'get index random dim nextvalue integer = rnd.next(0, rndlist.count)) 'this value @ index debug.write(rndlist(nextvalue)) 'remove item rndlist.removeat(nextvalue) loop

How to use ng-filter Json [@attributes] using Angularjs? -

i'm trying filter sports feed using sports id. json feeds @attribute based feed. json feeds series: [ { @attributes: { id: "cdf590b4-0206-45b0-9122-20eae46a2b27", name: "pakistan tour of sri lanka, 2015", year: "2015" }, match: [ {}, {}, {}, {} ], comment: [] }, { @attributes: { id: "324e971e-2044-4fa6-bdb2-0c47c99da64e", name: "south africa tour of bangladesh, 2015", year: "2015" }, match: [ {}, {}, {}, {} ], comment: [] }, my controller --so controller code.-- $http.get('http://example.com/cricket.php').then(function(response) { $scope.sports = sports; $scope.whichsports = $state.params.id; } this view filter code <ion-item ng-repeat="sport in sports | filter: { id : whichsports }"> so please me.! advance thanks. probably $scope.sports = sports; should instead $scope.sports = response; and in ng-repeat sport attr

c# - Google Maps javascript code-behind visual studio -

i have javascript code in c# file code-behind: string markers = @"var address = '" + txtlocal.text + @"'; geocoder.geocode( { 'address': address}, function(results, status) { map.setcenter(results[0].geometry.location); var marker = new google.maps.marker({ map: map, title: address, position: results[0].geometry.location }); });" ; literal1.text = @" <script type='text/javascript'> function initialize() { geocoder = new google.maps.geocoder(); var mapoptions = { zoom: 15, maptypeid: google.maps.maptypeid.hybrid }; var map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions);" + markers + @" } </script>"; i have piece of code in .aspx file: <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=aizasybf-_ruujxittvou3e0swutod8lu3bzkpi"></script>

machine learning - How to use weak learners in Adaboost? -

i'm using adaboost , here question weak learners. in adaboost algorithm, follows, in step (2), can use different algorithms? example, when k 1, use knn, if k=2, svm used , k=3, use decision tree? or, should use single algorithm in k iteration of for loop? (1) initialize weight of each tuple in d 1=d; (2) = 1 k // each round: (3) sample d replacement according tuple weights obtain di ; (4) use training set di derive model, mi ; (5) compute error.mi/, error rate of mi (eq. 8.34) (6) if error.mi/ > 0.5 (7) go step 3 , try again; (8) endif (9) each tuple in di correctly classified (10) multiply weight of tuple error.mi/=.1ô€€€error.mi//; // update weights (11) normalize weight of each tuple; (12) endfor adaboost used week learners, short decision trees. can use more complicated learners in case adaboost might not best choice combine results. most implementations (like scikit learn adaboostclassifier ) assume using same learner each step, shouldn't difficult ch

android - Gradle sync Error:Configuration with name 'default' not found -

i want add external library guillotinemenu-android in application. followed steps given in upvoted answer existing question how add library project android studio? facing error when try build project after step 6 i.e. when added dependency in app/build.gradle compile project(":guillotinemenu") . tried stackoverflow links related error not working out. have made folder named libs in app directory , copied project folder guillotine menu there. here build.gradle(module:app) file apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.sunshine.bbreaker.appet_i" minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.p

python - Django 1.8 File Upload Example -

i’m new django development platform. have been struggling create basic file upload app in django 1.8.2 (latest version). not find up-to-date example/snippet. appreciate if post here or refer me minimal complete (model, view, template) example code so. i’ve observed many other examples online notice version not have media_root or media_url attributes default. example: media_root = '/path/to/myproject/media/' media_url = '/media/' here models.py page from django.db import models # create models here. class test(models.model): first_name = models.slugfield() last_name = models.slugfield() email = models.emailfield() timestamp = models.datetimefield(auto_now_add = true, auto_now = false) updated = models.datetimefield(auto_now_add = false, auto_now = true) def __unicode__(self): return self.email here forms.py page from django import forms .models import test class emailform(forms.form): first_name = forms.charfield(required=false)

c# - IEventProcessor not reading from Event Hub -

i working through implementing event hub reader using eventprocessorhost , simple ieventprocessor implementation. have confirmed telemetry data being written event hub using paolo salvatori's excellent service bus explorer . have configured eventprocessorhost use storage account leases , checkpoints. can see event hub data files in storage account. problem seeing @ point ieventprocessor implementation not appear reading event hub. i not receiving exceptions. test console app connecting storage account without issue. have noticed logging statement added constructor never being called, looks receiver never being created. feel missing simple. can me determine have missed? thank you! ieventprocessor implementation: namespace receiver { internal class simpleeventprocessor : ieventprocessor { private stopwatch _checkpointstopwatch; public simpleeventprocessor() { console.writeline("simpleeventprocessor created");

cocoa - Can I change the NSSegmentedControl popup menu position? -

Image
i using 3 segment nssegmentedcontrol adding , removing configurations, cog "action" symbol pop menu. however, when menu pops shows follows: i prefer popup displayed centered above cog segment instead below , sticking off bottom of window (which preference pane). i have created subclass of nssegmentedcell override 'action' method described in this answer . i prefer avoid private apis if @ possible!

go - Implicit private function import? -

how main.go able use buildindexmapping ? the function not uppercased how publicly accessible within package , without explicit import of mapping.go ? main.go : https://github.com/blevesearch/beer-search/blob/721fab2198a52d919133df08058fde8043bab365/main.go#l55 mapping.go : https://github.com/blevesearch/beer-search/blob/721fab2198a52d919133df08058fde8043bab365/mapping.go#l19 both in same package. in go import packages, not files, private function available.

ios - Upload a single video file to server -

i want upload video webservice server. video take uiimagepicker here code uiimagepicker:- - (ibaction)btn_select:(id)sender { uiimagepickercontroller *imgpicker=[[uiimagepickercontroller alloc]init]; imgpicker.delegate=self; imgpicker.sourcetype=uiimagepickercontrollersourcetypesavedphotosalbum; imgpicker.mediatypes = [[nsarray alloc] initwithobjects:(nsstring *)kuttypemovie,nil]; [self presentviewcontroller:imgpicker animated:yes completion:nil];} - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { [picker dismissviewcontrolleranimated:yes completion:nil]; // dismiss image picker view controller nsstring *mediatype = [info objectforkey:uiimagepickercontrollermediatype]; if ([mediatype isequaltostring:(nsstring *)kuttypemovie]) { nsurl *mediaurl = [info objectforkey:uiimagepickercontrollermediaurl]; mpmovieplayercontroller *movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:mediaurl

javascript - flot pie chart data with hh:mm format -

i have data flot pie chart in h:m format. normally if give data in following format shows pie chart properly var data = [ {label: "data1", data:10}, {label: "data2", data: 20}, ]; but if instead of int/double directly give data hh:mm format dont anything var data = [ {label: "data1", data:10:30}, {label: "data2", data: 20:20}, ]; my question is without converting h:m plain int/double value there other way show h:m in flot pie chart? if no conversion better this? flot can not automatically unterstand time values, have convert them e.g. minutes. can use labelformatter function show values of pie slices in original format. this: $(function () { var data = [{ label: "data1", data: '10:30' }, { label: "data2", data: '20:20' }, ]; (var = 0; < data.length; i++) { var hours = parseint(data[i].data.split(':

google spreadsheet - Conditional search for a DOCS spreasheet -

i'm working 2 sheets in docs, want bring name of product(column 1) 1 sheet another(also in column 1) if has value in column(column 2), "published" tried use several formulas, if keep spaces between published , non published products, script need, suggestions ? are 2 sheets within same file? if so, formula may work: =filter(sheet1!a:a,sheet1!b:b="published") if columns in different files need combine both sheet1 ranges importrange formula: =filter(importrange("key","sheet1!a:a"),importrange("key","sheet1!b:b")="published")

thumbnails - How to create thumb button VB.net -

excuse me, i'm developing music player , want create thumb button same windows media player. how create it? thanks hey been looking same answer, far no luck but found these. https://msdn.microsoft.com/en-us/library/system.windows.shell.taskbariteminfo%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1 scroll down remarks. there example provided microsoft how create small play button , stop button. hope that's helpful

Changing a calculated value in a label when a button is pressed in c# -

i'm relatively new programming; know basics of c , less in c#. i'm trying write program job allow user enter value, value increase or decreased contract amount. i've looked everywhere , can't find exact answer need. tried loop until read windows form loop. the issue i'm having every time user enters second value program calculates amount original contract value, it's not keeping updated value after calculation. if writing console app figure out don't have lot of experience forms. here code button_click: private void button1_click(object sender, eventargs e) { const double contract_balance = 229481.65; const double sub_balance = 196817.63; double subbal = sub_balance; double bal = contract_balance; double enterpayment = 0; subballabel.text = subbal.tostring("c"); balancelabel.text = bal.tostring("c"); //user input payment enterpayment = do

angularjs - How to preview image before upload with ng-file-upload -

this code snippet. when user select file clicking on change image button, file gets selected , name displayed in text box. <img src="" alt="" border=3 height=75 width=75><br><br> <input type="text" ng-model="b.files[0].name" data-ng-hide="!uploadmode" readonly="readonly"> <button ngf-select ng-model="b.files" class="btn btn-success btn-sm" ng-click="uploadmode=1"> <span class="glyphicon glyphicon-picture"></span> change image </button> i want display image of selected file preview user, before actual upload. can please 1 me, changes need that? take @ example ( ngthumb directive). basically, it's using filereader api , listening appropriate events.

android - How to make a grid layout of CardViews with variable height? -

i have multiple cardview 's defined in xml as: <android.support.v7.widget.cardview android:layout_width="wrap_content" android:layout_height="wrap_content" card_view:cardpreventcorneroverlap="false" card_view:cardcornerradius="4dp"> <linearlayout android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="wrap_content"> <textview android:textsize="@dimen/abc_text_size_title_material" android:text="lorem ipsum dolor sit amet, consectetur adipiscing elit" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </linearlayout> </android.support.v7.widget.cardview> for phones, have wrapped multiple cardview 's in vertical linearlayout : <linearlayout android:layout_width="

java - OSGI: DS and component factories issues -

what need new instance of service every time when consumer needs service + using cdi. i've read lot of articles , can't find answer 2 questions. if use factories, why in service consumer call factory ( http://www.rpgnextgen.com/wiki/doku.php?id=component_factory ) , after reference service. mean // factory componentfactory factory = (componentfactory) context.getservice(servicereferences[0]); // instance componentinstance instance = factory.newinstance(null); is there no way set factory interface , in service consumer call service when osgi inside calls factory? if in service consumer call factory why mark service component when de facto factory component? the problem without factory @inject @osgiservice (javase) or @osgiservice (javaee) , can use different filters , code clear. using component factory (as understand) loose ability. componentfactory exists consumers want use factory, because want control lifecycle of individual components. example

c - Adding Array Elements and Storing in Array -

these piece of code gets data file , stores in arrays. searches though array, if number between .5 , 50,000 ( remove 0 , big numbers) goes if statement. in statement if number equal next check other array filter out small , large numbers adds , stores mean , adds counter. until number in array2 not equal next number comes out , calculates average it, ect. it fine until gets mean[j] = mean[j] + array1[i], tried printf check out part , spits out giant negative number. array mean set zeros along counter. plz :l #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { file *fp; float array1[1000], array2[1000], mean[1000], average[1000], counter[1000], range[1000], upper[1000], lower[1000]; int a, h, i, r, j = 0, pos, found = 0, extrinsic[1000]; int b=0; int linect = 1; char buf[128]; extrinsic[100] = 0; mean[100] = 0; counter[100] = 0; range[100] = 0; upper[100] = 0; lower[100] = 0; average[100] = 0; = 0; j = 0;

excel - How to add conditions to my recorded macro? -

i have recorded macro below, used auto-transfer data enter 1 worksheet worksheet when run macro. @ present, have record macro each new worksheet in workbook , run each separate macro depending upon sheet need new data transferred to. know how add conditions macro automatically decide worksheet send new data to, based on text in column g of original worksheet. there 4 different text phrases might contained in column g. appreciated! sub over_90_days() ' ' over_90_days macro ' transfer info terms on 90 days sheet ' ' activecell.offset(0, -7).columns("a:a").entirecolumn.select selection.end(xldown).select end sub sub update() ' ' update macro ' move new data different worksheet ' ' range("table1[[#headers],[name, last]]").select selection.end(xldown).select range("a74:b74").select selection.copy sheets("90 days or less").select range("a2").select selection

javascript - Error installing Yeoman on Yosemite -

i'm trying several days install yeoman in os x can't =/ when try install error: mac-pro:~ pauloricardo$ sudo npm -g yo password: > spawn-sync@1.0.11 postinstall /usr/local/lib/node_modules/yo/node_modules/cross-spawn/node_modules/spawn-sync > node postinstall sh: node: command not found npm err! darwin 14.3.0 npm err! argv "node" "/usr/local/bin/npm" "i" "-g" "yo" npm err! node v0.12.5 npm err! npm v2.11.2 npm err! file sh npm err! code elifecycle npm err! errno enoent npm err! syscall spawn npm err! spawn-sync@1.0.11 postinstall: `node postinstall` npm err! spawn enoent npm err! npm err! failed @ spawn-sync@1.0.11 postinstall script 'node postinstall'. npm err! problem spawn-sync package, npm err! not npm itself. npm err! tell author fails on system: npm err! node postinstall npm err! can info via: npm err! npm owner ls spawn-sync npm err! there additional logging output above. npm err! please

Is it possible to query the graph in neo4j with just a part of the value of a relation's property? -

i trying move info of data flows db. data flows this: e_app1 sends data i_app1. i_app1 sends data i_app3. i_app3 sends data i_app5. e_app2 sends data i_app2. i_app2 sends data i_app3. i_app3 sends data i_app5. e_app3 sends data i_app2. i_app2 sends data i_app4. i_app4 sends data i_app5. i_app5 sends data i_app6. e_app4 sends data i_app3. i_app3 sends data i_app5. i_app5 sends data i_app6. e_app5 sends data i_app2. i_app2 sends data i_app4. i_app4 sends data i_app5. i thinking of having property named "of" of "sends data" relationship contain names of data being sent can trace flow of particular application. on lines of below diagram. possible query of values, "show relations of value contains e_app4 only"? this first time trying graph db , thinking of using relationships complex. not looking high performance here. there other approach should follow able achieve result of tracing flow of particular application? link diagram: http://s27.postimg.o

mysql - How phpmyadmin authentication works? -

Image
i know why dont have first authentication asked phpmadmin itself, before mysql authentication. i set admin password : htpasswd /etc/phpmyadmin/htpasswd.setup admin and /etc/apache2/conf.d/phpmyadmin.conf file : # phpmyadmin default apache configuration #alias /ionis_rda /usr/share/phpmyadmin <directory /usr/share/phpmyadmin> options followsymlinks directoryindex index.php <ifmodule mod_php5.c> addtype application/x-httpd-php .php php_flag magic_quotes_gpc off php_flag track_vars on php_flag register_globals off php_admin_flag allow_url_fopen off php_value include_path . php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/ </ifmodule> <ifmodule mod_authn_file.c> authtype bas

javascript - Images dont slide in orbit slider Foundation -

Image
i'm trying add foundation orbit slider web page. looks easy , i've got see images , prev & next buttons, if click on prev , next buttons orbit slider doesn't move @ all. images doesn't slide , don't know why, beacuse i've seen many examples , think code looks same. woud appreciated <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="altiria webapp"> <link rel="stylesheet" href="assets/css/foundation.min.css"> <link rel="stylesheet" href="assets/css/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="assets/css/jquery-ui.css"> <link rel="stylesheet" href="assets/c

javascript - Get and store multidimensional array not JSON in Firebase -

i using multidimensional array (not json) in javascript. var ar = [ ['1','2013','a','name1','1','1','3','3','1','2','3','4',''], ['2','2014','b','name2','1','2','3','1','1','2','3','5',''], ['3','2015','c','name3','1','2','4','4','1','2','5','4',''] ]; to send or store array ar firebase cloud use: var data = new firebase("xxxx.firebaseio.com"); data.set(ar); i use 2d array form lot. what option have or store individual data or array firebase cloud? like refresh , sync array ar cloud store new data cloud ar[2][3] = "new text" get value cloud var x = ar[2][3] hope can help thanks k var array = [ ['1','2013'