Posts

Showing posts from March, 2011

php - Progress bar / animated.gif during phpmailer email send -

i created members based website , when post new articles, (similar blog post), use phpmailer send email out members requested email sent them. the email contains new articles content. title, description etc.. i'm in beta testing stage right now, , 3 email accounts takes 9 seconds send out 3 email when make new post. 3 seconds per email. i expect around 100 users on site, = 5 minutes send out emails. question is there way can hook real time progress bar show how time left when sending emails? my setup this: i have form connected action script. <?php include($_server['document_root'] . "/core/init.php"); // new data $title = $_post['title']; $description = $_post['description']; // query $addnotice = db::getinstance()->insert('table1', array( 'title' => $title, 'description' => $description, )); $id = isset($_post['id']); $users = db::geti

Why the length of the encrypted message is changed after downloading this message from file?Python RSA encryption/decryption -

encryption def encrypt(): k=0 l=1 length=len(message)/20 if int(length)>=1: in range(int(length)+1): message1="" if i<int(length)+1: i=k message1="" j in range(20*i,20*(i+1)): message1+=message[j] k=i message1=message1.encode() print(len(message1)) crypto = rsa.encrypt(message1, pubkey) text1.insert(end,crypto) cryptow+=crypto else: message1="" in range(len(message)-int(length)*20): message1+=message[int(length)*20+i] message1=message1.encode() crypto = rsa.encrypt(message1, pubkey) print(type(crypto)) text1.insert(end,crypto) cryptow+=crypto print(len(cryptow)) showinfo("attention!","message encrypted") message=2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71

fixed width html layout on an android smart phone -

Image
i'm trying build simple layout header there's black band full width of screen, inside there's meant logo, little text etc... should contained within fixed width column centered in middle of screen. underneath there's fixed column again centered it's not wrapped in anything. so i've built think should work , looks fine on pc on android smart phone there's weird problem. if make fixed width 1000px wide header develops strange gap on right hand side. can't figure out why. you can see problem here if have smart phone http://liquidlizard.net/narrower.php - click between 2 links. difference in 1 screen fixed width wrapper 1000, other 900px. here's code: <div id="header"> <div class="mainwrapnarrow"> <div class="font16">belfast<span class="strong">development</span></div> </div> </div> <div class="mainwrapnarrow border">

ios - UIButton sending wrong touch up inside event -

i've weird issue have uibutton fires touchupinside event whilst holding button down. happens sporadically, , on couple of devices. not happen on other devices. i subclassed button, , did override sendaction:to:forevent method see if can figure out something. does, gives selector called, , subsequent event ( touchupinside in case) triggered the uicontrol send action event, , has not been help. i have couple of views beneath , animation well. removed everything, still unable figure out what's causing it.

c# - How to store Active Directory user GUID using Entity Framework? -

i have site authenticates using active directory. using entity framework , need store references users. don't want save ad users in database. 1 way store user guid string in entity. class entity { string userguid ; } is possible this: class entity { userprincipal user; } instead of passing string guid pass object , make entity framework treat association if userprincipal object entity. doesn't have class userprincipal, class. deal objects rather strings. querying active directory not problem. in summary, able associate entity non-entity class storing string guid in database loading object. [update] many classes might have multiple associations ad users , can vary base class not solution. example, might have class this: class message { public user sender; public user recipient; public list<user> mentionedusers; } this not class using illustrates point. ideally user guid stored in message entity table loaded user entity framework other

ruby - Improving calculate function where input string does not follow normal computational order -

i working through sample interview questions , came across problem have write calculate function. caveat input string isn't written in computational order - instead numbers first , operators come after. test cases: calculate("2 3 +") # => 5 calculate("12 2 /") #=> 6 calculate("48 4 6 * /") # => 2 def calculate(string) numbers = string.scan(/\d+/) operators = string.scan(/\d\w/).map{|o|o.gsub(" ","")} #todo better regex remove space without having map formatted_string = numbers.inject(""){|string, b| string+"#{b}#{operators.shift}" } eval(formatted_string) end i able come solution, wondering if there more efficient/better way solve problem. don't come programming background not familiar tools/algorithms may help. any feedback appreciated. ooh, fun! syntax called reverse polish notation (rpn), aka "postfix notation" , still used powerful calculators (the

java - WebServiceContext is null in Apache cxf Web services -

i'm trying set context of cxf apache web service using @resource annotation. context comes null. please overcome problem. below webservice i'm trying access messagecontext. @webservice(servicename = "requestmanagerservice", targetnamespace = irmnamespaces.wsdl+irmversions.wsdl_version) @addressing(enabled=true, required=true) public class requestmanager implements irequestmanager{ @resource webservicecontext context; @webmethod(action = irmnamespaces.wsdl+irmversions.wsdl_version+"/requestmanagerservice/subscriberstatechangerequest", operationname = "subscriberstatechange") @oneway public void subscriberstatechangerequest( @webparam(partname = "subscriberstatechangerequest", name = "subscriberstatechangerequest", targetnamespace = irmnamespaces.service+irmversions.wsdl_version) subscriberstatechangerequesttype subscriberstatechangerequest) { messagecontext ctx = context.getmessagecontext(); below configurat

c# - Reflection to find what type/method called a constructor? -

i not sure if possible, if have default constructor , invoking (method, constructor, property, etc) possible determine type called while in constructor? i interested in use regards applying attribute property. update : question answered : when custom attribute's constructor run? example : [attributeusage(attributetargets.property)] public class someattribute : attribute { public type invokingtype { get; private set; } public someattribute() { //invokingtype = property applied } } public class someclass { [someattribute] public string someproperty { get; set; } }

Get docked message object in Outlook 2013 -

getting open new email message (when un-docked main outlook window) requires following code: outlook.application oapp = new outlook.application(); outlook.inspector inspector = oapp.activeinspector(); item = inspector.currentitem; outlook.mailitem omsg = item outlook.mailitem; how do when new message docked within main window of outlook? happens when user clicks reply button within message viewing. if want return new message object (like outlook.mailitem ), should try this: outlook.application oapp = new outlook.application(); outlook.mailitem omsg = explorer.gettype().invokemember("activeinlineresponse", system.reflection.bindingflags.getproperty | system.reflection.bindingflags.instance | system.reflection.bindingflags.public, null, explorer, null) outlook.mailitem; you should able attach file docked outlook message required.

c# - How to persist logged in user data for entire session? -

i'm creating practice admin application using mvc4, i'm not sure best method persist logged in user data entire lifetime of session accessible views & controllers. for example, desire user log in, download user data database, , entire session want maintain user model (name, database id etc) it's accessible throughout entire web application until user logged out. is best approach store data in encrypted cookie? or there way of using static class? currently i've read using viewmodel base class so: public abstract class viewmodelbase { public usermodel user { get; set; } } then of viewmodels can inherit base class, providing access user data model: public class allemployeesviewmodel : viewmodelbase { public list<employeemodel> employees { get; set; } } however, if in 1 controller action set user data, lost when loading controller action. to me seems waste of resources & increase load times have keep downloading use

typeahead.js - Twitter Typeahead Suggestion Limit -

i'm using latest version of typeahead (0.10.2) , can't plugin give me more 139 records. when change query return 140 records "empty" template created. what doing wrong? var engine = new bloodhound({ name: "courses", limit: 5000, prefetch: { url: "../../cfc/xxx.cfc?term=aa&returnformat=json", ajax: { datatype: "json", cache: false, data:{ method: "search" } } }, remote: { url: "../../cfc/xxx.cfc?term=%query&returnformat=json", ajax: { datatype: "json", cache: false, data:{ method: "search", timeout: 5000 } } }, datumtokenizer: function(d) { return bloodhound.tokenizers.whitespace(d.value); }, querytokenizer: bloodhound.tokenizers.whitespace }); $("#source").typeahead({ minlength: 2,

android - Equivalent to Google Play Games Service / iOS Game Center for Windows Phone 8? -

i creating cross platform app, supports real time multiplayer gaming. in ios, can use game center, create peer peer real time match. likewise, can use google play game services both ios , android. but couldn't find documentation doing equivalent windows phone 8 ? read somewhere using xbox live, couldn't find documentation on how windows phone 8 app. is not possible ? there way port google play game services windows phone 8 ? if need multiplayer support guess need create xbox game.microsoft has own play service.for more details refer link http://www.tomshardware.com/news/microsoft-launches-play-service,20510.html .also please take @ appwarp multi player gaming in widnwos phone 8 http://appwarp.shephertz.com/game-development-center/windows-game-developers-home/

Reporting tool for android app in eclipse -

i developing android application using eclipse. need app load data sqlite database , generate report , export pdf format. reporting tool can recommend? i use itext library generating report in own application. must create header section , content section of report yourself.

c++ - Draw array of VBOs in OpenGL ES -

i have array of vertex array objects, each contain vbo reference, , and array of matrices, of same size, such as: unsigned int vaoarray[128]; matrix_t matrixarray[128]; rather than for (i = 0; < 128; i++) { glbindvertexarray(vaoarray[i]); gluniformmatrix4fv(u_mvp_matrix_slot, 1, gl_false, &matrixarray[i]); gldrawarrays(bgl_triangle_fan, 0, 4); } is there way can push entire array of vaos , matrices gpu @ once? maybe using instancing extension somehow? i can't combine them in 1 vao/vbo, because combination can change (this drawing text, each character having own vao/vbo combo). and yes, realize involves using es 2.0 extensions. that's ok. btw, of vaos each character identical except vbo id, if helps.

facebook - How to connect social account to already registered user in SecureSocial, when the user is logged in? -

well, have question regarding connecting multiple social accounts using securesocial, not through login menu, inside app. what trying is: user logs in app using securesocial after he/she logs in app, should allowed connect facebook/twitter account, trying let users connect different social account logged in session of app. to make more simple, mean is, provide "connect facebook" or "connect twitter" inside app, logged in users. there such functionality in securesocial ??, have made easier me integrate social channels in app, has no idea whatsoever social apps. is there functionality such provided securesocial, or need create own modules , if needed create own modules, guys give me pointers how so. googled issue couldn't suitable answers. thank you. there support linking accounts now. check master samples on how it. if start authentication flow when user logged in securesocial invoke new method called link in userservice.

c# - IEqualityComparer That Will Find The Next Closest Element -

is possible write iequalitycomparer sortedlist <double, gameobject> return 'next-closest' double ? for example; sortedlist <double, gameobject> list = new sortedlist <double, gameobject>(new mycomparer()); list[0.00] = go1; list[1.00] = go2; list[0.55]; // should return go2. ie, find next-closest key, value pair // , return is possible this? use iequalitycomparer achieve this? #region comparator public class mycomparer : iequalitycomparer<double> // should pair<double, gameobject> instead? { public bool equals(double a, double b) { return (math.abs(a-b) <= 0.01); } } #endregion ps: if add own custom comparer ( iequalitycomparer ) - sorting , searching algorithm of sortedlist still remain binary search? changing comparer have made sortedlist less efficient? have made lookup , insertion less efficient? please use following program fix. , yes there little overhead due rounding. if ret

How does Javascript match the parameters in the callback function? -

i started learn javascript, , callback functions seem hard understand. 1 question have how javascript matches parameters in callback function? example in following foreach loop: var friends = ['mike', 'stacy', 'andy', 'rick']; friends.foreach(function(eachname, index){ console.log(index + 1 + ". " + eachname); }); is default foreach function pass index second parameter , entry first parameter in callback function? in order master callback functions, need check api (in case, foreach) every time use it? is default foreach function pass index second parameter , entry first parameter in callback function? yes; this part of specification . in fact, passes array being iterated third argument. call [[call]] internal method of callbackfn t value and argument list containing [the value], [the index], , [the object] . (emphasis mine.) in order master callback functions, need check api (in case, foreach)

javascript - Angularjs problems appending table -

i learning angularjs (i still fresh). trying add row table on button click. basing code tutorial - http://plnkr.co/edit/64e1ngnkc4vyyney6iqz?p=preview my code appends content leaves out , tags , adding tags. furthermore, tried appending simple string 'test' , adds tags string...why add tags didn't include? my html - <div ng-controller="growingtable"> <div ng-controller="incomecontroller"> <table class="table table-striped"> <tr> <td>account</td> <td>budget</td> <td>%</td> <td>enter amount</td> <td>total</td> <td>%</td> </tr> <tr> <tr ng-repeat="r in rows"> <td><input class="form-control" placeholder="account"

time - How to know how many milliseconds Key is pressed in java -

i want find out time in milliseconds key pressed in java, result prints different number though pressed key less 1 second or more. example if pressed less 1 seconds shows 30, 45 or 98 , if pressed 3 seconds shows 35 , 50 , 120 tried code long keypressedmillis; long keypresslength; . public void keypressed(keyevent arg0) { // todo auto-generated method stub int codigo = arg0.getkeycode(); if(codigo == keyevent.vk_space) { keypressedmillis = system.currenttimemillis(); } } . public void keyreleased(keyevent arg0) { // todo auto-generated method stub int codigo = arg0.getkeycode(); if(codigo == keyevent.vk_space) { keypresslength = system.currenttimemillis() -keypressedmillis; system.out.println(keypresslength); } } keypressed can (and be) called repeatedly while key pushed. should put in flag can check see if repeated key event... int lastkey = -1; public

c# - DataGridView DataBinding get selected object from Combobox -

i have datagridview , 1 of column combobox (datagridviewcomboboxcolumn) binded property of objects. datagridview format cell calls tostring() of objects. combo list strings , try select combobox error because program trying set string object. how solve it? select combobox object value not string. i have collection of objects ( myobject ) contains property public reason kind { get; set; } reason has method tostring() datagridview calls automaticly. while select value combobox not reason object, string you need use displaymemberpath property on datagridviewcomboboxcolumn <datagridviewcomboboxcolumn displaymemberpath="propertyname" />

sql server - On Date base record return -

i have table structure this vehid timefirst timelast inside 1 26/06/2014 null 0 2 26/06/2014 26/06/2014 1 2 26/06/2014 null 0 3 26/06/2014 26/06/2014 1 i want return record on base of veh enter , left on same day , pick left record of vehls.inside 0 mean veh left , 1 mean enter.expect output below vehid timefirst timelast inside 2 26/06/2014 null 0 here, might need exclude time datetime : select * tablename convert(date, timefirst) in ( select convert(date, timelast) tablename id = a.id) , inside = 0

how to share text on facebook Through android app which is login through facebook Parse -

i working on adding share on facebook functionality app. have new version of parse sdk facebook . i can't seem find information on how use parse's fb sdk implement share. i have facebook session open app don't understand how post text or share text on facebook in android. please give me suggestions . thanks in advance... i got ans :) here solution : bundle params = new bundle(); params.putstring("name", "facebook sdk android"); params.putstring("caption", "build great social apps , more installs."); params.putstring("description", "the facebook sdk android makes easier , faster develop facebook integrated android apps."); params.putstring("link", "https://developers.facebook.com/android"); params.putstring("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/images/iossdk_logo.png"); webdialog feeddialog = ( new webdialog.feeddialog

html - CSS3 Pseudo :after horizontal scroll even overflow hidden -

i developing responsible page using bootstrap, <div> content using :before , :after pseudo screen size. below code, working fine. horizontal scroll appearing, overflow hidden. please remove horizontal scroll. css .text_box{ background:#ff0000; width:1000px; height:200px; margin: 0 0 19px; padding: 20px 0 25px; position: relative; color:#ffffff; } .text_box:before{ background:#ff0000; display:block; width:100%; height:100%; overflow:hidden; position:absolute; top:0; left:-99%; z-index:-1; content:''; } .text_box:after { background: #ff0000; content: ""; display: block; height: 100%; overflow: hidden; position: absolute; right: -99%; top: 0; width: 100%; z-index: -1; } html <div class="text_box"> hello world !!! </div> remove 100% width :after , :next class. update css below. .text_box:before{ background:#ff0000; display:block; height:100%; overflow:hidden; position:absolute; top:0; left:-99%; z-inde

wpf - How to load a font file and use its font style in C#? -

i can load font file using this: privatefontcollection _fonts = new privatefontcollection(); _fonts.addfontfile ( filepath ); font customfont = new font(_fonts.families[0], 6.0f); but, problem facing cannot load font style (bold/italics etc) font file. need font file user, because going save font file , use opengl render it. but, before actual rendering, need show preview using wpf. all fonts can assumed system fonts. but, need find out font style ttf file show on wpf canvas. can can ask user load font file specify style drop down, defeats purpose, because if user specifies wrong style, show differently on emulator , during rendering. so, should do? i'm not sure understand problem, if want display text in particular font, can this. first, add font file folder in project... let's it's called resources . next, set build action content . can use font in xaml this: <textblock fontfamily="/resources/#some font name" text="some font name

javascript - gwt obfuscated maximum call stack size exceeded Object._toString -

i using gwt , error maximum call stack size exceeded when compiling obfuscated gwt. if compile pretty gwt, dont have problem. not sure problem, however, gwt version before 2.6 has bug cause call stack exceeded in browsers if have long string value, please try 2.6.1

c - Reverse Modulus Operator with given condition -

i have equation: x^2 mod p = z ; p , z given. x , p , z positive integers , max value of x given (say m ). p prime . how can calculate (multiple possible values) x when p , z known ? update: i found solution here: https://math.stackexchange.com/questions/848062/reverse-modulus-operator-with-given-condition/848106#848106 if x^2 mod p = z x^2 = n*p + z integer n p , z known, substitute integer values n find x

html - UIKIT HTMLeditor design not working properly -

hi guys followed uikit 's sample of html editor problem although working fine design not... didnt became same on docs followed still navbar's design of htmleditor ugly here code dont know if issue on css or javscript because have included dependencies needs based on doc code: <link rel="stylesheet" href="assets/~uikit/css/uikit.min.css"> <link id="data-uikit-theme" rel="stylesheet" href="assets/~uikit/css/uikit.docs.min.css"> <link href="assets/css/docs.css" rel="stylesheet"> <link rel="stylesheet" href="assets/~uikit/css/uikit.addons.min.css"> <link rel="stylesheet" href="plugins/codemirror/lib/codemirror.css"> <body> <div style="margin-top:100px;" class="uk-container uk-container-center"> <textarea data-uk-htmleditor="{mode:'tab'}">...</textarea> </div> <

How to enable logging / debugging for openssl in android. -

i working on assignment in openssl in android. i have access code. , can add custom logs in if want. but problem these logs dont appear in logcat. is there specific setting / property /flag need change enable logs openssl in android? thanks ! is there specific setting / property /flag need change enable logs openssl in android? the openssl library not log. there bio_s_log , not used anywhere: openssl-1.0.1h$ grep -r bio_s_log * crypto/bio/bio.h:bio_method *bio_s_log(void); crypto/bio/bss_log.c: why bio_s_log? crypto/bio/bss_log.c: bio_s_log useful system daemons (or services under nt). crypto/bio/bss_log.c:bio_method *bio_s_log(void) util/libeay.num:bio_s_log 1243 exist:!os2,!win16,!win32,!macintosh:function: util/mkdef.pl: $platform{"bio_s_log"} .= ",!win32,!win16,!macintosh";

Join or merge function in haskell -

is there function in haskell equivalent of sql join or r merge ? basically have 2 list of tuples , 'zip' them according key. know there 1 or 0 value each key a = [(1, "hello"), (2, "world")] b = [(3, "foo"), (1, "bar")] and like [ (just (1, "hello), (1, "bar)) , (just (2, "world), nothing) , (nothing , (3, "foo")) ] i can not think of standard function doing operation. convert 2 lists data.map.map s , code sql-join myself. in way, looks doable o(n log n) complexity, not bad.

wordpress - Woocommerce shop manager role, hide woocommerce menu -

Image
i using wordpress theme supports woocommerce, when adding user shop manager role don't want show woocommerce menu. just need products menu only. please help. you can use wordpress's ' remove_menus() ' function this. store managers have capability: 'manage_woocommerce' you can see allowed see woocommerce admin menu here: '/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php' look for: $main_page = add_menu_page( __( 'woocommerce', 'woocommerce' ), __( 'woocommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , array( $this, 'settings_page' ), null, '55.5' ); so theory. stop admin menu item displaying administrator, add functions.php file or plugin: add_action( 'admin_menu', 'remove_menus' ); function remove_menus(){ // if current user not admin if ( !current_user_can('manage_options') ) { remo

regex - Return first substring till It Matches in PHP -

i stuck this i have string let say $name = 'asdf_aadf01_2*f854?# sadf'; and need 'asdf_aadf01_2' in return means alpha numeric underscore until non alphanumeric , _ character found use: preg_match('/\w*/', $name, $match); $match[0] contain you're looking for. \w matches alphanumeric or underscore character. * quantifier means match 0 or more of preceding element.

module - Modular MediaWiki -

i wonder if possible configure mediawiki (or other wiki tools) modular predefined wiki. instance, on regular wiki page 1 can freely edit sections, text, everything. i looking solution predefines number of sections (or modules) can added each wiki page. users free edit inside sections within predefined formats. hope can help, thanks. as mediawiki, there @ least 1 extension can work way: semantic forms , used semantic mediawiki (though not necessary). sf, define 1 or more templates receives data entered in form, , form can divided sections. a more lighweight solution might using 1 of many boiler plate extensions available. either way, wiki can never force users follow scheme. whole philosophy, making wiki's unique among collaborative tools, users, not you, create not content structure content!

java - How to get text from specific href with jsoup? -

i text http://m.wol.jw.org/en/wol/dt/r1/lp-e/2014/6/26 via jsoup in android app. looks like: public static void refreshfromnetwork(context context) { document document; elements dateelement; elements textelement; elements commentelement; try { calendar calendar = calendar.getinstance(); int year = calendar.get(calendar.year); int month = calendar.get(calendar.month) + 1; int day = calendar.get(calendar.day_of_month); sdayurl = surl + "/" + year + "/" + month + "/" + day; document = jsoup.connect(sdayurl).get(); if (document.hastext()) { dateelement = document.select(".ss"); textelement = document.select(".sa"); commentelement = document.select(".sb"); sdate = dateelement.text(); stext = textelement.text(); scomment = commentelement.html(); ssavedforcheckingdate

c# - Tracking DownloadProgress with synchronous download -

basically this: using (webclient wc = new webclient()) { wc.downloadprogresschanged += (sender, args) => { progress = (float) args.bytesreceived / (float) args.totalbytestoreceive; }; wc.downloadfile(new uri(nolastsegment + file), path); } this doesnt work, because progress fired asynchronous downloads downloadfileasync. usually you've got other thread ui thread if can show progress, maybe you've got console app or something. can use kind of wait handle , set when download completes. using (var completedevent = new manualreseteventslim(false)) using (webclient wc = new webclient()) { wc.downloadfilecompleted += (sender, args) => { completedevent.set(); }; wc.downloadprogresschanged += (sender, args) => { progress = (float) args.bytesreceived / (float) args.totalbytestoreceive; }; wc.downloadfileasync(new uri(nolastsegment + file), path); completedevent.wait(); }

javascript - Detect elements with attribute without value -

lets i've got <div class="some-class" selected></div> i'm trying if has attr 'selected', but $(".some-class").attr("selected") //undefined $(".some-class").is("*[selected]") // false am able if has selected attrbute if has no value? try use has attribute selector @ context, $(".some-class").is("[selected]") demo

debugging - PHPStorm v.5 issues -

i use phpstorm 5.0.2 debugging php/mysql projects wamp framework (php 5.3.1, apache 2.2.9, mysql 5.5.24 on windows 7 platform). question 1: times in project, when watch debug variables used, take seconds refresh on debug panel, after each code step. each watch variable takes few seconds refresh, more watches have been defined, more slowing down takes place during code stepping, rendering debugging disappointedly slow. so, example, cannot press 'step over' every second, because have wait till watch values refreshed, before press next 'step over' , may take 5 or more seconds. this didn't use happen before, started happening lately , doesn't happen time. when doesn't happen, code stepping can advance quickly, did. in project have set quite few breakpoints, wondering if culprit. tried disable of them (not delete them, since need keep them future use), didn't see improvement. i tried different xdebug versions, no change took place. i have tried

azure - ADFS authentication for Corpnet users -

i need adfs authentication corpnet users windows 8.1 app. don't know how working. able authenticate via azure not corpnet. thanks vinod this complex topic explain in view words question rather open. do see if can going web application: http://msdn.microsoft.com/en-us/library/windows/desktop/bb736227(v=vs.85).aspx or windows phone app: http://www.cloudidentity.com/blog/2014/02/16/a-sample-windows-phone-8-app-getting-tokens-from-windows-azure-ad-and-adfs/

How do Chef and Docker work together -

i trying migrate applications heroku aws, , want use chef/docker on aws. may need several servers migration web server, app server, db, redis... i want deployment flow simple heroku; , want minimize configuration of servers on aws; came chef , docker. i have seen demo on using chef manage docker: http://www.getchef.com/solutions/docker/ still don't have understanding of boundary of chef , docker is. can give advice on how combine chef , docker together? or need chef @ if going use docker? you don't need chef use docker. if not familiar chef doesn't make sense use chef in combination docker. unless trying solve configuration puzzle. this indeed still evolving. use chef docker , distinguish 3 ways use chef docker: use vagrant , chef bake docker images. deploy docker images using chef using resources such docker-service , docker-image , docker-container . manage runtime configuration of docker container using chef. 1 , 2 doing. 3 try in time.

java - Send signal to av receiver with android -

i want implement function in android app turn on/off av receiver. therefore created socket , send command via telnet receiver, nothing happens. socket created successfully! my av receiver denon x-2000 , according official protocol have send pwstandby command. public void turnoff(view v){ runnable r = new runnable() { @override public void run() { socket s = null; printwriter out = null; bufferedreader in= null; try{ inetaddress ia = inetaddress.getbyname("192.168.100.228"); s= new socket(ia, 23); out = new printwriter(s.getoutputstream(), true); in = new bufferedreader(new inputstreamreader(s.getinputstream())); } catch(ioexception e){ } log.v("output","send standby"); out.println("pwstandby"); out.flush(); try { if(in

javascript - Issue regarding the XSS (Cross Site Scripting) attack -

in email of page have following contents. please <a href="emaildisclaimer-test.html?name=test&email=test@test.com" target="_blank">click here</a> regarding event. when user clicks on "click here" page redirected html page. url parameter retrieved , displayed. here i'm facing problems of xss attack. can have idea regarding issue. how can prevent javascript? from comment: once redirected, parsed , displayed in html. url passing parameter edited , appended script tags ( <img src="javascript:alert('xss');"> ). how can prevent appending parameter externally ?? as long content user supplies ever shown to same user , there's no xss issue. can hack themselves, no 1 else. if you're accepting end-user content display other users, of course need paranoid xss. i'm seeing 2 possible uses of content user: not allowing them use html allowing them provide (some) html not allowing

json - Import data to excel from rails URL -

i want import data excel rails url. have written action serve json data http request url. but when try import in excel using power query -> other sources -> odata feed not getting data instead got error [dataformat.error] odata: given url neither points odata service or feed: 'http://<server ip>:3000/test1/test2/test.json'. from odata documentation here , responded json data { "d" : { "key": "value"} } . doesn't seem help. got same issue. def test respond_to |format| format.json render :json => { "d" => { "key" => "value"} } end end end what missing? if using power query -> other sources -> odata feed, should provide url http://services.odata.org/v2/northwind/northwind.svc/categories not .json suffix. if trying import direct json result file of odata service, should use power query -> file -> text

clone - What's the opposite of shallow cloning? -

what's called when tell object clone of arguments (like in deep cloning), top-level object isn't changed? i need implement sort of method in program, , i'm trying figure out call method. say we're cloning foo, referenced several other objects. if doing deep-level cloning, our clone's arguments inaccessible other objects reference foo. in (currently unidentified) type of cloning, if clone foo, other objects referencing foo have access the newly cloned arguments. i don't think there's name that. i'd suggest naming method relates reason why you're doing this.

html - bootstrap submenu not working locally -

so i'm trying add sub menus main dropdown shown in http://www.bootply.com/3gl49mdq4p# or here under sub menus bit http://getbootstrap.com/2.3.2/components.html#dropdowns can't figure out why code not working. when hover "tvs" bit dropdown dropdown list consisting of "remote controls", "projectors" , "flat screen" should pop doesn't though i've tried doing says in both sources... <div class="navbar navbar-inverse navbar-static-top"> <div class="container"> <button class="navbar-toggle" data-toggle="collapse" data-target=".navheadercollapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="collapse navbar-collapse navheadercollapse"> <

el - What does it mean by ${ } dollor and brackets in jsp? -

i saw in jsp file, guessed brought in. come from? db? source of jsp file? or scripts? the ${} symbol java expression language you can check documentation @ oracle quote oracle : el can : dynamically read application data stored in javabeans components, various data structures, , implicit objects dynamically write data, such user input forms, javabeans components invoke arbitrary static , public methods dynamically perform arithmetic operations

scala - (de)serialize class to/from JSON -

reasonably new scala, i'm looking way serialize , deserialize class to/from json. i'm familiar jackson annotations java, , use style if makes sense in scala. two parts causing me problems: private constructor parameters, , hashsets. i've tried json4s , jackson-module-scala, seem able them want. both reported errors hashsets. sorry, don't have errors handy, can find if necessary. as test, here's class i'm trying serialize deserialize: class foo(val public: string, private: string) { somelist: mutable.hashmap[string] = new mutable.hashmap[string]("bar") def func = { .. } } thanks help! did try using case classes? otherwise think there annotation make class compatible pojo classes @beanproperty. can find more here https://twitter.github.io/scala_school/java.html

Why can my VisualStudio extension not be found in VS 2013 gallery search (but in VS 2010 and VS 2012)? -

after testing , uploading release 2.4 of extension switchstartupproject ( source code ) visual studio gallery, noticed in vs 2013 neither appears in extension search results when searching appropriate keywords (e.g. switch startup ), nor show available update when earlier version of installed. but extension works in vs 2013 when vsix file downloaded , installed. visual studio gallery page shows supports vs 2013. , in vs 2012 , vs 2010 both search , update indication works. the extension supports vs versions 2010, 2012, 2013 (and 2014 ctp) using version 1 vsix manifest : ... <supportedproducts> <visualstudio version="10.0"> <edition>ultimate</edition> <edition>premium</edition> <edition>pro</edition> </visualstudio> <visualstudio version="11.0"> <edition>ultimate</edition> <edition>premium</edition> <edition>pro</edition> </vi

javascript - Highcharts: Dynamically (programmatically) assign the axis name -

i trying add programmaticallya string x axis, instead declaring in chart creation. so example, have chart: $.(document).ready(function{) { chart=new highcharts.chart({ chart:{ renderto: 'container', type: 'line' } yaxis: { title: { text: 'theyaxis'} } series: [1,2,3,4] }); }); now want change yaxis title, create small function; this: var titley; function loadme(){ $.get('names.csv', function(data){ var lines= data.split('\n'); titley=lines[0].split(','[0]; }); } $.(document).ready(function{) { chart=new highcharts.chart({ chart:{ renderto: 'container', type: 'line' } yaxis: { title: { text: titley} } series: [1,2,3,4] }); loadme(); }); this result in title being empty. i checking sure value correctly retrieved, using console.log, , value coll

string - How to split the datas in android while using soap -

i had doubt while using soap ,how split string,is there possibility. //this original data afternoon-99127.79; night-67236.27; morning-61876.65; evening-20271.42; housekeeping-5444.05; need; afternoon 99127.79 night 67236 morning 61876.65; evening 20271.42; housekeeping 5444.05; i split using semicolon , don't know how use sub strings,use of start , end index don't know how give values..actually want split before "-" , after "-". string total_string = "afternoon-99127.79;night-67236.27;morning-61876.65;evening-20271.42;housekeeping-5444.05;"; string[] spilted_string = total_string.split(";"); (int i=0;i<spilted_string.length;i++){ system.out.println(spilted_string[i].split("-")[0]); system.out.println(spilted_string[i].split("-")[1]); } demo

r - Return df with a columns values that occur more than once -

i have data frame df, , trying subset rows have value in column b occur more once in dataset. i tried using table it, having trouble subsetting table: t<-table(df$b) then try subsetting using: subset(df, table(df$b)>1) and error "error in x[subset & !is.na(subset)] : object of type 'closure' not subsettable" how can subset data frame using table counts? here dplyr solution (using mrflick's data.frame) library(dplyr) newd <- dd %>% group_by(b) %>% filter(n()>1) # newd # b # 1 1 1 # 2 2 1 # 3 5 4 # 4 6 4 # 5 7 4 # 6 9 6 # 7 10 6 or, using data.table setdt(dd)[,if(.n >1) .sd,by=b] or using base r dd[dd$b %in% unique(dd$b[duplicated(dd$b)]),]

android - StrictMode DiskReadViolation on ListView fling -

my fragment generating huge bunch of disk read strict mode violations , flashing screen when small fling or scroll. running app on samsung android 4.4.2. the list view in fragment populated custom content provider using custom cursor adaptor. have not handled fling or scroll events might trigger disk read. getting these violations when fragment starts reasonable because getloadermanager().initloader() in onresume() . don't understand why fragment attempt disk read on fling. out of approx 500 logcat lines tag strictmode generated, have pasted few here. idea causing this? @targetapi(11) public static void enablestrictmode() { // strict mode available on gingerbread or later if (utils.hasgingerbread()) { // enable thread strict mode policies strictmode.threadpolicy.builder threadpolicybuilder = new strictmode.threadpolicy.builder() .detectall() .penaltylog

Javascript New Date() / UTC - GMT cross browser -

the issue : different formats new date() in ie 10 - ie 11. javascript: ie 11 / chrome : var m = new date("2014-07-04t04:00:00"); console.log(m); // fri jul 04 2014 06:00:00 gmt+0200 (w. europe summer time) ie 10: var m = new date("2014-07-04t04:00:00"); console.log(m); // fri jul 4 04:00:00 utc+0200 2014 is possible use 1 ring rule them all? you shouldn't pass string new date , reason. instead, should either give individual arguments: new date(2014, 6, 4, 4, 0, 0); // remember months zero-based or, if want give time in utc, try: var d = new date(); d.setutcfullyear(2014); d.setutcmonth(6); d.setutcdate(4); d.setutchours(4); d.setutcminutes(0); d.setutcseconds(0); d.setutcmilliseconds(0); you can, of course, make function this. alternatively, if have timestamp, can do: var d = new date(); d.settime(1404446400000);

Matlab - Concatenate strings with wildcard -

i have 2 variables, , b, have variable between them creates file name. e.g. a*b.mat * %// can number of digits obviously dir a*b.mat not work, haven't faintest on how make work. i think want this: concatenate contents of a , b string '*' in between , '.mat' @ end: dir( [a '*' b '.mat'] )

c++ - Error when passing array to function -

i'm new c++ , writing program supposed following: fill array of integers based on user-defined constant. pass array in step # 1 function computes mean of integers in array. pass array in step # 2 function computes standard deviation of integers in array. here's code: #include "stdafx.h" #include <iostream> #include <cmath> using namespace std; const int size_of_array = 100; int custarray[]; void fillarray(int size_of_array); double standarddeviation(double[], int); double mean(double[], int); double arithmeticaverage; int _tmain(int argc, _tchar* argv[]) { int i; fillarray(size_of_array); cout << "\n"; cout << "the mean is: " << mean(custarray[], i); cout << endl; cout << "the standard deviation is: " << standarddeviation(custarray[], i); return 0; } void fillarray(int size_of_array) { int = 0; custarray[0] = { 1 }; (int = 0; < si

enums - Enumerated type as a static variable in Objective-C -

i need static variable holds enumerated type accessed , changed other classes. can access value, when try change it, new value not stored. class it's declared in not instantiated. this enum declaration: typedef ns_enum(nsinteger, weapontype) { single, dual }; i have static getter , setter declared in .h file: +(weapontype)shipweapontype; +(void)setshipweapontype:(int)atype; in .m file have static variable static weapontype shipweapontype; and getter , setter implemented follows: + (weapontype)shipweapontype { return shipweapontype; } + (void)setshipweapontype:(int)atype { shipweapontype = atype; } shipweapontype returns 0. have tried having setshipweapontype require actual enum type rather int, makes no difference. any appreciated! i suspect you're missing obvious, have appears though should work. did test in single class inside default sprite kit project since had open, , worked. here's looks like: //======= .h ========== t

html - How to get my <td> act like <tr> -

Image
hi i'm trying make table responsive , need responsive , stack within each other table row html <html > <head> <meta name="viewport" content="width=device-width; initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="teststyles.css"> <!--[if lt ie 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if lt ie 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <![endif]--> <link href="media-queries.css" rel="stylesheet" type="text/css"> </head> <body> <table> <tr> <td> <p> stuff </p> </td> <td > <p> stuff </p> </td> <td > <p> stuff </p> </td>

python - Combine effects to menu in pygame -

hey guys developing game pygame. idea of game when user click on start button on menu(which appear on first before starting game) must see 2 balls bouncing on pygame window. for have 2 python files. bounceball.py this python file makes 2 ball bounce on pygame window made me.the code of bounceball.py here .(sorry pasting on pastebin since long code) menu.py this python file creates menu have found internet , works fine.the code of menu.py here but problem when user clicks on start button menu didnt .the thing want when user clicks on start button menu must see ball boucing have coded in bounceball.py on pygame window.how can link bounceball.py menu. i have tried acheive many methods didnt helped me .. hope guys can me in acheieving ..any appreciated ..thanks in advance it done better @ least works. menu.py #!/usr/bin/python import sys import pygame import bounceball #---------------------------------------------------------------------- whit