Posts

Showing posts from March, 2012

ios - Meaning of values received from "SecTrustCopyPublicKey" call -

when making https request google.com, did following: import foundation class learnnsurlsession: nsobject, nsurlsessiondelegate, nsurlsessiontaskdelegate { override init() { super.init() let mysession = nsurlsession(configuration: nsurlsessionconfiguration.ephemeralsessionconfiguration(), delegate: self, delegatequeue: nsoperationqueue.mainqueue()) let data = mysession.datataskwithurl(nsurl(string: "https://www.google.com")!, completionhandler: myhandler) data.resume() } func myhandler(data: nsdata!, response: nsurlresponse!, error: nserror!) -> void { let s = nsstring(data: data, encoding: nsasciistringencoding) println(s) } func urlsession(session: nsurlsession, task: nsurlsessiontask, didcompletewitherror error: nserror?) { println("error: \(error)") } // handles https connections func urlsession(session: nsurlsession, didreceivechallenge challenge: nsurlauthentic

ruby - when to use flush after writing to STDOUT? -

i know flush does. takes data stored in buffer , writes standard output empty buffer. not clear me when needs done (shouldn't flushing done automatically interpreter). reading book ruby programming language , gives example of socket server: require 'socket' host, port = argv begin stdout.print "connnecting..." stdout.flush s = tcpsocket.open(host,port) stdout.puts "done" local, peer = s.addr, s.peeraddr stdout.print "connected #{peer[2]}:#{peer[1]}" stdout.print "using local port #{local[1]}" begin sleep(0.5) msg = s.read_nonblock(4096) stdout.puts msg.chop rescue systemcallerror end loop stdout.print '> ' stdout.flush local = stdin.gets break if !local s.puts(local) s.flush response = s.readpartial(4096) puts(response.chop) end rescue puts $! en

javascript - Bootstrap JS Modal -

i send link forgotten password client. want show bootstrap js modal changing password when client clicks link. code showing approach provided below: account.html <template name="resetpassword"> <div class="modal fade" id="mymodal-9" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <span class="f-s-20 text-blue">Şİfre deĞİŞtİrme ekrani </span> </div> <div class="modal-body"> {{#if resetpassword}} <form action="/reset-password" id="resetpasswordform" method="post"> <input id=&q

python - GCE module in Ansible cannot find apache-libcloud although gce.py works -

i installed ansible, apache-libcloud pip. also, can use gcloud cli , ansible works non-gce-related playbooks. when using gce module task create instances in ansible playbook, following error occurs: task: [launch instances] ****************************************************** <127.0.0.1> remote_module gce instance_names=mm2 machine_type=f1-micro image=ubuntu-1204-precise-v20150625 zone=europe-west1-d service_account_email= pem_file=../pkey.pem project_id=fancystuff-11 <127.0.0.1> exec ['/bin/sh', '-c', 'mkdir -p $home/.ansible/tmp/ansible-tmp-1437669562.03-233461447935889 && chmod a+rx $home/.ansible/tmp/ansible-tmp-1437669562.03-233461447935889 && echo $home/.ansible/tmp/ansible-tmp-1437669562.03-233461447935889'] <127.0.0.1> put /var/folders/v4/ll0_f8lj7yl7yghb645h95q9ckfc19/t/tmpydopt9 /users/d046179/.ansible/tmp/ansible-tmp-1437669562.03-233461447935889/gce <127.0.0.1> exec ['/bin/sh', '-c',

sql - Mysql - get results from complex criteria -

Image
i have database statistics on number of websites , i'm having issue rather complex query have no idea how (or if it's possible). i have 2 tables: websites , visits . former list of websites , properties, while former list of each user's visit on specific website. the program i'm making supposed fetch websites need "scanned". interval between each scan each site depends on websites total number of visits last 30 days. here table intended scan-interval: the tables have following structure: websites visits what want query returns websites either at or past individual update deadline (can seen last_scanned column). is doable in single query? here's can try: select main.* ( select w.web_id, w.url, w.last_scanned, (select count(*) visits v v.web_id = w.web_id , timestampdiff(day,v.added_on, now()) <=30 ) visit_count, timestampdiff(hour,w.last_scanned, now()) hrs_since_update w

asp.net - How can I call eventhandler? -

void lbl_click(object sender, eventargs e) { linkbutton lnk = sender linkbutton; int currentpage = int.parse(lnk.text); int take = currentpage * 10; int skip = currentpage == 1 ? 0 : take - 10; fetchdata(take, skip); } hi, i want call method lbl_click() whenever click happens. how can define aspx tag call function " lbl_click()" whenever click happens? or can use javascript invoke "lbl_click()" function? code event handler lbl_click executed when click event fired link button. functionally, should happen when click paging link buttons. try put breakpoint in lbl_click function , fire event clicking on paging link buttons in ui. since, still not working you. have created small working page show how should be. code behind using system; using system.web.ui.webcontrols; public partial class default2 : system.web.ui.page { protected void page_init(object sender, eventargs e) { createdynamiclinkcontrols(); } private

javascript - How to get [data-value] from parent element after click -

my code structure looks this: <div id="calendar" data-calendar="0"> <div class="box"> <div class="head"> <div class="nav_prev" data-calendar-nav="prev"> <div class="nav_prev" data-calendar-nav="prev"> </div> </div> </div> and don't know how after click on .nav_prev or .nav_next data-calendar value (in example 0 ) #calendar . know should use .parent() cant figure out how this. for have js code: $(document).on("click","#calendar .head .nav_prev, #calendar .head .nav_next",function(){ if( $(this).attr('data-calendar-nav') == 'prev') { console.log('prev'); } if( $(this).attr('data-calendar-nav') == 'next') { console.log('next'); } }) use closest() parent , data() data attribute:

javascript - complex ajax query using parse api -

im dealing parse.com's apis. want make complex queries in javascript function. i couldnt manage equivalant params section below code ajax request. appriciated. for example, retrieve scores between 1000 , 3000, gave example in python, import json,httplib,urllib connection = httplib.httpsconnection('api.parse.com', 443) params = urllib.urlencode({"where":json.dumps({ "score": { "$gte": 1000, "$lte": 3000 } })}) connection.connect() connection.request('get', '/1/classes/gamescore?%s' % params, '', { "x-parse-application-id": "pchvgniu2bbgggmofkcvkquk91g5v3u5g4zgwifk", "x-parse-rest-api-key": "5pi5vb7dnu8mry6ypftotpidpuheqv5gmchfaqxk" }) result = json.loads(connection.getresponse().read()) print result the code in javascript can shorter: $.ajax({ type:"get", beforesend: func

html email - Lotus notes 8.5 image width and height -

Image
i have image in it's own table separator. works fine 8 in 8.5 image, including featured image showing @ 50% width table. lotus notes 8.0 - lotus notes 8.5 - notice in first, green separator image (which 1 big jpeg) correct width , height (as defined both style , width/height attributes). whereas in 8.5, disregards these values , has pretty halved image size. edit - code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>document here</title> </head> <body> <center style="width: 100%; min-width: 580px;"><!-- header row --> <table class="container header" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: inherit; width: 580px; margin: 0 auto; padding: 0;"> <tbody> <tr align="left" style="vertical-align: top; text-align: left; padding: 0;">

c++ - std::map check if a map has been assigned a non-default value? -

lets have complex map defined as std::map<int, std::pair< vector<int>, float> > complex_map; let assume initialized map as for (int k=0;k<5;k++) { std::pair< vector<int>, float> complex_map_child; complex_map[k]=complex_map_child; } next, populate entries of map: float test_1 = .7888; vector<int> test_2; test_2.push_back(1); test_2.push_back(2); complex_map[1].first = test_2; complex_map[1].second = test_1; so corresponding key value 1 of complex_map, have pair of values corresponding test_1 , test_2. now how check if have explicitly added values map? i.e in example how havent explicitly filled complex_map[0]? looks using std::map::operator[] improperly , try go on - getting object this: auto &complex_value = complex_map[0]; and try check if inserted before or implicitly created std::map::operator[] . just not use std::map::operator[] access elements. use when need set value in map. so proper solu

How to copy and rename folders using bash? -

i have many folders similar names sim00 sim01 sim02 and more. have file want copy of them named test.dat , copy them new folder named analysis , give them new name , such test_0.dat, test_1.dat , on. here have tried far. counter=0; value in "sim*/test.dat"; cp "$value" "analysis/${value%.dat}_$counter.dat ; ((counter++)); done however, not work. can show me different solution? the rule "quote variables" doesn't should quote wildcards, too. enclosing asterisk in double quotes prevents expansion. you need remove path filename: #! /bin/bash counter=0 file in sim*/test.dat; cp "$file" analysis/test_"$counter".dat ((counter++)) done

jquery - Trigger a function on multiple elements on scroll -

i’m trying trigger odometer.js on several figures on scroll. code wrong , think i’m gonna cry.. 2 hours , nothing : uncaught typeerror: this.el.appendchild not function... please help. thanks. html: <h2 class="odometre" chiffre-cle="2000">0</h2> <h2 class="odometre" chiffre-cle="2000">0</h2> <h2 class="odometre" chiffre-cle="2000">0</h2> javascript: var y = $(window).height(); var coord = y / 2; $(window).scroll(function(){ if($(window).scrolltop() > coord){ $(".odometre").each(function(){ var el = $(this); var chiffre = el.attr("chiffre-cle"); od = new odometer({ el: el, value: 0, format: 'd', animation: 'ease', duration: 400 }); od.update(chiffre); }) } else {

Powershell report to csv all files modified in last month -

i'm write ps script report in csv of files modified within last month. i've tried 2 options first doesn't write report file , showing results on screen , second nothing. appreciated. $dir_to_look="d:\testfolder" $month_backdate=$(get-date).adddays(-1) get-childitem $dir_to_look -recurse | where-object {!($_.psiscontainer)} | { $_.lastwritetime -gt $month_backdate } | foreach { write-host "$($_.lastwritetime) :: $($_.fullname) " } | export-csv -path \\share\filename.csv here second one: function get-oldfiles { param($date) $folders = get-childitem “d:\testfolder” -recurse | where-object {$_.psiscontainer -eq $true} foreach ($folder in $folders) { $oldfiles = dir $folder.fullname *.* | where-object {$_.lastwritetime -le $date} if ($oldfiles.count) { [float]$totalsize = ($oldfiles | measure-object -sum length).sum / 1kb $data = @{‘folder’=$folder.fullname;’count’=$oldfiles.count;’size(kb)’=$totalsize}

sql - GVim not recognizing commands in plugin -

Image
how gvim recognize sqlcomplete.vim commands? i'm unable use sqlcomplete.vim plugin. when running :version following output: and scrolling way bottom here rest of output: and env variables: :echo $vim c:\users\me\.babun\cygwin\etc\ :echo $home h:\ here output of :scriptnames : when running sqlcomplete.vim command such :sqlsettype sqlanywhere output is: how gvim recognize sqlcomplete.vim commands? another piece of helpful information output of :echo &rtp : h:\vimfiles,h:\.vim\bundle\vundle.vim,h:\.vim\bundle\dbext.vim,h:\.vim\bundle\sq lcomplete.vim,c:\users\me\.babun\cygwin\etc\vimfiles,c:\users\me\.babu n\cygwin\etc\,c:\users\me\.babun\cygwin\etc\vimfiles/after,h:\vimfiles/afte r,h:\.vim/bundle/vundle.vim,h:\.vim\bundle\vundle.vim/after,h:\.vim\bundle\dbext .vim/after,h:\.vim\bundle\sqlcomplete.vim/after some points check: :scriptnames shows plugin \sqlcomplete.vim but link provided points .../vim/runtime/ autoload /sqlcomplete

regex - Parse Nth matching column and split via single regular expression -

given below input line, need 4th column values on either side of slash character via single regex. 2323 va1/val1.2 val2/val2.2 val3/val3.2 down regex should match "val3/" . likewise regexp match "/val3.2" spacing between columns fixed , 2nd,3rd,4th column pattern "anystring/anyotherstring". / ` there. i using custom tool expects input regexp choices limited. able parse via javascript code looking single regex have match , split of nth column. you can 4th column following regex : (?:[^ ]* +){3}([^ /]*) note need return group(1). see demo https://regex101.com/r/km3rn2/2

ruby on rails - RSpec Helper Parameters Issue -

i'm trying test following code: module applicationhelper def current_book book.find(params[:id]) end end using following test rspec: rspec.describe applicationhelper, :type => :helper describe "#current_book" book_1 = create(:book) params = {} params[:id] = book_1.id expect(helper.current_book).to eq(book_1) end end but reason params[:id] parameter isn't being passed in properly. suggestions this? you need stub params: rspec.describe applicationhelper, type: :helper describe "#current_book" let(:first_book) { create(:book) } before(:all) { helper.stub!(:params).and_return(id: 1) } "returns book matching id" expect(helper.current_book).to eq(first_book) end end end

Business Unit is not showing AX 2012 R3 -

when trying create business unit in ax 2012 r3 showing under following setup → organization ✓ legal entities ✓ operating units ✓ position hierarchy ✓ organization hierarchies ✓ organization hierarchy purposes thank in advance microsoft dynamics ax 2012 r3 select following general ledger → setup → organization → business units

php - Symfony Picture Download -

i have action download picture , post picture toamazons3 , set url amazons3 in db: public function photouploadaction($username) { $em = $this->getdoctrine()->getmanager(); $request = $this->get('request'); $profilerepository = $this->get('artel.profile.developer.repository'); $developer = $profilerepository->findonebyusername($username); $developer_username = $developer->getusername(); if (!$developer) { throw $this->createnotfoundexception('unable find profile.'); } $authenticator = $this->get('artel.profile.authenticator'); if (!$authenticator->check($developer)) { throw new accessdeniedexception('access denied!'); } $url = sprintf( '%s%s', $this->container->getparameter('acme_storage.amazon_s3.base_url'), $this->getphotouploader()->upload($request->files->get('file'), $developer_userna

ios - Calling a function more than once swift, returning the same data -

so in swift call in function in ui picker func pickerview(pickerview: uipickerview, didselectrow row: int, incomponent component: int) { switch row{ case 0: //switch out returning actual selected item picker not using picker array let poke = ("\(mooarray[0])") getpokemon(poke); case 1: let poke = ("\(mooarray[1])") getpokemon(poke); case 2: let poke = ("\(mooarray[2])") getpokemon(poke); default: println("stopping") } //self.view.backgroundcolor = newbackcolor; } as can see calls getpokemon, passes through pokemon string, getpokemon function below func getpokemon(poke: string) { println("\(poke)"); //var pokemon = "charizard" var url = "http://pokeapi.co/api/v1/pokemon/" + poke alamofire.request(.get, url)

r - Alternative to calculating Elasticity using For Loop -

i've written piece of code calculate elasticity 200k products. elasticity being calculated alright it's been more 15 hours , process still running. see new objects being created. there faster alternative doing without using loop? below code: sku_list <- unique(transact_data4$productid) elasticity_values <- data.frame() (i in 1:length(sku_list)){ test_sku <- subset(transact_data4, productid==sku_list[i]) m1 <- lm(formula=sales~price, data= test_sku) coeffs <- as.data.frame(m1[[1]]) gradient<- coeffs[2,1] gradient_final <- ifelse(is.na(gradient), -1, gradient) mean_price <- mean(test_sku$price) mean_sales <- mean(test_sku$sales) elasticity <- gradient_final*mean_price/mean_sales sku_elasticity <- cbind(sku_list[i],elasticity) elasticity_values <- rbind(elasticity_values,sku_elasticity) } colnames(elasticity_values)[colnames(elasticity_values)=="v1"] <- "

java - LinkedHashMap casts -

i have following code // gets title, headers , data string type = (string) responsemap.get("type"); string language = (string) responsemap.get("language"); string template = (string) responsemap.get("template"); string title = (string) responsemap.get("title"); list<map> header = (list<map>) responsemap.get("headers"); object[] rows = ((list<list>) responsemap.get("data")).toarray(); list list = new arraylist(); bean line = null; linkedhashmap<string, object> hmap = null; int j, i; (j = 0; j < rows.length; j++) { hmap = (linkedhashmap<string, object>) rows[j]; line = new bean(); (i = 1; < headers.length; i++) { line.choosefield(i, headers, hmap); } list.add(line); } in hmap = (linkedhashmap) rows[j]; line eclipse says java.lang.classcastexception: java.util.arraylist cannot

c# - Updating related Data with Entity Framework 6 in MVC 5 -

using entityframework 6, update customer in following scenario: public class customer { public int id {get; set;} // 100 more scalar properties public virtual ilist<consultant> consultants {get;set;} } public class consultant { public int id {get; set;} public virtual ilist<customer> customers{get;set;} } this viewmodel edit view: public class customerviewmodel { public string[] selectedconsultants { get; set; } public ienumerable<consultants> allconsultants{ get; set; } public customer customer{ get; set; } } this edit-actionmethod: [httppost] public actionresult edit(customerviewmodel vm) { if (modelstate.isvalid) { // update scalar properties on customer var updatedcustomer = vm.customer; _db.customers.attach(updatedcustomer ); _db.entry(updatedcustomer ).state = entitystate.modified; _db.savechanges(); // update naviga

java - RabbitMQ moving messages from 1 Queue to another -

i using rabbitmq in java application. i want move messages 1 queue queue. the answer found here helpful me is possible move / merge messages between rabbitmq queues? . but on running command, there's no success or failure message. how can ensure during runtime? command using rabbitmqctl set_parameter shovel my-shovel '{"src-uri": "amqp://localhost", "src-queue": "myqueue", \ "dest-uri": "amqp://localhost", "dest-queue": "test3"}' and output setting runtime parameter "my-shovel" component "shovel" "{\"src-uri\": \"amqp://localhost\", \"src-queue\": \"myqueue\", \"dest-uri\": \"amqp://localhost\", \"dest-queue\": \"test3\"}" ... another way set rabbitmq policy time live or size on queue. then, setup policy handle messages should go. expire messages out

ibm mobilefirst - unable to list windows phone applications signed with MFP 7 -

we have problem when trying list application signed in applicationcenter/installers/html. we unsigned applicationcenter app windows phone mfp server repository. we certificate symantec (who delivers certificates windows applications). we signed applicationcenter app windows phone windows phone sdk using certificate delivered symantec. we install signed applicationcenter app in applicatoncenter console choosing installer option. we generated token aetgenerator tool uploaded , registered in application center console applicationcenter app windows phone. we connected http://hostname:portnumber/applicationcenter/installers.html windows phone device , accept token. then refresh screen , message list of application empty whereas should see applicationcenter app signed windowsphone. does ever face issue? thanks. do see windows phone app center client when open appcenter console in browser? can add ipa file , mark installer? if see ipa file in installers.html p

How to insert async and defer in script tags with CakePHP 3 -

i'm using php framework cakephp 3.0.3 , know how insert keywords defer , async script tags: how script injection framework: <? = $ this-> html-> script ('jquery-1.11.1.min.js')?> how rendered: <script src = "/ js / jquery-1.11.1.min.js"> </ script> like how be: <async script src = "/ js / jquery-1.11.1.min.js"> </ script> <script defer src = "/ js / jquery-1.11.1.min.js"> </ script> in documentation saw nothing done insert. an alternate form make follows: <? = $ this-> html-> script ('jquery-1.11.1.min.js' ['defer' => true])?> and rendering: <script src = "/ js / jquery-1.11.1.min.js" defer = "defer"> </ script> it's impossible $this->html->script() function. hard coded in cake\view\stringtemplate. suggest leave now, work anyway. if it's vital issue try override htmlhelper

java - How to print a type of getter -

i have code below: public static void main(string[] args) throws exception { printgetterssetters(podmiotszukajqueryformset.class); } public static void printgetterssetters(class aclass) { method[] methods = aclass.getmethods(); (method method: methods) { if (isgetter(method)) { system.out.println("getter: " + method); } } } public static boolean isgetter(method method) { if (!method.getname().startswith("getsomething")) { return false; } if (method.getparametertypes().length != 0) return false; if (void.class.equals(method.getreturntype())) return false; return true; } output: getter: public package.package.class package.package.class.getsomething() how can type of getter, in example: "class" in other examples "string" , "int" etc. --edit possible .getmodifiers() returns int. how can return string? think looking the method getretu

java - How to find out whether a zipped file contains executable files -

i have requirement upload files using java - spring web application. while uploading files web application, need check type of file uploaded. per requirement need allow zipped files uploaded. to deal security concerns, zip file should screened executable files or unwanted file types, if have list of malicious file types. kindly suggest how can know content type of files in zip, using java. i suggest try following: use zip file system provider access zip files using nio.2 file api: https://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html walk file tree: https://docs.oracle.com/javase/tutorial/essential/io/walk.html (there methods supporting java se 8 streams). perfrom checks, eg. using files.isexecutable

c# - Visual Studio 2015 'Output Window' highlight effect -

Image
maybe know how change highlight effect in 'output window' of visual studio 2015 here example: p.s. have vscoloroutput extension installed checked twice not set background color. this is, in fact, problem related vscoloroutput and, according vscoloroutput's author, it's caused bug in visual studio. you can see whole conversation regarding issue here: https://github.com/mike-ward/vscoloroutput/issues/4 in meanwhile, can try workaround propose there: go tools --> options --> environment --> fonts , colors show settings for:output window set item background black (not default or automatic) it worked me after restarted visual studio.

php - MYSQL in not work good with JavaScript (phpMyAdmin) -

i have problem i wanted start mysql , php have error every time start phpmyadmin. want fix problem first before learing wrong. error message: a fatal javascript error has occurred. send error report? error report { "pma_version": "4.3.11", "browser_name": "chrome", "browser_version": "44.0.2403.89", "user_os": "win", "server_software": "apache/2.4.12 (win32) openssl/1.0.1l php/5.6.8", "user_agent_string": "mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/44.0.2403.89 safari/537.36", "locale": "en_gb", "configuration_storage": "enabled", "php_version": "5.6.8", "exception_type": "js", "exception": { "mode": "onerror", "message": "script error.", "stack": [

javascript - Load some functions after successful render of custom directive -

i have directive shown below: angular.module("myapp") .directive('formprogress', function () { return { restrict: 'e', scope: { headingfirst: "@", headinghighlight: "@", values: "=", numwords: "=", customcallback: "&" }, templateurl: 'partial-htmls/toolbox/form-progress.html', link: function(scope, elm, attrs){ /* rendering before template rederred */ /* should render after directive has rendered right? */ console.dir(arguments); commonutilities.navigatetoform(3); } }; }); i trying call callback function after successful load of custom directive. i tried using link property mentioned in link . and tried defining loadcallback function in $scope object , call in custom directive: $scope.loadcallback = function(){ //here

ruby on rails - GitLab redirects to page 422 upon installation -

i installed gitlab following documentation page. server accessible http://foobar.com/gitlab . have passenger+apache installation. (unicorn running). after installation finished, loads login page, when type default username/password(root/5ivel!fe), redirects 422 page following error: 422 change requested rejected. i thought maybe there wrong password, tried reset password console when running gitlab-rails console production , sudo -u git -h gitlab-rails console production got following error: ls: cannot access /opt/gitlab/embedded/service/gitlab-rails/log: no such file or directory chpst: fatal: unknown user/group: -u since first error cause there no log file, manually created log file after running command got following error: chpst: fatal: unable setgroups: permission denied i don't know else. in production.log, complains csr token not being valid. assume means not supplying correct password, password given gitlab installation. also might relevant, used guide

html - Show/Hide div based on drop down value with out javascript -

i want toggle 2 div's based on dropdown selected value out javascript using css <select class="number" id="number"> <option value="1" selected="selected">1</option> <option value="2">2</option> </select> <div id="one">div one</div> <div id="two">div two</div> when user selects 1 dropdown div 1 should show , when user selects 2 drop down div 2 should shown. basically need toggle both divs based on drop down value some 1 please help. toggling div you can achieve toggle (and / or show / hide) aspect pure css few different ways; here's one: * { margin:0; padding:0; font-family:"helvetica neue", helvetica, sans-serif; word-spacing:-2px; } h1 { font-size:40px; font-weight:bold; color:#191919; -webkit-font-smoothing: antialiased; } h2 { font-weight:normal; font-size:20px; color:#888; paddi

javascript - jquery flot pointing on wrong place -

Image
i have gone through alot of questions through stackoverflow none me. trying generate graph through jquery flot legend placed on wrong place. here's screenshot of graph. data thursday displaying near friday. here's javascript code var plot = $.plot("#chart_widget", [ { data: issued, label: "issued" }, { data: released, label: "released" }, ], $.extend(true, {}, plugins.getflotdefaults(), { series: { lines: { fill: false, linewidth: 1.5 }, points: { show: true, radius: 4, linewidth: 1.1

php - Multidimensional Array - sort index value keys -

how sort multidimensional array indexes? i have array structure array ( [amie] => array ( [0] => amie [1] => 10 [3] => 10.9% [4] => 0.0 [5] => 14.3 [6] => 2.4 [7] => 1510.4 [8] => 209.7 [9] => 0 [10] => 0.0 [11] => 0 [12] => 0.0 [13] => 0.0 [14] => 0.0% [15] => 6 [17] => 100.0% [18] => 0.0% [2] => 1 ) [darren d] => array ( [0] => darren d [1] => 20 [3] => 3.6% [4] => 0.5 [5] => 0.0 [6] => 0.0 [7] => 2148.6 [8] => 193.6 [9] => 0 [10] => 0.0 [11] => 27418.4 [12] => 6854.6 [13] => 2.0

java - Is there a Character.toChar? -

i know can use character.tochars char[] codepoint. far have: public static string bytestostring(byte[] bytes) { char[] buffer = new char[bytes.length]; int = 0; (byte abyte : bytes) { buffer[i] = character.tochars(abyte)[0]; i++; } return new string(buffer); } and works. rather skip char[] , go straight char. every time search have above. hoping little cleaner. the code have best you're going find if intend use character class. , in honesty -- doesn't messy. i'd stick it. the entire method unnecessary, however. string class has constructor can turn array of bytes string. string(byte[] bytes, charset charset) use this: string str = new string(bytes, standardcharsets.utf_8);

java - Set jdatepickerimpl blank once date is selected -

i trying write piece of code on reset button. what trying is: first select date , then press reset button on click of reset button, date field should blank. i searched lot on net of example saying use setdate(new date()). setting current date not blank date. i used setdate(new date("")), has no effect. please me import java.awt.dimension; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; import net.sourceforge.jdatepicker.impl.jdatepanelimpl; import net.sourceforge.jdatepicker.impl.jdatepickerimpl; import net.sourceforge.jdatepicker.impl.utildatemodel; public class dateexample extends jframe { utildatemodel datemodel1 = new utildatemodel(); jdatepanelimpl datepanel1 = new jdatepanelimpl(datemodel1); jdatepickerimpl startingdate = new jdatepickerimpl(datepanel1); jbutton resetbutton = new jbutton("reset"); public dateexample() { setlayout(null); setsize(n

performance - Python dict from mobypos.txt file -

i have file moby project pairs words 1 or more letters indicating part of speech. example: hemoglobin\n hemogram\n hemoid\a hemolysin\n hemolysis\n hemolytic\a hemophile\na hemophiliac\n hemoglobin noun, hemoid adjective, , hemophile can used noun or adjective. i have created dict file pairs word letters indicating part of speech using following code: mm = open("mobypos.txt").readlines() pairs = [] x in mm: pairs.append(x.split("\\")) posdict = dict(pairs) this works successfully. want generate lists called nouns , verbs , adjectives , etc contain words of part of speech. fastest way this, given len(posdict.keys()) returns 233340 you can use list comprehension nouns = [word, type in posdict.iteritems() if 'n' in type] adjs = [word, type in posdict.iteritems() if 'a' in type] verbs = [word, type in posdict.iteritems() if 'v' in type] the use of in operator in if clause place words multiple types accordingly

mathematics - Variation of 100 Gold Coins Puzzle - Puzzling Stack Exchange

this question has answer here: cards in darkness 5 answers you blindfolded (and can’t see thing). there $100$ coins lying on table. of these coins, $80$ tails-up , $20$ heads-up. need divide them 2 groups of $x$ , $y$ each (with $x+y = 100$). can pick coin , flip (if tails, become head , if head, become tail), can't see don't know coin flipping. in end, both groups should contain equal number of heads. the trick simple: when dividing, make first pile big number of heads-up coins, i.e. 20. first pile contains unkown number of heads-up coins, call number n. second pile of 80 coins contains remaining 20-n heads-up coins. flip coins in first pile , both piles contain 20-n heads-up coins, regardless of value of n.

html - Clear absolute floated elements -

i try make hover effect. when user hovers 1 div goes in position absolute , changes it's height. here code: @import 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'; .child { position: relative; z-index: 2; width: 100%; min-height: 48px; } .child:hover { position: absolute; z-index: 3; border: 1px solid #c0c0c0; } .child .sub-child { display: none; } .child:hover .sub-child { display: block; } <div class="container"> <div class="row"> <div class="col-xs-4 col-md-4"> <div class="child"> first <ul class="sub-child"> <li>first</li> <li>second</li> </ul> </div> </div> <div class="col-xs-4 col-md-4">

ios - Monotouch, Trimming Video Fails -

i trying trim video 5 seconds programmatically. here implementation. avassetexportsession exportsession= new avassetexportsession(videoasset,avassetexportsession.presetlowquality.tostring()); int systemversion = convert.toint16(uidevice.currentdevice.systemversion.split('.')[0]); string filename; if (systemversion >= 8) { var documents = nsfilemanager.defaultmanager.geturls(nssearchpathdirectory.documentdirectory, nssearchpathdomain.user)[0].path; filename = path.combine(documents, "trimmed.mov"); } else { var documents = environment.getfolderpath(environment.specialfolder.mydocuments); // ios 7 , earlier filename = path.combine(documents, "trimmed.mov"); } outputurl=new nsurl(filename); exportsession.outputurl = outputurl; cmtime start = new cmtime((long)

javascript - Grails using submittoremote and onsuccess -

i can't make onsuccess event works... try use data rendered controller doesn't work. my gsp code: <g:submittoremote name="supprimerusr" url="[controller:'user',action:'presupprimeruser']" class="submit" value="${g.message(code: 'liste.user.bouton.supprimer.label')}" update="messageinfoerro" onsuccess="confirmersuppruser(data);"/> here method in controller "presupprimeruser": def presupprimeruser () { ... render(status: 200, text: 'haha') ... } javascript method "confirmersuppruser": function confirmersuppruser(data) { alert('confirm normal'); alert(data.text + 'haha '+ data.status); } whatever try doesn't work, have text render in controller, prints "undefined". how can make work ? didn't find many documentation it. thank you

c# - LINQ to Entity Query - duplicates in a group -

folks, i need linq entity query. i have following table holds list of shifts , user assigned each of shifts below: shiftid | startdatetime | enddatetime | assigneduserid | what trying pull out shiftid shifts have been assigned user on same date , time. should not happen person cannot in 2 places @ once...(this 1 has been sorted...now) we have instances in our database same user has been assigned work on 2 different shifts on same date , time. e.g. 56 | 06/08/2015 13:00:00 | 06/08/2015 17:00:00 | 22 64 | 06/08/2015 13:00:00 | 06/08/2015 17:00:00 | 22 hope can this, start pull out users have been assigned shifts on same start date ? public ilist<shiftdate> getduplicateshifts() { return _uow.shiftdate.get() .tolist(); } update ok, im getting there, able pull out groups of users user on 2 dates on same day, code below works: public ilist<shiftdate> getduplicateshiftsbyorg(int orgid) { ilist<shiftdate>

java - Spring integration and changing data routes -

i'm reading through spring integration documentation , still can't 1 thing: spring resolve dependencies , make automagic ioc dependency injection @ compile time or @ runtime? i believed runtime job wire available components in data route gateway data endpoint (e.g. db). since of examples made using dsl syntax in java, seems it's compile time job. so, glueing beans in data highway can made @ compile time? summing comments here : 1) spring ioc container manages beans creation till destruction. means beans ready in sort of bucket, ready use application. thus, necessary create contents of bucket @ compile time, rather runtime. not include hot-swapping of beans.. hope looking for. 2) can create many routes want, beans put in container.... , far understand, cannot change source code , synchronize running one, have atleast graceful restart. there bottom line this, spring must see if beans autowired, no circular dependencies, , there no expectation of source c

swift - Using unowned reference in a closure -

the swift programming language documentation states: define capture in closure unowned reference when closure , instance captures refer each other, , deallocated @ same time. so scenario come mind one: class classwithclosure { lazy var someclosure: () -> string = { [unowned self] in self.mymethod() } func mymethod(){ } } are there more scenarios closure , instance deallocated @ same time? anytime classwithclosure instance's reference count hits 0, instance deallocated. since instance getting deallocated, properties deallocated well. anytime classwithclosure instance deallocated, closure deallocated well. can't tell same other way around. mean if set someclosure nil, won't cause deallocation of classwithclosure instance.