Posts

Showing posts from September, 2015

iphone - UIScrolview Prioritize vertical and horizontal scrolling -

i've scenario using list of views scrolls horizontally, pagination. , each view has tableviews scrolls vertically. issue when want scroll vertically. hardly allows me that. vertically it's fine. can arrange in way vertically scrolling should have higher priority horizontal? both should accessible. well, have uiscrollview horizontal scroll , couple of uitableview s inside pages? think issue lays in uiscrollview intercepts vertical pan gesture. try disable vertical scrolling uiscrollview , should help.

wireshark - USB mapping with python -

while reading ctf write-ups came across script #!/usr/bin/env python import struct import image import dpkt init_x, init_y = 100, 400 def print_map(pcap, device): picture = image.new("rgb", (1200, 500), "white") pixels = picture.load() x, y = init_x, init_y ts, buf in pcap: device_id, = struct.unpack("b", buf[0x0b]) if device_id != device: continue data = struct.unpack("bbbb", buf[-4:]) status = data[0] x = x + data[1] y = y + data[2] if (status == 1): in range(-5, 5): j in range(-5, 5): pixels[x + , y + j] = (0, 0, 0, 0) else: pixels[x, y] = (255, 0, 0, 0) picture.save("riverside-map.png", "png") if __name__ == "__main__": f = open("usb.pcap", "rb") pcap = dpkt.pcap.reader(f) print_map(pcap, 5) f.close() and

java - What is the equivalent of @Value in CDI world? -

what way 1 inject property value property placeholder cdi bean? in spring 1 write: @org.springframework.beans.factory.annotation.value("${webservice.user}") private string webserviceuser; what sets webserviceuser field property webservice.user property file/property placeholder. how cdi? i've tried find answer, couldn't find equivalent. however, people write, can use cdi spring substitute on application servers, , use case basic, surely there must easy way, unfortunately i've failed find it. cdi specification dependecy injection , context doesn't have such configuration things out of box. provides powerful extension mechanism allows third party projects add new portable features (i.e works cdi implementation , not tied server). important project providing cdi extensions apache deltaspike , news, provides need. so need add deltaspike-core in project. if use maven, need add dependencies pom.xml <dependency> <group

c++ - nodejs socket.io closes connection before upgrading to websocket -

i'm trying write c++ client talk websocket server written using nodejs , socket.io. can't c++ client establish websocket connection; server drops connection right after client requests http connection upgraded websocket. i used tcpdump watch packets going , forth. when use websocket server browser, works great , tcpdump output shows packets going , forth. when try connect server using c++ client, websocket connection never gets established. output tcpdump shows upgrade request being sent server followed server dropping connection. i tried replicating sequence of events using nc . connected server (running on port 8080) , copy-pasted exact set of headers sent browser, captured tcpdump. duplicate of working headers, connection dropped. there no output on server end indicating why connection gets dropped. here headers sent: get /socket.io/?type=player&eio=3&transport=websocket&sid=7mdclht_8ctsd6f4aaac http/1.1 host: localhost:8080 connection: upgrade prag

python - PyQt: Label not showing correct number of length -

i making quiz application in pyqt4, there 3 main generators: incorrect , correct , timeout . all answers connecting scorecheck function: def scorecheck(self, sendercheck): if ( sendercheck == self.answ ) or ( sendercheck == self.answ1 ) or ( sendercheck == self.answ5 ) or ( sendercheck == self.answ7 ) or ( sendercheck == self.answ8 ) or ( sendercheck == self.answ10 ): self.wronganswers.append(1) elif ( sendercheck == self.answ2 ) or ( sendercheck == self.answ4 ) or ( sendercheck == self.answ9 ): self.correctanswers.append(1) elif sendercheck == self.tmr3: self.timeouts.append(1) print "worked" print len(self.timeouts) else: pass self.wronganswerlabel = qtgui.qlabel(str(len(self.wronganswers)), self) self.wronganswerlabel.setgeometry(220, 40, 200, 200) self.wronganswerlabel.setobjectname('wronganswercount') self.wronganswerlabel.setstylesheet("#wronganswercount { font-size

Deploying Qt Application on Android is really slow? -

as may know there 3 ways deploy qt application on android : use ministro service install qt deploy local qt libraries temporary directory bundle qt libraries in apk the first method takes 30 seconds , needs install apk . ministro . second takes 1 minute me ! , anytime try run program qt creator pushes qt libraries device. third 1 makes .apk file big , again takes 1 minute me. think situation that's not reasonable develop android application using qt. there way make deploying process faster? almost full year since op , things have not changed @ all. deployment of 7 mb apk takes on minute , half project compiles in 5 seconds. reason answering not problem got resolved, offer alternative solution. i've implemented "workaround" consisting of 2 applications work in tandem - 1 on pc , 1 on device - created compile files remotely, turned out faster alternative deployment well. on host create application launches compilation in separate process, when do

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

i trying rename upload image permission denied @ sys_fail2 - (d:/ror/projects/grp/public/uploads/gallery/test.jpg, d:/ror/projects/grp/public/uploads/gallery/qinsnvzicc20160509132021.jpg) my code : photo = params[:gallery][:gal_img] name = photo.original_filename directory = "#{rails.root}/public/uploads/gallery/" path = file.join(directory, name) uniq_name = (0...10).map { (65 + rand(26)).chr }.join time_footprint = time.now.to_formatted_s(:number) file.open(path, "wb") |file| new_file_name = uniq_name + time_footprint + file.extname(file) file.write(photo.read) @uniq_path = file.join(directory, new_file_name) file.rename(file, @uniq_path) end i have checked , giving privilege in ruby directory. please let me know why getting permission denied error?

installer - ClickOnce publish with different update locations for customers -

i have wpf application needs go out lots of customers. want give them files can distribute users install. have program update automatically. i thought clickonce way go have come problems. work fine if update locations same not, customer choose files go, either web site or file share. way can see of using way create different versions each customer update path set, not acceptable. i considering wix installer instead, require lot more work clickonce wondering if there way accomplish want using clickonce first? i'm facing same scenario, , guess should let customers create , sign own deployment menifest specifies update location. see walkthrough here: http://msdn.microsoft.com/en-us/library/bb384246.aspx

python - How can i get union of 2D list items when there occurs any intersection (in efficient way)? -

i have 2d list in python list = [[9, 2, 7], [9, 7], [2, 7], [1, 0], [0, 5, 4]] i union of list items if there occurs intersection. example [9, 2, 7] , [9, 7] , [2, 7] has intersection of more 1 digit. union of [9,2,7] . how can final list follows in efficient way ? finallist = [[9,2,7], [0, 1, 5, 4]] n.b. order of numbers not important. you have graph problem. want build connected components in graph vertices elements of sublists, , 2 vertices have edge between them if they're elements of same sublist. build adjacency-list representation of input , run graph search algorithm on it, or iterate on input , build disjoint sets. here's slightly-modified connected components algorithm wrote a similar question : import collections # build adjacency list representation of input graph = collections.defaultdict(set) l in input_list: if l: first = l[0] element in l: graph[first].add(element) graph[element].add(first)

Django Updating Existing Model field -

i have model in django foreign key django user model. trying update model form, database isn't updating. can't figure out problem. model.py from django.conf import settings class userinfo(models.model): username = models.charfield(max_length = 30) owner = models.foreignkey(settings.auth_user_model,on_delete=models.cascade,) form.py from django import forms society.models import userinfo class editform(forms.modelform): username=forms.charfield(widget=forms.textinput(attrs={'onchange': 'this.form.submit();', 'class': 'editinput'})) class meta: model = userinfo fields ='__all__' views.py django.shortcuts import render society.models import userinfo django.contrib.auth.models import user society.forms import editform def profileview(request): user = request.user username = userinfo.objects.get(owner=user)

c++ - Could not locate deviceQuery on my installation Cuda toolkit v7.5 on Windows 10 -

as going through installing cuda v7.5 following link http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/#compiling-examples i not able verify installation described in section 2.5. verify installation. reason because not find devicequery program should have been located in c:\programdata\nvidia corporation\cuda samples\v7.5\bin\win64\release therefore, not run devicequery cuda verified. devicequery program located ? still precompiled , deployed installation ? no, it's not precompiled more. you have compile (build) application first, before can run it. that true cuda samples now.

android - How to get orderId for an autorenewable transaction using Google Play Developer API? -

i've developed android application, in inapp subscription done play store billing version v3. , implemented google play developer api retrieve subscription status whether autorenewable or not. the method of google play developer api returns autorenewable status along other details such expiry time, start time etc. couldn't find possible solution retrieve order id of subscription used backend processing. transaction id google play developer api from? thanks in advance. you don't need orderid, need "base orderid" , can generate current orderid starttime , expiretime from developer android ( https://developer.android.com/google/play/billing/billing_subscriptions.html#administering ): subscription order numbers to track transactions relating given subscription, google payments provides base merchant order number recurrences of subscription , denotes each recurring transaction appending integer follows: gpa.1234-5678-9012-34567 (base order num

How to simplify the @import path for my npm sass package? -

situation i have developed small sass package , published on npm . to use package in project npm install , import main file so: @import 'node_modules/my-package/my-package.scss'; this works. question is possible allow users import so? @import 'my-package'; or @import 'my-package.scss'; i think saw packages allow this. possible? any kind of appreciated! with gulp , gulp-sass, people can specify includepaths .pipe(sass({ includepaths: [ './node_modules/your-package-name' ] })) this tell compiler includes appending path import compiling. then in *.scss files need do @import "your-package-name"; or @import "your-package-name/variables"; otherwise, don't think it's possible similar setup - after all, it's url, unless pre-processing, need specify full path it

jquery - How to display the error message -

when click button want validate fields , if there errors, want show user error message on top. i validating not able show error message. problem?. $(document).on('click', '#button', function() { var firstname = $('#fname').val(); alert(firstname); var lastname = $('#lname').val(); if (firstname.val() == '') { $("#error").append("please enter first name"); } else if (lastname.val() == '') { $("#error").append("please enter last name"); } }); <div data-role="content" style="padding: 15px;margin-top:21px"> <p id="error"></p> <label for="text">first name:</label> <input type="text" name="text" id="fname"> <label for="text">last name:</label> <input type="text" name="text" id="lname"&g

java - Is it possible to use EclipseLink HistoryPolicy to track user activity? -

i using eclipselink historypolicy track changes on entities , entities have createdby , updatedby properties. with of these properties , eclipselink history queries, can user's activity related specific entity on time? for example -user1 created employee id of 34 @ 2016-04-22 13:53:44 -user2 updated employee id of 34 @ 2016-05-04 17:25:21 etc. if not, how can achieve task in efficient way?

java - Unsatisfied dependency expressed through constructor argument with index 0 -

i getting following error. have mentioned java code related error. error following error getting caused by: org.springframework.beans.factory.beancreationexception: not autowire field: private java.util.list com.hp.ccue.serviceexchange.rest.orderutilsresource.orderutils; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'saworderutils' defined in url [jar:file:/opt/hp/propel/sx/web-inf/lib/sx-adapter-saw-2.20-snapshot.jar!/com/hp/ccue/serviceexchange/adapter/saw/util/saworderutils.class]: unsatisfied dependency expressed through constructor argument index 0 of type [com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor]: : no qualifying bean of type [com.hp.ccue.serviceexchange.adapter.saw.sawoperationexecutor] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {}; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no

javascript - Popup no working when page change -

i have popup ajax call him table , works until perform new query changes data in table . if 'll call not work, not error(out success) my javascript <script type="text/javascript"> var thedialog = $('#my-dialog').dialog({ autoopen: false, modal: true, closeonescape: false, height: screen.availheight - 100, width: 1100, show: 'fade', hide: 'fade', resizable: 'false' }); var mydialogprogress = $('#my-dialog-progress'); var mydialogcontent = $('#my-dialog-content'); function showeventregistrantsummary(id, ui) { $.ajaxsetup({ cache: false }); mydialogprogress.show(); thedialog.dialog('open'); mydialogcontent.html(''); $.ajax({ url: 'home/popup?id=' + id + '&ui=' + ui, type: 'get', ca

sql server - SELECT MAX(column) AND DISTINCT by one of two columns in MS SQL -

using ms sql server 2014. need select row (userid=1 or memberid=1) has max(messageid) value messages user #1 sent or received messages ordered messageid desc i tried solution here: how can select rows max(column value), distinct column in sql? , since user can send or receive messages, solution partly solves problem. message table messageid userid memberid message created -------------------------------------------------------------- 9 4 1 hi 9 2016-05-09 01:50:59.423 8 4 1 hi 8 2016-05-09 01:50:43.950 7 1 4 hi 7 2016-05-09 01:50:35.310 6 1 4 hi 6 2016-05-09 01:50:25.887 5 1 2 hi 5 2016-05-08 23:49:41.610 11 2 1 hi 11 2016-05-09 03:26:42.267 12 1 3 hi 12 2016-05-09 05:06:11.030 1 1 2 hi 1 2016-05-08 22:37:57.803 expected result messageid userid memberid me

javascript - AjaxToolkit Not Displaying(INTERNET EXPLORER) -

i making use of line chart , bar chart ajax control toolkit(version 16.1). chats display correctly on system(internet explorer , chrome) when deploy application server chats displays on chrome. not show in internet explorer. on local machine internet explorer version 12 , google chrome 50.0.2661.94 . <ajaxtoolkit:barchart id="barchart1" runat="server" chartheight="250" chartwidth = "450" charttype="column" charttitlecolor="#0e426c" visible = "true" categoryaxislinecolor="#d08ad9" valueaxislinecolor="#d08ad9" baselinecolor="#a156ab"> </ajaxtoolkit:barchart> web page in chrome web page in internet explorer

spring - What are the Integration frameworks available. -

is jbi, sca considered integration framework. integration framework available. jbi , sca different technologies. comment on sca. if "integration framework" mean technology assists in connecting services, say, yes. fabric3 (an sca runtime) uses precise terms: http://docs.fabric3.org/

css - input:hover+label override important styles [only IE11 bug] -

look @ code: color: red!important; doesn't work in ie11 [windows 10]. in brauser looks fine, how should be, please check. input:hover+label { color: green; } label:hover { color: red!important; } <input placeholder="what friends call you?" id="fname" /> <label for="fname">first name</label>

Android receive and send message -

i have 1 activity , 1 ordinary class, activity 1 receive message , ordinary class send message. how implement it: in activityone.class @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); public mhandler = new handler() { public void handlemessage(message msg) { super.handlemessage(msg); switch (msg.what) { case 10: toast("get message 10"); break; case 1: toast("get message 1"); break; } } }; } public void toast(string text) { toast.maketext(activityone.this, text, toast.length_short).show(); } and in ordinary.class how code sendemptymessage(1) ? you can use it edit: public class testapplication extends application{ private handler handler = null; public void sethandler

angularjs - Setting a page name depending on which view is active -

i have single page application, have display view in ng-view active. each view has own controller presume have communicate somehow change value of span. so far tried playing around scopes , emit/broadcast nothing works. in angular, cross-controller communication done using service "general" data page title, subtitle, , such...

R Shiny: Check if and which dropdown menu has been clicked within observe() -

i'm building shiny application in users can filter data based on 5 dropdown menus. menus should behave excel's filter function, e.g.: choose option in menu #1, filter data other 4 menus depending on input of first menu. choose option in menu #2, filter again other inputs menus, (and thats important) keep input of menu #1 selected and(!) filtered based on new input. in first try, coded structure 5 observeevent() functions, 1 each dropdown menu. worked, produced loads of code, filter , update mechanics quite big. i'm revising code , thought collapse 5 observeevent() functions 1 observe() function, major part of filter mechanism completly equal 5 menus. the problem encountering need function tells me input field has changed. flush event checks input fields in observe() function. test is.null() can't used, empty dropdown menu "change" needs checked (e.g. user changed mind , doesn't want filter menu #1) example code error occurs , function "is.

android - Implement click only on image not on text in custom listview -

i have custom listview contains image & text , implemented onitemclicklistener list should work image not text. onitemclick working fine image there fatal exception when click on text. additionally image visible in list if exists else hide. tried android:focusable="false" , android:clickable="false" still getting below exception java.lang.nullpointerexception: attempt invoke virtual method 'android.graphics.bitmap com.bumptech.glide.load.resource.bitmap.glidebitmapdrawable.getbitmap()' on null object reference onitemclick: @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { final imageview imageview1 = (imageview) view.findviewbyid(r.id.imagelist); final glidebitmapdrawable bitmapdrawable = (glidebitmapdrawable) imageview1.getdrawable(); final bitmap yourbitmap = bitmapdrawable.getbitmap(); dialog builder = new dialog(this); builder.requestwindowfeature(window.feat

html - How can I get the CSS-Transforms to work -

i got pretty annoying problem, looking @ transformation -> translate. currently, fading in navigation "blocks" right left. now, want hover effect on every single one, when hover on it, block translates right little bit. for used code: .navpoint:hover { -webkit-transform: translate(20px, 0px); -moz-transform: translate(20px, 0px); -o-transform: translate(20px, 0px); -ms-transform: translate(20px, 0px); transform: translate(20px, 0px); } this should work, looking @ demo, blocks aren't bothered move right. here demo i have feeling set not right, please have @ html setup first: <div class="navigation"> <h2 class="animated fadeinrightbig1 navpoint one">working process</h2> <h2 class="animated fadeinrightbig2 navpoint two">subscribe</h2> <h2 class="animated fadeinrightbig3 navpoint three">contact us</h2> </div> explaination: "animated" general animation, cust

php - How to take time as an input in Laravel? -

i want take input time am/pm using laravel controller mysql. problem have taken time blade view while seeing output using dd() it's showing following value. carbon {#213 ▼ +"date": "2016-05-09 00:00:00.000000" +"timezone_type": 3 +"timezone": "utc" } means nothing save start value. here model: class room extends model { protected $table='allocate_rooms'; } here view i've used: <div class="form-group"> <label>from</label> <input type="time" name="start" class="form-control" required > </div> here controller i'm using. public function allocateroom(request $request) { $room = new room(); $room->start =carbon::parse($request->input('start')); dd($room->start); $room->save(); } in database have used time datatype star

r - Recursive sum, using Poisson distribution -

i trying build recursive function in r, h(x,t) = \sum\limits_{d=0}^{x} (pr(d=d)*(h*(x-d)+h(x-d,t-1))) + \sum\limits_{d=x+1}^{\infty} (pr(d=d)*(p(*d-x)+ h(0,t-1))) where h,p constants, d ~ po(l) , h(x,0) = 0, code have done far, gives obvious error, can't see fix. code p<- 1000 # unit penalty cost lost sales h<- 10 # unit inventory holding cost pr. time unit l<- 5 # mean of d h <- function(x,t){ if(t==0)(return(0)) fp <- 0 sp <- 0 for(d in 0:x){ fp <- fp + dpois(x=d,l)*(h*(x-d)+h(x-d,t-1)) } for(d in x+1:inf){ sp <- sp + dpois(x=d,l)*(p*(d-x)+h(0,t-1)) } return(fp+sp) } when run this, error is error in 1:inf : result long vector which, seems obvious, question is, can point me in direction redefine problem, can r bring me solution? thanks in advance. going x+1:inf won't work. since you're using poisson's pdf, can add upper bound (why? think shape of pdf , how small values @ right tail): for(d i

php - removing blockquote from Wordpress post -

i have following function puts content on page (images removed) <?php $content = preg_replace('/(<img [^>]*>)/', '', get_the_content()); $content = wpautop($content); // add paragraph-tags $content = str_replace('<p></p>', '', $content); // remove empty paragraphs echo $content; ?> i want remove blockquotes content not sure how adjust code you can try : $content = preg_replace('/<blockquote>(.*?)<\/blockquote>/', '', get_the_content());

php - OOP not being initiated into variable for later object access -

i have feeling stupid mistake had me stalled last 24 hours; have class works on every other page use on. using very small version of class while creating ipn listener paypal subscriptions. the problem i'm having after creating new instance of class in variable (the exact same way on other pages), , try access it, receive error saying i'm trying use non object variable object. the condensed version; creating new instance of class: $utilities = new utilitys(new db("mysql:host=xcensored;dbname=xcensored", "xcensored", "xcensored")); using object $a = $utilities->db->run("select * xcensored xcensored =:id", array(':id' => (int)trim($xcensored))); error log message php notice: undefined variable: utilities in xx/xx/xx/xx.php php notice: trying property of non-object in xx/xx/xx/xx.php php fatal error: call member function run() on non-object in xx/xx/xx/xx.php looks you're using 'ut

Enable CPU Monitoring Metrics in Azure -

i have 3 azure services - standard .net application deployed one, wcf service , third windowsservice. i have enabled verbose logging on instance (but not changed code support logging). 3 connected same azure storage account. the .net instance logging cpu , memory metrics fine. the wcf instance logging memory usage not cpu. likewise windowsservice logging memory usage not cpu. i can't understand difference - (2) , (3) show flatlined cpu know not case (as can remote box , see cpu usage manually). does have ideas on difference is? thanks! i recommend watch "monitoring, management & devops in windows azure" https://channel9.msdn.com/(a(-6u-pjh5zaekaaaanmjly2izmgitzwmzns00mwu0lwixnmetntnkmdmxzdbmyjgyubegdshfweu7r941495i4kaqxyq1))/events/build/2013/3-558

sql - Best way to upsert from external app -

i have application uses bulk insert put data oracle database table. need change it, upserts it, have hard time finding best solution this. sites suggest using merge insert/update rows, it's effective , simplest solution, examples base on data in table. what best solution change? using kind of temporary or staging table necessary, or there way skip this? merge can used constant values well. however due oracle's lack of support values() row constructor gets bit ugly: merge the_table using ( select 1 id, 'arthur' name dual ) t on (t.id = the_table.id) when matched update set name = t.name when not matched insert (id, name) values (t.id, t.name); this can used multiple rows: merge the_table using ( select 1 id, 'arthur' name dual -- first row union select 2, 'ford' dual -- second row union select 3, 'zaphod' dual -- third row ) t on (t.id = the_table.id) when matched update set name = t.name when no

matlab - 3d plot of wave function -

Image
how can plot wave function n=a*cos(k*x-w*t) in matlab in 3d simulation? code used was: k=0.05; f=100; w=2*pi*f; a=1; x=[-5:1:5]; t=[0:2:20]; n=a.*cos(k.*x-w.*t); surf(x,t,n); to plot surface need mesh of data. x,t created line, there single t every x , surface has multiple t every x . if change definition of x , t to: [x,t]=meshgrid(-5:1:5,0:2:20); your code runs , plots:

java - How to load values into the same JSP page on button click event -

i have jsp page 1 button "load" , 2 textfields - "weather" , "companions". on click of button should call controller , controller has load values typed in textfields table of same jsp page. how can that? when click on "load", nothing happens. jsp page <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <html> <head> <title>test 1</title> </head> <body> <h2>context information</h2> <table> <tr> <td><form:label path="weather">weather</form:label></td> <td><form:input path="weather" /></td> </tr> <tr> <td><form:label path="companions">companions</form:label></td> <td><form:input path="companions" /></td> </tr> </table>

jquery - How to append data in a div with the save data? -

how append data in div ?i have div show data text file in div .now want append data from previous data .how append data ? <div id="realtimecontents" class="realtimecontend_h"></div> i read data save data that. reader.onloadend = function (evt) { $("#realtimecontents").text(evt.target.result); }; now want append data using not appending ? function nativepluginresulthandler(result) { $('#realtimecontents').html(result); } use .append() $('#realtimecontents').append(result); http://api.jquery.com/append/

php - Image not showing on image slider -

Image
hello im creating dynamic image slider image not showing. can upload image in file directory. don't know problem if database problem or what. i'm new html , css php. can give me ideas caused of not showing images? here image not showing can upload file gallery file directory. here database sql. here php code. <?php //for connecting db include('connect.php'); if (!isset($_files['image']['tmp_name'])) { echo ""; } else { $file=$_files['image']['tmp_name']; $image= addslashes(file_get_contents($_files['image']['tmp_name'])); $image_name= addslashes($_files['image']['name']); move_uploaded_file($_files["image"]["tmp_name"],"gallery/" . $_files["image"]["name"]); $photo="gallery/" . $_files["image"]["name"]; $query = mysqli_query($mysqli, "insert images(photo)values('$photo')"); $result =

c# - Distribute columns evenly in WPF DataGrid -

i have window set sizetocontent="widthandheight" , in window there row of controls want define width of window. underneath controls datagrid 3 columns. however can't seem evenly distribute 3 columns same size , use space available. there way in c#.net? you can via databinding. example: <window x:class="wpfapplication2.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" sizetocontent="widthandheight"> <stackpanel orientation="vertical"> <stackpanel orientation="horizontal" x:name="panel"> <label content="1" width="90"/> <label content="2" width="90"/> <label content="3" width="90"/> </stackpanel> <datagrid width="{binding ac

php - Cakephp 3.0: Turn off or disable Stack Trace runtime for specific controller -

i using cakephp 3.0 framework , need disable/turn off stack trace if exception or error occurs. i tried solution given on turn on /off debug mode particular controller in cakephp . if make change in myproject\config\app.php file, stack trace turned off controllers if set trace = false using following code specific controller error.trace set false stack trace not disabled. <?php namespace app\shell; use cake\core\configure; use cake\console\shell; configure::write('error.trace', false); class myclassshell extends shell { public function main() { echo 'error.trace...' . configure::read('error.trace'); // output false ... } } ?> its weird see if error.trace false still stack trace printed. is other way disable stack trace in cakephp 3.0 specific controller/shell file instead of setting app.php ? error options being read once like of other options, error options not runtime changeable via configure class.

cuda - Lock reading/writing for rows in two dimension array in global memory -

i have 2 dimensional array , there threads update rows in array. may 2 or more threads need update 1 row @ time. need lock threads trying access same row if there thread updating it. if threads need update 1 element in row simple atomic operation (e.g. atomicadd() ) should it. if related operations must performed on multiple elements of row, need implement sort of "critical section" control. example: #define row_count 10 __global__ void the_kernel( ... ) { // block-level shared array indicating locking state of each row __shared__ int locks[ row_count ]; // initialize shared array if ( threadidx.x == 0 ) memset( locks, 0, sizeof( int ) * row_count ); __syncthreads(); // suppose current thread need update row #3 int row_idx = 3; // thread-local variable indicating whether current thread has access target row bool updating = false; { // return value atomiccas 0 when no other thread updating row #3 // o

arrays - Converting byte[] to string[] in c# -

i have byte array of length 56 , converted string using function: str = bitconverter.tostring(bytes).replace("-", ""); now, need copy first twenty characters of "str" string "keydata" or string[] , when use array.copy(str, 0, keydata, 0, 20); i error stating parameter needs string[] , not string how past this? string anotherstring = str.substring(0, 20); or array arr = str.substring(0, 20).toarray();

Magento 2 API: How do I list products as a customer or anonymous user -

i'm build mobile app uses magento 2 rest api. in can add products cart , complete order. seems me cant list products or categories customer or guest user. admin can that. error get { "message": "consumer not authorized access %resources", "parameters": { "resources": "magento_catalog::categories" } } is there way can use "/v1/products" api customer or guest? i guess other option have build own customer api lists products/categories anonymous users. there specific settings allow anonymous user access hidden rest api endpoints: configuration > services > magento web api > web api security. select yes allow anonymous guest access menu. reference: http://devdocs.magento.com/guides/v2.0/rest/anonymous-api-security.html

oracle - sql developer time format -

i have add column db oracle sql developer. column needs format hh:mi:ss , when set column timestamp, convert me column : dd-mm-yy hh:mi:ss , if change nls settings . you can change preferences follows: go tools > preferences . in preferences dialog, select database > nls left panel. from list of nls parameters , enter hh:mi:ss timestamp format field. save , close dialog.

How to get string value from string array in Android -

i trying create application reads nfc tag , checks tag against strings in string array , sets text on activity. have got working checks if string exists , sets text in new activity, want able specify string want check against within array, because there multiple strings in nfc tag want display in new activity. have tried it: result == getresources().getstring(r.string.test_dd) here relevant code: string[] dd; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); dd = getresources().getstringarray(r.array.device_description); } @override protected void onpostexecute(string result) { if (result != null) { if(doesarraycontain(dd, result)) { vibrator v = (vibrator)getsystemservice(context.vibrator_service); v.vibrate(800); intent newintent = new intent(getapplicationcontext(), tabstest.class);

ios - didUpdateToLocation is never called -

i want pass information location of user function uses it. delegate class mylocation singleton stores information. but in code didupdatetolocation never gets called . should n't called @ least once whenever startupdatinglocation called if device stationary? i did check if locationmanager.location.coordinate.latitude , locationmanager.location.coordinate.longitude have right values , do. location services enabled , user permission access location services granted. still building ios 5. none of given solutions seem work me! can please give me idea why not working? the code follows: cllocationmanager *locationmanager; clgeocoder *geocoder; clplacemark *placemark; @implementation mylocation { } + (id)getinstance { static mylocation *sharedmylocation = nil; static int i=0; if(i==0){ sharedmylocation = [[mylocation alloc] init]; i=1; } return sharedmylocation; } - (id)init { if (self = [super init]) { latitude = [[n