Posts

Showing posts from March, 2014

module - Incorporate mqtt into appcelerator / titanium -

does have successful experience incorporating mqtt library appcelerator / titanium? what library have used how incorporate library (i.e. npm module, hyperloop, cocoapods, straight source code, etc) thanks in advance can give the existing module find http://gitt.io/component/it.uhopper.mqtt last updated in 2014. you'll have find (ios?) library , either wrap module or use hyperloop aware hl still in beta.

java - Jav save the date and time at a particular syncpoint and restart from same point -

my application looks daily updates api. wanted save date , time @ particular point , restart(let's tomorrow) same sync point updates. something structure: main() { long sync = getlastsavedstatetime() lookforupdates() savestatetimeagain() }

ios - Does GCSVideoView work with YouTube 360-degree live streaming? -

i saw announcement today youtube streaming 360 video, https://youtube.googleblog.com/2016/04/one-step-closer-to-reality-introducing.html does gcsvideoview loadfromurl: work? code below modified videowidget ios sample doesn’t show 360 video... nsstring *videopath =@"https://www.youtube.com/watch?v=db-uq08ydi4"; [_videoview loadfromurl:[[nsurl alloc] initfileurlwithpath:videopath]]; excited see working! thanks! before anything, check question answer's i'm looking forward see working answer this... working myself possible solution.. what found out gcscardboardview extension of glsurfaceview . cardboard viewports , proyections on top of opengl. i'm no expert way go (for me) 'how show videos through opengl view'. second step be: create pixel buffer in opengl support video stream.. that's i'm stuck.

javascript - Is there something like angular $watch in node js -

i'm rookie in web services , knowledges not deep in node js, apologize in advance if question not correct. question have 2 functions in angular-node js app. first function, uploading file public folder on server var storage = multer.diskstorage({ //multers disk storage settings destination: function (req, file, cb) { cb(null, './demo/'); }, filename: function (req, file, cb) { //var datetimestamp = date.now(); cb(null, file.originalname //file.fieldname + '-' + datetimestamp + '.' + file.originalname.split('.')[file.originalname.split('.').length -1] ); } }); var upload = multer({ //multer settings storage: storage }).single('file'); /** api path upload files */ app.post('/upload', function(req, res) { upload(req,res,function(err){ if(err){ res.json({error_code:1,err_desc:err}); return; } res.json({error

How to avoid ssh connection overheads in scp? -

i testing performance of scp command. want minimize overheads making tcp connection of ssh protocol inside scp. how can open first ssh connection , reuse on time? thanks help. // should have said 1 way achieve zip files , send @ once, works when files available time. let's assume files generated in stream fashion in source side, , want send possible after generated. // pleaser refer link answer found: (how reuse ssh connection speed remote login process) http://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/ if copying many tiny files connection overhead comes play, try tar'ing on fly , sending instead. try this: tar zcvf - data | ssh user@server "cat > data.tar.gz" you can drop z if compression isn't desired/helpful too.

c# - Does @Html.Textarea sanitize input? -

i have web form allows enter user input @html.textarea. if there form validation error, input shown in text area. if form submits successfully, user's input sent database. i've tried various things can think of sql injection, , appears microsoft's built in functionality catching it. should doing sanitize input? i'm using latest mvc razor framework. using strong types. i've read html.encode, think html.textarea method doing this? have not implemented it. the razor part not implement of checking (since has no way of knowing consider valid input). database layer using in mvc deals injection attacks.

vb.net - Set Minimum Number in ComboBox -

Image
i using line generate collection of numbers combobox. main.combobox.items.addrange(enumerable.range(1, maxnum).select(function(s) s.tostring()).toarray()) i wondering how set minimum it? example, 6-100, instead of default 1-100. update: i using numbersetting value of 0 in project properties settings tab. numbersetting getting actual value from: my.settings.numbersetting = cint(combobox.text) once numbersetting has value, use maxnum set maximum number of options in combobox: dim maxnum = my.settings.numbersetting dim winners = enumerable.range(1, maxnum).orderby(function(r) rand.next()).take(5).toarray() this allows me 100 checkboxes if select 100 option combobox. looking set minimum option 6, 1, 2, 3, 4, , 5 not options in combobox. solved: private sub options_load(sender object, e eventargs) handles mybase.load dim maxnum = my.settings.numbersetting2 numbercombo.items.addrange(enumerable.range(6, maxnum - 5).select(function(s) s.tostring()).toarra

Transaction block in Java? -

what idiomatic way perform transaction in java? have code myobject oldvar = myvar.tomyobject(); myvar.mutationanddbinsertion; myobject newvar = myvar.tomyobject(); i want wrap in single transaction block, sure myvar object not mutate unless database operation successful, , oldvar , newvar accurate representations of object state before , after mutation. how should approach this? committing transactions after auto-commit mode disabled, no sql statements committed until call method commit explicitly. statements executed after previous call method commit included in current transaction , committed unit. following method, coffeestable.updatecoffeesales, in con active connection, illustrates transaction: public void updatecoffeesales(hashmap salesforweek) throws sqlexception { preparedstatement updatesales = null; preparedstatement updatetotal = null; string updatestring = "update " + dbname + ".coffees " + "set sales = ? cof_n

javascript - Remove appended divs when checkbox is unchecked -

i have portion of form can add new rows when button clicked. accomplished using jquery append method. have added code remove individual appended item, need able remove appended items if specific checkbox unchecked. below code have button , input fields: $(function() { var max_fields = 10; //maximum input boxes allowed var $wrapper = $(".input_fields_wrap"); //fields wrapper var $add_button = $(".add_field_button"); //add button id var prefix1 = 'outlet[]'; var prefix2 = 'url[]'; $add_button.click(function(e) { //on add input button click var count = $wrapper.find('.col-md-12').length; e.preventdefault(); if (count < max_fields) { //max input box allowed $wrapper.append('<div class="col-md-12">\ <div class="row">\ <div class="form-group">\ <div cla

java - JTextArea keeps adding lines in for loop, how to prevent this? -

Image
i working on gradebook sort of program. user enters name of student , marks got on 4 tests, 2d array. when click 'student average' button determine average mark of said student, want print student info , average line after. output right now, shown in picture, adds around 15 lines before average displayed. i'm not sure happening in code causing this, attach actionperformed code of student averages button. code magic happens: private void studentaveragesbuttonactionperformed(java.awt.event.actionevent evt) { int sum = 0; int studentaverage = 0; studentname = lastnameinput.gettext() + " " + firstnameinput.gettext(); (int row = 0; row < studentmarks.length; row++) { (int col = 0; col < studentmarks[0].length; col++) { if (studentmarks[row][col] != null) { studentmarkscreen.settext(studentmarkscreen.gettext() + " " + string.valueof(studentmarks[row][col])); if (studen

React Native ART library documentation -

does have clue find documentation? saw number of components using library strangely couldn't find documentation? facebook's response issue https://github.com/facebook/react-native/issues/4789 library go production sadly there isn't documentation :(

file - How to remove script tags -

i have loaded many script files: eg: <script type="text/javascript" src=" script file "></script> <script type="text/javascript" src=" script file "></script> $('button').on('click', function() { $('script').remove(); // script events still functioning. }); if script loaded, cannot un-load it. removing <script> tag page won't have effect. a better option: event handler or event listener can removed using jquery's .off() function or javascript's removeeventlistener() .

jquery - JavaScript error in console. Uncaught SyntaxError: Unexpected token < -

i'm using this gallery project. when put code in page chrome console says uncaught syntaxerror: unexpected token < here code <script id="img-wrapper-tmpl" type="text/x-jquery-tmpl"> <div class="rg-image-wrapper"> {{if itemscount > 1}} <div class="rg-image-nav"> <a href="#" class="rg-image-nav-prev">previous image</a> <a href="#" class="rg-image-nav-next">next image</a> </div> {{/if}} <div class="rg-image"></div> <div class="rg-loading"></div> <div class="rg-caption-wrapper"> <div class="rg-caption" style="display:none;"> <p></p> </div> </div> </div> </script> a

Android, findViewById returns null -

i'm writing code android, matter that, when call findviewbyid returns me null, , cannot understand why! i've been wasting brain since yesterday, cannot figure out solution. goal set layout header listview. here code, respectively header , page: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/header" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="5dp"> <textview android:text="@string/bydistance" android:layout_gravity="left" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:textsize="13dp" android:gravity="center_horizontal

php - what is my implode problems? -

i want make form user can search info based on input , choices.after form filling data display using table..got error implode gave me warning implode(): invalid arguments passed in line 111 is $check = implode("','", $_post['check_list']); and after tried tick 2 values on checkbox gave me mysql_fetch_array() expects parameter 1 resource, boolean given in line 125 is while($row = mysql_fetch_array($sql)) { . <form method="post"> <div class="form-group"> <h3><label for="usr">carian bajet anda:</label></h3> <div class= "col-md-12"> <div class=" col-md-4"></div> <div class=" col-md-4"> <input name="bajet" type="text" class="form-control" id="usr"></div> </div> <div class=&q

include a phar file in Symfony 2 -

a company release php sdk phar file. sample file gave like: include 'baidubce.phar'; require 'sampleconf.php'; use baidubce\bceclientconfigoptions; use baidubce\util\time; use baidubce\util\mimetypes; use baidubce\http\httpheaders; i want use in symfony 2 project. best practice of including vendor phar file in symfony2 project?

xcode - Liferay iOS sign-in: onSuccess is not called after signIn -

i new liferay. trying liferay ios sdk 7.0.3, trying follow brief tutorial @ https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/invoking-liferay-services-in-your-ios-app but got stuck on, signinwithsession method. after establishing session [[lrsession alloc] initwithserver: authentication: initwithusername: password:] then have [session onsuccess:^(id result) { nslog(@"signin success"); } onfailure:^(nserror *e) { nslog(@"signin failure, , error %@", e); } ]; [lrsignin signinwithsession:session callback:session.callback error:&error]; when username/password combination wrong, onfailure gets called, , prints error signin failure, , error error domain=com.liferay.mobile.sdk code=2 "java.lang.securityexception" userinfo={nslocalizeddescription=java.lang.securityexception} but when correct username/password combination used, onsuccess block not called. don't see "signin success" in con

Can we generate Connection String for ODBC, JDBC, PHP and ADO.Net of Azure SQL Database using python SDK? -

i want generate connection string odbc, jdbc, php , ado.net using python azure sql database. can see option on azure portal, there way generate connection string programmatically? thing asm, arm or rest available that? as known, think can't generate connection string using python azure sql database, because can't user , password required connection string via sql database rest apis or classic rest apis . however, can generate connection string without user , password connection string template via using rest apis get database , get server , list databases & list servers extract attributes server name & database name .

Set cookies to text value using jQuery -

i add cookies function. in example, want browser remember value of p, "number one" after input button #sting clicked. when page refreshed empty p tag have text "number one." the html <p id="place"></p> <input id="sting" type="submit" value="run"/> the js $(document).on('click', '#sting', function(){ $('#place').text("number one"); }); jsfiddle: https://jsfiddle.net/xwgj4w67/ i have looked jquery cookie plugin( https://github.com/js-cookie/js-cookie/tree/v1.5.1 ), unsure of how use it. happy examples either or without plugin. thanks. you can use local storage store values browser: to set value in local storage: localstorage.setitem('place', "number one"); to value local storage: localstorage.getitem('place');

android - Equivalent of nameList.add(name) in recylerview -

i used add item in listview this name name = new name("via button"); namelist.add(name); madapter.notifydatasetchanged(); i know equivalent of in recyclerview. lot. you can define recycler view adapter takes take list 1 of params...in case list...once have defined adapter can pass on list of class level adapter. once fetch data (through api call or other means) can add add data , call notify data set custom adapter. example: // custructor of custom adapter public customadapter(list<name> mylist) { this.mylist = mylist; } //your class implementation public class myclass{ private arraylist<name> mylist = new arraylist<>(); customadapter myadapter; . . . public void init(){ //more code , init of components myadapter = new customadapter(mylist); recyclerview.setadapter(myadapter); } //more codes //once receive data api call (maybe) name name = new name("via button"); mylist.a

c# - "A call to a PInvoke function has unbalanced the stack" -

i created form application in visual c#, uses function generate mouse click, got following error message: a call pinvoke function '...form1::mouse_event' has unbalanced stack. because managed pinvoke signature not match unmanaged target signature. check calling convention , parameters of pinvoke signature match target unmanaged signature. my code: [dllimport("user32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall)] public static extern void mouse_event(long dwflags, long dx, long dy, long cbuttons, long dwextrainfo); private const int mouseeventf_leftdown = 0x02; private const int mouseeventf_leftup = 0x04; ... void generatemouseclick(int x, int y) { cursor.position = new point((int)x, (int)y); mouse_event(mouseeventf_leftdown | mouseeventf_leftup, cursor.position.x, cursor.position.y, 0, 0); } your win32 api declaration incorrect: 'long' maps int64 in .net framework, incorrect windows api calls. rep

fullcalendar - Angular-Ui-Calendar: How to show two agendaWeekView in single calendar -

i facing problem while adding 2 agendaweekview in single calendar. please have calendar config. header:{ left: 'prev,next', center: 'title', right: 'agendaweek agendaweek' }, here calling agendaweek 2 times, appears 2 tab in calendar called "week" when clicked of them both views activated , not able change text of week tabs. please give suggestion it. from looks of it, not closing right header variable quotation. maybe work. header:{ left: 'prev,next', center: 'title', right: 'agendaweek agendaweek' }, not sure though. if post plunker of fiddle diagnose ease.

timer - Swift Countdown from game end + 1 hour -

i trying create timer between games, after user loses life must wait 5min until can play again. not sure best way is. i need safe against user editing time in settings. what best way achieve this? at moment going through process of setting nsdate() object in keychain: let date = nsdate() and using values: let date = gameactions["endfight"] as! nsdate let calendar = nscalendar.currentcalendar() let components = calendar.components([ .hour, .minute, .second], fromdate: date) let hour = components.hour let minute = components.minute print("hour: \(hour)") print("mins: \(minute)") however hour returns 1 . after looking around lot occurred me might going whole wrong way. i going reverse swift timer tutorial count down backwards.. is right track? main question clarification: how able determine if 5 mins has passed since last game fight? the correct way utilizing timestamps on b

javascript - How can I allow the user to input Numeric (with/without decimal point) only. OR numeric with 'K'/'B' -

i've been searching through stack overflow, can't right answer question. how can allow user input number or number 'k (thousands)' or 'm (millions)'? i've tried using patterns, regexp, etc. is there regular expression this? tried using ^[0-9]*$ , ^[0-9\k\m]*$ , don't know if correct expression. think mean this, document.write(/^\d+(?:\.\d+)?[km]?$/.test('121k') + '<br/>'); document.write(/^\d+(?:\.\d+)?[km]?$/.test('121.7m') + '<br/>'); document.write(/^\d+(?:\.\d+)?[km]?$/.test('121.45') + '<br/>');

html - CSS trends with naming class and id with dash underscore? -

i've been using dashes separator css class , id names: .about-us .car-pricing-guide i've seen sites use multiple underscores __ .home__content also, i've seen 2 dashes .hero--title i know it's matter of preference can point articles or though process these kind of patterns? there move towards particular convention or there popular set of convention people seem agree/follow? the double underscore follows bem methodology. way of naming classes later becomes easy user understand. the guiding principle behind bem seems "when designing page, think in terms of reusable widgets". pretty standard way should writing semantic html. learn more bem here: bem methoodology

akka - Why are implicit variables not initialized in Scala when called from unit test? -

given the following singleton object in scala: package demo import akka.actor.actorsystem import akka.http.scaladsl.http import akka.http.scaladsl.server.directives._ import akka.stream.actormaterializer import scala.concurrent.future import scala.io.stdin object webserver extends app { implicit val system = actorsystem("myactorsystem") implicit val executioncontext = system.dispatcher implicit val materializer = actormaterializer() val route = { path("api" / "done-as-promised") { { complete { future.successful("done") } } } } val bindingfuture = http().bindandhandle(route, "localhost", 8080) } and following unit test package demo import akka.http.scaladsl.testkit.scalatestroutetest import org.scalactic.typecheckedtripleequals import org.scalatest.{inspectors, matchers, wordspec} class webserverspec extends wordspec matchers typecheckedtripleequals inspectors s

How to count number of unique records of a field in progress openedge 4gl? -

i have customer table field age . how can count how many distinct ages there ? you can in abl using for-loop , break , counter. there built in aggregate functions (accum) in abl seen in wild... define variable integer no-undo. each record no-lock break record.age: if last-of(record.age) do: = + 1. end. end. message "there " " unique ages" view-as alert-box. or crippled built in sql: select count(distinct age) record.

css - How to show list items got selected in javascript -

i have number of list items sports, music, dance etc. have images related them. want is, when click on image of sports, list item 'sports' seen selected. beginner in java script , not understand how make possible. this should working approach your, information missing, question. wrote show how can work can adapt solution code. js: $('img').click(function() { match = $(this).attr("match"); $('select').val(match); } html: <img src="1.jpg" match="sport"/> <img src="2.jpg" match="dance"/> <select name="list" value=""> <option value="sport">sport</option> <option value="dance">dance</option> </select> here can see jsfiddle: https://jsfiddle.net/1lw2gupj/2/

javascript - How to disable other tabs while loading any tab in bootstreap3 -

i using following tab load remote tab. here want load first tab default(after loading page) , while loading tab other tabs should disabled. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <!-- optional theme --> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <!-- latest compiled , minified javascript --> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <ul class="nav nav-pills" id="tab"> <li><a href="http://www.google.com" data-target="#google" class="media_node active span" id="info_tab" data-toggle="tablist" rel="tooltip"> goog

android - Listview style Each Row -

this code in custom adapter (the code in brown color) when list build proper margin applied valid items when scroll down , again scroll rows in list shifts margin left 20 i'm doing wrong please reply soon @override public view getview(final int position, view convertview, viewgroup parent) { final viewholder holder; // getting data final viewmoviedetailsmodel_viewcomments movies = getitem(position); if (convertview == null) { convertview = view.inflate(context, r.layout.comment_row, null); holder = new viewholder(); //getting handles holder.comments_linearlayout = (linearlayout) convertview.findviewbyid(r.id.comments_linearlayout); holder.commenter_textview = (textview) convertview.findviewbyid(r.id.comment_row_commenter); holder.commented_on_textview = (textview) convertview.findviewbyid(r.id.comment_row_comment_time); holder.co

javascript - Draggable marker in map -

i'm example map shows current location click of button shows lat,long , need little change on map changes : 1 - marker on map after click button draggable new lat long , show address , in fact marker fixed on center map , map draggable new address , new lat,long my code : <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map = null; function showlocation() { // one-shot position request. navigator.geolocation.getcurrentposition(callback); } function callback(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; document.getelementbyid('default_latitude').value = lat; document.getelementbyid('default_longitude').value = lon; var latlong = new google.maps.latlng(lat, lon); var marker = new google.maps.marker({ position: latlong }); marker

c# - Datagrid not updating when query is fired -

so have datagrid in usercontrol . databound observable collection in viewmodel. viewmodel implements inotifypropertychanged interface , has been appropriately wired in view. in view: <datagrid autogeneratecolumns="false" enablerowvirtualization="true" itemssource="{binding contributioncollection, mode=twoway, updatesourcetrigger=propertychanged}"> <!-- datagrid rows --> /> and in viewmodel: private observablecollection<contribution> _contributioncollection; public observablecollection<contribution> contributioncollection { { return _contributioncollection; } set { _contributioncollection= value; onpropertychanged("contributioncollection"); } } what meant happen, that; @ click of specific button, query fires against database , brings results. results meant shown in datagrid. //

jquery - Changing Iframe src in Ajax success call - Web server will Get source references twice -

Image
i have html page iframe element , when tried set iframe source after getting information through ajax call, multiple request source references server. iframe.html: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <script src="jquery-2.1.4.min.js"></script> <script src="bigfile.js"></script> // 3mb size </head> <body> <iframe id="samplefile"></iframe> <script type="text/javascript"> $.ajax({ type: "get", url: my_url, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { $("#samplefile").attr("src", "data.html"); } }); </script> </body> </html> data.html: <!doctype html> <html xmlns="http:/

C# ListView Item Image -

how can add image (specified image) listview foreach statement example: foreach(video entry in videofeed.entries) { listview1.items.add(entry); listview1.items.image(imageurl); } if want show image listviewitem , need create imagelist , fill images, assign imagelist listview , tell every listviewitem image list use: var listview = new listview(); // create image list , fill var imagelist = new imagelist(); imagelist.images.add("itemimagekey", image); // tell listview use new image list listview.largeimagelist = imagelist; // add item var listviewitem = listview.items.add("item image"); // , tell item image use listviewitem.imagekey = "itemimagekey"; you can read more listviewitem , how set/use images in msdn article or in msdn tutorial .

sql server - Calculating cumulative sum in ms-sql -

i have table tblsumdemo following structure billingid qty percent_of_qty cumulative 1 10 5 5 2 5 8 13(5+8) 3 12 6 19(13+6) 4 1 10 29(19+10) 5 2 11 40(11+10) this have tried declare @s int select billingid, qty, percent_of_qty, @s = @s + percent_of_qty cumulative tblsumdemo cross join (select @s = 0) var order billingid but i'm not able desired output,any appreciated , thanks you can use cross apply : select t1.*, x.cumulative tblsumdemo t1 cross apply( select cumulative = sum(t2.percent_of_qty) tblsumdemo t2 t2.billingid <= t1.billingid )x for sql server 2012+, can use sum over() : select *, cummulative = sum(percent_of_qty) over(order billingid) tblsumdemo

ios - Correct usage of NMSSH -

when session created, shell started , commands written: no responses recieved , callback methods buffer never called, did miss?: (executing single command using channel:execute works) -(void) createsessionwithadress:(nsstring*)address username:(nsstring*)user password:(nsstring*)pass{ session = [nmsshsession connecttohost:address withusername:user]; if (session.isconnected) { [session authenticatebypassword:pass]; if (session.isauthorized) { nserror *err = nil; session.channel.delegate = self; //self.receiveview.text = [session.channel execute:@"ls" error:&err]; // works [session.channel startshell:&err]; nslog(@"authentication succeeded"); } } } - (void)channel:(nmsshchannel *)channel didreaddata:(nsstring *)message{ nslog(@"read data!"); receiveview.text = [nsstring stringwithformat:@"%@ \n%@",receiveview.text,message]; } -

show/hide issue. want to initial show in jquery -

i new in jquery. want display or hide matched element. use slidetoogle() function. code is $(document).ready(function () { $(".show_hide").show(); $(".slidingdiv").hide(); $('.show_hide').click(function () { $(".slidingdiv").slidetoggle(); }); }); here .show_hide class link , .slidingdiv class div content. want if load page .slidingdiv content initial show set slidingdiv intially 'display:block' , when page loads shown .slidingdiv { display:block; } $(document).ready(function () { $('.show_hide').click(function () { $(".slidingdiv").slidetoggle(); }); }); or change jquery code to $(document).ready(function () { $(".show_hide, .slidingdiv").show(); $('.show_hide').

c# - How to obtain the AssignedLicenses using Microsoft.Graph Client Library -

is there working way read assignedlicenses property of user in microsoft graph client library ? tried following things, assignedlicenses property returned null allthough there licenses assigned user // test 1: using "me" var lic = client.me.request().getasync().result.assignedlicenses; // test 2: using id of user var lic = client.users["<id of user>"].request().getasync().result.assignedlicenses; using select correct technique here found out, viz request().select("assignedlicenses").getasync().result.assignedlicenses on graph, select used both reduce set of properties returned , bring in properties not returned default. in attempt keep default packet sizes moderately sized , readable , keep call performance high not routing every call every underlying service necessary fetch data callers don't need.

Node.js mysql Syntax Error in Merge Statement? -

i have sql query constructed follows: tmpquery = "insert vertix_users (user_name, user_email, user_pass) " + "values (" + mysql.escape(username) + ", " + mysql.escape(useremail) + ", " + mysql.escape(userpass) + ")"; tmpquery = "merge vertix_users (holdlock) olddata " + "using (values (@user_name, @user_email)) newdata (" + mysql.escape(username) + ", " + mysql.escape(useremail) + ") " + "on newdata.user_name = olddata.user_name , newdata.user_email = olddata.user_email " + "when not matched target " + tmpquery; when execute code, following log: merge vertix_users (holdlock) olddata using (values (@user_name, @user_email)) newdata ('asfasfsaff vvv', 'asfasfasfasf') on newdata.user_name = olddata.user_name , newdata.user_email = olddata.user_email when not matched target insert vertix_users (user_name, user_email, user_pass) va

c++ - Why does my code produce a segmentation fault? -

#include <iostream> using namespace std; int main () { int **a; int b[5] = {3,4,5,6,1}; *a=b; cout << *((*a)+0) << endl; return 0; } according understanding *((*a)+0) equivalent (*a)[0] . wrong? how can make above code print first element of array? and why this code work? #include <iostream> using namespace std; int main () { int *a; int b[5] = {3,4,5,6,1}; a=b; cout << *(a+0) << endl; return 0; } when replace a *a everywhere, why wrong? you access uninitialized pointer in *a=b; at point a points random location, , rule undefined behavior can't predict happen. seems location can't write to, , crash. the second variant works because make a point b , don't write uninitialized pointer, initialize pointer location of first item in b .

javascript - Getting the index of an HTML element but filtering out clearfix divs? -

i working on cms , save text, need know index of element working in. i have following (stripped) piece of html: <div class="row"> <article class="col-md-4 col-sm-4 project" > <div class="inphos-hover-color-element5715e6986d561" > <div> <div class="content dummy-content" data-content="title">vul hier uw titel in</div> <div class="content" data-content="text"> <p>sdfas</p> </div> </div> </div> </article> <article class="col-md-4 col-sm-4 project"> <div class="inphos-hover-color-element5715e6986d561" > <div> <div class="content dummy-content" data-content="title">vul hier uw titel in</div>

Mysql thread connected is 1-3 but experienced too many connections -

yesterday can see in log within 1 minute timespan, there alot of mysql errors many connections failures. running default setting: 151 max_connections , have not experienced before. when checking current state, thread connections 1 , 3 @ max. should increase max_connections or did temporary suffer ddos? note: solved , worked after minute. update 2: happend again. can see multiple errors within seconds timeframe error log. why happen? decrease max_connect_errors to, say, 100. small protection against hackers. threads_running @ least 1 because includes show . with max_connections = 151 , max_used_connections = 152 means 151 user connections came in, plus 1 "extra" connection allowed , used. reason, not run application root (or other super user). grant ... on your_database.* ... , not ... on *.* ... application logins. slows down hackers getting @ mysql database. root should allowed localhost . safety measure. if web server has "a

read Text File and Make Changes c# -

i want read text file contains <customername>@coustomername</coustomername> <customeraddress>@customeraddress</customeraddress> <customermobileno>@customermobileno</customermobileno> <payment>@payment</payment> replace @coustomername coustomer name passes during run time till use string readfile = file.readalltext(path); regex.replace(readfile , "@coustomername ", objproposar.firstname); this works need make changes in coustomer address, mobile no etc how can why regex, simple string.replace job: string oldtext = file.readalltext(path); string newtext = oldtext.replace("@coustomername", objproposar.firstname); // other ... file.writealltext(path, newtext);

java - POJOs (Entities?) with differnt amount of properties but same "meaning" (like being an Article). How to design that? -

i give small example: we have simple architecture that: gui -> domain <- dal with gui , dal pointing towards domain in terms of dependency. now domain contains entities, let's following "order" entity: public class order { private string name; private collection<article> articles; ...getter setters etc } now imagine 2 scenarios, 1 need articles (say gui layer asks list of orders , needs order details except articles) , 1 don't need them (one order it's articles). how best design that? 2 pojos? inheritance? in cases it's smart use 2 (or more) interfaces class. if entities in same database table, want limit usage, there's not really (technically speaking) several types of entities.

c - "File Copying" section in K&R -

i'm new programming , can't seem head around why following happens in code, is: #include <stdio.h> /*copy input output; 1st version */ main() { int c; c = getchar(); while (c != eof) { putchar(c); c = getchar(); } } so after doing reading, i've gathered following: nothing executes until hit enter getchar() holding function. before hit enter, keystrokes stored in buffer when getchar() called upon, goes looks @ first value in buffer, becomes value, , removes value buffer. my question when remove first c = getchar() resulting piece of code has same functionality original code, albeit before type smiley face symbol appears on screen. why happen? because putchar(c) doesn't hold code, , tries display c , isn't yet defined, hence outputs random symbol? i'm using code::blocks if helps. the function listed echo every character type @ it. true i/o "buffered". keyboard input driver of operating system doing bu

html - Alignment of Multiple Div inside div -

Image
i have kind of structure. <div id = "div"> <div id = "div1"> <div id = "div11"></div> <div id = "div12"></div> </div> <div id = "div2"> <div id = "div21"></div> <div id = "div22"></div> <div id = "div23"></div> <div id = "div24"></div> <div id = "div25"></div> </div> </div> for div2 want inside div have come in line. i want struuectue [div21] [div22] [div23] [div24] and 5th div has come down 4 div. i tried float left , right, postion not able that. please tell me how can this? try #div21,#div22,#div23,#div24{ display:inline-block; }

javascript - Grunt apply changes after edit js files -

Image
i created first project using grunt. have problem, because after editing js files need restart server apply changes. when edit jade files not need restart server. , problem: how add auto-refresh browser after file changed? my gruntfile: 'use strict'; module.exports = function (grunt) { // show elapsed time @ end require('time-grunt')(grunt); // load grunt tasks require('load-grunt-tasks')(grunt); grunt.initconfig({ reload: { port: 9000, proxy: { host: 'localhost' } }, // watch config watch: { files: ['views/**/*','routes/*'], taksks: 'workon reload', options: { nospawn: true // without option specified express won't reloaded }, express: { files: [ 'app.js', '!**/node_modules/**', '!gruntfile.js' ],

c# - cs0029 cannot implicitly convert type 'ApplicationUser' to 'User' -

i creating app register , authentication. using article in there. https://azure.microsoft.com/en-gb/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/ i errors after creating controllers in article, before enabling migrations. of course can't enable migrations cause lots of errors. what do? i searched answers 'string' 'int' or similar. full error: cs0029 c# cannot implicitly convert type 'pinggod.models.applicationuser' 'pinggod.models.user' also other error same meaning other way around: cs1503 c# argument 1: cannot convert 'pinggod.models.user' 'pinggod.models.applicationuser' thanks in advance! using system; using system.collections.generic; using system.data; using system.data.entity; using system.linq; using system.net; using system.web; using system.web.mvc; using pinggod.models; namespace pinggod.controllers { public class userscontroller : controller {