Posts

Showing posts from April, 2013

Read Word ActiveX radio button into vb.net form -

i'm working on code read values in word document windows form using vb.net. word document designed data read in contained within content controls. here sample of code: private sub importwordbutton_click(sender object, e eventargs) handles importwordbutton.click dim oword microsoft.office.interop.word.application dim odoc microsoft.office.interop.word.document dim occ microsoft.office.interop.word.contentcontrol oword = createobject("word.application") odoc = oword.documents.open("c:\temp\pifformtest2.docx", [readonly]:=false) each occ in odoc.contentcontrols select case occ.tag case "pifno" numberbox.text = occ.range.text case "piftitle" titlebox.text = occ.range.text case "initiator" initiatorbox.text = occ.range.text case "pthealthsafety" healthsafecheckbox.checked = o

python - logical operation on numpy array that was originally a pandas data frame -

i have 2 variables want perform on them elementwise logical operations. following error: tp = sum(actual & predicted) typeerror: ufunc 'bitwise_and' not supported input types, , inputs not safely coerced supported types according casting rule ''safe'' below code: import pandas pd import numpy np train = 'train.tsv' submission = 'submission1234.csv' trainsearchstream = pd.read_csv(train,sep='\t') sample = pd.read_csv(path + 'samplesubmission.csv') preds = np.array(pd.read_csv(submission, header = none)) index = sample.id.values - 1 sample['isclick'] = preds[index] actual = np.array(trainsearchstream['isclick'].dropna()) predicted = np.array(sample['isclick']) tp = sum(actual & predicted) per comments, actual , predicted both have dtype float64 . problem can reproduced in [467]: actual = np.random.random(10) in [468]: predicted = np.random.random(10) in [469]: actua

PowerPoint (or Excel) VBA Capture Coordinates of Mouse Click -

some background: the quick background in research stages of building add-in powerpoint. end goal develop cad dimensioning add-in expedite creating of engineering presentations. have lot of "powerpoint engineering" general sizes of components shown on simplified versions of said components created ppt shapes or screenshots of cad geometry itself. creating dimensions on , on tedious. each 1 consists of arrow, 2 lines, , text box dimension value. here need help. (if know how following in excel, work , work figure ppt equivalent later.) in powerpoint slide, while in design mode (i.e. not slide show mode), want following workflow: in open userform, user clicks button called "start" the code starts listen left mouse click (lmc) out in field of slide (it should not respond lmc on actual userform, example if user needs drag userform out of way) upon lmc, coordinates of cursor recorded (x1,y1) repeat steps 2 & 3 record (x2, y2) do stuff these coo

node.js - Node Webkit - Options for encoding in writeFileSync not work? -

i beginner. i want write html file containing chinese characters in utf8 encoding. found following code internet. fs.writefilesync(target, generatehtml(), "utf8"); though when read documentation, didn't explicitly can add encoding flag. generatehtml() returns html string. however, following characters "返回" became this: "活動" in file. sure encoding error. am using wrong function? how can write file in sync using proper utf-8? edit the fs.writefilesync worked alone well, not when content returned function. please try this: function generatehtml(){return "返回"} fs.writefilesync("index.html", generatehtml(), "utf8"); the file contains ԏ in utf-8 format, not intended content. edit i tested installed node.js version , working properly. seems have node webkit. i'll include version later. time here not convenient me. the solution set working node-webkit application page have utf-8

javascript - jquery prev and next adjacent sibling -

i create pagination add class next , previous element. generated code doesn't work well. think common situation, maybe using wrong code. how can improve code? this fiddle http://jsfiddle.net/hhebhm66/ var $curr = $( "div.active" ); $( ".prev" ).click(function() { if ($($curr).is(':first-child')){ $('.prev').hide(); }else{ $('.next').show(); $curr = $curr.prev(); $( "div" ).removeclass('active'); $curr.addclass('active'); } }); $( ".next" ).click(function() { if ($($curr).is(':last-child')){ $('.next').hide(); }else{ $('.prev').show(); $curr = $curr.next(); $( "div" ).removeclass('active'); $curr.addclass('active'); } }); your logic can improved using prev() or next() , checking element retrieved. if wasn't, first() or last() singl

javascript - Dynamically Load HTML page using Polymer importHref -

i'm writing simple element loads html files using polymer 1.0's helper function importhref() . page loads in, instead of html rendering page, i'm getting [object htmldocument] . when log successful callback, imported page wrapped in #document object (not sure on terminology here). but, info there in console. so, question is: how render html page? element: <dom-module id="content-loader"> <template> <span>{{filecontent}}</span> </template> <script> polymer({ is: "content-loader", properties: { filepath: { type: string } }, ready: function() { this.loadfile(); }, loadfile: function() { var baseurl; if (!window.location.origin) { baseurl = window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''

javascript - Why does a RegExp with global flag give wrong results? -

what problem regular expression when use global flag , case insensitive flag? query user generated input. result should [true, true]. var query = 'foo b'; var re = new regexp(query, 'gi'); var result = []; result.push(re.test('foo bar')); result.push(re.test('foo bar')); // result [true, false] var reg = /^a$/g; for(i = 0; i++ < 10;) console.log(reg.test("a")); the regexp object keeps track of lastindex match occurred, on subsequent matches start last used index, instead of 0. take look: var query = 'foo b'; var re = new regexp(query, 'gi'); var result = []; result.push(re.test('foo bar')); alert(re.lastindex); result.push(re.test('foo bar')); if don't want manually reset lastindex 0 after every test, remove g flag. here's algorithm specs dictate (section 15.10.6.2): regexp.prototype.exec(string) performs regular expression match of string ag

java - JVM memory dump -

we have tomcat 7 , java 7 running our application. the last days got lot of java.lang.outofmemoryerror: permgen space errors. so added /usr/share/tomcat7/conf/tomcat7.conf in java_opts : # use java_opts set java.library.path libtcnative.so java_opts="[...] -xx:errorfile=/var/log/jvm_crash.log -xx:+heapdumponoutofmemoryerror -xx:heapdumppath=/home/ec2-user/dumps" but /var/log/jvm_crash.log empty , there no *.hprof files anywhere (not in /home/ec2-user/dumps , expect them be). what did miss here? just suggestion solve memory leak problem, use java visualvm . should located @ jdk_home/bin/jvisualvm.exe . with tool, 1 thing track object has number of instances , objects still present in memory though not used anymore. this video should started.

vbscript - How I can create timer in classic asp? -

i developing application using classic asp , need call face book graph api in every 15 minutes. i knew can using set interval function, work when page open in browser. i using mysql db. can using db job run simultaneously after every 15 minutes. please suggest me valuable suggestion.

java - What exactly is Widevine? And how to ensure that I have this key on device? -

i'm working on factory start record widevine key on device , need ensure key there , working perfectly. can't find useful information retrieve data confirm key working properly. i don't know sure widevine does, know related encrypt data stream. maybe there way test running audio ou video internet. right? show me starting point? thank you! okay, widevine browser plugin allows high quality video viewed securely (as in viewers can't steal it). don't know mean key? however, runs in browser can inspect using chrome dev tools , viewing network tab see whats going on. hope helped. oh yeah, use charles or https://www.wireshark.org/ well.

Spring Security with CAS redirect loop -

i've been stumbling last few days on redirect loop when integrating cas sso 1 of web app. happens after i've logged in cas i've been monitoring requests being exchanged between cas , web app, , seem working. i suspect problem might come bad implementation of user rights / tokens. here's file : <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:sec="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.

asp.net - Adding multiple custom controls -

i have custom control (customcontainer) can hold multiple custom controls of type conditioncontrol. when click button in customcontainer control want add customcontrol container. protected void imagebutton1_click(object sender, imageclickeventargs e) { customcontrolspanel.controls.add(new literalcontrol("<br />")); conditioncontrol mycc = (conditioncontrol)loadcontrol(@"~/conditioncontrol.ascx"); customcontrolspanel.controls.add(mycc); } this works once. click once, adds condition control not work anymore. how can fix ? edit: tried saving control collection of panel session variable , using in order restore controls so: protected void page_load(object sender, eventargs e) { if (!page.ispostback) { session["controls"] = conditioncontrolspanel.controls; } else { controlcollection temp = (con

licensing - Version and/or license compatibility issues in Arcgis Products -

i have developed stand-alone application using arcobjects sdk 10.2.2 .net . can run app. when arcgis desktop 10.2.2 installed on other computer, not on computer 10.3 (or other versions) installed. is possible run app. developed 10.2.2 sdk , environment, on 10.3 installed platform ? , how? document, link etc.? if funcionality of arcobjects api did not changed between 10.2.2 , 10.3 versions, should try set attribute specific version "false" in proprties window of referenced arcobject libraries.

Rendering HTML Tags Laravel 5 Blade Templating -

i'm working on laravel app , displaying content database, datatype text , content <span style="font-weight: bold; font-style: italic;">what dog's name?</span> as can see has html tags when rendered in view, instead of formatting text what dog's name? displaying entire content <span style="font-weight: bold; font-style: italic;">what dog's name?</span> it's not reading html tag. there convertion need in formatting? when view source it, &lt;span style="font-weight: bold; font-style: italic;"&gt;what dog's name?&lt;/span&gt; here's code: view <table class="table table-striped table-bordered"> <tbody> @foreach($questions $key => $value) <tr> <td class="">{{ $value->question }}</td> </tr> @endforeach </tbody> my

c# - Serialize JavaScript Error to Web API 2 -

i want catch unhandled exceptions in angularjs app , send via api able log it. is there object javascript error type serializes in .net? $provide.decorator("$exceptionhandler", ['$delegate', '$injector', function ($delegate, $injector) { return function (exception, cause) { var $http = $injector.get("$http"); var log = { error: exception, message: cause } $http.post('api/log', log) .finally(function () { //send error page }); $delegate(exception, cause); }; }]);

How to set value in a variable of "use variables" using javascript in Klipfolio Dashboard? -

i need set data html component in variable of klipfolio using javascript using plugin multiple selection dropdown box. couldn't find way that. i tried "set" method , other method, didn't work out me. the dashboard has function on called "setdashboardprop". function takes following inputs: scope: (values: 1 = klip scope, 2 = tab scope, 3 = dashboard scope, 4 = user) name value xid (klip or tab identifier) secondaryid (tab identifier) (when scope == 1, tab) so set tab scope variable named currentmax 10 use following call: dashboard.setdashboardprop(2,"currentmax",10,dashboard.activetab.id); check value set using getdashboardprop: dashboard.getdashboardprop("currentmax",2,dashboard.activetab.id); i suggest using browser console in developer tools in either chrome or firefox test out these calls before including in klip.

html - Twitter embedded timeline 100% width -

i have twitter embedded timeline running on this page . via css, i've added following class: .twitter-timeline { min-width: 100% !important; up until yesterday, css extending timeline full width of content area, today style not work. i can see twitter have following style running within iframe: .timeline { max-width: 520px; i assume twitter have added recently. there can overwrite this? i've tried adding following css class, hasn't worked: .twitter-timeline { min-width: 100% !important; width: 100% !important; i'm aware can tap twitter api create custom feed, not have access artists twitter account generate access tokens etc. as mentioned twitter not allow timeline widget 100% width. responsive sites pain there solution (for now). use callback on twitter embed script , point function alters iframe styles. solution using jquery replace twitter embed code (under <a> tag) this. <script>

java - TestNG not Compatible with Eclipse Luna and Eclipse Indigo -

i installed testng in eclipse luna , eclipse indigo testng not showing in preferences window. followed right step 2 times mentioned @ below link http://www.guru99.com/all-about-testng-and-selenium.html it giving me same problem in both versions of eclipse... suggestion how start working testng? i see, question quite old faced same symptoms. me solution problem upgrade java installation 1.6 1.8. after testng pluggin worked expected.

c++11 - Is it possible to auto add some code, when I add class member variables -

i'm boost newbie. i know possible when add class member variable(at header file) automatically generate code // classa.h file class classa { public: int a; // in fact a,b,c structure. int b; // add "int c;" void save(); // want auto generate code @ save() void load(); } when add "int c;" // classa.cpp void classa::save() { somestream << << b; // use boost::serialize // want auto replace above code next // somestream << << b << c; } void classa::load() { somestream >> >> b; // replace above // somestream >> >> b >> c; // same order } enter code here it possible? using boost mpl? macro? i have variable add lot. the closest can std::tuple<int,int> data can grow std::tuple<int,int,int> , see here how print them.

What regex expression will match this string: <<<random text>>>>? -

i trying match string, , guess regex way go. the problem have 0 knowledge of how create regex expression. how create expression match string starts 4 < , ends 4 > , follows. <<<<a random string of letters, numbers & more (>) 1 symbols>>>> or can find introductory guide on interwebs? you should spend couple of minutes googling before posting. first hit regular expressions this site have served primer. anyway, basic idea: <<<<.*?>>>> that match 4 < , 0 or more characters until first >>>> . depending on regex flavor using, might able simplify above to: <{4}.*?>{4}

Ruby on rails - Template missing prob -

i having hard time solving problem because first time learn ruby on rail, have index.html.erb, new.html.erb, show.html.erb, edit.html.erb files. when go localhost:3000/blogs/edit page page showing show.html.erb , when delete show.html.erb access edit.html.erb im having template missing error. when access localhost:3000/blogs/new or localhost:3000/blogs working fine.so here's code inside blogs_controller.rb class blogscontroller < applicationcontroller def index @content_first = 'this 1' ; @content_two = 'this 2' ; end def new end def create end def edit end def update end def show end def destroy end end i think problem you're trying access /blogs/edit , , route /blogs/edit/:id . in need provide id of blog object, can edit it. if run rake routes you able see available routes. hope helps =)

Open a local pdf file from Delphi Firemonkey Code for Android App -

this question has answer here: delphi open pdf ios/android local storage 2 answers note: delphi xe8, firemonkey app android 4.4.2 i trying open pdf document android app made firemonkey , open adobe acrobat, file doesn't, have found online in several webpages , have tried every 1 of them, no 1 works. the error message adobe can't find document open but document in public folder, , have moved differents folder , nothing happend. i have opened images other folders without problem, don't understand. can give me solution please?. procedure tform1.bttnabrirclick(sender: tobject); var nombrefichero, rutaraiz, ruta_fichero, ruta_fichero2 : string; begin // nombrefichero := 'doc1.pdf'; // rutaraiz := 'file:///storage/emulated/0/tabletbigger/images/articulos'; // rutaraiz := '/storage/emulated/0

javascript - Buffering on audio source -

i'm using javascript radio player, so, got bad network , connection drops out, want know if there's function buffering, reload stream if crashes. hope answer, thanks. greetings, julia. if use case radio data streaming can't access past data, if use case media-player can use buffered property of audio element query range of media has been buffered @ moment or currenttime property access current execution time. var myaudioelement = document.createelementbytag('audio') // let's suppose audio element has radio streaming attached source myaudioelement.buffered // returns last data has been downloaded source myaudioelement.currenttime // returns time of last data played maybe should see connection api aware of when user go offline

java - How to Sort Reducer Output? -

i want sort output of reducer. sample of reducer output shown below: 0,0 2.5 0,1 3.0 1,0 4.0 1,1 1.5 the reducer output sorted first element of key. wanted sort second element of key output this: 0,0 2.5 1,0 4.0 0,1 3.0 1,1 1.5 any way can this? please help! this reducer: import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.hashmap; import org.apache.hadoop.fs.filesystem; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.text; import org.apache.hadoop.mapreduce.reducer; public class recreduce extends reducer<text, text, text, text> { public static int n=0; @override public void setup(context context) throws ioexception, interruptedexception{ filesystem hdfs= filesystem.get(context.getconfiguration()); bufferedreader br = new bufferedreader(new inputstreamreader(hdfs.open(new path(context.getconfiguration().get("outfile")))));

sql server - SQL: Sub Query to filter the result of a Query -

select sum(imps.[count]) , count (imps.interest_name) b, ver.vertical_name impressions imps inner join verticals ver on imps.campaign_id = ver.campaign_id ver.vertical_name = 'retail' or ver.vertical_name = 'travel' group imps.interest_name, ver.vertical_name; the above query returns record : b vertical_name 6 6 retail 3 2 retail 7 1 travel 13 10 travel i want modify query result such : b vertical_name 9 8 retail 20 11 travel that further grouping vertical name , taking sum of colums , b. guess has done sub query buy not sure how? just group vertical_name , remove imps.interest_name group by since doing count (imps.interest_name) on it. select sum(imps.[count]) , count (imps.interest_name) b, ver.vertical_name impressions imps inner join verticals ver on imps.campaign_id = ver.campaign_id ver.vertical_name = 'retail' or ver.vertical_name = 'travel' group ver.vertical_name;

javascript - PHP noob having problems posting drop-down values into MySQL database. My table formatting is off too. Can anyone shed some light on this? -

building football prediction website. getting thee home_team names , away team names fixtures table in dbms, corresponding drop down boxes each fixture user can predict score. cant work. grateful help! //establish connection <?php $connection = mysql_connect('localhost', 'root', 'password'); mysql_select_db('mls'); $query = "select * fixtures fixture_id between '1' , '10' "; $result = mysql_query($query); $num = mysql_num_rows($result); if($num>0){ echo"<table>"; echo "<th>home team</th>"; echo "<th>home score</th>"; echo "<th>away score</th>"; echo "<th>away team</th>"; for($count=0;$count<$num; $count++){ $row = mysql_fetch_array($result); echo"<tr> <td>".$row[&#

linux - Device Tree for PHY-less connection to a DSA switch -

we have little problem creating device tree our configuration of marvell dsa switch , xilinx zynq processor. connected this: |——————————————| |——————————————————————————————| | e000b000—|———— sgmii ————|—port6 (0x16) port3 —— phy3 | zynq | | mv88e6321 | | e000c000—|—x x—|—port5 port4 —— phy4 |——————————————| |——————————————————————————————| |___________ mdio _______________| and have device tree linux kernel, looks this: ps7_ethernet_0: ps7-ethernet@e000b000 { #address-cells = <1>; #size-cells = <0>; clock-names = "ref_clk", "aper_clk"; clocks = <&clkc 13>, <&clkc 30>; compatible = "xlnx,ps7-ethernet-1.00.a"; interrupt-parent = <&ps7_scugic_0>; interrupts = <0 22 4>; local-mac-address = [00 0a 3

linux - Changing IP address at runtime -

i creating tcp connection using function socket() , bind() , , listen() . our customers able define ip address of server @ runtime. there way of changing ip @ runtime or must done in bios? thanks tips i've changed ip address using ifaddrset(..) many times. call function within startup script before application running have no idea how calling function affects connected sockets. but have @ functions provided iflib.h . i'm sure you'll find suits needs ( ifaddradd(..) looks promising).

Learning Clojure: recursion for Hidden Markov Model -

i'm learning clojure , started copying functionality of python program create genomic sequences following (extremely simple) hidden markov model. in beginning stuck known way of serial programming , used def keyword lot, solving problem tons of side effects, kicking every concept of clojure right in butt. (although worked supposed) then tried convert more functional way, using loop , recur , atom , on. when run arityexception, can't read error message in way shows me function throws it. (defn create-model [name pa pc pg pt pswitch] ; converts propabilities cumulative prop's , returns char (with-meta (fn [] (let [x (rand)] (if (<= x pa) \a (if (<= x (+ pa pc)) \c (if (<= x (+ pa pc pg)) \g \t))))) ; function object {:p-switch pswitch :name name})) ; metadata, used change model (defn create-genome [n] ; adds random chars model string , sw

node.js - I want to render the data with the HTML file -

routes.get('/agents',function(req,res,next){ var sess = req.session; var userdata = sess.username; console.log("data coming here "+userdata); res.sendfile(__dirname + '/views/agents.html',[{"sessiondata":userdata}]); }); i want send data file , use data in html file. way this.please let me. you should use templating engine render data. ejs , jade work great , quite popular, you'll find plenty of resource learn how use it. learnjade 1 learn. using jade : routes.get('/agents', function(req, res, next) { var sess = req.session; var userdata = sess.username; console.log("data coming here " + userdata); res.render("agents.jade", {"sessiondata": userdata, "doesitwork": "yeah"}); });

Is it possible to create an RHQ plugin that collects historic measurements from files? -

i'm trying create rhq plugin gather measurements. seems relativity easy create plugin return value present moment. however, need collect these measurements files. these files created on schedule, example 1 per hour, contain finer measurements, example measurement every minute. file may below: 18:00 20 18:01 42 18:02 39 ... 18:58 12 18:59 15 is possible create rhq plugin can return many values timestamps measurement? i think can within org.rhq.core.pluginapi.measurement.measurementfacet#getvalues return many values want within measurementreport . so open file, seek last known position (if file appended to), read there , each line go measurementdata data = new measurementdatanumeric(timeinfile, request, valuefromfile); report.add(data); of course alerting on (historical) data sort of questionable, if read file 1 hour later, alert can not retroactively fired @ time bad value happened :->

spring data jpa - Issue with projection in SpringDataRest and @Lob attribute -

i have entity person : @entity public class person implements serializable { @id @generatedvalue(strategy = auto, generator = "person_seq") private integer idperson; private string lastname; private string firstname; @lob private byte[] picture; a repository public interface personrepository extends pagingandsortingrepository<person, integer> {} a projection @projection(name = "picture", types = { person.class }) public interface projectionpictureperson { byte[] getpicture(); } when used projection : ..../persons/1?projection=picture have error there unexpected error (type=internal server error, status=500). not write content: [b cannot cast [ljava.lang.object; (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->$proxy109["picture"]); nested exception com.fasterxml.jackson.databind.jsonmappingexception: [b cannot cast [ljava.lang.object; (through reference chain: org.springfram

codeigniter - Code Igniter : My Function is Pile Up -

can u me sir?, i'm sorry english bad,and i'm new ci. got problems project. when send id_user page, okay call "page 2". got id in link, fine, after try load page navbar, cant load page. , see function pile in link. but before work great, can load page. happen when send id page 2.. i cant post image, i'll try give example. first, link this localhost/codeigniter-maxtune/index.php/home/table and select 1 row in send id page. localhost/codeigniter-maxtune/index.php/home/another_page/8 okay got id in page, , try again access table page. localhost/codeigniter-maxtune/index.php/home/another_page/table and cant load page 'cause function "table" pile function "another_page" thats problem hope u understand , can me :) i use anchor link pages, here link of sending id href="form_add_saldo/$row->id_anggota" and here link calling table page href="admin_daftar_anggota"> it's contro

c - How is pointer to array different from array names? -

i reading more arrays vs pointers in c , wrote following program. #include <stdio.h> int arr[10] = { } ; typedef int (*type)[10] ; int main() { type val = &arr ; printf("size %lu\n", sizeof(val)) ; printf("size of int %lu\n", sizeof(int)) ; } if, execute program, sizeof(val) given 8 , sizeof(int) given 4. if val pointer array 10 elements, shouldn't it's size 40. why sizeof(val) 8 ? if val pointer array... yes, is, , sizeof(val) produces size " pointer array", not array itself. ...shouldn't it's size 40.? no, sizeof(val) calculates size of operand, "pointer" here. in platform, size of pointer seems 64 bits, i.e., 8 bytes. so, gives 8 . also, mentioned, use %zu print size_t , type produced sizeof operator.

node.js - How to get channelid in pubnub subscribe/or publish function? -

this subscribe code want channelid used this.channel in code got undefined. there way can channelid pubnub.subscribe({ channel: changing dynamically, presence: function (m) { console.log(m) }, message: function (m) { console.log(m); console.log("channel ==" + this.channel) }, error: function (error) { // handle error here console.log(json.stringify(error)); } }) result: channel==undefined looking @ the fine manual , should work: pubnub.subscribe({ channel: changing dynamically, presence: function (m) { console.log(m) }, message: function (m, env, channel) { console.log(m); console.log("channel ==" + channel) }, error: function (error) { // handle error here console.log(json.stringify(error)); } }) in other words, channel passed argument message callback. the reason this.channel being undefined message call

Deleting a Key and its occurrence in other key's Value in python dictionary -

suppose have dictionary mydict={0: set([1]),1: set([0, 2]),2: set([1, 3]),3: set([2])} and want delete 1 dictionary ,that means key "1" , every occurence of 1 in sets of value of other key .for e.g deleting 1 make dictionary mydict={0: set([]),2: set([ 3]),3: set([2])} i trying achieve not able .thanks in advance del mydict[item] key, value in mydict.items(): if item in value: mydict[key] = value.difference(set([item])) you can use this. first remove item dictionary, remove occurances of values using set difference.

ionic framework - angularjs child state to get data for parent state -

i want implement child state getting data main state. while i'm in child state want show $ionicloading content on view of parent state , after data loaded should leave child state , go parent state. how implement using angularjs/ionicframework? the controller state want split of looking this: .controller('mainctrl', function ($scope, $ionicpopover, $state, $ionicloading, $ionicplatform, $q, webservice, dbservice) { //------ part should go child state -----// $ionicloading.show({ template: "daten werden geladen...", animation: "fade-in", showbackdrop: false, maxwidth: 200, showdelay: 500 }); $ionicplatform.ready(function() { $ionicpopover.fromtemplateurl('templates/popover.html', { scope: $scope }).then(function (popover) { $scope.popover = popover; }); dbservice.droptables(); dbservice.createalltables(); webservice.getalltables().then(function(res) { $ionicloadi

c# - How do I create a `ITypeElement` with represents a closed generic type in a ReSharper plugin? -

Image
i'm using resharper 8 sdk , want find inheritors of particular generic interface, generic type particular type. have asked more general question got of way there, able find implementation of icommandhandler<t> , not 1 implementation want, icommandhandler<testcommand> this code have: foreach (var psimodule in declaredelement.getpsiservices().modules.getmodules()) { ideclaredtype generictype = typefactory.createtypebyclrname("handlernavigationtest.icommandhandler`1", psimodule, theclass.resolvecontext); var generictypeelement = generictype.gettypeelement(); if (generictypeelement != null) { var thetype = typefactory.createtype(originaltypeelement); var commandhandlertype = typefactory.createtype(generictypeelement,thetype); var handlertypeelement = commandhandlertype.gettypeelement(); solution.getpsiservices().finder.findinheritors(handlertypeelement, searchdomainfactory.createsearchdo

retrieve timestamp value properly from cassandra in node.js -

in database have timestamp value this: 2015-06-25 11:39:17+0530 but after retrieving it's like: 2015-06-25t06:19:13.362z ....so how retrieve in correct format. table structure: create table test.tab ( key text, time timestamp, value decimal, primary key (key, time) ) clustering order (time asc) , bloom_filter_fp_chance = 0.01 , caching = '{"keys":"all", "rows_per_partition":"none"}' , comment = '' , compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.sizetieredcompactionstrategy', 'max_threshold': '32'} , compression = {'sstable_compression': 'org.apache.cassandra.io.compress.lz4compressor'} , dclocal_read_repair_chance = 0.1 , default_time_to_live = 0 , gc_grace_seconds = 864000 , max_index_interval = 2048 , memtable_flush_period_in_ms = 0 , min_index_interval = 128 , read_repair_chance = 0.0 , speculative_retry = 

c# - Extension methods, which is a better choice -

following test class public class test { public int a; } following extension methods have created: public static class extension { public static void do1(this test t,int value) { t.a = t.a + value; } public static test do2(this test t,int value) { t.a = t.a + value; return t } } code usage: test t = new test(); t.a = 5; both following calls lead same result t.a, 10 : t.do1(5) t = t.do2(5) there many instances in code need implement similar logic, 1 better, 1 of them passing reference value , internally updating it, other returning updated reference. using 1 of them safer, if kind of code ever gets multi threaded wrapper, provided thread safety taken care of. update referenced variable need ref or out keyword, pointer pointer, instead of separate pointer same memory location in case, here in extension methods, cannot use them. please let me know if question needs further clarity in example not make sense return t variable.

objective c - iOS UIPageViewController child view under Bottom Bar -

Image
i had uipageviewcontroller embedded in navigationcontroller embedded tabbarcontroller. supposed every child view of uipageviewcontroller fits size within uitabbarviewcontroller. the first child view looks fine: switch next (vertically), it's view resizes , view length expands on bottom bar: actually it's not under bottom bar clipped size (which means if pull view still cannot see whole cut text). i did unchecked every related view controller's under bottom bar & adjust scroll view inset nothing works. any suggestion appreciated. try in table view controller viewdidload() method. self.extendedlayoutincludesopaquebars = no; or can set property in interface builder: uncheck extend edges: under bottom bars, under opaque bars.

mysql - php session and database in codiegniter -

i trying create shopping cart in codeigniter. can 1 suggest me best way of doing thing database , php session. i found lots of thing through internet not solved problem. please give me shortest way it. i new codeigniter. codeigniter provides default `cart` class these purposes. you have load library $this->load->library('cart'); if using codeigniter's cart class mandatory give (id, qty, price, , name) each products. cart class provides ways insert , update items. here codeigniter's docs on cart class this tutorial helped me grasp on how use cart class

java - Log4j2: Ability to log data with different log levels in multi user environment -

i'm using log4j2 in oracle adf 12c application. one of requirements of our customer have different log levels different logged-in users , change log levels dynamically user.also administrator should have control stop logging. i.e lets 'user a' needs trace log level , 'user b' needs error log level. if both users logged in simultaneously, application should log in trace level 'user a' , in error level 'user b'. , if 'user b' wants log in fatal level should able change configuration dynamically. following log4j2 config file. <?xml version="1.0" encoding="utf-8"?> <configuration status="trace"> <mapfilter onmatch="accept" operator="or"> <keyvaluepair key="$${ctx:loglevelyn}" value="y"/> </mapfilter> <appenders> <file name="file" filename="./adfappcustomlogs/testlog4j2.log">

Convert Rows to column rows in SQL Server -

i looking way convert rows in table columns rows , assign column names each. players id team john 1 t1 carmel 1 t1 jack 1 t1 james 1 t1 changed to: id team p1 p2 p3 p4 1 t1 john carmel jack james there can number of players in above example. tried using pivot. change rows columns not in fashion looking for. here 1 way using dynamic crosstab. read article jeff moden more details. declare @sql1 varchar(4000) = '' declare @sql2 varchar(4000) = '' declare @sql3 varchar(4000) = '' select @sql1 = 'select id , team ' select @sql2 = @sql2 + ' , max(case when rn = ' + convert(varchar(10), rn) + ' players end) [' + convert(varchar(10), rn) + ']' + char(10) from( select distinct rn = row_number() over(partition id, team order (select null)) tbl )t order rn select @sql3 = 'from( select *, rn = row_number() over(partition id, team

javascript - Downloaded file (using download.php) from server won't open. Why? -

i beginner. i've searched everywhere, don't know why after downloading file server through client (win 7 firefox), unable open file. i've tried png file , mp4 file. download completes, files don't open. here's script; $dl_file = $_get['val']; //verified full path , file name gets passed here $basename = basename($dl_file); $ext = pathinfo($dl_file, pathinfo_extension); $length = sprintf("%u", filesize($dl_file)); header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.$basename.''); //manually tried '.$basename.'.png' - did not work. how pass $ext here? header('content-transfer-encoding: binary'); header('connection: keep-alive'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); he

mysql - Increase storage on running EC2 using EBS -

i have instance running on ec2 default storage of 8gb. have mysql running on instance taking of storage on instance. i have created volume mounted on /vol1 is there way when mysql run out of storage start using new volume or way join them together. i can stop myqsl if have to, resize you can shift database amazon rds solve problem of disk overflowing because of database growth. rds scale required mysql database follow below link migrate mysql rds: http://aws.amazon.com/rds/mysql/

c# - Publish dacpac in single user mode using Microsoft.SqlServer.Dac.DacServices -

i want publish dac pac in single user mode prevent unnecessary db changes while database upgrading. have used deploy function in microsoft.sqlserver.dac.dacservices . that function there argument dacdeployoptions options. have set deploydatabaseinsingleusermode = true in options. though set true able db operation while dacpac deploying. is there missing? or there other way achieve this. help appreciated! which version of dacfx using? if it's not latest, best latest, because lot of older ones not @ recognizing options specify. alternatively, this(it's i've done, instead of trying dacfx work properly. serverconnection connection = new serverconnection(servername); server sqlserver = new server(connection); database qadatabase = sqlserver.databases[databasename]; qadatabase.databaseoptions.useraccess = databaseuseraccess.single; qadatabase.alter(terminationclause.rollbacktransactionsimmediately

objective c - Tab bar icons too dark -

my tab bar icons dark. i tried setting image unselected more transparent image, doesn't make difference. if use lighter image tab bar image, doesn't change way unselected or selected images in tab bar look. how can make icons brighter? try this note - change color per requirement //for selected icons [[uitabbar appearance] setselectedimagetintcolor:[uicolor yellowcolor]]; //for unselected icons [[uitabbar appearance] settintcolor:[uicolor graycolor]];

android - Can developers perform optimizations in apk creation using dx tool? -

dx tool present in android build tools, , developers need not invoke tool during creation of .dex/.apk. can developer perform further optimizations in .dex/.apk creation process optimize output .dex/.apk file better performance on device?

javascript - Object structure changed internally -

i trying populate highcharts object. chart loaded fine initially, source object gets changed. it's little tough tell, if kindly check jsfiddle code , following: click button1 => chart loads data [687, 687] expected. click button2 => chart loads data [546, 546] expected. again, click button1 => nothing happens because getalldata.t1.c1.m1 changed [687, 687] [object, object] . again, click button2 => chart loads data [546, 546] expected (please see console.log output below). can please explain? jsfiddle below console.log in chrome each button click. [687, 687] [546, 546] [object, object] 0: object y: 687 __proto__: object 1: object y: 687 __proto__: object length: 2 __proto__: array[0] [546, 546] as mentioned in comment, need set updatepoints argument of series.setdata false prevent highcharts updating existing data points (it due data sets being same length). something should suffice , preserve animations.

c# - SQL returning DBnull instead of integer -

i'm trying add record table, , when record exists, want return -3. in c# code, sql server returns dbnull . not sure why, because returns scope_identity no problem. here sql, appreciated. alter procedure [dbo].[inserttype] @name varchar(20), @username varchar(12), @returnid int output begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; if exists (select name tbltypes username = @username , name = @name) begin return -3 --already exists end else begin insert tbltypes (name, username) values (@name, @username) set @returnid = scope_identity() return @returnid end end

mathematical expressions - Mathematica is getting slow when repeatedly starting an external program -

i found strange phenomenon mathematica getting slow when repeatedly started external program using readlist . example, following code display significant increase of cpu time each 'ls' command (my platform os x): data = table[timing[readlist["!ls"]], {100000}][[all, 1]]; listplot[data] this phenomenon seems ubiquitous other external programs. can suggest me how avoid speed down?

css - add webfont icon using content on :before in a custom html selectbox -

i'm trying make custom styled selectbox base on default html selectbox , i'm trying change default dropdown icon on default html selectbox using :before , put "content: '\27'" ("/27" ionic icon of dropdown icon) sadly not working, help, suggestion, recommendation, ideas , clues appreciated. thank you! /* select box */ .dodong_ui_selectbox{ border: 1px solid #ccc; -webkit-appearance: none; padding: 5px; } .dodong_ui_selectbox:before{ content: '\27'; } .dodong_ui_selectbox:active, .dodong_ui_selectbox:focus{ outline: none; } <link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet"/> <select name="user" class="dodong_ui_selectbox"> <option value="user1">jason acappela</option> <option value="user2">mark henry</option> <option value="user3">xo