Posts

Showing posts from May, 2015

c - How to split a linked-list into two lists -

i'm writing code split circular linked-list 2 linked lists equal number of codes, following code: #include <stdio.h> #include <stdlib.h> typedef struct node *ptr; struct node { int element; ptr prev; ptr next; }; typedef ptr list; typedef ptr position; int main() { list l=malloc(sizeof(struct node)); list first=malloc(sizeof(struct node)); list second=malloc(sizeof(struct node)); splitlist(l,first,second); return 0; } void splitlist(list l, list first,list second) { position p,temp; p=malloc(sizeof(struct node)); temp=malloc(sizeof(struct node)); p=l; int count=0; while ((p)->next != l) { count++; } int c=count; while (c!=(count/2)-1) { p=(p)->next; temp=(p)->next; } first=l; (p)->next=null; second=temp; c=count; while (c!=(count/2)-1) { temp=(temp)->next; } (temp)->next=null; } when compiling code gives no er

javascript - angular-ui select2 breaks data-binding -

i have service stores data single source of truth, controllers can change model making calls service , other controllers synchronized model data. angular.module('fmappapp').factory('categoryservice', function(category) { var catserviceinstance, categories; categories = category.query(); // category ng-resource return catserviceinstance = { getcategories: function() { return categories; }, addcategory: function(category) { categories.push(category) } }; }); it working both in chrome , firefox untill integrated angular-ui select2 module utilize ui-select directive. populate options this: <ui-select-choices refresh="addnewobj($select.search)" refresh-delay="0" repeat="category in categories | filter: {name: $select.search}"> now when add category in 1 controller don't see appear in dropdown list. strangely, in firefox. in chrome works fine. i'd hear explanation , act

android sqlite - Deleting a tuple from Database -

in app there button. when pressed user framelayout added contains textview , samll delete button. whenever user presses delete button tuple should deleted database. m facing problem in this. pressing delete button how come know instance passed delete funtion when adding new view, can set id (or other object) value of view using settag() btn.settag(itemid); then when click on button, tag back, , use it: listener = new onclicklistener() { @override public void onclick(view v) { deletebyid(v.gettag()); } }; read more settag in android's api.

c# - Observable collection not reacting to it's collecion -

my listbox doesn't react observablecollection. this listbox talking about. <listbox x:name="createfieldslist" horizontalalignment="left" height="218" verticalalignment="top" width="244" margin="0,86,0,0" borderbrush="#ffb9b9b9"> <listbox.itemtemplate> <datatemplate> <grid margin="4" width="215" height="32.96" background="white"> <textblock text="{binding name}" fontweight="normal" fontsize="18.667" padding="8,3,0,0" /> </grid> </datatemplate> </listbox.itemtemplate> </listbox> in mainwindow, prepare data binding this priv

mongodb - Mongo error on I control hotfix -

i have tried start mongod.exe 2008 r2 server , im getting error: i control hotfix kb2731284 or later update not installed, zero-out files. i didnt find update or control, have encounter problem? thank you. well, faced same issue. installed fix, saw nothing same error. that's how got on it: create folder structure in c catalog one: c:\data\db. worked me perfectly. use windows 7 x64.

rust - Destructuring a vector (without taking a slice) -

i can destructure vector of tuples taking slice of vector , references items within tuple: let items = vec![("peter".to_string(), 180)]; if let [(ref name, ref age)] = items.as_ref() { println!("{} scored {}", name, age); }; how can destructure vector directly, moving items out of tuple. this: let items = vec![("peter".to_string(), 180)]; if let [(name, age)] = items { println!("{} scored {}", name, age); }; compiling above results in error: src/main.rs:6:12: 6:25 error: mismatched types: expected `collections::vec::vec<(collections::string::string, _)>`, found `&[_]` (expected struct `collections::vec::vec`, found &-ptr) [e0308] src/main.rs:6 if let [(name, age)] = items { ^~~~~~~~~~~~~ you asking 2 disjoint questions @ once: how can move out of vector? how can destructure item? the second easy: let item = ("peter".to_string(), 180); let (name

html - JavaScript event parameter in Firefox -

i have code: function buttonhighlight(event, img, name) { if (img === null) { img = event.target; } img.src = "img/" + name + "_on.png"; img.style.cursor = "pointer"; } function buttonlosthighlight(event, img, name) { if (img === null) { img = event.target; } img.src = "img/" + name + "_off.png"; img.style.cursor = "auto"; } <button type="submit" form="login_form" id="log_window_b" class="fake_button" onclick="loginhandler()"> <img src="img/send_off.png" alt="invia" width="55" height="15" onmouseover="buttonhighlight(event, null, 'send')" onmouseout="buttonlosthighlight(event, null, 'send')"> </button> if try without event parameter in js function , in html event attribute, works fine in chrome, no

sqlite3 - CONDITION ON INSERT -

i have database contain name , properties of 2 different classes of files filled after server send client. that: case when (select count() files_table_1 id="some id") not 0 (update files_table_1 set(...) id="some id") else (insert files_table_2 (...) values(...)) end; but not work. is there way that? thanks! c++ has keyword if situations this: bool ok = query.exec("update ..."); ... if (query.numrowsaffected() == 0) { ok = query.exec("insert ..."); .... }

javascript - Font size of a variable in Form -

how can change font size of variable in html? <form name=pad> .. <script> function rndize() { alpha = "abcdefghijklmno "; (i = 0; < 16; i++) { x = 0; y = 0; while (document.pad.elements[4 * y + x].value != " ") { x = math.floor(math.random() * 4); y = math.floor(math.random() * 4); } document.pad.elements[4 * y + x].value = alpha.substring(i, + 1); } bx = x; = y; } rndize(); </script> .. </form> how can change font size of alphabet? coming normal abcd only. how change size of variable? you can write document.pad.elements[4 * y + x].style.fontsize='12px'; or similar.

sublimetext3 - Sublime Text cppcheck "no lint errors" -

i installed sublime linter, cppcheck sublime linter , cppcheck binaries. i've set cppcheck other linters (for php , javascript) cppcheck not working. in command line says sublimelinter: cppcheck activated: extensions\cppcheck\cppcheck.exe but linter not working. clicking on "show lint errors" gives no lint errors and i'm sure there errors in code. ideas? i've met similar problem described. here's advice: read '.eslintrc' file clearly; try run 'eslint xxx' in terminal , find out if there hints or errors; reopen sublimetext , traverse project find out lint warnings ; click lint warnings found , you'll surprised find lint works. i guess may caused linter's error.

java - C# Windows app read data from streamsocket not comprehensible -

i'm trying realize simple streamsocket-communication between server , client. server written in java , client in c#. to send message (string) client server works fine. other way around have trouble. when send string server client, want, every message printed out client. i initialize streamsocket on client-side follows: public async void startconn() { streamsocket streamsocket = new streamsocket(); try { await streamsocket.connectasync(new windows.networking.hostname(server), port.tostring()); datareader reader = new datareader(streamsocket.inputstream); reader.inputstreamoptions = inputstreamoptions.partial; reader.unicodeencoding = windows.storage.streams.unicodeencoding.utf8; var count = await reader.loadasync(256); while (true) { string text = reader.readstring(count); debug.writeline("message: " + text); count = await reader.loadasync(256); } }

Single code for Tab Key functionality using Enter Key in Vb.Net for a Windows Application -

Image
i write code tab-like behavior when user presses enter on textboxes every form, works fine. if e.keychar = microsoft.visualbasic.chrw(keys.return) sendkeys.send("{tab}") e.handled = true end if however, need write code once, perhaps sub or function in module not have write same every form. have checked various forums including detecting enter keypress on vb.net , tab key functionality using enter key in vb.net either write code each textbox or every individual form. has tried out single code or may several selected forms of application? if yes, please share me. writing every form still works fine me need take advantage of oop. thanks there many ways implement this, 1 of create custom textbox user control adding control project easy right click in project in solution explorer ->add->user control give name control ex. "tabedtextbox" add textbox control user control place code in keypress event of textbox1 of us

c# - Application crashes on changing Application Bar visibility -

i creating panorama application , want custumize application bar, visible single page. have created application bar in xaml: <phone:phoneapplicationpage.applicationbar> <shell:applicationbar x:name="appbar_opere" isvisible="false" ismenuenabled="true" mode="default" opacity="0.95" > <shell:applicationbariconbutton iconuri="/assets/appbar/feature.search.png" text="cauta" /> <shell:applicationbariconbutton iconuri="/assets/appbar1/favs.png" text="favorite" /> <shell:applicationbariconbutton iconuri="/assets/appbar2/feature.settings.png" text="setari" /> <shell:applicationbar.menuitems> <shell:applicationbarmenuitem text="clasa ix-a" /> <shell:applicationbarmenuitem text="clasa x-ea" /> <shell:applicationbarmenuitem text="clasa

ios - National Rail Enquiries issue with SOAP requests. The operation couldn’t be completed. (NSURLErrorDomain error -1012.) -

i'm trying query national rail enquiries using api found below i'm having issues. http://lite.realtime.nationalrail.co.uk/openldbws/ i'm attempting use soapengine64 framework ( https://github.com/priore/soapengine ) simplify process of making requests (using swift) don't seem able results back. every time run following code error printed out. know i'm going wrong? error: 2015-03-28 13:46:09.528 rapid rail uk[18994:1032065] error domain=nsurlerrordomain code=-1012 "the operation couldn’t completed. (nsurlerrordomain error -1012.)" userinfo=0x7fd9a9c35e80 {nserrorfailingurlkey=https://lite.realtime.nationalrail.co.uk/openldbws/wsdl.aspx?ver=2014-02-20, nserrorfailingurlstringkey=https://lite.realtime.nationalrail.co.uk/openldbws/wsdl.aspx?ver=2014-02-20} swift code: var token = "<com:accesstoken><com:tokenvalue>my_token_key</com:tokenvalue></com:accesstoken>" var soap = soapengine() soap.heade

java - JAR execution different from eclispe execution -

i have issue jar execution. have java code finds positions of elements in txt file. when execute on eclispe, works perfectly. however when execute jar file code, returned positions not same. for example: in eclispe have [45,64] , jar gives me [48,67]. do know origin of problem? thanks!

php - Wordpress Get Template part -

going trough wordpress template found template <?php if ( is_home() ) { get_template_part('home', 'featured'); get_template_part('home', 'recent'); } ?> which calls template parts when home page displayed. is there way use same function pages? example domain-name.com/contact ? thanks you can use is_page determine page. example: if ( is_page('contact') ) { get_template_part('home', 'featured'); get_template_part('home', 'recent'); } the parameter function can page id, page title or page slug.

Do not work Google Analytics in Chrome extension -

i have problems including ga.js in extension. please, help. code: manifest included "content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'" analytics.js var _analyticscode = 'ua-xxx';//instead xxx number var _gaq = _gaq || []; _gaq.push(['_setaccount', _analyticscode]); _gaq.push(['_trackpageview']); (function () { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = 'https://ssl.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); this script added in 2 page - popup.html , options.html. on popup right , options page says: refused load script 'data:application/javascript;base64,dmfyihvyy2hpblryywnrzxi9znvuy3rpb24okxt9…jvcmw6znvuy3rpb24obyl7cmv0dxjuig87fsxfdhjhy2tfdmvuddpmdw5jdglvbigpe319fx07&

javascript - Turning hashtags to links in place, in rails -

i trying convert hashtags links within micropost. have implemented gem called simple_hashtag seems work linking aspect of this. however, gem works extracting hashtags post , displaying them in own loop. so, example if micropost was: today went #snowboarding, #awesome the code extract tags done loop, means has done outside of content. <p><%= micropost.content %></p> <ul> <% micropost.hashtags.each |hashtag| %> <li><%= link_to hashtag.name, hashtag_path(hashtag.name) %></li> <% end %> </ul> this leaves finished view looking like: today went #snowboarding, #awesome - snowboarding - awesome is possible have code scan content , replace hashtags links in place? wondering if there way maybe collect hashtags, convert them links , replace them in content? i know can scan content , find hashes using following: <% content = micropost.content %> <

java - HBase Table Design for maintaining hourly visitors count per source -

i working on project have report hourly unique visitors per source. have calculate unique visitors each source each hour. visitors identified unique id. should design calculation of hourly unique visitors efficient considering data of order of 20k entries per 8 hours. at present using sourceid+ visitorid row key. let's start saying 2500k entries per hour pretty low volume of data (not 1/second). unless want scale massively project achievable single sql server. anyway, have 2 options: 1. non-realtime log every visitorid+source , run job (like mapreduce) analyze data every hour, or every day depending on needs. in case can avoid hbase , stick hadoop. can log data different file each hour, process afterwards , store results in sql (or in hbase if wish). performance wise best approach. 2. realtime track data realtime making use of hbase counters, in case i'd consider using 2 tables: table unique_users : track last time visitorid has visited site (rowkey

angularjs - Looks like $http Service takes time to load the contents -

have written service fetch values promise , set values variables in service. retrives promise , sets value variables in service getvaluefrompromise =function(){ mypromise.then(function(res){ myarray =res; console.log("error"); }); } this functionality has been coupled controller in such way returns array this.getitems = function(){ getvaluefrompromise(); //line1 console.log(myarray); //line2 return myarray; //line3 }; my question revolves around getitemsmodule invoke getitempromise() set value variable myarray. question 1: happens in console find myarray [] empty @ while loading ui. once refresh controller, values in myarray[]. suspect because in getitems() promise takes time in evaluating .get('url') , since operation done in asynchronous manner myarray values gets returned before promise evaluated.is suspected right? question 2: if

c# - How to read Json data from Instagram RealTime API updates -

i'm trying use instagram realtime api updates whenever posts image specific tag, i've followed steps, i'm having problems read json data sent callback url. according instagram's documentation : when posts new photo , triggers update of 1 of subscriptions, make post request callback url defined in subscription. post body contains raw text json body update objects. i'm using c# , mvc 5, here's code read "raw text json body", note i'm saving json string in text file. [httppost] public httpstatuscoderesult receive() { string json; using (var reader = new streamreader(request.inputstream)) { json = reader.readtoend(); } file.writealltext(path.combine(server.mappath("~/"), "test.txt"), json); return new httpstatuscoderesult(200); } the problem is, when receive request, file create, empty. there's wrong code? problem instagram's api? i'd appreciate this. foun

sass - foundation-rails and Rails 4 css error -

this question has answer here: sass error compiling zurb foundation !global variable flag 1 answer i'm getting following error after following this: https://railsapps.github.io/rails-foundation.html invalid css after "...ules: $modules ": expected "}", "!global;" (in /home/jetimms/foci/code/ruby/bnr_rubyontheserver/chap31-advanceddatamodeling/nerd_news/app/assets/stylesheets/framework_and_overrides.css.scss:13) /app/assets/stylesheets/framework_and_overrides.css.scss // import css framework @import "foundation"; // override 'home' navigation link .top-bar .name { font-size: rem-calc(13); line-height: 45px; } .top-bar .name { font-weight: normal; color: white; padding: 0 15px; } // these examples can modify // create mixins using foundation classes @mixin twelve-columns { @extend .small-12; @e

cordova - Debug an app runnin of AVD -

i added file-transfer cordova plugin app upload images, test had use avd since can't on browser. the app run correctly on avd ui showing non of function needs make http calls on server works, login, register or upload image. made sure server , running , things working on browser. my question how debug while it's running on avd bring command prompt (windows)/terminal (mac) window , run adb logcat view logcat output of avd in real-time. if want write file, adb logcat > debug.log if avd android 4.4+, can connect chrome developer tools - navigate chrome://inspect/#devices in chrome. can view network activity of avd webview way.

site.php conflict for panel in Kirby CMS -

kirby cms supports non default file structure. http://getkirby.com/docs/advanced/customized-folder-setup when introduce following content site.php file: // changing directory $kirby->roots->content = $kirby->roots()->index() . ds . 'vendor/client-content'; // changing url $kirby->urls->content = $kirby->urls()->index() . '/client/mindfulness-content'; the panel redirects panel\panel\install or panel\panel\login not exist because has unnecessary redirect. pretty copy , pasted docs. if try panel\install or panel\login doesn't try , redirect styles not loaded. if attempt logon produces 'invalid route' exception: /panel/app/panel.php:203 stack trace: #0 /panel/index.php(47): panel->launch() #1 {main} thrown in /panel/app/panel.php on line 203 if leave site.php following happy: <?php $kirby = kirby(); i'm running following php on apache: php 5.4.16 (cli) (built: oct 31 2014 12:59:36) copyright (c) 1997

pinvoke - Determine C# P/Invoke Structure Alignment at Runtime -

i'm trying write p/invoke signatures windows setupapi calls, , i've encountered following problem packing of setupapi's structures: // excerpt setupapi.h #if defined(_win64) #include <pshpack8.h> // assume 8-byte (64-bit) packing throughout #else #include <pshpack1.h> // assume byte packing throughout (32-bit processor) #endif now, means can't set structlayoutattribute.pack property constant value. i tried doing following: [structlayout(layoutkind.sequential, pack = environment.is64bitprocess ? 8 : 1)] public struct sp_devinfo_data { public uint cbsize; public guid classguid; public uint devinst; public intptr reserved; } as expected, fails following compilation error: an attribute argument must constant expression, typeof expression or array creation expression of attribute parameter type i'd avoid #if , setting different compilation platforms, opposed any cpu . can determine packing of c# structure @ run-time?

javascript - HighCharts is slow to load data when building multiple charts -

i have page 2 highcharts on , wondered if there way speed load times charts. first main chart 2 series , second, more of ‘thumbnail’ chart , has 4 series. i populate listbox list of dates , user selects each date make ajax call data. i build charts in constructor … basicmaxchart = function() { options = { chart: {}, /*missed brevity*/, series: [{},{}] }; // options return options; }; // max basicminichart = function() { optionsmini = { chart: {}, /*missed brevity*/, series: [{},{},{},{}] }; // optionsmini return optionsmini; }; // mini my document ready function, // globals var options; var optionsmini; var chart; var chartmini; jquery("document").ready(function() { function createchart() { options = $.extend({}, basicmaxchart options); chart = new highcharts.chart(options); }; function createminichart() { optionsmini = $.extend({}, basicminichart(), optio

PHP Undefined index error with form -

i keep getting error follows when submit form. i'm not sure is. i'm running site on wamp (windows) , im writing in dreamweaver cs6. please note i'm new php. thanks! here code: notice: undefined index: message in s:\wamp\www\latech\contact.php on line 29 <!doctype html> <html> <head> <meta charset="utf-8"> <?php include 'includes/header.php'?> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css"> <title>anise technologys</title> </head> <body> <div class="wrapper"> <?php include 'includes/nav.php'?> <div class="content"> <h1 id="title-center">contact</h1> <?php // check header injections function has_header_injection($str) { return preg_match( "/[\r\n]/", $str ); } if (isset($_post['contact_submit'])) {

opengl - Computing a pixel's specular value? -

i've been looking around internet formula computing's diffuse value of given pixel in raytracer (where ray intersection has occurred of course). the examples found involve multiplying colours other colours. nvidia's formula follows: diffuse = kd x lightcolor x max(n · l, 0) where: - kd material's diffuse color - lightcolor color of incoming diffuse light - n normalized surface normal - l normalized vector toward light source - p point being shaded the formula doesn't seem hard me, when trying program find kd x lightcolour multiplication of 2 rgb values. confusing me as, unless it's case of multiplying both r, g , b values together, there's no way multiply values this. similarly, specular formula requires rgb value raised power equivalent shininess factor of material, again multiplication of 3-component data type itself. this me getting confused maths, if clear it'd appreciated. kd x lightcolour component-wise multiplication:

c++ - How to disable Wmaybe-uninitialized warning -

i want disable "wmaybe-uninitialized" warning. use omnet++ ( base on c++ ) simulate project. there anyway disable warning ? found following code , doesn't work. #pragma gcc diagnostic push #pragma gcc diagnostic ignored "-wunused-variable" #pragma gcc diagnostic ignored "-wmaybe-uninitialized" #pragma gcc diagnostic pop

android - This app is incompatible with your device in play store(Galaxy S5, Only READ_PHONE_STATE Permission) -

Image
i developed simple widget "sim info widget", shows basic information sim state, serial number, operator name etc. for of information need instance of telephonymanager , "android.permission.read_phone_state" permission. when directly run app in phone(samsung galaxy s5/g900i) through eclipse, got installed , running perfectly.(screenshot attached) but when published in google play, says app incompatible device the manifest is <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ragini.siminfowidget" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="9" android:targetsdkversion="21" /> <uses-permission android:name="android.permission.read_phone_state"/> <application android:allowbackup="tr

javascript - Angular JS ng-if an ng-repeat complex match length is greater than given value? -

i have ng-repeat shows table based on 1 loop, , cell based on different loop: <tbody> <tr ng-repeat="r in roles | limitto: 30"> <td>{{r.name}}</td> <td> <span ng-repeat="t in users100 | limitto: r.userlimit" ng-if="t.role == r.name"><a href="{{t.id}}">{{t.full_name}}</a></span> <span ng-if="true"><a href="" ng-click="r.userlimit=500">show all</a></span> </td> </tr> </tbody> each row role, first cell shows role's name. second cell shows results different dataset role in set matches original set's role value. (it repeats span each match r.userlimit , set in json @ 20) the tag has click sets value of r.userlimit 500, shows users. my question is, want show link if number of matches initial repeater greater value of r.userlimit (20) so thought ng-if="((t.

nsmutablearray - Interpreting a data stream in objective c -

i getting stream live feed. looks mutablearray: "columbia heights", e04, "cleveland park", a05 the first line name , second station code. i need turn dictionary plist compliant. so result in mind this: name: "columbia heights", code: e04, name: "cleveland park", code: a05 what i've written far this: nsmutabledictionary *stationdict = [nsmutabledictionary dictionarywithobjectsandkeys:@"name",@"name",@"code",@"code", nil]; int = 0; (i=0; < counter; i++) { // names , codes each of 3 fave stations //[stationarray addobject:[mutablefavearray objectatindex:i]]; nsstring *tempname = [mutablefavearray[i] valueforkey:@"name"]; nsstring *tempcode = [mutablefavearray[i] valueforkey:@"code"]; [stationdict setobject:tempname forkey:@"name"]; [stationdict setobject:tem

javascript - prevent a function running multiple times after calling it again from ajax -

i have been struggling find solution problem long time. (and have googled many times). i'm trying avoid same function running multiple times when recall after ajax call. i'll give simple example using following code: i load list of users db using php: while(some loop){ $users.=' <div> <div>user name</div> <div class="replace">replace user</div> <div class="delete">delete user</div> </div> '; } and display them inside div: <div class="user_wrap"> <?php echo $users; ?> <div id="add_user"></div> </div> now on front end can delete or replace each user or add new user div run 3 functions on document ready: $(document).ready(function(){ adduser(); deleteuser(); replaceuser(); }); function adduser(){ $("#add_user").on("click",function(){

c++ - Box2d cpp gives : box2d expression area > 1.1 exception -

Image
i have strange error : #define ptm_ratio 32 // shape b2polygonshape axleshape; axleshape.setasbox(20/ptm_ratio,20/ptm_ratio); // fixture b2fixturedef axlefixture; axlefixture.density=0.5; axlefixture.friction=3; axlefixture.restitution=0.3; axlefixture.shape=&axleshape; axlefixture.filter.groupindex=-1; // body definition b2bodydef axlebodydef; axlebodydef.type=b2_dynamicbody; // rear axle axlebodydef.position.set(m_cart->getworldcenter().x-(60/ptm_ratio),m_cart->getworldcenter().y+(65/ptm_ratio)); b2body* rearaxle =m_world->createbody(&axlebodydef); rearaxle->createfixture(&axlefixture); // front axle axlebodydef.position.set(m_cart->getworldcenter().x+(75/ptm_ratio),m_cart->getworldcenter().y+(65/ptm_ratio)); b2body* fronta

Check if a char is a digit? (in C) -

note newbie i've used isdigit() function before, have issue: i need check if (for example) char value -46 digit. isdigit() doesn`t seem recognize negative numbers (probably because of - before actual number). is there simple line of code can have same effect isdigit() function, detects negative numbers well? (like ascii table range or something) let me clarify myself further: have char type array: char a[20] enter each value manually (example): a[0]= a[1]= b a[2]= -46 now 3 (ignore remaining 17 - example), need check if of digit. -46 number i`m searching (to put in array), question how check if -46 "is digit"? the trick isdigit function not take argument of type char . quoting standard ( n1570 7.4p1: the header <ctype.h> declares several functions useful classifying , mapping characters. in cases argument int , value of shall representable unsigned char or shall equal value of macro eof . if argument has other value, be

matrix - MATLAB Naive Bayes object storing -

after using: nb = naivebayes.fit(training, class) to create naive bayes classifier object, want save n-by-d of these objects in matrix. have tried following arrayofnaivebayes(2,3) = nb; but get: "error using naivebayes/subsasgn (line 9) naivebayes class not support subscripted assignments." how possible fill matrix of naive bayes classifiers in matlab? note using fitnaivebayes or fitcnb resuts in same problem both return same kind of object. thank you try use cell array. first, initialize cell array. if numbers of elements want store, e.g. n x d , use arrayofnaivebayes = cell(n,d); if not know size beforehand, can start empty cell array: arrayofnaivebayes = {}; then if later have generated classifier object nb , want store under indices (2, 3), use arrayofnaivebayes{2,3} = nb; to access value later, use same syntax arrayofnaivebayes{2,3} . for more information, see matlab's documentation of cell arrays .

Ruby PDF Reader Stack Smashing Detection -

i using default ruby pdf::reader , using imagemagick extract images out of pdf . getting error while trying read pdf saying stack smashing attack detected. how can fix pdf not trip error while reading it. pdf-reader pure ruby library, it's unlikely root cause. how using imagemagick? if you're using compiled rubygem, them possibly has bug. there few options using imagemagick ruby, try 1 of alternatives. can provide simplest script possible triggers issue , copy of exact error message?

url rewriting - URL rewrite in IIS 8.5 is not working I'm getting 404 instead -

Image
hi i've configured rewrite rule on iis seems never gets fired i've been working on several hours without luck rule in web config of appplication: <rewrite> <rules> <rule name="rewrite frienly url snapshot" stopprocessing="true"> <match url="/(localhost:2934)\/trabajos\/([\w-]+)\/([\w-|\-]+)" /> <action type="rewrite" url="\/snapshots/{r:2}.html" logrewrittenurl="true" /> </rule> </rules> </rewrite> my url following: http://localhost:2934/trabajos/3ba2a9e4/some-cool-title ' and want rewrite as: http://localhost:2934/snapshots/3ba2a9e4.html this result testing pattern in iis: to me seems ok but when testing url in browser, feel rule never gets fired, in fact, i've configured trace failed request this tutorial , don't error or file in logs folder. ex: c:\inetpub\logs\failedreqlogfile

c# - WCF Subscriber to Azure SB with multiple operations -

i trying make wcf service both publishes messages topic , subscribes topic. idea have service expose endpoints managing customer (i.e. createcustomer, editcustomer, deletecustomer, etc). want publish message topic after completes each operation (i.e. oncustomercreated, oncustomerchanged, oncustomerdeleted, etc.) for example, client application hit editcustomer message on service. publish oncustomerchanged message customer object provided. service (the same 1 customer hit) have contract takes oncustomerchanged , updates database. my question is, have make separate subscription on topic each message type (i.e. oncustomerchangedsubscription, oncustomerdeletedsubscription, etc.) can route messages of different types correct endpoint? if case, need bunch of single-method contracts configure wcf endpoints properly: i.e: <service name="site.services.business.managers.customermanager"> <!-- endpoint clients hit --> <endpoint address="" b

iOS app exits after Google signin -

my app worked fine in development straight computer device. when using testflight/other deployment services, able sign google account (required app's functionality). however, in production environment, app closed once returned google. when reopening it, signed in, still closed within second or two. able move switch before then, indicates app wasn't frozen. device console says app exited voluntarily.

neo4j - Same Cypher Query has different performance on different DBs -

i have fulldb, (a graph clustered country) contains countries , have various single country test dbs contain same schema 1 given country. my query's "start" node, identified via match on given value property e.g match (country:country{name:"uk"}) and proceeds main query defined variable country. expecting query times similar given starting same known node , traversing same number of nodes related in both dbs. but getting difference performance query if run in full db or single country. i thought must have kind of "cartesian relationship" issue going on profiled query in full db , single country db profile same each step in plan. assuming profile reveal marked increase in db hits @ point in plan, values same. mistaken in profile displaying? some sizing: fulldb have 70k nodes, test db 672 nodes, time in full db query complete 218764ms while test db circa 3407ms. while writing realised there increase in number of outgoing relationships

jquery - text shadow on off with a fade -

i have text, , text shadow applied it. want behave "on/off". css: a.playnowanchor.glow { text-shadow: 1px 0px 20px #fff; } html: <a href="#" class="playnowanchor">play now</a> i have achieved effect jquery: setinterval(function() { $('a.playnowanchor').toggleclass('glow'); }, 400); and works fine, transition happen well. can done somehow css, because not know way jquery? you can use css animation achieve this. for repetition include infinite in animation example: body {background:salmon} /* testing purpose */ a.playnowanchor { -webkit-animation: animate .6s infinite; -moz-animation: animate .6s infinite; animation: animate .6s infinite; } /* keyframes */ @-webkit-keyframes animate{ 0% {text-shadow: none;} 50% {text-shadow: 1px 0px 20px #fff;} 100% {text-shadow: none;} } @-moz-keyframes animate{ 0% {text-shadow: none;} 50% {text

Multiline strings concatenation in Java -

i'm looking help. easiest way concatenate multiline strings in java , print after ? for example : i've got 2 strings : string turtle1 = " _\r\n .-./*)\r\n _/___\\/\r\n u u\r"; string turtle2 = " _\r\n .-./*)\r\n _/___\\/\r\n u u\r"; and want result in java eclipse console : _ _ .-./*) .-./*) _/___\/ _/___\/ u u u u i've try algorithms divide strings in differents parts , after re-concatenate it. without success. know there stringbuffer class , stringbuilder class after research, didn't found correspond need. thanks in advance help. not pretty works: string turtle1 = " _\r\n .-./*)\r\n _/___\\/\r\n u u\r\n"; string turtle2 = " _\r\n .-./*)\r\n _/___\\/\r\n u u\r\n"; string[] turtle1lines = turtle1.split("\r\n"); string[] turtle2lines = turtle2.split("\r\n"); stri

asynchronous - Java play framework Async operation on same object -

i'm trying perform async operations on same object example pass list promise perform concurrently 3 queries each query when finishes adds queried results list , http result returns full list when concurrent queries results finish. having @ tutorial: https://www.playframework.com/documentation/2.2.x/javaasync i make return async( promise(new function0<integer>() { public integer apply() { firstquery(); } }) . promise(new function0<integer>() { public integer apply() { return secondquery(); } }) .map(new function<integer,result>() { public result apply(integer i) { logger.debug("we have got "+i); return ok("got " + i); } }) ); to make 2 operations work concurrently , neither

java - Null Pointer Exception within Android Studio -

this question has answer here: null pointer exception - findviewbyid() 9 answers new android here. looked through other answers, still couldn't figure out wrong... hoping here. :) android studio says there null object reference @ line 28 login.setonclick... line. again, sorry if code mess, kinda winging it! thanks in advance! public class loginscreen extends actionbaractivity { // edittext medit; // textview mtext; private static string artist = "artist"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login_screen); button login = (button) findviewbyid(r.id.button1); final edittext user = (edittext) findviewbyid(r.id.username); login.setonclicklistener(new view.onclicklistener() { @over