Posts

Showing posts from July, 2013

php - Symfony. Use form to add rows to doctrine database. -

well need add rows data table in doctrine. of course know how create database , how add data without form. need make symfony made page add rows databasy via created form. this route form builder /** * @route("/lol") */ public function newaction(request $request) { // createformbuilder shortcut "form factory" // , call "createbuilder()" on $form = $this->createformbuilder() ->add('pytanie', textareatype::class) ->add('odpowiedz1', texttype::class) ->add('prawidlowa1', checkboxtype::class) ->add('odpowiedz2', texttype::class) ->add('prawidlowa2', checkboxtype::class) ->add('odpowiedz3', texttype::class) ->add('prawidlowa3', checkboxtype::class) ->add('odpowiedz4', texttype::class) ->add('prawidlowa4', checkboxtype::class) ->getform(); return $th

PHP - accessing one html values in another html using single php file -

i want access value send first.html test.php using ajax, , value send second.html, achieve tried both session , cookies . i'm not putting complete code basic structure this first.html <html> send value test.php </html> second.html <html> access value test.php </html> test.php <?php if(execute when request comes first.html){ $cookie_name = "user"; $cookie_value = "john doe"; setcookie($cookie_name, $cookie_value, time() + (86400 * 30)); echo " "; } else if(execute when request comes second.html){ if(!isset($_cookie[$cookie_name])) { echo "cookie named '" . $cookie_name . "' not set!"; } else { echo "value is: " . $_cookie[$cookie_name]; } } else{ $cookie_name = "user"; $cookie_value = "john doe"; setcookie($cookie_name, $cookie_value, time() + (86400 * 30)); if(!isset($_cookie[

javascript - cytoscape js updating node label dynamically with fontawesome -

example: https://jsfiddle.net/bababalcksheep/ajhnmcrb/16/ what needed: want dynamically change content name of node , want use font awesome icon unicode in it. tries: if use content: '\uf173' , font renders correctly. if want update node label new font unicode, not work. prints \uf173 instead of font i using input <input type="text" value="\uf173" id="title"> change node id e cy.$('#e') change content. $('#title').on('input', function() { cy.$('#e').css({ content: $('#title').val() }); }); a unicode escape character should work in html value if it's specified in code. if type \uf173 in input has value '\\uf173' . you'll have parse if want recognise similar typed string unicode escape value. or you'll have have user type real value want using kind of os system key sequence. or append value. wouldn't expect us

login with username and password by using selenium in python -

Image
software:python 2.7 + selenium browser:chrome 57 hi, i need download report files website. there os level pop-up window in have input username , password. i have tried solution input user name , password url link. eg: https://username:password@xxx.com but not work because username includes "\" translated "/" in url. and tried download software named autoit, can not install in pc since security issue. any solutions try issue. thanks the easiest way authenticate in case use username , password in url. still can authenticate username "\" symbol, need encode first in url format . example, before forming final url credentials can encode username urllib . code should work in python 2.7: import urllib username = "user\\name" password = "password" username_encoded = urllib.quote_plus(username) url = "http://%s:%s@xxx.com" % (username_encoded, password) print(url) in output should see: http://use

bash - Kuberntes kill process inside pod -

i using following code randomly kill processes inside pods : ${delay:=30} if [ "$#" -ne 1 ]; echo "one argument expected specifying time in seconds run" else end=$((seconds+$1)) while [ $seconds -lt $end ]; kubectl \ -o 'jsonpath={.items[*].metadata.name}' \ pods | \ tr " " "\n" | \ shuf | \ head -n 1 | #xargs -t --no-run-if-empty \ kubectl exec $(head -n 1) -- kill -9 9 #if [ $((seconds+${delay})) -lt $end ];then #break loop if (seconds completed + delay) greater time specified in argument # sleep "${delay}" #sleep pod gets deleted , terminating pod not selecte #else # break #fi done fi the script runs no output shown in goes infinite loop. can going wrong? two things: -o 'jsonpath={.items[*].metadata.name}' should go after kubectl pods , otherwise kubectl return message. also, add -t kubectl ex

javascript - how to append active color to the li element on filtering? -

i want append active class li element based on filtering in angular,i tried ng-class iam not getting. here html code: <div class="input-group dropdown" style="margin-top:50px;margin- left:100px;"> <input type="text" class="form-control" ng-model="input.val" data-toggle="dropdown" aria-describedby="basic-addon2" ng-change="fnautocompletequestion(input.val)" > <div class="dropdown-menu width-menu"> <ul style="width: 225px; height: auto; overflow: auto; list-style-type: none;margin-left: -30px;"> <li ng-repeat="value in data | filter: input.val" ng-class="{'active': $index == value.txt} ng-click="input.val=value.txt"> {{value.txt}} <hr ng-show="!$last" style="margin-top: -1px; margin-bottom: 12px;">

Find if a date is in date range using MySQL -

hi have following values stored in mysql table: --- ------------------------ ------------------- id | startdate (varchar (20)) | enddate(varchar(20)) --- ------------------------ ------------------- 1 | 03-04-2017 | 18-04-2017 i using following sql find if date within startdate , enddate: select (date_format(str_to_date('03-04-2017','%d-%m-%y'),'%d-%m-%y') >= startdate , date_format(str_to_date('03-04-2017','%d-%m-%y'),'%d-%m-%y') <= enddate) valid holiday my issue when execute query , provide 03-04-2017 returns 1 returns 1 when provide 03-05-2017. could please highlight wrong in query? use query this: select * holiday str_to_date(startdate,'%d-%m-%y') between str_to_date('03-04-2017','%d-%m-%y') , str_to_date('03-04-2017','%d-%m-%y'); sample mysql> select if(str_to_date('11-04-2017','%d-%m-%y') ->

asp.net mvc - How to Get SMS log from Twilio Webhook -

i making app in mvc send/receive sms using twilio api. done sending sms functionality confused get(inbound) sms log sent twilio number user. there few article not enough me. please me. twilio developer evangelist here. i recommend guide built twilio documentation team on how receive , reply sms messages in c# . explain webhook is, how use twiml , how use knowledge in asp.net mvc receive , respond sms messages.

java - Android Live Wallpaer crashed(NullPointerException, canvas is a null object)but I cannot find where -

this question has answer here: what nullpointerexception, , how fix it? 12 answers 04-14 12:04:30.971 1639-1938/system_process i/windowmanager: destroying surface surface(name=media:com.android.wallpaper.livepicker/com.android.wallpaper.livepicker.livewallpaperchange) called com.android.server.wm.windowstateanimator.destroysurface:2014 com.android.server.wm.windowstateanimator.destroysurfacelocked:881 com.android.server.wm.windowstate.removelocked:1449 com.android.server.wm.windowmanagerservice.removewindowinnerlocked:2478 com.android.server.wm.windowmanagerservice.removewindowlocked:2436 com.android.server.wm.windowmanagerservice.removewindowlocked:2305 com.android.server.wm.windowmanagerservice.removewindow:2300 com.android.server.wm.session.remove:193 04-14 12:04:30.990 3852-3852/tianranwang.livewallpaper d/mainservice: dispose 04-14 12:04:31.018 1639-1990/system

Playframework and Spark classpath issue -

is there workaround issue? managed integrate spark in playframework in dev mode? i'm running playframework-2.5 application uses spark-sql-2.1.0 read csv file. class should instantiated spark-sql listing2exported . i read there might classpath issues when run in dev mode , can confirm that. dev mode: if execute activator run exception prod mode: if execute activator start file read properly. . case class listing2exported ( extractor:option[string], categoryid:option[int], categoryname:option[string], productname:option[string], productcode:option[int] ) the exception 1) error injecting constructor, scala.scalareflectionexception: class org.raisercostin.namek.io.listing2exported in javamirror playdependencyclassloader{.... ] not found. @ scala.reflect.internal.mirrors$rootsbase.staticclass(mirrors.scala:123) ~[scala-reflect-2.11.8.jar:na] @ scala.reflect.internal.mirrors$rootsbase.staticclass(mirrors.scala:22) ~[scala-reflect-2.11

JSON tag order in Python -

this question has answer here: how keep json key order fixed python 3 json.dumps? 2 answers json.dumps messes order 4 answers i'm new python, been learning @ college , have question. first of all, important part of code in question: #this on tcp client name = raw_input("box name: ") timestamp = time.time() json_dict = {'type': 'create', 'name': name, 'timestamp': timestamp} print json_dict tcp_s.send(pickle.dumps(json_dict)) #this on tcp server json_dict = pickle.loads(client_s.recv(65536)) file_received = json.dumps(json_dict,indent=4) print file_received im trying carry on information client server , have convert json, successful. issue: order in presents typ

arrays - What is the time complexity of this program fragment? -

counter = 0; (i=1; i<=n; i++) if (a[i] == 1){ counter++; } else { f (counter); counter = 0;} } let a[1, …, n] array storing bit (1 or 0) @ each location, , f(m) function time complexity θ(m) . then, time complexity of program fragment ? i stuck in part time complexity of function f(0) ,as called continuously if array contains zeroes . the code theta( n ). let's f(m) has cost cm constant c. 1 should upper , lower bound analysis 2 different constants since f(m) theta( m ), analysis more or less same. then, f called sequence of values, x1, x2, x3, ..., xk correspond runlengths of 1s. total cost of calling f c*x1 + c*x2 + ... + c*xk = c(x1 + x2 + ... + xk) . since (x1 + x2 + ... + xk) total number of 1s in array, sum @ n (the length of array). total cost of calling f o( n ). the code loops n times, n lower bound total cost. we've shown linear upper , lower bounds, , f theta( n ).

angularjs - $viewContentLoading is not working -

i'm trying log value before content gets loaded. i'm using $viewcontentloading purpose getting called inside init function. but, value not getting logged. can what's wrong code. var app = angular.module('plunker', []); app.controller('mainctrl', function($rootscope, $timeout, $q) { function init() { $rootscope.$on('$viewcontentloading', function(event, viewconfig) { alert("hello"); console.log(33) }); } init(); }); <!doctype html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <link rel="stylesheet" href="style.css" /> <script src="http://code.angularjs.org/1.0.7/angular.min.js" data-semver="1.0.7"></script> <script src="app.js"></script> </head> <body ng-controller="mainctrl&

c# - Bulk update in SQL database using generic class object -

i working c#.net application.. wanted update bluck of records in database particular chunk or batch.. in code maintaining generic class object collection , needs update database in chunk.. list<testrecord> recordcollection = new list<testrecord>(); recordcollection.add(new testrecord(id = 1,name = 'test',body = 'html')) recordcollection.add(new testrecord(id = 2,name = 'test2',body = 'html2')) maintaining batches 3000 records set chunk of data updation. if(recordcollection.count > 3000) { == update record set in database using single update query.. } i have searched few of method bluck update below, creating datacontext. creating linq sql using userdefinetable type, method require datatable instead generic class. is there direct method can directly use generic object collection ? scenario mentioned in above code. and if there no direct way bluck update using generic class best way use case. please advise. thanks

JavaScript style.height gives me an error -

i had working on sliding menu. so debug proposes made button: <input type="button" style="position: fixed; left:0; bottom:0; width:50px; height:25px;" value="test" onclick="login('logf')" /> and here have login function: var loginshow = false; function login(c) { e = document.getelementsbyclassname(c); if(loginshow) { e.style.height = "0"; } else { e.style.height = "110px"; } loginshow=!loginshow; } but google chrome gives me error: bar.js:13 uncaught typeerror: cannot set property 'height' of undefined @ login (bar.js:13) @ htmlinputelement.onclick ((index):32) getelementsbyclassname returns array-like object of child elements have of given class names. need iterate elements , apply style on each one var loginshow = false; function login(c) { let elements = document.getelementsbyclassname(c); f

sql server - PowerShell DTexec /ISServer pass a connectionstring as package variable -

i want execute ssis package on isserver via powershell. used script found on microsoft page. doesn't work out me. want pass connectionstring not assign connectionmanager variable string. in connectionstring there \ , ; present , powershell sees new option. want seen whole string. i've tried everything, adding "\" , \"" websites suggested, used instead of \, put double quotes, put ' quotes, nothing works. getting error option myserver\myserver ;initial not valid. can't remove myserver\myserver` because connection instance. the connectionstring assigned via changing variable. variable contains data source=myserver\myserver;initial catalog=sql_myarchive;provider=sqlncli11;integrated security=sspi; dtexec /isserver "\ssisdb\test\test.dtsx" /server "myserver" /envreference 8 /par "$package::connectionsource";`""data source=myserver\myserver;initial catalog=sql_myarchive;provider=sqlncli11;integrated

collections - Java excplicit cast of nested maps -

why cast work? import java.util.hashmap; import java.util.map; public class testmap { public static void main(string[] args) { map<string, map<string, map<string, map<string,integer>>>> resultmap = new hashmap<>(); map<string, object> amap = new hashmap<string, object>(); map<string, integer> hiddenmap = new hashmap<string, integer>(); hiddenmap.put("fortytwo", 42); amap.put("key", hiddenmap); resultmap = (map<string, map<string, map<string, map<string, integer>>>>) amap.get("key"); system.out.println(resultmap); } } also this: map<string, map<string, map<string, map<string,map<string,integer>>>>> resultmap = new hashmap<>(); ... resultmap = (map<string, map<string, map<string, map<string,map<string,integer>>>>>) amap.get("key");

google apps script - Importing CSV in GAS - too slow -

i have script imports csv file. works, it's slow in opinion. since csv file pretty big script exceeds maximum execution time. does have suggestions on how increase speed of code? fyi: due s3 authentication cannot use built-in sheets function. function myfunction() { var liquiditybalance = spreadsheetapp.openbyurl(liquiditybalancesheet).getsheetbyname('liquidity'); var s3 = s3.getinstance(awsaccesskeyid, awssecretkey); var froms3 = s3.getobject(bucket, file); var data = utilities.parsecsv(froms3.getdataasstring(), '\t'); var csv = [] liquiditybalance.clearcontents(); (var = 0; < data.length; i++) { var row = [] (var = 0; < data[i].length; a++) { row.push(data[i][a]); } liquiditybalance.appendrow(row); } } hopefully following code run faster. code assembles data , writes assembled data in 1 action instead of appending rows 1 @ time. if code still times out, need run partial amounts of data , know left

mysql - MAMP asking to install wordpress after I deleted files from /db/mysql56 -

after mysql wouldn't start, searched, , found advice, after following said advice, deleted files in mamp/db/mysql56 (not folders). this solved problem of mysql not loading. but... asks me install wordpress again. if try that, won't let me. errors saying database doesn't exist etc. does know of can try local site , running? thanks much! mike you deleted whole mysql database of mamp.. thats problem. restore files , debug further why mysql not starting. did can not fix problem having. if don't have backup of files consider database lost , remove mamp , reinstall start over.

javascript - JQuery selector, partial DOM searching for performances -

i'm working jquery , @ point use jquery selectors make page work. issue here html work can long depending on data work , looks this. html <div class="mailing"></div> <input type="text" class="mail_subject"/> <input type="text" class="mail_body"/> <!-- can have 1 n number of these --> <!-- preview tags --> <p class='main_subject'></p> <p class='main_body'></p> <!-- , few more things don't use here --> </div> <div id="table1"> <table id="ranking"> <tbody> <!-- data, can have 0 ~3500 rows --> </tbody> </table> </div> as can see, page more or less divided in 2 parts, <div class="mailing"> , contains few forms, , <div id="table1"> displaying lots of data. in mailing

c++ - Using std::remove_if with lambda predicate to delete multiple elements -

what fastest , efficient way of using std::remove_if lambda predicate delete multiple elements @ same time? @ moment have point struct position , unique id. inside update loop fill points vector , add points deleted @ end of update loop. @ moment have call remove_if inside loop remove deleted points points vector. example if add 10 points per frame , after loop points check if point outside screen bounds, if added deletedpoints_. struct point { /// position. vector3 position_; /// unique id per point int id_; } /// current max id int maxid_; /// points std::vector<point> points_; /// deleted points std::vector<point> deletedpoints_; //updates 60fps void app::update() { /// add 10 points per frame (int = 0; < 10; ++i) { point newpoint; /// add position newpoint.position_ = worldposition; /// add id starts 1 maxid_ += 1; startpoint.id_ = maxid_; /// add new point in points

asp.net mvc - MessageListRequest function not available in Twilio -

i working develop project , need implement send/receive sms functionality. found code resources get(inbound) sms when tried implement in project wonder messagelistrequest , messageresult functions not available in twilio. have 1 of idea? var client = new twiliorestclient(accountsid, authtoken); var request = new messagelistrequest(); messageresult messages = client.listmessages(request); twilio developer evangelist here. it looks reading documentation version 4 of c# twilio library. have released version 5 of c# twilio library accesses lists of messages differently. here example of how list messages in version 5: using system; using twilio; using twilio.rest.api.v2010.account; class example { static void main(string[] args) { // find account sid , auth token @ twilio.com/console const string accountsid = "your_account_sid"; const string authtoken = "your_auth_token"; twilioclient.i

javascript - Canvas onClick add to array -

i got html5 canvas project i'm struggling with. i'm trying add new particle on click. , particles pushed particles array, particle not show. can see particle pushed array mouse coordinates, doesn't seem last particle drawn. doing wrong? see example. // request animation frame var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; // canvas var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); // set full-screen canvas.width = window.innerwidth; canvas.height = window.innerheight; // options var num = 100; // number of particles draw var size = 2; // particle size var color = '#dd64e6'; // particle color var min_speed = .3; // particle min speed var max_speed = 2; // particle max speed var dist = 100; /

javascript - how to find the id of html element that is generated from json -

i generating html list items json. id equal id in json. can not refer id='thing'. question is, how i, in later functions, function refer id of object when know id = i? html += "<li class='list-item ui-state-default addnewcontext' id=" + + ">" + card.card_name + ' - ' + card.price + "<button> x </button>" + "</li>" ; / you have i id. mean want reference element id? var myobj = jquery("#" + i);

Cannot reopen Jupyter notebooks on Google Cloud Dataproc cluster after stopping cluster -

i using google cloud dataproc run jupyter notebook (following these instructions: https://cloud.google.com/dataproc/docs/tutorials/jupyter-notebook ). i ran notebook, saved it, , @ point later on, stopped cluster (using gui). later restarted cluster , tried run jupyter notebook again same instructions in last step, when try open jupyter in chrome get: "this site can't reached. webpage @ http://<my-cluster-name>:8123/ might temporarily down or may have moved permanently new web address. err_socks_connection_failed." also (i don't know if helps) in terminal window configured browser, have message: error:child_thread_impl.cc(762)] request unknown channel-associated interface: ui::mojom::gpumain google chrome[695:8548] nswindow warning: adding unknown subview: <fullsizecontentview: 0x7fdfd3e291e0>. break on nslog debug. google chrome[695:8548] call stack: ( "+callstacksymbols disabled performance reasons" ) in terminal window ssh-e

r - How to rename backticked contained column names in dplyr -

i have following tibble: library(tidyverse) df <- structure(list(`input paired-end (star)` = c(9394981, 100), `multi-mapped pair (star)` = c(1493691, 400), `uniquely mapped paired-end (star)` = c(6826405, 200), `unmapped pair (star-appx)` = c(1074885, 300)), class = c("tbl_df", "tbl", "data.frame"), row.names = 1:2, .names = c("input paired-end (star)", "multi-mapped pair (star)", "uniquely mapped paired-end (star)", "unmapped pair (star-appx)")) that looks this: # tibble: 2 × 4 `input paired-end (star)` `multi-mapped pair (star)` `uniquely mapped paired-end (star)` `unmapped pair (star-appx)` * <dbl> <dbl> <dbl> <dbl> 1 9394981 1493691 6826405 1074885 2 100

XSLT - Copy all nodes and add extra node in copied nodes -

i looking xslt(1.0) code below input , output xml. in output xml, there can child node under c6 element. in below xml, have put cn element name. input xml - <?xml version = "1.0" encoding = "utf-8"?> <root> <input> <c2> <c3> <c4>c4</c4> </c3> </c2> </input> <output> <c5> <c6> <cn> <t1></t1> <t2></t2> </cn> </c6> <c6> <cn> <t1></t1> <t2></t2> </cn> </c6> </c5> </output> </root> desired output xml

@Selenium: Presence of an element -

what purpose of checking presence of elements rather visibility of element? as quality tester, should on visibility of elements. can provide me examples? as mentioned in link given sisanared explains differences between each method nicely, in short checking present of element check whether element exist in html page regardless visibility , enable flag. usually presence of element used when put element hidden, , need make sure element present before start test in page. example ask developer add ispageready element rendered hidden indicate page , other javascript codes have been loaded since in modern web not enough wait using selenium default wait page load. visible element, on other hand visible user, , used interaction, type, click, etc.

C# AddIn Excel : export xls file in text file with separator -

it's first addin excel , i've problem export excel's file in text file separator ("|"). export excel's file in same path, extension ".txt" , separate excel's columns specific character ("|"). i've created button on ribbon : private void exportsave_click(object sender, ribboncontroleventargs e) { int lastcolumns; lastcolumns = usedrange.columns.count; int endcol = lastcolumns; microsoft.office.interop.excel.worksheet xlsheet = globals.vattools.application.activesheet; microsoft.office.interop.excel.range usedrange = xlsheet.usedrange; // save file in .txt in same path string path = system.io.path.getdirectoryname(process.getcurrentprocess().mainmodule.filename); xlsheet.saveas(path, microsoft.office.interop.excel.xlfileformat.xltextwindows); } i'm not sure of format "xltextwindows". i identify columns don't know how add

Duplicate Woocommerce pages in Wordpress -

i've been struggling know should case : i'm building e-commerce website client , using woocommerce e-commerce plateform. we want separate website in 2 sides: corporate : presents company , product selled (so needs access woocommerce loops etc...) store : contains woocommerce pages (login page, cart page, user's account settings page, products pages etc...) they each have own design (navigation bar different etc...). and each have own subdomain : corporate : domain.com store : store .domain.com i've thought wordpress multisite need woocommerce datas exactly same on both site. is there way have 2 differents products template on woocommerce (one corporate side , 1 store side)? same product archive. thanks in advance if corporate site displaying product data, why not use woocommerce api retrieve product data "store.domain.com" site? way have flexible setup.

c# - Access to F# record base properties without using interface -

f# records cannot inherited, can implement interfaces. example, want create different controllers: type controllertype = | basic | advanced1 | advanced1ram | advanced1rambattery | advanced2 // base abstract class type icontroller = abstract member rom : byte[] abstract member ``type`` : controllertype type basiccontroller = { rom : byte[] ``type`` : controllertype } interface icontroller member this.rom = this.rom member this.``type`` = this.``type`` type advancedcontroller1 = { ram : byte[] rom : byte[] ``type`` : controllertype } interface icontroller member this.rom = this.rom member this.``type`` = this.``type`` type advancedcontroller2 = { rommode : byte rom : byte[] ``type`` : controllertype } interface icontroller member this.rom = this.rom member this.``type`` = this.``type`` let init ``type`` = match ``type`` | basic ->

javascript - How do I data bind a custom semantic ui dropdown to angularjs directive -

there 2 dropdowns second 1 gets states first dropdowns selected country. problem using semanticui's menu data-ng-model='selectedcountry' value remains undefined when selected , second dropdown remains empty. how can selectedcountry semanticui menu. (this works me when use <select> <option>'s ) markup <div ng-controller="loader"> <div> <countrystate></countrystate> </div> </div> controller function loader($scope, $http) { var data = $http.get('scripts/provinces.json'); data.then(function (res) { $scope.countries = res.data.countries; $scope.states = res.data.provinces; }); data.catch(function (err) { console.log("error on : " + err); }); $scope.getstates = function () { console.log("selected states: " + $scope.states); console.log("selected country " + $scope.countries)

sql - Copying tables from schema or database -

i use oracle database. i confused concept between schema , database. looked around here , couldn't find explicit defined example. suppose have qa, dev , production environment , suppose have 3 qa environments. between 3 qa environment, have different database or different schema? suppose 3 different qa environments have different data in each environment. , suppose want create new fourth qa environment , want copy table (lets call table foo ) 1 of existing qa environment (lets call environment qa_1 ) new qa environment (lets call qa_new ). copying schema table foo qa_1 qa_new or copying database table qa_1 qa_new ? you want copy entire database new environment environments match. a schema similar namespace. database can have multiple namespaces , you'll want copy all.

c# - How to sum multiple objects together -

lets have 3 objects object o1, o2, o3 these objects have values of o1 = 1 o2 = 2 o3 = 3 for simplicity sake now add these objects sum of 6 + operator cannot used objects. ways can these objects summed without extensively converting them? the reason using objects rather int etc, due using datatable gets populated sql query. take value datatable , assign o1 example. you can overload plus operator if make own object type. suspect there other ways this, example: i take value datatable , assign o1 example. you assign int @ time. if want use object, because need create more behavior in future, on object type would:q // overload operator + public static yourobject operator +(yourobject a, yourobject b) { return new yourobject(a.thevaluepropertyint + b.thevaluepropertyint); } but not going able sum types of c#'s object because not overload + operator. fundamentally trying use object specific behavior (integer math) wit

c++ - Trying to read command line switches with regex -

so trying read input command line in format fileusage.exe [switches] [folder] switches can typed in format long start -. example -c+j#r. int main(int argc, char *argv[]) { cout.imbue(locale("")); vector<char> theswitches; regex switches(r"reg(\-(c|\+|j|#|w|s|x|r|r|s|v|h)$)reg"); if (argc > 1) { // search through command line args , find matching switches if (regex_match(argv[1], switches)) { theswitches.push_back(argv[1]); } else cout << "didnt find switches" << endl; } with code, able iterate on parameters. have removed $ match end of parameter list. regex switches(r"reg(\-(c|\+|j|#|w|s|x|r|r|s|v|h))reg"); std::string s = "-c -s"; using reg_itr = std::regex_token_iterator<std::string::iterator>; (reg_itr it{s.begin(), s.end(), switches, {1}}, end{}; != end;) { std::cout << *it++ << "\n"; } // outputs: // c // s

sql - Access delete query not deleting right record -

this should not hard. i'm trying delete record table, id equal form value. done thousand times. in case, first record in table being deleted, not selected 1 in form. i've looked @ table properties, form properties , tried every delete query variation i'm aware of. i've tried building delete query in query design , executing that. i've tried sql statement passing access query. , i've tried writing sql access delete query. results same. however, if hard code id number in access delete query, correct record deletes expected. here's few i've tried: set dbs = currentdb docmd.runsql "delete * " _ & "tblcourse cocourseid = " & cocourseid & ";" set dbs = currentdb dbs.execute "delete * " _ & "tblcourse cocourseid = " & cocourseid & ";" currentdb.querydefs("dqrydeletecourse").sql = "delete * tblcourse cocourseid = " & cocourseid

sql - TSQL - The multi-part identifier bounding error -

create function [dbo].[test] (@id int, @val int) returns @return table (id int, val int) begin insert @return select @id, @val return; end go declare @t1 table (id int identity(1,1), val int) declare @t2 table (id int, val int) insert @t1 select 1 union select 2 union select 3 union select 4 insert @t2 select 1,1 union select 2,4 union select 3,3 select * @t1 t1 left join @t2 t2 on t1.[id] = t2.[id] left join [dbo].[test] (1, coalesce(t2.[val],t1.val)) t on t1.id = t.id go drop function [dbo].[test] go goal: to pass in t2.val 2nd param of fx if available, else pass in t1.val. changing fx definition not possible. i can't seem work. tried isnull , doesn't work either. if want call table valued function, use apply ( outer apply in case because using left join ): select * @t1 t1 left join @t2 t2 on t1.[id] = t2.[id] outer apply [dbo].[test](1, coalesce(t2.[val], t1.val) ) t; if want additional condition, use where clause:

postgresql - How to batch import Postgres Large Objects in RDS? -

it's pretty easy batch import large objects in postgres when have access server-side lo_import function, apparently rds doesn't allow it. so how batch import large objects in rds? tried using client-side lo_import function can't figure out how use in plpgsql function, it's not help.

c# - XAML - Change icon dependent on binding -

i'm creating listview , binding data, working ok, can't work out how change icon based on data value. <border background="aquamarine" grid.column="0"> <symbolicon symbol="folder" horizontalalignment="center" margin="10"/> </border> <border background="yellow" grid.column="1"> <textblock text="{binding fname}" margin="5" /> </border> so symbolicon folder how change icon if underlying data set has boolean value denoting folder false? in fact there way of changing other styling in following textblock, based on actual data underlying field? you can change symbol based on bool property binding using ivalueconverter . have ivalueconverter convert true "folder" , false "somethingelse" (whatever icon want false). the binding like: <symbolicon symbol="{binding path=thebooleanproperty, convert

jquery - Modal Video Problems -

slight problem modal videos. have done 3 modal videos each seperate link. when click on bootstrap pill open area modals are, 3 videos start playing in background without opening modals? i'm after video's playing when opened, , stopping , resetting when modal closed (the first part cant find answer whereas second part have seen answers make sense of first part im not sure ive gone wrong). if has time me out i'd appreciate it modal code <div class="row"> <div id="vid1" class="col-xs-12 col-md-4"> <a href="#" class="launch-modal" data-modal-id="modal-video1"> <span class="video-link-text">example 1</span> </a> </div> <div id="vid2" class="col-xs-12 col-md-4"> <a href="#" class="launch-modal" data-modal-id="modal-video2"> <span cla

.net - windows will not allow me to create, copy or move a .licx file -

i have encountered issue creating, or moving .licx file. started branch svn , checkout. svn fail trying copy in licx file machine created. in trying research realized can no longer create file .licx extension. windows tells me need permission myself in order create it. i'm owner of folder structure way up. any thoughts or experience might causing issue? this bad virus dat blocking file type. dat wasn't getting updated due corruption in mcafee install (corporate mandated). once reinstalled mcafee , updated dat problem went away.

java - How to parse a JSON REST response - NoClassDefFoundError: org/json/JSONArray -

i have following uri returns me json response. tried parse response of request , access steps array stops in first step. here code: public void getroute() throws exception { string urltoread="https://maps.googleapis.com/maps/api/directions/json?origin=41.43206,-81.38992&destination=montreal&key=xxx"; defaulthttpclient httpclient = new defaulthttpclient(); httpget getrequest = new httpget(urltoread); getrequest.addheader("accept", "application/json"); httpresponse response = httpclient.execute(getrequest); string json = ioutils.tostring(response.getentity().getcontent()); jsonarray array = new jsonarray(json); (int = 0; < array.length(); i++) { jsonobject object = array.getjsonobject(i); system.out.println(object.getjsonarray("routes")); } } but complains with: exception in thread "main" java.lang.noclassdeffounderror: org/j