Posts

Showing posts from 2010

sqlite - fetch column name from json array -

i need column name json array , ccompare column name sqlite table , have alter table when column name dowsnot exists. i use code fetch column , column name sqlite code string searchquery = "select * " + mytable; cursor cursor = mydatabase.rawquery(searchquery, null ); jsonarray resultset = new jsonarray(); cursor.movetofirst(); while (cursor.isafterlast() == false) { int totalcolumn = cursor.getcolumncount(); jsonobject rowobject = new jsonobject(); for( int i=0 ; i< totalcolumn ; i++){ cursor.getcolumnname(i); here use "cursor.getcolumnname() " column name sqlitetable. like this possible fetch column name jsonarray example cursor.getcolumnname(resultset.getjsonarray(i); is possible, else give me solution column name of jsonarray value. have compare column names of jsonarray , sqlite table.

sql server - Extract Data from running dataset -

i've had minor crisis sql server, involving large portion of data being removed. luckily, application wrote using dataset pull data server, , still has of old data. there way can extract data rentry database? must done application running, opening new instance pulls new data database... my google-fu has turned nothing, particular problem have. appreciated. apologies questionable tags, hard see fits. edit: clarify confusion found in comments, data absolutely within application, closing cause loss of data. copying data ui i'm trying avoid here...as massively time consuming. thank again help, appreciated.

c# - Bind/Display the two different columns data together inside a Dropdown for a particluar Id in "Edit" mode of RadGrid -

i have 4 columns in telerik radgrid 1) account code (only column shown in "edit" , "add" mode - dropdown) 2) account description 3) amount 4) remark below "add" mode code using: html code: <mastertableview showheaderswhennorecords="true" autogeneratecolumns="false" datakeynames="accountcodeid" insertitemdisplay="top" insertitempageindexaction="showitemoncurrentpage" showfooter="true" commanditemdisplay="top"> <columns> <telerik:grideditcommandcolumn></telerik:grideditcommandcolumn> <telerik:gridtemplatecolumn uniquename="accountcode" headertext="account code"> <itemtemplate> <asp:label...

c# - ADO.net Entity Data Model from SQL Server -

i trying create entity data model sql server database using ado.net in visual studio 2012 , facing error key (primary , foreign): the table/view 'database.tablename' not have primary key defined. key has been inferred , definition created read-only table/view. is there me solving problem? thanks.

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 what's solution basic problem? well, problem variable i , within each of anonymous functions, bound same variable outside of function. what want bind variable within each function separate, unchanging value outside of function: var funcs = []; function createfunc(i) { return function() { console.log("my value: " + i); }; } (var = 0; < 3; i++) { funcs[i] = createfunc(i); } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } ...

perl - Why do I get "HASH(0x1cbf850)" when I try to print a value from my YAML file? -

i'm trying read yaml file following code: #!/usr/bin/perl use strict; use warnings; use data::dumper; use mime::base64; use yaml qw(loadfile); $set = loadfile('/apps/config/config.yml'); print $set->{appbaseurl}; my config file looks this: dev: &dev appbaseurl: "https://app-dev:8443" appusername: devadmin apppassword: ffaljfdlsd stage: &stage appbaseurl: "https://app-stg" appusername: stageadmin apppassword: jljfaldskels" when print $set->{appbaseurl}; get hash(0x1cbf850) which not expected. why?

asp.net mvc - Why can't one Razor helper call another helper? -

i'm running razor code below in .cshtml file (it's simplified version of more complex need achieve), rendertestb helper not seem execute. @rendertesta("test string 1", "test string 2"); @helper rendertesta(string input1, string input2) { <div> @rendertestb(input1) @rendertestb(input2) </div> } @helper rendertestb(string input) { <p class="test">@input</p> } why this? , there way of achieving i'm trying do? i realise duplicate paragraph code within rendertesta helper, prefer re-usable code solution. what this? @rendertesta(rendertestb("test string 1"), rendertestb("test string 2")) @helper rendertesta(string input1, string input2) { <div> @input1 @input2 </div> } @helper rendertestb(string input) { <p class="test">@input</p> } you should consider using editor / display templates or cus...

Infinite loop (do - while) -

for(int m=0;m<=3;m++){ for(int n=0;n<=3;n++){ if(n>0){ int c =n,t=1; do{ t = up_key_no0(&puzz[c][m]); c--; }while(t==1||c>=0); } } } int up_key_no0(int *puzy){ int *puzx = puzy -4; int down = *puzy; int = *puzx; if(((down==up)||(up==0))&&down!=0){ *puzx += *puzy; *puzy=0; return 1; } else{ return 0; } } is following piece of code wrong? if yes reply. whole code cant fit puzz 2 dimensional array of 4x4 your do-while loop can go out of range of table negative indices when t 1 , c 0. maybe should change condition (t == 1 && c >= 0) (and instead of or).

KMP Algorithm Implementation in C++ gives Runtime Error -

i have implemented knuth-morris-pratt algorithm in c++ . implementation seems right encountering runtime error cant seem figure out . need in . #include <iostream> #include <cstring> #include <string> using namespace std; int* prefixfunction(string pattern) { int m = pattern.length() ; int prefixtable[m] ; prefixtable[0] = 0 ; int k = 0 ; for(int q = 1; q<m; q++) { while(k>0&&pattern[k]!=pattern[q]) { k = prefixtable[k] ; } if(pattern[k]==pattern[q]){ k = k + 1 ; } prefixtable[q] = k ; } return prefixtable ; } void kmp(string text,string pattern) { int* prefixtable = prefixfunction(pattern) ; int n = text.length() ; int m = pattern.length() ; int q = 0 ; //characters matched for(int i=0;i<n;i++) { while(q>0&&pattern[q]!=text[i]) { q = prefixtable[q] ; } if(pattern[q]==text[i]) { ...

jsf - Universally skip validation params on required inputs -

how make button can skip web required validation(but still want process data, immediate , on cannot true). important must universal. @ moment using in every required field condition request param. code example below <p:inputtext value="#{cc.attrs.data.exampledata1}" required="#{param['onlysave'] == null}"/> <p:inputtext value="#{cc.attrs.data.exampledata2}" required="#{param['onlysave'] == null}"/> <p:inputtext value="#{cc.attrs.data.exampledata3}" required="#{param['onlysave'] == null}"/> <p:commandbutton value="zapisz zmiany" action="#{cc.attrs.controller.save()}" update="@form"> <f:param name="onlysave" value="true"/> </p:commandbutton> this solution fine cause can in every page add param button , skips validation, when save bu...

powershell - WMI Permanent Events -

i try set wmi permanent events base on specifics events coming network card on windows 7 sp1. i use code: #creating new event filter $instancefilter = ([wmiclass]"\\.\root\subscription:__eventfilter").createinstance() $instancefilter.querylanguage = "wql" $instancefilter.query = "select * __instancecreationevent targetinstance isa 'win32_ntlogevent' , targetinstance.logfile='system' , targetinstance.sourcename '%e1_express%' , (targetinstance.eventcode=27 or targetinstance.eventcode=32 or targetinstance.eventcode=33 or targetinstance.eventcode=36)" $instancefilter.name = "lan_watcher_filter" $instancefilter.eventnamespace = 'root\cimv2' $result = $instancefilter.put() $newfilter = $result.path #creating new event consumer $instanceconsumer = ([wmiclass]"\\.\root\subscription:commandlineeventconsumer").createinstance() $instanceconsumer.name ='lan_watcher_consumer' $instanceconsumer....

php - How can I access an array/object? -

i have following array , when print_r(array_values($get_user)); , get: array ( [0] => 10499478683521864 [1] => 07/22/1983 [2] => email@saya.com [3] => alan [4] => male [5] => malmsteen [6] => https://www.facebook.com app_scoped_user_id/1049213468352864/ [7] => stdclass object ( [id] => 102173722491792 [name] => jakarta, indonesia ) [8] => id_id [9] => el-nino [10] => alan el-nino malmsteen [11] => 7 [12] => 2015-05-28t04:09:50+0000 [13] => 1 ) i tried access array followed: echo $get_user[0]; but displays me: undefined 0 note: i array facebook sdk 4 , don't know original array strucutre. how can access example value email@saya.com array? to access array or object how use 2 different operators. arrays to access ...

cordova - Creating registration ID for Azure Notification Hub via REST api -

i'm building app in cordova, , want use azure notification hub send push notifications app. i've had issues notification hub cordova plugin, fails build 64-bit architecture - hence it's plugin not option me. instead i'm using notification hub rest api. i'm stuck trying create registration id device. i'm able send ajax-request notification hub, keep getting 401 error. here's js code far: function registerhub() { var connectionstring = 'endpoint=sb://[service-bus-name].servicebus.windows.net/;sharedaccesskeyname=defaultfullsharedaccesssignature;sharedaccesskey=[my-shared-access-key]'; var parts = connectionstring.split(';'); if(parts.length != 3) throw "error parsing connection string"; parts.foreach(function(part){ if (part.indexof('endpoint') == 0){ endpoint = 'https' + part.substring(11); console.log('endpoint ' + endpoint); } else if(part.indexof('sharedaccess...

How to do foreach in Meteor with Mongo? -

have collection peoples = new mongo.collection('peoples'); peoples.insert({ name: ["mark", "john", "kate"] }); i want show names in name <template name="ptable"> <tr class="trjob"> <td> {{#each names}} {{> peoplename}} {{/each}} </td> </tr> </template> <template name="peoplename"> <div>{{name}}</div> </template> what in temlate helpers template.ptable.helpers({ names: function(){ return posts.tags; } }); template.peoplename.helpers({ name: function(){ return posts.tags.find(); } }); i know have sh*** code in template helpers, idea how make ? it must (in dom) <td> <div>mark</div> <div>john</div> <div>kate</div> </td> simple array example template.home.helpers({ names: function(){ return [1,2,3]; ...

javascript - Adding onclick to Polygon Location Label in Google Maps v3 -

i have following code initialize polygon onclick listener displays alert: polygon.location = location; polygon.locationlabel = new locationlabel(location, latlng, mapprovider.map); google.maps.event.addlistener(polygon, 'click', function(e) { alert('hello'); }); this fine, displays alert when click polygon not actual label. how add listener alert displayed when label clicked? try : texttoshow = polygon.locationlabel; google.maps.event.addlistener(polygon, 'click', function(e, texttoshow) { alert(texttoshow); });

beanshell - Query on Jmeter +JSON -

how can create json file contain below data in bean shell scripting , call every iteration on jmeter { "1436327282123": { "numcopies": 20, "status": "done printing", "title": "demo.jpg", "username": "david", "date": "23:06 feb 5, 15", "print status": "ok", "time": "1429036296", "timestampdoneprintingattr": 1436327282 } }

java - how to get value thats displayed in the Emulator? -

i writing small android "hello world" application , write small test case . have written small test case , have below : public void testmyfirsttesttextview_labeltext() { final string expected = getcontext().getresources().getstring(r.string.hello_world); final string actual = getcontext().gettext().tostring(); assertequals(expected, actual); } the expected variable gets instantiated value strings.xml actual value , struggling understand methods or snippet should write in order value of displayed string . so how value of text displayed in emulator: of below statement wrong: final string actual = getcontext().gettext().tostring(); i new android , can me please . if check last peice of code in snippet : assertequals(expected, actual); it checks(using junit think) weather value of expected same actual . once again repeat question in above snippet , how get/retrive value of displayed text ? i.e. on below line : final string actual = getc...

c# - ProtocolException Unhandled/(405) Method not allowed with WCF; Bindings and Endpoints look right though -

Image
i'm learning how use wcf , trying write little helloworld program scratch (both host , client sides). i've been getting protocolexception unhandled whenever client tries use service, , can't figure out why. i'm hosting service using iis. regarding way have things set up: i'm doing best separate client, proxy, host, service, , contract detailed in video , outlined in article . i've got different projects within solution each of those. here different files showing i'm talking about: service namespace helloworld { public class helloworldservice : ihelloworldservice { public string getmessage(string name) { return "hello world " + name + "!"; } } } contract namespace helloworld { [servicecontract] public interface ihelloworldservice { [operationcontract] string getmessage(string name); } } proxy namespace helloworld { public class proxy : clientbase<ihelloworldservice...

r - file.remove gives "cannot remove file ... reason 'No such file or directory'" although I use "showWarnings = FALSE" -

in (non interactive) r script, running cmd.exe (on windows), have following line file.remove('text.xls', showwarnings = false) when interpreter reaches line , file not exist, writes cannot remove file 'text.xls', reason 'no such file or directory' although have set parameter showwarnings false . there way suppress message? you can add if statement: if(file.exists("text.xls")) file.remove('text.xls', showwarnings = false) so file.remove function evaluated if indicated file exists

sql - Select sysdate-to_date('08-aug-2015','dd-mm-yy' ) from dual; -

in oracle if run select sysdate-to_date('08-aug-2015','dd-mm-yy' ) dual; command on 08-08-2015 @ 5 pm?what output , why? my output is -30.29566 i want know why there leading space, why negative, , value represent. you can substitute fixed value sysdate test this: select to_date('2015-08-08 17:00:00', 'yyyy-mm-dd hh24:mi:ss') - to_date('08-aug-2015','dd-mm-yy' ) dual; to_date('2015-08-0817:00:00','yyyy-mm-d --------------------------------------- .708333333 which 17/24; difference between 17:00 , 00:00 on same date. date arithmetic explained in documentation , , shows result of subtracting 1 date number: each date value contains time component, , result of many date operations include fraction. fraction means portion of 1 day. example, 1.5 days 36 hours. these fractions returned oracle built-in functions common operations on date data. if run query toda...

css - Bootstrap DropDown Menu: Remove Scrollbar -

i'm working in following github-repo . when window width decreases,the navbar collapses , changes dropdown menu scrollbars (for width , heigth). how can remove scrollbars? i tried adding .navbar-collapse{ max-height:auto; max-widht:auto; } to css file handles collapsing size. another solution adding following css: /* no scrolling collapsed menu */ .navbar-collapse.in { overflow: hidden; max-height: none !important; height: auto !important; }

Getting issue in making JSON request from xml request of SAP -

my requirement create json below xml, , send post request sapnetweaver adapter. sap end point uri: /sap/opu/odata/sap/zpm_mobile_srv/woheaderset method: post payload: 1 operation, 2 materials xml request contain 2 payload operations , material. 1. operation : woheaderoperation 2. materail : woheadermaterial this code contain 2 section 1 woheaderoperation , second woheadermaterial <?xml version="1.0" encoding="utf-8"?> <atom:entry xmlns:atom="http://www.w3.org/2005/atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <atom:content type="application/xml"> <m:properties> <d:aufpl>1000000053</d:aufpl> <d:gltrptms>1425887760</d:gltrptms> <d:gstrptms>1425887760</d:gstrptms> <d:auart>pm02</d:auart> ...

android - Parse.com hangle one-to-many relation -

i need save one-to-many relations in parse, every cathegory has have several questions ( max 4 ) , every question has have string question , answer ( max 5 strings ) , additionally 4 image ( not implemented yet ) , need have online updating "on air". , testing database service ( , decided parse need save relation between cathegory , question) this code activity (fragment) : question q1 = new question("how money cost new skoda fabia?", "300 " + "000kc", "200 000kc", "100 000kc", "50 000kc"); q1.saveinbackground(); question q2 = new question("how money cost new skoda felicia?", "300 " + "000kc", "200 000kc", "100 000kc", "150 000kc"); q2.saveinbackground(); question q3 = new question("how money cost new skoda octavia?", "500 " + ...

database - open cart: Fatal Error : Class 'Mysqli' Line 7 -

anyone can me? have problem installation opencart in cpanel softacolous, when i'm finished install , during open site have message : fatal error: class 'mysqli' not found in /home/radiance/public_html/shoukhin/system/library/db/mysqli.php on line 7 ==info:== open cart: version : 2.0.3.1, 1.5.6.4 release date : 29-05-2015 anything more solve or ans? there solve it? thanks in advance. azad please install mysqli centos server . to install mysqli using eachapache: login whm 'root' user. either search "easyapache" or go software > easyapache scroll down , select build option (previously saved config) click start "start customizing based on profile" select version of apache , click "next step". select version of php , click "next step". choose additional options within "short options list" select "exhaustive options list" , "mysql improved ex...

cql - NoHostAvailableException Found at the Time of data reading from Cassandra -

i using cassandra 2.1.5, , cassandra-java-driver 2.0.10. facing below exception when fetching data cassandra table. com.datastax.driver.core.exceptions.nohostavailableexception: host(s) tried query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.transportexception: [/127.0.0.1:9042] connection has been closed)) @ com.datastax.driver.core.exceptions.nohostavailableexception.copy(nohostavailableexception.java:84) @ com.datastax.driver.core.defaultresultsetfuture.extractcausefromexecutionexception(defaultresultsetfuture.java:265) @ com.datastax.driver.core.defaultresultsetfuture.getuninterruptibly(defaultresultsetfuture.java:179) @ com.datastax.driver.core.abstractsession.execute(abstractsession.java:52) @ com.datastax.driver.core.abstractsession.execute(abstractsession.java:36) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl...

php - CI : save values from hidden fields to another table -

i created form in ci framework 60 fields, , database works. want separate fields , send table, linked primary table (with relatioship, of course). hide fields, , show if radio button checked "yes" : <!-- other fields --> <div><label class="control-label" for="imp_status">3rd party</label> <div class="controls"> <table> <tr> <td><input type="radio" name="imp_status" id="imp_status_yes" value="1" onclick="javascript:importircheck()"> yes</td> <td><input type="radio" name="imp_status" id="imp_status_no" value="0" onclick="javascript:importircheck()"> no</td> </tr> </table> </div> </div> <div style="display:none" id="info_imp"> <fieldset> somefields </fieldset> </div> <!-- other ...

javascript - Which Jquery events should I use within an ajax modal? -

i have modal loaded via ajax, use .on() jquery bind events inside modal : $(document).on('click', '#mybutton', function() { $('#mydiv').toggle(); }); i want toggle() div when modal called, event should use ? i tried "load" doesn't works : $(document).on('load', function() { $('#mydiv').toggle(); }); edit : i found solution here : binding elements when modal window loads ajax (jquery) try this $('#mybutton').click(function() { $('#mydiv').toggle(); });

.net - c# linq how to check for null values in the same column that i need to be not null -

i have query in linq var finalresults = (from r in results.asenumerable() datetime.now.subtract(r.field<datetime>("senton")).minutes > 7 select r ).tolist(); sometimes senton column null , want ignore these cases. how can remove these null cases ? if required can staging (another) table has not null values , can continue the table results can have table, lets results2 doesn't have null values or senton ? if field senton can null , have return datetime? instead of datetime . try: var finalresults = (from r in results.asenumerable() r.field<datetime?>("senton") != null && datetime.now.subtract(r.field<datetime>("senton")).minutes > 7 select r ).tolist(); alternatively, pointed out in comment, can use datarow.isnull . var finalresults = (from r in resul...

magento - Two layouts configuration in config.xml -

i trying use 2 layout files, 1 taking data user , saving database , other display content it.i don't know how configure config.xml adding 2 layout files in magento. here layout configurations in config.xml <layout> <updates> <helloworld> <file>displaydata.xml</file> </helloworld> <helloworld> <file>helloworld.xml</file> </helloworld> </updates> </layout> you can use single layout file define multiple handlers. http://code.tutsplus.com/tutorials/custom-layouts-and-templates-with-magento--cms-21419 in tutorial, @ last specified how use our custom layout extension. can add new handler follows. <?xml version="1.0"?> <layout version="0.1.0"> <mymodule_index_index> <reference name="content"> <block type="mymodule/mymodule" name="mymodule" template="mymodule/m...

python - SqlAlchemy/Sqlite: InterfaceError - is there a data size limit? -

i try store (an admittedly large) blob sqlite database using sqlalchemy. for mcve use ubuntu-14.04.2-desktop-amd64.iso blob want store. size: $ ls -lhubuntu-14.04.2-desktop-amd64.iso ... 996m ... ubuntu-14.04.2-desktop-amd64.iso the code from pathlib import path sqlalchemy import (column, integer, string, blob, create_engine) sqlalchemy.ext.declarative import declarative_base sqlalchemy.orm import sessionmaker sqlite3 import dbapi2 sqlite sa_base = declarative_base() class dbpath(sa_base): __tablename__ = 'file' pk_path = column(integer, primary_key=true) path = column(string) data = column(blob, default=none) def create_session(db_path): db_url = 'sqlite+pysqlite:///{}'.format(db_path) engine = create_engine(db_url, module=sqlite) sa_base.metadata.create_all(engine) session = sessionmaker(bind=engine) return session() if __name__ == '__main__': pth = path('/home/user/downloads/iso/ubuntu-14.04...

xlrd - Python Error:sheet attribute has no column ncolumns -

i learning python on own ,and trying search given text, struck error ,tried google , solve on own of no use. code . import xlrd book = xlrd.open_workbook("tc0132_shooting_information_display(osd_list)_dmhh.xlsm" , "rb") print book.nsheets print book.sheet_names() first_sheet = book.sheet_by_index(0) # print first_sheet.row_values(10) cell = first_sheet.cell(10 ,10) print cell # print cell.value print first_sheet.row_slice(rowx=9,start_colx=2,end_colx=10) in range(first_sheet.nrows): row = first_sheet.row_values(10) j in range (first_sheet.ncolumns): column == first_sheet.column_values(5) if row[column] == search_value: print i,j print 0 thanks in advance. there no such attribute ncolumns: have typo: for j in range (first_sheet.ncols): instead of for j in range (first_sheet.ncolumns):

objective c - How to convert currency in the simplest form in Xcode? -

hello have been making simple app regarding currency conversion. made 2 buttons named convert $ , other convert £. after add number in text field how can show conversion in label have created try this, double curr = [self.mytxtfield.text doublevalue]; double convcurr = curr*(conversion value); [self.mylbl settext:[@(convcurr) stringvalue]];

javascript - angularjs ng-repeat not stopping -

i'm trying use angularjs set multiple links various pages ng-repeat directive so <div class="talks"> <a ng-repeat="talk in talks" ng-href="#/talk/{{ talk.id }}"> <h5>{{ talk.speaker }}</h5> <h4>{{ talk.title }}</h4> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="360px" ng-attr-height="40px" viewbox="0 0 360 40" xml:space="preserve"> <path ng-attr-d="{{ getpathsmall(talk, 'engagement', talk.highest, true, false) }}" stroke="#0bcea7" fill="none" stroke-width="2px" /> <path ng-attr-d="{{ getpathsmall(talk, 'mood', talk.highest, true) }}" stroke="#1486c1" fill="none" stroke-width="2px" /> ...

javascript - How to set a variable in a child process in Node.JS? -

i´m having troubles setting variable in child process node.js. my code passing looks this: parent.js: var spawn = require("child_process").spawn; // run node app.js file argument var child = spawn("node", ["app.js"]); // send data child process via stdin stream child.stdin.setencoding = "utf-8"; child.stdin.write(parsefloat("45.00").tofixed(2)); // listen response child: child.stdout.on("data", function (data) { console.log("got data child: " + data); }); app.js: var temp; process.stdin.setencoding("utf8"); process.stdin.on("readable", function(){ temp = process.stdin.read(); return temp; }); then function in child-process should set variable temp setpoint pid - controll: ctrl.setpoint(readsetpoint()); ctrl.setinput(readinput()); ctrl.compute(); output = parsefloat(ctrl.myoutput).tofixed(2); function readsetpoint(){ return temp; } function readinput...

Double Hyphen/Dash in SQL-Injection. What are they used for? -

i'm learning how sql-injections work. on many teaching-websites there examples shown, such as select fieldlist table field = 'x' , email null; --'; in field 'field' content thats going checked comes textfield or similar website. user-input in case x' , email null; -- use of -- ?? i saw few similar examples no explanation. missing fundamental? ohh nevermind. -- used out-comment rest of query...

javascript - AngularJS + ADAL.JS set Resource ID (Audience) -

how can use adal.js in angularjs bearer token audience https://management.azure.com javascript code? i have created client application in ad , set permissions allow access "windows azure service management api". angularjs code follows: adalservice.init( { instance: "https://login.windows.net/", tenant: "<something>.onmicrosoft.com", clientid: "<some id>", cachelocation: 'localstorage', redirecturi: 'http://localhost:63691/index.html#/configure', endpoints: { /* 'target endpoint called': 'target endpoint's resource id' */ 'https://management.azure.com/subscriptions?api-version=2014-04-01': 'https://management.azure.com/' } }, $httpprovider ); if use token received adalservice in p...

Haskell: Using the same operator on different types in a function -

i'm writing simple interpreter in haskell. have 3 possible variable types: bool , int , string . avoid repetition in evaluating comparisons, i've written function takes 2 expressions , operator: data value = intval integer | stringval string | boolval bool | ... evalcomparison :: ord => exp -> (a -> -> bool) -> exp -> result value evalcomparison expr1 op expr2 = val1 <- evalexp expr1 val2 <- evalexp expr2 return $ boolval $ case (val1, val2) of (intval i1, intval i2) -> op i1 i2 (*) (stringval s1, stringval s2) -> op s1 s2 (**) (boolval b1, boolval b2) -> op b1 b2 (***) otherwise -> error "expected values of same type!" it's intended usage is, example: evalexp :: exp -> result value ... evalexp (elessthen e1 e2) = evalcomparison e1 (<) e2 (and on other comparison operators). the problem - doesn't work. ghc sa...

ios - NSDateComponents to NSDate - Swift -

i have function : private func getcurrentdatecomponent() -> nsdatecomponents { let date = nsdate() let calendar = nscalendar.currentcalendar() let components = calendar.components(.calendarunithour | .calendarunitminute | .calendarunitmonth | .calendarunityear | .calendarunitday, fromdate: date) return components } when call , use function date var d = this.getcurrentdatecomponent().date i don't know why variable d nil... thank help ysee that's how it: let allunits = nscalendarunit(rawvalue: uint.max) return uicalendar.currentcalendar().components(allunits, fromdate: nsdate()) note in swift 2.0 bitwise or operator | not used more, instead nscalendarunit conforms optionsettype format: let timeunits : nscalendarunit = [.hour, .minute, .second]

c++ - nanomsg: Segmentation fault when using cmake -

i'm using nanomsg request/receive , code have works fine when compiled using makefile. when try using cmake, compiles fine runs segmentation fault when trying send message. does know what's going on? i'm unsure if issue in cmake file or in .cc files. here minimal working example. request.cc (its .h file omitted here) requester::requester(const char* url) { int socket = nn_socket(af_sp, nn_req); assert(socket >= 0); assert(nn_connect (socket, url) >= 0); } requester::~requester() { nn_shutdown(socket, 0); } const char* requester::request_for_sentence(const char* sentence){ int size_sentence = strlen(sentence) + 1; int bytes = nn_send(socket, sentence, size_sentence, 0); # segmentation fault occurs here assert(bytes == size_sentence); char *buf = null; bytes = nn_recv(socket, &buf, nn_msg, 0); assert(bytes >= 0); printf("requester received %s\n", buf); return buf; } request_test.cc int main(int argc, char** arg...