Posts

Showing posts from 2015

ios6 - keep track of connected users on ios application -

i have ios app, users can login , logout whenever want. in server side, want know wich users online. set user online when login webservice called, , set offline when logout webservice called. but, cant sure logout done, maybe cellphone turn off, server keep user online, , when try login again error "sorry, logged in" maybe can feedback server (my app uses push notifications) dont know how fast detect user has gone offline... in these cases think best think app should ping server every x seconds , update kind of "last_online" field. then in logic, can consider example user last seen online more 3 minutes ago considered offline. like said, can't trust user click "logout" can't assume that's time logged out. of course can still let user click logout manually.

c++ - QTest dosnt compile -

/usr/include/qt5/qttest/qtestmouse.h:161: undefined reference `qtest::defaultmousedelay()' /usr/include/qt5/qttest/qtestmouse.h:206: undefined reference `qtest::qwarn(char const*, char const*, int)' collect2: error: ld returned 1 exit status im create simple test: #include <qttest/qtest> #include "testhuff.h" #include "huffmancode.h" void testhuff::simpletest() {} if remove #include <qttest/qtest> compiles well.

algorithm - Order of computation on parallel processing -

given unsorted array, have read in article n-square processors can used maximum element of array in o(1) complexity. can explain mechanics behind it? the mechanics behind algorithm based on can call dirty trick. namely, allow processors write simultaneously same shared memory location. if write same value, result considered well-defined. this can used implement parallel-and , parallel-or operators. here's example parallel-or: result := false in 0 n-1 parallel if a[i] result := a[i] we allow simultaneous reads. here's max algorithm: n := a.length in 0 n-1 parallel m[i] := true in 0 n-1 parallel j in 0 n-1 parallel if a[i] < a[j] /* dirty trick: simultaneous read many processors */ m[i] := false /* dirty trick: many processors write m[i] @ once */ in 0 n-1 parallel if m[i] max := a[i] /* dirty trick: many processors write max @ once */ return max the abstract architecture allows these

oop - Data Abstraction in C -

what understood data abstraction hiding technical details user , showing necessary details. data abstraction oop feature. question is: c support data abstraction? if so, why data abstraction object oriented programming language feature , not procedural language feature? if answer question no , structures, enums in c? hide details users. it's possible object oriented programming in c. remember e.g. first c++ compiler c++ c transpiler, python vm written in c etc. thing sets called oop languages apart other better support these constructs, instance in syntax. one common way provide abstraction function pointers. @ struct linux kernel source below (from include/linux/virtio.h). /** * virtio_driver - operations virtio i/o driver * @driver: underlying device driver (populate name , owner). * @id_table: ids serviced driver. * @feature_table: array of feature numbers supported driver. * @feature_table_size: number of entries in feature table array. * @probe: fun

node.js - Time based javascript functions with setInterval -

i'm using node.js question strictly javascript related. i'm interfacing i2c board fade lights , i'd fade them @ specific rate, 1 second. setinterval, in theory should work like... if wanted fade them 100 steps in 1 second like... var fader = setinterval(function(){ //will fade light 100 steps in 1 second dofade(something,something); },10) but depending on code inside of interval loop, may take longer 1 second (i tested , application 2.5 seconds). i'm sure fact function dofade taking set amount of time happen causing issue i'm curious if there real way make happen within 1 second. the closest you'll ever get, afaik, relying entirely on js this: var fader = (function(now) { var timeleft, end = + 1000,//aim 1000 ms stepsremaining = 100, callback = function() {//define here, avoid redefining function objects dosomething(foo, bar); setter(); }, setter = function() {//re

batch file - FORFILES less than 4 days old -

so i'm having trouble trying figure out forfiles. i'm trying files no more 4 days old. less 4 days. not seem quite possible since /d -4 gets items 4 days or older. below have far. forfiles /p t:\downloads /m *.exe /c "cmd /c copy @path t:\downloads\applications | echo copying @path" /d +4 anyone know if possible? or maybe better alternative? this might work you: @echo off &setlocal cd /d "t:\downloads" (for %%a in (*.exe) @echo "%%~a")>dir.txt /f "delims=" %%a in ('forfiles /d -4 /m *.exe ^|findstr /vig:/ dir.txt') echo copying %%a&copy "%%~a" "t:\downloads\applications" del dir.txt unfortunately doesn't work in xp.

flash - How do you get the files type/extension based on the file content in ActionScript? -

how file type/extension based on file content in actionscript? example have jpg image following file name: niceimage. based on file name, won't know whats files extension me it's important know exact type of image. you have read in binary data ( https://www.google.com/search?q=read+binary+file+in+as3 ) , parse image header yourself. there libraries out there (such http://www.greensock.com/loadermax/ ) can if care loading content scene.

c# - Task overrides task -

i have task fetch content server. problem is, task overrides task before, 2 times same result. my code: task<string> task = server.gettext(); string result = await task; if (result == "\n") { ..... } else { string[] sarray = result.split('|'); app.mainlist.add(new etc.text(sarray[0], sarray[1], sarray[2], sarray[3], sarray[4])); app.number++; } gettext(): public static async task<string> gettext() { if (app.number <= app.total) { httpclient http = new system.net.http.httpclient(); httpresponsemessage response = await http.getasync(queryuri + "?w=" + app.number.tostring()); return await response.content.readasstringasync(); } else { app.number = 1; httpclient http = new system.net.http.httpclient(); httpresponsem

objective c - NSPredicate Crashes when trying to use CONTAINS -

the data structure want question. data transformable field in turn nsdictionary . obj = { //... nsdictionary *data:@{ likespeople:@[@{@"username":@"jack",@"id":@"ae3132"}] } } what want search inside nsarray *fetchresult check there noone in likespeople x id . attempts on doing end crashing highlighting there problem in nspredicate declaration. what doing wrong , how fetch information want? socialwall *thesocialwall = fetchresult[0]; nslog(@"%@",thesocialwall.data); nspredicate * predicate = [nspredicate predicatewithformat:@"data.likespeople contains(c) %@",myuser.userwebid]; nsarray * result = [fetchresult filteredarrayusingpredicate:predicate]; nslog(@"%@",result); not contains(c) contains[c] #import <foundation/foundation.h> int main(int argc, char *argv[]) { @autoreleasepool { nsdicti

C++ Double subscript overloading: cannot convert from 'type' to 'type &' -

i'm trying make 2d matrix class vector of vectors , both classes templates. i've overloaded subscript operator in vector class. problem occurs when try overload operator[] in matrix class error message: error c2440: 'return' : cannot convert 'vector' 'vector &' . here's code classes: template <typename t> class vector { private: t *mem; int vectsize; public: vector<t> (int _vectsize = 0); //some other methods here t& operator[](int index) { return mem[index]; } }; and template <typename h> class matrix { private: int dim; vector< vector<h> > *mat; public: matrix<h> (int _dim = 0); matrix<h> (const matrix & _copy); vector<h>& operator[](int index) { return mat[index]; //here's error } }; i made googling , found same examples or overloading () instead of []. can't unde

compatibility - Change text location in CSS -

i'm using following login form want change design bit: http://html-form-guide.com/php-form/php-login-form.html i want place ' login ' middle of box, instead left: i've found out can change textsize, font etc. in fg_membersite.css (line 17). what's interesting in chrome displayed in middle, in firefox it's shown on left. since i'm new css worker wanted ask if me fixing incompatiblity problems here. since contains lots of javascript based stuff wasn't sure if posting source codes here sensible, because i'd have post whole source anyway then. thanks in advance! edit: prettier now. thanks: http://rapidhdd.com/images/4013242013-10-06_1842.png use center text part: <form id='login' action='login.php' method='post' accept-charset='utf-8'> <fieldset > <legend align="center">login</legend> <input type='hidden' name='submitted' id='submitted

yaml - Including variables in jekyll from given file -

i want have variable assignments placed in single txt file or similar in jekyll, , have them included in front matter assignment. instead of this: --- variable1: abc variable2: 123 --- i can have this: --- {% include variables.txt %} --- the purpose of have website editable technologically inexperienced client. want abstract out core site structure things need edited as possible - without setting cms, or moving dynamic site (so can still hosted on github pages) you throw of variables _config.yml file , can accessed this: {{ site.variable1 }}

java - How make two or more title bars of the Main Activity? -

i want put 2 bars in 1 activity. first want put textview control switch , second on listview control switch. how that? tried adjust main title bar, have other. put 2 style files, first containing controls textview, imageview , list, , second defines single field list. main_activity.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" tools:context=".mainactivity" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="5dp"

r - Changing color of shades in ggplot2 function -

i had previous question shading sections of graph , guys got graphs! wondering possible change colour of shading instead of being gray? here code used graphs link previous question. ggplot(data, aes(x=time, y=average, colour=test)) + geom_rect(aes(xmin=20,xmax=30,ymin=-inf,ymax=inf),colour=na,alpha=0.02) + geom_errorbar(aes(ymin=average-se, ymax=average+se), width=0.2) + geom_line() + geom_point() shading sections of graph using r

powershell - Joining back a splitted variable -

$(((get-adrootdse).defaultnamingcontext).split(",dc=")) this gives following output. (literal output) ps c:\users\administrator> $((get-adrootdse).defaultnamingcontext).split(",dc=") contoso com i contoso.com result. splitting variable wasn't issue. however, how join 2 parts again? i've found examples on how join , split, not on how 'rejoin' after split method. you can use -join operator join strings: ps> "a,s,d,f".split(",") -join "" asdf the value after -join operator character or text want join with. alternatively can use more explicit .net method string.join : ps> [system.string]::join("", "a,s,d,f".split(",")) asdf the first argument join character, second list want join.

c++ - Reading a file where middle name is optional -

i'm trying read in file formatted firstname middlename (optional) lastname petname\n with middle name being there on half entries, i'm unsure best way read these in , them correct variable names. appreciated. you this: std::string line, word; while (std::getline(myfile, line)) { if (line.empty()) continue; // read words line: std::istringstream is(line); std::vector<std::string> words; words.reserve(4); (int = 0; >> words && < 4; i++) words.push_back(word); if (words.size() == 4) // middle name present ... else // not ... }

python - How to get virtualenv to use dist-packages on Ubuntu? -

i know virtualenv, if not passed --no-site-packages argument when creating new virtual environment, link packages in /usr/local/lib/python2.7/site-packages (for python 2.7) newly-created virtual environment. on ubuntu 12.04 lts, have 3 locations python 2.7 packages can installed (using default, ubuntu-supplied python 2.7 installation): /usr/lib/python2.7/dist-packages : has global installation of ipython, scipy, numpy, matplotlib – packages find difficult , time-consuming install individually (and dependences) if not available via scipy stack . /usr/local/lib/python2.7/site-packages : empty, , think stay way on ubuntu unless install package source. /usr/local/lib/python2.7/dist-packages : has important local packages astronomy, notably related pyraf, stsci, etc., , extremely difficult , time-consuming install individually. note global directory such /usr/lib/python2.7/site-packages not exist on system. note global installation of ipython, scipy, etc. lets me use packages

python - Is there a better way to split of objects by one of its attributes? -

i'm working on appengine app , have list of objects datastore want split groups based on 1 of attributes. have solution this, wanted check if knows of better way this. this code have @ moment: for report in reports: if report.status == 'new': new_reports.append(report) elif report.status == 'read': read_reports.append(report) elif report.status == 'accepted': accepted_reports.append(report) elif report.status == 'deined': denied_reports.append(report) elif report.status == 'resubmitted': resubmitted_reports.append(report) any ideas welcome! a dictionary nice instead of local variables: reports_by_status = {'new': [], 'read': [], 'accepted': [], 'deined': [], # denied? 'resubmitted': []} report in reports: d[report.status].append(report) but made typo! might nice prevent using whatever data in status variable assign categor

Titanium remote images initial run -

my issue: want application have initial data set, including images, first run. but after if user connects internet, can download newer images. from can google, way use image caching. how do initial caching of images first run on application? (if application runs offline first time) you can put initial files inside project , titanium include them during build process. update them in future have use titanium.filesystem.file object.

Batch file to delete folders older than N days except specific ones -

i'm looking make batch file delete profiles haven't been used in on 6 months while retaining specific ones such "administrator, default user, users, etc." i've searched around , have found way remove older files/folders: forfiles.exe /p d:\files /s /m . /d -7 /c "cmd /c del @file" but there's no way of making exception "forfiles" i've found way delete files/folders exceptions: for %%i in (*.exe) if not "%%i"=="file name" del /q "%%i" but that'll remove every file/folder , not older ones. my scenario: take care of hundreds of workstations run winxp. there several users log in these computers , wouldn't want delete accounts. haven't logged in in while , exception of 3 or 4 permanent accounts in each workstation same. so, if no 1 has logged in administrator account in on 6 months, stay intact. can't drop forfiles of these workstations or other piece of software i'm limite

jquery - Javascript returning Uncaught TypeError: Cannot call method 'indexOf' of undefined -

i have facebook friend invite sender , following code returning , error. iframehtml = $myjq('#polldaddy_embed_0').html(); if (iframehtml.indexof("facebook") === -1) { iframehtml = iframehtml.replace("fb_id=","fb_id="+window.uid); iframehtml = iframehtml.replace("?q_3826051_url=","&q_3826051_url="+encodeuricomponent(window.url)); $myjq('#polldaddy_embed_0').html(iframehtml); if (window.total>=5) { $myjq('#fb_first5_id').trigger('click'); } } the error getting is: uncaught typeerror: cannot call method 'indexof' of undefined that tells element id polldaddy_embed_0 didn't exist when code ran. if call $() selector doesn't match anything, empty jqu

SciLab: RGB color plot, trying to color each mark with its respective color -

all, i have made 3d plot of colors in rgb color space. marks same color. each mark color represents in space. so, mark in red corner of plot should red, etc... the code have far below. thanks help, -bill // rgb color data few shades of pink , red r = [1, 1, 1, 1, 0.8588235294117647, 0.7803921568627451, 1, 0.9803921568627451, 0.9137254901960784, 0.9411764705882353]'; g = [0.7529411764705882, 0.7137254901960785, 0.4117647058823529, 0.07843137254901961, 0.4392156862745098, 0.08235294117647059, 0.6274509803921569, 0.5019607843137255, 0.5882352941176471, 0.5019607843137255]'; b = [0.796078431372549, 0.7568627450980392, 0.7058823529411765, 0.5764705882352941, 0.5764705882352941, 0.5215686274509804, 0.4784313725490196, 0.4470588235294118, 0.4784313725490196, 0.5019607843137255]'; // draw 3d graph r g b vectors param3d(r,g,b,35,45,"red@green@blue",[2,4]); title("some shades of pink , red"); // set marks ball style p=get("hdl");

node.js - Modeling time-based application in NodeJs -

im developing auction style web app, products available period of time. i know how model that. so far, i've done storing products in db: { ... id: p001, name: product 1, expire_date: 'mon oct 7 2013 01:23:45 utc', ... } whenever client requests product, test *current_date < expire_date*. if true, show product data and, client side, countdown timer. if timer reaches 0, disable related controls. but, server side, there operations needs done if nobody has requested product, example, notify owner product has ended. i scan whole collection of products on each request, seems cumbersome me. i thought on triggering routine cron every n minutes, know if can think on better solutions. thank you! some thoughts: index expire_date field. you'll want if you're scanning auction items older date. consider adding second field expired (or active ) can other types of non-date searches (as can always, , should anyway, reject auctions have expired

Use python dropbox API with django -

i'm using dropboxoauth2flow method described dropbox api v1.6 in django v1.5.3 application , i'm having 400 error when redirected dropbox oauth2 authorization page. when go to dropbox_auth_start url redirected to: https://www.dropbox.com/1/oauth2/authorize?state=twd4eh4nzk5nlcuhxe7ffa%3d%3d&redirect_uri=http%3a%2f%2fmydomain.com%2fdropbox_auth_finish&response_type=code&client_id=blahblahblah and 400 error occurs. the "dropbox-auth-csrf-token" written in session file way. my django code: views.py def get_dropbox_auth_flow(web_app_session): redirect_uri = "http://www.mydomain.com" return dropboxoauth2flow('blahblahblah', 'blehblehbleh', redirect_uri, web_app_session, "dropbox-auth-csrf-token") # url handler /dropbox-auth-start def dropbox_auth_start(request): authorize_url = get_dropbox_auth_flow(request.session).start() return httpresponseredirect(authorize_url) # url handler /dropbox-

How can I make a function with optional arguments in C? -

recently got question when writing program file opening. let me explain question clearly. here i'm taking open call example. to create file: open("file_name", o_creat, 0766); //passing 3 parametrs to open file: open("file_name", o_rdwr); //only 2 arguments. then observed point , works main() too. main(void) //worked main(int argc, char **argv); //worked main(int argc) //worked , it's doesn't give error "too few arguments". main() //worked so how can create these optional arguments? how can compiler validate these prototypes? if possible, please write example program. the open function declared variadic function. this: #include <stdarg.h> int open(char const * filename, int flags, ...) { va_list ap; va_start(ap, flags); if (flags & o_creat) { int mode = va_arg(ap, int); // ... } // ... va_end(ap); } the further arguments not consumed unless have indic

sql server - I want to use the variable I declared somewhere else but I cannot (simple sql query) -

declare @path text; set @path = 'c:\bulk' bulk insert [humanresources].[employee] -- want use variable here !! ( check_constraints, codepage='acp', datafiletype='widechar', fieldterminator='\t', rowterminator='\n', keepidentity, tablock ); declare @path nvarchar(2000); set @path = 'c:\bulk.(extension)'; declare @sql nvarchar(max) = '''bulk insert [humanresources].[employee] from' + @path + ' ( check_constraints, codepage=''acp'', datafiletype=''widechar'', fieldterminator=''\t'', rowterminator=''\n'', keepidentity, tablock )''' execute sp_executesql(@sql)

python - pandas DataFrame filter by rows and columns -

i have python pandas dataframe looks this: b c ... zz 2008-01-01 00 nan nan nan ... 1 2008-01-02 00 nan nan nan ... nan 2008-01-03 00 nan nan 1 ... nan ... ... ... ... ... ... 2012-12-31 00 nan 1 nan ... nan and can't figure out how subset of dataframe there 1 or more '1' in it, final df should this: b c ... zz 2008-01-01 00 nan nan ... 1 2008-01-03 00 nan 1 ... nan ... ... ... ... ... 2012-12-31 00 1 nan ... nan this is, removing rows , columns not have 1 in it. i try seems remove rows no 1: df_filtered = df[df.sum(1)>0] and try remove columns with: df_filtered = df_filtered[df.sum(0)>0] but error after second line: indexingerror('unalignable boolean series key provided') do loc : in [90]: df out[90]: 0

Java compiling error, please help, i suck at java -

here error : "exception in thread "main" java.lang.runtimeexception: uncompilable source code - constructor thecontroller in class project* * .thecontroller cannot applied given types; required: java.lang.string found: int reason: actual argument int cannot converted java.lang.string method invocation conversion @ project* ** .main.main(main.java:23)" i know tells me problem is, how fix it? here code "main", public class main { /** * @param args command line arguments */ public static void main(string[] args) throws ioexception { readfile statesreadfile = new readfile(); statesreadfile.loaddata("states2.txt"); thecontroller statesqueues = new thecontroller(statesreadfile.getnumstates()); statesstack mystatesstack = new statesstack(statesreadfile.getnumstates()); and here guess doesn't match cause have error there too, public class thecontroller { public queues pq1; public queues pq3; public queues

tf idf - How to create my own stop words list? -

i create stop words list non-english language. metrics better creating stop words list: term frequency entire document collection or tf-idf metrics? you can use r this: my.list <- unlist(read.table("c:/users/blabla/desktop/files/yourstopword.txt", stringsasfactors=false)) my.stops <- c(my.list) mycorpus <- tm_map(mycorpus, removewords, my.stops)

php - laravel 4 Route::controller() method returns NotFoundHttpException -

i trying route restful controller using following in app/routes.php: route::controller('register', 'registercontroller'); route::get('/', 'homecontroller@showwelcome'); in app/controllers/registercontroller.php file have added following: <?php class registercontroller extends basecontroller { public function getregister() { return view::make('registration'); } public function postregister() { $data = input::all(); $rules = array( 'first_name' => array('alpha', 'min:3'), 'last_name' => array('alpha', 'min:3'), 'company_name' => array('alpha_num'), 'phone_number' => 'regex:[0-9()\-]' ); $validator = validator::make($data, $rules); if ($validator->passes()) { return 'data saved.'; } return redirect::to('register')->witherror

networking - Finding another Android device on WiFi network -

i'm making application needs communicate app on device. problem ip addresses devices aren't allways same. want client find server on specific port, how can find devices on network have port opened without me having enter server's ip on client side? i've found android's nsdmanager, works api level 16 , on. i'm developing level 10. thanks in advance! you can use zero-configuration networking can solve problem.have @ following websites- http://www.multicastdns.org/ , http://en.wikipedia.org/wiki/zero-configuration_networking . you can make use mdsnd, check bonjour implementation on android more info.

python - Custom routing in Flask app -

i've been trying understand how generate dynamic flask urls. i've read docs , several example, can't figure out why code doesn't work: path = 'foo' @app.route('/<path:path>', methods=['post']) def index(path=none): # stuff... return flask.render_template('index.html', path=path) i'd expect index.html template served /foo , not. build error. missing? if use fixed path, /bar , works without issue. @app.route('/bar', methods=['post']) you've got long , short of already. need decorate view functions using /<var> syntax (or /<converter:var> syntax appropriate). from flask import flask, render_template app = flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/<word>', defaults={'word': 'bird'}) def word_up(word): return render_template('whatstheword.html', word=w

c++ - Extract 4 SSE integers to 4 chars -

suppose have __m128i containing 4 32-bit integer values. is there way can store inside char[4] , lower char each int value stored in char value? desired result: r1 r2 r3 r4 __m128i 0x00000012 0x00000034 0x00000056 0x00000078 | v char[4] 0x12 0x34 0x56 0x78 sse2 , below preferred. compiling on msvc++. with sse2 can use following code: char[4] array; x = _mm_packs_epi32(x, x); x = _mm_packus_epi16(x, x); *((int*)array) = _mm_cvtsi128_si32(x);

Generating Colour Image Using Matlab -

Image
i want draw color image in matlab of size 200*200 pixel ,type rgb , square size of green color in middle i-e 76 row , 125 column. then want draw 20*20 pixels square of red, green, blue , black in corner's of same image. don't know how or draw color boxes (rgb) in matlab. i have done in binary shown in following fig: you need define 3 components mentioned: r, g, b. if want work color channels integers 0..255, need convert matrix type integer: img = ones(256,256,3) * 255; % 3 channels: r g b img = uint8(img); % using integers 0 .. 255 % top left square: img(1:20, 1:20, 1) = 255; % set r component maximum value img(1:20, 1:20, [2 3]) = 0; % clear g , b components % top right square: img(1:20, 237:256, [1 3]) = 0; % clear r , b components img(1:20, 237:256, 2) = 255; % set g component maximum % bottom left square: img(237:256, 1:20, [1 2]) = 0; img(237:256, 1:20, 3) = 255; % bottom right square: img(237:256, 237:256, [1 2 3]) =

Is there a cleaner and a shorter way to write this conditional in python? -

>>> def accept(d1, d2): if somefunc(d1,d2) > 32: h = 1 else: h = 0 return h does python have ternary conditional operator? doesn't give solution case 1 want return value. lambda based solution preferable. or, perhaps trickier, return int(somefunc(d1, d2) > 32) note int(true) == 1 , int(false) == 0 .

How to insert php variable into mysql query? -

i have following statement: select bname,cnum,vnum, match(vtext) against (''".$word."'') relevance kjv match(vtext) against (''".$word."'') , bnum='".$book."' order relevance desc, bnum, cnum, vnum limit 0,1"); which returns empty rows, if substitute variables hardcoded values, goes through. variables not null, know because output them page after type them in box. thanks it better see more of surrounding code, expect it's double single quotes causing problem: select bname,cnum,vnum, match(vtext) against ('".$word."') relevance kjv match(vtext) against ('".$word."') , bnum='".$book."' order relevance desc, bnum, cnum, vnum limit 0,1");

Making a jQuery Isotope layout initialize inside a Bootstrap Tab -

i have bootstrap tab control 4 tabs. isotope code inside 3rd tab. when navigate tab, layout not engaged (all images on own line, not in nice tiled layout). if resize page reorganize proper layout. i have recreated issue here. http://jsfiddle.net/vc6vk/ <div class="tab-pane" id="messages"> ....isotope code here </div> how make isotope engage when navigate tab, formatted , displaying correctly? you can use event shown.bs.tab : $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $container.isotope('layout'); }); this code trigger layout tabs, can detect tab e.target, if e.target == tab link isotope grid, trigger layout . hope makes sense... http://jsfiddle.net/vc6vk/1/

C++ string functions - Why do they often have unspecified complexity? -

i noticed that, according recent c++ iso standard, string::pop_back , string::erase (to name two, there others) member functions have unspecified complexity. reasoning behind leaving complexity choice of library coders? there implementations of knows have non-constant complexity string::pop_back ? tldr; because history, , time complexities haven't been proposed yet the situation: [basic.string] directly specifies few operations have complexity: size() : o(1) since c++11 max_size() : o(1) since c++11 shrink_to_fit() : o(n) in c++17 (although added in c++11) operator[] : o(1) since c++11 swap() : o(1) data() : o(1) since c++11 it indirectly specifies many more (and i'm missing few here): length() : equal size() empty() : equal size() at() : equal operator[] front() : equal operator[] back() : equal operator[] copy() : o(n) (comes character traits) assign() : o(n) (comes character traits) find() , variations : o(n

c# - How to Pause Before Performing an Action -

i have need place quick pause in application before performing action (enabling application bar button), unsure of how best accomplish this. lot of processing happening in thread ui updated. once ui updated, scrolling pivot control particular pivot item. pause 1 second, or long takes scroll previous pivot item in pivot control, before allowing application bar button enabled. how might accomplish this? have far follows // show image , scroll start page if needed if (viewport != null) { viewport.source = result; if (editpagepivotcontrol != null && editpagepivotcontrol.selectedindex != 0) { //here pivot control told move first item // (from second on before happens) editpagepivotcontrol.selectedindex = 0; } //a flag determine whether app bar button should enabled //how pause time takes finish moving // first pivot item? if (_wasedited) ((applicationbariconbutton)applicationbar.buttons[0]).isenabled = true;

.net - How to implement a MVC 4 change log? -

i developing mvc 4 application. client wants have change log, can view fields have been changed. should show old value , new value, in case of edit. if delete, should show row deleted. whats best way achieve this? just clarify.. changes actual data in database.. ie might have record of customer names , addresses.. user might update addresses.. need ability see user changed.. old data , new data thanks... this typically done using triggers in database. create audit table, , create triggers catch each change , record them. an article talking here: http://www.codeproject.com/articles/441498/quick-sql-server-auditing-setup more recent versions of sql server have auditing built-in, in enterprise editions quite spendy.. people don't have access these features. another option, , cannot speak how works, third party tools claim add auditing capability. example, simple google search found these: http://krell-software.com/omniaudit/ https://renholdsoftwar

php - Creating Cron Jobs in CakePHP 2.x -

i have attempted create cron job in cakephp 2.x application. of resources have read online seem either doing different 1 little consistency or explain in complex terminology. basically have created following file myshell.php in /app/console/command <?php class myshell extends shell { public function sendemail() { app::uses('cakeemail', 'network/email'); $email = new cakeemail(); $email->from('cameron@driz.co.uk'); $email->to('cameron@driz.co.uk'); $email->subject('test email cron'); $result = $email->send('hello cron'); } } ?> and want run code @ midnight every night. what do next? next part confuses me! have read on book at: http://book.cakephp.org/2.0/en/console-and-shells/cron-jobs.html should run code in terminal make @ time etc. , can set these using hosting provider rather seems. but i'm rather confused console directory. should

ios - How do I push notifications if my app hasn't been run yet? -

assuming user has not launched app yet, but has been run before . there way still "push" news/updates? to explain mean: imagine user installed "your-restaurants-in-your-area" local orientated app, , configured app in setting notify user when new restaurants open... however, user forgets run app @ daily basis. there way app auto-show news inside ios? i have found xe4 anders stying people working xe4 http://blogs.embarcadero.com/ao/2013/05/02/39456 http://blogs.embarcadero.com/ao/2013/05/24/39472 after further searching (i missed first round) found this: http://edn.embarcadero.com/article/43239 it requires editing delphi xe4 bundled source files (i.e. not officially supported / made easy in xe4), seems can made work. (i have not found official mention of official "built-in" support in xe5.) i upvoted answer given sofar since helpful in way. the question not related delphi… it impossible auto-run/unattended-run applications in i

generating random baseband signal in matlab -

how use matlab commands conv & randn generate random baseband signal of specified bandwidth in matlab? i have equation: m=conv(randn(1,9501),ones(1,500))/100, [supposedly] produces bandwidth of 20hz, don't understand how modify signal obtain desired bandwidth of 10hz. i want apply signal in qam , ssb-sc.

sql - Is it possible to execute a CallableStament on a different Connection? -

it considered practice reuse callablestatement 's instances (check here ). but when creating callablestatement , statement (from understanding) bound specific connection . do: connection con = pool.getconnection(); callablestatement st = con.preparecall("{ stmt; }"); st.executequery(); st.close(); con.close(); from checked, following not going execute query: connection con = pool.getconnection(); callablestatement st = con.preparecall("{ stmt; }"); con.close(); con = pool.getconnection(); // possibly new connection, different 1 used create callablestatement instance st.executequery(); st.close(); my question is: if want reuse callablestatement instances, on other hand still being able new connections , close old ones (not have have same connection open) can do? preparedstatement s (or ought be) cached jdbc driver. see e.g. http://www.mchange.com/projects/c3p0/ this means should not hold on 1 , use between connections, don&

powers of 2 java code help with my input different outcome -

import java.util.scanner; public class powersof2 { public static void main(string[] args) { int inputpowersof2; int powerof2 = 1; int exponent; int exponent2; scanner scan = new scanner(system.in); system.out.println("how many powers of 2 printed?"); inputpowersof2 = scan.nextint(); system.out.println("\n\n"); if(inputpowersof2 >= 2) { system.out.println("here first " + inputpowersof2 + " powers of 2:"); system.out.println(); } else { system.out.println("here first power of 2:"); system.out.println(); } exponent2 = 0; exponent = 0; while(exponent <= inputpowersof2) { system.out.print("2^" + exponent2 + " = "); exponent2++; system.out.println((powerof2 = 2 * pow

c# - .NET Chart set minimum length for scrollbar -

i working on application using winforms chart control. i have width of chart form set (in terms of pixel size) , , set value determine when enable scrollbar x axis on chart. example, within visible range of chart there 100 "ticks" on x axis, instead of cramming 10,000 of them onto chart. is there way set this?

if statement - Rails unless with 2 conditions, second condition not working using slim -

here's code: - unless relationship.are_friends?(current_user, @user) && (current_user != @user) - puts "d"*100 - puts "#{current_user.inspect}" - puts "#{@user.inspect}" = link_to "add friend", controller: "relationships", action: "req", name: @user.name, remote: true, class: "friend_link" basically second condition "current_user != @user" not working , don't know why. when puts current user , @user working correctly. @user = user.find_by_name(params[:name]). thanks help! i assume requirement. allow add b friend if: a , b not friends and a , b not same person so, in pseudo-code, unless (already_friends or same_person) allow_add_friend end if requirement, statement should read: unless relationship.are_friends?(current_user, @user) or (current_user == @user) note && changed or , != changed == .

android - onCreate being called on Activity A in up navigation -

so have activity , activity b. want activity able navigate activity b press of button. works, when use navigation(the home button in action bar) navigate activity a, oncreate() called again , old information user typed in lost. i've seen: oncreate called if navigating intent , used fragments, , i'm hoping not have redesign entire app use fragments. there way can stop oncreate() being called every time activity becomes active again? this behavior totally fine , wanted. system might decide stop activities in background free memory. same thing happens, when e.g. rotating device. normally save instance state (like entered text , stuff) bundle , fetch these values bundle when activity recreated. here standard code use: private edittext msomeuserinput; private int msomeexamplefield; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // todo inflate layout , stuff msomeuserinput = (edittext) findviewb

java - Errors occurred during the build. Errors running builder 'Android Pre Compiler' on project 'com.xxx...'. com/android/sdklib/util/SparseArray -

errors occurred during build. errors running builder 'android pre compiler' on project 'com.xxx.android.xxx'. com/android/sdklib/util/sparsearray i error today when try build project. not android project projects. any idea has happened? working yesterday today can't build project on workspace. below eclipse log file. entry org.eclipse.core.resources 4 75 2013-10-07 10:09:12.562 !message errors occurred during build. !subentry 1 com.android.ide.eclipse.adt 4 75 2013-10-07 10:09:12.562 !message errors running builder 'android pre compiler' on project 'com.xxx.android.xxx'. !stack 0 java.lang.noclassdeffounderror: com/android/sdklib/util/sparsearray @ com.android.ide.eclipse.adt.internal.resources.manager.dynamicidmap.<init>(dynamicidmap.java:29) @ com.android.ide.eclipse.adt.internal.resources.manager.projectresources.<init>(projectresources.java:67) @ com.android.ide.eclipse.adt.internal.resources.manager.projectresour

How to fix "Headers already sent" error in PHP -

Image
when running script, getting several errors this: warning: cannot modify header information - headers sent ( output started @ /some/file.php:12 ) in /some/file.php on line 23 the lines mentioned in error messages contain header() , setcookie() calls. what reason this? , how fix it? no output before sending headers! functions send/modify http headers must invoked before output made . summary ⇊ otherwise call fails: warning: cannot modify header information - headers sent (output started @ script:line ) some functions modifying http header are: header / header_remove session_start / session_regenerate_id setcookie / setrawcookie output can be: unintentional: whitespace before <?php or after ?> the utf-8 byte order mark specifically previous error messages or notices intentional: print , echo , other functions producing output raw <html> sections prior <?php code. why happen? to understand why hea