Posts

Showing posts from August, 2011

c# - Retrieve data from the entity framework table in my execute method -

i need data table have created using entity framework. right now, web api project responsible generate table out of test data i've created. the web api project has folder called dal bookingscontext class in. looks this: public class bookingscontext : dbcontext { public bookingscontext() : base("bookingscontext") { } // dbset bookings public dbset<booking> bookings { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.conventions.remove<pluralizingtablenameconvention>(); } } if create instant of class in controller, can call dbset method bookings database. the problem have created class library called getbookings. responsible bookings database. the class should data database table getallbookingsquery. // generic interface public interface iquery<out t> { t execute(); } class getallbookingsquery : iquery<list<booking>> { // list of b...

ruby on rails - How to configure sequence separator with underscore `_` of friendly_id gem -

i using friendly_id gem version 3.3.3.0 in rails 3.2 i have defined friendly id following :- class user < activerecord::base has_friendly_id :name, use: :slugged, sequence_separator: '_', max_length: 32 end i have used sequence separator _ but when execute query on console separating using _ (underscore) works fines -- (double dash) i have 3 user cached_slug user_1 user_2 , user_3 when trying find records cached slug generates following query. using - _ (underscore) for - `user_1` user.find("user_1") select sluggable_id slugs ((slugs.sluggable_type = 'user' , slugs.name = 'user_1' , slugs.sequence = 1)) - `user_2` user.find("user_2") select sluggable_id slugs ((slugs.sluggable_type = 'user' , slugs.name = 'user_2' , slugs.sequence = 1)) - `user_3` user.find("user_3") select sluggable_id slugs ((slugs.sluggable_type = 'user' , slugs.name = 'user_3' , slugs.sequence = 1)...

RichTextBox handling with custom ScrollBar in C# -

recently i'm on form project custom gui. (metroframework) has own textbox component, prefer richtextbox. problem uses windows legacy scrollbar if set visible. don't want use this. luckily framework has own scrollbar component skin want. can set richtextbox no scrollbar (scrollbars property set none) , set independent custom scrollbar docked right richtextbox. didn't find solution how derive or attach custom scrollbar control legacy richtextbox if behaviors rtb's built in scrollbar. tried manually. when populate rtb, can calculate custom scrollbar minimum, maximum, smallchange, largechange properties can set scrollbar thumb size. achieved emulate scrolling method cathich custom scrollbar's scroll event scroll rtb's text content vertically (only need vertical scroll) interop services (user32.dll): private void metroscrollbarrichtextboxmain_scroll(object sender, scrolleventargs e) { uint npos = (uint)metroscrollbarrichtextboxmain.value * (uint)math.round(...

c# - Get items from PageList -

i using project pagedlist ( https://github.com/troygoode/pagedlist ) on asp.net mvc project , have following: pagedlist<testmodel> models = _service.get(2, 20); the service return pagedlist need create list items in pagedlist , without paging metadata. i tried following ilist<testmodel>)models.getenumerator() no success. how can pagedlist converted list? try using system.linq; models.tolist() the return type list<testmodel> .

c# - Entity Framework missing ef designer from database -

i running vs 2010 sp1. installed nuget package manager , there installed entity framework 6. however when add "ado.net entity data model" , go wizard see 2 options under "choose model contents" generate database empty model why not seeing these other options? ef designer database empty ef designer model empty code first model code first database

c# - Get all Area, Controller and Action as a tree -

i need areas has been registered list , of controllers sub list , same thing actions. this: adminarea homecontroller index add ... othercontroller ... anotherarea homecontroller index ... ... i have checked answer of this question, , one , not i'm looking for. first 1 return routes has been registered , second 1 return controllers @ once. update ok, below code can areas , answer of second question can controllers, can't figure out each controller belong area. var areanames = routetable.routes.oftype<route>() .where(d => d.datatokens != null && d.datatokens.containskey("area")) .select(r => r.datatokens["area"]).tolist() .distinct().tolist(); so here came with, it's wanted. hope helpful. public virtual actionresult index() { var list = getsubclasses<controller>(); // controllers actions var getallc...

html - make rectangular image appear circular with CSS without making pictures look out of shape -

Image
each post on page has picture , want make rectangular image appear circular, doing code below effect, image looks out of shape: can fix this? #circular img { width: 280px; height: 300px; border-radius: 150px; margin:35px; -webkit-border-radius: 150px; -moz-border-radius: 150px; background: url(http://link-to-your/image.jpg) no-repeat; box-shadow: 0 0 8px rgba(0, 0, 0, .8); -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .3); -moz-box-shadow: 0 0 8px rgba(0, 0, 0, .3); } here's screenshot of random image: one of options use image background , set this https://jsfiddle.net/jl5ek6e8/ <div class="circle" style="background-image:url(http://vignette1.wikia.nocookie.net/joke-battles/images/4/40/18360-doge-doge-simple.jpg/revision/latest?cb=20151209161638)"></div> .circle { width:300px; height:300px; border-radius:50%; border:2px solid white; box-shadow: 0 0 20px rgba(0,0,0,.3); backgr...

java - MOXy - Automatically unmarshal correct class from a list of classes -

is possible make unmarshaller select correct class deserialize list of classes? moxy jaxbcontext (it correct one, double checked this) created both classes referenced, everytime unmarshaller creates first class mentioned. regardless content provide. see example files further information. the xml content loaded xml api (the eve online xml api if information required), response might error or valid response object. structure of responses looks this: error response <?xml version='1.0' encoding='utf-8'?> <eveapi version="2"> <currenttime>2015-07-20 21:13:14</currenttime> <error code="106">must provide userid or keyid parameter authentication.</error> <cacheduntil>2015-07-21 09:13:14</cacheduntil> </eveapi> valid response <?xml version='1.0' encoding='utf-8'?> <eveapi version="2"> <currenttime>2015-07-19 14:58:36</currenttime...

android - It is possible to get a .aar with a Product flavor -

i work on big project @ work, have been herited 3 months ago. @ moment project structure : engine : library entire code (all java classes) extern libraries app : android project wrapper have 2 declinaisons-flavor of app (different name , icon commercial purpose). engine lib integrated app. additionnaly, build engine .aar 1 client use library without app wrapper. my big problem : last developepr of project dont know gradle , android structure, strange res added twice in engine , app/ build script / extern lib added twice... so, before work on new major version, want refator build system , simplify ! in best world, want delete lib project, add engine code app, have 1 project app , use power of flavors managing specifics parts. if have flavors : one two lib it possible use flavor "lib" .aar ? if have solution simplify or resolve problem, im over. in advance :) having, has described it, single application module outputs both .aar , .apk not pos...

How to allow Ejabberd external XMPP component to send presence packets on behalf of a user -

i wrote external component ejabberd, when trying send presence stanzas on behalf of user 400 error. the component's name bot.domain.com , host name in ejabberd domain.com , have set "check_from" flag false component. below example of presence stanza trying send component on behalf of user: <presence from="user@domain.com"> <status>test status</status> <show>dnd</show> </presence> and error message returned ejabberd: <presence type="error" to="user@domain.com"> <status>test status</status> <show>dnd</show> <error code="400" type="modify"> <bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> </error> </presence> if add to="user2@domain.com" in package i'm sending, destination user receives package. if add to="domain.com", don't 400 error anymo...

asp.net - Checkbox in Repeater (Categories SubCategories Filtering) -

i tried 2 main category in repeater using checkbox , have no problem when try subcategories on same database table (using checkbox.checkchanged) first checkbox not responsing second working without problem. how can fix situation? checbox filtering may not still needs fix. list.aspx <asp:repeater id="rptcat" runat="server"> <itemtemplate> <ul> <li> <asp:checkbox id="main_cat" runat="server" type="checkbox" oncheckedchanged="main_cat_checkchanged" autopostback="true" text='<%# eval("cat_name") %>' data-id='<%# eval("cat_id") %>' /> </li> </ul> </itemtemplate> </asp:repeater> <asp:repeater id="sub_cat" runat="server"> <itemtemplate> ...

Is this one-hot encoding in TensorFlow fast? Or flawed for any reason? -

there few stack overflow questions computing one-hot embeddings tensorflow, , here accepted solution: num_labels = 10 sparse_labels = tf.reshape(label_batch, [-1, 1]) derived_size = tf.shape(label_batch)[0] indices = tf.reshape(tf.range(0, derived_size, 1), [-1, 1]) concated = tf.concat(1, [indices, sparse_labels]) outshape = tf.reshape(tf.concat(0, [derived_size, [num_labels]]), [-1]) labels = tf.sparse_to_dense(concated, outshape, 1.0, 0.0) this identical code in official tutorial: https://www.tensorflow.org/versions/0.6.0/tutorials/mnist/tf/index.html to me seems since tf.nn.embedding_lookup exists, it's more efficient. here's version uses this, , supports arbitrarily-shaped inputs: def one_hot(inputs, num_classes): tf.device('/cpu:0'): table = tf.constant(np.identity(num_classes, dtype=np.float32)) embeddings = tf.nn.embedding_lookup(table, inputs) return embeddings do expect implementation faster? , flawed other reason? ...

c - Prevent line being printed to command line pipe to file -

the title maybe little confusing.. here attempt of explaining it: i have command program: c file1.txt > file2.txt this command in commandline takes first file , pipes output of program (that printed) second file. so im scanning user message in: printf("enter message:"); char *message = malloc(sizeof(char) * 256); scanf("%s", message); printf("your message is: %s", message); but prints both printf(...) statements piped file, whereas want second one. how can prevent this? thanks! one way use stderr information don't want copied output file: fprintf(stderr, "enter message:");

postscript - EPS inside EPS as a link - any alternative to "run" command? -

maybe dumb question have 0 experience in postscript/eps , need (try and) solve problem got (the functionality worked in past...so told). under windows 7 x64. the requirement asks link eps file inside eps file. way done using "run" command along "translate" , "scale" in order fit child.eps parent.eps. (this done java class) consider following (simplified) example: %!ps-adobe-3.0 epsf-3.0 %!ps-adobe epsf-3.0 %%boundingbox: 0 0 800 200 /courier findfont 70 scalefont setfont 10 10 moveto (hello world!) show %%eof the above works fine if, before %%eof , add (child.eps) run i quite strange behaviors (tried on 3 windows pcs exact same results): adobe illustrator cs5 (v15) works ok(ish)...it works if illustrator not open , double-click file. if open illustrator first use file -> open dialog open eps file, fails "unknown error" adobe illustrator cs6 fails open file "unknown error" (all time) gsview (with ghostscrip...

c# - Create a PDF from retrieved data, and return the PDF to the browser WITHOUT a third party tool? -

ok, i'm trying take information database, , convert info pdf, without using third-party tool. i've googled this, , tried several different incarnations. closest i've gotten this: [httpget, actionname("getthepdf")] public void createthefile() { response.buffer = true; response.clear(); response.clearcontent(); response.clearheaders(); string mystring = "lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla ac eleifend nunc, eget consequat arcu."; byte[] bytes = system.text.encoding.utf8.getbytes(mystring); response.contenttype = "application/octet-stream"; response.addheader("accept-ranges", "bytes"); response.addheader("content-disposition", "inline; filename=testdoc_1.pdf"); response.addheader("content-length", mystring.length.tostring()); response.binarywrite(bytes); response.flush(); } which doesn't work on https. ...

qt - CMake doesn't find Qt5QuickCompiler -

i'm trying build qt quick controls application cmake . use following documentation: http://doc.qt.io/qtquickcompiler/qquickcompiler-building-with-cmake.html when running cmake , i'm getting error: by not providing "findqt5quickcompiler.cmake" in cmake_module_path project has asked cmake find package configuration file provided "qt5quickcompiler", cmake did not find one. not find package configuration file provided "qt5quickcompiler" of following names: qt5quickcompilerconfig.cmake qt5quickcompiler-config.cmake at line: find_package(qt5quickcompiler) obviously cmake doesn't find qt5quickcompiler . checked in qt folder (c:\qt) it's not there. yet run application qmake . what need set in order find qt5quickcompiler ? the error pretty clear: cmake doesn't have module qt5quickcompiler find it. doesn't know is. i've checked corresponding cmake folder , doesn't have file. i'm not ...

html - Firefox not displaying CSS updated via JavaScript -

i'm implementing sort of progress bar using html/css using 1 div inside another: <div class="composite-player-duration"> <div class="composite-player-duration-amount"></div> </div> the inner div should grow inside outer div horizontally. here less style divs , javascript function implements progress: style.less .composite-player-duration { -webkit-transform: translatey(40px); -webkit-transition: 0.3s ease; background-color: rgba(0, 0, 0, 0.2); bottom: 0; left: 0; position: absolute; right: 0; top: 0; transform: translatey(40px); transition: 0.3s ease; } .composite-player-duration-amount { -webkit-transition: 0.1s; background-color: orange; float: left; height: @height0; opacity: 0.5; transition: 0.1s; width: 0%; } player.js function startcount() { playpausebutton.classname = 'composite-playpause fa fa-pause'; timer = setinterval(function() { played = video.currenttime; ...

MySQL: Multiple Running Totals from Different Subqueries -

when run single query using following formula have first column give month/year, second give number of people signing per month, , third give running total of signers, works great: set @runtot1:=0; select 1rt.month, 1rt.1signed, (@runtot1 := @runtot1 + 1rt.1signed) 1rt (select date_format(str_to_date(s.datecontacted,'%m/%d/%y'),'%y-%m') month, ifnull(count(distinct case when s.surveyid = 791796 s.id else null end),0) 1signed table1 s join table2 m on s.id = m.id , m.current = "yes" str_to_date(s.datecontacted,'%m/%d/%y') > '2015-03-01' group month order month) 1rt with query above, following results table, want if needed count 1 thing: month 1signed 1rt 2015-03 0 0 2015-04 1 1 2015-05 0 1 2015-08 1 2 2015-10 1 3 2015-11 1 4 2016-01 0 4 2016-02 0 4 but can't figure out how multiple subqueries since need happen multiple columns @...

ajax - MVC5 not passing JSON property names through to view -

Image
i'm starting out mvc, json, ajax, etc , side project have been trying create data viz dashboard. today followed guide on how pass simple table of data sql json view: http://techfunda.com/howto/292/list-records-using-json it worked: jsonresult comes through controller , contains values not property names . causes problem because i'm referencing property names when process data display in javascript. here's sql data: here's model: public partial class vw_dash_chartdata : ienumerable<object> { [key] [jsonproperty(propertyname = "classification")] public string classification { get; set; } [jsonproperty(propertyname = "count")] public int count { get; set; } public ienumerator<object> getenumerator() { yield return classification; yield return count; } system.collections.ie...

MS Access 2010: erratic behaviour for pivot chart (maybe Win8.1 related) -

i have pretty simple graph form, displays results data table in db. graph included subform in another, i'm running timer nothing running exe generate csv, replacing data in data table via csv import , requeries graph. on development machine runs flawlessly. now, on production machine, form runs fine 6-7 times out of ten, remaining runs, graph subform empty. there's no error message whatsoever. the behaviour not timer-related, same happens when triggered manually, it's better observable timer. not restricted subform either, when subform empty, opening graph form can either show diagram or not. issues problem might related to: production running win 8.1, development win 7 objectname tracking disabled on db, caused problems graph form or import (the import table objectname causing problems) did observer similar behaviour? upgrading win8 win10 help, if that's culprit?

PHP how to spilt two array -

i have array like: array(2) { ["y"]=> string(1) "a" ["z"]=> string(3) "1,2" } i want print them as: array(2) { ["y"]=> string(1) "a" ["z"]=> string(1) "107"},array(2) { ["y"]=> string(1) "a" ["z"]=> string(1) "2"} here code: $a = explode(",",$row['z']); assuming want print like... array(2) { ["y"]=> string(1) "a" ["z"]=> string(1) "1"} array(2) { ["y"]=> string(1) "a" ["z"]=> string(1) "3"} ... then should work. $rowsplitted = array(); $zvalues = explode(',', $row['z']) $yvalue = $row['y'] foreach ($zvalues $zvalue) { $rowsplitted[] = array( 'y' => $yvalue, 'z' => $zvalue, ]; }

php - return NULL; vs. return; -

this question has answer here: should function use: return null;? 6 answers i wonder if there differences in php . lets assume have following function(s) public function myfunc() { // logic here return; } and here: public function myfunc2() { // more logic here return null; } i understand, returning "" (an empty string) different null . var_dump() on each of these functions returns null. internally (bitwise or comparison) somehow handled differently? does affect parsing-time? practice write return null or more convention? i didn't studied source code of php, developer i'm using return null when function should return value (by design) , simple return when need leave function not returning value.

jquery - What is "+newcolor+" in CSS -

Image
<html> <head> <title>the jquery example</title> <script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type = "text/javascript" language = "javascript"> $(document).ready(function() { $(".inner").click(function () { var newcolor = $(this).css('background-color'); $("#destination").wrap("<div class = 'newinner' style = 'border:2px solid "+newcolor+"';></div>"); }); }); </script> <style> .inner{ margin:10px;padding:12px; border:2px solid #666; } .newinner{ padding:20px;} </style> </head> <body> <p>click on square below see result:</p> <div class = "inner" id = "destination">this tes...

python program to manipulate a list of items using class -

i newbie python oop concept. need write program manipulate list of items(add, delete , display) using class. without class got output in way : def add(): b=input("how many inputs? : ") print b if b==1: in1=input("enter item : ") a.append(in1) else: in2=input("enter items : ") a.extend(in2) print def delete(): c=input("which item delete? ") global a=[x x in if x != c] print def display(): print ans=true global a=[1,2,3,5,2] while ans: print (""" 1.add items 2.delete items 3.display items 4.exit/quit """) ans=raw_input("what do? ") if ans=="1": add() elif ans=="2": delete() elif ans=="3": display() elif ans=="4": print("\n goodbye") exit() else: print("\n not valid choice t...

algorithm - Calculate "moving" Covariance -

i've been trying figure out how efficiently calculate covariance in moving window, i.e. moving set of values (x[0], y[0])..(x[n-1], y[n-1]) new set of values (x[1], y[1])..(x[n], y[n]). in other words, value (x[0], y[0]) gets replaces value (x[n], y[n]). performance reasons need calculate covariance incrementally in sense i'd express new covariance cov(x[1]..x[n], y[1]..y[n]) in terms of previous covariance cov(x[0]..x[n-1], y[0]..y[n-1]). starting off naive formula covariance described here: [ https://en.wikipedia.org/wiki/algorithms_for_calculating_variance#covariance][1] all can come is: cov(x[1]..x[n], y[1]..y[n]) = cov(x[0]..x[n-1], y[0]..y[n-1]) + (x[n]*y[n] - x[0]*y[0]) / n - avg(x[1]..x[n]) * avg(y[1]..y[n]) + avg(x[0]..x[n-1]) * avg(y[0]..y[n-1]) i'm sorry notation, hope it's more or less clear i'm trying express. however, i'm not sure if sufficiently numerically stable. dealing large values might run arithmetic overflows or other (for e...

javascript - Export large html table to excel -

Image
i want export html table excel i'm using javascript code: var tabletoexcel = (function () { var tds = document.getelementsbytagname("td"); var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/tr/rec-html40"><meta http-equiv="content-type" content="application/vnd.ms-excel; charset=utf-8"><head><!--[if gte mso 9]><xml><x:excelworkbook><x:excelworksheets><x:excelworksheet><x:name>{worksheet}</x:name><x:worksheetoptions><x:displaygridlines/></x:worksheetoptions></x:excelworksheet></x:excelworksheets></x:excelworkbook></xml><![endif]--></head><body><table x:str>{table}</table></body></html>' ...

selenium - Find XPath with known value using c# -

i attempting write automated smoketest internal corporate website using c# , selenium webdriver. the problem website dynamically generated using lot of dojo javascript. contains frames , popups. o_o so everytime page loaded normal element attributes randomized , never consistently same. the order randomized. the known constant inner text contained within these tags. example 1 (initial page load): <div id="23"> <span id="random40">known text one</span> <span id="random41">known text two</span> <span id="random42">known text three</span> </div> example 2 (subsequent page load): <div id="random 11"> <span id="random45">known text three</span> <span id="random46">known text one</span> <span id="random43">known text two</span> </div> as can see in examples ...

itextsharp - Highlighting text with PdfObject as only reference -

i'm using itextsharp , have pdfobject contains text, want highlight. more specifically, have stream object used external object (a form xobject ) in 1 or more pages. able create pdfstamper instance, need actual coordinates of object set color. what's best approach go this? i able parse pdf using renderlistener wondering if possible iterating through xobjects.

php - Credit Card data capturing and verfication -

i making website client of ours want customers able book appointments on new wordpress site creating. problem want capture customer's credit card details can charge card fee if not turn up. i have been looking time no luck. have ideas on how can capture data without charging customer immediately. thanks in advance. the problem want capture customer's credit card details can charge card fee if not turn up. storing cc account info illegal, unless conform strict federal , state laws storing such data. besides, there no reason write own payment gateway , conform security requirements site , server. google "payment gateway" , read. you'll find different payment processors cc's , purchase orders, ways bill through web interface @ processors, plugins wordpress, , plugins allow automatic/reoccurring billing, etc.

sql - How to return a query summing similar appearance? -

i want query group identical column , have column in output total number of each unique output below? sig_id ip_src ip_dst sig_name timestamp 504 192.168.0.1 192.168.0.103 community web-php deluxebb forums.php access 2010-08-23 21:47:56 504 192.168.0.1 192.168.0.103 community web-php deluxebb forums.php access 2010-08-23 21:47:56 504 192.168.0.1 192.168.0.103 community web-php deluxebb forums.php access 2010-08-23 21:47:56 504 192.168.0.1 192.168.0.103 community web-php deluxebb forums.php access 2010-08-23 21:47:56 503 192.168.1.3 63.243.90.10 icmp destination unreachable communication destination host administratively prohibited 2010-08-23 21:51:47 503 192.168.1.3 63.243.90.10 icmp destination unreachable communication destination host administratively prohibited 2010-08-23 21:51:47 503 192.168.1.3 63.243.90.10 icmp destination unreachable communication destination h...

excel - Determining values when looping through multiple ranges in VBA -

i working on macro set chart max , mins based on dynamic data set. when user chooses group, chart updates, , macro runs update chart max , min values appropriate scale. i hoping can me try use variables 3 ranges to: choose chart based on cell value in range set min based on cell value in range set max based on cell value in range at point able pull out chart name, having trouble getting value min , max range. any appreciated! sub rescale() activesheet.calculate dim chrtnmrng range dim chrtminrng range dim chrtmaxrng range dim cell range set chrtnmrng = sheets("data").range("o5:o20") set chrtminrng = sheets("data").range("z5:z20") set chrtmaxrng = sheets("data").range("aa5:aa20") each cell in chrtnmrng sheets("dashboard").chartobjects(cell.value).chart.axes(xlvalue) .minimumscale = chrtminrng.value .maximumscale = chrtmaxrng.value end next cell end sub do this: sub rescale()...

google apps - Drive push messages - spammed by notifications -

i developing system synchronizing files between google drive , external storage. trying process push notifications. able register them , receive them. after receiving each notification, acquire list of changes using proper endpoint , try new version of file if necessary, flow that: subscribe notifications using changes.watch receive push message url changes use api provided query changes on changes.list endpoint filter items changed after particular moment get content of file , transfer service it seems after initial notify message, google starts spamming new one, after getting file. suspect action of getting file content changing timestamp on file , therefore - content changed. is possible not modify file in way when getting content? edit: it seems behaviour concerns files.export endpoint - exporting google doc pdf leads notifications spam too. commenting out export part in code stops them coming. you're getting spammed since changes: watch listens m...

javacard - How to send the APDU command to get a success response? -

i have method in javacard applet: public void process(apdu apdu) { byte[] buf = apdu.getbuffer() ; switch(buf[iso7816.offset_ins]) { case 0x40: util.arraycopy(hello,(byte)0,buf,iso7816.offset_cdata,(byte)5); apdu.setoutgoingandsend(iso7816.offset_cdata,(byte)5); break; default: isoexception.throwit(iso7816.sw_wrong_ins) ; } } here hello : private final static byte[] hello = {0x48, 0x65, 0x6c, 0x6c, 0x6f }; and sending command in script follows: powerup; // select installer applet 0x00 0xa4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7f; // create testapplet applet 0x80 0xb8 0x00 0x00 0xd 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x00 0x7f; //show hello message 0x40 0x00 0x00 0x00; //this command mentioned in tutorial gave error powerdown; the first 2 commands succeeded, last 1 gets error command not in correct format . i tried command: 0x00 0x4...

video - iOS: AVPlayerItem seekToTime not seeking to exact time requested -

i'm working on app streams video on http. avplayer used play video. using avplayeritem , selectmediaoption method switch between specific video streams (there 3 streams in source). my problem when switch between media options call seektotime: tolerancebefore: toleranceafter: skip new video same point in time video switching from. trouble is, doesn't work reliably. video skips point several seconds before requested time, though avplayeritem currenttime property reports time requested. passing kcmtimezero both tolerancebefore , toleranceafter. something else worth mentioning happens 1 specific media stream. have media stream not exhibit issue. can 1 suggest might problem here? it turns out issue didn't have apis or how being used. looks encoder used create video segments creating errors in resulting files. the errors reported ffprobe like: [h264 @ 00000249a4348980] decode_slice_header error [h264 @ 00000249a4348980] no frame! [h264 @ 00000249a4348980] ...

MS Access and number of decimal places returned in calculations -

this not formatting question. i have found doing simple division in ms access (2010) query not return expected number of digits. simplest: (3.1 + 3.1)/2 = 3.1 but ms access returns 3.09999990463257 yes, can round and/or format result show specified number of decimal places. also, in example above, rounding give me true value of 3.1; however, question "why ms access this?" rather how fix it. both select (3.1+3.1)/2 result tblfoo in query, and debug.print (3.1 + 3.1)/2 in vba return 3.1 me. are summing values of data type single ? have limited precision.

email - How do I get an icon in Google Inbox? -

Image
i receive e-mails various senders, , when view them in google inbox, either on inbox.google.com, or on android app, have icon in circle next them... others have letter. bitbucket, example, has nice icon when send me e-mail: the question: does google inbox fetch picture kind of g+ magic, or e-mail headers involved here? how implement in own solutions when sending out e-mails? according marketingland.com display logo from: address one of great things new inbox google is more visual. sender of email displayed icon rather plain text from: address. similar gmail’s grid view , works by: having verified google+ business account authenticating spf , dkim registering google

javascript - Express server not serving static files -

i'm using express , socket.io write app, server can't find static files are. realize question has been asked multiple times, none of proposed solutions worked me. i've tried different ways reference public folder express.static() or rearrange code structure, still no luck. code structure: /node_modules /public /css index.css /html index.html /js /src /server /models index.js package.json index.js: // modules needed var express = require('express'), http = require('http'), bodyparser = require('body-parser'), logger = require('logger'), mongoose = require('mongoose'), io = require('socket.io'), path = require('path'), methodoverride = require('method-override'), user = require('./src/server/models/user'); // connect mongodb mongoose.connect('mongodb://...

weblogic12c - Weblogic 12 - Changing Scoped Role to Group mapping in the deployed application -

our current application uses jsf/jpa technology , deployed on weblogic 12.1.2 , following: authenticates user through idp the idp after authenticating user sends groups user belong to using web.xml , weblogic.xml map groups roles our application scoped roles granular , helps following: hide ui pages or components on ui use rolesallowed annotation on methods since group role mapping in weblogic.xml, our application users can't change groups roles mapping , problem have solve. my goal following: authenticate user through our idp the idp send groups user belongs to define roles in web.xml define tables our application read find group role mapping use weblogic api group role mapping create ui allow our users change group role mapping the problem running can't find how group role mapping dynamically using weblogic since can't access weblogic api allow me change group role mapping in deployed application. has done before? i have looked @ creating...

php - Randomize weighted array with weights lower than 1 and decimals -

i have array weights on each value used retrieve random value based on weights. have used in past: $items = array( "value1" => 30, "value2" => 70 ); $weighted = array(); foreach( $items $value => $weight ) { $weighted = array_merge($weighted, array_fill(0, $weight, $value)); } echo $result = $weighted[array_rand($weighted)]; but if need use decimals on weights? (the weights use sum 100 btw) for example: $items = array( "value1" => 0.5, "value2" => 99.5 ); so value1 shown 0.5% of times. you go that: first, create decimal random number within desired precision. example, create random integer number between 0 , 10.000 , divide 100 (in case, it's precision 2 digits after comma). let's name random_value. then (in pseudo code): given: random_value, decimal in [0,100] sum = 0 each item in items sum += weight(item) if(sum >= random_value) r...

r - Display second Y axis using dygraph -

trying have 2 y axis different scales. second y axis scale doesn't show , data plotted entirely off screen. have: dygraph(bmsp1, main = "black mo sp")%>% dyaxis("y", label = "depth (m) ", valuerange = c(0, 1.0))%>% dyaxis("y2", label = "temp (c) ", valuerange = c(0, 25.0)) plot of depth , temp i tried error: dygraph(bmsp1, main = "black mo sp")%>% + dyaxis("y", label = "depth (m) ", valuerange = c(0, 1.0))%>% + dyaxis("y2", label = "temp (c) ", valuerange = c(0, 25.0))%>% + dyaxis("temp", axis('y2')) error in dyaxis(., "temp", axis("y2")) i haven't figured out how add data using dput() (file size large). here snapshot head() > head(bmsp1) depth temp (c) 2015-09-30 09:00:00 0.003 21.378 2015-09-30 09:15:00 0.228 17.475 2015-09-30 09:30:00 0.228 17.475 2015-09-30 09:45:00 0.2...

c# - Operator '!' cannot be applied to operand of type long -

i doing conversion of old vb code c#. getting error when converting couple of properties. "operator '!' cannot applied operand of type long" this vb code looks , hoping this. public property value() integer if (me.m_value < 32768) return me.m_value else return -32768 + (me.m_value - 32768) end if end set(byval plcvalue integer) me.m_value = plcvalue end set end property public property b0() boolean if ((me.m_value , &h1&) = &h1&) return true else return false end if end set(byval state boolean) if (state = true) me.m_value = me.m_value or &h1& else me.m_value = me.m_value , (not &h1&) end if end set end property public property b1() boolean if ((me.m_value , &h2&) = &h2&) return true else ...

php - Implementing another list dropdown upon extra selection -

i have mysql database, , have option displays 'treatments' dropdown box on html page. how go implementing code, if user wants select more 1 treatment, dropdown box appear? edit: e.g. lets shopping items online, , have items listen in dropdown box. pick one, , want pick more. click: 'add more' , dropdown appears on page can select item. here php code: <?php $hostname = 'hostname'; $dbname = 'dbname'; $username = 'username'; $password = 'password'; $con=mysql_connect($hostname,$username,$password,$dbname) or die("failed connect mysql: " . mysql_error()); $db=mysql_select_db($dbname,$con) or die("failed connect mysql: " . mysql_error()); $query = "select * `treatments`"; $result = mysql_query($query, $con); $options = ""; if (!$result){ die("no results found."); } while ($row = mysql_fetch_array($result)){ $options .= "<option>$row[1]</option>...

java - RabbitMQ impacting JDBC connection pool -

i have web servlet has been running well. decided replace tcp connection backend server rabbitmq. while doing load testing noticed started fail timeouts waiting idle jdbc connection. error [http-bio-8080-exec-12] jdbcexceptionreporter.logexceptions(234) | cannot connection, pool error timeout waiting idle object debug [http-bio-8080-exec-12] jdbcexceptionreporter.logexceptions(225) | cannot open connection [???] org.apache.commons.dbcp.sqlnestedexception: cannot connection, pool error timeout waiting idle object @ org.apache.commons.dbcp.poolingdatasource.getconnection(poolingdatasource.java:114) @ org.apache.commons.dbcp.basicdatasource.getconnection(basicdatasource.java:1044) @ org.springframework.orm.hibernate3.localdatasourceconnectionprovider.getconnection(localdatasourceconnectionprovider.java:85) @ org.hibernate.jdbc.connectionmanager.openconnection(connectionmanager.java:446) @ org.hibernate.jdbc.connectionmanager.getconnection(connectionmanager.java:1...