Posts

Showing posts from March, 2014

c++ - CAsyncSocket::Create fails in CWinThread::Initinstance but works in Constructor -

i have casynsocket derived class in cwinthread derived class i use new , create create suspended create cwinthread in cwinthread::initintance i try casyncsocket::create program goes "south" code totally leaves initinstance when move code cwinthread constructor works i'm baffeled thanks

sockets - recv() function returns -1 -

this (-1) not on fail return code list. things going on this, on wp8.1 sl project, i'm calling set of socket functions on native dll. wsastartup() succeeed, gethostbyname() succeed, create socket , connect() succeed, send() succeed, but recv() failed, , returns -1 all functions works on emulator, recv() returns -1 on device. did of have idea why? :-p ps: there's no problem when called in lib on wp8.1 wrt. later need use wp8.1 sl, build dll. :-p ok, fixed it. because didn't setup wifi on phone.

java - how to use parameterized junit when input is from several files? -

i used use parameterized junit. i have 2 files long list in each of them. say file_a file_b i loaded 2 big lists memory , compared each line in different test. unfortunately list grew big , had memory problem parse parse json before saving file. that's why split each long list smaller files. say file_a_1 file_a_2 file_a_3 and file_b_1 file_b_2 file_b_3 how can still use parameterized junit infra , syntax compare each corresponding list items, when each list distributed few files? i have tried: @test public void comparenewresponsetobaselinereturnsnolargedifferences() throws ioexception { e2eresultshort baselinelist = routingresponseshortrepository.getbaseline(chunkid); e2eresultshort freshrunlist = routingresponseshortrepository.getlatestresponse(chunkid); ??? how iterate on differet `i` each test ?? list<string> testfailuremessages = alternativeshorttotalchecker.checkallalternativesshort(baseline.get(i), freshrun.

Simple example to post to a Facebook fan page via PHP? -

i've done lot of searching , i've found outdated tutorials don't work... i have site made php , when submit particular form in admin area, want publish facebook "fan page" there no rss available, have example directly post facebook fan page (not user wall) using php sdk? thank you! finally, after lot of tests, worked, without php sdk. step step guide: 1. permissions , page token go https://developers.facebook.com/tools/explorer/ , select app first drop down menu, in left. click on button "get access token", , in "select permissions" window, click in "extended permissions" , check manage_pages , publish_stream, , click in "get access token" blue button. you may asked in step grant permissions app access facebook account, accept. next, click @ end of text field next "get" drop down, , replace numbers for: me/accounts, , click in blue button next text field. you'll tokens pages, in

php - Need help structuring database for nested navigation -

i want create nested navigation menu/navigation, via database(sqlite), using pdo (in end should work dropdown menu). i've been googling around, , looked @ different posts in here. still don't know how properly. need database structuring advice, , maybe example. know might lot ask, thought i'd try anyway. writing secondary sub-menu nested under first sub-menu within delphi in html easy enough, need pdo methods , functions like: query_select , query_update the basic logic code is: make links , tables place them in unordered list insert "web" a key factor code whether you're designing mobile or desktop? for structuring examples, consider file i/o functions when performing sql query, when import occurs consider loop structure based on db. hth- cd

drupal 7 - Activate view automatically in a page -

i wonder how can create view , activate @ given time automatically see on particular page , option in administrator ativate it. maybe use nodequeue ? thanks i having little trouble understanding mean, let me put in starting points. views ui submodule allows go /admin/structure/views , see list of views, , enable/disable each right there. disabling module on production sites recommended, few developers because annoying have turn on , off when want make little adjustments. as far "at given time automatically see on particular page" sounds want panels, context, , make views panel displays. allow use 1 particular page (the url registered panel) has created views on it, perhaps selections rules change ones visible depending on looking or whatever other trigger want. now details comment: sounds want taxonomy vocab set tag style, user can add terms it. taxonomy has pages each term, lists nodes have term. improve view uses context filter find term , related

Iterating through two separate panda data frames via for loop in python? -

i have 2 panda data frames: df1 df2 1 5 4 4 3 2 i want create list such data frames concatenated colon: 1:5, 4:4, 3:2 help previous question shows can do: ["{}:{}".format(a, a) in df1] which makes list 1:1, 4:4, 3:3, how do this: ["{}:{}".format(a, b) a, b in df1, df2] to create desired result above? something this? df1 = pd.dataframe({"df1":[1,4,3]}) df2 = pd.dataframe({"df2":[5,4,2]}) ["{}:{}".format(a, b) a, b in zip(df1.df1, df2.df2)] ['1:5', '4:4', '3:2']

c++ - Check function going into infinite loop and segmentation fault -

void inputstatisticaldata() { //variables declaration cout << "\n[here take in data]" << endl; //cin data while (exit == false) { cout << "entered loop" << endl;//for troubleshooting purpose cout << "countcheck: " << countcheck << endl;//for troubleshooting purpose if (!vector.empty()) { cout << "entered vector check if" << endl;//for troubleshooting purpose if (condition)//checks if data has duplicates { cout << "\ndata exist, please enter new set of data." << endl; break; } else { cout << "entered countcheck++" << endl;//for troubleshooting purpose countcheck++; } } else { //stores data exit

Reorder String based on Specified Character in Python -

i'm looking way in python change, example, string "main st & 1st st" string "1st st & main st". i know effect of: intersection = "main st & 1st st" intersectionlist = intersection.split(" & ") reversedintersection = (" & ".join(intersectionlist[::-1])).strip() but seems needlessly multi-stepped , wondering if there more efficient method, built-in method, etc... accomplish same goal better. i don't think way multi-stepped. shortest way can find describe want is: take string split @ ampersands reverse substrings write down substrings, separating them ampersands that's code does. if want code more compact, can leave .strip() @ end since isn't useful , rewrite 2nd , 3rd lines this: reversedintersection = (" & ".join(intersection.split(" & ")[::-1])) i don't know of built-in method this, since can code same work takes describe , isn't com

Svn hook script email body html formatting -

i have below script sends email whenever developer commits svn repository. mail body includes name of file plus changes developer has added , removed. i want additions blue , removals red, color formatting not working. folks can please advise has been long time , stuck solution #!/usr/bin/ruby -w # subversion post-commit hook. edit configurable stuff below, , # copy repository's hooks/ directory "post-commit". don't # forget "chmod a+x post-commit". # ------------------------------------------------------------------------ # *will* need change these. address="foo@some_domain.com" sendmail="/usr/sbin/sendmail" svnlook="/usr/bin/svnlook" # ------------------------------------------------------------------------ require 'cgi' # subversion's commit-email.pl suggests svnlook might create files. dir.chdir("/tmp") # revision in repository? repo = argv.shift() rev = argv.shift() # overview infor

PHP: Finding duplicates in multidimensional arrays and echo'ing the result -

i've been stuck little while , can find on internet how remove duplicates. i'm new php simple answers appreciated. so let's have multidimensional array of surnames, addresses, time of accidents , reason of accidents so: array( array( 'adams','king street 12','14:25','heart attack' ), array( 'ellis','vine street 4','02:48','broken leg' ), array( 'adams','parker street 43','20:10','heart attack' ) ) and need find entries have had same accident more once, of short array, output should this: adams king street 12 14:25 heart attack adams parker street 43 20:10 heart attack i tried $answer = array_unique(array_diff_assoc($whole_ar, array_unique( $whole_ar))); doesn't seem work on multidimensional arrays. i guess have in steps firstly need php5.5 or higher put array_column() on each key $myarray = array(

osx - How do I import and symbolicate a crash report on this Xcode 6.3.1? -

how import crashes log on xcode 6.3? have 0 crashes on apple servers apps, or programmer genius , apps have 0 crashes or not working on xcode (surprise!). anyway, customer sent me crash log 1 of apps mac, don't see how crash log can imported on new amazing xcode 6.3? any clues? this solved me: if plug in /any/ device select device in devices window , click view device logs, should able drag crash report resulting sheet. https://forums.developer.apple.com/thread/11473

Can't get JetBrains License Server to run when deployed to existing Apache Tomcat instance -

unfortunately, jetbrains not have place report issues license server, i'm having ask here last resort. can me! i trying jetbrains license server installed on ubuntu 14.04. instructions i've been following here . far, i've successfully: installed oracle java 8 webupd8team using apt installed apache tomcat 7 using apt configured java_home environment variable creating /usr/share/tomcat7/bin/setenv.sh recommended tomcat documentation ran sudo chmod +x setenv.sh ensure script executable deployed licenseserver.war /var/lib/tomcat7/webapps verified war file unpacked correctly when tomcat starts however, when @ tomcat's logs, see lots of java exceptions appear permissions-related have no idea how resolve them. here sampling of exceptions appear in catalina.out : error pluginmanagerimpl - error while configuring logging java.io.filenotfoundexception: /usr/share/tomcat7/logs/jetbrains-license-server/cfc7082d-ae43-4978-a2a2-46feb1679405.log (no such file or

c# - Same MDI Form for nested forms -

i have mdi form (main software form "form_main" ) has menustrip. clicking menu open search form "form_search" using following code: // main form form_search frm = new form_search(); frm.mdiparent = this; frm.show(); when user selects desired result, details form "form_details" should opened show information of selected result. opening details done using following code: // search form form_details frm_det = new form_details(selectedid); frm_det.show(); but details form "form_details" out of mdi space. my question how can open details form "form_details" search form "form_search" still under mdi form "form_main" thanks or suggestions you need set mdi parent of new form same, main parent: form_details frm_det = new form_details(selectedid); frm_det.mdiparent = this.mdiparent; frm_det.show();

php - count click on link class on posts and add it to custom field -

i have 4 links on each of posts (facebook, twitter, etc ...), i'm trying do, everytime click on 1 of link, i'll have counter incremented, , store reslut in custom field associated posts. this way i'll abble display on each of posts number of clicks, , sort posts depending of clicks. i know how count php, don't know how store , update custom field everytime user clicks, , associate custom field. can me ? thanks lot help, create field in post table called views. in post page add-in 'update' query takes current value of posts.views , increments one. simple.

data visualization - Drawing a moving average-style line representing the amount of quota left (R graph drawing) -

Image
2nd edit realise revised code close, not quite there; should reasonably calculate remaining daily average where have data , not continually increase until end of month (i.e. should horizontal after 20th). edit : i've worked out how include "daily average remaining" (after googling found "within"). i'm struggling getting line draw. new code: library("ggplot2") library("sitools") host=c("red", "blue", "green") finish=as.date("2015-04-30") start=as.date("2015-04-01") date=rep(seq(start, finish, "days"), each=3) bytes=c(sample(1e7:2e8, 60), rep(0, 30)) download = data.frame(bytes, date, host) download=within(download, days_remain <- as.numeric((finish - date), units="days")) download=within(download, avg_remain <- ((8e9 - cumsum(bytes))/days_remain)) ggplot(download, aes(x = date, y = bytes, fill = host)) + plot(download$date, download$avg_remain) + geom_are

meteor - Template.body vs Template.myTemplate -

i going through meteor tutorial ( https://www.meteor.com/try ), , have come across templates puzzles me. in tutorial, simple "todo list" application gets created. in app, following html placed simple-todos.html file: <!-- simple-todos.html --> <head> <title>todo list</title> </head> <body> <div class="container"> <header> <h1>todo list</h1> </header> <ul> {{#each tasks}} {{> task}} {{/each}} </ul> </div> </body> <template name="task"> <li>{{text}}</li> </template> then, following javascript placed simple-todos.js file: // simple-todos.js tasks = new mongo.collection("tasks"); if (meteor.isclient) { // code runs on client template.body.helpers({ tasks: function () { return tasks.find({}); } }); } at point, example works intended. however, poke

javascript - Match two string patterns at the same time with regex for removal -

a quick question string manipulation in javascript. i have files named pattern: content_filename content_big_filename the filename in variable, cannot take last 8 chars. need extract filename. now i'm using string.replace( /\/content_/, '' ) need support content_big. how should go this? if it's last part after underscore, split , pop str.split('_').pop(); document.body.innerhtml += "content_filename1".split('_').pop() + '<br>'; document.body.innerhtml += "content_big_filename2".split('_').pop()

Android java : null context in a class that extend Application -

i have class extending application. when try context of class either using "getapplicationcontext" or using "getbasecontext", context allways null. i need context use "getsharedpreferences". the error printed : caused by: java.lang.nullpointerexception @ android.content.contextwrapper.getapplicationcontext(contextwrapper.java:109) what doing wrong or other ways can use "getsharedpreferences" without context (if possible) ? thanks help. edit code : i'm initializing class "deviceinfo" in main class. class "deviceinfo" extends application. in it's constructor tried : protected deviceinfo() { context = getapplicationcontext(); } wich gives me same error mentioned earlier. and here main line causing me trouble... sharedpreferences key = getapplicationcontext().getsharedpreferences("keys", context.mode_private); final edit : all, took inputs , realized wasn

javascript - How can I replace an object in array that is displayed using ng-repeat? -

i have array of items displayed in table using ng-repeat. when click on item, item pulled server , table should updated updated item. function updated item when clicking on item in table: $scope.getupdateditem = function(item){ itemservice.getitem(item).then( function(updateditem){ item = updateditem; }, function(error){ //handle error } ); }; i'm displaying items using: <tr ng-repeat="item in myitems"> the problem: item in table never updated. what's best way update item in ng-repeat? can use "track $index" in ng-repeat this? or have iterate on myitems find item want replace? update: a possible solution instead of using item = updateditem, to use: var index = $scope.myitems.indexof(item); $scope.myitems[index] = updateitem; however, feel there should "cleaner" way of doing this. there isn't cleaner way (then update). noticed, when change

Allowing quotes in search term solrnet -

i've come across problem when users trying search terms multiple works wrapped in quotes. i'm using solrnet query solr. for example, if user searches "fertilizer", correct results. searching "fertilizer report" brings no results. the code can see queries solr shown below, term search term, , qo query options contain start point , number of rows. _solr.query(string.isnullorempty(term) ? solrquery.all : new solrquery(term), qo); i've had @ article online, see here mention using quoted , correct way go doing this? or should configured in schema/solr config files? update 1 further mauricio's comment, i've added part of solr config xml below shows how i'm using dismax: <requesthandler name="select" class="solr.searchhandler" default="true"> <lst name="defaults"> <str name="deftype">edismax</str> <int name="rows">10</int> <

html - Picture show text on hover as "rollover" -

i want make "roll on text" when hover image container. i did fine, position absolute, cant right position relative. now text comes after image need text small overlay bottom of image <div class="ce_image team block"> <figure class="image_container"> <img src="assets/images/c/de****-d1-6a7e730c.jpg" width="300" height="300" alt=""> <figcaption class="caption" style="width:300px">the text want display on hover</figcaption> </figure> </div> css: (ps: quess css bad, never made smth this) .image_container { position: relative; display: inline-block; padding: 0.75em; border: 1px solid #b2b9c4; border-radius: 2px; background: #ffffff; background-image: -webkit-linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.02)); background-image: -moz-linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0

java - AsyncTask with HTTP get and fetch of .xml -

i developing android app clicking on buttons control digital state of arduino board. arduino responses xml file created during runtime and, fetching contents, i'd display state of pins. now, realize in fact app works can't handle fetchxml() method in asynctask instance. ui freezes , don't want that. this code of main activity: public class mainactivity extends actionbaractivity { private string url = "http://192.168.0.254/?domotica"; private edittext button1,button2,button3,button4; private handlexml obj; @override protected void oncreate(bundle savedinstancestate) { /* if (android.os.build.version.sdk_int > 9) { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy); } */ super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button1 = (edittext)findviewbyid(r.id.edittext1); button2 = (edittext)findviewbyid(r.i

playframework - Play 2 framework Internationalization not working in if statement -

i working play 2.3.8. in views, of internationalized messages not displayed. i suspect bug in play? code @play.i18n.messages.get("calendar.level.0.criterias.title") works outside of if statement, not inside. happening? can not use scala variables within scala code? here code: @if (user == null) { <p style="padding-bottom: 0px;">@play.i18n.messages.get("calendar.level.0.criterias.title")</p> }

p4v - How to disable/deactivate/archive branches in Perforce -

i have few applications on perforce , each application has few branches. right latest branch in actual use, old ones there backtracking , debugging purposes. is there way can disable old branches no 1 can branch/use them? removing permissions them best option. since want them remain accessible historical reference, not permit new changes, you'll want remove "write" level of permission leave "read" level: write user * * -//depot/oldbranch/... read user * * //depot/oldbranch/... if groups have permissions these branches in first place you'd need careful of placement of lines make sure don't accidentally grant "read" permission other groups; might mean doing more like: write group * * -//depot/oldbranch/... read group dev * //depot/oldbranch/... or use "=write" syntax instead: =write group * * -//depot/oldbranch/... you can use "=branch" prevent old branch being used source new branches (the &q

oracle - Before update trigger is not creating history for null values -

my before update trigger not creating history changing null value other value. creating history changing other values. main logic this: if nvl(:old.place,null) <> nvl(:new.place,null) insert table (place) values(:old.place) end if; the nvl() function used substitute value in place of null. you're replacing null with... null, pointless. you're trying compare 2 null values (in)equality operator, , null neither equal or not equal including itself, result unknown, , condition false if either old or new value null. you use fixed dummy value know never exit: if nvl(:old.place,'**fake**') <> nvl(:new.place,'**fake**') but clarity i'd prefer explicitly test nulls: if (:old.place null , :new.place not null) or (:old.place not null , :new.place null) or (:old.place != :new.place)

Which maven repositories are checked for my dependencies when using gradle? -

i have gradle project has 2 maven repositories configured. 1 of them nexus repository somewhere on network , requires authentication. other local maven repository resides within project directory structure. the build should first check if maven user has access nexus repository , if not should check local repository see if can resolve dependencies there. reading documentation here ordered repositories remote nexus listed first. think documentation states repositories checked in order. mean tries remote location first , if finds match, we're done. if doesn't find match, move on next repository. are expectations correct? i've configured repositories follows: repositories { maven { url "http://nexus/content/groups/restricted_group" credentials { username user password user } } maven { url "${rootproject.projectdir}/libs" } }

scala - How to change RowMatrix into Array in Spark or export it as a CSV? -

i've got code in scala: val mat: coordinatematrix = new coordinatematrix(data) val rowmatrix: rowmatrix = mat.torowmatrix() val svd: singularvaluedecomposition[rowmatrix, matrix] = rowmatrix.computesvd(100, computeu = true) val u: rowmatrix = svd.u // u factor rowmatrix. val s: vector = svd.s // singular values stored in local dense vector. val v: matrix = svd.v // v factor local dense matrix. val uarray: array[double] = u.toarray // doesn't work, because there not toarray function in rowmatrix type val sarray: array[double] = s.toarray // works val varray: array[double] = v.toarray // works how can change u uarray or similar type, printed out csv file? that's basic operation, here have considering u rowmatrix following : val u = svd.u rows() rowmatrix method allows rdd rowmatrix row. you'll need apply rows on rowmatrix , map rdd[vector] create array concatenate string creating rdd[string]. val rdd = u.rows.map( x => x.toarray.mkstr

recursion - Finding complexity of backtracking recursive algorithm -

i have recursive algorithm: #include <iostream> #include <cmath> #include <map> #include <iterator> #define n 8 using namespace std; void putintoboard(int a, int b, int board[][n]); bool isfull(int board[][n]); void cleanboard(int board[][n]); void bishopsolver(int level, int i, int board[][n]); void putintoarray(int a, int b); void printout(); map<int, int> coordmap; int main(){ int board [n][n]= {0}; int count= 0; int level; int i; bishopsolver(0,0,board); return 0; } void printout(){ (map<int,int>::iterator = coordmap.begin(); != coordmap.end(); ++it) { int value = it->second; int y = value / 8; int x = value - y * 8; cout<<"("<<x<<";"<<y<<"), "; x=x+1; if ((x) == 7) x=0; cout<<"("<<x<<":"<<y<<"), "<<endl; } } v

javascript - AJAX success:function always returning success (and 200 status code), error function not triggering -

i'm bit of beginner when comes ajax calls apologies in advance because i'm stuck , have no idea why! in summary, have own server displaying log in page. using router determining whether or not details entered in form correct user proceed homepage. log in button linked ajax whereby add event handler [should] displays alert boxes based on outcome of check in router. so.. problem displaying correct alert boxes each response. 'success' alert box displaying status code of 200. code error:function not being reached. i have router file serve pages , deal log in check, js file containing correct combinations of log in credentials, login html page , login js file. using javascript , ajax , google chrome debugging. of code think need question below. please ask if require more. login check on router: app.post('/api/login/', function (req, res) { console.log(req.body); var emaillog = req.body.email; var passwordlog = req.body.pa

javascript - Grab `this` from caller function object -

i have some code i'm invoking everywhere this. screenshot.snap(this, $('.navbar-inner .container')); in above code, this object being passed in mocha.js. contains information current test name, file it's in, etc. use information name screenshot. i want remove need pass in this reference everywhere, no matter how try reach inside of snap function, unable find information need. var testcontext = exports.snap.caller; //.prototype? .this? i have inspected exports.snap.caller.tostring() , , function called in mocha test suite. did through debugging repl, , on further inspection see information can the properties of function instance , contains nothing calling function's this . is there way this, or stuck passing in this argument every time call screenshot.snap function? you might able in before block like: var snap; before(function () { browser.get('https://angularjs.org'); snap = screenshot.snap.bind(this); }); and rep

python - Getting lat/long coordinates from identified tweets using tweepy; getting KeyError: 'coordinates' -

i'm trying lat/long coordinates identified tweets. part having trouble if decoded['coordinates']!=none: t.write(str(decoded['coordinates']['coordinates']) block. don't know if it's working or not because ~150 tweets returned coordinates [none] before error returned, believe error comes when tweet coordinates found, , returns keyerror: 'coordinates' . the following code: import tweepy import json htmlparser import htmlparser import os consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' # listener, resposible receiving data class stdoutlistener(tweepy.streamlistener): def on_data(self, data): # twitter returns data in json format - need decode first decoded = json.loads(htmlparser().unescape(data)) os.chdir('/home/scott/810py/project') t = open('hashtaghipster.txt','a') # also, convert utf-8 ascii igno

Passing a value into a class to be used when the class is instantiated in Swift -

when creating instance of custom class, want pass value class declaration, used when it's instantiated. i tried doing through property, doesn't work. correct way achieve this? (apologies if i'm not wording question quite right, code below makes question clear.) class hello { let indexinarray: int! override init(frame: cgrect) { super.init(frame: frame) println("this hello number \(indexinarray).") } } index in 0..<4 { let singlehello = hello() singlehello.indexinarray = index } the desired output: // hello number 0. // hello number 1. // hello number 2. // hello number 3. if understand question correctly, you're after: class hello : hellosuperclass { // note - no longer has declared implicitly unwrapped optional. let index: int // create new designated initialiser takes frame , index arguments. init(frame: cgrect, index: int) { self.index = index super.init(frame:

python - wsgi: video in response does not play -

Image
i have simple wsgi module: def application(environ, start_response): start_response('200 ok', [('content-type', 'text/html')]) return ["here video: <video controls autoplay><source src='path-to-video/video.mp4' type='video/mp4' /></video>"] i have video on machine , fine: if open in browser plays. wsgi, not. video there (from inspect elements), except it's black box , not play. screenshot attached: what's wrong? i'm thinking path incorrect. when opening html file, browser knows open local file. path in html treated local path on computer. guess path should /home/username/myvideo/1.mp4 . broswer finds file , play it. when using wsgi, sending request server (localhost, assume). in case, path used against server root path (localhost://). browser attempt file on localhost://home/username/myvideo/1.mp4 , will, of course, fail. that's why video won't play.

c# - How can I create a WPF data grid with an enhanced table header? -

Image
i'm working on wpf based data management system, planned replace old excel based one. old system consist of tables user can input data. 1 of these tables looks this: the number of rows , columns fixed (25 rows per day, 6am 6am next day). it kinda difficult provide input form kind of data, tried implementing table in wpf using datagrid. however, wasn't able these nifty merged cells, in first , second row. are there 'datagrid' usercontrols on market allow merging cells, shading rows etc.? or there other way of providing user-friendly input form i've overlooked? if you're looking grid cell merging tool can try devexpress . here link on how merge datagrid cells using devexpress another solution merge datagrid rows use listbox

java login/logout on localhost -

this desktop application uses jdbc:mysql://localhost/ database. long story short, i`m trying do: ask credentials ( username/password ). compare mysql database match ( true/false ). if true → load workspace, implements data mysql . if false → keep asking valid credentials. as of now, i`m thinking of using cardlayout approach. schema simple: if true → switch workspace_card . set mysql table field ( user_status ) 1 (meaning online ). logout → switch login_card . set mysql table field ( user_status ) 0 (meaning offline ). so, question is: may cardlayout considered approach when comes low level security type of applications? what accurate schema/method use in javaworld achieve above tasks/results ? i guess stoting user online/offline status in database , manahe through application in bad approach. in cases, such of application/database process shutdown, force shutdown , others, logo

c# - How can I upload image into Cloudant? -

i want save profile image nosql db cloudant. i know how save firstname, lastame, , age not image using c#. you can try using 1 of client libraries c#/.net listed here . this 1 seems promising. example on how use here . according documentation have send image in base64 string below: { "_id":"myprofile", "_attachments": { "myphoto.png": { "content_type":"image\/png", "data": "ivborw0kggoaaaansuheugaaaaoaaaakcayaaacnms+9aaabieleqvqylqxbzuvbyaah4n/7syqkbrptjgujzdk/0inyd9hb8dhhh8ey7ddyceexm7d9cwmh6al3t571imomepdshlwy7tzs2mlatgls35rk3foqynn68mgwkx79sd3a0tx6bbgao/mzhgse4i3npdw906yvmtrkakd8hl3bthck03idtbbwkmlw3szql8lyugbhchat0ndv/apralqrbxdmy0plsz0x4lfzbmzouai1zwipg5bwxqztt4tgpewwnelzve2s3tt+sldfz0eswvryahqo/ew4bianz7ih0w2i43fboupt1wxuhcbj0qbqbi+pfpi6ju/9ifzcpdzxtngsgayqcinuyl4eaob3po6kdymfmwtkvtkic4hbmjbm19agkuxulof57j04oe3seaawk5mekaxprkjugx/tfo77urlkdvzzl6cchga9pyu4rwtlx2m4

web services - How to expose a native dll on EC2 or Azure? -

i have native c++ dll doing advanced calculations should kept secret. dll has interface, let's say: int calculate(int* params, int params_length); i want expose dll web applications. far found common solution build web service around dll (soap or rest). what best way of solving kind of problem, platform use (ec2 or azure) ? prefer not use .net solution. having service around best solution. rest service if preferable performs better , don't need build soap wrapper anymore. also, if web applications written in .net can directly use c++ dll, explained here, http://blogs.msdn.com/b/jonathanswift/archive/2006/10/02/780637.aspx regarding platform, there no best platform such , can use of two. however, if building solutions in .net , using visual studio azure preferred there built-in tooling in visual studio azure.

php - Error Fatal error: Call to a member function insert() on a non-object -

i'm using callback after inserting in database, pass values other table, think method used fine. gives me error when inserting other table in database, in model, or in controller im kind of clueless in error, can please me. before put $this->load->database(); in autoload in config file :) fatal error: call member function insert() on non-object a php error encountered severity: notice message: undefined property: finances::$inventory_model filename: controllers/finances.php line number: 125 controller: public function inventory_management($post_array,$primary_key) { $this->load->model('inventory_model'); if($post_array['id_expense']!=null){ $type = 'add'; $id_exp_detail = $primary_key; $result = $this->inventory_model->insert([ 'id_exp_detail' => $id_exp_detail, 'name' => $post_array['

javascript - ExtJs 5.1 paging tool bar in grid panel -

using extjs 5.1, when load grid panel showing correct paging number in paging tool. during page load time show page 1 of 5. previous , next buttons disabled. # var store = new ext.data.store({ autoload: {params:{start: 0, limit: 5}}, pagesize: 5, remotesort: true, model: 'tenantdetails', proxy: { type: 'ajax', enablepaging : true, url: 'http://localhost:8080/restcountries-dev/rest/page/v0.5/tenant', reader: new ext.data.jsonreader({ type: 'json' , totalproperty:15, rootproperty:'tenant' }) }, listeners:{ load:function(store){ ext.getcmp('tenant_detail_grid').getselectionmodel().select(0, true); } } }); # and paging toolbar defined below. bbar: ext.create('ext.pagingtoolbar', { store: store, displayinfo: true,

r - Combine two equal length vectors alternating -

this question has answer here: alternate, interweave or interlace 2 vectors 2 answers im struggling feel there must vectorized way not finding it. have 2 equal length vectors , combine them want first element in vector 1 followed first element in vector 2, second element in vector 1 followed second element in vector 2, etc. vector1 <- c(301l, 50l, 61l, 84l, 90l) vector2 <- c(302l, 51l, 62l, 85l, 91l) what want result (i know combine them , use sort want keep order of them intact (301 & 302 come before rest). vector3 <- c(301l, 302l, 50l, 51l, 61l, 62l, 84l, 85l, 90l, 91l) try c(rbind(vector1, vector2)) or using map unlist(map(c, vector1, vector2))

Onsen UI list item with expandable functionality -

is there feature or technique implement list item on tapped gets expanded? not sure if found solution already. i looking similar today able make expandable list using angular's ng-show , scope. i'm not sure if you're using angular have made example anyway. you bind ng-show variable in scope (in example have assigned json scope variable , ng-show bound 'expand'): listscope.items = [{heading:'heading item 1',details:'some details item', expand: false}, {heading:'heading item 2',details:'some other details item',expand: false}, {heading:'heading item 3',details:'im getting on typing out details items now',expand: false]; then in html have ng-repeat iterating through items: <ons-list ng-repeat='item in listscope.items'> <ons-list-item ng-click="listscope.toggleexpandlist(item)"> <h3>{{item.heading}}</h3> <div ng-show="item.expand">

java - Image height getting compressed on Android -

i trying create facebook-like feed on app. for image on every post, trying scale occupy full width of post - <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="12dp"> <imageview android:id="@+id/image" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="fitxy" android:adjustviewbounds="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparentright="true" android:layout_alignparentend="true" android:layout_marginleft="3dp" android:layout_marginstart="3dp" android:layout_marginright="3dp" and

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e

javascript - SCORM 2004 Get and Set Values -

i trying , set completion status of various objectives. trying these; str = scorm.getvalue("cmi.objectives." + i.tostring() + ".completion_status"); getvalue('cmi.objectives.0.completion_status') returned '' in 0 seconds [13:50:23.469] checking getvalue error [13:50:23.469] scorm error found - set error state: 301 - objectives collection not have element @ index 0, current element count 0. this log of scorm cloud. think might related giving ids objectives. my objectives not set id in manifest , don't know have it. question need give id each objective (manifest or javascript)? if think/guess/know problem different, appreciated. so typically check - scorm.getvalue('cmi.objectives._count') know if had objectives poll. if came 2, have 2 objectives loop thru cmi.objective.x.id needed update. or, if adding new objective, _count give next available index in packed array. if had _count of 1 worth trying check comp

css - Define one font face for several font files with different weight -

i came across issue using custom fonts. many offer several files support different font weights , italics, define font face like: @font-face { font-family: 'webfont bold'; src: url('myfont.woff') format('woff'), /* chrome 6+, firefox 3.6+, ie 9+, safari 5.1+ */ url('myfont.ttf') format('truetype'); /* chrome 4+, firefox 3.5, opera 10+, safari 3—5 */ } where bold replaced different font specific words italic or light. wondering possible define 1 font face use specific font, bold if somewhere in css font-weight: bold; set? the correct way this: @font-face { font-family: 'webfont'; src: url('myfont_regular.woff').... } @font-face { font-family: 'webfont'; font-weight: bold; src: url('myfont_bold.woff').... }