Posts

Showing posts from February, 2015

Error in displaying custom Google Map in Polymer -

i displayed simple google map : <google-map latitude="30.283" longitude="57.083" zoom="12" language="fa" disable-default-ui > but when try add position style, doesn't apply , zoom control disappears, guess problem in way add additional-map-options , don't know how fix it: <google-map latitude="30.283" longitude="57.083" zoom="12" language="fa" disable-default-ui additional-map-options='{"zoomcontrol" : "true", "zoomcontroloptions" : {"style" : "google.maps.zoomcontrolstyle.small", "position" : "google.maps.controlposition.bottom_right"} }'> huh... turns out polymer not know google.maps.controlposition.bottom_right ... knows int 9 ... <google-map latitude="30.283" longitude="57.083" zoom="12" langua...

Java Swing - Detect which display a JFrame is displayed on -

i aware this question can current displays graphicsdevice[] in swing application following code: graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice[] gd = ge.getscreendevices(); i understand here set device myself, let user select use in menu, etc. goal detect of these graphicsdevices application displayed in, can default fullscreening in current graphicsdevice without bothering user. i using code following fullscreen application: jframe frame = new jframe(); // ... when want fullscreen: graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); graphicsdevice gd = ge.getdefaultscreendevice(); if (gd.isfullscreensupported()){ frame.dispose(); frame.setundecorated(true); frame.setalwaysontop(true); gd.setfullscreenwindow(frame); frame.setvisible(true); } i cannot find in graphicsdevice or graphicsenvironment apis current graphicsdevice jframe displayed on. aware there may possible hacks posit...

html - How to stop a fixed positioning going negative -

i updating site responsive design, has content in 1000px width container centres on viewport. want used fixed sidebar, want whole content still stick 1000px , centred in viewport, , when viewport less 1000px, bootstrap responsive design work. current best attempt follows: <div id="wrapper"> <div id="page-content-wrapper"></div> <div id="sidebar-wrapper"></div> </div> with css #wrapper{ height: 100%; position: fixed; left: calc((100vw - 1000px)/2); top: 0; max-width: 1000px; width: 100%; overflow: auto; } #page-content-wrapper{ position: relative; overflow-y: scroll; height: 100%; padding: 0px; } #sidebar-wrapper { position: absolute; top: 0px; left: 250px; } this works fine until viewport less 1000px, @ time bootstrap works e.g. menus collapse, content starts disappearing left. because wrapper left position goes negative viewports less 1000px. h...

powershell - What is the FileSystem provider filter syntax? -

get-help get-childitem displays -filter parameter, displayed wording " specifies filter in provider's format or language ". language differs between powershell calls "providers", , file system declared 1 of them. have not found syntax descriptions on file system provider's filter syntax. help? the filter syntax supported filesystem provider sparsely (if all) documented, because there's nothing say. in short, supports simple wildcard matching know windows xp-era search: any file extension: *.* any file .txt extension: *.txt partial wildcard matching: *something*.txt single-character matching (matches myfile1.jpg not myfile01.jpg ): myfile?.* note : only supports single expression per filter, illegal: *.jpg|*.txt

image processing - player size with different Zoom -

i have got many videos youtube soccer players, need estimate player size different zoom in various videos. i know player height around 185cm, if assume height of far player (zoom out) 185 , make stander case depend on it, can estimate player height @ different zoom, if zoom in more stander case height larger 185cm, don't have information focal length or distance player. how can make proper estimation @ different zoom, assuming stander case? i not think can measure player height , using presumptions on height same time. because in way presume height avg 185 cm measurement gets same value. instead can isolate more 1 players in standing pose (the more better), create average z distance camera map (assuming players 185cm in height). interpolate / smooth between measured grid points, filter out inconsistencies , compute player height again. more precise lock onto known object size for example think rail unified size. if captured slight angle can estimate camera f...

javascript - Showing the effect of ngCloak -

i working friend on application , decided use ngcloak directive avoid display of raw/uncompiled code. since both relatively new know if there's way capture effect of happens if ngcloak directive left out. since both of our computers substantially powerful effect invincible. there way slow down able see happen on slower device? or process code step step? thanks in advance. having left out ng-cloak, , assuming making call data being rendered after page loads up, can open debugger in browser , set break point on line makes call data. refresh page , script pause on break point , see effect of not using ng-cloak in browser window.

insert data into access database using c# not working -

i trying add data access database, far have. try { connection.open(); string datainsert = "insert clientst (firstname, lastname, address, email, phone, cellphone, notes) values('" + boxaddname.text.tostring() + "', '" + boxaddlastname.text + "', '" + boxaddadress.text + "', '" + boxaddemail.text + "', '" + boxaddphone + "', '" + boxaddcellphone + "','" + boxaddobs.text + "')"; oledbcommand command = new oledbcommand(datainsert, connection); command.executenonquery(); connection.close(); messagebox.show("client added,"); } catch(exception ex){ messagebox.show("error :" + ex); } } it does't give me king of error menssage, code executes fine nothing added database. please note farly new c# , it's first...

javascript - Does Crockford's "deentityify" method in The Good Parts actually work? -

this particular code has been asked twice before, never question raised "does anything?". appears in page 41 of crockford's book. here syntactic sugar earlier in book: object.prototype = function (name, func){ if(!this.prototype[name]){ this.prototype[name] = func; } and here deentityify methody: string.method('deentityify', function ( ) { var entity = { quot: '"', lt: '<', gt: '>' }; return function () { return this.replace( /&([^&;]+);/g, function (a, b) { var r = entity[b]; return typeof r === 'string' ? r : a; } ); }; }()); if in editor write like: document.writeln( '&lt;&quot;&gt;'.deentityify( )); you'll see in browser: however, if type in browser: document.writeln( '&lt;&quot;&gt;'); you'll still see: ...

Is there a better way to pass string output from jq to bash? -

i’ve discovered jq , been loving it. 1 thing find myself doing lot though stuff like: result=$(jq --raw-output '.some | .filters // ""') if [[ $result ]]; foo else bar fi the default empty string seems play more nicely bash "truthiness" e.g. if [[ $result != "null" ]] , , raw-output necessary store resultant string in variable. question is, i’m using these 2 tweaks consistently in scripts, there perhaps better way achieve same functionality? or make sense (as possible enhancement jq) able set couple env vars control behavior duration of script? you can use -e flag make jq return exit code 0 if last output value neither false or null logic may become: result=$(jq -e -r '.some | .filters') && foo || bar

SettingNotFoundException: com.android.bluetooth.gatt.GattService -

i've been getting error: android.provider.settings$settingnotfoundexception: bt_svcst_com.android.bluetooth.gatt.gattservice @ android.provider.settings$system.getintforuser(settings.java:1358) @ android.provider.settings$system.getint(settings.java:1348) @ com.broadcom.bt.service.profileconfig.isprofileconfiguredenabled(profileconfig.java:375) @ com.android.bluetooth.btservice.adapterservice.setprofileservicestate(adapterservice.java:791) @ com.android.bluetooth.btservice.adapterservice.processstart(adapterservice.java:557) @ com.android.bluetooth.btservice.adapterstate$offstate.processmessage(adapterstate.java:159) @ com.android.internal.util.statemachine$smhandler.processmsg(statemachine.java:966) @ com.android.internal.util.statemachine$smhandler.handlemessage(statemachine.java:789) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:157) @ android.o...

mysql - SQL query using sum() -

Image
hello i'm working on sql problem can't quite figure out. here schema i'm working with: here question stuck on: -- 3 find first name, last name , total combined film length of sci-fi films every actor. result should list names of of actors (even if actor has not been in sci-fi films) , total length of sci-fi films have been in. so far have select actor.first_name, actor.last_name, (select sum(film.length) film inner join film_category on film.film_id = film_category.film_id inner join category on film_category.category_id = category.category_id inner join film_actor on film_actor.film_id = film.film_id inner join actor on film_actor.actor_id = actor.actor_id category.name = 'sci-fi' ) actor i know need group actor_id i'm unable in select subquery. have tips? there no need use subquery. aggregate functions work on entire data set. 'group by' specifies how group data you're aggregating. select a.actor_id, a.first_name, a.l...

c - Simple pass a pointer to another function FAILED -

i keep getting runtime error when trying pass input[i] function... don't know why. it's supposed pass address of input[i] pointer in other function don't know went wrong. must simple failed catch... edit: program stop before passing array , exit. void processinfixexp(const char * filename) { char ** input = null, ** output = null; int = 0, numinput = 0; char len; char tempinput[100] = {0}; file * pfile = null; if((pfile = fopen(filename, "r")) == null) { printf("cannot read file %s\n", filename); system("pause"); exit(1); } while(fgetc(pfile) == '\n') ++numinput; /* printf("%d\n", numinput); */ input = (char**)malloc(numinput * sizeof(char*)); output = (char**)malloc(numinput * sizeof(char*)); if(!input || !output) { printf("memory allocation failed.\n"); system("pause"); exit(1); } ...

javascript - Show only one month name in FullCalendar when WeekView wraps two different months -

Image
i developing using fullcalendar.js, , in week view, when week 2 different months (for example 27 july - 2 august) fullcalendar week view shows 2 months text. searching everywhere there no solution this. maybe stackoverflow users can me. that's have: and that's need: i see date format mmmm yyyy , , returns 2 months or 1 automatically , seems impossible change this. in calendar.defaults (aprox. line 8300 in non-minimized code) object can notice this: titlerangeseparator: ' \u2014 ', // emphasized dash monthyearformat: 'mmmm yyyy', // required en. other languages rely on datepicker computable option as explained, monthyearformat seems 1 month, in specific moment merges titlerangeseparator become 2 months. do know how solvable? thank you. edit i found functions make complex string, used month , day views don't want change (i need week view). code next. how can modify code solve it? // date range formatting // --------------------...

powerpoint - Aspose: while I am trying to generate a ppt from csv, the ppt is getting corrupted? -

aspose: while trying generate powerpoint csv file, powerpoint getting corrupted? i representing aspose.slides. have observed requirement generating ppt csv file. information shared abstract , request please share how , loading csv file , , how populating csv file read data in ppt using aspose.slides. request please share working sample project, source presentation , generated presentation in aspose.slides forum link below , obliged further in regard. http://www.aspose.com/community/forums/aspose.slides-product-family/109/showforum.aspx

javascript - Gulp jade compilation -

i'm using gulp-jade , i'm getting error 1 of templates: 557| 558| > 559| 560| .tabs-wrap(ng-show="eventexists"): .contain-center 561| 562| #room-tabs-contain.contain-disable.contain: .contain-center unexpected token "pipeless-text" @ parser.parseexpr (/users/dylan/project/node_modules/jade/lib/parser.js:254:15) at first glance appears error in github.com/jadejs/jade. might be, using jade server templates express, , when going through express router, template complies fine no errors. i tried being explicit jade instance gets used gulp: gulpjade = require 'gulp-jade' jade = require 'jade' locals = {} gulp.src "#{config.client}/**/*.jade" .pipe gulpjade(jade: jade, pretty: true, locals: locals) .pipe gulp.dest("#{config.build}") still, no luck. key question trying figure out is: why jade template render fine through express, errors out when going through gulp-jade turns out,...

java - How can I get the longitude and latitude in my android app? -

i've been trying location particular phone while now. have used following code instead of showing location crash when try , run app in emulator. once i've got longitude , latitude going use map current location on google map! public class homescreen extends actionbaractivity implements locationlistener { final textview t = (textview)findviewbyid(r.id.textview1); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_homescreen); locationmanager locationmanager = (locationmanager) getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, this); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.homescreen, menu); return true; } @override public boo...

What version of PHP is Symfony using? -

i have been struggling few hours now. running centos 6.6. few hours ago having issues symfony project required php 5.4+ because of libraries required. installed version 5.4 , used have php 5.3.3. php 5.4 allows new features. such array shorthand declaration , binary data strings. this: //array shorthand declaration $arr = [1, 2, 3, 4]; //php +5.4 $arr = array(1, 2, 3, 4); //php 5.3.3 //binary data strings 0b001 //php +5.4 this on official documentation here's link source: https://secure.php.net/manual/en/migration54.new-features.php however when executing scripts getting errors if not running php 5.4 example one: php parse error: syntax error, unexpected '[' in /vendor/wisembly/elephant.io/src/engine/abstractsocketio.php on line 44 and line of code be: //does not work $data = [$event, $args]; //php 5.4 syntax //it works $data = array($event, $args); //php 5.3.3 syntax this output of running php -v on terminal php 5.4.43 (cli) (built: jul 8 2015 12...

ios - ReactiveCocoa nested map -

[[[[[self.textfield.rac_textsignal throttle:0.5] flattenmap:^racstream *(id value) { //call api return [api signal]; }] flattenmap:^racstream *(nsarray *result) { result = [result.rac_sequence take:150].array; //result json array return result; }] map:^id (nsarray *result) { return [result.rac_sequence map:^id (json *r) { //handle json item return item; }].array; }] subscribenext:^(nsarray *result) { //reload ui } error:^(nserror *error) { } completed:^{ }]; how avoid nested map in signal sequence? better way handle this?

html - Changing style tag with javascript [Slider] -

www.imgur.com/8bq1x.png i remove style display:none yellow highlighted bit when blue highlighted bit selected. how edit code that? (function(iis) { "use strict"; iis.slider.prototype.addcaptions = function() { iis._addclass(this._attributes.container, 'iis-has-captions'); array.prototype.foreach.call(this._attributes.slides, function(slide, i){ var caption = document.createelement('div'); iis._addclass(caption, 'iis-caption'); var captioncontent = ''; if(slide.getattribute('title')){ captioncontent += '<div class="iis-caption-title">'+ slide.getattribute('title') +'</div>'; } if(slide.getattribute('data-caption')){ var datacaption = slide.getattribute('data-caption'); if(datacaption.substring(0,1) == '#' || datacaption.substring(0,1) == '.'){ ...

javascript - How to start a basic WebRTC data channel? -

how start basic webrtc data channel? this have far, doesn't seem try , connect. im sure missing basic. var rtcpeerconnection = window.rtcpeerconnection || window.mozrtcpeerconnection || window.webkitrtcpeerconnection || window.msrtcpeerconnection; var peerconnection = new rtcpeerconnection({ iceservers: [ {url: 'stun:stun1.l.google.com:19302'}, {url: 'stun:stun2.l.google.com:19302'}, {url: 'stun:stun3.l.google.com:19302'}, {url: 'stun:stun4.l.google.com:19302'}, ] }); peerconnection.ondatachannel = function () { console.log('peerconnection.ondatachannel'); }; peerconnection.onicecandidate = function () { console.log('peerconnection.onicecandidate'); }; var datachannel = peerconnection.createdatachannel('mylabel', { }); datachannel.onerror = function (error) { console.log('datachannel.onerror'); }; datachannel.onmessage = function (event) { console.log...

python - Unmerge or fill in columns in pandas groupby dataframe -

i have data frame when printed in terminal or sent excel file looks below. +-----------------------------------------------------------------------------------------------------------+ | 112 martin messenger bag mrkt-15-0004 accessories watch featured host nan | | 262 fauna pouch kitten area-15-0050 accessories watch featured host nan | | 263 key cable nati-15-0005 gadgets featured nan | | gadgets nan | | summer staples nan | | 110 winter remedy pack ecoa-15-0002 home goods home goods nan | | 109 travel set ecoa-15-0001 beauty featured nan | | 274 ideal notebook iphone ...

sql server - How to debug "Object of class mysqli could not be converted to string" error in PHP? -

i working on academic project, , stuck in search feature, query trying run running smoothly in mysql server, when try run on application, giving me error this: catchable fatal error: object of class mysqli not converted string in.......... the code snippets follows: database connection: <?php error_reporting(e_all); define("dbname","foodfood"); global $con; $servername = "localhost"; $username = "root"; $password = "passport"; // create connection $con = mysqli_connect($servername, $username, $password); // check connection if (!$con) { die("connection failed: " . mysqli_connect_error()); } ?> the query causing error: function find_food ($keysearch, $con) { $find_query = "select `vendor`.`v_id`,`vendor`.`v_name`,`vendor`.`v_img`,`contacts`.`cont_addr`,`contacts`.`cont_phn`,`fooditem`.`item_name`,`fooditem`.`fi_price`,`fooditem`.`fc_desc` vendor left join ".dbname.".`contac...

Java use a piece of code from a text file -

i trying figure out. world editor want program read text file , use content code material. i've made decent file reader i've got problem. in console getting right output, file has 1 line says: this.makegrass(new vector3f(0, 1, 2)); this part of code tells program render specific object scene, in case it's grass model. instead of printing information console with system.out.println(arylines[i]); i want able use information stored on .txt file can add rendering code. entire method prints lines on text file console is: public void textoutput() { string file_name = "c:/text.txt"; try { storecoords file = new storecoords(file_name); string[] arylines = file.openfile(); int i; (i = 0; < arylines.length; i++) { system.out.println(arylines[i]); // !! how use information part of code ?? } } catch(ioexception e) ...

c# - Searching in text files for a keyword until a string is encountered -

i'm writing program me search keyword inside thousands of files. each of these files has unnecessary lines need ignore because mess results. luckily they're located after specific line inside files. i've got search, without ignoring lines after specific line, returning enumerable of file names containing keyword. var searchresults = files.where(file => file.readlines(file.fullname) .any(line => line.contains(keyword))) .select(file => file.fullname); is there simple , fast way implement functionality? doesn't have in linq i'm not sure if possible. edit: example make clearer. how text files structured: xxx xxx string yyy yyy i want search xxx lines until either keyword found or string , skip next file. yyy lines want ignore in search. try this: var searchresults = files.where(file => file.readlines(file.fullname) ...

ios - Swift: Simple Animation? -

i have button , textview on vc. textview automatically hidden. textview.hidden = true if press button, textview shows up. @ibaction func buttonispressed(sender: anyobject) { textview.hidden = false } is there way add simple "fade" animation textview? i mean if press button, textview should fade in. i heard facebooks pop framework, isn't there easier way? //instead of textview.hidden = true textview.alpha = 0 //now on press action @ibaction func buttonispressed(sender: anyobject) { uiview.animatewithduration(1.0, animations: { () -> void in self.textview.alpha = 1.0 }) }

vsto - How to insert existing worksheet in Excel using C#? -

i trying insert existing sheet excel current worksheet. but, instead inserting current worksheet, creates new worksheet. missing in code? i using this: workbook wkactive = globals.thisaddin.application.activeworkbook; objbook = globals.thisaddin.application.workbooks.open(idstemplatepath, 0, true, 5, "", "", true, xlplatform.xlwindows, "\t", false, false, 0, true, false, false); wkactive.sheets.add(objbook.sheets[1], type.missing, type.missing, type.missing); wkactive.save(); wkactive.close(); from mvp: i believe worksheet.copy method want. assuming using vsto, following code demonstrates 1 way copy worksheet non-vsto workbook workbook in vsto customization. particular example copies first worksheet in non-vsto workbook named "myworkbook.xls" vsto workbook, after "sheet3". excel.workbook workbook = globals.thisworkbook.application.workbooks.open(@"c:\myworkbook.xls", missing...

build - Compile TypeScript with modules and bundle to one file -

when using module inside tsconfig.json typescript compiler ignore --out flags , generate regular output, e.g. commonjs modules in seperate files. is there way bundle transpiled files single file? i trying use webpack can not of loaders run. running typescript compiler directly works. for typescript external module bundles can use npm package tsproject

android - Will GCM Network Manager work on non-Play devices? -

as replacement jobscheduler android prior 5.0, google released gcm network manager automatically uses native jobscheduler in android 5.0 , custom code older ones. however, not sure if works on non-play devices (those without google play services), kindle , blackberry 10 , china phones. name seems has related gcm, suspect works on play devices. can confirm this? of course needs google play service 7.5.0+ installed on device, gcmnetworkmanager added in google play services 7.5.0, not work on older versions. (announcement blog post here: http://android-developers.blogspot.com/2015/05/a-closer-look-at-google-play-services-75.html )

Is it possible to setup a web app in Azure that connects to multilple on-premise databases? -

i setup azure web app connects different on-premise databases (same schema). these databases in no way related each other. possible? yes, want use hybrid connections. see article how set them up: https://azure.microsoft.com/en-us/documentation/articles/integration-hybrid-connection-create-manage/ you'll still have set kind of programmatic way of choosing connection use. you'd have expand upon scenario me if need more advice.

php - array grouping or sorting is not working -

here array. array( [0] => array ( [amt] => 50.00 [transaction_date] => 2015-07-18 ) [1] => array ( [amt] => 0.00 [transaction_date] => 2015-07-17 ) [2] => array ( [amt] => 60.00 [transaction_date] => 2015-07-18 ) ) i trying sort or grouping array according date.transaction date should 1 means no duplicate entry of transaction in array. i want new array follows array( [0] => array ( [amt] => 110.00 [transaction_date] => 2015-07-18 ) [1] => array ( [amt] => 0.00 [transaction_date] => 2015-07-17 ) ) 2015-07-18 date appears 2 times in array 2 diffe...

node.js - Confused about Mongoose/Mongo Terminology. Are Sub-Docs/Embedded-Docs also Collections? -

if have following mongoose models: // child.model.js var mongoose = require('mongoose'), schema = mongoose.schema, childschema = new schema({ name: string, age: number }, {collection: 'children'}); module.exports = mongoose.model('child', childschema); //parent.model.js var mongoose = require('mongoose'), child = require('./child.model.js'), schema = mongoose.schema, parentschema = new schema({ name: string, children: [child.schema] }); module.exports = mongoose.model('parent', parentschema); would mean have 2 collections, 1 called 'parents' , 1 called 'children'? as understand above code creates nested document structure whereby child objects exist within collection of parent documents. however, i'm getting confused {collection: 'name'} option can pass schema constructor. option ignored when crea...

Rails - Partial in another view can't access its controller -

i'm trying build profile page displays posts sent requested user, , allows visitor write post of own. because simplified example should have 2 distinct controllers: users , posts, made partials each post action render within user's show action. directory structure views directory looks this: - posts - _index.html.erb - _new.html.erb - users - show.html.erb ... (etc.) section displays these partials within user's show.html.erb : <section> <h3>posts:</h3> <%= render '/posts/new', :post => post.new %> <%= render '/posts/index', :posts => post.where(target_id: params[:id]) %> </section> i found out pass variables partial in render line, , though works, it's messy , doesn't follow best practices. ideally, i'd want these partials connected posts controller can write more complex database queries in place isn't view: class postscontroller < applicationcontroller def...

grunt-ngdocs: styles file not included to demo code -

i using grunt-ngdocs document angular project. demo plunker code (generated automatically) doesn't include css file. my configuration in gruntfile.js includes: ... scripts: [ 'https://code.jquery.com/jquery-2.1.4.js' ], styles: [ 'https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.0.7/semantic.css' ] ... in js src file: @example <example module="sui.checkbox"> <file name="index.html"> ... </file> <example> on api page, js , css files loaded correctly. displayed demo source code doesn't include css file: <!doctype html> <html ng-app="sui.checkbox"> <head> <script src="https://code.jquery.com/jquery-2.1.4.js"></script> <script src="app.js"></script> <!-- semantic.css should imported here --> </head> <body> ... </body> </html> on api pa...

android - Is there a similar method to "bringToFront()" on Linear Layout? -

Image
well, i'm making game uses class extends surfaceview represent game screen, works buttons, i'm defining "buttons panel" on xml , adding "gameview" linearlayout, contains stuff, programatically , bringing "buttons panel" front, this: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); linearlayout rl1 = (linearlayout)findviewbyid(r.id.rl1); rl1.addview(new gameview(this)); squarelayout sq1 = (squarelayout)findviewbyid(r.id.square); //the control buttons in custom layout called "squarelayout" sq1.bringtofront(); } the problem here want layout contains game buttons(the squarelayout) fill half of height of relativelayout(the activity set landscape), morphing relativelayout vertical linearlayout, adding squarelayout, , setting both weight's properties 1, , it's this: the problem "bringtofront();" method not wo...

excel - In vsto C#, when copying(no pasting) a range, how to know this range(row/col/rect info)? -

example in excel 2013, select range a1:c3 , ctrl-c or right click copy. noticing there animation moving arounding range, meaning copied it. now want range in code. i hooked copy invent in windows message. , how can range? pls help. example code: private override oncopy(excel.range source){ //... base.oncopy(source); //now can source range when copy happens. //but in vsto, there no such method. //help me work around } you can use selection object current selection. may return selection, not copied. to copied seletion object need set keyboard hook intercepting ctrl+c keyboard buttons and/or repurspose ribbon controls. see using shortcut keys call function in office add-in started windows hooks. most repurposing ribbon controls enough (context menus use ribbon ui). see temporarily repurpose commands on office fluent ribbon more information.

php - mysql_connect(): Connection refused -

Image
i wondering if possible databases block sql accesses through mysql_connect . downloaded xampp , created sql database using own computer local host , wrote php file accessed database. however, when tried change username , host settings xampp run php files connect external sql database of free hosting site i'm trying use (biz.co.nf), got following error message: warning: mysql_connect(): connection refused in /applications/xampp/xamppfiles/htdocs/... right i'm thinking either: my login credentials database incorrect, or somehow host blocks sql accesses external users, if load php code server using filezilla, should work okay? please let me know if case. i'm have right login credentials. here's have: $host = "fdb13.biz.nf"; $username = "1764941_login"; $password = ________; $db_name = "1764941_login";! $tbl_name = "members"; //connect server mysql_connect($host, $username, $password)or die("cannot con...

android - Record calls in PCM-Format -

i trying write android app using sip-based voip (i use sipdemo template). i need record incoming , outgoing calls , save them in pcm-format . private static final int recorder_samplerate = 44100; private static final int recorder_channels = audioformat.channel_in_mono; private static final int recorder_audio_encoding = audioformat.encoding_pcm_16bit; is possible? this activity incoming calls: public class incomingcallreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { sipaudiocall incomingcall = null; try { sipaudiocall.listener listener = new sipaudiocall.listener() { @override public void onringing(sipaudiocall call, sipprofile caller) { try { call.answercall(30); } catch (exception e) { e.printstacktrace(); } } }; walkietalkieactivity wtactivity = (walkietalkie...

.net - How can I change COM Security settings programmatically by c#? -

Image
i need change com security permissions programmatically using .net methods. mean these settings: how can this? thanks! as far know there no api this. com , dcom access control set in registry, under "incognito" ole (because of historical reasons). @ same time .net has standard classes manipulate registry. so here should when facing task: launch registry monitor, mark russinovich's formerly sysinternals, microsoft set com setting interactively using windows ui, , monitor registry changes. optional recommended: after having targeted search keyword (the registry keys) try in google doc/code, or better search in github within code implement c# classes manipulating appropriate registry classes

sql - Update attribute only when value is not nil -

i have simple sql statement: update people set (updated_at, first_name, last_name, email) = (now(), r.first_name, r.last_name, r.email) id = r.p_id; i want set email value when r.email not nil . is there way in 1 query? i assume part of query you need add conditional. depending on dbms (postgresql, mysql) need different solutions. postgresql you'll need coalesce . coalesce function returns first of arguments not null. update people set (updated_at, first_name, last_name, email) = (now(), r.first_name, r.last_name, (coalesce (r.email, people.email)) people, r people.id = r.p_id mysql you'll need if condition: if (r.email null, people.email, r.email) so query need perform should similar to: update people set (updated_at, first_name, last_name, email) = (now(), r.first_name, r.last_name, (if (r.email null, people.email, r.email)) people, r people.id = r.p_id

c - Finding the size of n-ary tree -

in c, tried find size of n-ary tree this. know why wrong. couldn't find out way return size of n-ary tree. can suggest way return size of tree. int size(struct node*root) { int sz=0; if(root==null) return 0; else { for(int i=0;i<n;i++) sz=sz+1+size(root->child[i]); } return sz; } try this: int size(struct node*root) { int sz=1; if(!root) return 0; for(int i=0;i<n;i++) sz+=size(root->child[i]); return sz; }

wix - Using WixIIsExtension and localization variable errors on building localized installer -

when using wixiisextension wix msi project, building localized installer (ru-ru culture, example), got lot of such errors: the localization variable (loc.configureiis) unknown. please ensure variable defined i have workaround - installing iis application organized separate merge module without localizations. when build wix mergemodule project using wixiisextension - it's ok. but reason of errors inside msi project? fixed in later versions of wix? the iis extension messages not localized russian. can specify "fallback" culture, existing (english) messages used. in project settings, set "ru-ru,en-us" in "cultures build", instead of "ru-ru". see more fallback cultures: http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/specifying_cultures_to_build.html these non-localized strings of iis extension shown fraction of second when progress bar runs, , in log files. anyways, provide translations (or wai...

javascript - How to do recursive directive with $templateCache? -

i trying use angular.treeview display tree structure, , works fine. however, causes infinite loop when use $templatecache make more maintainable. looks using string store template removes outermost loop in recursive calls not happening template retrieved $templatecache. see problem after commenting out second line (line #88 in angular.treeview.js) in example @ http://plnkr.co/edit/khq7bmpryedk6b1pvldy?p=preview . $log.log('cache:' + templatecache.get('treenode.html')); //template = templatecache.get('treenode.html $log.log('string:' + template); //rendering template. element.html('').append( $compile( template )( scope ) ); the other question if can $templatecache work how replace variables in template before it's compiled? i'd replace variables treemodel , nodechildren in template make code more flexible. got working naming controller's $scope variable same recursive call's....

c++ - Why "-1" is 11111111 not 10000001 in signed int -

this question has answer here: why prefer two's complement on sign-and-magnitude signed numbers? 17 answers i'm doubt why uses -1 11111111 in signed int , not 10000001. because learned first bit use specify sign , rest of 7 bits value. in reason designers decide use -1 [ first bit = 1 , value 7 bits =127 ] not [ first bit = 1 , value 7 bits =1 ] c , c++ allow both sign-and-magnitude (with -1 10000001 ) , two's complement form (with -1 11111111 ). in addition both languages allow one's complement form (with -1 11111110 ). however, on extant platforms two's complement form used. 1 main advantage (the “why” ask about) values same wrap-around unsigned arithmetic, unsigned in c , c++. put way, if interpret same bits unsigned value, differs negative value 2 n , n number of value representation bits.

html - Bug in CSS 2.1 Table spec for computing column widths? -

the tables section in css 2.1 spec reads: if 'table' or 'inline-table' element has 'width: auto', used width greater of table's containing block width, capmin, , min. however, if either capmin or maximum width required columns plus cell spacing or borders (max) is less of containing block, use max(max, capmin). i believe may error, , should read: if 'table' or 'inline-table' element has 'width: auto', used width greater of table's containing block width, capmin, , min. however, if both capmin and maximum width required columns plus cell spacing or borders (max) are less of containing block, use max(max, capmin). the reason capmin minimum width of caption. if disregard effect of capmin, spec correctly uses maximum width of columns when width less containing block width. introducing caption minimum width in way spec worded causes maximum width of columns short-circuited when capmin alone less...

python - Error importing scikit-learn modules -

i'm trying call function cluster module, so: import sklearn db = sklearn.cluster.dbscan() and following error: attributeerror: 'module' object has no attribute 'cluster' tab-completing in ipython, seem have access base, clone, externals, re, setup_module, sys, , warning modules. nothing else, though others (including cluster) in sklearn directory. following pbu's advice below , using from sklearn import cluster i get: traceback (most recent call last): file "test.py", line 2, in <module> sklearn import cluster file "c:\python34\lib\site-packages\sklearn\cluster\__init__.py", line 6, in <module> .spectral import spectral_clustering, spectralclustering file "c:\python34\lib\site-packages\sklearn\cluster\spectral.py", line 13, in <module> ..utils import check_random_state, as_float_array file "c:\python34\lib\site-packages\sklearn\utils\__init__.py", line 16, in <m...

php - How to pull data from this json? -

i've got json data this: [["building1.jpg",["uploads\/45\/0\/building1.jpg","uploads\/45\/1\/building1.jpg"],[],"","45",["345:255"]]] and need access uploads\/45\/1\/building1.jpg , how php? for uploads\/45\/0\/building1.jpg i'm using $data[0][1][0] , works, uploads\/45\/1\/building1.jpg $data[0][2][0] doesn't work. correct approach? you want $data[0][1][1] , they're in same array.

bootstrap navigation bar dropdown menu -

i making navigation bar website doesn't seem work. when click on products tab have made dropdown menu works dead link , takes me index.php# . please help. attaching markup : <nav class="navbar navbar-default" > <div class="container-fluid"> <ul class="nav navbar-nav"> <li class="active"><a href="index.php" >home</a></li> <li><a href="#">contact us</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">products <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="boys.php">boys</a></li> <li><a href="girls.php">girls</a...

Replace mysql query table prefix in php -

i writing database query manager class.in class table prefixes characterized #__ . want replace them table prefix function. the function wrote works slow. want optimized function (maybe regex or solution). notice: please remember #__ should not replaced in quotes. examples : select p.*, m.member_name, m.member_alias #__posts p left join #__members m on m.member_id=p.post_author p.post_approve = '1' , p.post_date <= '1438252218' or insert `#__posts` (`post_title`, `post_text`) values ('post title (maybe include #__ )' , 'post text. can include #__') my function: protected function replace_prefix($sql, $prefix = '#__') { $done = null; $single = false; $double = false; $found = false; $i = 0; while (strlen($sql) > 0) { if ($sql[$i] == null) { return $done.$sql; } if (($sql[$i] == "'") && $sql[$i-1] !='\\') ...

c# - How to create a gridview row clickable? -

i want create gridview row whole row clickable , when click anywhere on row open aspx page rows information. i using asp.net , c#. can me please. in advance. just call below code on rowdatabound click anywhere on gridview row fire selectedindexchanged event you have <%@ page enableeventvalidation="false" %> protected void grdyourgrid_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { // attaching 1 onclick event entire row, // fire selectedindexchanged, while click anywhere on row. e.row.attributes["onclick"] = clientscript.getpostbackclienthyperlink(this.grdyourgrid, "select$" + e.row.rowindex); } }

objective c - How to Upload an Animated GIF in Twitter for IOS? -

i have gif image , want share in twitter unfortunately it's not working. when posted image using twitter api on dev.twitter.com site works fine , animates. however want post image using twitter ios app/api. know how this? thanks in advance. - (void)postimage:(uiimage *)image withstatus:(nsstring *)status url:(nsurl*)urldata { // uiimage *img = [uiimage animatedimagenamed:@"test.gif" duration:3.0]; nsurl *url = [nsurl urlwithstring:@"https://api.twitter.com/1.1/statuses/update_with_media.json"]; nsmutabledictionary *paramater = [[nsmutabledictionary alloc] init]; //set parameter here. see others acceptable parameters find @ twitter api here : http://bit.ly/occe6r [paramater setobject:status forkey:@"status"]; acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccounttype *accounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifiertwitter]; [accountstore requ...

java - how to read a file thats comma‐delimited -

im tring read file list of strings. there 3 lines in file , im trying print them in file output prints first line. 'woman' should not printed. nor should 'man' public void readfile(string filename) { string gender; string width; string height; string name; string x; string y; try { scanin = new scanner (new file (filename)); this.scanin.usedelimiter(", "); } catch (filenotfoundexception | numberformatexception exception) { exception.getmessage(); } while(this.scanin.hasnext()){ gender = scanin.next(); if(gender.equals("woman")){ width = scanin.next(); height = scanin.next(); x = scanin.next(); y = scanin.next(); name = scanin.next(); system.out.printf("%s %s %s %s %s", width,height,x,y,name); } if(gender.equals("man")){ width = sca...

java - Finding duplicate elements in an array without using nested loops -

this question has answer here: find duplicate element in array in time o(n) 21 answers i had interview consisted of following problem. please possible solutions. write method in java find duplicate elements in integer array without using nested loops ( for/ while / while, etc ) , without using library functions or standard api's. hey below solution has complexity o(n) , works fine. check if helps. public class main { public static void main(string[] args) { int a[] = new int[]{10,3,5,10,5,4,6}; string distinctelement=""; string repetitiveterms=""; for(int i=0;i<a.length;i++){ if(i==0){ distinctelement+=a[i]+" "; } else if(distinctelement.contains(""+a[i])){ repetitiveterms+=a[i]+" "; ...

download - How do i return a response as excel file using dropwizard? -

i using dropwizard rest api development, returns json response. have come across requirement have return excel file on call of 1 particular api. found out apache poi library use. how return excel file response . browser should show option download. set content-type application/octet-stream , add content-disposition response header should it. content-disposition: attachment; filename="file.xsl" . example @path("/file") public class fileresource { @get @produces(mediatype.application_octet_stream) public response getfile() throws exception { inputstream = new fileinputstream("file.txt"); return response.ok(is) .header(httpheaders.content_disposition, "attachment; filename=\"file.txt\"") .build(); } } other inputstream , return file , byte[] , streamingoutput , have options.