Posts

Showing posts from March, 2010

C# Reflection: "Pointer" to a value-type -

short description i want know if there .net feature letting me manipulate value type obtained reflection. when calling propertyinfo.getvalue(...) on value type property want not copy, original object , manipulate it. i not allowed use unsafe pointers. long description this requirement arose because implementing webservice letting me manipulate unity3d scene graph. the scene graph might have following structure gameobject 1 vector 1.2 gameobject 2 struct 2.1 vector 2.2 a client can query following uri: get http://.../gameobject2/structproperty/someproperty this works, as simple traversing hierarchy via reflection, searching property name (e.g. struct or vector) , calling getvalue on corresponding propertyinfo, returning client. but client can query: post http://.../gameobject2/vectorproperty/xproperty e.g. 5.4 entity body. x property of vector should set 5.4 what doing @ moment traversing graph forward (like get) till find vector object. doing rec

Determining the Problematic CSS File in Firebug -

i have displayed in firebug console "networkerror: 404 not found - http://********.com/images/slider-img/ajax-loader.gif" so it's telling me can't find background image. can pinpoint css file image has been declared background-image property? i have 4-5 css files being referenced in document , manual way of finding out open each of files , find image. wondering if avoided , have firebug tell me css file culprit... firebug (as of version 2.0.x) doesn't directly show initiator of network request. requires platform support, requested in bug 563623 . so, workaround can this: switch css panel. click search field @ right side of firebug. ensure option multiple files checked. enter ajax-loader.gif => css panel switch css source containing rule containing image value. notes: there may several properties referring different images named ajax-loader.gif . should check whether path image corresponds 1 shown in error message. (within

javascript - Avoiding CORS restrictions on the Fetch API in Chrome -

i using fetch api in react+redux app this: fetch("http://news.at.zhihu.com/api/4/news/before/20160127"). the app running in chrome , set --disable-web-security argument when open chrome. however, still cors issue: fetch api cannot load http://news.at.zhihu.com/api/4/news/before/20160127 . no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:8080 ' therefore not allowed access. if use xmlhttprequest, works well. looks --disable-web-security can not work fetch api. does know how use fetch api without worrying cors issue? can not modify response header such 'access-control-allow-origin' since services not in charge. fetch('//news.at.zhihu.com/api/4/news/before/20160127', { mode: 'no-cors' }).then(function(response) { console.log(response) }).catch(function(err) { console.log(err) }); have try.

android - How to open an app from SMS -

is there possibility open activity via intent sms? can use autolink , somehow override url autolink open application or googleplay page? you can create broadcastreceiver scans incoming sms keywords, or check if sender particular number. if of checks match up, can launch activity through intent. however, keep in mind users won't if opened activity everytime got sms. in cases, should use notification.

how to use batch script to export data from oracle into excel file with column names -

this bat script: set linesize 4000 pagesize 0 colsep ',' set heading off feedback off verify off trimspool on trimout on spool &1 select * siebel.s_contact; spool off exit; then try run below command. can generate excel file data column names missing. c:\users\jy70606\documents\script>sqlplus -s geneos/password@database @c:\users\jy 70606\documents\script\daily.sql daily.csv my question is, how make columns available in excel ? your bat script contains following command remove columns set heading off you need switch on set heading on reference: https://docs.oracle.com/cd/b19306_01/server.102/b14357/ch12040.htm#i2699001

java - Text document is becoming file folder -

here class, doing wrong. why text document becoming file folder. please explain going on , how can correct it. thank you public class inputoutput { public static void main(string[] args) { file file = new file("c:/users/crypticdev/desktop/file/text.txt"); scanner input = null; if (file.exists()) { try { printwriter pw = new printwriter(file); pw.println("some data have stored"); pw.println("another data stored"); pw.close(); } catch(filenotfoundexception e) { system.out.println("error " + e.tostring()); } } else { file.mkdirs(); } try { input = new scanner(file); while(input.hasnext()) { system.out.println(input.nextline()); } } catch(filenotfoundexception e) { system.out.println("

haskell - Yesod generateFormPost - No instance for (RenderMessage master0 FormMessage) -

i tried follow screencast michael snoyman http://vimeo.com/39646807 . however, seems changes i18n causes code fail. can't find information on how solve problem on scaffolded site , can't quite make sense of information given here http://www.yesodweb.com/book/internationalization . this error get, referring code in home.hs: no instance (rendermessage master0 formmessage) arising use of `generateformpost' possible fix: add instance declaration (rendermessage master0 formmessage) in stmt of 'do' block: (formwidget, enctype) <- generateformpost noteform in expression: { (formwidget, enctype) <- generateformpost noteform; defaultlayout ($(widgetfile "notes")) } in equation `getnotesr': getnotesr = { (formwidget, enctype) <- generateformpost noteform; defaultlayout ($(widgetfile "notes")) } the information seems pretty clear, problem can't figure out how add instance declaration (renderme

sql - Adwords script - exclude campaign name -

i've used line include campaign names contains "test" this: 'where campaignname contains "test" ' how can exclude campaign name? i've tried not contains , doesn't work. if want select campaigns not contains "test" can use this: where campaignname does_not_contain_ignore_case 'test' see column operators on https://developers.google.com/adwords/api/docs/guides/awql?hl=en

pointers - Type conversion issue in C# -

i'm trying (originally comes here ) heap , pointer on c# console project. , program looks this: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.runtime.interopservices; public class win32 { [dllimport("user32.dll", charset = charset.auto)] public static extern intptr malloc(int size); [dllimport("user32.dll", charset = charset.auto)] public static extern int free(intptr region); //change intptr befroe free method int ---update--- } public class program { public unsafe void heap() { int* num1, num2, answer; num1 = win32.malloc(sizeof(int)); *num1 = 999; // 999 should value stored @ pointer num1 refers num2 = win32.malloc(sizeof(int)); *num2 = 1; // 1 should value stored @ pointer num2 refers answer = win32.malloc(sizeof(int)); *answer = *num1 + *num2; // 1000 should value of pointer answer's reference

sql - Check Missing data when id is not null or blank -

i trying check if data present id not corresponding value entire row discard output. if both value , id blank ok, , row retain in output declare @tab table ( id varchar (50), sku varchar (50), resistor_id1 varchar (50), resistor_value varchar (50), capacitor_id varchar (50), capacitor_value varchar (50), inductor_id varchar (50), inductor_value varchar (50) ) insert @tab select '1', 'bpn1256', '1033', '' , 'rma56', 'ceramic', 'pvan59', 'ferrite' union select '1', 'san9286', '' , '' , 'tma56', 'film' , '' , '' union select '1', 'rja1896', '3033', '35ohm', 'uma56', 'ceramic', 'pvan59', 'ferrite' union select '1', 'dnn5256', '4033', '45ohm', 'qma56', '' , 'pvan59', 'ferrite' union select '1

iOS Custom Url Scheme XCode -

first of all, know how make custom schemes in ios , know how open app website using javascript settimeout method. i have app uses custom url scheme , working great. is, sends http://testsite.com/querystrings message other users in contact list (predefined) , on clicking web links in sms, these things happen: open link in safari open app if installed custom url using settimeout if not installed, move normal website page what wanted open app directly sms if installed have send custom url scheme in sms, not option because if app not installed sms wont work weblink option now. today, installed soundcloud , accidentally noticed thing when http:// m. soundcloud .com /... url sent in sms , on clicking link opens app (if installed) directly not safari (strange me). so wondering how come app open web link without opening safari. googled around couldn't find solution problem. attaching screenshot mobile press , hold on link in messages app give open in "soundcloud&quo

audio - php telegram sendAudio -

i have problem sendaudio() function in php telegram bot. if (strtoupper($text) == "music") { $voice = curl_file_create('audio.ogg'); $content = array('chat_id' => $chat_id, 'audio' => $voice); $telegram->sendaudio($content); } this don't work audio lenghtof 9 or more seconds. tried .mp3 nothing. same function audio lenght of 6 or less seconds works. looked in documentation , says 50mb files restricted. pls. here's $telegram. include("telegram.php"); $bot_id = "xxxxxxx:yyyyyyyy_mytoken"; $telegram = new telegram($bot_id); and here telegram.php: class telegram { private $bot_id = "mytoken"; private $data = array(); private $updates = array(); public function __construct($bot_id) { $this->bot_id = $bot_id; $this->data = $this->getdata(); } public function endpoint($api, array $content, $post = true) { $url = 'https://api.telegram.org/bot' . $this->bot_id . '/&

ios - Add a UIMenuItem for a specific UITextView? -

i have lot of uitextview s in screen , want add new custom uimenuitem 1 of them. it possible add custom uimenuitem specific uitextview ? i use below code have custom button uitextview s uimenuitem *menuitem = [[uimenuitem alloc] initwithtitle:@"read" action:@selector(readbuttonaction)]; [[uimenucontroller sharedmenucontroller] setmenuitems:[nsarray arraywithobject:menuitem]]; thanks if want uimenuitem displayed specific uitextview can add menuitem in textfielddidbeginediting method , add specific tag uitextview custom menu item displayed :- -(void)textviewdidbeginediting:(uitextview *)textview { if(textview.tag==999) //specify textveiw want custom menu { [[nsoperationqueue mainqueue] addoperationwithblock:^{ uimenuitem *menuitem = [[uimenuitem alloc] initwithtitle:@"read" action:@selector(readbuttonaction)]; [[uimenucontroller sharedmenucontroller] setmenuitems:[nsarray arraywithobject:menuitem]]; }]; } }

Android studio manifest file all red -

Image
everything went red after integrated google login. it seems don't have google_maps_key in string.xml you have add or remove call of string

android - ActionBar app icon as home -

i want app icon in top left return when pressed, i'm using setdisplayhomeasupenabled(true); and arrow icon appears, pressing doesn't anything, why? here's oncreate: @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); android.app.actionbar ab = getactionbar(); ab.settitle("aritmetik"); ab.setdisplayhomeasupenabled(true); setlistadapter(new arrayadapter<string>(aritmetik.this, android.r.layout.simple_list_item_1, classes)); } you have override onoptionsitemselected() . @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: // app icon in action bar clicked; go home intent intent = new intent(this, homeactivity.class); intent.addflags(intent.flag_activity_clear_top); startactivity(intent); return true;

html - Line that goes from end of text to end of block on middle of height -

i have headings , want add line goes end of text in heading end of heading block. line should in middle of line height. something +---------------+ | text ----| +---------------+ a pseudo-element ideal that: h1 { overflow: hidden; position: relative; } h1::after { content: ""; position: absolute; top: 50%; width: 100%; height: 2px; transform: translatey(-50%); margin-left: .25em; background-color: red; } <h1>some text</h1> modern version (using flexbox instead of positioning) h1 { overflow: hidden; display: flex; align-items: center; } h1::after { content: ""; flex: 1; height: 2px; margin-left: .25em; background-color: red; } <h1>some text</h1>

Android swipe and tabs ui - what is "best practice" and up to date? -

Image
i have used in past " android actionbar fragmentpageradapter , viewpager " seems little out of date - there newer, more advanced/better guideline/technique stuff ? android 4.4 for example: private viewpager viewpager; private tabspageradapter madapter; private actionbar actionbar; and tabspageradapter class: public class tabspageradapter extends fragmentpageradapter { frontendcontroller context; wearlistfragment wearlistfragment; mobilelistfragment mobilelistfragment; favouritelistfragment favouritelistfragment; advancedcontrolfragment advancedcontrolfragment; controlfragment controlfragment; setupfragment setupfragment; statusfragment statusfragment; public tabspageradapter(fragmentmanager fm,frontendcontroller context) { super(fm); this.context =context; } // "setup", "advanced","favourite","status","control", "mobile",

javascript - Angularjs routing controller from another module -

im building big app , , structure goes this: each module has own folder structure controllers, directives, etc... each folder has index.js file , other files separates each controller, each directive, etc... the index.js file contains definition of module. instance controllers of businessmodule above: angular.module('mycompany.businessmodule.controllers', []); there's no dependencies here, there any. then in firstctrl.js, can reuse module , add controller it: angular.module('mycompany.businessmodule.controllers').controller('firstctrl', function(){ }); then app.js aggregates module want application adding them dependencies array. angular.module('myapp', ['mycompany.businessmodule', 'mycompany.anotherbusinessmodule'],'ngroute'); now comes route include other modules view. route goes like: var myapp = angular.module('myapp'); myapp.config(function($routeprovider) { $routeprovide

TFS build 2015 fails to trigger coded ui tests - part of continuous integration process -

we have come across issue tfs build fails trigger coded ui tests, based on how test settings file specified in build definition. we have been unable codedui test project run. goal have run on separate machine (virtual machine). have configured test controller , agent on vm. have set run interactive process. when run build partially succeeds , following test error reported the failure message returned below: mstestadapter failed discover tests in class ‘mvc_test.mvctest_cui’ of assembly ‘c:\builds\1\test_coe\mvcappframework\bin\mvc_test.dll’. reason not load file or assembly ‘microsoft.visualstudio.qualitytools.codeduitestframework, version=12.0.0.0. culture =neutral, publickeytoken=b03f5f7f11d50a3a’ or 1 of dependencies. system cannot find file specified.. setup / environment details: visual studio 2015 ultimate tfs server 2015 agents visual studio 2015(test controller , test agents) test agent installed interactive process coded ui tests your codedui t

system - write error: No space left on device in embedded linux -

all have embedded board, run linux os. , use yaffs2 rootfs. run program on it, after times, got error "error no space left on device.". checked flash, there still have lot free space. write config file. config file update. program write log flash. log size limited 2m. don't know why, , how solve. me please!(my first language not english,sorry. hope understand say) some debug info: # ./write_test version 1.0 close file :: no space left on device return errno 28 # cat /proc/yaffs yaffs built:nov 23 2015 16:57:34 device 0 "rootfs" start_block........... 0 end_block............. 511 total_bytes_per_chunk. 2048 use_nand_ecc.......... 1 no_tags_ecc........... 1 is_yaffs2............. 1 inband_tags........... 0 empty_lost_n_found.... 0 disable_lazy_load..... 0 refresh_period........ 500 n_caches.............. 10 n_reserved_blocks..... 5 always_check_erased... 0 d

c# - How to add runat=server attribute to html buttons -

i have multiple html buttons generated server side method on csharp class. result is: <button id='btn1' runat='server' onserverclick='btn_click'>apply</button> <button id='btn2' runat='server' onserverclick='btn_click'>apply</button> <button id='btn3' runat='server' onserverclick='btn_click'>apply</button> ... <button id='btnn' runat='server' onserverclick='btn_click'>apply</button> i add btn_click event behind code: protected void btn_click (object sender, eventargs e) { string id = (sender control).clientid; msg = id; } as can see want buttonid when click on of buttons, btn_click won't call , can't buttonid. i using asp.net website c#4.0. the problem need generate buttons using server side , runat attribute doesn't work method . how can fix problem? method body generated buttons for (int = 0; < dt.r

web services - Startup time of webservice -

i have wcf web service running in iis. lot of load work in service constructor namespace wcfservice_myservice { [servicebehavior(instancecontextmode = instancecontextmode.single)] public class service1 : iservice1 { public service1() { trace("service starting"); ...load work... trace("service ready accept requests"); } ... more functions... } } but service restarted when hasn't finish load yet. have log files , see service restarted. suppose because takes 7 seconds start , suppose because iis thinks not responding creates new one. correct? can tell iis wait longer? i don't want have thread load because don't want accept requests until loaded. , told loading process long never more 10 seconds. any ideas? thanks

c# - WebClient.FileDownlOad GIVIn error that the file a is accessed by another process -

i trying download file using webclient method downloadfile giving me error that process cannot access file '...\d915877c-cb7c-4eeb-97d8-41d49b75aa27.docx' because being used process. but when open file clicking it, opening. there same question requesting same info none accepted answers. any appreciated it may os not letting file go. whatever after searching lot unable find solution here code create file document d = new document(); d.save(httpcontext.current.server.mappath(@"invoice\" + iname + ".docx")); i using aspose word dll and following way accessing it using (var client = new system.net.webclient()) { client.usedefaultcredentials = true; client.downloadfile(server.mappath("invoice/" + request.querystring["id"].tostring() + ".docx"),server.mappath("invoice/" +request.querystring["id"].tostring() + ".docx")); client.dis

Public/Private keys for Google developers service account -

i've been going on while , can't manage understand how obtain public/private keys automatically created service account in google developers console. i making python script imports data using gspread google spreadsheet, , authenticate myself through signedjwtassertioncredentials need existent service account the issue is: i create new project using: "create project" but when go permissions/permissions, see the service account need created, don't have keys it. i want know how @developer.gserviceaccount.com keys since have tried importing data google spreadsheets using other @xxx-22324.iam.gserviceaccount.com no luck, says email address not exist. edit: whenever go api manager / credentials possibility generate key @mxxx-22324.iam.gserviceaccount.com (the 1 can't use) i solved issue: google has updated service account detail format , it's way of sharing spreadsheets service accounts can accessible gspread. i created servic

android - CSS for printing purposes from mobile devices -

i'm building app android print web page bluetooth printer problem dimensions of divs , font sizes changing screen resolution another, 10.1 tab 4.7 inch phone , 3.5 i tried use units: pt, em, px... one solution make resolution specific sheets, way!!!

AngularJS: Debounce. Fire changes to apply on click -

there input debounce, 'clear' btn (to clear input) , 'use' btn (to use input value). : <input ng-model="*" ng-model-options="{ debounce: 1000 }" /> for proper 'clear' btn work $rollbackviewvalue() used (here) <button ng-click='formname.$rollbackviewvalue();vm.clear()' /> but approach can used 'use' btn? how fire changes apply on click (before debounce interval ended)? for 'use btn' use $commitviewvalue() <button ng-click="userform.username.$commitviewvalue(); setvalue()">setvalue</button> just example <form name="userform"> <label>name: <input type="text" name="username" ng-model="user.name" ng-model-options="{ debounce: 1000 }" /> </label> <button ng-click="userform.username.$commitviewvalue(); setvalue()">setvalue</button

java - Upload image File to server wich work on php -

i want upload image file mobile phone on android server. have url , must send image file in filed 'file' use robospice robospice-google-http-client . code this: public class loadfileonserverrequest extends googlehttpclientspicerequest<loadfilemodel> { hashmap<string, object> postparam; public loadfileonserverrequest(file file) { super(loadfilemodel.class); postparam = new hashmap<>(); postparam.put("file", file); setretrypolicy(null); } @override public loadfilemodel loaddatafromnetwork() throws exception { genericurl genericurl = new genericurl("http://testwb/ajax_scripts/file.php"); httpcontent content = new urlencodedcontent(postparam); httprequest request = buildpostrequest(genericurl, content); request.setparser(new jacksonfactory().createjsonobjectparser()); httpresponse response = request.execute(); return response.parseas(getresulttype()); } private httprequest buildpos

.htaccess - Openshift DIY cartridge site is downloading php files instead of running them -

i have openshift app diy cartridge have bunch of php , html files in $openshift_repo_dir/diy folder. html files in folder displayed on browser. however, php ones downloaded browser instead of being executed. are php files not allowed run in diy cartridge or doing wrong? .openshift folder empty, except cron folder (i've added cron cartridge app too). i've looked @ this question, .htaccess workaround doesn't work in case. it seems like have php interpreter on diy cartridge. can inspire example here , on how install apache php on diy cartridge. here can find avenue using nginx.

jQuery UI Autocomplete on KeyPress write value -

i trying implement jquery ui autocomplete way like when have list "alpha","beta","gamma" type "a" input field , "alpha" proposal want hit enter , "alpha" shall be new value of input field instead of selecting "alpha" mouse click. possible? $.ajax({ url : 'myajax.php', type : 'post', data : { param: getdata }, datatype : 'json', success : function(data) { $("#myfield").autocomplete({ minlength: 0, source: data, focus: function( event, ui ) { $(this).val(ui.item.key); return false; }, select: function( event, ui ) { $("#myfield").val(ui.item.value); return false; } }); } }); you can add aut

$http header 'Content-Type' not appending in the header - AngularJS -

Image
i'm using $http request , wanted append 'content-type': 'application/json' in header. if don't append header 415 (unsupported media type) error thrown. i'm using apache 2.2.13 proxypass, in i not requestheader append content-type "application/json" . if put requestheader configuration in apache $http.get works fine , 'content-type' appended. scenario 1 : using $http , trying request request : $http({ method: 'get', headers: { 'content-type': 'application/json'}, url: '/items/?customerid=5656' }); chrome network tab : scenario 2 : using restangular , trying same request request : restangular.setdefaultheaders({'content-type': 'application/json'}) restangular.setbaseurl('/items') restangular.all('').getlist({customerid: '103020'}, {'content-type': 'application/json'}); chrome network tab : the other inter

c# - Skip expression bodied property in debugger -

is there analog of [debuggerstepthrough] attribute available expression-bodied properties in c# ? for example want skip on code public byte bytearray => builder.createarray(); [debuggerstepthrough] can not applied properties. c# team provide other solution in c# 6.0 ? debuggerstepthrough isn't valid expression bodied properties this: [debuggerstepthrough] public byte bytearray => builder.createarray(); doesn't compile. does: public byte bytearray { [debuggerstepthrough] { return builder.createarray(); } } there other debugger attributes debuggerhidden , debuggernonusercode , don't disable step-through. you can disable properties in debugging options, there's no way imo configure expression-bodied properties.

Azure PowerShell 1.0 - Where is Get-AzureSBNamespace? -

i've been following blog create service bus namespace on azure using powershell 1.0. however, after logging azure using cmdlet login-azurermaccount (as described here ) , attempting use cmdlet get-azuresbnamespace returns null reference exception, i.e., get-azuresbnamespace : object reference not set instance of object. looking @ documentation powershell 1.0, there appears no reference cmdlets service bus services on azure, i.e., get-azuresbnamespace . does azure powershell 1.0 support azure service bus (specifically eventhubs)? i followed following link create service bus event hub , created succesfully. as mentioned in above comments cant assign event hub resouce group comes under add-azure account cmd. https://azure.microsoft.com/en-in/documentation/articles/service-bus-powershell-how-to-provision/

php - Symfony - permissions (rights) instead of roles -

i implemented user registration/login schema in symfony 3.x project. based implementation on http://symfony.com/doc/current/cookbook/doctrine/registration_form.html (among others). well, works, it's based on roles, , want change permissions, like: "can_edit", "can_post", "can_delete" etc. it doesn't work roles, there no such thing "role hierarchy", besides logic behind controlling user access bit more complicated editing security.yml -> access_control. so how can accomplish this? btw, did is: reading this: http://symfony.com/doc/current/cookbook/security/voters.html :) creating tables "permission" , "user_permission". "permission" table has id , "symbol" (text) column (e.g. value == "can_post"). user_permission has "user_id" , "permission_id" fields. i created "permission" entity (i use orm), , modified user entity, joined "permissi

c# - Adding custom argument to rest callback action -

i've ran problem programming basic tool listing few 'items' (and respective price on ingame auction-house) video-game in wpf-window. i price trend specific item (id) last 30 days rest-service delivers me this: [{"timestamp":"1453892281000","buy":"3411","sell":"3791"},{...},...] i'm requesting price trend around 100 items @ time (all async) , when handling responsedata class fields of response through restsharp. problem can't match responsedata item rest-response doesn't deliver me one. there way add id (integer) action/callback? public static void getitempricehistory(int itemid, listingsview view) { var request = new restrequest("itempricetrend/" + itemid); action<list<restitempricehistory>> ariph = view.processitempricehistory; executeasync(request, ariph); } public static void executeasync<t>(restrequest request, action<t> callback) t : new()

entity framework 6 - Improve long running EF query with AsNoTracking -

i'm using entity framework v6.1.3 , 1 query tacking > 10s run application. takes < 1s when adding asnotracking() call: public ilist<job> getbyerpheaderids(string[] headerids) { return base.query() .include(j => j.preferredbranch) .include(j => j.jobtype) .include(j => j.technicians) .include(j => j.gmcjobstates) .where(j => headerids.contains(j.erpserviceorderid)) .asnotracking() .tolist(); } the getbyerpheaderids() method gets array 400 elements. problem need save database after modify items retrieved query. down context use following code manage entities state: public virtual void save(tentity entity) { if (_context.entry(entity).state == entitystate.detached) { if (entity.isnew) { _dbset.add(entity); } else { var cachedentity

android - Create custom View with horizontal RecyclerView and a custom border (with movement listener) -

i need create custom view, represents horizontal recyclerview border around it. border's left , right sides draggable on recyclerview items. it's ui video trimming. understand need create like: public class customview extends recyclerview { .... ondraw(canvas cancas) { // , there should code draw borders like: paint paint = new paint(); paint.setcolor(color.red); paint.setstrokewidth(1.5f); paint.setstyle(paint.style.stroke); canvas.drawrect(0, 0, getwidth(), getheight(), paint); .... } } edit: example how be inside pink border should recyclerview images inside. want do. for horizontal view, final staggeredgridlayoutmanager layoutmanager = new staggeredgridlayoutmanager(1, staggeredgridlayoutmanager.horizontal); mrecyclerview.setlayoutmanager(layoutmanager); & border use custom drawable.

xslt - Copying a node from a custom function -

i need remove duplicate values following xslt. 2 nodes should equal if attributes equal. solution i've come first occurrence of component name(0 preceding siblings). if there no following siblings directly copy node. if there following siblings nodes including current node in variable. process variable code below find unique occurences , copy node when found. problem copying node <xsl:copy-of> function not seem work. suggestions on how this? xml <component name="compa"> <group> <field name="field1" required="y"> <field name="field2" required="n"> <field name="field3" required="y"> </group> </component> <component name="compb"> <group> <field name="field1" required="n"> <field name="field2" required="n"> <field name=&q

r - Fusing dfs with equal dimmensions -

i fuse 3 data frames ( aa , ab , bb ) contain same dimensions , never contain number in same coordinate (if 1 contain number others contain na . can true specific coordinate contain na data frames). input: aa <- 'pr_id sample1 sample2 sample3 ax-1 na 120 130 ax-2 na na na ax-3 na na na' aa <- read.table(text=aa, header=t) ab <- 'pr_id sample1 sample2 sample3 ax-1 100 na na ax-2 na 180 na ax-3 na 120 na' ab <- read.table(text=ab, header=t) bb <- 'pr_id sample1 sample2 sample3 ax-1 na na na ax-2 150 na na ax-3 160 na na' bb <- read.table(text=bb, header=t) my expected output: fus <- 'pr_id sample1 sample2 sample3 ax-1 100 120 130 ax-2 150 180

php - CakePHP Minify plugin and denying access to original files under webroot -

we use cakephp 2.7.9 , minify plugin on centos server running apache 2.2. https://github.com/maurymmarques/minify-cakephp the plugin works fine , can minify css files this. echo $this->minify->css(array('default', 'global')); the code above generates url this. http://example.com/min-css?f=default.css,global.css and want deny access original files under webroot/css. how can done in cakephp? want return 404 or 401 or direct url access this. http://example.com/css/default.css and want deny access original files under webroot/css simply don't non public code , files public webroot. it's not recommended in case. point minifier files , set output folder webroot. we use task runners , keep minification code outside of actual app. stuff doesn't belong application - imho. we use php robo , on js side gulp minification , automatically trigger tasks on deployment. our scss , js files outside of webroot. have few asset include

c# - ReactiveValidatedObject with DataAnnotation force revalidation of property -

i trying validate property if property set true. using requiredifattribute taken webpage. [requiredif("propertya",true)] public string propertyb { { return _propertyb; } set { this.raiseandsetifchanged(x => x.propertyb, value); } } requiredif attribute checking if propertya set true validate otherwise skips validation , return success. it's working charm problem works if propertyb changed doesn't know needs refresh when propertya changed. trying force update when propertya changed this: this.observableforproperty(x => x.propertya).subscribe(obj => { this.raisepropertychanged(x=>x.propertyb); }) but doesn't work - nothing happens. think it's ignored because value has not changed. there approach works rather workaround solution: this.observableforproperty(x=>x.propertya).subscribe(obj => { var temp = propertyb; propertyb = "anything"; //it forces revalidation propertyb =

Eclipse debugging Android app - debugger shows wrong line executing -

while implementing twitter integration in app, discovered following oddness of eclipse debugger. causing this? i'm using asynctask getting request token twitter using twitter4j 3.0.3. public class twitterrequestasync extends asynctask<void, void, requesttoken> { private context context; public twitterrequestasync(context context) { this.context = context; } @override protected requesttoken doinbackground( void... params ) { twitter twitter = gettwitter(); // gettwitter() in enclosing class try { requesttoken token = twitter.getoauthrequesttoken(); return token; } catch (twitterexception e) { log.e( tag, e.getmessage(), e ); return null; } } @override protected void onpostexecute( requesttoken result ) { super.onpostexecute( result );

Using php preg_match to get an id from forum quotes -

i've been using preg_match try , id quote in forums have written. have far. $quote = '[quote]19[\quote] reply quote.'; $get = '/([quote])([0-9])([\quote])/'; $id = ''; preg_match($get, $quote, $id); echo $id[0]; unfortunately doesn't give me result hoping , have tried many variations , tried preg_replace in hopes might give me need after lot of reading on stack overflow think preg_match way go. can't seem want id in between quote tags. my experience preg limited @ best , i've tried best try work unfortunately beyond current knowledge assistance appreciated. hints [ , ] used character class delimiters. they must escaped \[, \] when taken literally. the definition [0-9] means this: character class of digits. (…) brackets embrace result group. if wish extract numeric data between [quote] , [\quote] ([0-9]*?) should in brackets. result in $id[1] (group # 1). the backslash "\" character in [\quote] must es

javascript - Split Date Wed Jan 27 2016 02:14:05 GMT+0200 (GTB Standard Time) -

i have date (wed jan 27 2016 02:14:05 gmt+0200 (gtb standard time) , want split in order take hours (02:14:05). how can that? thank you var date = new date('wed jan 27 2016 02:14:05 gmt+0200 (gtb standard time)'); var time = ('0' + date.gethours()).slice(-2) + ':' + ('0' + date.getminutes()).slice(-2) + ':' + ('0' + date.getseconds()).slice(-2); console.log(time);

javascript - How to add margin to table in jquery datatables? -

i need add space between table, table length , table pagination. this: enter link description here js code: $(document).ready(function () { $('#data-table').datatable({ bfilter: false, aocolumndefs: [ { bsortable: false, atargets: [1, 2], }, { 'bvisible': false, atargets: [4], }, { "targets": 0, "render": function (data, type, full, meta) { return '<a href = "@(url.action("employeeaccount", "company"))?employeeid=' + full[4] + '">' + data + '</a>'; } }, ] }) }); html: <table class="table table-striped table-bordered table-hover little_margin_table" id="data-table" wi

attributes - Web Api Autofac InstancePerRequest -

i have custom authorizationfilter attribute on web api project this [attributeusage(attributetargets.class | attributetargets.method, allowmultiple = false)] public class genericauthenticationfilter : authorizationfilterattribute { /// <summary> /// public default constructor /// </summary> public genericauthenticationfilter() { } private readonly bool _isactive = true; /// <summary> /// parameter isactive explicitly enables/disables filter. /// </summary> /// <param name="isactive"></param> public genericauthenticationfilter(bool isactive) { _isactive = isactive; } /// <summary> /// checks basic authentication request /// </summary> /// <param name="filtercontext"></param> public override void onauthorization(httpactioncontext filtercontext) { if (!_isactive) return; var identity = fetchau