Posts

Showing posts from April, 2011

c++ - mmap: enforce 64K alignment -

i'm porting project written (by me) windows mobile platforms. i need equivalent of virtualalloc (+friends), , natural 1 mmap . there 2 significant differences. addresses returned virtualalloc guaranteed multiples of so-called allocation granularity ( dwallocationgranularity ). not confused page size, number arbitrary, , on windows system 64k. in contrast address returned mmap guaranteed page-aligned. the reserved/allocated region may freed @ once call virtualfree , , there's no need pass allocation size (that is, size used in virtualalloc ). in contrast munmap should given exact region size unmapped, i.e. frees given number of memory pages without relation how allocated. this imposes problems me. while live (2), (1) real problem. don't want details, assuming smaller allocation granularity, such 4k, lead serious efficiency degradation. related fact code needs put information @ every granularity boundary within allocated regions, impose "gaps" with

eloquent - Record Not Being Deleted In Laravel -

hello having weird issue not understand, trying delete record in laravel . destroy method in resource controller: public function destroy($id) { $ins = institution::find($id); $success = $ins->delete(); return [ 'success' => $success ]; } this model : namespace app\models; use illuminate\database\eloquent\model; use illuminate\database\eloquent\softdeletingtrait; class institution extends model { use softdeletingtrait; protected $dates = ['deleted_at']; protected $table = 'sys_institutions'; } now success returns true indicating record indeed has been deleted when check db not case. i have tried returning $ins after delete well, column deleted_at seems have date not saved database. in database table deleted_at null . now did not create tables migrations dunno if might have current problem. i have checked $id , indeed correct. i have tried using: $success = institution::destroy($id);

asp.net - VS2008 VB Button fires in Firefox & Chrome but not in IE 11 -

my simple webform program has submit button fires uneventfully in current versions of firefox , chrome, not fire in ie 11. other programs in same project have similar buttons fire in 3 browsers. no error messages, running breakpoints shows never hits .click sub. happens when running in local mode on real webserver (sorry, it's behind our firewall, can't demo it). here's button code: <asp:button id="btnsubmit" runat="server" text="submit" /> and in designer: protected withevents btnsubmit global.system.web.ui.webcontrols.button and in .vb: protected sub btnsubmit(byval sender object, byval e eventargs) handles btnsubmit.click --some code-- end sub note in handles code directly above, there breakpoint on protected sub line never touches (and on other programs in project when tested). doesn't matter if there's code in or not, doesn't sub @ all. (suggestions similar incidents found via google) there no validators

python - Why my SGD is far off than my linear regression model? -

i'm trying compare linear regression (normal equation) sgd looks sgd far off. doing wrong? here's code x = np.random.randint(100, size=1000) y = x * 0.10 slope, intercept, r_value, p_value, std_err = stats.linregress(x=x, y=y) print("slope %f , intercept %s" % (slope,intercept)) #slope 0.100000 , intercept 1.61435309565e-11 and here's sgd x = x.reshape(1000,1) clf = linear_model.sgdregressor() clf.fit(x, y, coef_init=0, intercept_init=0) print(clf.intercept_) print(clf.coef_) #[ 1.46746270e+10] #[ 3.14999003e+10] i have thought coef , intercept same data linear. when tried run code, got overflow error. suspect you're having same problem, reason, it's not throwing error. if scale down features, works expected. using scipy.stats.linregress : >>> x = np.random.random(1000) * 10 >>> y = x * 0.10 >>> slope, intercept, r_value, p_value, std_err = stats.linregress(x=x, y=y) >>> print("slope

cassandra - Exception in thread "main" java.lang.AbstractMethodErrorat org.apache.spark.Logging$class.log(Logging.scala:52) -

hi getting below exception while running spark application. application read text file using spark , persisting same cassandra db. exception in thread "main" java.lang.abstractmethoderror @ org.apache.spark.logging$class.log(logging.scala:52) @ com.datastax.spark.connector.cql.cassandraconnector$.log(cassandraconnector.scala:142) @ org.apache.spark.logging$class.logdebug(logging.scala:63) @ com.datastax.spark.connector.cql.cassandraconnector$.logdebug(cassandraconnector.scala:142) @ com.datastax.spark.connector.cql.cassandraconnector$.com$datastax$spark$connector$cql$cassandraconnector$$createsession(cassandraconnector.scala:152) @ com.datastax.spark.connector.cql.cassandraconnector$$anonfun$4.apply(cassandraconnector.scala:149) @ com.datastax.spark.connector.cql.cassandraconnector$$anonfun$4.apply(cassandraconnector.scala:149) @ com.datastax.spark.connector.cql.refcountedcache.createnewvalueandkeys(refcountedcache.scala:36) @ com.dat

c# - Strategy for splitting a large JSON file -

i'm trying split large json files smaller files given array. example: { "headername1": "headerval1", "headername2": "headerval2", "headername3": [{ "element1name1": "element1value1" }, { "element2name1": "element2value1" }, { "element3name1": "element3value1" }, { "element4name1": "element4value1" }, { "element5name1": "element5value1" }, { "element6name1": "element6value1" }] } ...down { "elementnname1": "elementnvalue1" } n large number the user provides name represents array split (in example "headername3") , number of array objects per file, e.g. 1,000,000 this result in n files each containing top name:value pairs (headername1, headername3) , 1,000,000 of headername3

excel - VLOOKUP / CONCATENATE "#N/A" error -

i trying put 2 columns , value sheet. if hardcode numbers vlookup works concatenate #n/a . both columns general format. not understand doing wrong. this doing, in excel 2010: =vlookup(concatenate($w26,w$1),sheet2!$a$1:$b$200,2,false) any ideas? =vlookup(concatenate($w26,w$1)+0,sheet2!$a$1:$b$200,2,false) someone sent me , works great. everyone.

python - Hiding lines after showing a pyplot figure -

Image
i'm using pyplot display line graph of 30 lines. add way show , hide individual lines on graph. pyplot have menu can edit line properties change color or style, rather clunky when want hide lines isolate 1 you're interested in. ideally, i'd use checkboxes on legend show , hide lines. (similar showing , hiding layers in image editors paint.net) i'm not sure if possible pyplot, open other modules long they're easy distribute. if you'd like, can hook callback legend show/hide lines when they're clicked. there's simple example here: http://matplotlib.org/examples/event_handling/legend_picking.html here's "fancier" example should work without needing manually specify relationship of lines , legend markers (also has few more features). import numpy np import matplotlib.pyplot plt def main(): x = np.arange(10) fig, ax = plt.subplots() in range(1, 31): ax.plot(x, * x, label=r'$y={}x$'.format(i)

forms - VBA Label formating -

i using label tool box control place , write default text form. want break line , don't know how it. i don't believe writing paragraph on caption field right way customize form, it? missing something? when writing text label press ( shift + enter ) add return carriage.

ruby on rails - 'GMT-05:00) EST' option unexpectedly included in time_zone_select dropdown -

Image
(with rails 3.2.20, ruby 1.9.3) in website in production '(gmt-05:00) est' option unexpectedly included in time_zone_select dropdown: this timezone not exists in activesupport::timezone::mapping . injected activesupport::timezone.zones_map : def zones_map @zones_map ||= begin new_zones_names = mapping.keys - lazy_zones_map.keys new_zones = hash[new_zones_names.map { |place| [place, create(place)] }] lazy_zones_map.merge(new_zones) end end on line lazy_zones_map.merge(new_zones) because lazy_zones_map contains "est" zone. it not happen on development box and not happen in rails production console : activesupport::timezone.send :lazy_zones_map returns {"utc"=>(gmt+00:00) utc} . but when put in view in production <%= activesupport::timezone.send :lazy_zones_map %> i {"utc"=>(gmt+00:00) utc, "est"=>(gmt-05:00) est} . don't understand why happens, idea? the #lazy

Can we access database without SQL Server Management Studio in c# -

i created database name="records" of sql server management studio (ssms). question if uninstall ssms can still access database c# program? if yes, then process connectivity still same given below? sqlconnection cnn ; string connetionstring = "data source=servername;initial catalog=databasename;user id=username;password=password"; cnn = new sqlconnection(connetionstring); management studio gui client interacting database. separate actual database. in other words: don't need management studio programmatically access ms sql database.

How to add a route to Amazon VPC into an instance's OpenVPN connection? -

Image
i want setup render farm in ec2 (all win2012r2) several slaves 1 instance openvpn connection our office lan (all osx). what have done far: setup vpc 10.42.0.0/16 setup openvpn 10.8.0.0/24 , 1 instance client, server in our office 192.168.1.0/24 , connection working flawlessly added 10.8.0.0/24 , 192.168.1.0/24 vpc route tables/routes tab target: vpn client instance source/dest checks turned off vpn client instance what working: i can ping around in vpc i can ping around vpn what doesn't work: ping vpn server clients vpc-address ping slave node vpn net some debugging: wireshark on vpn client 10.8.0.14 shows ping echo 'no response' when trying ping 10.8.0.14 10.42.243.30 , return route seems broken so how vpc working every instance can ping vpn server , additionally our office lan? regards, dennis i suspect need configure network acls (security groups) allow inbound , outbound traffic between vpc nodes.

java - Proguard doesn't hide class and folder names in Android -

i have android application wanted obfuscate using proguard. after time managed make work external libraries using. configure proguard release build using gradle buildtypes { release { signingconfig signingconfigs.release minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } there 1 problem tho. i testing obfuscated code smali2java, can read code , methods if not obfuscated, , when is, can see variables , imports. the problem can see class names , folders. it's important me hide them user couldn't see project structure , code this: public class dtostoprintrequestsmapper { private final transactionlinecreator a; private final protocoldiscountcreator b; private final protocolpaymentcreator c; } i not want user able see things. folders structure in project. here proguard-rules: # add project specific proguard rules here. # more details, see # http://

retrieve json data using GET in angularjs -

i've got data stored in nosql database i'm able see in when accessing localhost:3000/countries. i'm trying use factory in order data in json. .factory('countries', ['$http', '$q', function($http, $q) { var countries = { get: function() { return $q(function(resolve, reject) { $http({ method: 'get', url: '/countries' }).then(function(response) { resolve(response.data); }, function(error) { reject(error); }); }); }; return countries; } ]); and i'm attempting use controller send data appropriate url displayed isn't working expected to. .controller('countriesctrl', function($scope, countries) { console.log(countri

distributed - Physical Clocks: Correctness vs. Accuracy -

in context of studying class on distributed systems stumbled upon following definitions not understand: let c(t) perfect clock. a clock ci(t) called correct @ time t if ci(t) = c(t) . a clock ci(t) called accurate @ time t if dci(t)/dt = dc(t)/dt ≡ 1 . question 1: definition of correctness means, how accuracy different it? question 2: what's d about? not mathematical explaination appreciated. thank in advance! without more symbols, mathematical conceptually: accuracy means clock changing @ same rate perfect clock. correctness means clocks register same time. d derivative - can check calculus book, or wikipedia . t means time, change of imperfect/perfect clock respect time.

c++ - About reference to pointers -

i've been making tree, because planting trees save planet (or program). class tree { node* root; // ... void insert(int value){ private_insert(value, root); } void insert_private(int value, node* n){ if(n == nullptr){ n = new node(value); } else { standard recursive insertion function here } } // ... }; long story short i've tried using shared_ptrs first, the insert() function never add element tree. thought might doing wrong shareds tried raw pointers , got same non-inserty resoults. turns out need pass reference root/nodes. void insert_private(int value, node*& n) {...}; i understand if dont pass reference copy made. if pointer holds address, doesnt it's copy hold same address? if make new() non-referenced pointer why doesnt stick root/nodes? the why question here, can accept it works this, tree works, dont know why this. edit: after reading comments created small expert level program: void fn(int* i){ co

c# - WPF DataGrid: How to Determine the Current Row Index? -

i trying implement simple spreadsheet functionality based on datagrid. the user clicks on cell the user types value , presses return the current row scanned , cell formula depends on clicked cell updated. this seems best event handler requirements: private void my_datagrid_currentcellchanged(object sender, eventargs e) question: how detect row index of current row? try (assuming name of grid "my_datagrid"): var currentrowindex = my_datagrid.items.indexof(my_datagrid.currentitem); normally, you'd able use my_datagrid.selectedindex , seems currentcellchanged event, value of selectedindex displays previously selected index. particular event seems fire before value of selectedindex changes.

php - Android - send image to server - Async Task An error occured while executing doInBackground() -

i want make app takes picture , sends online server. have read many tutorials , articles , code far: import android.app.activity; import android.content.intent; import android.content.res.configuration; import android.graphics.bitmap; import android.net.uri; import android.os.asynctask; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.util.log; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.imageview; import android.widget.toast; import org.apache.http.httpresponse; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import java.io.bytearrayinputstream; import java.io.bytearrayoutputstream; import java.io.file; import java.io.ioexception; import java.io.inputstream; import java.text.simpledateformat; import java.util.da

Determining implementation of Python at runtime? -

i'm writing piece of code returns profiling information , helpful able dynamically return implementation of python in use. is there pythonic way determine implementation (e.g. jython, pypy) of python code executing on @ runtime? know able version information sys.version : >>> import sys >>> sys.version '3.4.3 (default, may 1 2015, 19:14:18) \n[gcc 4.2.1 compatible apple llvm 6.1.0 (clang-602.0.49)]' but i'm not sure in sys module implementation code running. you can use python_implementation platform module in python 3 or python 2 . returns string identifies python implementation. e.g. return_implementation.py import platform print(platform.python_implementation()) and iterating through responses on command line: $ in python python3 pypy pypy3; echo -n "implementation $i: "; $i return_implementation.py; done implementation python: cpython implementation python3: cpython implementation pypy: pypy implementat

How can you find and replace text in a file using the Windows command-line environment? -

i writing batch file script using windows command-line environment , want change each occurrence of text in file (ex. "foo") (ex. "bar"). simplest way that? built in functions? if on windows version supports .net 2.0, replace shell. powershell gives full power of .net command line. there many commandlets built in well. example below solve question. i'm using full names of commands, there shorter aliases, gives google for. (get-content test.txt) | foreach-object { $_ -replace "foo", "bar" } | set-content test2.txt

css - How to limit the number of items per table row? -

table shows large number of items per row goes beyond screen. tried add css style modify table width didn't work. i thought putting break line after definite number(maybe using jquery) of items while create each row in iterative mode. there way define number of items created dynamically in each table row? thanks, you must modify table header width, child row/td inherit size : <table> <thead> <tr> <th width="20%">column 1</th> <th width="20%">column 2</th> <th width="20%">column 3</th> <th width="20%">column 4</th> <th width="20%">column 5</th> </thead> <tbody> <tr> <td>data column 1</td> <td>data column 2</td> <td>data column 3</td> <td>data col

vba - Automatic Excel Acronym finding, Definition and Classification Adding -

i have been working code found here having difficulty getting 1 more task me. have added column (3) excel document has "classification" of acronym & definition , want add newly created word doc in column 1, before acronym. have tried several different ways of moving provided code around results in error. appreciated. have included working code below. said, works want 1 more thing. thank you! sub extractacronymstonewdocument() dim odoc_source document dim odoc_target document dim strlistsep string dim stracronym string dim strdef string dim otable table dim orange range dim n long dim m long m = 0 dim strallfound string dim title string dim msg string dim objexcel object dim objwbk object dim rngsearch object dim rngfound object dim targetcellvalue string ' message box title title = "extract acronyms new document" ' set message box message msg = "this macro finds acronyms (consisting of 2 or more " & _ "uppercase letter

java - Spring MVC: Controller does not run in an ApplicationContext -

i trying implement webapp using spring mvc framework. far, helloworld wasn't problem. wanted read in data database. so, implemente class called dataprovider handles database access. now added dataprovider class helloworld class, controller here. that, following exception: java.lang.illegalstateexception: applicationobjectsupport instance [de.bpm.keza.ui.srv.kennzahlen.controller.hellocontroller@7361b599] not run in applicationcontext here dispatcher-servlet: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.o

c# - subscript Strings and add to Textboxes/Rectangle in Visio -

i hope can me. i'm working on tool creates technical drawings excel data. some of desciption boxes on drawings have sub- or superscriptions. i've found article related word: how add subscript characters in paragraphs using word automation? but there's text directly edited, i'm not sure if possible when text in rectangle / textbox, mne object , not directly page. here codesnippet: "x" + **unsaturated + "unsat** ≤ " + dataserver.getprojectdata["motor"]["unsaturated commutation reactance " + unsaturated].last.value + " %"; the bolded part should subscripted example, there possibilty realize this? thanks alot mirko status: drop method: public void drawer(shapeitem si, visio.master master) { //drops shape @ position x,y. visio.shape shape = vpage.drop(master, (si.coordx / 100000), (si.coordy / 100000)); if (master.name.equals("rectangle") || master.name.equals(&q

Android Wearable API: how to pass a dynamic List? -

this how i'm using dataapi putdatamaprequest datamapreq = putdatamaprequest.create(path); datamapreq.getdatamap().putfloatarray(key, list); putdatarequest putdatareq = datamapreq.asputdatarequest(); wearable.dataapi.putdataitem(mgoogleapiclient, putdatareq); list array[] or arraylist<> . if add new element i'll have put list in data map again. cause retransmission of every inserted elements? yes, if change element in array/list, need put data item , replace old one. cause retransmission other devices. in general, wouldn't worry retransmission. since there limit of how can send in dataitem, not sending data. if still worried it, consider partitioning data , sending several data items (for example send 4 sub-arrays of floats , merge them on other side). do not send each float separate data item (enormous overhead).

How to listen from two Bluetooth devices simultaneously into an android mobile application? -

i working on android app needs communicate 2 external bluetooth devices simultaneously , read data ,process data , show on screen. will possible? your question similar post multiple bluetooth connection there can find answer. regards

php - Yii2 db\Connection memory exhausted -

my code rather complex, is: read csv file, perform operations on data, select , insert data db. operations done in chunks, variables reused , none of them globals. error looks (full stack trace shown): [bt704cdb0e1fhr6jbf5q1hg2r4][error][yii\base\errorexception:1] exception 'yii\base\errorexception' message 'allowed memory size of 134217728 bytes exhausted (tried allocate 332653 bytes)' in /usr/sites/autozapas/vendor/yiisoft/yii2/db/connection.php:782 stack trace: #0 [internal function]: yii\base\errorhandler->handlefatalerror() #1 {main} 2015-07-14 14:17:23 [2][bt704cdb0e1fhr6jbf5q1hg2r4][info][application] $_post = [ 'columns' => '{}' 'comment' => '' 'supplier_id' => '' ] at stage application stops error. more half chunks executed. perform db operations through: $connection = yii::$app->dbdata; $command = $connection->createcommand($sql); $command->queryall(); //or $command->

Update the data in excel instead of deleting -

the below code deleting records want update next column "ok" instead of deleting entire row. please advise changes required. dim myfilenamedir string dim ws1 worksheet dim irow1 long dim str string myfilenamedir = "c:\users\gshaikh\desktop\book16.xlsx" workbooks.open filename:=myfilenamedir, updatelinks:=0 set ws1 = worksheets("students") str = listview1.selecteditem.subitems(1) msgbox str ws1 .autofiltermode = false irow1 = .range("b" & .rows.count).end(xlup).row .range("b1:d" & irow1) .autofilter field:=1, criteria1:="=*" & str & "*" .offset(1, 0).specialcells (xlcelltypevisible).entirerow.delete end .autofiltermode = false end activeworkbook.save activeworkbook.close you need remove: (xlcelltypevisible).entirerow.delete and replace cells.value = "ok"

authentication - How to limit view to authenticated user in Django Rest Framework -

i have django rest framework application. authentication performed through login method: def login(self, request): user = find_my_user(request) user.backend = 'django.contrib.auth.backends.modelbackend' login(request, user) return response({"status": "ok"}) authentication works fin. i have viewset having list_route() need authenticated user used. here code: class commonview(viewsets.viewset): @list_route() @authentication_classes(sessionauthentication) @permission_classes(isauthenticated) def connected(self, request): return response({"status": "ok"}) even if user not authenticated (no session cookie), action performed. as work around, i've performed : class commonview(viewsets.viewset): @list_route() def connected(self, request): if request.user.is_authenticated(): return response({"status": "ok"}) else: retur

osx - Swift: can't find glProgramParameteriEXT -

im trying move objective-c swift can't seem figure out how call opengl extension functions. need include opengl/glext.h . where hiding in swift (import opengl, glkit not enough)?? glprogramparameteriext(program,gl_geometry_input_type_ext , gl_triangles)

java - How to download all the required JARS to use play framework properly? -

these last 2 days, trying hold of play framework (java) had issues import libraries project, example play.db.ebeans.model. there way automatically download , use these dependencies in intellij ? enabling ebean in 2.4 described! (in previous paly 2.x it;s enabled default) https://www.playframework.com/documentation/2.4.x/javaebean

Convert number to date sql oracle -

i'm trying convert number ( yyyymmdd ) date ( mm/dd/yyyy ) for example 20150302 ====> 03/02/2015 you can try this: select to_date(20150302,'yyyymmdd') dual; or select to_char(to_date(20150302,'yyyymmdd'),'mm/dd/yyyy') dual;

link to - Rails 4 - link_to with confirm in Rails -

i'm trying customize dialog confirm link_to in rails 4. not understand why rides html "confirm", , should "data-confirm"! i've tried number of ways, , generated "confirm", this: <%= link_to 'delete', user, :method => :delete, :confirm => 'are sure?' %> <a confirm="are sure?" rel="nofollow" data-method="delete" href="/user/13">delete</a> i followed tutorial: http://thelazylog.com/custom-dialog-for-data-confirm-in-rails/ , used example in tutorial, doesn't work confirm has been deprecated in rails 4. so use new syntax: <%= link_to "title", "#", data: {confirm: "are sure!"} %>

android - Trigger UIAutomator Test Script programatically -

we using uiautomator automation. to run uiautomator test scripts used compile scripts command prompt using either usb or wifi adb , run on android device. uiautomator scripts come in jar format after compilation. push jar in device , have trigger test scripts. command start test script in “adb shell uiautomator runtest testpackage.jar ”. it working normal adb connection. but in our case have initiate test scripts without adb connection. so tried passing commands programmatically in device using java code try { stringbuffer output = new stringbuffer(); process p = runtime.getruntime().exec(params[0]); bufferedreader reader = new bufferedreader(new inputstreamreader( p.getinputstream())); string line = ""; while ((line = reader.readline()) != null) { output.append(line + "\n"); p.waitfor(); } } catch (ioexception e) { e.printstacktrace();

c# - Tiling image in a Grid -

how can tile single image (small size) multiple times in grid container appears grid holding 1 single image instead of multiple images tiled together? i've seen methods create single image copying smaller image multiple times blitting, process computationally expensive. don't want create bigger image; want use same single image multiple times process doesn't require cpu cycles. how can done? update: seems there exists no easy way above. so, workaround, how can create single larger image tiling multiple smaller images in wp8.1 rt? in code have instantiated 1 bitmap image. tho, i'm not sure, if memory conserving. { int n = 5; grid grid = new grid(); bitmapimage bitmapimage = new bitmapimage(new uri("pack://application:,,,/stackoverflowtest;component/1.jpg")); (int = 0; < n; i++) { grid.columndefinitions.add(new columndefinition {width = gridlength.auto}); grid.rowdefinitions.add(new r

matlab - resample or interpolate a unevenly spaced path -

Image
let's have path made of 3d points, distance between consecutive points not constant. how resample such distance between consecutive points becomes constant? i tried interp1 don't know original query points of hypotetically parametrized curve x(t),y(t),z(t). example path: you can use interparc matlab file exchange . in following example, function calculates 100 equally spaced points of original curve. default spline-interpolation used , gives smooth curve. defining optional parameter, can change behaviour. use 'linear' linear approximation (most efficient). here code: % define original points = [0.132488479262673 0.427113702623907;0.160138248847926 0.462099125364431;0.197004608294931 0.532069970845481;0.236175115207373 0.634110787172012;0.263824884792627 0.677842565597668;0.284562211981567 0.709912536443149;0.307603686635945 0.744897959183673;0.339861751152074 0.785714285714286;0.376728110599078 0.806122448979592;0.40668202764977 0.81486880466

c# - Space character becomes Euro character -

i have pdf template (made designer) editable fields on it. task values web service (returns json in utf-8) , populate fields in pdf. use pdfsharp library , specify encoding through xfont (tried both, winansi , unicode). document looks ok after saving, if click inside 1 field contains number space (10 000.00), space becomes euro character. other text fields spaces not have behavior , if hardcode string value in code, ok. any idea problem here welcome. thanks in advance edit like commented below, indexer on string value showed 160 underneath problematic character. found this post on stackoverflow afterwards. minuses, try better next time :) unicode has many different spaces. make sure have standard space (ascii 32 or 0x20) in number. i think encoding specify has no effect on encoding used form contents (which presumably use pdf encoding). suspect number string contains special space character while other strings use normal space characters. replacing spaces in

r - How to select row's last values in a data frame and arrange them in a separate column? -

Image
i have data frame of following type: i need create separate column include last variables each row starting column v9 , i.e. 15:32 , 13:44 , 16:37 , 15:31 , null , null , 16:10 , 16:22 etc. if easier, can live removing empty rows (in case 5 , 6). tried combination of which.max , length , apply , output did not make sense. have no idea next. help. we use max.col . subset columns 'v9' 'v11'. then, use max.col column index of elements not blank. in case of 'ties', there optional argument in 'max.col' i.e. ties.method specify either 'first', 'last' or 'random'. default option 'random'. here, using 'last' option. cbind sequence of 'row' create 'row/column' index , extract values 'dfn'. dfn <- df1[paste0('v', 9:11)] new <- dfn[cbind(1:nrow(dfn),max.col(dfn!='', 'last'))] new #[1] "15:32" "13:44" "16:37" &quo

linux - How to capture CPU Idle time from Top -

i trying capture cpu idle time top. following code captures load average trying manipulate following code capture's cpu idle time. any ideas welcome. top -bn1 | grep load | awk '{printf "cpu load %: %.2f\n", $(nf-2)}' above code outputs: cpu load %: 0.44 i want change code outputs cpu idle time cpu id %: 92.9% example top output: top - 10:35:25 1 day, 16:06, 5 users, load average: 0.24, 0.16, 0.15 tasks: 210 total, 2 running, 198 sleeping, 10 stopped, 0 zombie %cpu(s): 2.2 us, 0.2 sy, 4.7 ni, 92.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.1 st kib mem: 16433064 total, 1353396 used, 15079668 free, 180944 buffers kib swap: 0 total, 0 used, 0 free. 700468 cached mem pid user pr ni virt res shr s %cpu %mem time+ command 24293 ubuntu 30 10 32828 2576 1608 s 19.3 0.0 0:25.30 fiberlamp 2173 ubuntu 20 0 51200 16496 4952 s 9.3 0.1 263:34.18 xvnc4 12648 ubuntu 20 0 23668

javascript - Default value in grid -

i have grid/list: items: [ { xtype: 'gridpanel', reference: 'list', resizable: false, width: 200, title: '', forcefit: true, bind: { store: '{schedules}' }, columns: [ { xtype: 'gridcolumn', dataindex: 'revision', text: 'revision' } ], i want add listener record @ index 0 in store selected default. i've tried playing selmodel not working intended. do on viewready event: { xtype: 'gridpanel', listeners: { 'viewready': function(g) {

mysql - PHP PDO Fetch not working? -

i can select object, cannot fetch rows database using following code, can see obvious errors? $sql2 = "select id, latitude, longitude, name countries"; $stmt2 = $pdo->prepare($sql2); $stmt2->execute(); while ($row = $stmt2->fetch(pdo::fetch_assoc)) { echo $countryid = $row->id; echo $countryname= $row->name; echo $longitude2 = $row->longitude; echo $latitude2 = $row->latitude; } the parameter pdo::fetch_assoc tells pdo return result associative array. can fetch array not object while ($row = $stmt2->fetch(pdo::fetch_assoc)) { echo $countryid = $row['id']; echo $countryname= $row['name']; //rest of code }

c# - Mvc get subcategories from category id -

i have 2 sql table categories , subcategories. in subcategories table there categoryid row. how can subcategories categoryid? public actionresult index() { var model = new blogdb(); model.categories = db.categories.tolist(); model.subcategories = db.subcategories.tolist(); return view(model); } i want this: select c.name, s.name categories c left join subcategories s on c.id=s.categoryid and index view is: <ul> @foreach (var item in model.categories) { <li> @item.name <ul> @foreach (var sub in model.subcategories) { <li>@sub.name</li> } </ul> </li> } </ul> if datamodel setup correctly, , assuming category class has icollection of subcategories public call category { //. //. //. public virtual list<subcategory> subcategories{get;set;} } <ul> @fo