Posts

Showing posts from June, 2011

spring - Creating custom Zuul filters -

i want implement custom filters zuul proxy. now, know there has been lot of talking subject here , took @ answer provided, examples of filters , spring cloud documentation, went through several times. have tried copy of filters content use, didn't work. i have eureka server, registering 3 separate services, 1 of them being front door other two, collecting information each of them , retrieving it. what want able re-route requests zuul receives @ beginning of process, redirect them through particular services, using url parameters determine process should aimed instead of another. have created filter tagged @component annotation, implementing zuulfilter . don't know, how make redirections work, , methods use. so, question : how can redirect incoming requests different registered services, using url parameters ? look @ predecorationfilter example matches routes based on url path (ie /myservice ). if matches full url sets routehost in ribbon context, otherwi

Android Studio failed to complete Gradle execution without cause -

Image
i have strange problem since yesterday. if use run-button in android studio android studio cannot complete gradle execution. in gradle console in android studio first message: :app:compiledevelopmentdebugjavawithjavac note: input files use or override deprecated api. note: recompile -xlint:deprecation details. note: input files use unchecked or unsafe operations. note: recompile -xlint:unchecked details. followed by: :app:dexdevelopmentdebug agpbi: {"kind":"simple","text":"warning: ignoring innerclasses attribute anonymous inner class","sources":[{}]} agpbi: {"kind":"simple","text":"(org.apache.commons.httpclient.httpmethodbase$1) doesn\u0027t come an","sources":[{}]} agpbi: {"kind":"simple","text":"associated enclosingmethod attribute. class produced a","sources":[{}]} agpbi: {"kind":"simple","text&qu

Windows Azure - Shared Access Signature (SAS URI) -

Image
heres 3 questions you! is possible revoke active sas uri without refreshing storage key or using stored access policy? in application, users share same blob container. because of this, using stored access policy, (max 5 per container), or refreshing storage key, (will result in sas uri's being deleted), not option me. is possible show custom errors if sas uri incorrect or expired? this default page: if let users create own sas uri uploading/downloading, need think setting restrictions? can abused? currently, in application, there restrictions on how allowed upload, no restrictions on how many sas uris allowed create. users can aquire how many sas uris long don't complete upload or exceed allowed stored bytes. how real filesharing websites deal this? how sas uri cost create? edit - clarification of question 3 . before can upload or download blob must first sas uri. wondering if it's "expensive" create sas uri. imagine user exploiting this,

c# - Upgrade to mvc 4 manually by replacing dlls -

existing project uses following assemblies manually placed , referenced in _bin_deployableassemblies folder. projects not use nuget on this. i'm upgrading mvc 3 4 replacing same dlls in above folder. there other dependency dlls need place there? microsoft.web.infrastructure.dll system.web.helpers.dll system.web.mvc.dll system.web.razor.dll system.web.webpages.deployment.dll system.web.webpages.dll system.web.webpages.razor.dll there little bit more needed replacing dlls. see article: http://www.dotnetexpertguide.com/2011/12/upgrade-aspnet-mvc-3-project-to-mvc-4.html

c# - Is there an iOS override for when a view was popped back? -

i have masterdetail application, , navbutton add new item. im able pop view back, need reload table nice done. how can masterviewcontroller know when popped reload? heres pop code: navigationcontroller.popviewcontroller(true); it functions expected, need masterviewcontroller reload table, made method for: public void reloadtable() { tableview.reloaddata (); } try this: public partial class masterviewcontroller : uiviewcontroller { public void reloadtable() { tableview.reloaddata (); } } public partial class detailviewcontroller : uiviewcontroller { public override void viewwilldisappear (bool animated) { var masterviewcontroller = navigationcontroller.viewcontrollers.oftype<masterviewcontroller> ().firstordefault(); if (masterviewcontroller != null) { masterviewcontroller.reloadtable (); } base.viewwilldisappear (animated); } } you need add using system.linq; oftype metho

printing - Print string to a java.io.Console object -

i'm making multi-player game each player has own input/output console on screen. i'm having bit of trouble trying this. don't want every player see other player's in/outputs. to use analogy, want playeroneconsole.out.println("player 1 string"); , instead of system.out.println("player 1 string"); can see player one's stuff. after reading documentation, i've tried this, not work intended throws nullpointerexception: public class player { string myname; console myconsole; public player(string name) { myname = name; myconsole = system.console(); } public void taketurn(string playeroptions){ myconsole.writer().print(playeroptions); //this not right. } } i want playeroptions print exclusively player's console, not system console. by way, i'm using netbeans ide 8.0.2 if makes difference. when using java.io.console , must execute java app console e.g. windows cmd or

javascript - Add a span in a span with JQuery -

i'm trying put <span> in other <span> in title of jquery's modal doesn't work. here's html code : <div class="ui-dialog-titlebar..."> <span class="ui-dialog-title">info title</span> ... </div> <div id="1"> and want put <span class="glyphicon glyphicon-info-sign"></span> inside ui-dialog-title <span> . i tried : $(".ui-dialog-title").prepend('<span class="glyphicon glyphicon-info-sign"></span>'); and works ! <div class="ui-dialog-titlebar..."> <span class="ui-dialog-title"> <span class="glyphicon glyphicon-info-sign"></span>info title </span> ... </div> <div id="1"> but , have multiple <span> class ui-dialog-title in document , want access <span> using id of next <div> . i tried : $("#

android - Responsive web app as a phonegap packaged mobile app -

my requirement pretty simple. have responsive web -url, , want package android app, whenever app accessed web-url open in device native browser, , user behave mobile app. using below config.xml phonegap build: <?xml version='1.0' encoding='utf-8'?> <widget id="com.demo.sample" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0"> <name>myapp</name> <description> sample.in mobile app. </description> <author email="@#$%@gmail.com" href="http://google.in"> team </author> <preference name="phonegap-version" value="3.7.0" /> <content src="http://google.in/" /> <plugin name="cordova-plugin-whitelist" version="1" /> <plugin name="inappbrowser"

c - print elements of one array based on values set in another array -

i have 2 arrays, 1 data[n] array of type int , stores random values. other result[n/4] array, has details 4 integers of 'data' array in 1 element. for example : result[0]=1000 0000 1000 0000 0000 0000 1000 0000 implies data[0], data[1], data[3] needed printed out. simillarly result[1] has details data[4] data[7] in each byte of , hence if 'n' elements present in data array, n/4 elements present in result array. now provided result , data arrays , count value(no. of elements in result array) , have print 'data' values 'result' value set(i.e., '1000 0000'). have tried 2 methods. method 1: i=0;j=0; while(i<count) { if((result[i]>>24 & 0xff) > 0) printf("%d",data[j]); if((result[i]>>16 & 0xff) > 0) printf("%d",data[j+1]); if((result[i]>>8 & 0xff) > 0) printf("%d",data[j+2]); if((result[i]>>0 & 0xff) > 0) printf("%d",data[j+3]); i++; j+=4; } m

javascript - Angular JS Force iframe to reload -

i'm making application, , have different videos in same page, don't wanna run different videos in same time, want when user play videos should reload other iframes (so videos stop automatically) ? is there anyway manipulate iframe controller , if can provide simple example or thing can solve problem wich have been working on more 2 days. controller : function myctrl($scope) { $scope.video1 = 'https://www.youtube.com/embed/wsxwjj88vko'; $scope.video2 = 'https://www.youtube.com/embed/fvxajf9alpm'; } html : <div ng-controller="myctrl"> <iframe ng-src="{{video1}}" width="400" height="300" frameborder="0" allowfullscreen></iframe> <iframe ng-src="{{video2}}" width="400" height="300" frameborder="0" allowfullscreen></iframe> </div> jsfiddle or way force reloading button example : $scope.reload = function() {

mysqli - Would this PHP inserting be secure? -

this question has answer here: how can prevent sql injection in php? 28 answers i've been working on little script insert data database i'm not sure if it's secure way. feedback pretty cool! question, secure way of inserting data? code: function dbrowinsert($table, $data) { require_once('../config.inc.php'); $builddata = null; $countloop = 1; foreach($data $field) { $sep = ($countloop!=count($data) ? ',' : '') ; if((int)$field == $field) { $builddata .= (int)$field . $sep; } else { $builddata .= '"' .mysqli_real_escape_string((string)$field) . '"' . $sep; } $countloop++; } $fields = array_keys($data); mysqli_query($conn, "insert into" . $table . "(`" . implode('`, `', $fields) . "`)

Redirecting front-end routes to Dashboard in Bolt CMS -

i'm trying redirect front end routes admin dashboard, i'm using bolt installation rest api end. here's how i'm routing content: contentlink: path: /{contenttypeslug}/{slug} defaults: { _controller: 'bolt\controllers\backend::dashboard' } requirements: contenttypeslug: 'bolt\controllers\routing::getanycontenttyperequirement' so, i've done use dashboard controller. when try visit 1 of routes, following whoops error: twig_error_loader template "dashboard/dashboard.twig" not defined () so reason it's not looking in correct place template. there way correct this? this looks it's twig path setup differently depending on whether there frontend or backend request. you can add path twig environment bolt uses following call: $app['twig.loader.filesystem']->prependpath("/path/to/twig"); the path backend twig templates may vary work. $path = $app['resources

c# - Enumerating a LINQ-to-SQL DataContext -

i looking enumerate through tables in datacontext have created using o/r designer. based on this question , i'm presently using reflection so, i.e. propertyinfo[] dc_properties = data.gettype().getproperties(); //data datacontext propertyinfo[] row_properties; foreach (var prop in dc_properties) { object value = prop.getvalue(data); if(value itable) { var table = (itable)value; //value table foreach (var item in table) //item row in table { row_properties = item.gettype().getproperties(); //row_properties values of row foreach (var prop2 in row_properties) { object value2 = prop2.getvalue(item); //prop2 value } } } } however, slow. know better way enumerate through datacontext , obtain values of rows of tables in it? thank you.

html - Wordpress acf paragraph doesn't work -

if edit content of page, paragraph doesn't generated: <div class="medium-8 columns"> <h4>title</h4> helloworld </div> if justify content, paragraph works: <div class="medium-8 columns"> <h4>title</h4> <p style="text-align: left;">helloworld</p> </div> i've searched on google , found it's problem of wordpress... it's possible? ps: if add <p></p> on text editor, works, want use visual editor

WPF OpenFileDialog with the MVVM pattern? -

Image
i started learning mvvm pattern wpf. hit wall: what do when need show openfiledialog ? here's example ui i'm trying use on: when browse button clicked, openfiledialog should shown. when user selects file openfiledialog, file path should displayed in textbox. how can mvvm? update : how can mvvm , make unit test-able? solution below doesn't work unit testing. what create interface application service performs function. in examples i'll assume using mvvm toolkit or similar thing (so can base viewmodel , relaycommand). here's example of extremely simple interface doing basic io operations openfiledialog , openfile. i'm showing them both here don't think i'm suggesting create 1 interface 1 method around problem. public interface ioservice { string openfiledialog(string defaultpath); //other similar untestable io operations stream openfile(string path); } in application, provide default implementation of service.

How to convert xml attribute to custom object during deserialization in C# using XmlSerializer -

i invalidcastexception: value not convertible object: system.string idtag while attempting deserialize xml attribute. here's sample xml: <?xml version="1.0" encoding="windows-1250"?> <arrayofitem xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <item name="item name" parentid="sampleid" /> </arrayofitem> sample classes: public class item { [xmlattribute] public string name { get; set; } [xmlattribute] public idtag parentid { get; set; } } [serializable] public class idtag { public string id; } the exception thrown convert.totype() method (which called xmlserializer ). afaik there no way "implement" iconvertible interface system.string convert idtag . know can implement proxy property i.e: public class item { [xmlattribute] public string name {get; set;} [xmlattribute("paren

Reg using Jasper reports in PHP/MySQL web application installed using XAMPP -

for our web application using php & mysql db need generate reports using jasper reports. using xampp we have installed jaspersoft ireport 5.6.0 to connect db - tried steps in ref link http://chathurangat.blogspot.in/2012/03/jasperreports-with-php.html 1) selected mysql (com.mysql.jdbc.driver) - jdbc driver (as in step no. 6) 2) please suggest need give jdbc url jdbc:mysql://localhost/databasename 3) db availabe in mysql - can accessed using phpmyadmin interface please suggest how can connect our mysql db please suggest whether need install aditionally thank you when login jasper reports server, there root on left hand side: root -> data sources. data sources -> right click. given open options. choose add resource -> data source. you select mysql odbc driver in drop down box jdbc driver: input right fields , test connection.

git - What is best practice for updating feature branches to a new base? -

i use git flow , have question best practice when branching making feature branches. if have develop main branch , 2 feature branches, 1 branched @ time t2 , other branched @ t3, should done if both feature branches not ready merge , need new develop branch or other feature branch? there way update "base" of feature 1 develop @ t2 new "base" of develop @ t3 when new has been done develop? , feature branch 2, when not ready merging, can updated new changes develop branch before merge it? feature 1 (branch) / / ----- develop ----/-----\--------------------------- \ \ feature 2 (branch) t1 t2 t3 t4 can branches somehow "moved forward" new changes in develop branch included feature branches or necessary merge first? i want complement 2 ex

ios - Adding UITextField above Keyboard -

Image
i found link how create tool bar above keyboard. don't use textfield need tap , show keyboard. idea press on "leave comment" button , keyboard text field appeared. so in link i've attached seems use inputaccessoryview of text field interact with. in case don't have text field. so first of need toggle keyboard without text field , show keyboard textfield bar above keyboard. how can make it? hello need put uitextfield outside view, this: viewcontroller.h @property (strong, nonatomic) iboutlet uitextfield *_mytextfield; viewcontroller.m uitextfield *t = [uitextfield new]; [self.view addsubview:t]; [t becomefirstresponder]; t.inputaccessoryview = _mytextfield; see result:

c# - Create a dropdownlist of checkboxes using EPPlus -

i using epplus ( http://epplus.codeplex.com/ ) create excel files in asp.net application. wondering if knows if it's possible create dropdownlist checkboxes in 1 cell. i've checked documentation, found nothing far. i've tried googling haven't found in right direction yet. this question on forum pretty demonstration of i'm looking for, hasn't received answers: http://epplus.codeplex.com/discussions/585879 does happen have ideas , can point me in right direction? you can use: var validationcell = sheet.datavalidations.addlistvalidation("a1"); validationcell.formula.values.add("a"); validationcell.formula.values.add("b"); validationcell.formula.values.add("c"); ... but can choice 1 single value. multiple values, think, not supported excel.

perl - Ordered hash of hashes - setting and accessing key/value pairs -

i want implement ordered hash value of each key value pair nested hash map. unable so. not getting errors nothing being printed. use hash::ordered; use constant { lead_id => 44671 , lag_id => 11536 , start_time => time }; $dict_lead=hash::ordered->new; $dict_lag=hash::ordered->new; open(my $f1,"<","tcs_07may_nse_fo") or die "cant open input file"; open(my $f2,">","bid_ask_".&lead_id) or die "cant open output file"; open(my $f3,">","ema_data/bid_ask_".&lag_id) or die "cant open output file"; while(my $line =<$f1>){ @data=split(/,/,$line); chomp(@data); ($tstamp, $instr) = (int($data[0]), $data[1]); if($instr==&lead_id){ $dict_lead->set($tstamp=>{"bid"=>$data[5],"ask"=>$data[6]}); } if($instr==&lag_id){ $dict_lag->set($tstamp=>{"bid"=>$data[5],"ask"

Install windows drivers using python -

i'm trying automate driver installation using python script, using batch file same task, since i'm building gui using python i'd incorporate python. i using pnputil.exe install driver: 'pnputil -i -a path_to_inf' reason can't make work in python, i've tried subprocess.call, os.system, nothing works, kind of error, using os.system can run registry commands read/write/add/remove keys, pnputil gives me errors. os.system error = 'pnputil' not recognized internal or external command, operable program or batch file. subprocess.call error = subprocess.popen(['pnputil -i -a path_to_inf'], shell=true) = filename, directory name or volume label syntax incorrect. you have use whole address of pnputil.exe execute in python.. try this subprocess.popen(['c:\\windows\\system32\\pnputil.exe -i -a path_to_inf'], shell=true) or subprocess.popen(['c:\\windows\\sysnative\\pnputil.exe -i -a path_to_inf'], shell=true)

java - AES-CTR double encryption reverses the ciphertext to plaintext -

when try encrypt ciphertext again same key, produces original plaintext. algoritm used aes counter mode . key , iv remains same. is way algorithm supposed behave? , if, use of cipher.encrytmode given first parameter of cipher.init()? here sample program tested, import javax.crypto.*; import javax.crypto.spec.ivparameterspec; import javax.crypto.spec.secretkeyspec; public class encryptiontest { public static void main(string[] args) throws exception { secretkeyspec key = null; ivparameterspec ivspec = null; byte[] keybytes = "usethiskeyusethiusethiskeyusethi".getbytes(); byte[] ivbytes = "usethisiusethisi".getbytes(); key = new secretkeyspec(keybytes, "aes"); //no i18n ivspec = new ivparameterspec(ivbytes); cipher aescipher = cipher.getinstance("aes/ctr/nopadding"); byte[] bytetext = "your plain text here".getbytes(); aescipher.init(cipher.e

html - Stop breaking words in CSS -

i want stop block breaking words (the block contains sentences without abnormally long words), added word-break: keep-all doesn't work - still breaks in middle of words. how can fix it? .example { float: left; width: 420px; display: inline-block; word-break: keep-all; } <h:panelgroup id="panel"> <x:message id="id" style="display: block" styleclass="example"/> </h:panelgroup> in css : -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; should job :) refere : https://css-tricks.com/almanac/properties/h/hyphenate/

android - Parse.com saveAllInBackground doesn't work inside deleteAllInBackground -

i trying save list of parseobjects using save in background. avoid duplices in table, querying existing rows , deleting them if , save new copy. the parseobject.saveallinbackground gets execued, callbacks getting called, no rows getting saved. i sure list passing saveallinbackground has parseobjects. i debugged methods, flow runs intended. update 1: when number of rows delete less number of rows added, newer rows persisted. meaning, rows not present in list passed deleteallinbackground method persisted. this code parsequery query = new parsequery("postchoice"); query.frompin(); query.findinbackground(new findcallback<parseobject>() { @override public void done(final list<parseobject> locallist, parseexception e) { if (locallist != null && !locallist.isempty()) { list<parseobject> postlist = new arrayli

How to convert JSON array to java object -

this json i'm sending via post request { "pids" : [ "mob123", "elec456"] } this class receives json, @post @consumes(mediatype.application_json) @produces(mediatype.application_json) @path("/getproductsinfo") public list<productdetails> getproductsinfo(productids productids) { system.out.println(productids + " "); dbcursor<productdetails> dbcursor = collection.find(dbquery.in("pid", productids.getpids())); list<productdetails> products = new arraylist<>(); while (dbcursor.hasnext()) { productdetails product = dbcursor.next(); products.add(product); } return products; } im converting json array 'productids' object, pojo class public class productids { @jsonproperty("pids") private list<string> pids; public list<string> getpids() { return pids; } public void setpids(list<stri

android - change user's name in navigation menu when user logs in -

i have navigation menu , in header of there textview shows user name when he/she logs application(like gmail app). unfortunately when user logs in loginactivity , goes mainactivity textview doesn't change , have restart app change text. (i used sharedpreferences save user name) how can solve problem?? when come mainactivity , the textview must updated. can in onresume() of mainactivity . take user's name , put in textview of navigation drawer. i think have abstract activity manages navigation drawer ? must update navigation drawer in onresume() of abstract activity , in case in activity name updated when activity come in front.

How to get substring of a string in ANT property -

i have requirement substring out of string in ant property. example string: 1=tibunit-1.4.2.projlib\= i want extract part before .projlib\= , after first = . the result should be: tibunit-1.4.2 any ideas? use script task builtin javascript engine (jdk >= 1.6.0_06) , : if need substring 'tibunit-1.4.2.projlib\' : <project> <property name="foo" value="1=tibunit-1.4.2.projlib\="/> <script language="javascript"> // simple echo println(project.getproperty('foo').split('=')[1]); // create property later use project.setproperty('foobar', project.getproperty('foo').split('=')[1]); </script> <echo>$${foobar} => ${foobar}</echo> </project> output : [script] tibunit-1.4.2.projlib\ [echo] ${foobar} => tibunit-1.4.2.projlib\ if need substring 'tibunit-1.4.2' : <project> <property name="foo&quo

python - "Can't find template" error in Django -

Image
i started learning django. followed guide on django webpage, still don't feel understood it. decided make similar myself. making similar voting system in guide, bit different. started doing reading documentations , guide text. created generic listview display index.html, show list of votings. ' this views code: class indexview(generic.listview): template_name = 'vote/index.html' model = type def get_queryset(self): return type.objects.order_by('-pub_date') here index.html code: {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static 'vote/style.css' %}" /> {% block content %} <h2>votings</h2> <ul> {% voting in object_list %} <li>{{ voting.type_name }}</li> {% empty %} <li>sorry, there not votes.</li> {% endfor %} </ul> {% endblock %} models code: from

bash - Prepare command line arguments in a variable -

i need generate images using imagemagick. reason prepare draw operation in variable before calling convert , looks this convert -size 160x160 xc:skyblue \ -fill 'rgb(200, 176, 104)' \ $draw_operations \ $0.png $draw_operations contains lines, these -draw 'point 30,50' \ -draw 'point 31,50' this call convert results in non-conforming drawing primitive definition `point` ... unable open image `'30,50'' ... ... if use $draw_operations double quotes (which required, if contains multiple lines) error is unrecognized option `-draw 'point 30,50' ' finally if put -draw 'point 30,50' is, there no error. it's not related imagemagick, rather way bash substitute variables. see bashfaq 50: i'm trying put command in variable, complex cases fail! . problem shell parses quotes , escapes before expands variables, putting quotes in variable's value doesn't work -- time quotes "are there",

c# Generics "in" keyword -

i've been assigned maintenance work on existing application. i've come across following code: public interface ientityservice<t, in tkey> { t getentitybyid(tkey id); ienumerable<t> getall(); void update(t entity); void delete(tkey key); } i'm not sure in keyword second generic argument, tkey . i came across following msdn article (should) explain me perfectly: in (generic modifier) (c# reference) however, don't truly understand it. here's says: for generic type parameters, in keyword specifies type parameter contravariant. can use in keyword in generic interfaces , delegates. contravariance enables use less derived type specified generic parameter. allows implicit conversion of classes implement variant interfaces , implicit conversion of delegate types. covariance , contravariance in generic type parameters supported reference types, not supported value types. a type can declare

php - Allowing anonymous users to upload to a specific Imgur account using Imgur api? -

i'm trying build web application allow many users upload images same album on own imgur account. is possible without need authorization anonymous user? from api documentation on oauth2 https://api.imgur.com/oauth2 states user gets redirected can authorize app inputting password. is possible when using anonymous album? or not @ all?

php - Send data to server with Volley Lib in Android -

i've developed application i'm going send data phone server json , use volley library in android. can not send data server! my simple php code : $name = $_get["name"]; $j = array('name' =>$name); echo json_encode($j); my java code : private void makejsonobjectrequest() { mrequestqueue = volley.newrequestqueue(this); string url = "http://my-site-name/sampleget.php"; stringrequest jsonobjreq = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { log.d("result:", response); toast.maketext(getapplicationcontext(), response, toast.length_short).show(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) {

xcode6.3 - Unable to run Xcode 6.3.2 on 10.11 Beta 2 -

this question has answer here: xcode 6.3.2 can't run on osx 10.11 el capitan developer preview 3 2 answers i installed second beta of 10.11 , xcode 6.3.2 has stopped running. the error is: in order open "xcode", need update latest version. the version of xcode installed on mac not compatible os x el capitan. have "xcode" 6.3.2. download version 6.3.2 free mac app store. it runs if open via terminal. /applications/xcode.app/contents/macos/xcode </dev/null &>/dev/null & thanks the poster @ developer forum had information.

cron - New instance in a cronjob php -

i want execute periodic task using php script. inside script (into cron job), trying instantiate class without success: the include works fine: include_once (dirname(__file__).\'../my/class/myobjectmgrclass.php\'); but try instantiate class, cron not work anymore: $myobjectmgr = new myobjectmgr(); "include_once()" try include file define won't stop script if doesn't exists try use require_once(), trigger fatal error if file missing. way when concatenate dirname, add , / begin of string require_once (dirname(__file__)). '/../my/class/myobjectmgrclass.php'; also don't use \ unless want escape something.

javascript - Accessing Isolated Scope of Sibling resulted from same angular directive -

i have angularjs directive produce multi select drop down complicated template. directives having isolated scope. based on dropdown click variable named open in dropdown toggling , visibility adjusted. currenly dropdown closing when dom clicked. if user clicking 2 dropdowns 1 after other, both remains open. can close, sibling dropdown, accessing scope , setting value open . how can access isolated scope of sibling originated same directive ? var directivemodule = angular.module('angular-drp-multiselect', []); directivemodule.directive('ngdropdownmultiselect', ['$filter', '$document', '$compile', '$parse', function ($filter, $document, $compile, $parse) { return { restrict: 'ae', scope: { selectedmodel: '=', options: '=', extrasettings: '=', events: '=', searchfilter: '=?', translationtexts:

html - Height set to 100% doesnt work -

on site making, one-paged site, first div should has height of 100%, isnt working, div not cover height size of screen. at moment, div (header) has weight set 650px , fine on 1336x768 resolution, not different resolutions. when set height:100%; doesnt happen, not make div have height of screen on different resolutions. i think css error, cant figure out yet. i hope can understand. body { margin: 0; font-family: 'open sans', helvetica, sans-serif; min-width: 900px; } .header { background-image: url("img/fundo1.jpg"); background-color: rgb(21, 21, 21); color: white; height: auto; min-height: 650px; position: relative; } .header .logo { width: 230px; height: 60px; margin: 20px 8px 8px 6%; } .header .menu { position: absolute; top: 55px; right: 25px; } .header .menu { margin: 0 4px; font-size: 15px; color: white; text-decoration: none; padding: 6px 20px; } .header .menu a:hover,

c# - Extension Method for Interface in Internal Class -

i trying write extensions dynamic linq . need add method signature ienumerablesignatures interface located in internal class expressionparser . internal class expressionparser { interface ienumerablesignatures { [...] } } while add signature code directly, i'd rather define extension method interface, keep original code clean. usually, add method defaultifempty , this: internal static class extension { static void defaultifempty(this expressionparser.ienumerablesignatures sig); } this gives access error though, because expressionparser internal. have tried several combinations of access level class , method. is there way add extension method such interface or have mess original code? [edit] turns out that, when making interface internal (or public matter), not recognized dynamic linq. still got not-found exception on runtime. there's no (obvious) way around editing codeplex code. [/edit] you can not since ienumerablesignature

excel - VBA to show result based on combobox value changed -

Image
i userform this: i have few criteria meet. 1. different customer have different process , specification 2. if id#(textbox1) empty, process , specification change well. 3. different customer use different g-chip carry out progress. as below code: private sub userform_initialize()combobox1.list = array("apple", "banana", "watermelon") end sub private sub textbox1_change() call cual if textbox1.value = "n/a" call custxptarray else call custwithptaluarray end if end sub sub custwithptalu() select case combobox1 case "apple" combobox2.list = array("ni", "nini") case "banana" combobox2.list = array("au", "auau") case "watermelon" combobox2.list = array("pd", "pdpd") end select end sub sub custwithptaluarray() call custwithptalu if combobox1.text = "apple" textbox2.value = iif(combobox2.val

ruby on rails - Retrieve Customer's default and active card from Stripe -

i trying retrieve default , active card of customer. (also keep in mind coding have, customer can have 1 card means if there way around it can help). some months ago used code segment working fine. seems stripe made updates , can't work now. current_user.stripe_card_id = customer.active_card.id the error is undefined method `active_card' #stripe::customer if need more information please let me know. edit: customer.default_card.id not work either. i used customer.methods check methods , found (default_source): current_user.stripe_card_id = customer.default_source works fine now. thank you

c - Memory management in OS development -

i'm not sure if question on-topic (and apologize if it's not), wonder how memory management can accomplished when creating operating system. understanding is: the os provides memory management. any programming language (above assembly, e.g. c) needs already managed memory (for stack frames , heap allocations). this sounds oxymoron. how can memory manager written if tool write needs memory manager in first place? must done in assembly? c not require managed memory. thinking of malloc library function, function (though standardised available user programs). an easy implemented memory allocation scheme following: char * free_space; void * kmalloc(size_t s) { char * block = free_space; free_space += s; return block; } // free not possible the pointer free_space must set during initialisation start of known free area of memory. might given boot loader through multiboot information. a more complex example can found in this code kernel wrote long

Ruby (rails) non-blocking recursive algorithm? -

i've written following pseudo-ruby illustrate i'm trying do. i've got computers, , want see if anything's connected them. if nothing connected them, try again 2 attempts, , if that's still case, shut down. this big deployment recursive timer running hundreds of nodes. want check, approach sound? generate tonnes of threads , eat lots of ram while blocking worker processes? (i expect running delayed_job ) check_status(0) def check_status(i) if instance.connected.true? return if instance.connected.false? , < 3 wait.5.minutes instance.check_status(i+1) else instance.shutdown return end end there not going large problem when maximum recursion depth here 3. should fine. recursing method not create threads, each call store more information call stack, , resources used storage run out. not after 3 calls though, quite safe. however, there no need recursion solve problem. following loop should well: def check_status return

Sitecore custom field treeview with multiselect -

i've created custom treeview field - multiselect treeview. this field inherited sitecore.shell.applications.contenteditor.treelist overridden method add(): public class multiselecttreelist : treelist { protected new virtual void add() { bool alert = true; if (this.disabled) return; string viewstatestring = this.getviewstatestring("id"); var treeviewex = this.findcontrol(viewstatestring + "_all") treeviewex; assert.isnotnull(treeviewex, typeof (datatreeview)); var listbox = this.findcontrol(viewstatestring + "_selected") listbox; assert.isnotnull(listbox, typeof (listbox)); if (treeviewex == null) { sheerresponse.alert("treeviewex control not found..", new string[0]); } else { item[] selectionitems = treeviewex.getselecteditems(); if (sele