Posts

Showing posts from April, 2010

java - LibGDX + Box2D : Object Positioning -

Image
i'm trying code breakout games libgdx , box2d. there 1 point don't understand. there must 2 bricks touch edge. on emulator saw 2 bricks nested. here's createbox method's code: private void createbox(float posx, float posy, float boxw, float boxh) { bodydef bodydef = new bodydef(); bodydef.type = bodydef.bodytype.staticbody; bodydef.position.set(posx, posy); body body = world.createbody(bodydef); polygonshape shape = new polygonshape(); shape.setasbox(boxw, boxh); fixturedef fixturedef = new fixturedef(); fixturedef.shape = shape; fixturedef.density = 1f; fixture fixture = body.createfixture(fixturedef); shape.dispose(); } edit: multiplied code. createbox(cons_holder.bricks_left_margin + (i * cons_holder.brick_width * 2 ), cons_holder.brick_top_screen_margin + (j * cons_holder.brick_height * 2 ) + cons_holder.bricks_top_margin, cons_holder.brick_width / 2,

android - Matter of Handlers execution in a sequence -

i took snipet site explaining handler in android (a threading thing). @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); thread mythread = new thread(new runnable() { @override public void run() { (int = 0; < 4; i++) { try { timeunit.seconds.sleep(2); } catch (interruptedexception e) { e.printstacktrace(); } if (i == 2) { muihandler.post(new runnable() { @override public void run() { toast.maketext(myactivity.this, "i @ middle of background task", toast.length_long) .show(); }

Dynamically Change CSS with Javascript or jQuery -

i have snippet of code in change css dynamically based on values being greater 0. value of '0' class = 'cart-summary__count'. value greater '0' class = 'cart-summary__count_full'. <span class="cart-summary__count" data-v-observable="cart-count">0</span> <span class="cart-summary__count" data-v-observable="cart-count">1</span> *edit: <div id="cart-summary"> <span class="cart-summary__count" data-v-observable="cart-count">0</span> <a href class="cart">example.com</a> </div> change to: <a href class="cart-full">example.com</a> i still learning js , appreciated. cart value can change on page when adding item. please use code $(document).ready(function() { $("span").each(function(){ if (parseint($(this).text()) > 0){ $(this).removeclass("

c# - Error in declaring default parameters for method -

this question has answer here: optional parameters “must compile-time constant” 8 answers i using default parameters i'm getting error default parameter value 'regularexpression' must compile time constant here method signature: public static pipe.datatypes.buyflow.entities.question getemailaddressquestion(string regularexpression = regularexpressions.emailaddressregex, int rank = 1, bool isrequired = true) { } and here property: public static string emailaddressregex { { string emailaddressregex = @"^[a-za-z0-9\._%\+\-]+@([a-za-z0-9\-]{1,40}\.)+([a-za-z0-9]{2,4}|museum)$"; return emailaddressregex; } } it error message says. default parameters have constants (at compile time). the getter of emailaddressregex return different values during runtime. same value not known compiler.

android - How to connect paired device via Bluetooth for TV(REMOTE)? -

my code mbluetoothadapter = bluetoothadapter.getdefaultadapter(); if (mbluetoothadapter != null) { // device not support bluetooth if (!mbluetoothadapter.isenabled()) { intent enablebtintent = new intent(bluetoothadapter.action_request_enable); startactivityforresult(enablebtintent, 10); }else{ set<bluetoothdevice> paireddevices = mbluetoothadapter.getbondeddevices(); // if there paired devices if (paireddevices.size() > 0) { // loop through paired devices (final bluetoothdevice device : paireddevices) { // add name , address array adapter show in listview //marrayadapter.add(device.getname() + "\n" + device.getaddress()); devname = device.getname(); devadd = device.getaddress(); if(!devname.isempty()) {

excel - Fill a column with UserForm -

i want fill column userform. user has 4 options how column can filled. problem right know is, first option works (2). input-mask wont disappear after click ok-button. chosen option should copied column h , filled automatically. mistakes? private sub commandbutton1_click() ' ok button dim emptyrow range dim lastrow long lastrow = cells.specialcells(xlcelltypelastcell).row worksheets("sheet1").activate set emptyrow = worksheets("sheet1").range("h2:h" & lastrow) if optionbutton2.value = true emptyrow.value = "2" if optionbutton3.value = true emptyrow.value = "3" if optionbutton4.value = true emptyrow.value = "4" if optionbutton5.value = true emptyrow.value = "5" end if end if end if end if end sub give shot.. biggest difference here how if statement written. original code had if statements nested in ea

How to connect to a database without the config file in Yii2? -

i using, same problem, code given in question yii2 create database connection . i realise $config variable no longer 1 in web.php file, "config" folder, , changing $config in configuration::setconfig() function. my question more experienced me in yii should write in web.php file in db field (or in db.php file) "create database connection programmatically without using config file" ? in function configuration::setconfig() configure application? i'm sorry if question not clear enough. please ask details in comments if needed. thank you! you can define new connection way $db = new yii\db\connection([ 'dsn' => 'mysql:host=localhost;dbname=example', 'username' => 'root', 'password' => '', 'charset' => 'utf8', ]); , $db->open(); after db connection established, 1 can execute sql statements following eg: : $command = $db->createcomm

java - dropdown select as ID and pass to action class but in search query i have given if null then search all content . how can i search by dropdown ID? -

function searchcontentdisplay(key) { var paramtypeid=$("#paramlist").val(); var paramvalue = document.getelementbyid("paramval").value; alert(paramvalue+paramtypeid); $("#ajax_loader").show('slow'); $.ajax({ url : "serachglobalparam", type : "post", data : 'globalparamdto.paramtypeid='+paramtypeid+'&globalparamdto.paramvalue='+paramvalue, async : true, cache : false, mimetype:"multipart/form-data", beforesend: function(){ $("#ajax_loader").show('slow'); }, complete: function(){ $("#ajax_loader").hide('slow'); }, success : function (data) { $("#searchglobalparam").html(data); } }); }

c# - Repeating a string using StringBuilder -

i want repeat .- 40 times , save string using stringbuilder why not work? string result = new stringbuilder("").append(".-",0,40).tostring(); i know other solutions want use stringbuilder that method not think does. 2 int parameters specify start index , length of sub-string want append. stringbuilder have method want: it's called insert : sb.insert(0, ".-", 40);

php - using implode to insert values into database table columns -

i using php implode insert values, fetched array of input fields, database table column. works fine me: $insert_row =mysql_query("insert activityproduct (ideal) values (" . implode('),(', $_post["ideal"]) . ")"); i'd insert values, fetched 2 different array of input fields, 2 database table columns. below code produces , error: $insert_row =mysql_query("insert activityproduct (aid,ideal) values (" . implode('),(', $_post["act"]) . " ," . implode('),(', $_post["ideal"]) . ")"); i'd express 2 arrays, in insert statement, as, e.g: (10,21),(20,31),(30,41) , not (10),(21),(20),(31),(30),(41) any idea on how go this, highly appreciated. use may you $ideal=implode('),(', $_post["ideal"]); $act=implode('),(', $_post["act"]); $insert_row =mysql_query("insert activityproduct (ideal) values (" .mysql_real_escape_st

loadhtmlstring shows blank screen webview ios10 -

loadhtmlstring web view shows blank screen in ios10 [webview loadhtmlstring:[nsstring stringwithformat:@"<div style='font-size:13px;font-family:helvetica;color:#0000;word-break:keep-all'>%@",myshtmalstring] baseurl:nil]; when loaded shows blank screen

python - Subprocess.Popen stdin in new console -

i want execute python subprocess in new console. once started, want user able answer questions asked new process on stdin. i tried following code: p = subprocess.popen(cmd, stdin=subprocess.pipe, stdout=subprocess.pipe, stderr=subprocess.pipe, cwd=cwd, creationflags=subprocess.create_new_console) (o, e) = p.communicate() as subprocess asks input on stdin following error message displayed: eoferror: eof when reading line is way achieve ? as i'm not interested in stdout/stderr redirection, tried way: subprocess.popen(cmd, cwd=cwd, creationflags=subprocess.create_new_console) it works fine now. guess it's not compatible redirect standard input/outputs , create new console.

ios - Refactor a switch statement with cyclomatic complexity upper than 10 -

i've code: for notif in environmentmanager.notif { if let type = notif.type { switch type { case .sitteravailable: self.managenotif(notif, title: "une sitter disponible", storyboardname: "searchguard", vcname: "searchguardncsid") case .occasionaladjustmentreminder: self.managenotif(notif, title: "rappel", storyboardname: "searchguard", vcname: "searchguardncsid") case .guardrequest: self.managenotif(notif, title: "nouvelle garde urgente", storyboardname: "emergencyguardsitter", vcname: "emergencyguardsitternavigationcontrollersid") case .newreservationrequest: self.managenotif(notif, title: "nouvelle garde", storyboardname: "guardwebsitter", vcname: "webguardsitternavigationcontrollersid") case .newmessage:

javascript - Angularjs GET request ends with 400(). Incorrect formulated inquiry? -

i have webshop project in spring, i'm trying handle adding itemst cart. script fails on refreshcart method. gives http status 400 - incorrect request, check request data so here's angualarjs script: var cartapp = angular.module('cartapp', []); cartapp.controller('cartctrl', function ($scope, $http) { $scope.refreshcart = function (cartid) { console.log("cart id in refreshcart method controllers.js " + cartid); $http({ method: 'get', url: '/rest/cart/' + cartid }).then(function successrefresh(singlecart) { $scope.cart = singlecart; console.log("success, im inside"); console.log(singlecart); console.log("after"); }, function errorcallback(singlecart) { console.log("error in refreshcart"); }); }; $scope.clearcart = function () { $http.delete('

android - java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++.so" not found -

i trying use 2 prebuilt native libraries (.so) in android application. have created jni project have done following, created java native library , compiled javac created c header javah -jni command created corresponding c source file methods implemented this c source code (the methods in it) refer methods .so file expose android.mk file written. given below. using ndk-build built , pushed mobile android.mk local_path := $(call my-dir) include $(clear_vars) local_module := libmodule1 local_src_files := prebuilts/$(target_arch_abi)/libmodule1.so include $(prebuilt_shared_library) include $(clear_vars) local_module := libmodule2 local_src_files := prebuilts/$(target_arch_abi)/libmodule2.so include $(prebuilt_shared_library) include $(clear_vars) local_module := com_example_androidwrapper_nativelibrary local_src_files := com_example_androidwrapper_nativelibrary.c local_shared_libraries := libmodule1 libmodule2 include $(build_shared_library) when run app gettin

jquery - How to find in which device (mobile(android or Ios) or desktop) the web application is opened -

i working on web application project using angularjs has mobile applications android , ios. want when web application open in mobile need find device type , check mobile app installed or not, if installed should open in mobile app, if not download button there app-link.thanks in advance using $window services, you can check one var useragent = $window.navigator.useragent; /(iphone|ipad|ipod).* os 9_\d/.test(useragent) && !/version\/9\./.test(useragent);

c# - Send raw JSON and file in the same web api 2 endpoint -

Image
i wondering whether possible send file (which want ".pdf", ".jpg" or ".png") along raw json. endpoints far send raw json (which i'm testing via postman frontend not exist yet), intention sending of form data sent using angular js. don't know angular js yet, can't imagine how work. the signature of endpoint in question looks this: [route("post")] [customauthorize(roles = "user, admin")] [validatejwt] public async task<ihttpactionresult> post(httprequestmessage request, salesorderviewmodel orderdata) the view model c# class loads of string properties model binder converts json. i know whether sending raw json , file user select possible in same endpoint web api 2. it? thanks in advance. you can't direct post aplication/json, still can multiple form fields (as form data), file + data, value of data can json. i'm not recommending method trick: public async task<ihttpactionr

automation - How can we write a BDD scenario fr complex flow -

how can write bdd scenario fr complex flow. ****for example:**** want write scenario creating new user registration wifi connection. it 1 scenario ask customer details, product details , payment details, account details , @ end creating new account customer. how can write scenario test 1 scenario. can write separate scenario each module, combining modules , cover 1 flow needed. please me on this. there can other scenarios premium user, guest user, full flow 1 part. have tried cucumber? you can like feature: check user registered wifi scenario: registration given: when: then: account created and above steps need create java step file contain step definition. @then("^account created$") public void accountcreated(){ //do validation }

axapta - What is the best way to migrate or export/import data from Microsoft AX4 to AX7 -

on 1 side have working ax4 environment , want upgrade new ax7. therefore need tables of database imported or migrated new one. what best way achieve that? there no direct upgrade path ax4 ax7 (afaik), nor there way directly move objects. how many objects need migrated? you're left 2 options. xpo objects ax 2012 staging environment, upload ax 2012 modelstore lcs , migrate code , create migration project in ax7 (see https://ax.help.dynamics.com/en/wiki/upg101-preparing-for-migration/ ) recreate objects hand :( a little more detail on (1.) in ax 2012, instead of code being stored on disk in bunch of layer files, it's stored in separate sql database. , modelstore conceptually *.bak file of database. when import xpo ax 4.0 cus layer, ends in axcus.aod; likewise when import xpo in ax 2012, ends in modelstore in cus layer. to uplift code in ax7 ax12 , take *.modelstore file , .zip (compress) , upload on lcs.dynamics.com . must connect lcs vso (visua

mysql - SQL left join with SUM -

i need join 1 table another, each type of group in left table got sum of value types in second table, group_type = 4. tried following: select * orbiting_group_types ogt left join (select sum(val) report_orbiting_vals rov order type rov.orbiting_group_type_id = 4) on ogt.id = rov.orbiting_group_type_id however throw me error - syntax error @ or near "where" line 8: rov.orbiting_group_type_id = 4) what did miss? try this: select * orbiting_group_types ogt left join (select sum(val) report_orbiting_vals subrov subrov.orbiting_group_type_id = 4 //order type ) rov on ogt.id = rov.orbiting_group_type_id 1) should name subqueries reference them. can't make reference outside of subquery inside. 2) type doesn't sound column name 3) order goes after where, always.

c# - Binding Shape FillColor to Button BackgroundBrush -

i wanna create close/maximize/minimize buttons app. wrote piece of style : <style x:key="closebutton" targettype="button"> <setter property="template"> <setter.value> <controltemplate> <grid background="transparent"> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal" /> <visualstate x:name="mouseover"> <storyboard> <coloranimation storyboard.targetname="backgroundcolor1" storyboard.targetproperty="(shape.fill).(gradientbrush.gradientstops)[0].(gradientstop.color)"

angularjs directive - Angular 2 multiple errors such as Template parse errors and Can't bind to -

Image
i new ag2.just started 1 day. tried online tutorial , follow coding error. directives: [favour_component] // line of coding marked red then chrome console, error unhandled promise rejection: template parse errors:can't bind 'isfavour' since isn't known property of 'favours'. may know whats wrong coding? app.component.ts import { component } '@angular/core'; import {favour_component} './favour.component' @component({ selector: 'my-app', template: ` <favours [isfavour]="post.isfavour"></favours> `, directives: [favour_component] }) export class appcomponent { post={ title:"title", isfavour:true } } favour.component.ts import { component, input} '@angular/core'; @component({ selector: 'favours', template: ` <i class="glyphicon" [class.glyphicon-star-empty]="!favour"[class.glyphicon-star]="favour&quo

android - Manage Firebase users in app -

i'm developing android app needs able manage user list. problem is, firebase doesn't seem offer support kind of scenario, opposed social apps users self-registering , managing own accounts. create users in firebase console, not enough. the users registered email , password, users must have admin permissions , allowed edit user list, can enforce using security rules. however, users listed in firebase console don't have place put information permissions, info must go in main database. editing database tree in console not reasonable, hence must done in app. first problem is, there no way user list app. workaround, can create users in app using createuserwithemailandpassword () function. then, can save user info in main database, keeping them in sync. minor problems aside (such newly created user getting automatically signed in, signing out admin user), function starts fail , error logs indicate "too_many_attempts_try_later". not acceptable. any suggestion

html - Vertical align text to image -

this question has answer here: vertically align text next image? 20 answers i've got image floated left, , want vertically align text image text sits in middle of image. any ideas how it's done? have tried many solutions provided on site, none working me. as shown below, this solution not work. /* limiting outter width illustrate problem */ .cart-helper-outer { width: 200px; } /* makes helper items full width */ .cart-helper-inner { width: 100%; float: left; } /* displays image left of text */ .cart-helper-inner img { max-width: 50px; float: left; margin-right: 2.5%; vertical-align: middle; /* not work*/ } .cart-helper-inner p { vertical-align: middle; /* doesn't work*/ } <div class="cart-helper-outer"> <div class="cart-helper-inner"> <img src="http://plac

javascript - PHP exec command node -

i'm running apache , node.js on same server. tried execute command using php: exec('usr/bin/node', 'var/www/html/app/node/server.js'); var_dump($output); it returned: "array(0) {}"; do have idea why php did not execute command node? thank help. try absolute paths: exec('/usr/bin/node /var/www/html/app/node/server.js', $output); usr/bin/node relative path meaning appended current directory php script executed in.

javascript - Protractor: Compare two element for equality -

i have list of elements list = element.all(by.css(....)); one of them has specific attribute specific = list.element(by.css('[active]'); now check if specific element first expect(list.get(0)).tobe(specific) however doesn't work (it doesn't match). suggestion how compare elements? you can value of active attribute , see if not null: expect(list.first().getattribute("active")).not.tobenull(); you cannot though directly compare elements , but, can compare id s or outerhtml attribute values of elements: expect(list.first().getid()).toequal(specific.id()); expect(list.first().getattribute("outerhtml")).toequal(specific.getattribute("outerhtml"));

Missing operator error using batch file -

i've been trying create little batchscript usages of browser. far works, should. moved file pc , i'm getting "missing operator" errors eventho program runs should. idea's? @echo off set date = %date set time = %time set sum=0 /f "tokens=5 delims=," %%x in ('tasklist /fo csv /fi "imagename eq firefox.exe"') ( /f "tokens=1-5 delims=.k " %%a in ("%%~x") set /a sum+=%%a%%b%%c%%d ) echo %date%, %time%, firefox.exe, %sum%k > firefoxdumpresult.csv pause :start set date = %date set time = %time set sum=0 /f "tokens=5 delims=," %%x in ('tasklist /fo csv /fi "imagename eq firefox.exe"') ( /f "tokens=1-5 delims=.k " %%a in ("%%~x") set /a sum+=%%a%%b%%c%%d ) echo %date%, %time%, firefox.exe, %sum%k >> firefoxdumpresult.csv set choice= set /p choice="do want log one? press 'y' , enter yes: " if not '%choice%'=='' set choice=%cho

c# - Best practices for catching and re-throwing .NET exceptions -

what best practices consider when catching exceptions , re-throwing them? want make sure exception object's innerexception , stack trace preserved. there difference between following code blocks in way handle this? try { //some code } catch (exception ex) { throw ex; } vs: try { //some code } catch { throw; } the way preserve stack trace through use of throw; valid well try { // bombs here } catch (exception ex) { throw; } throw ex; throwing exception point, stack trace go issuing throw ex; statement. mike correct, assuming exception allows pass exception (which recommended). karl seguin has great write on exception handling in foundations of programming e-book well, great read. edit: working link foundations of programming pdf. search text "exception".

python - Wait for a clicked() event in while loop in Qt -

how can wait, @ each iteration, within loop, user press given qpushbutton? for in range(10): while (the button has not been pressed): #do nothing #do the main problem cannot catch clicked() event in while loop. edit: finally ended with: in range(10): self.hasbeenprocessed = false # 1 function can modify boolean # , function connected button while (self.hasbeenprocessed not true): qtcore.qcoreapplication.processevents() so, share slight skepticism whether should want doing described. also, share better if show bit more code describe context. having said this, code below stab @ seem describing. note no means meant production-ready code, more crude example illustrate principle. what happens call 1 function on press of button1 , keep event loop spinning inside while loop calling qcoreapplication.processevents() means gui still accept e.g. mouse events. now, should not typically

How do I restore phabricator if I deleted the files but the database is still intact? -

so, did stupid rm -rf on folder complete phabricator folder present. the whole phabricator database still intact though. i cloned required repos on same old location: somewhere/ $ git clone https://github.com/phacility/libphutil.git somewhere/ $ git clone https://github.com/phacility/arcanist.git somewhere/ $ git clone https://github.com/phacility/phabricator.git apache configured during previous install. i ran: ./bin/storage upgrade after went address pointed phabricator folder. following error: 1146: table 'phabricator_user.user_cache' doesn't exist how resolve it? or in general, what's best way reinstall phabricator using old database? thanks well, if still have database, make mysqldump data (export db data - should have default - cron job, running backup script on backup machine/usb/hard/cloud) do fresh reinstall on phabricator(even on whole lamp). import previous backup.sql did. after setting user/passwd/host/port/ in &qu

javascript - Mathjax - Add offset for the target "\eqref" link of equation when there is a top fixed menu -

i try implement "pure" css solution or javascript way add offset matjax anchor links on equations. when scroll down on page, fixed top menu appears. handle behavior javascript : $(window).bind("load", function () { $('a[href*="#"]').click(function(event) { event.preventdefault(); if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { var hash = this.hash; $('html,body').animate({ scrolltop: target.offset().top - 55 }, 300, function() { href = window.location.href; history.pushstate({page:href}, null, href.split('#')[0]+hash); }); return false; } } }); $(window).bind('popstate', function(event) { var state = event.originalevent.state; va

java - How does logging work if I have slf4j-api, log4j, slf4j-log4j12 and commons-logging in classpath? -

Image
in our build.gradle: dependencies { // logging compile "org.slf4j:slf4j-api:$slf4jversion" compile "log4j:log4j:$log4jversion" compile "org.slf4j:slf4j-log4j12:$slf4jversion" .... } in code use classes slf4j library. looks this: also use spring framework. uses commons-logging inside. there no exclusions of commons-logging in our configuration. see spring logs in our log files. , don't understand how work (i see works). our configuration correct? p.s. from point of view should add jcl-over-slf4j , exclude commons-logging see works correctly. is concatenation of circumstances expected behavior?

javascript - Foundation for Apps, off canvas close on click off -

i'm using foundation apps, angular version, , trying use off canvas menu. works fine, opening , closing via setting links, not close when clicking off of in main content area previous versions, , example, do. it's simple setup: <zf-offcanvas id="menu" position="left"> <a zf-close="" class="close-button">×</a> </zf-offcanvas> <a zf-open="menu" class="button">open off-canvas</a> and should done, clicking anywhere on main content (not links) not close off canvas example docs: http://foundation.zurb.com/apps/docs/#!/off-canvas i'm looking either solution problem, or hacked out js solution close window on clicking on "main" content. you have add "zf-close-all" attribute body tag. <body zf-close-all>

javascript - How can I attach an event to the selection of Bootstrap collapsing panel? -

in following code, there bootstrap collapsible panel no list, doesn't expand or contract. how can attach event selection of panel? <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <div class="panel-group"> <div class="panel panel-default" id="leftsidemenu"> <div class="panel-heading" id="aboutcollapsepanel"> <h4 class="panel-title"> <a data-toggle="collapse" href="#collapseabout" data-target="tabsabout" >about</a> </h4> </div>

When creating a push notification channel using the Google Drive API (v3) does setting payload to true in the request body do anything? -

i receive metadata or summary of changes in push notifications google drive api. it appear documentation setting payload true in request body accomplish this. far can see, both file , change notifications not include request body when payload set true when notification channel created. the documentation states payload "a boolean value indicate whether payload wanted. optional." does have idea field (if anything) , whether there way include additional information? if check other google apis similar payload request usage, looks flag determine if message body should included in notifications. take @ google admin sdk push notification , similar drive api push notification doing.

JSON to SQL Server: Convert sub-array of values to column -

i have json like { "url": { "web_categories": [{ "id": 226 } , { "id": 401 }] }, "account":"basic" } i output in sql column contains ids of web_categories url matched to. | webcat | |--------| | 226 | | 401 | using sql server 2016 / azure sql db's support json, how 1 achieve that? reproducible example declare @jsoninfo varchar(max) set @jsoninfo =n'{ "url": { "web_categories": [{ "id": 226 }] }, "account":"basic" }' previous iterations select * openjson(@jsoninfo) (webcat varchar(12) '$.url.web_categories.id[0]') select * openjson(@jsoninfo) (webcat varchar(12) '$.url.web_categories.id') select * openjson(@jsoninfo) (webcat varchar(12) '$.url.web_categories') select * openjson(@jsoninfo,'$.url.web_categories.id[0]') select * openjson(@jsoninfo,'$.url.w

angular - Angular2 RC6 Update -

since have updated package.json angular2 rc6 errors ts2305: "../@angular/router/index" has no exported member 'routerconfig' "../@angular/common/index" has no exported member 'control', 'controlgroup','validators', etc. my dependencies in package.json follows "dependencies": { "@angular/common": "2.0.0-rc.6", "@angular/compiler": "2.0.0-rc.6", "@angular/compiler-cli": "0.6.0", "@angular/core": "2.0.0-rc.6", "@angular/forms": "2.0.0-rc.6", "@angular/http": "2.0.0-rc.6", "@angular/platform-browser": "2.0.0-rc.6", "@angular/platform-browser-dynamic": "2.0.0-rc.6", "@angular/router": "^3.0.0-rc.2", "@angular/upgrade": "2.0.0-rc.6", "angular2-in-memory-web-api": "0.0.18", "angular2localization&qu

c - How to detect instances where code accidentally creates a pointer to a pointer? -

in doing wholesale refactoring, i've come across instances i've made same mistake. have accidentally passed pointer pointer instead of pointer. code explains best. /* oops */ below. the struct: struct my_struct { int x; int y; int z; int value; } initialize function: void initialize(struct my_struct *s) { s->x = 0; s->y = 0; s->z = 0; s->value = 0; } the original function: struct my_struct do_something() { struct my_struct s; initialize(&s); s.value = 27; return s; } the new function void do_something(struct my_struct *s) { initialize(&s); /* oops! */ s->value = 27; } it should have been: void do_something(struct my_struct *s) { initialize(s); /* fixed */ s->value = 27; } is there way, maybe compiler flag or linter can me locate these oopsies? notes: i'm using gcc (but if compiler or linter can find this, please tell) i'm using these compil

ruby on rails - ujs + remotipaart - when running jQuery `.html(...)` calls, the appended html becomes just text -

Image
i using rails 5, remotipart. remotipart version is: gem 'remotipart', github: 'mshibuya/remotipart' (at moment of question, current commit 88d9a7d55bde66acb6cf3a3c6036a5a1fc991d5e). when want submit form having multipart: true and remote: true` but without sending attached file , works great. when send file, fails. to illustrate case, consider response this: (function() { modelerrors('<div class=\'alert alert-danger alert-dismissible\' role=\'alert\'>\n <div aria-label=\'close\' class=\'close fade in\' data-dismiss=\'alert\'>\n <span aria-hidden>\n &times;\n <\/span>\n <\/div>\n code can\'t blank\n<\/div>\n'); }).call(this); when response executed, after arriving (since js), form looks expected (in case, validation error right happen, , rendered danger alert right appear such text): however, when fill file field, , repeat exact same case (exact