Posts

Showing posts from June, 2014

regex - u character appears within a regular expression in python -

i have lines of code extracts email addresses pdf file. page in pdf.pages: pdf = page.extracttext() # print elpdf r = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-za-z]{1,4}') results = r.findall(pdf) listemail.append(results) print(listemail[0:]) pdf.stream.close() unfortunately, after running code have noticed results not fine appears 'u' character every time match found: [[u'testuser1@training.local']] [[u'testuser2@training.local']] does know haow avoid character appearing? thanks in advance as others have noted, not bug, feature. if want non-unicode encoded strings, can convert text unicode more palatable. stackoverflow q/a cover subject: convert unicode string string in python (containing symbols) i've run before , in use cases, can problematic, encounter issues method expects non-unicode string , breaks. :) example solutions link: >>> a=u'aaa' >>>

jquery - Returning variables outside a function -

i have been having problems returning variable through jquery function. $(document).ready(function () { var selected = ""; $('.whitetheme').on('click', function () { $(this).effect("highlight", {}, 2000); selected = "whitetheme"; return selected; $('.blacktheme').fadeout(1500); $('.redtheme').fadeout(1500); }) console.log(selected); }); i trying have value of selected changed "whitetheme" once clicked. right now, log function returns empty string. you're binding event handler (and if invoked) change variable value. however, event cannot occur before console.log executed, don't see updated value. also, blacktheme , redtheme classes not faded out, since code part unreachable. what trying achieve?

abstract syntax tree - How can I build an AST using ANTLR4? -

i have antlr3 grammar builds abstract syntax tree. i'm looking upgrading antlr4. however, appears antlr4 builds parse trees , not abstract syntax trees. example, output=ast option no longer recognized. furthermore neither "ast" nor "abstract syntax" appears in text of "the definitive antlr4 reference" . i'm wondering if i'm missing something. my application knows how crawl on ast produced antlr3. changing process parse tree isn't impossible bit of work. want sure it's necessary before start down road. antlr 4 produces parse trees based on grammar instead of asts based on arbitrary ast operators and/or rewrite rules. allows antlr 4 automatically produce listener , visitor interfaces can implement in code using grammar. the change can dramatic users upgrading existing applications version 3, whole new system easier use , (especially) maintain.

Is it possible to query out all of the "praises" messages from yammer? -

Image
yammer has feature allows "praise" someone. however, looking @ data returned "praise" message, not appear there distinguishing flag or attribute marks "praise" message. inside message, there attachment "type=praise" , "praised-user-id". what best way pull information out of yammer? unfortunately there no way pull praise messages yammer @ time. it's worth joining yammer developer network , tracking updates api, not i'd expect see in near future.

asp.net - .NET GridView Updating, e.OldValues is empty -

i using ajax tabcontainer , have asp gridview in each tab bound objectdatasource. objectdatasource returns different objects based on tab selected (tabcontainer autopostback="true"). bind objectdatasource gridview based on tab selected during tabcontainer load in code behind if ispostback because on first load tabcontainer not visible. not bind gridview anywhere else. fields in gridview eval instead of bind because parameters added objectdatasource dinamically. this bulk update gridview of fields editable. when update gridview, not able see e.oldvalues. if fields in gridview set bind, able retrieve e.newvalues nut e.oldvalues still empty... does know deal is? <asp:objectdatasource id="odsequipment" runat="server" typename="equipmentdb" selectmethod="getequipment" sortparametername="sortexpression" updatemethod="updateequipment"> <selectparameters> --params </selectparameters&g

forms - Dropdown Select Box not showing correctly with custom CSS? -

how can add custom css select box styling chrome , safari? there fix? answer: need add -webkit-appearance: none; , height value chrome , safari. any suggestions? resource: http://bavotasan.com/2011/style-select-box-using-only-css/ try on jsfiddle remove , add style in google chrome: before: - http://jsfiddle.net/joshsalway/jw6qy/ after: - http://jsfiddle.net/joshsalway/cmbtb/ select{ -webkit-appearance: none; }

.net - Will calling a progress report method slow down a C# file download on Windows Phone 7 significantly? -

i have windows phone 7 (7.1) method in c# given url in string form downloads contents of url file (see code below). can see code, assign downloadprogresschanged() event handler. in handler, if caller provided iprogress object, call report() method on object. given potential user having slow web connection, want make sure download go fast possible. calling iprogress.report() method in webclient's downloadprogresschanged() callback slow down download considerably? i'm not familiar enough iprogress.report() know if executes on current thread or calling thread. execute on calling thread? concern repetitive thread switch bog things down. i'll wrap call method in task.run() call keep ui thread happy. in case, i'll ask if there potential problems code far bogging down ui thread concerned? any other comments on code pertaining structure or performance appreciated. note, i'm using microsoft.bcl.async package in app. update (added later) : in reg

php - Codeigniter: $_SESSION doesn't work on hosting server -

code works fine on localhost giving error when moved project hosting server. says severity: notice --> undefined variable: _session i using codeigniter 2.1.3. double checked $autoload['libraries'] = array('database','session'); in autoload.php $_session not available until session_start() called. recommend using native ci session class function ( $this->session->userdata('some_data') ) instead of using default php sessions. ci doesn’t use php session’s , instead rely’s on cookies. amend notice can add session_start() index.php file if wish continue doing.

c# - How does one unit test modifying an XML document? -

i'm @ loss how begin creating unit tests method: public override void modifyxmldocument(foo foo, string nodetochange, string newvalue) { xmldocument xmldocument = new xmldocument(); xmldocument.load(foo.xmlpathandfilename); xmlelement rootelement = xmldocument.documentelement; // rest of method (to modify xml doc) here } that method finds element/node in xml doc , updates user-supplied value. (the method more complex shown here.) the part i'm having hard time understanding how have method execute, without relying on hard disk. xmldocument.load() takes file path , loads file disk. @ end of method, saves updated file disk. how can make method unit testable? there couple of ways can this, require refactoring of code. modifyxmldocument need take xmldocument parameter, can mock there on. public void test_that_xml_is_loaded() { var sut = new sut(); var xmldocumentfake = new mock<xmldocument>(){callbase=true}; xmldocumentfake

java - Add elements between nodes Ordered LinkedList -

i queried search engine on site, did not see matched looking for, hope question has not been answered elsewhere. trying perfect add method ordered linkedlist. rest of program runs fine, , while list prints out specified in test harness, want names sorted. my output after several calls add , remove harness: sue, bill, michael, someguy, michael, carl, steve, carl, sue sue, bill, someguy, michael, steve, carl, sue sue, bill, someguy, michael, steve, carl, sue, sue, bill what want this: sue, sue, bill, michael, michael, carl, carl, steve, etc... my add method: public boolean add(comparable obj) { orderedlistnode newnode = new orderedlistnode(obj, null, null); if( tail == null) { tail = newnode; head = tail; modcount++; return true; } if(((comparable)(head.theitem)).equals(obj)){ tail.previous = newnode; modcount++; return true; }else{ tail.previous.next = newnode; newnode.previous = tail.previous;

javafx 2 - revert TextFieldTableCell value -

i used example 13-10 tableviewsample enabled cell editing in page: http://docs.oracle.com/javafx/2/ui_controls/table-view.htm let's see portion: firstnamecol.setoneditcommit( new eventhandler<celleditevent<person, string>>() { @override public void handle(celleditevent<person, string> t) { ((person) t.gettableview().getitems().get( t.gettableposition().getrow()) ).setfirstname(t.getnewvalue()); } } ); in handle method want catch exception, , when exception occurs cell text must reverted old value. can not change text, when call ((person) t.gettableview().getitems().get( t.gettableposition().getrow()) ).setfirstname(t.getoldvalue()); just changes value of tableview data, not displayed text

python - What's wrong with my channel api code? -

i've been working on getting website gae , channel api display , process real time data robot i'm working on. i'm pretty new web development, , python in general, seems me code should work i'll make more fancy once working (logging data database, actual data processing etc.), want display recent occurance of variable "val" post request sent internet connected board on robot. helpful looking real time data display channel api. right i'm displaying template input box set send post request page. instead of updating front page current value on submission however, blank screen. i'm not sure if problem has channel api code, or java function updating displayed value. python code: import os import webapp2 import jinja2 import json import logging google.appengine.ext import db google.appengine.api import channel google.appengine.api import users template_dir = os.path.join(os.path.dirname(__file__), 'templates') jinja_env = jinja2.environment

c# - Is CSLA.NET a right solution for multiple databases? -

i have application connect database. have plan slice data in database multiple databases. for example, have 10,000 records in table test_table_1 , right located in 1 database. now, want move 5,000 records database new database, same table name. so, have 2 databases, original 1 contain first 5,000 records , new data-center contain rest (5,000 records.) the challenge on application. need update reading configuration value configuration file check data center connect to. here questions: is csla.net right solution problem? is there feature on csla.net allow me switch between data-centers when 1 of them dead? csla not data access framework or orm, business layer framework. it abstract concept of database, making possible business layer use data multiple databases. interaction database(s) responsibility of data access layer (dal). csla provides high level functionality invokes dal in consistent manner, implement dal. one important consideration when building bus

html form is not posting input control values on postback -

i have simple html page 1 form , few controls in it. html page hosted on server. when post form values in input fields not show input values in form post data. reuest body has btn1=post other controls not listed there below html : <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test</title> </head> <body> <form id="form4" action="somepage.htm" method="post" > <input type="text" id="textmain1" value="" /> <input type="text" id="textmain2" value=""/> <input type="text" id="textmain3" value=""/> <input type="submit" id="btn1" name="btn1" /> </form> </body>

rails 3 + shoulda + validations based on callbacks -

i new shoulda. many of models have validations below validates :sampling_method, :presence => true, :if => :type_of_resource validate :check_for_decimal_places, :if => :is_size_and_gdnt, :on => :update here, type_of_resource , is_size_and_gdnt instance methods model my shoulda validation first as it { should validate_presence_of(:sampling_method) } but dont know how add check if i have checked second validation using creating object using factory girl, , checking values when object saved how test second validation using shoulda

oracle - how to get value containing special symbol in where clause -

i have requirement pull column value containing special symbol( '.' ). i wrote code below select value, name_display_code vp40.attributes attribute_type_id in ( select attribute_type_id vp40.attribute_types name_display_code = 'attribute_type.r' || '&' || 'd gmd no'||'.') i need value attribute_type.r&d gmd no. tl;dr: set define off before running query (probably). a period ( . ) not special character. way you've split , concatenated value makes me wonder if you're seeing substitution variable issue in sql*plus or sql developer (or maybe other client) because of & , can in turn can make . seem disappear - though not in specific case. a period can mark end of substitution variable, , needed if next characte

linux - mail command not found error while script execution -

below code working on, trying trigger mail when enters if block #!/bin/bash toaddr2="harigm@gmail.com" # main routine export path=/usr/bin:/usr/local/bin ssh -o passwordauthentication=no -q psoft@123.34.71.238 exit test=$? echo "return value $test" set path=/usr/bin:$path mail $toaddr2 -s "this subject" when execute above code, getting mail command not found using bash , tried setting path well. i tried mailx command well, got same error not worked, clue one, might issue. given it's bash script, wanted say export path=/usr/bin:${path} instead of set path=/usr/bin:$path

"Running a 64-bit JVM is not supported on this platform" with java -d64 option on 64bit linux -

i have 64 bit linux os: $ uname -p x86_64 java -version listed: java version "1.6.0_43" java(tm) se runtime environment (build 1.6.0_43-b01) java hotspot(tm) server vm (build 20.14-b01, mixed mode) i trying run 64 bit jvm 4096 min heap size ( heavy weight app ). when add -d64 option message running 64-bit jvm not supported on platform with out -d4 option , heap size 2048 works fine. memory isnt enough need use 64 bit jvm 4gigs. can tell me why not accepting d64 ? thanks @adi dembark , @nos found issue. indeed 32 bit jvm. changing 64 bit fixed it.

java - Reflection for testNG -

i have method uses restrict access via spring security. following method : @preauthorize("isauthenticated() , haspermission(#request, 'create_requisition')") @requestmapping(method = requestmethod.post, value = "/trade/createrequisition") public @responsebody void createrequisition(@requestbody createrequisitionro[] request, @requestheader("validateonly") boolean validateonly) { logger.debug("starting createrequisition()..."); (int = 0; < request.length; i++) { createrequisitionro requisitionrequest = request[i]; // fixme has removed/moved requisitionrequest.setfundmanager(requisitionrequest.getuserid()); // fixme might have search using param level systemdefault sysdefault = dbfuncs.references.systemdefault .findbycompanyanddivisionandportfolio( usercontext.getcompany(),

database - Access query select -

i need query on access database don't know how do. have database table diseases stores diseases names , id 1 called symptoms stores symptoms names , id, , 1 called symptomsdiseases associate symptoms given disease. want diseases have given set of symptoms example diseases symptoms id 3, 4 , 5. sql query should solve this? these tables , fields: 1) diseases iddisease diseasename 2) symptoms idsymptom symptonname 3) symptomsdiseases iddiseases_fk idsymptoms_fk => in table have example: iddisease_fk || idsymptoms_fk 6 || 4 6 || 5 6 || 3 6 || 7 6 || 8 4 || 10 4 || 11 4 || 4 4 || 5 4 || 3 this type of technique called relational division select a.iddisease, a.diseasename diseases inner join symptomsdiseases b on a.iddisease = b.iddiseases_fk b.idsymptoms_fk in (3,4,5) -- &

sql server - SQL Triggers and streaminsight - any StreamInsight Guru's out there? -

when data entered table fires trigger copies different table i want use stream insight when trigger firing , copying amended data different table. how can data input adapter trigger in table(event) how can use trigger event input adapter getting data in streaminsight? why want this? streaminsight provide triggers don't? streaminsight isn't etl tool - that's seem want use for.

Cannot update MySQL from php -

i cannot life of me php update database. i've gotten insert not update. been going @ on 2 hours. need pair of fresh eyes! if can figure out.. huge help. i'm making small stupid mistake, oh well. if i've left out you'd see, please let me know. it's going towards, http://cbogausch.com/portal/ update.php <?php include("config/db.php"); if (isset($_post['submit'])) { $sql = "update `secure_login`.`users` set `link1` = \'$_post[input_link1]\', `link2` = \'$_post[input_link2]\', `link3` = \'$_post[input_link3]\', `link4` = \'$_post[input_link4]\', `link5` = \'$_post[input_link5]\', `link6` = \'$_post[input_link6]\', `link7` = \'$_post[input_link7]\', `link8` = \'$_post[input_link8]\', `link9` = \'$_post[input_link9]\', `link10` = \'$_post[input_link10]\', `link11` = \'$_post[input_link11]\', `link12` = \'$_post[input_link12]\', `pic1`

WPF Equivalent to Flex VGroup -

what wpf equivalent flex vgroup? intent have vertical list of checkboxes flex declaration this <s:vgroup> <s:checkbox label="item 1" /> <s:checkbox label="item 2" /> <s:checkbox label="item 3" /> </s:vgroup> have fooled around grid without success. that should job. <stackpanel orientation="vertical"> ... </stackpanel> http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel.aspx

Problems integrating Jenkins and Mercurial -

i getting next error: java]started user anonymous building in workspace c:\program files (x86)\jenkins\jobs\test1\workspace $ hg clone --rev default --noupdate ssh://locahost/*/test1 "c:\program files (x86)\jenkins\jobs\test1\workspace" remote: unable open connection: remote: host not existabort: no suitable response remote hg! error: failed clone ssh://locahost/*/test1 error: failed clone ssh://locahost/*/test1 finished: failure in mercurial pluging jenkins console have used repository url: ssh://locahost/*/test1 the rest options in default any idea? thanks i don't know why have * character in path remote repository, seems culprit particular error (it generates similar errors against own hg server).

how to connect to ftp server from android -

i have gone through many discussion uploading file ftp server.i think there 2 ways connect , upload: 1: must use apache library , use classes ftpclient. 2: urlconnection code: public void getfile(url u) throws ioexception { // url de type "http://www.monsite.com/monrep/mavideo.wmv" string filename = u.getfile(); filename = filename.substring(filename.lastindexof('/') + 1); urlconnection uc = u.openconnection(); int filelenght = uc.getcontentlength(); if (filelenght == -1) { monview2.settext("fichier non valide:"+ filename); } try { inputstream myinput = uc.getinputstream(); string outfilename = "/sdcard/gpto/"+ nomparcours + "/" + filename; fileoutputstream myoutput = new fileoutputstream(outfilename); byte[]buff = new byte[1024]; int l = myinput.read(buff); w

entity framework - Linq To Entities Compare Value Against List<int> -

i using entity framework 5.0 , , have problem linq query. have following method accepts integer value passed query. works fine. public ilist<tblcoursebooking> getstandardreport(int attendanceid) { return _uow.tblcoursebookingrepo.all .where(cb => cb.attended.equals(attendanceid) .tolist(); } however, need change method accepts list of integers , , pulls out records attended equal of list of integers. this public ilist<tblcoursebooking> getstandardreport(list<int> attendanceids) { return _uow.tblcoursebookingrepo.all .where(cb => cb.attended.equals == attendanceids .tolist(); } i try , use contains or any linq keywords, however, attended single value, not collection, properties available me after dot are compareto, equals, gethashcode, gettype, gettypecode, tostring could please help? thanks time. use contains function, match each id against given list: return _uow.tblcourseb

c# - Print multiple documents in winrt -

i wrote smal app sales customers. wan't print bill ech customer. i don't understand how can set pagebreak code in winrt apps. can give me example? or not supported @ moment? or there eist free components reporting or s.th.? please have @ these posts how print contents of textbox print sample msdn printing mvvm xaml windows 8 store apps - final frontier then if face problem, feel free ask me.

android - Trying to space items in a ListView while using adapter and drawable. Margin is not working -

i trying have listview items have rounded corners , items spaced out each other. done using custom arrayadapter. mycustomadapter arradapter = new mycustomadapter(); setlistadapter(arradapter); i using drawable image round corners <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="10dp" /> <gradient android:angle="90" android:endcolor="#993333" android:startcolor="#ffffff" android:type="sweep" /> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#000000" /> </shape> and setting in layout background top container - linearlayout <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.andr

Is it possible to track emails to the extent that we get counts for "READ","DELETED","SOFT BOUNCE","HARD BOUNCE"? -

the title being self explanatory, add points it. 1.firstly, possible track these (read,deleted,soft bounce,hard bounce) without using third party api? 2. if no, third party services provide same ? i aware <img src="send-identifiers-to-this-url-to-track"/> , can me "no.of reads/forwards", not deleted. anybody in ? there number of things can detect own software , no third party, though don't know how map onto categories list: tracking images , links, said (read). no mail server take message, e.g there might not mx record domain or mailserver ip might blocked dnsbl (maybe mean hard bounce?) mail server response codes . might tell example: your email rejected because mailbox on capacity etc (probably soft bounce) rejected because it's spam (probably hard bounce) greylisted or (probably soft bounce) there nothing can detect difference between unread , deleted messages though. true of third party services. not detect read m

ruby on rails - can't connect to rds at ec2 server, missing mysql socket -

i have ec2 server , rds server. , ruby on rails app connecting rds these settings worked me in local env: host: myappnameandhash.us-west-2.rds.amazonaws.com adapter: mysql2 encoding: utf8 reconnect: false database: maindb pool: 20 username: root password: xxxx socket: /var/run/mysqld/mysqld.sock port: 3306 but on ec2 server don't have mysqld.sock file error: fatal: failed connect mysql (error=can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2)) what need install in order have socket? thanks update: i removed socket definition , port. deploy using capistrano , ssh server , go "current" folder. there try run: rake ts:start , following: rake aborted! can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) but don't have socket definition in database.yml file anymore remove socket , port number database.yml file , try, work.

rest - How to pass model name to angularJS restful api -

i new angularjs, have used backbone while now. i want create reusable restful api can pass model name can use different models. at moment have: angular.module('healthplanapiservices', ['ngresource']) .factory('api', function($resource) { return $resource(base_url + 'api/:object/:id', { id : '@id', object : 'actions' }, { query : { method : 'get', isarray : true, callback : "json_callback" }, save : { method : '@id' ? 'put' : 'post', isarray : true, callback : "json_callback" } }); }); ... sets model 'actions'. in controller use: // collection api.query(function(r) { $scope.actions = r; }); $scope.toggledone = function(a) { a.done = !a.done; //save item api.save(a); } that's fine, how pass model name ('actions' in c

java.lang.Boolean more than two Instances -

i have noticed weird behaviour in code of hibersap project ( booleanconverter linenumber 75). the problem boolean value not converted 'x'. have debugged code , inspected boolean expression javavalue == boolean.true . expression interpreted false because javavalue boolean.true , has id 36 , boolean.true has id 33 (the id shown in variables-view of eclipse ide). can inspect instances of boolean , indeed, there 4 instances of java.lang.boolean!! could please explain me why happening. edit: okay, think question isn't precise enough. field should converted boolean , not java.lang.boolean . must classloader fault here. in case conversion boolean boolean done jvm. know every object comparison should use .equals() (and fill in bug) in case should work is. see following code: public static void main(string[] args) { for(int = 0; < 1000; i++){ print(true); } } public static void print(object value) { system.out.println(value); } this sho

python - Ajax is giving back all the html instead of the variable in Django? -

i have ajax , template this: <html> <body> <script language="javascript" type="text/javascript"> <!-- //browser support code function ajaxfunction(){ var ajaxrequest; // variable makes ajax possible! try{ // opera 8.0+, firefox, safari ajaxrequest = new xmlhttprequest(); } catch (e){ // internet explorer browsers try{ ajaxrequest = new activexobject("msxml2.xmlhttp"); } catch (e) { try{ ajaxrequest = new activexobject("microsoft.xmlhttp"); } catch (e){ // went wrong alert("your browser broke!"); return false; } } } // create function receive data sent server ajaxrequest.onreadystatechange = function(){ if(ajaxrequest.readystate == 4){ document.myform.time.value = ajaxrequest.responsetext; } }

php checking textbox containing a date field -

im using php , im checking if textbox empty (this textbox contains date field) i have $startperiod = date("y-m-d",strtotime($startperiod)); if(empty($startperiod){ // } this if statement not work because when date field empty gets defaulted "1969-12-31" how can fix can check if date field textbox empty? wrap if condition if($startperiod != "") { $startperiod = date("y-m-d",strtotime($startperiod)); if(empty($startperiod){ // } }

objective c - How I know the the posting data goes correctly -

-(ibaction)clicked:(id)sender{ nsstring *cidstring = cid.text; nsurl *url = [nsurl urlwithstring:@"http://localhost:8080/test/?"]; nsstring *postdata = [nsstring stringwithformat:@"companyid=%@",cidstring]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:[url standardizedurl] cachepolicy:nsurlrequestreloadignoringlocalcachedata timeoutinterval:60]; [request sethttpmethod:@"post"]; [request setvalue:@"application/x-www-form-urlencoded; charset=utf-8" forhttpheaderfield:@"content-type"]; [request sethttpbody:[postdata datausingencoding:nsutf8stringencoding]]; [self startconnection:(nsmutableurlrequest *)request]; if([self.result isequaltostring:@"new alert"]) { cid.text = @"scuess"; } } where startconnection method follows - (void)startconnection:(nsmutableurlrequest *)request

full text search - Ruby on Rails thinking-sphinx has many through indexing -

cheers! have tour model these associations: has_many :tour_in_the_countries has_many :country, :through => :tour_in_the_countries and in tour_index.rb thinkingsphinx::index.define :tour, :with => :active_record indexes :title indexes :preview end how add index country's name in case? this should trick: indexes tour_in_the_countries.country.name, :as => :countries

linear algebra - LAPACK Matrix multiplication with C++ -

i new c++ , trying use lapack libraries matrix multiplication. tried run routine dgemm give below. expecting output a*b. every time answer b*a. way routine works or wrong code. my code: #include "stdafx.h" #include<iostream> using namespace std; extern "c" void dgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k, double *alpha, double *a, const int *lda, double *b, const int *ldb, double *beta, double *c, const int *ldc); int main(void) { double a[4] = {1,2,3,4}; double b[4] = {5,6,7,8}; char trans = 'n'; int m = 2; int n = 2; int k = 2; double alpha = 1.0; int lda = 2; int ldb = 2; double beta = 0.0; double c[4]; int ldc = 2; dgemm_(&trans, &trans, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc); cout << c[0] << endl; cout << c[1] << endl; cout << c[2] << endl

javascript - How to hide series name and Y value in hover popup in Highcharts -

hovering on series in highchart graph displays popup series name , y value, in example: 'tokyo 9.5ºc'. display own, custom text on hover - can modifying each point's name. @ same time hide default series name , y value. i've searched doc haven't found suitable. ideas how approach this? you'll have specify tooltip formatter (see documentation ): tooltip: { formatter: function() { return 'the value <b>'+ this.x + '</b> <b>'+ this.y +'</b>'; } }, there can show x-values if or custom text. hope helps.

vba - excel 2003 vb writing class -

Image
i want write class in java/c# in excel 2003 using visual basic. not know write class. is example of writing class? if yes should put these in excel 2003? type employee name string address string salary double end type what have there user defined type (a fixed data structure) can place in module in project. to create class module (which presume you're looking for), right click vba project -> insert -> class module

launch a system command via Javascript in Google Chrome -

i want execute local program on computer via javascript in chrome. in firefox, can done follows var file = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); file.initwithpath(cmd); var process = components.classes["@mozilla.org/process/util;1"] .createinstance(components.interfaces.nsiprocess); process.init(file); process.run(false, args, args.length); can please 1 me execute local program chrome extension? thanks you can't this. chrome's sandbox security model doesn't let arbitrarily execute programs on user's machine; extremely dangerous. theoretically possible using npapi , it's unlikely such plugin approved chrome web store. if private use create plugin using npapi , whatever want, wouldn't able distribute plugin through chrome web store.

html - Apple Safari Buttons onclick takes to long -

i have simple system register present @ party. created easy numkeypad buttons, , works. when try in safari (or other mobile browser), takes second before can press next button. has quick, long. is there way shorten "waiting" time between button presses. click events delayed in mobile browsers due fact browser has ensure user isn't double-tapping or tap-holding element. i have written jquery plugin can handle touch , mouse events in convenient way, , allows bind 1 event trigger without delay ( tap ). can check out here: https://github.com/benmajor/jquery-mobile-events

javascript - Regex expression validation for numbers -

this regex expression have validate situation below: correct input: 12345678,12345678,12345678 *space*12345678 , 12345678 , 12345678 , 12345678 12345678,12345678,*space* 12345678 *space*12345678, 12345678, result: return true(regex expression working correctly situations above.) wrong input: 1234567812345678 result: return true (should false) for wrong input should returning false , return true. should validate wrong input? var validate_commas = /^(\s*\d{8}\s*[,]?\s*)*$/; thank you see ambiguity in description more details on why question ambiguous, , how affects answers get. i assume spaces (ascii 32) arbitrarily allowed: at start of string at end of string before , after comma. i assume want disallow horizontal tabs, new lines, carriage returns , other whitespace characters matched \s , , allow space (ascii 32) freely specified. the bnf grammar above assumptions is: <digit> ::= "0" | "1" | "2&quo

ruby on rails - Functions to be run only when server is started -

i working on rails application. want execute piece of code during server start-up. add code? in config/initializers . .rb files in directory run when server started.

regex - JAVA: Regexp on user-defined tokens -

i need run regexp on set of user-defined tokens. for example, i've string this: tok3 tok1 tok2 tok2 tok4 tok3 // example string and using regexp this: (tok1|tok2)+ // regexp i'd capture sequence of tokens: tok1 tok2 tok2 in example string. now, regexp work on sequence of characters, problem different in sense tokens not characters strings. tokens composed 2 or more characters. furthermore, software should able detect regexp in example matches string @ position (1, 4). for moment, solved problem mapping each token char in ascii alphabet , running regexp after removing spaces. however, i'm not satsfied solution , wondering if there better one. thanks! edit spaces in regexp needed separate tokens. don't mean spaces mandatory between tokens. how storing positions of spaces , using translate string position token position? far elegant straight regex, it's idea. treemap<integer, integer> spaces = new treemap<integer, in

java - Eclipse: Green rectangle label on Class -

Image
what green thing seen on upper-right side of class icon indicate? i couldn't find on after searching label inside eclipse preferences . never seen it, ( very ) dirty , time loosing way know go window -> preferences -> general -> appearance -> label decorations , select 1 label decorations @ time see pluggin making green box appears , check on pluggin documentation.

vim - Make all gvim windows share a single R process and screen session -

old versions of vim-r-plugin offered option choosing whether vim/gvim instances used own r processes (and screen sessions) or single shared process (using vimrplugin_single_r variable). see section 5.2 of documentation of version 101217 . the current version of plugin use separate r processes default , despite best efforts @ loss on how change single process. know how? edit the best solution have found use version 0.9.9.1, last version including option.

complex Xpath into Linq to XML -

my input xml: .... <node attribute1 = "guid1"> <childnode1 attributechildnode= var1> </childnode> <childnode2 attributechildnode= var2> </childnode> </node> <node attribute1 = "guid2"> <childnode3 attributechildnode= var3> </childnode> <childnode4 attributechildnode= var4> </childnode> </node> .... my xpath code looks this mynodelist = xmldoc.selectnodes(".//node[@attribute1 ='" & varstring1 &'']/nodechild[@attributechildnode1 = ''& varstring2 &'']") i have no idea how linq xml code should same result can please me you can still use xpath using xdocument , linq xml; var doc = xdocument.load(filepath); var mynodelist = doc.xpathselectelements(".//node[@attribute1 ='" & varstring1 &'']/nodechild[@attributechildnode1 = ''& varst

Is there an API on Facebook like Foursquare venues explore? -

in foursquare api, there endpoint "explore venues", give lat , lng filtering food example , returns list of venues. there on facebook? couldn't find... with search api http://developers.facebook.com/docs/reference/api/search/ run example on graph api explorer: search?distance=1000&center=-23.5475381,-46.5684873&type=place

jquery - Bootstrap datepicker - Parse date -

i'm using pretty eternicode's/bootstrap-datepicker jquery plugin. i'm trying use included dpglobal tools date operations. example: dpg = $.fn.datepicker.dpglobal; date_format = 'dd/mm/yyyy'; date_str = '31/12/2013'; console.log(dpg.parsedate(start, date_format)); returns me (on firefox) typeerror: format.parts undefined what doing wrong ? check out my fiddleable example you have parse format before use parsedate(...) :) . dpg.parsedate(date_str, dpg.parseformat(date_format)) i've updated fiddle .

Git show diff in certain file -

i'm using github gui , i've old version of project called 2.4, difference in file big visible. can through commandline show diff in commit at: 8f135b0 ? the command: git show 8f135b0 ... show change introduced commit diff, commit message , other details.

c++ - Error in displaying a double value in a PlainText widget -

[update] this code: double tmp=0; double a=4.87149e+07; double b=10; double c=5.29e-06; ... double sum=0; ofstream m2; m2.open("c:/capture/m2.doc"); (i=0;i<916;i++) { (int j=0;j<916;j++) { tmp=a*b*c; sum= sum+tmp; m2 << sum << "\n"; } } 'm having above: when print sum, gives me nan result. when omitted c sum formula, gives me non nan result. thus, believe compiler pretending it's +oo/-oo multiplication (a big, , c small), not case! i,m dealing important data that. i want print result @ end in textedit: plaintextedit->setplaintext(qstring::number(sum)); as reach half of count loop (458), , j (458), values of sum become equal -1.#ind how handle that? running following: #include <iostream> #include <fstream> #include <qdebug> int main(int argc, char *argv[]) { double tmp=0; double a=4.87149e+07; double b=10; double c=5.29

jquery - How to select every last child which got specific css property? -

i trying select every last element got display:block properties in hidden parent element. here example fiddle play with. html: <ul style="display:none;"> <li>1</li> <li>2</li> <li>3</li><!-- goal find last visible child on every hidden ul --> <li style="display:none;">4</li> </ul> jquery: $('ul').each(function() { visiblecountoneachul =+ 0; $(this).children('li').each(function(index) { if ( $(this).css('display') === 'block' ) { visiblecountoneachul += 1; $(this).addclass('thesearevisible'); //this part works; //i can select elems elems got display:block //but can't select last elem on each ul //if ( index === (visiblecount-1) ) { //$(this).addclass('last-visible'); //} } }); }); $('ul

java - Best practices for verifying recursive method calls with Mockito -

consider example class: public class processor { private final dependency dependency; public processor(dependency dependency) { this.dependency = dependency; } public void processusers(list<integer> userids, int attempt) { if (attempt == 0) { //log initial processing } else if (attempt > 0 && attempt < 5) { //log retry processing } else { //log processing limit exceeded return; } list<integer> failedids = new arraylist<integer>(); (integer userid : userids) { try { processuser(userid); } catch (exception ex) { //logging failedids.add(userid); } } if (failedids.isempty()) { //log ok } else { processusers(failedids, attempt + 1); } } public void processuser(integer userid) throws exception{ //dependency can throw exception dependency.call(); } } i verify method processusers calls when exception thrown.

msysgit - Git cannot find ssh-keys in windows console -

i have git repository , can clone in windows machine , bash-console. when trying clone in windows console git cannot find ssh-keys , ask password. here usefull information: [36]: ssh -v -t xx.xxx.xxx.xxx openssh_4.6p1, openssl 0.9.8e 23 feb 2007 debug1: connecting xx.xxx.xxx.xxx [xx.xxx.xxx.xxx] port 22. debug1: connection established. debug1: identity file /.ssh/identity type -1 debug1: identity file /.ssh/id_rsa type -1 debug1: identity file /.ssh/id_dsa type -1 debug1: remote protocol version 2.0, remote software version openssh_5.8 debug1: match: openssh_5.8 pat openssh* debug1: enabling compatibility mode protocol 2.0 debug1: local version string ssh-2.0-openssh_4.6 debug1: ssh2_msg_kexinit sent debug1: ssh2_msg_kexinit received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: ssh2_msg_kex_dh_gex_request(1024<1024<8192) sent debug1: expecting ssh2_msg_kex_dh_gex_group debug1: ssh2_msg_kex_dh_gex_i