Posts

Showing posts from August, 2014

F# higher-order functions on discrete unions -

i trying write rest client in f# uses strongly-typed values define resource "signatures". have decided use discrete unions represent signature list of optional arguments. planning on providing generic way convert parameter value list of tuples represent key/value pairs used create request. learning exercise trying use idomatic f#. i've gotten stuck, trying define 2 different discrete unions have similar signatures. there way me dynamically select right pattern matching function @ runtime? type = | first of string | second of string type b = | first of string | second of string | third of string let createa f s = [a.first f; a.second s;] let createb f s t = [b.first f; b.second s; b.third t] let toparama elem = match elem | a.first f -> "first", f | a.second s -> "second", s let toparamb elem = match elem | b.first f -> "first", f | b.second s -> "second", s

mysql - html textbox posted to php create table columns -

i new php , trying learn. example not going live! i have html textbox , posted php. trying break string using explode function , want add seperate strings select database , table database "columns". or advice great thanks $getmessage = $_post["dbmessages"]; $questions = $_post["dbmessagesname"]; $answers = $_post["dbmessages"]; $combined = array_combine($questions, $answers); $dbconnectiont = mysqli_connect($host, $user, $password, $dbname); // create loop assign input boxes foreach($combined $question => $answer) { // create tables , columns message text box $sqlcreatetable = "create table " . $question . "( add answer column names )"; $answersplit = explode(" ", implode($getmessage)); // if connection , sql quer

.net - Trouble with a member constraint invocation expression when the member signature has type variables in F# -

i'm having trouble using member constraint invocation expressions when member signature has type variables. specifically, code [<autoopen>] module foo // preapplied lens type lens <'i,'j> = { : 'j; set : 'j -> 'i } // record type lenses type foo1 = { num_ : int; letter_ : char } member this.num = { = this.num_; set = (fun num' -> {this num_=num'})} member this.letter = { = this.letter_; set = (fun letter' -> {this letter_=letter'})} end let (foo1:foo1) = {num_ = 1; letter_ = 'a'} // ecord type lenses type foo2 = { num_ : int; name_ : string } member this.num = { = this.num_; set = (fun num' -> {this num_=num'})} member this.name = { = this.name_; set = (fun name' -> {this name_=name'})} end let (foo2:foo2) = {num_ = 2; name_ = "bob"} // add 2 record num lens let inline add2 (x

javascript - AngularJS directives erroring out - Cannot read property 'compile' of undefined -

newbie angularjs , trying create simple directive. code fails typeerror: cannot read property 'compile' of undefined. suggestions appreciated. js var xx = angular.module('myapp', []); xx.directive('myfoo', function(){ return { template:'23' }; }); html <div ng-app="myapp"> <div my-foo></div> </div> you can find code , error here https://jsfiddle.net/p11qqrxx/15/ it's return statement. bad: return {} // returns undefined, return odd , doesn't @ next line good: return{ } // returns empty object, open object on same line return better: var directive = {}; return directive; // how it, avoid issue.

python 2.7 - easy_install not working on OS X -

i seem have screwed python install on mac (running osx 10.10.3), can run python not easy_install . running easy_install gives me sudo: easy_install: command not found however, sudo easy_install-3.4 pip doesn't give me error when try use pip using pip install gevent get -bash: /usr/local/bin/pip: no such file or directory if use pip3.4 install gevent i long set of errors ending with cleaning up... command /library/frameworks/python.framework/versions/3.4/bin/python3.4 -c "import setuptools, tokenize; file ='/private/var/folders/sb/bk7v6n4x30s6c_w_p3jf7mrh0000gn/t/pip_build_oskar/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record /var/folders/sb/bk7v6n4x30s6c_w_p3jf7mrh0000gn/t/pip-q7w99lz8-record/install-record.txt --single-version-externally-managed --compile failed error code 1 in /private/var/folders/sb/bk7v6n4x30s6c_w

Custom Bullets from Images on UITextView or UILabel Swift -

Image
i'm creating app mobile version of large website. website has area lists product features. each feature bulleted unique custom image. is there way swift? essentially, create bullet list of strings, instead use small images bullet dots? make uitextview's text type attributed increase head indentation value construct string in following format: "• string\n\n• string, longer , better. number of words in string higher last one." use alt + 8 type in bullet. result:

ios - Why does NSLog not output aString parameter? -

i have following code in tweak.xm: %hook nsstring - (bool)isequaltostring:(nsstring *) astring { nslog(@"%@", [nsstring stringwithformat:@"isequaltostring : %@ with: %@", astring, self]); return %orig; } %end however syslog output shows self not astring (should after :), example: apr 9 20:46:32 remini citrixreceiver-ipad[7972] <warning>: isequaltostring : with: /var/mobile/containers/data/application/42123bed-a507-4ce0-97b0-20dffd9bb78c apr 9 20:46:32 remini citrixreceiver-ipad[7972] <warning>: isequaltostring : with: /applications/cydia.app apr 9 20:46:32 remini citrixreceiver-ipad[7972] <warning>: isequaltostring : with: /private/var/lib/apt/ apr 9 20:46:32 remini citrixreceiver-ipad[7972] <warning>: isequaltostring : with: /var/mobile/containers/data/application/42123bed-a507-4ce0-97b0-20dffd9bb78c why astring not outputted? i hazard guess string either nil or empty. check against @ beginning of metho

ios - hpple: is it possible to get text value like javascript textContent -

is possible text content of child elements recursively in hpple . method in tfhppleelement class? such javascript document.getelementbyid("testdiv").textcontent i'm using code content of news title nsurl *newurl = [nsurl urlwithstring:@"http://somesite"]; nsdata *newsdata = [nsdata datawithcontentsofurl: newurl]; tfhpple *newsparser = [tfhpple hpplewithhtmldata: newsdata]; nsstring *newsxpathquerystring = @"//div[@class='item column-1']"; nsarray *newsnodes = [newsparser searchwithxpathquery: newsxpathquerystring]; nsmutablearray *newnews = [[nsmutablearray alloc] initwithcapacity: 0]; (tfhppleelement *element in newsnodes) { news *news = [[news alloc] init]; [newnews addobject: news]; news.title = [[element content] stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]]; news.photo_url = [

How to combine a pattern analyzer and char_filter in elasticsearch -

i have keyword field tokenize (split on commas), may contain values "+" characters. example: query_string.keywords = living,music,+concerts+and+live+bands,news,portland when creating index following nice job of splitting keywords on commas: { "settings": { "number_of_shards": 5, "analysis": { "analyzer": { "happy_tokens": { "type": "pattern", "pattern": "([,]+)" } } } }, "mappings": { "post" : { "properties" : { "query_string.keywords" : { "type": "string", "analyzer" : "happy_tokens" } } } } } how can add char_filter (see below) change +'s sp

Keyring python module and Mac OSX -

i'm trying use keyring python module on mac. keyring.get_password returns none, although pretty sure keyring , username in both exist. idea problem? to give more concrete example, piece of code: print "'{}' '{}' [{}]".format(keyring, username, keyring.get_keyring()) return keyring.get_password(keyring, username) prints when invoke concrete arguments: 'login' 'skype' [<keyring.backends.os_x.keyring object @ 0x10c85b450>]

python - Interpolate doesn't work for numpy percentile -

i'm trying use midpoint interpolation when using np.percentile , gives me error: typeerror: percentile() got unexpected keyword argument 'interpolation' there way fix this? it says in the documentation of np.percentile interpolation argument added in numpy version 1.9.0. based on error message, think need upgrade.

angularjs - Call to a REST API cause 415 (Unsupported Media Type) -

am trying integrate service web app, did making post call got error: post https://admin.example.com/api/v1/service 415 (unsupported media type) am not http codes tried figure out 415 means didn't reall doing simple: .controller('createbeaconctrl', function($scope, $state, $http) { $scope.item = { value1: $scope.value1, value2: $scope.value2, value3: 1 }; var url = 'https://admin.example.com/api/v1/service'; $scope.submit = function() { $http.post(url, $scope.item). success(function(data, status, headers, config) { // callback called asynchronously // when response available console.log("done"); }). error(function(data, status, headers, config) { // called asynchronously if error occurs // or server returns response error status. console.log("error making call"); }); }; }); am authenticating call sending username , pass

Copy contents of HTML to column- error handling VBA Excel -

solved!!! followed advice of jbarker2160 on error resume next solution. refined code made use less resources. sub project() dim locationarr variant dim long dim g_strvar string dim fake string locationarr = range("c1:c8877").value = lbound(locationarr) ubound(locationarr) fake = (locationarr(i, 1)) g_strvar = importtextfile(fake) activecell.value = g_strvar activecell.offset(1, 0).select g_strvar = "" next end sub function importtextfile(strfile string) string on error resume next open strfile input #1 importtextfile = input$(lof(1), 1) close #1 end function original question how create error handling on process? first time user. i copying local backup file content intranet csv. have been stumbling around vba build solution. need figure out how handle error. my current sheet contains list of product sku's, product names, , file path html files populate pages (some of outdated paths). using vba have place fil

javascript - Getting CSS Calc percentages to update during resize -

i have series of panels have css calc/percentage based heights , widths. panels accurately , smoothly resize after window size has changed. height: calc(50% - 5px); however, wondering if there way have panels resize while window being resized instead of after. don't want use kind of js calculation this! if there dom api setting or way of manually re-firing calc() function on resize, acceptable. edit: don't want calculating widths , heights in js. else fine. does know way of doing this?

php - Error adding line in mysql with correct syntax -

i've looked @ several answers none solving problem. i want insert several lines table , using following code: insert teams (id, 'name' , 'password' ) values(2, 'aston villa' , 'aston villa' ); column types are: int,varchar,varchar but keep getting following error: "#1054 - unknown column '2' in 'field list'" also if want hash password inline believe still receiving same error insert `teams`(id, `name`, `password`) values (`2`,`aston villa`,sha256(`".$astonvilla."`)); make sure wrapping values properly: $insert = printf("insert teams(`id`, `name`, `password`) values (2,'aston villa',sha256('%s'));", $astonvilla);

java - Consuming SSL Web Services on JBoss 7 -

i'm running application in jboss7 using jaxws consume web services. however, have consume 1 of these web services on ssl. i can set using system.setproperty() properties javax.net.ssl.truststore , javax.net.ssl.keystore , etc. appropriate passwords set. this working, doesn't seem elegant me. so, question is: there better way consume web services on ssl?

c++ - Dead virtual function elimination -

question (can clang or perhaps other optimizing tool shipped llvm identify unused virtual functions in c++ program, mark them dead code elimination? guess not.) if there no such functionality shipped llvm, how 1 go implementing thing this? what's appropriate layer achieve this, , can find examples on build this? thoughts my first thought optimizer working on llvm bitcode or ir. after all, lot of optimizers written representation. simple dead code elimination easy enough: function neither called nor has address taken , stored somewhere dead code , can omitted final binary. virtual function has address taken , stored in virtual function table of corresponding class. in order identify whether function has chance of getting called, optimizer not have identify virtual function calls, identify type hierarchy map these virtual function calls possible implementations. this makes things quite hard tackle @ bitcode level. might better handle somewhere closer front end, @ stage

javascript - Module pattern and this -

i using module pattern javascript "classes". there significant downside declaring var self outisde of class returning , setting this inside class constructor don't have worry context switching when don't want to. in small example it's unnecessary, example. example: var seat = (function() { var self = null; function seat(startx, starty, inputseatnumber, inputtablenumber) { self = this; self.radius = 10; self.x = startx; self.y = starty; self.seatnumber = inputseatnumber; self.tablenumber = inputtablenumber; } seat.prototype.moveto = function(newx, newy) { if(newx >= 0 && newy >= 0) { self.x = newx; self.y = newy; } }; return seat; })(); edit: example added var seatingchartview = (function() { function seatingchartview(canvas_id, seatingchartcontroller, seatform) { this.stage = new createjs.stage(canvas_id); this.contr

javascript - How to remove all hidden characters except colons, numbers and 'AM' or 'PM' -

i have string has time in this "6:00:00 am" or "10:15:00 pm" i know string has hidden characters in use regex replace characters except colons, numbers , or pm. not sure if below works because have string comparison check still failing. selectedtime = selectedtime.replace(/^\w:\s/g, ""); i tried selectedtime = selectedtime.replace(/[^\w:\s]/g, ""); as stated... replaced except numbers (the ^\d part), colon (the ^: part) , am/pm (the ^amp part). selectedtime = selectedtime.replace(/[^\d:amp]/g,""); you might test using https://regex101.com

vb.net - Ctrl plus Alt makes Visual Studio hidden form appear -

i want application run in system tray, antivirus software , such. form should not visible. use following code hide form on startup: protected overrides sub setvisiblecore(byval value boolean) if not me.ishandlecreated me.createhandle() value = false end if mybase.setvisiblecore(value) end sub that works fine. however, when press both ctrl , alt keys on keyboard, form appears. google makes seem first 1 have problem. hope not. how can make form truely hidden? set application's formborder "fixedtoolwindow" (or this, try all; worked me, can't remember right formborderstyle)

python - how to get a defautdict(set) like this form : {str : { str : int } } -

i got dictionary this {('a','b'):3, ('b','c'): 2, ('a','c'): 5} i want convert form : {'b': {'c': 2}, 'a': {'c': 5, 'b': 3}} that means have build dictionary form: d:{(str1,str2):int} --> {str1 : { str2 : int } } you not want defaultdict based on set based on dict instead. dic = {('a','b'):3, ('b','c'): 2, ('a','c'): 5} dic2 = defaultdict(dict) j,k in dic: dic2[j][k] = dic[(j,k)] ## dic2 = defaultdict(<type 'dict'>, {'a': {'c': 5, 'b': 3}, 'b': {'c': 2}}) on side note, d.keys() iterable, there no need call list(d.keys()) . in fact, iterate on keys of dictionary d , best call for key in d:

ios - Modal View change my Tab when it close -

i have tabbarviewcontroller 2 tabs: tab(a) , tab(b). both tabs has uitableview inside , when click in cell, modal view appears. if click on tab(a) default tab, works fine problem when go tab(b) , after opening modal view, when close modal view tab bar automatically goes default tab tab(a). tried : [self dismissviewcontrolleranimated:yes completion:nil]; and : [self.presentingviewcontroller dismissviewcontrolleranimated:yes completion:nil]; for going back. have same result. you can save last view controller selected in tab bar such: -(void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller { _previousviewcontrollerindex = // index of tab here } after dismissing model view, viewdidappear called on uitabbarcontroller, , can programatically select previous selected controller: - (void)viewdidappear:(bool)animated { [super

mongodb - Meteor / Iron Router: Data from Mongo db collection don't show up in dynamic template page -

i'm quite new in javascript programing, appreciate help. i'm using: meteor (official windows port) latest version 1.1.0.2 iron router , autopublish package what i'm trying do, shouldn't hard do, missing me. want load data mongo db collection movies = new mongo.collection('movies'); into template in /client folder <template name="movie_template"> <p>dynamic page test movieid {{id}}</p> <h1>{{name}}</h1> <p>{{year}}</p> </template> my router.js file based in /lib folder in root of meteor project router.route('/movies/:movieid', function() { this.render('movie_template', { waiton: function() { return meteor.subscribe('moviesdetails', this.params.movieid); }, data: function() { return movies.findone({id: this.params.movieid}); } }); }); publications.js in /server folder meteor.publish('moviedetails', func

javascript - html input type=file -- Select a file from iCloud -

i'm developing cordova / phonegap-based application has embedded text editor. access selected files, i'm having user browse mobile device using html <input type=file> element: <div class="control-row"> <label for="selfile" class="topcoat-button">{{t 'view.lblselect'}}</label> <input type="file" value="" id="selfile" multiple> </div> on ios, however, clicking on input element brings photos instead of allowing me pick icloud documents. there way select icloud documents cordova / phonegap? the attr "multiple" not compatibile icloud file, can try remove , work fine,but can select 1 file of couse <div class="control-row"> <label for="selfile" class="topcoat-button">{{t 'view.lblselect'}}</label> <input type="file" value="" id="selfile" > </div>

Connect to Cassandra Apache with SSL using cassandra-driver in Node.js -

i try connect cassandra have wrongly configured. run on localhost. cassandra has generated certificated , add on. in cqlsh there no errors flag --ssl. fragment code var tls = require('tls'); var fs = require('fs'); var options = { key : fs.readfilesync('client-key.pem'), cert : fs.readfilesync('client-cert.pem'), ca : [fs.readfilesync('server-cert.pem')] }; var client = new cassandra.client({ contactpoints : ['127.0.0.1'], authprovider : new cassandra.auth.plaintextauthprovider('cassandra', 'cassandra'), ssloptions : tls.connect(options) }); what i'm doing wrong? please help! you should not need specify tls.connect(options) rather should provide options ssloptions. driver calls tls.connect ssloptions provide. if make change , still errors, can share me are? there lot of different factors can make establishing ssl connection fail.

javascript - jquery .html feature stripping tags -

i'm attempting modify elements , give them elements. table , elements created. however, upon attempting load s response text strips s. i've verified response text propping loading on it's own page, when using below code. tags stripped. $("#records").load("get.php?"+str, function(){ $('.trclass').each(function(){ var id=this.id; var xmlhttp=new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { $('#'+id).html(xmlhttp.responsetext); } } xmlhttp.open("get","get.php?read=true&"+str2,false); xmlhttp.send(); }); }); i've verified responsetext correct. i'm fine turning .append() or .load() need works. i've seen solutions involving making new div , putting table in , sending that's way hacky , don't wan

windows - Extracting EMF from EMF Spool? -

windows emf spool files format well-known , documented, cannot seem understand how can extract information spool file. right now, i'm trying achieve extract emf spl file (as general rule, should present). know spool file defined structures, this: private enum spoolerrecordtypes srt_eof = &h0 ' // int32 0 srt_reserved_1 = &h1 '* 1 */ srt_fontdata = &h2 ' 2 font data */ srt_devmode = &h3 ' 3 devmode */ srt_font2 = &h4 '4 font data */ srt_reserved_5 = &h5 ' 5 */ srt_font_mm = &h6 ' 6 font data (multiple master) */ srt_font_sub1 = &h7 ' 7 font data (subsetfont 1) */ srt_font_sub2 = &h8 ' 8 font data (subsetfont 2) srt_reserved_9 = &h9 srt_unknown = &h10 ' // int unknown... srt_reserved_a = &ha srt_reserved_b = &hb srt_page = &hc ' 12 enhanced meta file (emf) */ srt_eopage1 = &hd ' 13 endofpage */ srt_eopage2 = &he ' 14 endofpage */ srt_ext_font = &hf ' 15 ex

c++ - Putting a line on a QPushButton -

i creating program draws graphs; want able have button user can press choose line color , style. want able visually show current selection is. currently, know can using 2 seperate widgets, qpush button, , widget make myself draws line across using qpen. i turn these 2 widgets single widget. want widget pushable "button" user presses , can signal out of run routine sets new qpen. is functionality built in? or need create new widget re-implements either qpushbutton or qactionbutton? or should make widget listens mouseclick events on , create signal slot there? you use qlabel , set style sheet, , use line on graph. use bounds of qgroupbox define x , y axis. maybe this: yourqlabel.setstylesheet("qwidget {background-color: rgb(255, 0, 0); color:white; border: 1px solid black;}"); // red black border then can set height, width , position of qlabel based on values graph. of course work if lines on graphs rectangular. if aren't, you'll ha

python - Clear SQL database -

i want remove entered data sql database. using python handle of sql statements program - did not make backup of clean database, , want clear records , reset primary ids etc without affecting structure of database ready ship code. i using python , sqlitestudio. thanks. in sqlitestudio's sql editor execute command: delete table_name; if have multiple tables command is: delete table_name_1, table_name_2,...; instead of table_name put name of table(s).

passport.js - Better quality photo from passport-facebook -

how 1 better quality picture passport-facebook , picture recieve in photos[0].value 50x50 pretty poor, wish atleast 150x150.i trying mess link - no luck. possible retrieve better quality profile picture? edit: current fb strategy setup: passport.use(new facebookstrategy({ clientid: 'xxxxxx', clientsecret: 'xxxxx', callbackurl: 'http://localhost:4242/facebook/cb', profilefields: ['id', 'name', 'displayname', 'photos', 'hometown', 'profileurl'], passreqtocallback: true }, ... you should able specify profilefields property described in https://github.com/jaredhanson/passport-facebook#profile-fields like following retrieve larger picture: passport.use(new facebookstrategy({ // clientid, clientsecret , callbackurl profilefields: ['id', 'displayname', 'picture.type(large)', ...] }, // verify callback ... )); or change strategy.js file

javascript - Want to show unique values only using d3.js not working -

i have large dataset same detector having multiple occurrence. there many detectors. want fill combobox unique detectors only. using following code: d3.select("#detectors") .selectall("option") .data(d3.map(data, function(d) { return d.code; }) .keys()) .enter() .append("option") .text(function(d) { return d; }).attr("value", function(d) { return d; }); but not showing unique detector codes. rather combobox being filled number 1 ongoing. how can desired goal. sample simple dataset is var data=[{"code":5222,"date":3-4-2015},{"code":5222,"date":3-6-2015},{"code":5222,"date":3-7-2015},]; the data has in real large number of detectors unique code. want show these unique codes in combobox. above case there 1 5222 in options i think need use nest() . var nest = d3.nest() .key(function(d) { return

c++ - Figuring out the algorithmic complexity of my Program in Big-O Notation -

i have created program binary search on order list user enters, , outputs desired value want search in list. problem have find algorithmic complexity in big-o notation each part of code time complexity of it, however, not great @ figuring out big-o notation. if possible explain how it, etc. here's code , have tried figure algorithmic complexity lines, if did wrong please correct me. #include<iostream> #include<vector> using namespace std; int binarysearch(vector<double> uservector, int, int); int main() { int size; // o(1) int i; //o(1) int desirednum; // o(1) cout << "how many values want enter: "; // o(1) cin >> size; // o(1) vector<double> uservector(size); (i = 0; < size; i++) { cout << "enter value: "; cin >> uservector[i]; } cout << "what value looking for: "; // o(1) cin >> desirednum; // o(1) int location = binarysearch(uservector, size, desirednum);

Why is CakePHP 3 so slow at autoloading classes on a Vagrant box? -

Image
setup vagrant box (2gb memory) apache/2.2.22 (ubuntu) php 5.4.38-1+deb.sury.org~precise+2 (cli) (built: feb 20 2015 12:16:47) cakephp 3 i installed fresh cakephp 3 composer, , basic default home page noticed page took 4s ~ 5s load. here benchmarks ( kitchen.com server alias): chrome dev tools phpstorm + xdebug even composer.phar dumpautoload -o didn't change thing. sometimes rest calls (returning small json) reach ~12s because of autoload , php_sapl_name: ajax rest call request url: http://kitchen.com/admin/kitchen/settings.json request method: get response: { "settings": { "sitename": "site settings", "desciption": "lorem ipsum" } } controller action: public function index() { $this->set('settings', ['sitename' => 'site settings', 'desciption' => 'lorem ipsum']); $this->set('_serialize', ['

php - ZF2: Why are my sessions logging out? -

my zf2 application logs out after short period of inactivity - say, 60 minutes or - , can't understand why. i have 'auth' object singleton composes instance of zend\session\container . constructor creates container following line: $this->session = new container('auth'); the auth object has login() method stores current user following line: $this->getsession()->userid = $user->id; the auth object has isloggedin() method tests status follows: if ($this->getsession()->userid) { return true; } return false; that's pretty straightforward. yet, time time when bootstrap checking see if logged in, comes false. why? here's printout of config session manager: 'cookie_domain' => '', 'cookie_httponly' => false, 'cookie_lifetime' => 604800, 'cookie_path' => '/', 'cookie_secure' => '', 'name' => 'myapplication', 'remember_

css - How to show website is not aligned? -

Image
is there way show webmaster "learn more" boxes aren't aligned , need adjusted few pixels or down in css file? webmaster cant see misalignments. see "learn more" boxes edification. thank time. you can use developer tools in browser. for internet explorer: press f12 . select dom explorer (press ctrl+1 ). select element (press ctrl+b ). mouse on elements , can see grid lines of elements on page. google chrome has similar features. btw, don't see icons misaligned. perhaps need refresh browser.

tabs - Getting additional NA column in read.delim in R -

i reading text file in r of form (from terminal) hmi$ head -2 output_perl_hmi.txt 1 cg10619-rb tup 18864094 18864523 rev gfp_rnai3_r1 0.870707220482784 1 cg11050-rc cg11050 6613278 6612484 rev gfp_rnai3_r1 0.999267733859066 but when read in r using read.delim, adds additional column of na @ end. can remove column wondering why it's creating additional column , how can avoid when reading file. > d=read.delim("output_perl_hmi.txt", header=f) > colnames(d) <-c("count", "flybasename", "genename", "start", "end", "type","sample", "posterior_probability") > head(d) count flybasename genename start end type sample posterior_probability na 1 1 cg10619-rb tup 18864094 18864523 rev gfp_rnai3_r1 0.8707072 na 2 1 cg11050-rc cg11050 6613278 6612484 rev gfp_rnai3_r1 0.9992677 na firstly, must

.htaccess - Only redirect if not mobile? -

i need create redirect if user agent not mobile. unfortunately can't done. #rewritecond %{http_user_agent} !"android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [nc,or] rewritecond %{http_host} ^example\.com$ [or] rewritecond %{http_host} ^www\.example\.com$ rewriterule ^/?$ "https\:\/\/example\.com\/home" [r=302,l] any appreciated. thank you. got done # redirect desktop rewritecond %{http_host} ^example\.com$ [or] rewritecond %{http_host} ^www\.example\.com$ rewritecond %{http_user_agent} !(android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera\smobile|palmos|webos) [nc] rewriterule ^/?$ "https\:\/\/example\.com\/home" [r=302,l] # redirect mobile rewritecond %{http_host} ^example\.com$ [or] rewritecond %{http_host} ^example\.com\/home$ [or] rewritecond %{http_host} ^example\.com$ rewritecond %{http:x-wap-profile} !^$ [or] rewritecond %{http_user_agent} "android|blackberry|ipad|iph

c - Queue sorting function sorts to the wrong queue -

here queue sorting function, dispatchlist, realtime, , jobqueue defined queue struct struct queue { pcbptr front; pcbptr back; }; typedef struct queue queue; and pcbptr defined as struct pcb { int pid; int arrival_time; int time_left; int priority; int status; int printers; int modems; int scanners; int cds; int memory; //might need struct memory block? struct pcb* next; struct pcb* prev; }; typedef struct pcb pcb; typedef pcb * pcbptr; now actual function void starthostd(){ int i=0; while(dispatchlist.front != null){ if(dispatchlist.front->priority == 0){ enqueue(dispatchlist.front, &realtime); dispatchlist.front = dispatchlist.front->next; printf("the %d pcb moved realtime queue\n", ); } else{ enqueue(dispatchlist.front, &jobqueue); dispatchlist.front = dispatchlist.front->next; printf("the %d pcb moved job queue\n&q

javascript - Knockout Search / Filter -

i'm new knockout js , i'm having hell of time trying project completed. i've created map website displays series of pins on page popular locations around town. idea search bar left of page filter out pins on map names not match search query. there "master" list on left of page search bar filter too. i used example found on jsfiddle here: http://jsfiddle.net/mythical/xjezc/ i'm having troubles applying same logic code. here is: html: <li> <input class="form-control" placeholder="search…" type="search" name="filter" data-bind="value: query, valueupdate: 'keyup'" autocomplete="off"> </li> <ul data-bind="template: {name:'pin', foreach: pins}"></ul> </ul> <script type="text/html" id="pin"> <li> <strong data-bind="text: name"></

javascript - why the width of elements are different after page load and after that moment? -

the situation want change size of element right after page load. problem element did not change because result returned function getsearchbarwidth negative number. strange here console prints incorrect values of width of 2 element web_logo , menu ; width should small, in console, width of both elements equal parent element, navigation bar. later, print out again width of 2 element in console, result correct. can explain this? update: seems because don't specify width of navigation bar. there other except specify width of parent element correct width of children right after page loads? <script src="js/function.js" defer></script> content of file js // calculate width of window , relevant element function getsearchbarwidth(){ var wwidth = $(window).width(); var offset = 20; // distance between search bar , each of 2 next elements var offset_1 = 15; // padding of each sides of navi bar var searchbarwidth = wwidth - $("#navi_bar

Retrieve Python version from pyd built without such an information -

Image
on windows, have python library (*.pyd), , need check linked python version. can python 2.7.x or 3.x. when run using win32api (adapted here: https://stackoverflow.com/a/20064736/2741329 ): def get_pyd_python_version(pyd_path): """ python version required passed pyd library """ import win32api print("- pyd path: %s" % str(pyd_path)) try: info = win32api.getfileversioninfo(pyd_path, '\\') except win32api.error e: print(str(e.strerror) + " > " + pyd_path) return "" python_version = "%s.%s.%s.%s" % ( str(win32api.hiword(info['fileversionms'])), str(win32api.loword(info['fileversionms'])), str(win32api.hiword(info['fileversionls'])), str(win32api.loword(info['fileversionls']))) return python_version i get: the specified resource type cannot found in image file. the same funct

unknown host - What is code (not MAC) in place of IP address? -

in place of ip address, there code looks simular "2600:1000:b11c:d167:cb6c:bd27:8c9:41ba". this? 2600:1000:b11c:d167:cb6c:bd27:8c9:41ba example of ipv6 address , unlike 32-bit ipv4 address, length 128-bit.

java - Sending a class object to a multipart-form-data-expected web service -

this web service's declaration @post @path("/upload") @consumes(mediatype.multipart_form_data) @produces("application/json") public devicedbuploadresponse upload(@formdataparam("file1") inputstream file1, @formdataparam("file2") inputstream file2, @formdataparam("name1") string filename1, @formdataparam("name2") string filename2, @formdataparam("id") string id) my web service call var fd=new formdata(); fd.append("id",id); /* lines of code here */ $.ajax({ url: 'http://localhost:8080/linterm2m/webapi/m2m/upload', data: fd, processdata: false, contenttype: false, type: 'post' }); everything works far. required receive data (filename , id) through request object, like: public class request{ string id; string filename1; string filename2; } but doubt can fulfilled because of multipart-form-data consuming type.

Why Ionic Framework Doesn't Support Tablet Layout on Android? -

Image
i have big problem ionic framework after compile platform android release on play store such warning message play store doesn't compatible tablet layout. can check screenshots below: warning message on play store developer console: they said designed phones: when tested on tablet, didn't problem , fit tablet layout except got problem screenshots above. how can fix it? you can download application on link

.htaccess - If the mp4 video was not found, throw the flv video -

i own video sharing website users upload videos it. usually videos converted mp4 file , streamed. however, many times due server failures, video gets converted flv files. flv , mp4 files stored within same location under same name. the player calls 1 video file source: http://server.mysite.com/location/user/id/file.mp4 i want server throw same link flv file instead of mp4 (if mp4 file not found), in case if mp4 video not found server throw: http://server.mysite.com/location/user/id/file.flv how achieve using htaccess? custom 404 page how dropping custom 404 error page looks whether alternative file exists , redirects there. mod_rewrite second option involves mod_rewrite (untested pseudo-code): in /etc/httpd/conf/httpd.conf (or wherever httpd.conf lives in distro) enable rewriteengine (you can per vhost if wish so): rewriteengine on also don't forget set allowoverrides directory: <directory /foo/bar> allowoverrides fileinfo </direc

javascript - CKeditor: change default select option in dialog -

i changle "link" dialog window. need able insert anchor (remove url , emails option). use code: ckeditor.on( 'dialogdefinition', function( ev ) { var dialogname = ev.data.name; var dialogdefinition = ev.data.definition; if ( dialogname == 'link' ) { var infotab = dialogdefinition.getcontents( 'info' ); var linktypefield = infotab.get( 'linktype' ); linktypefield['default'] = 'anchor'; linktypefield['items'].splice(0, 1); linktypefield['items'].splice(1, 1); } }); this code remove url , email options. when dialog box appears nothing selected. how select "anchor" option default? your customisation ok, except it's missing: linktypefield.setup = function() { this.setvalue( 'anchor' ); }; because default implementation selects url link type when creating new link, unless data (li

Can I pass a clock signal as an input argument in a Verilog task? -

i writing testbench in vcs(g-2012.09) verify spi module. here task byte spi master: task get_byte; begin repeat(8) @(posedge spck) begin if (spss == 1'b0) tmp = {tmp[6:0], mosi}; end $display ("[time:%dns]---->get byte: 0x%h", $stime, tmp); end endtask it works. want parameterize task , replace code with: task get_byte; input clk, oen, din; output [7:0] byte; begin byte = 8'd0; repeat(8) @(posedge clk) begin if (oen == 1'b0) byte = {byte[6:0], din}; end $display ("[time:%dns]---->get byte: 0x%h", $stime, byte); end endtask but when called task get_byte(spck, spss, mosi, tmp) , run testbench in vcs, stucked. seemed spck did not pass work clk inside task. so there rule clock signal can not used input argument within task or did make wrong? in 1 of old stackoverflow questions can find following answer : in verilog arguments passed tasks

c# - Interface Object Always Null -

i created "personfuntionality" object "personfuntionality" interface. interface has method save details of person.the problem personfuntionality has null value. public personfuntionality personfuntionality; try { list<beans.person> prsn = new list<beans.person>(); beans.person psn = new beans.person(); psn.personid = convert.toint32(txtid.text.trim()); psn.personname = txtname.text.trim(); psn.personcity = txtcity.text.trim(); prsn.add(psn); //prsn.personid = convert.toint32(txtid.text.trim()); //prsn.personname = txtname.text.trim(); //prsn.personcity = txtcity.text.trim(); if (personfuntionality != null) { bool success = personfuntionality.savepersondetails(prsn); if (success == true) {

android - zxing doesn't handle null properly -

the error message zxing should show if result null doesn't come up. need change? code here: public void onactivityresult(int requestcode, int resultcode, intent intent) { intentresult scanningresult = intentintegrator.parseactivityresult(requestcode, resultcode, intent); if (scanningresult != null) { //we have result scancontent = scanningresult.getcontents(); scanformat = scanningresult.getformatname(); formattxt.settext("format: " + scanformat); contenttxt.settext("content: " + scancontent); toast.maketext(this, "please click 'update database' after message ends", toast.length_long).show(); } else{ toast.maketext(getapplicationcontext(),"no scan data received. restart scanner", toast.length_short).show(); } } no matter result, 'please click' toast

How to use a 'for' loop to iterate nested-list index items in Python 2.7? -

i have list this: nlist = [[0,0,0],[3,2,1]],\ [[]],\ [[100,1000,110]],\ [[0,0,0],[300,400,300],[300,400,720],[0,0,120],[100,0,1320],[30,500,1450]] and need store outputs in such manner every variable before '\' comes out this, example, before 1st '\': 0 metres, 0 metres, 0 seconds 3 metres, 2 metres, 1 seconds i have come far individual indexes before each '\', example nlist[4] : outputlist = [] distance in nlist[4]: outputllist.append('{} metres, {} metres, {} seconds'.format(*distance)) but how create for loop iterates on nlist indexes , stores output in format 'x' metres, 'y' metres, 't' seconds in empty list outputlist ? thanks help. for in range(1,len(nlist)): distance in nlist[i]: outputllist.append('{} metres, {} metres, {} seconds'.format(*distance)) i think you're asking.

Android search listview like dial pad search(search for both name and number) -

Image
i created dial pad using grid view , got call log in list view, enabled search functionality call log user entered number(from gridview). how can search call log contact name also. suppose when user entered 7 showing call log containing 7 number, not showing call log containing letters p,q,r,s in contact name. have filter both same time. dialerhomeactivity.java calllistadapter=new customadapter(dialerhomeactivity.this, r.layout.list_row, common.calloglist); /** * enabling search filter * */ // capture text in edittext phone_num_edt.addtextchangedlistener(new textwatcher() { @override public void aftertextchanged(editable arg0) { // todo auto-generated method stub string text = phone_num_edt.gettext().tostring().tolowercase(locale.getdefault()); calllistadapter.filter(text); } @override public void beforetextchanged(charsequence arg0, int arg1, int arg2, int arg3

php - SMS Gateway setup from localhost server -

i have server computer windows os , mysql database installed.it contains php program has sms sending feature, runs through zend server , apache. server computer connected other client computer networking. client uses internet explorer use php program. the server has constant internet clients doesn't. thing sms gets delivered if client computer has active internet connection. means whoever using program main server client has have internet connection, no matter if server has internet or not. i don't want share internet connection clients want them able send sms through program. want if server has internet if client server requesting send sms program use internet server , sen sms. is there coding or solutions doing that?

bluetooth lowenergy - Interacting with BLE from both android and iOS app -

i have same app 2 versions in android , ios. in app, need interact ble devices find uuid of devices. want make predefined database uuid of devices saved. android app, mac address uuid. in ios app, different uuid. how can same uuid both android , ios app after scanning ble? can ble made write protected? if yes, how possible?

actionscript 3 - How to get Http path of recorded video in flash using Flash media server -

i using influxis flash media server recording of video using flash application. recording part working fine , can find recorded video on fms server in .flv format. now have convert video on server mp4 format , have play recorded video mobile. need http path of recorded video can access video , can play on device have rtmp url of video cannot played ios or android application. please provide solution. thanks.

jquery - Adding options to select dynamically -

i have pulled data backend using ajax/json, , trying append data select box using jquery. data appended select box properly, shown on page when put alert("some text") . here code: var comp_select = jquery("select[class='xf-depselect-selector depselect-fragment']").get(3); alert("some text"); (var = 0; < data.length; i++) { jquery(comp_select).append(new option(data[i]["component_name"], data[i]["component_name"])); } without seeing more of code, sounds race condition. code append items inside success callback ajax call, or function called after calling ajax method? loop through 'data' suggest callback wouldn't able tell sure snippet

how to jsf tags are working in OSGI freamework -

i'm new in osgi framework(equinox). use eclipse kepler version. succesfully deployed myfaces , dependency bundles equinox. myfaces bundle "myfaces-bundle-2.1.18-snapshot.jar". dependency bundle has web.xml file, manifest.mf file , index.xhtml. when try run it, can't see jsf tags "h:" or "f:". pure html tags working properly. missing? here web.xml file; . . . . <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>faces servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <context-param>