Posts

Showing posts from January, 2012

sql - How would I iterate through a list in SAS and translate / replace each piece with an imported mapping? -

i new sas , i'm not sure how go replacing each part of dataset have_1 translation data set (have_2) imported sas. data have_1 1111 1234 2222 2938 3849 1234 9388 ... 2222 2222 data have_2 1111 1234 b 2222 c 2938 d 3849 e ... 9388 f data want b c d e b f c c whether or not want replace them, proc format in sas - maps value value. here how might that. note cannot reuse original 3 variables (since they're numeric), rename , drop combination if wanted same variable names. using format statement directly achieve same result visually (but underlying value still numeric one). data have_1; infile datalines missover; input var1-var3; datalines; 1111 1234 2222 2938 3849 1234 9388 2222 2222 ;;;; run; data have_2; input numval charval $; datalines; 1111 1234 b 2222 c 2938 d 3849 e 9388 f ;;;; run; data for_fmt; set have_2; start=numval; label=charval; *could use rename these mak...

android - Bold characters in string.xml are not shown on screen -

in string.xml file, have this: <string name="example_string"><b>this</b> <b>%1$s</b></string> and placed textview: textview.settext(getstring(r.string.example_string, "good question")); the "good question" argument passed getstring() method not shown in bold . word "this" not shown in bold! what's reason , how solve it? ========================================================================= i know how use html.fromhtml(), method not support inserting string place holder have defined in string resource. if trying tell me html.fromhtml() exists, please not reply... so after day of search, found desired answer on android developers website! link page here: https://developer.android.com/guide/topics/resources/string-resource.html sometimes may want create styled text resource used format string. normally, won't work because string.format(string, object...) method strip style...

ios - xamarin c# UiScrollingView not scrolling with a vertical list of buttons -

i'm developing ios app xamarin , c# code, without designer. i implemented uiscrollview long list of buttons follows: var sizes = uiscreen.mainscreen.bounds;// 320, 480 .... scrollview = new uiscrollview(new cgrect(20, 200, sizes.width - 40, sizes.height - 200)); scrollview.backgroundcolor = uicolor.magenta; view.addsubview(scrollview); and added list of buttons: var m1 = new uibutton(uibuttontype.system); m1.frame = new rectanglef(45, -50, 230, 20); m1.settitle("beautiful way", uicontrolstate.normal); m1.touchupinside += (sender, e) => openplayerview(playeroption.stream, "mysongurl.mp3", "beautiful way" ); var m2 = new uibutton(uibuttontype.system); m2.frame = new rectanglef(45, -20, 230, 20); m2.settitle("boys in sky", uicontrolstate.normal); m2.touchupinside += (sender, e) => openplayerview(playeroption.stream, "mysongurl.mp3", "boys in sky"); var m3 = new uibutton(uibuttontyp...

node.js - Making Global NPM packages available to all users on windows 2012 server -

i trying install continues integration server. server pull data git , try build application. since using windows 2012 server, multiple users can trigger build. purpose, want ensure node packages install admin available users. how can i: install node packages globally available users. i want use locally hosted node registry. don't want use node registry. after installing packages, how can validate if users can access packages? had same issue. needed ci build agent run global package on cli. saw this post in new feature request system-wide npm -g windows. in short: open administrator level command prompt note current global prefix: npm prefix -g set global prefix ci user: npm config set prefix <c:\users\ci_user\appdata\roaming\npm> install needed packages: npm -g pkg restore prefix previous value.

Scala: Create object only if it doesn't exist yet -

i'm new scala, , simple question, i'm struggling figure out how make object if 1 doesn't exist yet. i query database, , find out if there's present, if so, store in object, otherwise create new one. in java know like pushmessage push = null; if(getfromdatabase() == null) { push = new pushmessaage(param1, param2...); } else { push = getfromdatabase(); } but, how do in scala. when try , same thing, tells me getfromdatabase() doesn't conform expected type null. similarly, tried doing pattern matching , doing like val push = getfromdatabase match { case some(pushmessage) => pushmessage case none => new pushmessage(param1, param2...) } but, didn't work told me constructor cannot instantiated expected type, found: some[a], expected: pushmessage so, how do this? , appreciated. i assume getfromdatabase returns either null or pushmessage , in order pattern match correctly, need wrap option : val push = option(getfromd...

c# - How do i delay a function after the handled device ends shake? -

i'm developing game on unity3d. here have 5 cards, , i'm trying shuffle them shake movement, but, code, cards being shuffle while shake performed, need that function can delayed or start when shake ends. here code: using unityengine; using system.collections; using unityengine.ui; public class shake1 : monobehaviour { int numtimes = 50; public image personajes; public image lugares; public image situaciones; public image emociones; public image objetos; public gameobject camshake; float accelerometerupdateinterval; // greater value of lowpasskernelwidthinseconds, slower filtered value converge towards current input sample (and vice versa). float lowpasskernelwidthinseconds; // next parameter initialized 2.0 per apple's recommendation, or @ least according brady! ;) float shakedetectionthreshold ; float lowpassfilterfactor; vector3 lowpassvalue; vector3 acceleration; vector3 deltaacceleration; ...

c# - In ServiceStack, how do I broadcast messages from the Server? -

is there simple tutorial showing how use server events servicestack? specifically, i'm looking way have server generate messages broadcast clients. i've been reading servicestack documentation , playing sample chat application neither source informative. documentation has gaps , chat application bloated , shows how send messages triggered client, not server , can't figure out how adapt code. the server events docs shows different apis available publishing server events: public interface iserverevents : idisposable { // external api's void notifyall(string selector, object message); void notifychannel(string channel, string selector, object message); void notifysubscription(string subscriptionid, string selector, object message, string channel = null); void notifyuserid(string userid, string selector, object message, string channel = null); void notifyusername(string username, string selector, object message, string channel =...

enums - Retrieving Scala enumeration constants by name -

i retreiving scala enumeration constants name. dmitriy yefremov propose solution scala 2.10 (@see http://yefremov.net/blog/scala-enum-by-name/ ) the code crash private def factorymethodsymbol(enumtype: type): methodsymbol = { enumtype.member(newtermname("withname")).asmethod // scala.scalareflectionexception: <none> not method } i update code use scala 2.11. idea ? you can existing api, don't need workarounds: def constantbyname[t <: enumeration](enum: t, key: string): option[t#value] = { enum.values.find(_.tostring == key) } it works because .values gives list[enum#value] , can matching.

character encoding - Python 3 - number of letters in an encoded string -

i number of letters in given string. however, len(txt) returns number of letters in unicode form (i guess), actual number of letters less get. for example: txt = שלום וברכה len(txt) # returns different 10 i saw solution python 2 using string.decode , not available in python 3 - , i'm not sure appropriate answer me. way, encoding string cp862 . edit: more details: read text file using with open(path, "r", encoding="cp862") textfile: this output of line read when print it ╫¬╫ñ╫¿╫ש╫ר ╫£╫ª╫ץ╫¥: ╫¢╫ת ╫¬╫ª╫£╫ק╫ץ ╫נ╫¬ ╫¢╫ש╫ñ╫ץ╫¿ the length 52. real line is: תפריט לצום: כך תצלחו את כיפור , real length 29 probably, opening file wrong encoding scheme, here demonstration: >>> import sys >>> sys.version '3.4.3 (default, oct 14 2015, 20:28:29) \n[gcc 4.8.4]' >>> >>> s = '╫¬╫ñ╫¿╫ש╫ר ╫£╫ª╫ץ╫¥: ╫¢╫ת ╫¬╫ª╫£╫ק╫ץ ╫נ╫¬ ╫¢╫ש╫ñ╫ץ╫¿' >>> len(s) 52 >>> >>> s = s.encode(...

angularjs - Insert plain HTML into template -

i use angularjs 1.4 , need insert plain html receive $http.get() template html tags jquery inserts plain html dom tags. conroller code: var onloadurl = function( data ){ $scope.joomlacomponent = data; } joomlacomponent.loadurl( $location.absurl(), true ).then( onloadurl ); template: <script type="text/ng-template" id="joomla-component.tpl"> <div class="uk-grid uk-margin-large"> {{joomlacomponent}} </div> </script> now insert plain text need have html tags inserted document's dom. first off, need call $scope.$evalasync() in onloadurl function trigger digest cycle. then, use ng-bind-html="joomlacomponent" instead of {{ joomlacomponent }} .

bash - find the latest modified file and exec -

i want find out latest built rpm in directory , exec on it. similar below. /bin/ls -1t srcdir/*.rpm | head -1 but find command find srcdir/*.rpm <get-only-the-most-recently-modified-file> -exec "<do-something>" two approaches -- 1 portable non-gnu platforms, other fast large directories (to extent allowed filesystem): portable what? bashfaq #3: how can sort or compare files based on metadata attribute (newest / oldest modification time, size, etc)? relevant here. summarize: latest= f in "$srcdir"/*.rpm; [ "$f" -nt "$latest" ] && latest=$f done how? [ "$a" -nt "$b" ] checks whether file named in variable a newer named in variable b in ksh-derived shells. fast ...to clear, faster large directories, opposed faster in cases. said, it's adapted find (for instance) 5 or 10 newest files, or files except 5 or 10 newest, other approach not effectively. what? if ...

How to send IDOC's to the SAP through wso2 esb -

i have gone through below document , configured: https://docs.wso2.com/display/esb481/sap+integration i have use idoc protocol talk sap, created proxy idoc structure , try hit proxy getting clueless null pointer exception. error log: tid: [0] [esb] [2016-07-07 08:20:22,543] warn {org.apache.synapse.endpoints.endpointcontext} - endpoint : sapidocendpoint marked suspended failed {org.apache.synapse.endpoints.endpointcontext} tid: [0] [esb] [2016-07-07 08:20:22,543] warn {org.apache.synapse.endpoints.endpointcontext} - suspending endpoint : sapidocendpoint - current suspend duration : 30000ms - next retry after : thu jul 07 08:20:52 clt 2016 {org.apache.synapse.endpoints.endpointcontext} tid: [0] [esb] [2016-07-07 08:20:22,543] error {org.wso2.carbon.transports.sap.saptransportsender} - error while sending idoc epr : idoc:/sapdelts {org.wso2.carbon.transports.sap.saptransportsender} java.lang.nullpointerexception @ org.wso2.carbon.transports.sap.idoc.defaultidoc...

Rails 5 Unpermitted parameter: organization -

i getting error unpermitted parameter: organization when submit sign form user. using 'auth scratch' variant, not devise. here code: user.rb class user < applicationrecord belongs_to :organization has_secure_password end organization.rb class organization < applicationrecord has_many :users has_many :tasks accepts_nested_attributes_for :users end users_controller.rb class userscontroller < applicationcontroller def new @user = user.new @organization = organization.new end def create @user = user.new(user_params) @user.build_organization(user_params[:organization_attributes]) if @user.save session[:user_id] = @user.id redirect_to root_url, notice: "thank signing up!" else render "new" end end private # use callbacks share common setup or constraints between actions. def set_user @user = user.find(params[:id]) end # never trust parameter...

database - Star Schema design from 3NF -

Image
i'm newbie data warehousing , i've been reading articles , watching videos on principles i'm bit confused how take design below , convert star schema. in examples i've seen fact table references dim tables, i'm assuming questionid , responseid part of fact table? advice appreciated. i can't see image @ moment (blocked firewall @ office). i'll try give ideas. the general idea organize measurable 'facts' called fact tables. there 3 main types of facts, topic different day (but i'd happy go if needed). each of these facts you'd see in center of typical 'star schema'. other attributes within fact tables typically fk references dimension tables. regarding dimensions, these groups of attributes share commonality (the notable being calendar dimension). important because when you're doing analysis across multiple facts dimensions use connect them. if consider simple example: product ordered , shipped. have 2 transac...

jquery - Access content of external css using javascript -

its easy internal css code like: var css = ''; $('style').each(function(){ css+=$(this).html(); }); now if there external link css file like: <link href="style.css" /> is there anyway know css codes available using javascript/jquery? is there anyway know css codes available using javascript/jquery? yes. there stylesheets collection containing stylesheet objects, of cssstylesheet objects , have cssrules property (just rules on old ie) cssrulelist containing cssrule objects. doesn't matter whether styleshet external (via link ) or inline (via style ). example: var foreach = array.prototype.foreach; foreach.call(document.stylesheets, function(sheet, index) { if (sheet.cssrules || sheet.rules) { log("sheet #" + index); foreach.call(sheet.cssrules || css.rules, function(rule, ri) { log("- rule #" + ri + ": " + rule.csstext); }); } else { log(...

c++ - ' ' was not declared in this scope -

i'm new , can't understand meaning of "not declared in scope" error. tried declaring these functions , using "" show function did not compile , run. here errors: in function 'int main()': [error] 'random' not declared in scope [error] 'sound' not declared in scope [error] 'delay' not declared in scope [error] 'nosound' not declared in scope [error] 'blink' not declared in scope [error] 'textattr' not declared in scope #include<stdio.h> #include<iostream> #include<dos.h> #include<conio.h> #include<stdlib.h> using namespace std; int main () { int count=50; while(count--) { sound(90*random(10)); delay(100); nosound(); textattr(random("16")+'a'+blink); cprintf("kshitij"); } } looks have turbo c++ code in 1990's. last version of turbo c++ released before standardized c++, it...

ios - How to shuffle a INSPhotoViewable (custom) array? -

i trying shuffle array (i using https://github.com/inspace-io/insphotogallery extension): lazy var photos: [insphotoviewable] = { return [ insphoto(imageurl: nsurl(string: "http://i.imgur.com/jxy2d4a.jpg"), thumbnailimageurl: nsurl(string: "http://i.imgur.com/jxy2d4a.jpg")), insphoto(imageurl: nsurl(string: "http://i.imgur.com/nc4bqlb.jpg"), thumbnailimageurl: nsurl(string: "http://i.imgur.com/nc4bqlb.jpg")), ]() i know can shuffle int array using extension collectiontype { /// return copy of `self` elements shuffled func shuffle() -> [generator.element] { var list = array(self) list.shuffleinplace() return list } } extension mutablecollectiontype index == int { /// shuffle elements of `self` in-place. mutating func shuffleinplace() { // empty , single-element collections don't shuffle if count < 2 { return } in 0..<count ...

html - How come footer isn't inside Container? -

when made footer's width 100%, noticed stretched outside of container (which think based on html looks inside it). there's many divs when looked on 2-3 times (and think css reason it, still can't figure out), still no avail. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>social network</title> <link rel="stylesheet" type="text/css" href="css/styles.css" media="all"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href='https://fonts.googleapis.com/css?family=open+sans:400,700' rel='stylesheet' type='text/css'> <!--[if lt ie 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif] --> </head> <body> <!-- header --> <div class="container"> <...

java - Integrating Spring dependency injection with Ninja framework -

i have looked replacing our current java web framework (play framework) more java based framework. have came across 2 web frameworks looked attractive me: the ninja framework & spark framework. i tend prefer ninja framework, can not manage find working example of along spring framework 's dependency injection container (that use no intentions replace it). can point me working example (of spring ninja) or describe pros or cons using ninja framework?

java - How to start Eclipse when Windows 10 starts -

i have upgraded windows 10, , used have eclipse application in startup folder. has been replaced section in task manager, , cannot add eclipse this. has got round issue? the user startup folder in windows 10 located default @ c:\users\username\appdata\roaming\microsoft\windows\start menu\programs\startup . add shortcut program execute on startup folder (in case eclipse), , should run next time restart. more details, see add app startup windows 10 .

haskell - Using a monad to implicitly check refinement type well-formedness -

while implementing refinement type system, need put in checks make sure types well-formed. example, type num[100,0] shouldn't happen, num[lb,ub] type of numbers larger lb , smaller ub . wrote: -- formation rules class refty t tyok :: t -> bool instance refty ty tyok (numty (n1, n2)) = n1 <= n2 tyok (catty cs) = isset cs {- data wellformed t = valid t | invalid instance monad wellformed (>>=) :: refty => wellformed -> (a -> wellformed b) -> wellformed b valid t >>= f | tyok t = f t | otherwise = invalid invalid >>= _ = invalid -} which got me known problem of " restricted monad ". suggested answer have wellformed monad general restrict functions. go adding well-formed check everywhere. there better way around? in case, don't think want monad, sugar accompanies do notation. example, have thought definition of applicative like? things mess...

Pass a null terminated string to bash function -

my exported function : myfunc(){ # operation null terminated string # if use $1, guaranteed null terminated string? } for sake of example, consider find . -type -f -print0 | while read -rd '' line myfunc "$line" done if you're using print0 make sure use empty ifs= in addition -d '' in read make null delimiter: while ifs= read -r -d '' line; myfunc "$line" done < <(find . -type f -print0) as shown can avoid pipeline , use process substitution.

unity3d - Can I use Unity remote with a Android emulator instead of Android phone? -

Image
unity remote app. allows connect unity while running project in play mode editor. but if want test game don't have android phone? yes, happens ¯\_(ツ)_/¯ i have great android emulator: nox app player the emulator doesn't have usb , show me standsrt text connect device usb cable ..... bla bla bla ...game in unity editor running...emulator doesn't display game. can somehow connect emulator unity using unity remote ? or using else? how? not sure if still need solution problem, think should leave solution come later. you can connect nox unity via unityremote (i'm using unity remote 5) adb of nox. here steps : rename adb.exe other (i.e adb_origin.exe). it's located @ sdk folder\platform-tools go nox installation folder\bin, looking nox_adb.exe, copy location of origin adb.exe rename nox_adb.exe adb.exe open cmd , enter : adb.exe connect localhost:62001 , see "already connected localhost:62001". if not, can try replace localhost 1...

How to export a datetime value from mysql to php -

i want promotion code feature ecomm website. have variable called $currentdate i'm not sure correct format. $currentdate = date("y-m-d") i compare date in database called expirydate. in database have row promocode = gss2016 (varchar), discount = 0.1 (double, suppose represent 10% discount) , expirydate = 2016-07-28 (datetime in y-m-d if i'm not wrong...) have run query check if promocode exist i'm unsure of how export php , compare current date $currentdate = date("y-m-d"); session_start(); $conn = mysqli_connect("localhost", "root", "","websitedb"); $promocodeinput = $_post['promocode']; $sql = "select * promocodedb promocode = '$promocodeinput'"; $codechecker = mysqli_query($conn, $sql) or die (mysqli_error($conn)); if (mysqli_num_rows($codechecker) > 0) { $fetchdiscount = mysqli_fetch_assoc($codechecker); $expiry = $fetchdiscount['expirydate']; ...

xcode8 - Xcode 8 Swift 3 missing "Main Interface" -

i have been working on project in beta xcode 8 using swift 3 , today when tried build application found "main interface" in targets missing , when try drop down choose nothing there. checked storyboards , added project. checked storyboards entry points, exist , in right place. the project builds black screen. tried removing , re-adding entry points , did not work. if try force name of storyboard main interface errors saying storyboard not exist, , in project. wondering if came across project , has solution.

xslt - xsl modulus issue not displaying html inside for each if clauses -

here's code: <xsl:for-each select="/*/articles/article"> <xsl:if test="(pos() mod 5)"> // display html here </xsl:if> </xsl:for-each> doesn't seem work. page hangs. not quite sure whats wrong xpath defines function named position() not 1 named pos() .

java - Subtract one day from date with format as mm/dd/yyyy -

this question has answer here: how can increment date 1 day in java? 22 answers i have date field being placed .csv , need subtract 1 day each date. these dates taken 1 csv string variable, , placed string variable. these dates formatted mm/dd/yyyy, , need subtract 1 day each of these dates. looking best solution on how this. for example have date 7/28/2016 need taken 7/27/2016. all appreciated, in advance. edit: appreciate answers fast, ended separating steps first comment, have used jodatime answer went other options seeing around. this code: private string subtractdate(string date) { simpledateformat formatter = new simpledateformat("mm/dd/yyyy"); string returnvalue = ""; try { date newdate = formatter.parse(date); calendar cal = calendar.getinstance(); cal.settime(newdate); ...

Can't access oracle APEX page -

i worked oracle apex , created applications. access url localhost:9090/apex/apex_admin today tried change book work-group , changed ip of laptop , restarted it, can't access apex environment more although restore computer 3 day no way. note: when enter url: localhost in browser opens iis7 page. please can me in need finish work possible.

Understanding Spring MVC sub-project -

i have experience in using spring mvc framework, however, still have doubts. understand, mvc framework helps in writing web applications using mvc design pattern. now, tried understand better, came know uses 2 design patterns: "front controller" followed "mvc" design pattern`. the first part understood, "front controller" provided spring mvc in form of dispatcherservlet intercepts incoming requests intended it. where "mvc framework" in spring mvc framework? understood, developer writes controller, model, view. if developer doesn't write code of, controller there nothing framework provides controller. i having difficulty how spring mvc supports mvc pattern when developer has write code. let me explain taking controllers example. yes. at first glance , may seems spring doing nothing. it might because of integration code between application code , framework reduced annotations.so developers missed notice single word ...

javascript - How to change this specific css class inside div, in Date Picker jquery-ui? -

in calendar date picker, have div <div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-datepicker-multi-2 ui-datepicker-multi"> i want change css class class: ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-datepicker-multi-2 ui-datepicker-multi i used this, doesn't work: .ui-datepicker .ui-widget .ui-widget-content .ui-helper-clearfix .ui-corner-all .ui-datepicker-multi .ui-datepicker-multi-2 { position: absolute; top: 38px; left: 44px; z-index: 1; display: block; width: 55em; } how change css class? css incorrect? there's wrong div, because 1 style automatically added div. checked inspect element, saw there's element inline, there's non. that's why css won't affect it, how solve it? how remove auto style div? i need me following javascript code, how set width width: "55em" because of following code css w...

Deleted actions appear again after export/import from Wit.ai -

when export , import app on wit.ai, actions (responses) deleted before re-appear (and marked not unused). intended? it's not expect. thanks no, not intended , bug. tested following scenario , worked me add "test" bot sends 1 of story, save it. remove story , save story again. went action tab, delete action "test". export app. create new app importing exported one. checked in both story , actions tab , "test" answer not there

c++ - Understanding recursion with small example -

hi have written small recursive method in cpp. trying understand recursion void print(int n) { if(n==6) return; print(++n); cout<<n<<endl; //output 6 5 4 3 2 } void print(int n) { if(n==6) return; print(n+1); cout<<n<<endl; //output 5 4 3 2 1 } void print(int n) { if(n==6) return; print(n++); cout<<n<<endl; //programme crash } could please explain me happening internally? function calls placed on stack. think of stack of plates. time "print(x)" called in code, addition stack of plates. function removed stack when gets closing curly bracket or when hits return statement. i assume you're calling print(0) on these functions. such print(0) first thing on stack. last function crashes because calls print(0) "forever" until fails have room more "plates." called infinite recursion , infinite recursion infinite due limitation of...

c# - UNity3D, return value from one class/method to another class/method in Unity3D -

in unity3d, i have weapon script , stamina script. want drain stamina when weapon swings. i tried code , have been playing around couple of hours. i using unity gives me comment using new , should use add.component etc appreciate answer question well! hopefully post bit better in terms of title , information/layout tired , low on energy. im going take short food break before it! here stamina system : ` public class hands : monobehaviour { public int startinghealth = 100; public int currenthealth; public int healthreg; sword mysword; bool isregenhealth; public float startingstam = 100; public float currentstam; public float stamreg; bool isregenstam; void awake() { currentstam = startingstam; } void update() { if (currentstam != startingstam && !isregenstam) { startcoroutine(regainstamovertime()); } } private ienumerator regainstamovertime() { isregenstam = true; while (currentstam < startingstam) { stamr...

Using Mithril to generate HTML for a Bootstrap Accordion -

have problem using mithril generate functioning bootstrap accordion. when write html manually accordion works ok. <div id="mycontent"> <div class="container"> <div class="row"> <div class="col-md-8 p-t-3"> <div id="bookingaccordion" role="tablist"> <div class="panel panel-default"> <div id="headingone" class="panel-heading" role="tab"> <h4 class="panel-title"> <a data-target="#collapseone" data-toggle="collapse" data-parent="#bookingaccordion"> address , contact details </a> ...

xamarin.android - Reading an android file with Xamarin -

this super simple i'm having trouble reading bytes file. have working fine ios android crashes directorynotfoundexception . think uri wrong i'm not sure i'm wrong it... my view has button opens file picker... var selecteddocumentpath = await dependencyservice.get<ifilepicker>().pickdocument(); my filepicker class... class filepicker : ifilepicker { public async task<string> pickdocument() { string fileuri = string.empty; console.writeline("selecting document android device."); intent intent = new intent(intent.actionopendocument); intent.settype("*/*"); intent.putextra(intent.extramimetypes, new string[] { "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }); intent.addcategory(intent.categoryopenable); ((activity)forms.context).startactivityforresult(intent.createchooser(intent, "select document...

Filter or clean CSV data while loading to PostgreSQL -

i loading csv files postgresql tables using bulk load method copy command. there fields have bad character in (like "|", """, ";" , on). keep getting different error while loading it. tried tab-delimited, comma-delimited, , other options, too, no luck. is there way can clean csv data before loading postgresql using copy command or there copy command syntax can replace bad characters default? these of syntax have tried: copy tblsf '/filelocation/test.csv' csv header delimiter ',' null '?'; copy tblsf '/filelocation/test.csv' csv header delimiter '|' null '?'; copy tblsf '/filelocation/test.csv' csv header delimiter e'\t' null '?'; copy tblsf '/filelocation/test.csv' csv header delimiter '<>' null '?'; thanks in advance. sometimes file not encoded using utf-8. try this: iconv -f utf-8 -t utf-8 -c /filelocation/test.csv > ...

C - Is sorting an array of pointers of structs slower than sorting the structs directly (qsort) -

i sorting millions of structs organzied in array qsort-function of standard c library. tried optimize performance creating array of pointers of struct same length. in contrast expectations execution time of second variant slower: qsort array of structs: 199s qsort array of pointers of structs: 204 i expected time swapping pointer blocks in memory faster moving structs (size 576). may have performance leaks or known behaviour? there other issues here. by creating array of pointers fragmenting memory. algorithms in standard libraries designed optimise sorting of contiguous arrays, doing missing cache far more if had bigger array. quicksort in particular quite locality of reference, halve sample size , sorting subsets of original array in chunks can fit cache. as general rule, cache misses order of magnitude slower hits. result time delay significant enough make speed not copying bytes.

javascript - How to get two different array objects together -

here attached json . "mainsteps": [ { "id": "9b3b64b4-d8a5-46d5-b464-066dc5c45dc3", "name": "main step 1", "steps": [ { "name": "sub step 1.1" }, { "name": "sub step 1.2" } ] }, { "name": "main step 2" "steps": [ { "name": "sub step 2.1" }, { "name": "sub step 2.2" } ], }, { "name": "main step 3", "steps": [ { "name": "sub step 3.1" }, { "name": "sub step 3.2" } ], } ] am looking output --> [main step 1, sub step 1.1 , sub step 1.2] ,[main step 2, sub step 2.1 , sub step 2.2] , [main step 3, sub step 3.1 , sub step 3.2] . spend whole day output getting output [[main step ...