Posts

Showing posts from March, 2012

swing - Is it possible to know whether the copied content in clipboard is mp3 file using awt.Toolkit and Clipboard in java -

i trying write code runs @ background , monitors copy actions copying .mp3 file or folder containing .mp3 file { clipboard cb = toolkit.getdefaulttoolkit().getsystemclipboard(); if (cb.isdataflavoravailable(dataflavor.javafilelistflavor)) { try { string name = ""+cb.getdata(dataflavor.javafilelistflavor); boolean found = false; if (name.tolowercase().endswith(".mp3]")) { system.out.println("is mp3"); found = true; } if (!found) { system.out.println("is not mp3"); } } catch(unsupportedflavorexception ex) { ex.printstacktrace(); } catch(ioexception ex) { ...

ios - In AVAudioplayer multiple songs play at once.how to fix single song play at a time -

i trying create avaudioplayer programatically.the audio player playing.but have issues.i displaying 12 audio items in uitableview.if click first item should navigate audio player view controller.and click play button song play.if click button song play continuously.but if click again same item audio view controller view display initial state progress bar should not move , current time , song duration empty.but song play continuously. , issue there. if click first item corresponding song play.i should not click pass button.i click button , click second item.if click second item audio view controller display.i click play button song display.in background first song play , second song play.this second issue.how solve these 2 issues.please me body. -(void)playorpausebuttonpressed:(id)sender { if(playing==no) { [playbutton setbackgroundimage:[uiimage imagenamed:@"pause.png"] forstate:uicontrolstatenormal]; // here pause.png image showing pause button...

javascript - replacing old canvas with new one with scaled image -

i have canvas loaded image on top of it. canvas has static widkth , height (800x600). image can smaller or larger. if image smaller size of canvas, placed on middle using following code x = (canvas.width - image.width)/2; y = (canvas.height - image.height) / 2; ctx.drawimage(image, x, y) i want replace old canvas new 1 has image scaled accoring ratio. code following(for testing purposes render image on top left corner of canvas, not yet implemented exact position) oldcanvas = document.getelementbyid('mycanvas'); newcanvas = document.createelement('canvas'); ctx = newcanvas.getcontext('2d'); x = y = 0; newimagewidth = image.width * 2; newimageheight = image.height * 2; ctx.drawimage(oldcanvas, x, y, newimagewidth, newimageheight); oldcanvas.parentnode.replacechild(newcanvas, oldcanvas) but canvas stays same old. tried doing same witout scaling image changing size of newcanvas , worked.what doing wrong in here? edit: works if chnage drawimage origina...

kotlin auto documentation tools -

hasn't found kotlin auto documentation tools. doxygen kotlin. , there no kotlin own auto documentation understand. so, if such tools exists, please let know. actually, right kotlin team uses dokka (beta) official documentation https://github.com/kotlin/dokka the documentation language write within code comments k-doc: https://kotlinlang.org/docs/reference/kotlin-doc.html it generates beautiful layouts in web ( http://kotlinlang.org/api/latest/jvm/stdlib/index.html ) or pdf ( http://kotlinlang.org/docs/kotlin-docs.pdf )

c# - Mock HttpContext using moq for unit test -

this question has answer here: how mock httpcontext in asp.net mvc using moq? 5 answers i need mock of httpcontext unit testing. i'm struggling it. i'm making method change sessionid programmatically sessionidmanager. , sessionidmanager requires httpcontext not httpcontextbase. but couldn't find example make mock of httpcontext. examples out there make httpcontextbase. i tried below didn't work httpcontext httpcontext = mock<httpcontext>(); httpcontext httpcontext = (httpcontext)getmockhttpcontextbase(); public httpcontextbase getmockhttpcontextbase() { var context = new mock<httpcontextbase>(); var request = new mock<httprequestbase>(); var response = new mock<httpresponsebase>(); var session = new mock<httpsessionstatebase>(); var application = new mock<httpapplication>(); var httpcontex...

xml - Deserialize from WebServices C# -

Image
here's issue : need list of resources web services, , deserialize object. doesn't work, despite facts code worked xml file. can't figure why doesn't work, , i'm stuck ! here's xml : <resourcedataset xmlns="http://schemas.microsoft.com/office/project/server/webservices/resourcedataset/"> <resources> <res_uid>blabla</res_uid> <res_name>blabla</res_name> <res_code>blabla</res_code> <res_group>blabla</res_group> <res_cost_center>blabla</res_cost_center> </resources> <resources> <res_uid>blabla</res_uid> <res_name>blabla</res_name> <res_code>blabla</res_code> <res_group>blabla</res_group> <res_cost_center>blabla</res_cost_center> </resources> <resources> <res_uid>blabla</res_uid> <res_name>blabla</res_name> <res_code>blabla</res_code> ...

javascript - How to clear value from magic suggest -

how clear input value magic suggest. while selecting value select box, based on select box selection magic suggest value need clear or magic suggest need initialise again removefromselection(object / array[object], issilent:boolean) remove 1 or multiples json items current selection. set issilent true prevent event trigger.

version control - Does SVN keep changes locally on your hard disk -

say, if don't have internet connection, , want see previous version, possible svn. in other words, save differences locally on machine. subversion keeps pristine copy of "base" (i.e. latest version checked out or updated to) in .svn folder @ root of working copy. this means can find out files have been modified in local working copy svn status , see modifications svn diff without connection server. can svn revert things base revision. however, cannot examine changes made particular commit unless have connection repository.

.net - I need to store '/' separated strings in a tree-like structure in C#, how should I do it? -

i trying store parts of long string in efficient tree-like structure, have searched of implementations searching within words... let me try explain mean example, if have: /potato/carrot/tomato /potato/carrot/pea /potato/lettuce my initial thoughts should this potato - carrot -tomato -pea - lettuce and far have searched, efficient search trees (such dawg , tries) storing words characters , not sure how should go it. ideas? thanks lot in advance! edit: far persistence concerned, don't need store tree thought of keeping in memory long program running. edit2: far storing of children concerned, ended using hybriddictionaries , more efficient dictionaries , works pretty fast now, lot guys! to keep in memory, might use pattern encountered: class vegetable : dictionary<string, list<vegetable>> depending on want (search, count, sort) can implement helper methods inside class.

HTML5 increase youtube speed 2x from url? -

i know how speed youtube video 2x without user clicking on html5 (of video), instead modifying url. for example, know how watch video starting @ specific time appending url parameter &t=1m1s (for 1 minute , 1 second). is possible use similar method speed video 2x? what parameters should add url watch video in double speed (i'm using html5)? there's no way change playback speed url arguments. anyway, if you're working html, can take advantage of youtube player iframe api. here's how configure player javascript: https://developers.google.com/youtube/iframe_api_reference#getting_started and here's function you're looking set playback speed: https://developers.google.com/youtube/iframe_api_reference#playback_rate so can edit onplayerready function this: function onplayerready(event) { player.setplaybackrate(2); // you're looking event.target.playvideo(); } you can of course pass on step 5 of documentation stop video playing ...

angularjs - Injecting an annotated Service in a Provider in Angular -

i use service in provider. i'm not sure it's right way go. i've managed instantiate service in provider, injecting service provider instead, , calling .$get() method. if service requires dependencies, gets harder. keeps working if dependencies inferred: call .$get(), returns correct function , dependencies right. but if try dependency annotation, it's way work through minification, $get() returns annotation array defined it. thought use injector.$invoke(),but seems cannot resolve dependencies anymore. i created plunker here: http://plnkr.co/edit/tplf3vqumwght46q3aaa?p=preview things tricky @ line 90, , line 112 problem lies.

Bootstrap 3.1 gradient less mixin error on IE8 and 9 -

i have problem gradient mixin ie8 , 9 browsers because gradient mixin seems have little bug because hexa code gradien has many characters resulted bootstrap mixin. if encountred problem , solved please share. less mixin bootstrap: .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) { background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // safari 5.1-6, chrome 10+ background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // standard, ie10, firefox 16+, opera 12.10+, safari 7+, chrome 26+ background-repeat: repeat-x; filter: e(%("progid:dximagetransform.microsoft.gradient(startcolorstr='%d', endcolorstr='%d', gradienttype=0)",argb(@start-color),argb(@end-color))); // ie9 , down } variables: @table-header1: rgba(155,214,45,0.65); @table-header2: rgba(123,192,67,0.99); less: .table { thead tr { fon...

MongoDB get last 10 activities -

in social network want feed member a , member a following lets 20 category/member . when category/member( followed member a ) activity inserted collection called recent_activity : { "content_id": "6", // content id member following "content_type_id": "6",// content type (category , other member) "social_network_id": "2", // action category did (add/like/follow) "member_id": "51758", //member "date_added": isodate("2014-03-23t11:37:03.0z"), "platform_id": numberint(2), "_id": objectid("532ec75f6b1f76fa2d8b457b"), "_type": { "0": "altibbi_mongo_recentactivity" } } i want when member a login system last 10 activities categories/member my problem : how 10 activities categories/members . it better in 1 query or loop. for use case, i'd suggest invert logic , keep separa...

Do not match word boundary beetwen parenthesis with python regex -

i have: regex = r'\bon the\b' but need regex match if keyword (actually "on the") not between parentheses in text: should match: john on beach let me put on fridge (my son) on beach arnold on road (to home) should not match: (my son )on beach john @ beach bob @ pool (berkeley) spon (is on table) i don't think regex here general case. examples, regex work want to: ((?<=[^\(\)].{3})\bon the\b(?=.{3}[^\(\)]) description: (?<=[^\(\)].{3}) positive lookbehind - assert regex below can matched [^\(\)] match single character not present in list below \( matches character ( literally \) matches character ) literally .{3} matches character (except newline) quantifier: 3 times \b assert position @ word boundary (^\w|\w$|\w\w|\w\w) on matches characters on literally (case sensitive) \b assert position @ word boundary (^\w|\w$|\w\w|\w\w) (?=.{3}[^\(\)]) positive lookahead - assert regex bel...

scala - Checking on a property of a collection of case-class instances -

consider simple case-class "card" 2 properties ("number" , "color") this: case class card(number: int, color: string) consider sequence of cards one: val cards = seq( card(5, "red"), card(7, "red"), card(3, "black")) now suppose wanted solve these problems in scala-idiomatic way (functionally oriented?): find if cards have same color find if cards have same number find if cards in ascending order concretely, have implement these functions: // cards have same color? def havesamecolor(cards: seq[card], ifempty: boolean = true): boolean = { ??? } // cards have same number? def havesamenumber(cards: seq[card], ifempty: boolean = true): boolean = { ??? } // cards ordered ascendingly? def areascending(cards: seq[card], ifempty: boolean = true): boolean = { ??? } what possible / best approaches? looping, recursing, folding, reducing? forall short-quits met first false def havesamecolo...

Git branch description -

i set simple description local branch , i'd see it. how 1 can see description branch set issuing git branch --edit-description ? the description used request-pull (as stated in man-page). has been discussed here .

Getting modulo of bytes-number in Python -

when working in python, let's have long bytes object. want modulo number. example, have bytes object b'hi' , want modulo 3, result 26729 % 3 == 2 . (the bytes object seen 1 big number.) how do in python? (preferably python 3.) i'm hoping there's relatively elegant way don't have manually compute number. >>> int.from_bytes(b'hi', 'big', signed=false) % 3 2

Filter html content with Spring and Thymeleaf -

how can filter html content according authentication status using spring boot spring security , thymeleaf? note: i'm using spring boot auto-configuration. what want can achieved using thymeleaf's spring security integration (check out link if haven't integrated two). for example following: <div sec:authorize="hasrole('role_admin')"> content shown administrators. </div> <div sec:authorize="hasrole('role_user')"> content shown users. </div>

Knuth Morris Pratt algorithm comparison -

i have been studying exams when came across problem, guys please for alignment of pattern p , text t, suppose mismatch occurs @ p[i+1] , t[k] during execution of kmp algorithm how many times t[k] come comparison in total during execution of kmp algorithm (spi non-optimized) the possible solutions came across are i-spi spi+1 n-i n-spi but of them fail on scenarios, there no single answer cases. still can give upper bound on number of comparisons , found if symbols in p same. try , compute that. if not enough try using property: kmp compare t[k] against p[sp i ] , against p[sp sp i +1 ] , on until 1 of 2 options happens: the given letter matches t[k] the value of given sp 0 the 2 above may happen in many different ways depending on p , t , impossible give closed formula.

vb.net - Ctrl + Shift + H cannot be detected using Me.KeyDown -

the code, not react during ctrl + shift + h pressed : private sub hidemode(byval sendeer system.object, byval e keyeventargs) handles me.keydown select case cint(e.keycode) case keys.controlkey if e.shift andalso e.keyvalue = convert.toint32(convert.tochar(keys.h)) msgbox("test hide function") end if end select end sub the expected result that, after pressing ctrl + shift + h msgbox show text "test hide function" what's error in here? i don't underdstand why try convert keycode integer when same work done using keys enum select case e.keycode case keys.h if (e.control andalso e.shift) msgbox("test hide function") end if end select edit well, webbrowser control different beast. need add specific keydown handler (in addition other 1 handles keydown when focus on other controls) private sub browser_previewkeydown(byval sender syst...

javascript - d3.js issues. Appending div -

i have application, should build graphics according values database. should use d3.js use this guide . code of example works fine. here is: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>d3 demo: 5 divs data</title> <script type="text/javascript" src="../d3/d3.v3.min.js"></script> <style type="text/css"> div.bar { display: inline-block; width: 20px; height: 75px; /* gets overriden d3-assigned height below */ background-color: teal; } </style> </head> <body> <script type="text/javascript"> var dataset = [ 5, 10, 15, 20, 25 ]; d3.select("body").selectall("div") .data(dataset) .enter() ...

Rename a lot of files in subdirectories with multiple file extenisons -

so have big folder full of more folders hold files have regular extension, ,v after (like .xml,v) is there quick way/program make go through of folders , when finds ,v it'll remove ,v it? thanks edit: running windows 7 (64-bit). please remember idiot :p use find list files ending ,v . pipe output shell loop renames files. ${f%%,v} matches file name without ,v suffix. find . -name \*,v | while read f; mv $f ${f%%,v} ;done

asp.net - Is it right to use nested master pages in this case? -

i'm making website has different panels various users. these panels have menu items different depending on user logged on, except 1 item available in every panel every user. , page linked item identical every user. now question how can make page appear every user while other menu items shown along fixed menu item @ same time ?! i used nested master pages, i'm stuck somehow ! in parent master page, placed fixed menu item , in child master placed rest of menu items each panel. have 1 parent master page , several child master pages each containing user's required menu items. and "i'm stuck" part! don't know how make page going linked fixed menu item! since should available every user ..., if make content pages child masters have make page several times .... i don't know whether made myself clear. if there ambiguity, please ask!

html - How to pass selected div tag id values to single textbox separated by comma using javascript -

javascript: function sample(c_id) { document.getelementbyid("result").value=""; var x = document.getelementbyid("result").value=c_id; } html: <div id="1" onclick="sample(this.id)">one</div> <div id="2" onclick="sample(this.id)">two</div> <input type="text" value="" id="result"> please me... you'll need keep array of values have been added input. when toggle each number, can have removed array splice() or added array push() . need join values comma, , apply value of input : var taken = []; function sample(c_id) { var inp = document.getelementbyid("result"); var ind = taken.indexof(c_id); if(ind > -1){ taken.splice(ind,1); taken = taken; } else { taken.push(c_id); } inp.value = taken.join(','); } jsfiddle note: invalid start id s number. should sta...

ruby - Rails - Sharing DB and Models -

i building series of rails applications different use cases, using same database schema. migrations , models created in main app. common approach in rails reuse models in other apps in order not duplicate code? what you're looking called multitenancy . explanation , numerous ways of implementation aren't suited short answer, since there many different use cases. there many guides show how this, though, , i've listed couple starting points below. railscast - multitenancy postgresql railscast - multitenancy scopes slideshow - multitenancy rails book - multitenancy rails alternatively, acts tenant gem attempt abstract pain away (mostly).

android - Play youtube video in video player -

i want play video youtube in app. dont want use youtube application that. prefer native videoplayer. have written below code that. nothing happening. black screen displaying. string link= getintent().getextras().get("url").tostring(); videoview videoview = (videoview) findviewbyid(r.id.videoplayer); mediacontroller mediacontroller = new mediacontroller(this); mediacontroller.setanchorview(videoview); uri video = uri.parse(link); videoview.setmediacontroller(mediacontroller); videoview.setvideouri(video); videoview.start(); please me. in advance. just hope it's work: string link= getintent().getextras().getstring("url"); videoview videoview = (videoview) findviewbyid(r.id.videoplayer); uri video = uri.parse(link); videoview.setvideouri(video); videoview.start();

python - Tkinter calculator error above my ability to fix -

so im trying learn tkinter in python , found code online didn't work ive been messing around it, changing layout , on, cant make math or clear button work, if tell me why , how fix it, grateful. #import tkinter tkinter import * root = tk() root.title("calculator") entrybox = entry(root) #set coordinates entry box(columnspan large way fit "7" in corner) entrybox.grid(row=1, column=0, columnspan=42) #defines button def inputzero(): old_value = entrybox.get() new_value = old_value + "0" entrybox.delete(0, end) entrybox.insert(0, new_value) #defines button , how looks 1 = button (root, text="0", command = inputzero, width = 3) one.grid (row = 9, column = 0,) def inputone(): old_value = entrybox.get() new_value = old_value + "1" entrybox.delete(0, end) entrybox.insert(0, new_value) 1 = button (root, text="1", command = inputone, width = 3) one.grid (row = 8, column = 0, columnspan=1) ...

android - Fragment Getting Method from Another Class -

i have android app uses fragments. i'm following tutorial ( calllogs tutorial ) calls history. i have class made tutorial in link want data class , use in 1 of fragments. i've tried following; int callsmade = new getusage().getcalldetails(); string callsmade = string.valueof(callsmade); log.e("calls made:", "texts: " + callsmade); but keep getting error on "cursor managedcursor" line (nb: i've changed managedcursor getcontentresolver since managedcursor deprecated , error too) is there i'm doing wrong here? anthing ye can think of can change? thanks alot can provide. edit: code getcalldetails(); public int getcalldetails() { stringbuffer sb = new stringbuffer(); cursor callscursor = getcontentresolver().query( calllog.calls.content_uri,null, null,null, calllog.calls.date + " desc"); //cursor plancursor=planshelper.query("plans", null, null, null, null); int name = callsc...

android - Why does order of declaration matter for setting up a tab host? -

i setting tab host application , noticed order in declare each tab matters. when set this, application quits unexpectedly, before reaching activity: tabspec spec1 = th.newtabspec("tag1"); tabspec spec2 = th.newtabspec("tag2"); tabspec spec3 = th.newtabspec("tag3"); spec1.setcontent(r.id.tab1); spec2.setcontent(r.id.tab2); spec3.setcontent(r.id.tab3); spec1.setindicator("stop watch"); spec2.setindicator("tab 2"); spec3.setindicator("tab 3"); th.addtab(spec1); th.addtab(spec2); th.addtab(spec3); when set this, application works fine: tabspec spec1 = th.newtabspec("tag1"); spec1.setcontent(r.id.tab1); spec1.setindicator("stopwatch"); th.addtab(spec1); tabspec spec2 = th.newtabspec("tag2"); spec2.setcontent(r.id.tab2); spec2.setindicator("tab 2"); th.addtab(spec2); tabspec spec3 = th.newtabspec...

excel - Drop down list that covers two correspoding columns -

Image
i creating calcuation worksheet pricing construction materials, need easy use, quick , accurate. can drop down list (let list in cell a1) choose range of values in column c10-b200, bring in equivalent value range d10-b200. ie, if user chooses "c17" list in cell a1, want cell b1 automatically contain value "d17". do use if function, or can list span 2 columns? have used data validation create 'materials' drop down list, need include 'price', if see mean. any appreciated, euan you can try this. put formula in adjacent cell. =if(b3<>"";index(g3:g12;match(b3;f3:f12);0);"") where b3 contains dropdown (validation list =f3:f12) c3 contains formula given above f3:f12 contains texts displayed in dropdown g3:g12 contains values display in second cell

android - Return response data from a web service using java -

i building android application need use web service post data , return string. achieve have created asynctask in background. protected string doinbackground(void... params) { url posturl; try { posturl = new url("http://192.168.2.102/rest%20service/index.php"); } catch (malformedurlexception e) { throw new illegalargumentexception("invalid url"); } string body = "mdxemail=" + email + "&mdxpassword="+ password; byte[] bytes = body.getbytes(); string response = null; httpurlconnection conn = null; try { conn = (httpurlconnection) posturl.openconnection(); conn.setdooutput(true); conn.setusecaches(false); conn.setfixedlengthstreamingmode(bytes.length); conn.setrequestmethod("post"); conn.setrequ...

java - Rounding Bigdecimal values with 2 Decimal Places -

i want function convert bigdecimal 10.12 10.12345 , 10.13 10.12556 . no function satisfying both conversion in same time.please achieve this. below tried. bigdecimal = new bigdecimal("10.12345"); a.setscale(2, bigdecimal.round_up) a.setscale(2, bigdecimal.round_ceiling) a.setscale(2, bigdecimal.round_down) a.setscale(2, bigdecimal.round_floor) a.setscale(2, bigdecimal.round_half_down) a.setscale(2, bigdecimal.round_half_even) a.setscale(2, bigdecimal.round_half_up) output : 10.12345::10.13 10.12345::10.13 10.12345::10.12 10.12345::10.12 10.12345::10.12 10.12345::10.12 10.12345::10.12 bigdecimal b = new bigdecimal("10.12556"); b.setscale(2, bigdecimal.round_up) b.setscale(2, bigdecimal.round_ceiling) b.setscale(2, bigdecimal.round_down) b.setscale(2, bigdecimal.round_floor) b.setscale(2, bigdecimal.round_half_down) b.setscale(2, bigdecimal.round_half_even) b.setscale(2, bigdecimal.round_half_up) output : 10.12556::10.13 10.12556::10.13 10.12556:...

javascript .click() method not work on android in some cases -

html code of link : <a href="#" id="10" target="_blank"> codes here... </a> the code call in application : webview.loadurl("javascript:(function(){document.getelementbyid('10').click();})()"); but no results... i've enabled javascript webview before , works... , i've tested .click() method other elements on other web pages , works correctly. what should make webview click on link... ? me please; thank ! edit : perhaps it's because of numeric start of id name of these elements, can use them using id or tag name on google chrome console on windows without problem... it's not possible use them using tag name, even, click on, on android webview ! edit 2 : problem isn't numeric start of 'id's in fact ! i've found out click function doesn't work other ids without numerics in page i'm using only... , can't understand why !!! i've tried ...

gimp - Automating Brush Insertion -

very new gimp , unfortunately in need of producing output :) i looking automate repetitive task of placing instances of existing brushes in image. can point me in direction of command might use achieve this, or tell me if possible gimp scripting? many thanks yes, if question mean "stamp" each brush in imagem possible via scriptting. i'd recomend setting python - not little bit complicated because yu willhave deal with things image width, , such in order fit brushes - should less 30 lines of code. it can done interactively filters->python-fu->console - there can make pdb calls - press "browse" button check available. you can do, example, create new image in gimp, open python console, , paste code it: img = gimp.image_list()[0] size = 30 brush_list = pdb.gimp_brushes_get_list(none)[1] x, y = 0,0 pdb.gimp_context_set_brush_size(size) brush in brush_list: pdb.gimp_context_set_brush(brush) pdb.gimp_paintbrush_default(img.l...

oracle - Enity and stored procedure mapping with different data types -

i have created mapping between stored procedure , entity table. possible define conversion during mapping? for example: 1 of entity column datetime , store procedure take column text. i know can update stored procedure have datetime parameter, consider cannot update stored procedure. using ef5 oracle odp.net can edit entity? if can map private string property db , not map datetime property. datetime property's getter string property , convert datetime , setter convert datetime string , set private string prop. this article shows mapping private properties.

c++ - Need Windows XP alternative to GetNamedPipeClientProcessId -

the code below working superbly, want generalize it, getnamedpipeclientprocessid compatible windows vista , above. what alternative options have support windows xp? bret = getnamedpipeclientprocessid(hin, &clientid); if (false == bret) { printf("\ngetnamedpipeclientprocessid failed\n"); closehandle(overlapped.hevent); closehandle(hin); return 1; } if handle protocol, when connection established send packet process id , read in other endpoint.

How to Integrate TinyMCE editor with php -

how integrate tinymce editor php? have downloaded editor , put in js folder in root directory. have following implementation in code. <script type="text/javascript" src="js/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", themes: "modern", plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste moxiemanager" ], toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" }); </script> and here's text box area is: <textarea name="pagebody" id="pagebody" rows="4">...

python - merge all keys of dictionary of dictionary and create new dictionary -

i having 1 dictionary { "a": "b", "c": { "d": "e", "f": { "g": "h", "i": "j" } } } i want output like: { "a": "b", "c.d": "e", "c.f.g": "h", "c.f.i": "j" } i tried solve >>> def handle(inp): out = {} in inp: if type(inp[i]) dict: jj in inp[i].keys(): out[i+'.'+jj] = inp[i][jj] else: out[i] = inp[i] return out >>> handle(inp) {'a': 'b', 'c.f': {'i': 'j', 'g': 'h'}, 'c.d': 'e'} but not able solve . you need recursively each dictionary. this works. >>> >>> def handle(inp): ... out = {} ... in inp: ... if type(inp[i]) dic...

c++ - Using printf() changes multithreaded outcome? -

i'm writing multithreaded program run modified bubble sort class project. basically, each thread bubble sorts segment of array of integers, , each segment shares 1 element neighboring segments in order values flow between them. currently, using pthread_mutex_t s around critical sections; must have wrong, because finishes sorted, finishes not sorted, , program hangs. here's problem : if use printf() s see in each thread, it's virtually guaranteed not hang (which makes difficult figure out it's getting hung up). why using printf() s in sections of code run each thread seem prevent hanging , cause program finish? edit : determined main cause of issue had not initialized mutexes (with pthread_mutex_init() ). chrk correct using improper synchronization, , printf() usage slowed things down enough make things working. i can't sure this, obviously, saying guess: theoritically, printf(3) uses system call write(2) stdout , i/o procedure, slower rest pa...

java - Getting Transport error in apache axis2 client -

in project trying create rest client on apache axis 1.62 , working before on ssl . due server configuration change , proxy has been added when tried access webservice following error org.apache.axis2.axisfault: transport error: 403 error: portcullisnomatch @ org.apache.axis2.transport.http.httpsender.handleresponse(httpsender.java:310) @ org.apache.axis2.transport.http.httpsender.sendviapost(httpsender.java:194) @ org.apache.axis2.transport.http.httpsender.send(httpsender.java:75) @ org.apache.axis2.transport.http.commonshttptransportsender.writemessagewithcommons(commonshttptransportsender.java:404) @ org.apache.axis2.transport.http.commonshttptransportsender.invoke(commonshttptransportsender.java:231) @ org.apache.axis2.engine.axisengine.send(axisengine.java:443) @ org.apache.axis2.description.outinaxisoperationclient.send(outinaxisoperation.java:406) @ org.apache.a...

c# - Read the column value extract the substring and over write the substring value -

i copying data 1 excel sheet compare. need date in columns date plus time present. write code iterate through column fetch substring , write . tried code int ncolumns = ws2.usedrange.columns.count; int nrows = ws2.usedrange.rows.count; (int = 3; < nrows; i++) { (int j = 2; j < ncolumns; j++) { string order_date = ws2.columns[i, "a" + j]; string order_date_2 = order_date.substring(9); ws2.columns[i, "a2"] = order_date_2; } }

php - Apprequest: get all people that invited specific users / getting user_id of user who opens notification -

i have made referral system, user can invite friend app. i'd see user opens notification on facebook. possible? way, can figure out have invited user, , let him know "xxx other friends have invited him" the url on facebook is: fb_source=notification&request_ids=the_request_id&ref=notif&app_request_type=user_to_user&notif_t=app_request i know can request_id, way, know 1 user have invited, , not others.

Measure dB with AVAudioRecorder is limited to 96dB on iOS -

i'm trying build db measurement unlock feature within app. feature should become available once user reaches 100db. current implementation able measure 96db. understand problem somehow related bitrate recording: 16bit capable of 96db, 24bit should capable of 144db ( http://www.head-fi.org/t/415361/24bit-vs-16bit-the-myth-exploded ). the db measurement , calculations work fine, issue can not measure more 96db. i'm struggeling settings achieve higher bit rate, guess i'm doing wrong here. my current initialisation of recorder looks this: nsdictionary *settings = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithfloat: 44100.0], avsampleratekey, [nsnumber numberwithint: kaudioformatappleima4], avformatidkey, [nsnumber numberwithint: 1], avnumberofchannelskey, //[nsnumber numberwithint: 24], avencode...

c# - understanding the logic behind swapping ranges of bits -

hello need little understanding logic behind swapping ranges of bits algorithm. "program" swaps given number of consecutive bits in given positions , works , need understand logic behind in order move on other topics. here source code full "program" http://pastebin.com/ihvpsee1 , need tell me if on right track far , clarify 1 part of code find difficult understand. temp = ((number >> firstposition) ^ (number >> secondposition)) & ((1u << numberofbits) - 1); result = number ^ ((temp << firstposition) | (temp << secondposition)); (number >> firstpostion) move binary representation of given uint number(5351) right(>>) 3 times (firstposition). 00000000 00000000 00010100 11100111 (5351) becomes 00000000 00000000 00000001 01001110 , because understanding when shift bits loose digits falls out of range.is correct? or bits right side appear on left side? (number >> secondposition) apply same logic .1 , in cas...

android - my app with broadcast receiver and wifi -

i, firt app android , i'm trying comunicate hardware because me it's exciting! when disable wifi or change network.... need make toast , vibrate. what's wrong??? i test app galaxy s2 4.1.2 want app able run on old phones android 2.3.3. androidmanifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="dado.wifibc" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.access_wifi_state"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.change_network_state"/> <uses-permission android:name="android.permission.change_wifi_state"/> <uses-permission android:name="android.permission.vibrate"/...

repository - How to fetch artifacts from own repo using maven? -

how create simple project fetches artifacts repo using maven? , these artifacts saved - default maven repo? i using apache archiva. just start using repository manager nexus , that's it. please configure settings.xml file according following: <settings> <mirrors> <mirror> <!--this sends else /public --> <id>nexus</id> <mirrorof>*</mirrorof> <url>url of archiva server</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <!--enable snapshots built in central repo direct --> <!--all requests nexus via mirror --> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled>...

excel vba - By Reg Argument Type Mismatch, Where is it -

i created function demsontration purposes. believe represents problem facing. function dostuff(thedates date, thevalues double) dim themaxval double dim themaxdate date themaxval = worksheetfunction.max(thevalues) themaxdate = worksheetfunction.max(thedates) dostuff = array(themaxval, themaxdate) end function then run sub use function : sub test3() sheet1 dim numdates integer numdates = range(.range("e2"), .range("e2").end(xldown)).cells.count dim thedates() date redim thedates(numdates - 1) dim thevalues() double redim thevalues(numdates - 1) = lbound(thedates) ubound(thedates) thedates(i) = .range("e2").offset(i, 0).value thevalues(i) = .range("e2").offset(i, 1).value next dim ddvector() variant ddvector = dostuff(thedates, thevalues) end end sub basically, collect dates , values out of spread sheet , 2 arrays pass function "do suff" error of "byref argument type mismatch"k thedates. isn...

accessibility - Separate tabIndex order for Accessiblity using ARIA in HTML5 -

any way provide separate tabindex order accessible elements in html5 using wai-aria? usecase: lets take case multiple choice question rendered in html. can have question text, radio buttons labels, , submit button. here radio buttons , submit button should tabbable. whereas 3 components should accessible screen readers. question text should read before radio button labels read. as example, please check question in following link http://www.html5tests.com/tests/intro/intro-00.php how should use aria in such case. the using wai-aria in html spec provides practical guides using aria. written on spec the first rule of aria use is: if can use native html element [html5] or attribute semantics , behaviour require built in, instead of re-purposing element , adding aria role, state or property make accessible, so. in case, <fieldset> html element has requirements built-in use <fieldset> rather using else , re-purposing aria. here example implementat...

ios - UILabel In UICollectionViewCell is setting after scrolling? -

in code,i trying use uiimage & uiabel in uicollectionviewcell .what doing if there no image in uicollectionviewcell want shift uilabel upwards.so used 2 frames of label , checked if(uiimageview.image==nil) showing effect after scrolling? do? here code did- -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell *mycell=(uicollectionviewcell*)[self.view viewwithtag:1]; mycell = [collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; uilabel *label=(uilabel*)[mycell viewwithtag:12]; uiimageview *collectionviewimage=(uiimageview*)[mycell viewwithtag:11]; nsstring *collectionviewimagename=[imagescollectionviewarray objectatindex:indexpath.row]; collectionviewimage.image=[uiimage imagenamed:collectionviewimagename]; if (collectionviewimage.image==nil) { [collectionviewimage set...

ios - Opaque UIView not letting me scroll UIView behind it -

i have view hierarchy looks this. buttonsview <-- uiview 1-3 small buttons mkmapview <-- bottom view when buttonsview shown still want user able scroll mkmapview if user not touching of buttons. i have tried different combinations of userinteractionenabled = no nothing helps. you have several ways solve this: the top view 3 small buttons can smaller , covers area 3 small buttons need. this, top view won't cover map view, , can still scroll around. implement own hittest / pointinside functions let top view decide whether wants catch event (when tap on 1 of buttons) or decides send event further responder chain (when user taps else). see example here possible ways it: allowing interaction uiview under uiview

javascript - Hide Navigation in Lightbox -

i'm messing around lightbox jquery plugin i've little knowledge of jquery / javascript . i when image shown *data-id="0"* , prev button hidden. something showing / hiding class ok also. may know correct way achieve objective? this full plugin code: (function($, undefined) { $.fn.maxgallery = function(options) { var defaults = {}, $this = $(this); options = $.extend({}, defaults, options); //?????? ??? ???????? var length = $('.gallery').find('a').length; var href, arrofimgs = []; (var = 0; i<length; i++) { href = $('.gallery') .find('a') .eq(i) .attr('href'); arrofimgs.push(href); } $(document) .on('click', '.gallery__item', function(e) { return false; }); var gallery = { id: null, title: '', init: function() { var _this = ...