Posts

Showing posts from February, 2011

python - Fastest way to replace values in a numpy array with a list -

i want read list numpy array. list being replaced in every iteration of loop , further operations done on array. these operations include element-wise subtraction numpy array distance measure, , checking threshold condition in distance using numpy.all() function. using np.array( list ) each time convert list array: #!/usr/bin/python import numpy np = [1.33,2.555,3.444,5.666,4.555,6.777,8.888] %timeit b = np.array(a) 100000 loops, best of 3: 4.83 per loop is possible better this, if know size of list , invariable? small improvements welcome, run large number of times. i've tried %timeit(np.take(a,range(len(a)),out=b)) takes longer: 100000 loops, best of 3: 16.8 per loop as "know size of list , invariable", can set array first: b = np.zeros((7,)) this works faster: %timeit b[:] = 1000000 loops, best of 3: 1.41 µs per loop vs %timeit b = np.array(a) 1000000 loops, best of 3: 1.67 µs per loop

python - Scrapy: retain original order of scraped items in the output -

i have following scrapy spider status of pages list of urls in file url.txt import scrapy scrapy.contrib.spiders import crawlspider pegaslinks.items import statuslinkitem class finderrorsspider(crawlspider): handle_httpstatus_list = [404,400,401,500] name = "finderrors" allowed_domains = ["domain-name.com"] f = open("urls.txt") start_urls = [url.strip() url in f.readlines()] f.close() def parse(self, response): item = statuslinkitem() item['url'] = response.url item['status'] = response.status yield item here's items.py file: import scrapy class statuslinkitem(scrapy.item): url = scrapy.field() status = scrapy.field() i use following command output of items in csv: scrapy crawl finderrors -o file.csv the order of items in ouput file different order of corresponding urls in urls.txt file. how can retain original order or add field items.py kind of glo

javascript - Animating JSON models without three.js -

i know can load json models in webgl, don't know how animate them if have rigged model loaded. there way of doing without three.js? you can animate rigged model using three.js (however seem not want use built in functionality). what three.js doing in background, passing matrix transforms (an array of matrices), , per vertex passes bone indexes (up 4) , bone weights vertex shader. in vertex shader, it's blending between matrices based on vertex weight , translating vertex. in theory can pass values vertex shader animate things. or use three.js animation routines. it can use 2 methods store data. 1 method uses "image texture" stores matrix , fancy footwork turn image matrices in vertex shader. method passing uniform matrix array (for newer graphics cards preferred method).

Match two columns in Tableau -

i have 2 columns below column 1 column 2 b b c d i need create calculated field check if value in column 2 exists in column 1, if return “yes”. (without blending or duplicating data) how do in tableau? i appreciate can on this. this question asked on tableau forums @ http://community.tableau.com/thread/170673 , several answers provided there.

javascript - Filtering in Angular using a slight complex boolean condition -

i struggling filters in angularjs. essentially, have checkbox this: <div class="col-sm-2" style="text-align: right"> <label for="include-deleted-search" class="control-label">include deleted</label> </div> <div class="col-sm-2"> <input ng-model="search.includedeleted" type="checkbox" id="include-deleted-search"/> </div> which trying use filter airlines if (the item in filter deleted, , includedeleted true) or item in filter not deleted. my table looks this, note { isdeleted: search.includedeleted } filter not working i'd like. <table class="table table-hover table-striped table-bordered"> <thead> <tr> <th>ariline id</th> <th>airline name</th> <th>country</th> <th>telephone</th> <th>24hr tele

javascript - Timer Start button -

hi i'm making game involves count down timer. want game start when timer button clicked @ moment timer begins on own. have looked @ few different questions answered haven't worked me. suggestions? var seconds = 60; function secondpassed() { var minutes = math.round((seconds - 30)/60); var remainingseconds = seconds % 60; if (remainingseconds < 10) { remainingseconds = "0" + remainingseconds; } document.getelementbyid('countdown').innerhtml = minutes + ":" + remainingseconds; if (seconds == 0) { clearinterval(countdowntimer); document.getelementbyid('countdown').innerhtml = "times up!!!"; } else { seconds--; } } var countdowntimer = setinterval('secondpassed()', 1000); add setinterval button's click listener: var btn = document.getelementbyid('button_id'); btn.addeven

nslocale - How to convert two letter currency code to base locale identifier on IOS -

i need convert 2 letter country code, default, native, identifier, e.g. tw > zh_tw not en_tw. > en_us. ru > ru_ru, not en_ru. isn't justg same 2 letters repeated. note, need country code, not language code. there simple way, using nslocale, or have have big list !? thanks shaun southern nsstring *countrycode = @"ie"; nsdictionary *components = [nsdictionary dictionarywithobject:countrycode forkey:nslocalecountrycode]; id localeident = [nslocale localeidentifierfromcomponents:components]; nslocale *locale = [[nslocale alloc] initwithlocaleidentifier:localeident];

c# - How do I inject into base class with Castle Windsor? -

i have series of core services want configure castle windsor, things logging, caching, email config, etc. making these services configurable app.config change great boon (e.g. development/testing it's great able tell app route email traffic through other mechanism actual mail server). two questions: many of classes need access these services inherit abstract base class (contains core logic used subclasses) seem ideal inject core services base class somehow children inherit references services. note these subclasses implement interface may better path go down? i have scenario unrelated objects in other assemblies need able tap core services. these objects not instantiated me other libraries (i'm implementing interface of 3rd party library uses implementation in framework). if need access email or logging or other core service in code, how reference? i hope makes sense, thank you. regarding first point, use property injection . you have 2 choices injectin

unix - sed search and replace a string with its sub string value -

i have create table script ( external table). want replace table name ext_[first 27 characters of original table] sample i/p file create table "p12345678912345678912345678912" ( "partition_key" varchar2(12), "id" varchar2(100), "stress_testing_scenario_id" varchar2(100), "tranche_collateral_type" varchar2(20), "tranche_guarantee_type" varchar2(20), "bs_type" varchar2(3), "contract_reference" varchar2(50), expected o/p create table "ext_p12345678912345678912345678" ( "partition_key" varchar2(12), "id" varchar2(100), "stress_testing_scenario_id" varchar2(100), "tranche_collateral_type" varchar2(20), "tranche_guarantee_type" varchar2(20), "bs_type" varchar2(3), "contract_reference" varchar2(50), the script needs work on both linux , solaris. this awk one-liner works example: awk

php - How to orderby woocommerce product categories as in the order I want? -

this query arguments. want products appear according categories arranged in order want. $query_args = array( 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $post_per_page, 'orderby' => 'name', 'order' => 'desc', 'paged' => $paged, 'tax_query' => array( array('taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => 12, 'operator' => 'not in', ) ) ); $wp_query = new wp_query($query_args); means, want specify category order in query somewhere.. array(3,4,5,7) and products category 3 appear first, 4, 5 , on. how can achieve this? tried plugin, seems it's not working custom query. h

ios - UIMenuController Has Zero Frame -

i went through every other question on related topic. none helped me far. i trying show uimenucontroller on uiview . therefore subclassed uiview , implemented required methods already. in uiviewcontroller instantiate uigesturerecognizer , add custom uiview . works fine. can handle long press gesture. uimenucontroller won't show up! @interface copyableview : uiview @end @implementation copyableview - (bool)canbecomefirstresponder { nslog(@"_can become 1. responder_"); return yes; } - (bool)canperformaction:(sel)action withsender:(id)sender { nslog(@"_can perform action_"); return (action == @selector(copy:)); } - (void)copy:(id)sender { nslog(@"_copy_"); } @end @interface infoviewcontroller : uiviewcontroller @property (nonatomic, weak) iboutlet copyableview *myview; @end @implementation infoviewcontroller - (void)viewdidload { [super viewdidload]; [self.myview addgesturerecognizer:[[uil

python - OpenERP add column to treeView -

im trying show new column in treeview purchase.order.tree. my goal is, becosue have product, orders have 1 product quantity number, how show quantity in treeview purchase.order.tree ? any ideas ? you'll have override original view , add new field, on example overriding account.invoice: <record model="ir.ui.view" id="new_invoice_tree"> <field name="name">mymodule.account.invoice.tree</field> <field name="model">account.invoice</field> <field name="inherit_id" ref="account.invoice_tree"/> <field name="arch" type="xml"> <field name="name" position="after"> <field name="quantity"/> </field> </field> </record> just make sure inherit_id referencing original view , set correct model on name="model&

HTML page getting distorted in Android webview, Same is working in iOS webview -

html page getting distorted in android webview, same working in ios webview. ui getting distorted in android webview per device resolution. probably need setup viewport properly.

javascript - How do I listen for webpack (watchpack) changes in --watch mode? -

i'm experimenting webpack , call function everytime webpack/watchpack detects changes when in --watch mode. watchpack api describes .on('change') method, how can hook running instance of watchpack? executing this: webpack --watch --colors --progress and here webpack.config.js : var extracttextplugin = require('extract-text-webpack-plugin'); module.exports = { entry: { style: './styles/master.less', homepage: './styles/homepage.less', messaging: './styles/messaging.less', places: './styles/places.less', profile: './styles/profile.less', }, output: { filename: '_tmp/[name].js' }, module: { loaders: [ { test: /\.less$/, exclude: /node_modules/, loader: extracttextplugin.extract('raw!less') } ] }, plugins: [ new extracttextplugin(

How to change the Directory from command prompt using Java code -

public void verifyfiles(file dir) throws ioexception{ file[] files = dir.listfiles(); (file file : files) { //check if directory if (file.isdirectory()) { //recursively call file list function on new directory verifyfiles(file); } else { try { processbuilder builder = new processbuilder( "cmd.exe", "/c", "cd \" c:\\users\\e843778\\documents\\netbeansprojects\\encryptedfiles\" && c:\\program files\\pgp corporation\\pgp desktop"); builder.redirecterrorstream(true); process p = builder.start(); runtime rt = runtime.getruntime(); string query2 = "cmd /c pgpnetshare -v " + "\"" + file + "\""; process proc = rt.exec(query2); proc.waitfor(); system.out.print

How to check android OS version of bluestacks Emulator -

i searched lot in google, no hope, how check os version of bluestacks emulator in windows? there video in youtube checking bluestack version, not android version used in it. can please me in matter? went settings --> advanced settings, there no tab corresponding about tab found in android emulator in case of genymotion emulator. mukund install terminal emulator play store, open application , type: getprop ro.build.version.release like: 4.4.4 kitkat. or getprop ro.build.version.sdk getting sdk version return 19

php - ratchet HttpServer class not found -

Image
so made real-time chat on windows in php websockets , every thing worked when try run server on vps(debian) error php fatal error: class 'ratchet\http\httpserver' not found in /react-chat/bin/server.php on line 11 so when @ server.php file : <?php require __dir__ . '/../vendor/autoload.php'; use chat\chat; use ratchet\server\ioserver; use ratchet\http\httpserver; use ratchet\websocket\wsserver; $server = ioserver::factory(new httpserver(new wsserver(new chat)), 2000); $server->run(); every thing seems normal composer.json file { "require": { "cboden/ratchet": "~0.3" }, "autoload": { "psr-4": { "chat\\": "bin/src/" } } } the warning got when doing composer install following but dont warning making error php namespaces case sensitive, try http instead of http : use ratchet\http\httpserver;

sql server - Stored Procedure doesn't work, manual update works fine - why? -

so when executing sql below following: string or binary data truncated. exec sp_goodswelcomenotification 'd84be19b-be86-4a38-958b-e6d786cc27db' the stored procedure follow: alter proc [dbo].[sp_goodswelcomenotification]( @itemguid varchar(50) ) declare @productcode varchar(50), @parentguid varchar(100) set @productcode = 'select idx37 iwfaccountopening idx1!='' , idx6=' + @itemguid set @parentguid = 'select idx134 iwfaccountopening idx1!='' , idx6=' + @itemguid begin transaction insert notificationtable values(650, @productcode, @parentguid, 'pending','','','y','y',@itemguid,0,'','') commit transaction when execute insert statement manually executes fine: insert notificationtable values(650, 'bv-tkm-0000068-02', '241c8abc-5f95-4c35-9405-d6adfc8e2f55', 'pending','','','y','y','d84be19b-be86-4a38-

javascript - NodeJS - Export multiple functions -

i trying build first nodejs module. doing: var text = function(){ this.padright = function(width, string, padding){ return (width <= string.length) ? string : this.padright(width, string + padding, padding); }; this.cleantext = function(text){ if (typeof text !== 'undefined') { return text.replace(/(\r\n|\n|\r)/gm,""); } return null; }; this.printout = function(outputobj){ var module = this, output = ""; outputobj.foreach(function(obj){ switch(obj.type){ case "date" : var date = obj.contents; if(typeof date != "undefined") output += date.tostring().substring(4, 25) + "\t"; break; case "string": var string = obj.contents; if(typeof string != "undefined"){

parsing - C to Forth parser using Bison -

i'm trying make c-to-forth bison parser. i've developed of typical functions, have troubles expressions. i thinking using ast during parse, more difficult code temporary buffer. could recommend 1 strategy on other? thanks if use strategy of producing translation each production, becomes impossible reorder clauses. that's severe limitation. there number of hacks in common use around problem. 1 provide mechanism whereby output production can saved in temporary buffer, can output later on. however, cleaner solution create ast (abstract syntax tree) during parse, , walk ast when parse complete. since entire parse tree available @ point, can walk child nodes of production in arbitrary order. the ast strategy more cleanly separates parse code generation, making easier implement other processing steps (pretty printing, linting, etc., etc.). avoids problem of producing partial output in case error detected , parse prematurely terminated.

ios - Twitter Logout from browser not reflecting in app -

i have used sttwitterapi login using either acaccountstore or browser. here's condition thats creating issue me. when user logs in app using twitter browser(default safari), gets call-backed app and sttwitterapi object stores data. everything works fine. can tweet using account. if user switches browser(default safari) , logs out twitter account(which used while logging) , returns app tweet, done old account (associated earlier in browser before logging out), should not case. i want ask user again logging in logged out browser. tried using verifycredentialswithsuccessblock:errorblock : returns me user details of old user(the 1 logged out). update: app doesn't redirects user browser after user logged in. concern if user opens twitter in browser out of volition, shown logged in account used while logging in(and should case), user decides either log out account or wishes change account , logs out account(used during login) browser. it gets logs out (which

How can I notify content creator of new Disqus comment on her page? -

i have site user profile pages, users can add content to, e.g. anne. other users (e.g. bob) can comment on these pages using disqus. when bob comments on anne's page, i'd notify anne of new comment. currently disqus emails site moderator notify new comment. can made notify anne well? i'm not using wordpress (see related question here discussion when using wp), django site. i've seen can javascript callback disqus, use trigger api call backend send notification email. if disqus can send notifications directly won't need reinvent wheel. you can, it's manual process. requires author have disqus account , has enabled email notifications disqus. through disqus admin tool, click on "discussions" tab. on page can set thread/article author valid disqus user. disqus send notification author whenever comments.

c - Is a Command injection possible in the arg parameter of execve -

my program uses excve run ls, , second argument filled user : char * envp[1] = { 0 }; execve(my_command, user_input, envp); is possible user inject command in user_input parameter though considered argument? i tried running $( interpreted before : ./my_program.out "$(cat /etc/passwd)" is there way escape $ still inject command? no can't inject commands unless there vulnerability inside ls. see http://linux.die.net/man/2/execve the argument vector , environment can accessed called program's main function, when defined as: int main(int argc, char *argv[], char *envp[])

sql - Limit on GROUP BY in Postgresql -

i need have query group tracks created date(month) , limit every group max 10 results. i'm trying in way: select "tracks".* (select row_number() on (order tracks.votes_count desc) r, t.* tracks t 1=1 ) x x.r <= 10 but give me error on clause: error: missing from-clause entry table "tracks" where i'm doing wrong ? how should correct query ? x alias exposed. need change tracks alias x . select x.* (select row_number() on (order tracks.votes_count desc) r, t.* tracks t 1=1 ) x x.r <= 10

extjs4.2 - Pass data between views in ExtJS -

i reading data store , populating main girdview. when of row clicked, windows appear , want fill fieldset in window same record clicked. can tell me how it? my popup window like: { extend: 'ext.window.window', height: 500, width: 1500, minwidth :1500, maxwidth :1500, layout: 'fit', controller: 'popupwindowcontroller', initcomponent: function () { var me = this; //console.log(me.myextraparams); var store = ext.getstore('mainstore'); ext.applyif(me, { /* items: [{ xtype: 'form', bodypadding: 10, region: 'center' }]*/ }); me.callparent(arguments); }, items: [ { xtype: 'panel', title : 'projektierung', bodystyle : 'padding:5px', width : 1880, autoheight : true, items:

javascript - How do I stop a function running again when I dont want it to? (jquery) -

lots of things not right in js code. when click "show" more once, #box-1 keeps moving further , further down. same thing's happening #box-2 when clock "hide" more once. how stop happening? i'd add, how make boxes "fade" when shows , hides? can seem make work when it's showing. don't want use toggle button, want use 2 buttons because i'm experimenting on something. here's jsfiddle link thank time :) $(document).ready(function(){ $('a#hide').click(function(){ $('#box1').hide().animate({'top': '-=155px', opacity: 0}, 500); $('#box2').show().animate({'top': '+=155px', opacity: 1}, 500); }) $('a#show').click(function(){ $('#box1').show().animate({'top': '+=155px', opacity: 1}, 500); $('#box2').hide().animate({'top': '-=155px', opacity: 0}, 500); }) }); edit: i got code working way wanted

postgresql - Connect to a remote database on a docker container hosted on an AWS instance -

i have postgresql database running on docker container, ip address of container ip_container, , exposes port 5432, hosted on aws instance of ip address ip_instance. security group allows tcp connexions on port 5432. i cannot connect on database local computer using ip_instance , port 5432 (cannot find host). missing ?

node.js - WebRTC: One to one Audio call not working in different machine -

i trying implement 1 one audio call using webrtc (signalling using websockets) . works when try in 1 system using multiple tabs of chrome (localhost). when try hit server machine initial handshakes , call doesn't happen. but when try change tag , changed constraints video constraints . works if try access other machine (i.e video call works ). i thought because if firewall when video call worked puzzled . here code: // constraints audio stream $scope.constraints = { audio: { mandatory: { googechocancellation: true }, optional: [] }, video:false }; navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia; // success callback of getusermedia(), stream variable audio stream. $scope.successcallback = function (stream) { if (window.url) { myvideo.src = window.url.createobjecturl(stream); // converting media stream blob url. } else

python - Tweepy not working -

so trying run tweepy script collect tweets. i've setup database i'm running error. starting... started user: user1 exception in thread thread-1: traceback (most recent call last): file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) file "build/bdist.macosx-10.6-intel/egg/tweepy/streaming.py", line 414, in filter self.body['follow'] = u','.join(follow).encode(encoding) typeerror: sequence item 0: expected string or unicode, int found edit: script using: urllib import urlencode_noplus _noplus not in urllib why deleted code. although suspect causing error.. import tweepy import threading import logging tweepy.models import status tweepy.utils import import_simplejson urllib import urlencode import

c++ - Error: QueryFrame not a member of cv -

when run opencv code on raspbian following error: error: "capturefromcam" not member of cv error: "setcaptureproperty" not member of cv error: "queryframe" not member of cv can correct notations using opencv 3.0. code runs without errors on lower version. to expand on berak's answer: the opencv c-api relic should not used unless have to. has been case long, long time. there apparently still ways access old c api if still need to. see comment berak on post. to capture video should using cv::videocapture class in c++ api. link shows usage examples class reference. if have old code uses old c-api, options either remain on opencv 2.x, or rewrite c++ api.

How can I add a single cell to a Google Spreadsheet using the Sheets API without using batching? -

a similar question asked not answered 2 , half years ago. i have looked @ google's documention on both modifying cells , adding cells using batch updates. however, trying add single cell without using batching mechanism, , there seems no documented way of doing it. here have tried. note entry trying add not have value, why linked documentation not allow me "change" contents of cell. in particular, cellfeed not contain cell trying add value of. cellentry otherentryfromcellfeed = // obtained through oauth , finding sheet, worksheet, , cellfeed, documented above cellentry cellentry = new cellentry(5, 10, "value"); cellentry.setservice(otherentryfromcellfeed.getservice()); cellentry.update(); error: exception in thread "main" java.lang.unsupportedoperationexception: entry cannot updated @ com.google.gdata.data.baseentry.update(baseentry.java:635) after hour of poking through javadocs spreadsheetservice , googlese

java - How to write accented characters from XML into MarkLogic using JavaApi? -

i have xml of 20mb having accented characters Ö,É,Á, , many more.here problem when insert file marklogic, these characters saved in english format o,e,a.but want store in same format.so how can store characters in accented format , read xml in same way. xml file iso-8859-1 encoded. code have written writing , reading : databaseclient client = databaseclientfactory.newclient(ip, port, database_name, username, pwd, authentication.digest); xmlinputfactory factory = xmlinputfactory.newinstance(); xmlstreamreader streamreader = null; streamreader = factory.createxmlstreamreader(new filereader("record.xml")); xmldocumentmanager xmldocmgr = client.newxmldocumentmanager(); xmlstreamreaderhandle handle = new xmlstreamreaderhandle(streamreader); xmldocmgr.write("/" + filename, handle); for reading xml: xmldocumentmanager docmgr = client.newxmldocumentmanager(); domhandle xmlhandle = new domhandle(); docmgr.read("

regex - Extract value from character array in R -

i have following charecter array head(rest, n=20) [,1] [,2] [,3] [1,] "" "" "" [2,] "" "" "" [3,] "b" "-1" "-tv" [4,] "" "" "" [5,] "" "" "" [6,] "a" "" "" [7,] "" "" "" ... [2893,] "" "" "" [2894,] "" "" "" [2895,] "" "" "" [2896,] "st" "" "" [2897,] "2" "-th" "" [2898,] "1" "" "" i extract capital letters, numbers , lower case letter while keeping index values. i can find capital positions letters this grep("[a-z]", rest, perl=true) and values grep("[a-z]", r

android - How to set vertical filled progress -

Image
i want set custom circular progress-bar below: edited i wrote following code this. not work : private void circularprogressbar(imageview iv2, int i) { bitmap b = bitmap.createbitmap(300, 300,bitmap.config.argb_8888); canvas canvas = new canvas(b); paint paint = new paint(); paint.setcolor(color.parsecolor("#c4c4c4")); paint.setstrokewidth(10); paint.setstyle(paint.style.stroke); canvas.drawcircle(150, 150, 140, paint); paint.setcolor(color.parsecolor("#ffdb4c")); paint.setstrokewidth(10); paint.setstyle(paint.style.fill); final rectf oval = new rectf(); paint.setstyle(paint.style.stroke); oval.set(10,10,290,290); canvas.drawarc(oval, 270, ((i*360)/100), false, paint); paint.setstrokewidth(0); // paint.settextalign(align.center); paint.setcolor(color.par

Is there a way to make a base64 encoded background image png black and white on hover with css only? -

i didn't found solution problem. seems possible if use svgs grayscale filters there easy way css only? update: filter: grayscale(100%); -webkit-filter: grayscale(100%); and -webkit-filter: grayscale(0); filter: grayscale(0%); works newest firefox , chrome versions. if have managed set background image data base64 string again :hover black , white data.

javascript - angular custom filter only on button click -

i new angular custom filters , wondering if there way apply filters ng-repeat when button clicked. here jsfiddle example : http://jsfiddle.net/toddmotto/53xuk/ <div ng-app="app"> <div ng-controller="personctrl person"> <input type="text" ng-model="letter" placeholder="enter letter filter"> <ul> <li ng-repeat="friend in person.friends | startswithletter:letter"> {{ friend }} </li> </ul> </div> </div> sometings this: function mycontroller(startswithletterfilter) { //retrieve person object this.friends = person.friends; this.onclick = function() { this.friends = startswithletterfilter(person.friends, myletter); } } bind repeater friends property , not directed person.friends can manipulate array responding on events

android - ScrollView Still comes Behind out of it's Area -

Image
this xml. . <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" tools:context="com.xxx.xxx.myactivity" > <linearlayout android:id="@+id/viewfromdatetodate" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_gravity="center" android:layout_marginbottom="10dp" android:layout_margintop="10dp" android:gravity="center" android:orientation="horizontal" > <edittext android:id="@+id/txtfromdate" android:layout_width="wrap_content" android:layout_height="wrap_cont

java - HTTP transport error: javax.net.ssl.SSLHandshakeException -

i have java client on glassfish has consume soap web service third party can't around error: "error": { "code": "clienttransportexception", "description": "http transport error: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target" } i have third party certificates in jvm keystore , cacert still no luck. this (summarised) ssl messaging: info: using sslengineimpl. info: allow unsafe renegotiation: false allow legacy hello messages: true initial handshake: true secure renegotiation: false info: http-listener-2(5), read: tlsv1 handshake, length = 181 info: *** clienthello, tlsv1 info: randomcookie: ... info: *** info: %% resuming [session-5, tls_ecdhe_rsa_with_aes_128_cbc_sha] info: *** serverhello, tlsv1 info: randomcookie: i

maven - Adding Dependency to Android Studio -

can me how add this library android studio project. <dependency> <groupid>com.googlecode.mp4parser</groupid> <artifactid>isoparser</artifactid> <version>1.0.5.4</version> </dependency> this how add in android studio: in build.gradle (module: app) add dependencies: compile 'com.googlecode.mp4parser:isoparser:1.0.5.4' it should this: dependencies{ //other dependencies compile 'com.googlecode.mp4parser:isoparser:1.0.5.4' } i hope helps :)

c++ - Correct way to link with /usr/lib/libgtest_main.a? -

i got libgtest-dev installed , brought me /usr/lib/libgtest_main.a , /usr/lib/libgtest.a . now trying link simple test application. following command produces me functional executable: g++ -pthread sample1.o sample1_unittest.o /usr/lib/libgtest.a /usr/lib/libgtest_main.a is there way instruct linker search .a files? there way assemble application in 1 step (compile , link)?

javascript - Why is IE7 ignoring the css background? -

i trying add div elements using inject of mootools . here part of code var elm = document.createelement('div'); elm.setattribute('id', 'leftheader'); elm.setattribute('class', 'leftheader'); var div_before = document.getelementbyid('w1'); var aux = div_before.parentnode; aux.insertbefore(elm, div_before); var elm2 = document.createelement('div'); elm2.setattribute('id', 'rightheader'); elm2.setattribute('class', 'rightheader'); var div_before2 = document.getelementbyid('w1'); aux2 = div_before2.parentnode; aux2.insertbefore(elm2, div_before2); and stylesheet below .leftheader { background: #e64626 url("bgleft.png") 0 0 no-repeat; float: left; position: absolute; width: 40%; height: 358px; } .rightheader { background: #e64626 url("bgright.png") right 0 no-repeat; float: right; position: absolute; width:

How to add CC with Lotus Notes email in Excel VBA -

Image
i have macro sends email recipients automatically excel vba, have different columns in excel file such "recipient email address" , "cc", macro retrieve data worksheet , format accordingly. need add "cc" field 2 email addresses email format , couldn't figure out how that, can me that? here's how worksheet looks like: here's entire code macro: sub send_unformatted_rangedata(i integer) dim nosession object, nodatabase object, nodocument object dim varecipient variant dim rnbody range dim data dataobject dim rnggen range dim rngapp range dim rngspc range y: dim stsubject string stsubject = "change request " + (sheets("summary").cells(i, "aa").value) + (sheets("summary").cells(i, "ab").value) + (sheets("summary").cells(i, "ac").value) + (sheets("summary").cells(i, "ad").value) + (sheets("summary").cells(i, "ae").value) + (sheets

how to get the time cost of all spring bean initialization -

all my spring app takes long start before can respond requests. so want check beans took time, can further more. is there way solve this? the easiest way enable logs, since don't know bean taking long time. log4j.logger.org.springframework.beans.factory=debug you see like: debug defaultlistablebeanfactory:450 - creating instance of bean...

javascript - How to hide filepath input file? -

i need javascript , html guess. i have input file button can choose image , upload it, want remove "filepath" name, or @ least hide it. possible do, if how do that? i able hide "no file chosen" using but not able same hiding filepath. i've tried use that, , use onclick , 1 nothing seems work. use display none input type file, , include button id='x' in page. add eventlistener click on button x , when trigger onchange event input type file. works.

java - Kryo read and write generically -

i found 2 ways how read , write using kryo generically , thinking if 1 of them better or worse or if same. option 1 - using kryo function writeclassandobject (readclassandobject) public <t> void writek(t obj, string filename) { checkdir(path); kryo kryo = new kryo(); output output = null; try { output = new output(new fileoutputstream(homepath + path + "/" + "kryo_" + filename + ".bin")); kryo.writeclassandobject(output, obj); } catch (filenotfoundexception e) { e.printstacktrace(); } { output.close(); } } option 2 - using writeobject (readobject) , class information public <t> void writekryo(class<t> cl, t obj, string filename) { checkdir(path); kryo kryo = new kryo(); kryo.register(cl); output output = null; try { output = new output(new fileoutputstream(homepath + path + "/" + "kryo_" + filename + ".bin")

Android Call Recording not getting stopped when the call hangs up -

public class callreceiver extends broadcastreceiver { mediarecorder callrecorder; boolean recording = false; private static boolean ring = false; private static boolean out = false; private static boolean callreceived = false; string outnumber; location location; @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_new_outgoing_call)) { outnumber = intent.getstringextra(intent.extra_phone_number); log.d("outnumber", outnumber); } //check if checked in sharedpreferences prefs = context.getsharedpreferences("mypreference", context.mode_private); string check = prefs.getstring("ischeckedin", null); if (check.equals("yes")) { telephonymanager tm = (telephonymanager) context.getsystemservice(co

node.js - Applying limit in listing large numbers of files in nodejs -

i have folder millions of images stored in it. want 10 random jpg images folder. i trying below code list images , gives big list of images after time (5-6 minutes) can apply if condition determine jpg , can 10 random records list. fs.readdir(imagefolder, function (err, files) { console.log(files.length); }); is there quick way list few images of required extension? i got solution, var sys = require('sys') var exec = require('child_process').exec; var child; child = exec('find '+imagefolder+' -name "*.jpg" | shuf -n 10', function (error, output, stderr) { console.log(output); });

consistency questions about query on Cassandra using cql -

i did exact same query on cassandra, result different, i'm wondering why. detail following: cqlsh:keyspace > select info_map seq_id = '123456' limit 2; (0 rows) ..... (after 1 minute) ..... cqlsh:keyspace > select info_map seq_id = '123456' limit 2; {............data detail........} (1 rows) i can assure data not instant (the data inserted database 1 month ago), , number of hit recode @ 1 (though write limit 2 in cql). , cassandra has 2 datacenters.

swift - How to use ExSwift Array.toDictionary? -

exswift has array extension: /** converts array dictionary keys , values supplied via transform function. :param: transform :returns: dictionary */ func todictionary <k, v> (transform: (element) -> (key: k, value: v)?) -> [k: v] { var result: [k: v] = [:] item in self { if let entry = transform(item) { result[entry.key] = entry.value } } return result } the exswift wiki shows example other todictionary() method signature. i'm not yet familiar way how these method signatures work. wondering whether can show me example of how use above method call? you need provide closure takes parameter element of array , returns key - value pair. say have array of keys, , want create dictionary default value each key (let's 0 ): let keys = ["a", "b", "c"] let dictionary = keys.todictionary { element in return (element, 0) }