Posts

Showing posts from August, 2012

php - make element dragable in Yii2 -

i want make draggable element in yii2 advance application. in php or html example http://jqueryui.com/draggable . try in yii2 didn't work. can me please? view page code. <?php /* @var $this yii\web\view */ use yii\helpers\html; $this->title = 'generate table'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="site-generatetable"> <h1><?= html::encode($this->title) ?></h1> <p>test drag , drop function</p> <div id="draggable" class="ui-widget-content"> <p>drag me around</p> </div> </div> <style> #draggable { width: 150px; height: 150px; padding: 0.5em; } </style> <script> $(function() { $( "#draggable" ).draggable(); }); </script> and application asset this <?php namespace frontend\assets; use yii\web\assetbundle; /** * main frontend application asset bundle.

html - How can I restrict element width, using Bootstrap? -

Image
ok, i'm having issue can't head around... my website built around twitter bootstrap , i'm showing data in nested accordion structure. however, on cases (such 1 : http://patternz.drkameleon.com/project/results/441298/3/extended - please have @ 'results' tab, needs username: 'peraspera' , password: 'adastra' access it), the content seems overflow . if want see actual code (and not looks like, since 1 fetched via ajax, content here : http://patternz.drkameleon.com/project/format/441298/3/extended ). the weird thing in various other cases content restricted inside main page... any ideas might going wrong or done in order fixes? anything more welcome - i've been banging head against wall several hours due thing... :s add width:900px tab-pane class <div class="tab-pane active" id="patterns" style="width:900px">

angularjs - Angular time validation -

in following sample of code creating input take time ex. meeting over. <input ui-timepicker name="eventtimepickerto" id="eventtimepickerto" class="form-control" autocomplete="off" attachlevel="-1" placeholder="@webresources.placeholderendtime" ng-model="eventdetails.datetimeto" time-pattern="@validatorregex.validtimeorempty" ng-disabled="eventdetails.permissions.timepickerdisabled" ng-change="saveeventdetails()" ng-blur="saveeventdetails()" /> what want validate input should

How to save the results of a selection query into several LIST Java ordered by ID? -

Image
i want save results of query in several java list grouped id. this result of request: i want have java list follows: list 1 (id = 1, latitude, longitude) / list2 (id = 2, latitude, longitude) ...... this incomplete code: public string getdistancetraveled() { string f = "" ; double distance = 0; alldevicelist = (arraylist<device>) devicebean.getlistalldevice();// list of device list<eventdata> list = devicebean.getlatandlongdeviceid();// list of eventdata map<string, list<eventdata>> map= new hashmap<string, list<eventdata>>(); for(eventdata eventdata : list){ if(map.containskey(eventdata.getdevice().getdeviceid())){ list<eventdata> templist = map.get(eventdata.getdevice().getdeviceid()); templist.add(eventdata); map.put(eventdata.getdevice().getdeviceid(), templist); //system.out.println(&q

javascript - Loading spinner on Ajax call -

i have ajax script fetch query file , load new content file on database update. how go adding loading spinner script? < div id = "ajaxloader" > < h1 > loading < /h1> </div > < div id = "feed_main_load" > < /div> var $loading = $('#ajaxloader').hide(); $(document) .ajaxstart(function () { $loading.show(); }) .ajaxstop(function () { $loading.hide(); }); $(document).ready(function() { $("#feed_main_load").load("elements/feedloadtest.php"); var refreshid = setinterval(function() { $("#feed_main_load").load("elements/feedloadtest.php?" + 1*new date()); }, 60000); }); what have show spinner before call $.load, and hide in completion callback. you have here full snippet: $(document).ready(function() { $(img).hide(); $("#feed_main_load").load("

objective c - How to allow user to upload attachments in iOS application -

in case of android when want send or attach document such pdf or doc application can access files in external storage , share or attach. but since ios follows sandbox approach there no filesystem not possible attach or upload in same manner. in ios application right now, have implemented open in functionality, wherein in info.plist file have specified application supports types of documents when user opens documents gets option open in application, save document in documents/incoming folder in application, when user clicks add attachment can see document attach, since long process looking better ones. i saw whatsapp allows uploading/sharing icloud apart can provide similar behaviour android.

angularjs - Asynchronous call defer and promise chain -

i stuck ashync call chain. tried google couldn't found exact answer. requirement have method callapi(){ calling 4 service asynchronous. want chain asynchronous calls can defer.resolve when request done } any great help. in advance. you can use $q.all() . takes array of promises , returns promise, resolve when promises in array have resolved. example: function callmultipleservices() { return $q.all([ //just random functions returning promises... someasyncservice(), $http.get('http://google.de'), someotherasyncservice() ]) //.then(function(resultarray) { return dosomethingwith(resultarray) }) } the returned promise resolve array, containing resolved values of promises passed in. if want promise return single value somehow derived service results, add .then takes results , somehow calculates final promise result (as in comment above)

opencart2.x - Installing omise on opencart 2.2 -

i trying install omise on opencart 2.2(the latest one), latest omise compatible opencart 1.5x, tutorials provided opencart 1.5x. there anyway,that let me install omise on opencart 2.2? omise supports opencart 2.0.x. please find more information link: https://github.com/omise/omise-opencart but asking version, opencart 2.2, need test yourself.

R: webscraping a table -

i trying webscrape live exchange rates webpage. tried: library(xml) webpage <- "http://liveindex.org/" tables <- readhtmltable(webpage ) n.rows <- unlist(lapply(tables, function(t) dim(t)[1])) but error message. thank help.

dir-pagination directive angularjs : Update pagination after filtering -

Image
am using dir-pagination directive pagination, working fine while filtering pagination not getting update below mycode: <tbody dir-paginate="booking in bookinglist | itemsperpage: 30 | orderby:sortkey:reverse"> <tr ng-repeat="orders in booking.order | filter: booking_filter | daterange: startdate : enddate | orderby:sortkey:reverse"> <td>{{booking.customer_name}}</td> <td>{{orders.order_id}}</td> <td>{{orders.service_name}}</td> <td>{{orders.employee_name}}</td> <td>{{orders.area_name}}</td> <td>{{orders.booking_date | date:"dd/mm/yyyy"}}</td> <td>{{orders.booking_time}}</td> <td>{{orders.status}}</td> <td class="g-btn-full-width"> <button type="button" ng-click="editbooking(orders._id)" cl

ios - When to use NSURLSessionDownloadTask and NSURLSessionDataTask? -

Image
what difference between these 2. able data server using both. there 3 types of concrete session tasks in context: nsurlsessiondatatask: use task http requests retrieve data servers memory. nsurlsessionuploadtask: use task upload file disk web service, typically via http post or put method. nsurlsessiondownloadtask: use task download file remote service temporary file location. you can suspend, resume , cancel tasks. nsurlsessiondownloadtask has additional ability pause future resumption.

Save data from an Angular 2 component before navigate to another component -

i save angular 2 component related data database before navigating particular component component database saved data able display on second component. in order called save method on ngondestroy() hook of first component , display method on second component ngoninit() . however, looks ngoninit() calls before ngondestroy() finished. means before saving data database second component retrieve old data , displaying. please me resolve issue. you can implement candeactivate purpose. router continues route change if promise returnes routercandeactivate resolves true see https://angular.io/docs/ts/latest/api/#!?apifilter=candeactivate rc.x routercandeactivate(currtree?: routetree, futuretree?: routetree) : promise<boolean> { return new promise<boolean>((resolve, reject) => { ... }) } beta.x or router-deprecated in rc.x routercandeactivate(nextinstruction: componentinstruction, previnstruction: componentinstruction) { return new prom

asp.net mvc 3 - Loading "knockout.mapping" plugin using require.js -

i creating mvc3 application, requirejs. in views need convert model object knockout viewmodel object. need use knockout , knockout.mapping libraries. my application designed in following way, 1). script files categorized folders scripts/app/home/ - contains scripts views in home controller. scripts/lib/ - contains scripts jquery, knockout,knockout.mapping, requirejs etc 2). in "_layout.cshtml" referencing "require.js" this. <script src="@url.content("~/scripts/lib/require.js")" type="text/javascript"></script> 3). configure require.js settings using different script file called "common.js" (scripts/lib/common.js) require.config( { baseurl: "/scripts/", paths:{ jquery: "lib/jquery-2.0.3", ko: "lib/knockout-2.3.0", komapping: "lib/knockout.mapping" } }); 4). index.js file in 'scripts/app/home/"

ios - Set title of UIButton that's located in a UICell -

Image
i don't understand why can't set title of uibutton . crashes here: func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { if(section == 0) { let view = uiview() view.alpha = 0 return ktableheadershouldsticktotop ? view : carouselviewcontroller.view } else { let cell = tableview.dequeuereusablecellwithidentifier("newsfeedsectionheadercell") as! newsfeedsectionheadercell cell.delegate = self cell.datasource = self cell.followingbutton.settitle("test", forstate: .normal) return cell } } it connected in .xib file: please check whether can take cell object in viewforheaderinsection : method because per knowledge viewforheaderinsection : called before cellforrowatindexpath . put breakpoint @ let cell = tableview.dequeuereusablecellwithidentifier("newsfeedsectionheadercell") as! newsfeedsectionheadercell and check var

Google Drive PHP API - Simple File Upload Without Signing In -

i have been able simple-file-upload.php example script work, see here: https://github.com/google/google-api-php-client/blob/master/examples/simple-file-upload.php but i'm unable work out how can run without browse user having signed in google account. i want server upload file without user interaction. i've noticed other questions answers have been accepted after trying them out suspect api has changed , no longer work. for example: https://github.com/yannisg/google-drive-uploader-php the token file created gdrive_token.php empty. any advice appreciated. thanks. edit: daimto i'm pretty sure need save refresh token issued after user has signed in. have used following: $refreshtoken = $client->getrefreshtoken(); but returns nothing. can obtaining , using refresh token in context of simple-file-upload.php linked above?

De-select kendo treeview node -

how de-select node in kendo treeview ? i tried removing class 'k-state-selected' node.it works fine, there direct method that. first selected node find specific span using 'k-state-selected' class remove it. var treecontrol = $("#tree-control ").data("kendotreeview"); treecontrol .select().find("span.k-state-selected") .removeclass("k-state-selected");

vba - Userform controlled variables within a macro -

morning guys, i have ran small roadblock project. i'm new vba , trying best 'learn doing' cannot seem head around macro/userform interactions. i have userform 1 textbox , 9 checkboxes. supposed show userform, allow user dictate sheet name, , (from list of 9 users) select active or not (true or false). in main sub, have a allocator.show command, may have guessed, allocator userform name. then i've sort of been trying things don't know how right rest of userform code is; private sub cbgo_click() unload allocator end sub private sub cboxalison_click() if me.cboxalison.value = true alisonyn = true else alisonyn = false end if end sub private sub cboxbeverly_click() if me.cboxbeverly.value = true bevelyyn = true else bevelyyn = false end if end sub private sub cboxcallum_click() if me.cboxcallum.value = true callumyn = true else callumyn = false end if end sub private sub cboxellen_click() if

How to add custom field to invoice in NetSuite -

i tried add field invoice. i created fields in transaction body fields(customization/lists,records & fields/transaction body fields) , make access full access , display main couldn't find in invoice record. where find this? on custom field definition, need click "apply forms" , make sure new field enabled on applicable forms. then, clear browser cache before viewing invoice record.

Pandas DataFrame.update with MultiIndex label -

given dataframe multiindex , dataframe b one-dimensional index, how update column values of new values b index of b should matched second index label of a. test data: begin = [10, 10, 12, 12, 14, 14] end = [10, 11, 12, 13, 14, 15] values = [1, 2, 3, 4, 5, 6] values_updated = [10, 20, 3, 4, 50, 60] multiindexed = pd.dataframe({'begin': begin, 'end': end, 'value': values}) multiindexed.set_index(['begin', 'end'], inplace=true) singleindexed = pd.dataframe.from_dict(dict(zip([10, 11, 14, 15], [10, 20, 50, 60])), orient='index') singleindexed.columns = ['value'] and desired result should be value begin end 10 10 10 11 20 12 12 3 13 4 14 14 50 15 60 now thinking variant of multiindexed.update(singlei

javascript - Es6 React Refs to components -

how reference component using react es6? i have component a class componenta extends react.component { dosomethingincomponenta() { //do here.. } } render(<componenta />, document.getelementbyid('container')); and component b want call componenta's method class componentb extends react.component { dosomethingincomponentb() { componentainstance.dosomethingincomponenta() } } how reference componenta? have tried using var componentainstance = render (<componenta />, document.getelementbyid('container')) export default componentainstance; but since using webpack , componenta.jsx entry point error module not found: error: dependency entry point not allowed is there workaround this? react encourages build applications 1 way data flows. if <componentb /> direct child of <componenta /> can pass data (and functions) using props. function componenta() { const dosomething = () => con

android service not starting or giving explict error -

i have service check screen on of. calling service activity mentioned below. when call service in device below lollipop works. working lollipop also. stopped working on lollipop , gives me error java.lang.illegalargumentexception: service intent must explicit no tried various methods , not able understand whats happening..... package com.androidexample.screenonoff; import android.app.activity; import android.app.alertdialog; import android.app.service; import android.content.broadcastreceiver; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.intentfilter; import android.os.ibinder; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.imageview; import android.widget.textview; import android.widget.toast; public class aescreenonoffservice extends service { broadcastreceiver mreceiver=null; @override

javascript - ie11 fixed header not working allowing scroll over -

i've got bit of javascript code on selecting menu item pdf file gets loaded field id=content. i've got fixed header , footer in place. code works fine chrome, safari, edge, firefox, & opera ie11 ignores fixed header , footer i've loaded pdf (but not left i've got menu). here's javascript load pdf: document.getelementbyid('content').innerhtml = "<object id='provue_file' data='"+file_name+"#view=fith' type='application/pdf' width='100%'><p>it appears don't have adobe reader or pdf support in web browser. <a href='"+file_name+"'>click here download pdf</a>. or <a href='http://get.adobe.com/reader/' target='_blank'>click here install adobe reader</a>.</p></object>"; here's header , footer css declarations: div.header, div.footer { padding: 0.5em; color: blue; background-color: honeydew; c

c# - Delete an Entity with Entity Framework 6.0 -

i trying delete entity using ef6.0 i'm stuck in situation , getting exception. below code snippet i'm running exception _context.images.remove(image) i have separate logic gives me entity. i'm getting below exception: the object cannot deleted because not found in objectstatemanager. upon googling found out since entity fetched separate context , getting deleted in separate context i'm getting error. don't want fetch entity again. want use fetched entity can't find way so. what need attach() entity context. give dbcontext knowledge of object. long entity has valid id, you'll fine. here pseudo-code give idea of you'll need do. using (var context = new mydbcontext()) { // make context aware of object. context.images.attach(image); // delete object. change internal // state deleted. context.images.remove(image); // finally, save changes context.savechanges(); }

jQuery ,Uncaught TypeError: $(...).autoNumeric is not a function -

i'm trying implement autonumeric jquery plugin keep getting error message in console. uncaught typeerror: $(...).autonumeric not function markup: <input type="text" class="employee_annual_salary /> <script type="text/javascript" src="http://www.example.co.uk/assets/js/autonumeric.js"></script> <script type="text/javascript"> $(function() { $(".employee_annual_salary").autonumeric('init'); }); </script> i have these scripts in header <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>assets/tinymce/tinymce.min.js"></script> <script type="text/javascript" src="

javascript - SyntaxError unexpected token u in JSON on position 0 Angular2 -

Image
i tried make server dummy data. here system.js config (since have different routing, seemed work fine till now) system.config({ // baseurl node_modules baseurl: '/plugins/dashboard/assets/@@version@@/node_modules', defaultjsextensions: true }); system.import('/plugins/dashboard/assets/@@version@@/app/main') .then(null, console.error.bind(console)); here service: import {injectable} 'angular2/core'; import {http, response} 'angular2/http'; //import {observable } 'rxjs/observable'; import {observable} 'rxjs/rx'; import {newsletter} "../objects/newsletter"; @injectable() export class newsletterservice { constructor (private http: http) {} //need change url private _mynewsletterurl = "http://epub-core.dev.prisma-it.com:8888/plugins/dashboard/assets/@@version@@/app/data/newsletter.json"; // url web api getnewsletter () { cons

php - Upload Image from different page -

Image
i want upload image , insert database different page. want create admin panel can upload image image sider image slider in different page. it's working when form method inside index.php, when put admin.php it's not working. think need method? can give me idea method, requirements that? i'm new php , sql. here index.php code want show slide. <?php //for connecting db include('connect.php'); if (!isset($_files['image']['tmp_name'])) { echo ""; } else { $file=$_files['image']['tmp_name']; $image= addslashes(file_get_contents($_files['image']['tmp_name'])); $image_name= addslashes($_files['image']['name']); move_uploaded_file($_files["image"]["tmp_name"],"gallery/" . $_files["image"]["name"]); $photo="gallery/" . $_files["image"]["name"]; $query = mysqli_query($mysqli, "insert images(photo)values(&#

javascript - Service Call in client Side -

i need call service , retrieve resulted data in call function getting js error: uncaught referenceerror: invoicehtmlservice not defined. please - below pages , class my aspx page <%@ page language="vb" autoeventwireup="false" codebehind="invoicehtml.aspx.vb" inherits="webapplication2.invoicehtml" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>web service call client-side javascript</title> <script type="text/javascript"> function sendrequest() { debugger; invoicehtmlservice.getbillinvoicehtmldata(); } function oncomplete(arg) { alert(arg); } function ontimeout(arg) { alert("timeout has occured"); } function onerror(arg) { alert("error has occured: " + arg._message); } <

iphone - Zoom only a selected subview from the UIScrollView -

i adding many uiimageview's uiscrollview,with paging enabled.i need zoom image have tapped zoom,rather zooming entire scrollview.also zooming particular image doesnot scale other subviews. - (void)loadscrollviewwithimages { scrollview.contentsize = cgsizemake(self.view.bounds.size.width * imagelist.count, self.view.bounds.size.height); scrollview.pagingenabled = yes; uiview *mainview = [[uiview alloc] initwithframe:self.view.bounds]; cgfloat xpos = 0.0; (uiview *subview in scrollview.subviews) { [subview removefromsuperview]; } int = 0; (nsdictionary *imagedetails in self.imagelist) { uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake(xpos, 0.0, self.view.bounds.size.width, self.view.frame.size.height)]; imageview.contentmode = uiviewcontentmodescaleaspectfill; [imageview setclipstobounds:yes]; [mainview addsubview:imageview]; xpos += self.view.bounds.size.width; [imageview setimagewithurl:[nsurl urlwithstring:[imagedetail

browser - What is == $0 in developer tool after the end of every line of code? -

Image
this question has answer here: what ==$0 (double equals dollar zero) mean in chrome developer tools? 4 answers i want know == $0 in developer tool, marked red in screenshot. found == $0 in code of every website in developer tool , want know this? i not seeing this, $0 refers element inspected. try out right-clicking comment , choose "inspect element" in google chrome. if pop on console , type out $0, select element in page , print out in console.

Locating index of item via REGEX in Python -

i've hit wall , need help. context: have list of lists of strings. matrix = [['444'], ['23%'], ['a']] for moment, have list of counts @ position 0, percentage @ 1 , significance test @ 2. the number of lists within list changes 3 2 1 time time. , type of string within list changes position. cannot assume index 0 counts , percentage 1 etc. hence wanted find way of dynamically finding out percentage, example, located in matrix, , if in there. here i've written far: for i, row in enumerate(matrix): cell in row: if "%" in cell: percent = print percent i, row in enumerate(matrix): cell in row: if re.search('[a-za-z]', cell): sigtest = print sigtest i, row in enumerate(matrix): cell in row: if re.search('[0-9]', cell): count = print count output: 1 2 0 1 problem: can see,

c# 4.0 - Regasm COM visible assembly on network drive using framework 4 -

i've got v4.0 library needs com visible called delphi application. using regasm following error: regasm : error ra0000 : not load file or assembly 'file:///d:\development\ entv610\atmslinkclientlibrary.dll' or 1 of dependencies. operation not supported. (exception hresult: 0x80131515) i can work if modify regasm.exe.config file use: <runtime> <loadfromremotesources enabled="true"/> </runtime> unfortunately need write installer , rest of application. don't want clients have edit file in framework folder. there anyway library registered on mapped drive without setting config file?

python - How to convert a stat output to a unix permissions string -

if run os.stat(path) on file , take st_mode parameter, how there string this: rw-r--r-- known unix world? since python 3.3 use stat.filemode : in [7]: import os, stat in [8]: print(stat.filemode(os.stat('/home/soon/foo').st_mode)) -rw-r--r-- in [9]: ls -l ~/foo -rw-r--r-- 1 users 0 jul 23 18:15 /home/soon/foo

delete users in yajra laravel datatables -

hy, i'm new laravel using l5 , yajra/datatables plugin.when click on delete button gives error "tokenmismatchexception in verifycsrftoken.php line 53:" code is controller.php return datatables::of($users) ->addcolumn('action', function ($id) { return '<button class="btn-delete" data-remote="localhost/blog/public/delete/' . $id->id . '">delete</button>'; }) ->make(true); in view <script> $(function(){ $('#users-table').datatable({ processing: true, serverside: true, ajax: '{!! route("data") !!}', columns: [ {data: 'id', name: 'id'}, {data: 'name', name: 'name'}, {data: 'email', name: 'email'}, {data: 'created_at', name: 'created_at'}, {data: 'updated_at', name: 'updated_at'}, {data: 'ac

how to put an image view on top of a surfaceview android -

i have surface view have set setzorderontop(true); when have recorded video on view, set display of media player view , set visibility of images on true can see images on surface view. now when set mediaplayer.start() video plays images on surface view disappear, , aren't visible after explicitly set surfaceview setzorderontop(false); , visibility of images visible in oncompletion of media player. imageviews onclick enabled please me solve this. the view ui on 1 layer, surfaceview surface on different layer. can put surfaceview surface in front of or behind view elements, can't put between views, , can't change position once surface has been created: note must set before surface view's containing window attached window manager. you can solve on api 14+ sending video textureview instead. textureviews less efficient, can manipulated in layout other view.

java - Android Exception in parsing a static json -

i have configuration file pick server @ launch of android app. code fetching file pretty standard @override protected void onresume() { super.onresume(); new connectiontask().execute(); } private class connectiontask extends asynctask<string, string, string> { @override protected void onpreexecute() { } @override protected string doinbackground(string... args) { string result = null; authenticateconnection mauth1 = new authenticateconnection(); try { result = mauth1.connection(); } catch (exception e) { e.printstacktrace(); } return result; } @override protected void onpostexecute(string str) { if (!isfinishing() && !isdestroyed()) { if (!textutils.isempty(str)) { log.e("str", "" + str); /****** below line crashes*******/ baseurl obj = new gson().fromjson(str, baseur

javascript - How to queue ajax request while the server is still processing previous request? -

i'm performing live server side search while user typing in browser. seach functionality can't keep typing pace, requests pile up. i want able cancel queries replaced new queries before server ready respond. this want achieve: the first keystroke should sent server. the next key stroke should queued client side script until server responds first query. if, in meantime, keystroke happens should replace queued keystroke. this way, recent keystroke gets sent server, once server ready. of course, if there no queue, keystroke should sent straight server. my current implementation dead simple: $.ajax({ type: "get", datatype: "script", data: { search: "something" }, url: "/api/search", success: function(data, status, xhr) {}, error: function(xhr, textstatus, errorthrown) {} }); i think approach going flood server, because you're sending request server on each keystroke. , if abort request on cli

Script breaks after the second if statement -

i trying format email confirmation registration form. if choose class filled should produce else statement otherwise show value click on in form. works first if statement when add second statement no longer gives me else statement if class full. if (s1 = sheet.getrange("a6").getvalue() && sessiononeload6 <= 15){ var sessionone = e.values[4]; } else { var sessionone = "this section full, please return enrichment registration form (link) , choose new section."; } if (s1 = sheet.getrange("a7").getvalue() && sessiononeload7 <= 15){ var sessionone = e.values[4]; } else { var sessionone = "this section full, please return enrichment registration form (link) , choose new section."; } you using = test equivalence in fact assigning right hand side s1 . use == test value equivalence or === type , value equivalence instead. leave original value of s1 intact both conditionals.

C# List Group By with where -

Image
hi i'm trying group c# list. how looks. name user fred true fred false fred true joe true joe true max false max true result: this how wanted after group by, how can in c#? you can group name , use enumerable.count predicate here: var result = list .groupby(x => x.name) .select(g => new { name = g.key, true = g.count(x => x.user == true), false = g.count(x => x.user == false) });

security - Develop a secure VoIP Android app -

i want develop android app. it's first 1 , has secure voip app. told use webrtc , after lot of research i'm stuck. don't how webrtc works. can me steps in developing kind of apps? having worked in past webrtc , want share information here may people's want start learning scratch: --> first thing refer straight forward example pierre chabardes on github. here link : androidrtc --> can find here straight forward build scripts pristineio android & ios build latest version of required webrtc library. requires linux machine. webrtc build scripts --> , tutorial here : introduction webrtc this 3 links started , can start learning here then. hope helps , out here.

excel - Transposing and inserting cells at the same time -

i'm having trouble following problem. have dataset looks this: 1 3 4 6 7 1 2 2 4 5 9 5 1 2 3 5 i want take single numbers common in each, , arrange them in 1 column: 1 2 3 4 5 6 7 9 the approach i'm taking script recognise there more 1 complete cell in row, execute command transpose adjacent cells beneath current range. have far is: sub recordarrangetest() dim rng range dim long dim n long dim wholecolumn range dim lastcolumn long lastcolumn = range("a1").currentregion.columns.count = 1 dim lastrow long lastrow = range("a1").end(xldown).row while <= lastrow set rng = range("a" & i) set wholecolumn = range(cells(i, i), cells(1, lastcolumn)) if isempty(rng.offset(0, 1).value) = false range(rng.offset(1, 0), rng.offset(lastcolumn, 0)).insert shift:=xldown wholecolumn.copy rng.offset(1, 0).pastespecial paste:=xlpasteall, operation:=xlnone, skipblanks:= _ false, transpose:=true wholecolumn.delete shift:=xlup =

jquery - dataLayer.push() doesn't trigger an HTTP request -

Image
i triggering google analytics event on page load code: datalayer.push({ 'event': 'gaevent', 'eventcategory': 'data-harvest', 'eventaction': 'form-submitted', 'eventlabel': 'vr-gear' }); it happens on document.ready() , there no errors in console, reason doesn't trigger http request. idea why that? if not using google tag manager, that's expected result. datalayer specific json object gtm defines , deploys in order fire tags , acquire various pieces of information page. uses special 'event' fire custom tags. google analytics not utilise datalayer that's why, without gtm, won't see http requests. if using gtm need have edit access @ least, , you'll need to: create custom event trigger uses specific event value ( gaevent ) create variables use other event-based parameters ( eventcategory, eventaction, eventlabel ) and tag uses pieces together.

python - Efficiently compute columnwise sum of sparse array where every non-zero element is 1 -

i have bunch of data in scipy compressed sparse row (csr) format. of course majority of elements zero, , further know non-zero elements have value of 1. want compute sums on different subsets of rows of matrix. @ moment doing following: import numpy np import scipy sp import scipy.sparse # create data sparsely distributed ones data = np.random.choice((0, 1), size=(1000, 2000), p=(0.95, 0.05)) data = sp.sparse.csr_matrix(data, dtype='int8') # generate column-wise sums on random subsets of rows nrand = 1000 k in range(nrand): inds = np.random.choice(data.shape[0], size=100, replace=false) # 60% of time spent here extracted_rows = data[inds] # 20% of time spent here row_sum = extracted_rows.sum(axis=0) the last few lines there bottleneck in larger computational pipeline. annotated in code, 60% of time spent slicing data random indices, , 20% spent computing actual sum. it seems me should able use knowledge data in array (i.e., non-zero value in s

arrays - PHP Multidimension in_array -

i've got 2 dimensional array looking this: array ( [google.fr] => array ( [0] => array ( [0] => google.de [1] => microsoft.de [2] => google.com [3] => apple.de ) ) what need check is, if string first dimension - here google.fr equal string comparing to. found thread here in stackoverflow provided following function: function in_array_r($needle, $haystack, $strict = true) { foreach ($haystack $item) { if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) { return true; } } return false; } i'm calling follows: if (in_array_r($row->name, $linkresult)) { echo "<span style=color:red; margin-left:15px;> <b>!</b></span>"; } but no matte

rabbitmq - Scatter Gather : Wait for all "Gather-Workers" to complete -

i getting rabbitmq. i have scatter , gather proof of concept working. my eventual setup be: myclient (aka, scatter'er) mygatherworker1 mygatherworker2 mygatherworker3 mygatherworkern (could go 10 @ point) myrabbitmqserverhost mygatherworker1-mygatherworkern wired "exchange" (i think that's right term) on myrabbitmqserverhost. myclient send scatter-gather request myrabbitmqserverhost. below "myclient" code. i have minresponses variable. says "once n number of responses, consider scatter , gather done". however, best strategy making sure configured "mygatherworker(s)" provide response? i want have guaranteed "wait mygatherworkers" strategy. , not have put "n" value on client side configuration match (same) number of mygatherworker's. i know adding more mygatherworker's system. private icollection<customermovesummary> sendscattergathermessagetoqueues(list<string>

c# - Unity3d "Cannot implicitly convert type `void' to `bool'" -

void update () { if (transform.translate((input.acceleration.x), 0, 0)) { getcomponent<rigidbody>().addforce(vector2.right); } } i using accelerator android app , doesn't seem it. can change work keydown wont work accelerator. error: "cannot implicitly convert type "void" "bool" according documentation http://docs.unity3d.com/scriptreference/transform.translate.html : transform.translate not return boolean; return type void. therefore cannot use if statement evaluate whether or not successful. if want check see if translate happened correctly need check side effects calling transform.translate. in other words see has changed on transform , see if matches expectations.

qt - QML object property changed from c++, but I can't see the result -

so change property of qml object via c++ code, couldn't see result on screen. have item repeated 64 times, , want image displayed 32nd item (from c++) used invokemethod access object via c++ used setproperty change visibility, if view qdebug property "visible" did change, notice no difference on screen still cannot see image, if change visibility qml, can see it. this c++ code: int main(int argc, char *argv[]) { qguiapplication app(argc, argv); qquickview view; view.setsource(qurl("qrc:///main.qml")); view.show(); qquickitem* child; qqmlapplicationengine engine; engine.load(qurl(qstringliteral("qrc:///board.qml"))); qobject *rootobject = engine.rootobjects().first(); qquickitem *qmlobject = rootobject->findchild<qquickitem*>("grid")->findchild<qquickitem*>("repeter"); qmetaobject::invokemethod(qmlobject,"itemat",qt::directconnection, q_return_arg (qquickitem*,child), q_arg(in