Posts

Showing posts from April, 2011

php - My Slim API gives me a 404 error page -

i'm making api angular app allow me access database slim. followed tutorial http://anjanawijesundara.blogspot.ca/2015/04/crud-application-with-angularjs.html i have 'angularjs' folder. in it, have index.html file, 'api' folder api, 'app' folder, angular app, , 'assets' folder css, img , other js file. i installed slim in 'api' folder composer (it created vendor folder) , have 'index.php' file next vendor folder. my 'index.php' file (in api folder) looks far: <?php require 'vendor/autoload.php'; $app = new \slim\app; $app->get('/types', 'gettypes'); $app->get('/types/:id', 'gettypebyid'); $app->run(); function db_connection() { $dbhost = "localhost"; $dbuser = "kevdug_portfolio"; $dbpass = "*****************"; $dbname = "portfolio"; $dbh = new pdo("mysql:host=$dbhost;dbname=$dbname", $dbuse

.htaccess - Rewrite QSA, understanding it better -

so, i'm having difficult time understanding qsa. since rewriterule ^search/(.*)$ search.php?s=$1 [nc,l,b,qsa] rewriterule ^search/(.*)$ search.php?s=$1 [nc,l,b] both give me same result. read qsa appends parameters passed (at least think that's understood it). it's not working me. currently have url http://localhost:8888/search/hey+i%27m+a+search+query&sortby=day which returns hey i'm search query&sortby=day i can set rewriterule ^search/(.*)&sortby=(.*)$ search.php?s=$1&sortby=$2 [nc,l,b,qsa] which return parameter, understand qsa, should automatically handled...right? i got information here - what $1 [qsa,l] mean in .htaccess file? basically, question is, why should use qsa? , kind of benefits provide in situation? (sorry being blunt, can't grasp of this) the problem example url has no query string. use ? designate query string: http://localhost:8888/search/hey+i%27m+a+search+query?sortby=day the ?sortby=day

android - Reliable, lightweight communication protocol for mobile -

i looking communication protocol use in mobile application. first target android, nice if supported in other platforms ios, osx , windows 8. main goals are: it has energy efficient , messages sending small , there no communication of time (it's sensing, , updates not frequent) it should support intermittent connectivity , guarantee message delivery important application not miss updates should able support encryption or messages of sensor data contain privacy sensitive information * should not require constant connection * application can put sleep when not in use. google cloud messaging works great when comes receiving messages server, problem having send clients without requiring keep connection active. the previous version using xmpp , json messages, think bad idea, since requires constant connection, , not meant energy efficient. i want use protocol buffers instead of json more compact representation , faster serialization, undecided on transport. mqtt came w

Jquery HTTP POST -

i have jquery code appends field form. when submit form, fields appended not available php. there special have pick these fields up? here code: $(document).ready(function() { window.unique = 0; //hides alert $("hide").click(function(){ $("#alert").hide(); }); $(document).on('click', '#toggle_header', function(){ window.unique++ $("#header_list").append("<li><input type='text' name='header_name" + unique + "' placeholder='name'><input type='text' name='header_value" + unique + "' placeholder='value'><a href='#' id='toggle_header_remove'><i class='icon-remove'></i></a></li>"); }); $(document).on('click', '#submit_query', function() { $.ajax({ url: 'index.php', type: &

javascript - Squaring each number in an array with dynamically added inputs -

i'm trying calculate standard deviation of set of data entered user form dynamically added inputs. far have been able calculate sum of elements in array, cannot figure out how square each element of array. have searched forum, trying suggestions applicable result ( square each number in array in javascript ) did not seem work. here snippet of code: $(".calcsd").click(function() { $("input[type=text]").each(function() { arr.push($(this).val().trim() || 0); sum += parseint($(this).val().trim() || 0); }); where .calcsd button user clicks perform calculation. moreover, length of array given var number = arr.sort().filter(boolean).length; script intended filter out inputs left blank. also, if make difference, inputs dynamically added array via: $('.multi-field-wrapper').each(function() { var $wrapper = $('.multi-fields', this); $(".add-field", $(this)).unbind('click').click(function(e)

vb.net - Can't access encrypted sqlite database -

i used navicat premium create database file , selected encrypted put password. when try accessing database in vb.net program error saying... file encrypted or not database "data source=\\10.10.10.10\folder\database.db;password=pwd;version=3;", true the above connection string (please ignore network path =) ). anyway, can through opening connection when reading data error. tried creating database doesn't have password , worked fine. copy pasted password have in code navicat make sure typed correctly.

I don't understand the Dojo documentation -

i'm beginner in dojo. first of javascript based? example create form have use javascript or html tags? also cannot understand documentation , tutorials. it's confusing. there proper website (other dojo itself) has tutorials? you can use dojo's components's (widgets) in 2 ways. programmatic , declaritive. programmatic way (what talking about) defining widgets through use of javascript. declaritive can define them using html markup. david walsh has nice short writeup , if search "declaritive programmatic dojo" you'll find questions , answers on matter: https://davidwalsh.name/dojo-widget difference between programmatically vs declaratively created widgets in dojo? declarative coding or programmatic coding in dojo projects? declarative or programatic approach in dojo? if you're having trouble tutorials on dojo website, suspect you're better off, first diving basic beginner javascript tutorials before trying learn framework dojo

javascript - Custom handlebars each helper with index -

i wrote helper loops on array, i'm stuck @ getting index available each iteration. wish in view print index of current item. helpers: { each_min: function(ary, min, options) { if(!ary || ary.length == 0) return options.inverse(this); var result = []; for(var = 0; < min; ++i) result.push(options.fn(ary[i])); return result.join(''); } } my template {{#each_min p.name 4}} {{#if this}} {{index}} {{this}} {{else}} <p>-</p> {{/if}} {{/each_min}} looking through handlebars docs found relevant info in block helpers section. block helpers can inject private variables child templates. can useful add information not in original context data. ... make sure create new data frame in each helper assigns own data. otherwise, downstream helpers might unexpectedly mutate upstream variables. based on made these changes: template : {{#each_min p.name 4}} {{#if this}} {{@index}} {{thi

html - Font Awesome icon in input placeholder not working -

i trying use font awesome icons in input placeholder. i tried not working. <body> <input type="text" placeholder="&#xf002;" style="font-family:fontawesome"/> </body> what’s wrong this? getting weird number in placeholder instead of icon. you can add font awesome icon <input type="text" placeholder="&#xf002" style="font-family:arial, fontawesome" /> you can check out fiddle fiddle click here

flash - Create text file using PHP and AC2 -

so have php code, actionscript code. when run flash file, doesn't want write. i've been searching hours solution online, not permissions. (note, not hosted on server, in folder on computer, issue?) php <?php $fscrn = $_post['fscrn'] $saveto = "full=".$fscrn."&" file_put_contents("video.txt",$saveto) ?> and actionscript 2 var videoresponse = new loadvars(); videoresponse.onload = function(success) { if (success) { trace("successful") } } var videovar = new loadvars(); videovar.fscrn = "true"; videovar.sendandload("config/video.php",videoresponse,"post"); bonus: image of file structure where swf located https://gyazo.com/918b0d9bcdb51996089b5d45846d1fd2 where php located https://gyazo.com/e758818fe895183b003e5b0fa5741abf anyone know solutions? (it print "successful" when run though) tl:dr > doesn't create new text file when php runs

c - Customize output of event auditing in FreeBSD -

i want customize output of event auditing in freebsd. read audit kernel , daemon code, , found auditd_gen_record function in /usr/src/contrib/openbsm/libauditd/auditd_lib.c , , think function generates event auditing records. since wanted make sure function function want, wrote simple function , call in auditd_gen_record function, sample function wrote didn't work reason! sample function is: void test_audit(void) { int fd; int flags = o_wronly | o_append; char * path = "/root/testoutputdata"; char * msg = "audit gen rec\n"; fd = open(path, flags); write(fd, msg, strlen(msg)); close(fd); } if think i'm in wrong place or function, or should manipulate else, please tell me. how can manipulate freebsd event auditing creating custom logfile? thanks!

reactjs - Element is removed after transitionLeaveTimeout - but how come not inserted after transitionEnterTimeout -

i have issue, animation 1 or 0 items of animation page - http://facebook.github.io/react/docs/animation.html#animating-one-or-zero-items my component shows message initially. when gets next message, fades out "leaving" element in 1second. because set transitionleavetimeout 1second well, element removed after fade out completes. however, set transitionentertimeout 1second (and tried 2second), however, "entering" element inserted first child on start of "leaving". how come "entering" element not inserted after transitionentertimeout ? there way make happen? the reason ask because if both present, "leaving" element gets shifted down line-height. can't css tricks -100% line height , others css bit complex. here copy paste eample shows issue: <html> <head> <script src="https://fb.me/react-with-addons-0.14.4.js"></script> <script src="https://fb.me/react-dom-0.

java - Prompting user for input until an empty line -

here main method cypher program. i'm trying modify code prompts user input until empty line submitted public static void main(string[] args) { scanner kb = new scanner(system.in); system.out.println("enter "); string message = kb.nextline(); system.out.println("enter encryption key: "); string key = kb.nextline(); int shift = integer.parseint(key); string encrypted = encrpyt(message, shift); system.out.println("encrypted: " + encrypted); string decrypted = decrypt(message, shift); system.out.println("decrypted: " + decrypted); } just use while loop. string line = kb.nextline() while (!line.equals("")) { (your code here) line = kb.nextline(); } the while loop break when user enters empty line.

css - Adsense Responsive not always displayed -

yup, 1 problem google adsense , responsive ads. added total of 3 ads site, 2 'horizontal' , 1 'auto'. created css classes them since adsense couldn't figure out width. .adsidebar { margin: auto; max-height: 600px; width: 302px; } .adcontent { margin: auto; width: 300px; @media #{$small-break} { width: 320px; } @media #{$large-break} { width: 730px; } } ads included using these classes. <div class="adcontainer"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle adcontent" style="display:block" data-ad-client="ca-pub-123456789" data-ad-slot="987654321" data-ad-format="horizontal"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div> about 50% of time 3 ads displayed correctly. however, i

mysql - Codeigniter Data Retrieve -

Image
here database structure same subject may have many teachers. first database teacher field foreign database. when searching individual subject how full teacher details. try this select * subject full outer join teachers on subject.teacher = teachers.id subject.subject '$search'; why full outer join ?? how in ci? $query = $this->db->query("select * subject full outer join teachers on subject.teacher = teachers.id subject.subject '$search' "); $result = $query->result_array(); return $result;

excel vba - Group rows by value -

Image
how programmatically group following data values in column b ? note, there random values in columns a , c . like this: --> try this sub demo() dim r range dim v variant dim long, j long activesheet on error resume next ' expand groups on sheet .outline.showlevels rowlevels:=8 ' remove existing groups .rows.ungroup on error goto 0 set r = .range("b1", .cells(.rows.count, 2).end(xlup)) end r 'identify common groups in column b j = 1 v = .cells(j, 1).value = 2 .rows.count if v <> .cells(i, 1) ' colum b changed, create group v = .cells(i, 1) if > j + 1 .cells(j + 1, 1).resize(i - j - 1, 1).rows.group end if j = v = .cells(j, 1).value end if next ' create last

objective c - How to make a curve in UITableView Section Header iOS 8 -

Image
i have made parallax view in there google map , table view. i using this parallax library. all want place curve image in section header make this. i have tried tableheaderview in case scrolled table view. then tried viewforheaderinsection . when reach @ top header become fixed , table scrolls. but issue can see cell behind curved image.

php - Success:1 still no notification in android -

i trying send push notification through gcm getting: { "multicast_id":4793018731783267982, "success":1, "failure":0, "canonical_ids":0, "results": [ { "message_id":"0:1452928098906665%a69ccee8f9fd7ecd" } ] } but still no notification coming. here code: //index.php code $app->get( '/notify',function () use($app) { $response = array (); $regid="device registration id"; //hard coded $message="hi everyone.this notify you" ; $registatoin_ids = array($regid); $message = array("price" => $message); $db = new dbhandler (); $result = $db->send_notification($registatoin_ids, $message); echorespnse ( 200, $result); } ); //dbhandler code public function send_notification($

how to delete files and folders -

how delete files or folders start 2015 , 2014? this have far, deletes files , folders under c:\temp folder @title = @echo on set folder="c:\temp" cd /d %folder% /f "delims=" %%i in ('dir /b') (rmdir "%%i" /s/q || del "%%i" /s/q) pause you use for loops walk through directory tree; for /r /d enumerates subdirectories recursively, , for /r returns files: pushd "c:\temp" /r /d %%i in ("2014*" "2015*") ( rmdir /q "%%~fi" ) /r %%i in ("2014*" "2015*") ( del /q "%%~fi" ) popd or let dir /b /s return items, files , directories, , parse output for /f loop: pushd "c:\temp" /f "eol=| delims=" %%i in (' dir /b /s "2014*" "2015*" ') ( 2> nul rmdir /q "%%~fi" || del /q "%%~fi" ) popd the 2>nul redirection avoids error messages returned rmdir , if current ite

javascript - EmberJS Data DS.JSONSerializer vs. DS.JSONAPISerializer -

i have emberjs project 2 model, both seams use different serializers. debugging inside emberjs data i've seen first model class of serializer "ds.jsonapiserializer" , other "ds.jsonserializer". both use same. i didn't override serializers , respective adapters empty , extend same adapter (generaladapter). the difference modela objects pushed ember server using request , adapter (using same adapter modelb) whereas modelb pushing store.pushpayload controller (without using adapter). is feature or bug or totally miss understanding something? edit: adapter code: app.applicationadapter = ds.adapter.extend(ds.buildurlmixin, { namespace: rabbit.common.baseurl + 'editor-jersey', defaultserializer: '-rest', headers: { accept: 'application/json' }, findall: function(store, type, sincetoken) { var adapter = this; var url = this.buildurl(type.modelname, null, null, 'findall');

java - Where to find the main layer.xml file in Netbeans RCP maven project? -

Image
i trying dev application based on netbeans rcp, far good, change default menu (hide menu don't want / need). i found have edit layer.xml, don't know find default one. i can create new layer.xml, module. any ? thanks. short answer: there isn't one, need create manually , modify liking. longer answer: there no 'default' layer.xml 'app'. keep in mind, nbp app platform + bunch o' modules. there no 'main' module. each module can have (single) layer.xml file (rather, each module have layer.xml file, albeit generated). @ run-time, platform (module system?) merges layer.xml files modules bundled app. layer xml no longer necessary introduction of annotations (i think thats reason, mistaken). nbp build generates layer.xml annotations in module's source files. after building module, can see in output directory 'generated-layer.xml'. creating xml layer file: right click on module in project tree , select new -&

hadoop - How to find the actual IP address of a Cent OS virtual machine? -

Image
hi, have installed cent os inside vm ware. want know ip address. when try find using "ifconfig" in terminal, showing local address(127.0.0.1). might issue? want know actual ip address. you can try ip s or ifconfig -a what see if address of localhost interface, seems vm doesn't have ethxxx of emxxx interface configured

html - The three-column layout conundrum, this time sans header and footer -

i know 1 of web 1.0 newbie questions, alas, in position asking myself. sites not necessitate sort of layout , looking @ doing 1 friend three-column layout, fixed-width center column...with twist of no header or footer box elements , stip 3 columns stretch height-wise fit size of screen on viewed. further exacerbating issue body have 1 color or background image , center column have own background color or image. visually, page layout such: +----------+---------------+----------+ |nothing |only content |nothing | |here |will here |here | |just |w/a different |just | |body b/g |background |body b/g | |color or |color or |color or | |image |image |image | | | | | | |all 3 columns | | | |always fill | | | |screen height | | +----------+---------------+----------+ i have read interesting arguments against absolute positioning (adobe forum

html - What does `//` in javascript's src attribute do? -

this question has answer here: is valid replace http:// // in <script src=“http://…”>? 12 answers can change http:// links //? 6 answers i'm using facebook's javascript sdk , has double forward slashes. mean? <script src="//connect.facebook.net/en_us/all.js"></script> i know single / means root directory, // ? telling source use http:// , path? this "protocol-relative" link. uses http or https depending on used load current page.

node.js - How to connect to gitHub api using nodejs from a secure network? -

i using below code repositories github. when use home network able retrieve list of repositories, if try fetch repo other network gives me error: 'connect econnrefused'. new nodejs, still wondering how go solving issue. any ideas? var https = require("https"); var username='xyz'; var options = { host :"api.github.com", path : '/users/'+username+'/repos', method : 'get' } var request = https.request(options, function(response){ var body = ''; response.on('data',function(chunk){ body+=chunk; }); response.on('end',function(){ var json = json.parse(body); var repos =[]; json.foreach(function(repo){ repos.push({ name : repo.name, description : repo.description }); }); console.log('the repos '+ json.stringify(repos)); }); }); request.on('error', function(e) { console.error('and error '+e); }); request.end();

How get large size album pictures of facebook? -

i using facebook graph api, using login user, user allow permission user_photos , graph api getting list of albums, list of pictures album id, pictures of thumbnail size 130x130. please give code hint large image of album's upload pictures. following code using access albums , pictures $albums = $fb->get('/me/albums', $accesstoken)->getgraphedge()->asarray(); foreach( $albums $album_id => $album_data ){ $fbpictures = $fb->get("/".$album_data['id']."/photos?fields=picture&limit=12&type=normal", $accesstoken)->getgraphedge()->asarray(); } $fbpictures variable getting arrays of pictures of album, has picture id , url of small thumbnail, can't access large size image. please guide me how possible? thanks lot

Does Firebase have a timeout policy for write operations? -

there setvalue( ) save data firebase. happens if connection very slow. there timeout limit saving data? if timeout, retry? if retries, how many times? also, there timeout reading method ondatachange(datasnapshot snapshot) , updating methods? is there way set own timeout limits? when client first connects firebase (so when executes first new firebase(...) , establishes websocket connection server. after data transferred on pre-established connection. when call setvalue() or write operation, command sent on open socket server. when client adds listener (with addvalueeventlistener() or similar), server send updates on open socket client. since there no connection being established, time-outs don't come play here. when connection between client , server somehow lost, client try re-establish connection. uses exponential back-off here, tries reconnect , progressively less frequently. while there no connection server, client keep serving data received in memory

Azure - Creating a queue keep returns "(400) bad request" -

i trying create new storage queue azure keeps crash without explanation, creating tables worked fine, relevant code: private cloudtable usertable; private cloudtable pettable; private cloudqueue healingqueue; public override bool onstart() { cloudstorageaccount storageaccount = cloudstorageaccount.parse(cloudconfigurationmanager.getsetting("connectionstring")); cloudtableclient tableclient = storageaccount.createcloudtableclient(); usertable = tableclient.gettablereference("users"); usertable.createifnotexists(); pettable = tableclient.gettablereference("pets"); pettable.createifnotexists(); // create queue: // cloudqueueclient queueclient = storageaccount.createcloudqueueclient(); healingqueue = queueclient.getqueuereference("healqueue"); healingqueue.createifnotexists(); // line

css - Get rid of lines in bootstrap dropdown navbar -

Image
does know how rid of these lines separating menu items? i've been looking under .dropdown-menu class in bootstrap css, can't find alter lines. the default nav bar drop down menu doesn't see example : https://getbootstrap.com/examples/navbar/ it may css file include in project cause effect

PHP DOM RemoveChild doesn't work -

i have following code: <?php $li = ('www.somesite.com'); $ht = file_get_contents($li); $dom = new domdocument(); libxml_use_internal_errors(true); $dom->loadhtml($ht); $divs = $dom->getelementsbytagname('section'); foreach ($divs $div){ if(preg_match('/\btresc\b/', $div->getattribute('id'))) { $chapter = $div->getelementsbytagname('div1')->item(0); $oldchapter = $div->removechild($chapter); echo $oldchapter; } } ?> i'm trying remove <div class="div1">.*</div> <section id="tresc">.*</section> however, following error: fatal error: call member function removechild() on non-object. know i'm doing wrong here? appreciated! don't include quotes in preg_match(), getattribute() give plain value without quotes: if(preg_match('/tresc/', $div->getattribute('id'

Scala: Dynamically generating match clauses for case classes -

i want use power of scala's pattern matching within set of `condition-action' rules. these rules not known in advance, rather generated @ runtime according complex critera. algorithmic generation mechanism can considered separate , not part of question, concerned how express via scala reflection/quasiquotes. concretely, i'm looking generate case definitions (of general form case v0@x(v1,_,v2): x => f(v1,v2) ) @ runtime. it presumably possible via toolbox.parse(str) string generated @ runtime. however, if possible seem desirable incorporate greater degree of type-safety this: more specifically, want case defs match against sealed case class hierarchy of terms ( term,var(name: char),lit(value:int),group(a: term,b: term,c: term) ). for example, generated case def in general, return function of none, or of v0,v1,v2: t match { case v0@group(v1@_,v2@var('a')) => group(v2,v0,group(v1,var('z'),lit(17))) // etc } i'm attempting fol

requiredfieldvalidator - required field validator not working row updating gridview -

hi here below code on gridview rowupdating event. why required field validator not working? if (string.isnullorempty(txtkmstart.text) && string.isnullorempty(txtkmend.text)) { requiredfieldvalidator rfvs = new requiredfieldvalidator(); rfvs.controltovalidate = txtkmstart.id; rfvs.errormessage = "km start required!"; requiredfieldvalidator rfve = new requiredfieldvalidator(); rfve.controltovalidate = txtkmend.id; rfve.errormessage = "km end required!"; validationsummary vs = new validationsummary(); vs.showsummary = false; vs.showmessagebox = true; } and gridview below <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" autogenerateeditbutton="true" backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth="

ios - UITableViewCell swipe change content with nib file -

Image
can ios uitableview change or populate different uitableviewcell object's content different .xib files, when user swipes, content change @ current swiped row. two ways: 1) recognize swipe uiswipegesturerecognizer.use uiscrollview in each cell , write logic based on swipe handler. 2) use gallery-like library. example, gbinfinitescrollview ( github

python - Sorting numpy lists -

i having troubles working numpy arrays new numpy. have big input read sys.stdin , consisted of lines 2 values , space between them, representing point or 2 coordinates. save in list looks this: np.array([[1, 3], [5, 6], [7, 2], [9, 9]]) i want sort list sums , x-coordinate, not sure how this. i not sure how add sum third element of each sublist, in case wanted add it. relying on python's built-in sorted inefficient numpy-arrays, when these big. try instead: import numpy np l = np.array([[1, 3], [5, 6], [7, 2], [9, 9]]) ind = np.lexsort((l[:,0], l.sum(axis=1))) sorted_l = l[ind] ind contain indices of original array, sorted 2 arrays given lexsort . last array primary sort column lexsort . l[ind] selects these indices original array.

php - (Needle, Haystack) with 2 arrays, confused -

have been trying figure out simple problem 3 days , don't understand why function removes of values, leaves others in place. this function checks list of bad domains against list of domains, if finds bad domain, removes domains list. here's code: // check each bad domain, against each array in array list $bad_domains = array('youtube.com', 'facebook.com', 'google.com', 'twitter'); $good_domains = array( 'http://www.wufoo.com/', 'https://plus.google.com/u/0/b/105790754629987588694', 'http://studioduplateau.com/ss=', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=tic-toc', 'http://twitter.com/?lang=ka-boom', 'http://twitter.com/?lang=ka-boom', 'la

c# - The entity type ApplicationUser is not part of the model for the current context after swapping server from local to external -

i have error after transfer whole data local external server. both databases have same tables etc. how fix this? work correctly before change server local external. data different register or login adding correctly. connecton string <add name="defaultconnectionentities" connectionstring="metadata=res://*/models.biuromodel.csdl|res://*/models.biuromodel.ssdl| res://*/models.biuromodel.msl; provider=system.data.sqlclient; provider connection string=&quot; data source=db-mssql;initial catalog=inzs9776; persist security info=true;user id=inzs9776; password=xxxxx&quot;" providername="system.data.entityclient" /> defaultconnectionentities class public partial class defaultconnectionentities : dbcontext { public defaultconnectionentities() : base("defaultconnectionentities") { } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { throw n

Why does Collections.sort(List) work in Java 8 with CopyOnWriteArrayList but not in Java 7? -

i can sort list of users without problems using following code , java 8: copyonwritearraylist<user> allcurrentloginneduserslist = new copyonwritearraylist<>(); collections.sort(allcurrentloginneduserslist); now, changed java 7 , saw no errors on eclipse. now, when running under java 7 got error: java.lang.unsupportedoperationexception @ java.util.concurrent.copyonwritearraylist$cowiterator.set(copyonwritearraylist.java:1049) @ java.util.collections.sort(collections.java:221) @ com.fluent.user.sortallcurrentloginnedusers(user.java:446) how fix it? there change between java 7 (and version of java 8) , java 8u20 in way collections.sort work ( issue 8032636 , noted holger ). java 7 collections.sort(list, c) specifies that: this implementation dumps specified list array, sorts array, , iterates on list resetting each element corresponding position in array. avoids n² log(n) performance result attempting sort linked list in place. l

angularjs - Angular $HTTP returns 404 in PhoneGap (works in browser) -

i trying login in angular app packaged using phonegap build. when run app in browser works fine , can login using api call remote server (so no server cors issues). when try use same code in phonegap app 404 response server phonegap request/response request url:http://budget.expectbrilliant.com/auth/local request method:post status code:404 not found404 not found request payload {"email":"ben@cogiva.com","password":"nebjam2n"} response headers client-via:shouldinterceptrequest browser request/response: request url:http://budget.expectbrilliant.com/auth/local request method:post status code:200 ok remote address:46.101.93.76:80 response headers access-control-allow-origin:* connection:keep-alive content-length:184 content-type:application/json; charset=utf-8 date:sat, 16 jan 2016 12:50:08 gmt vary:accept-encoding x-powered-by:express request headers accept:application/json, text/plain, */* accept-encoding:gzip, deflate accept-lang

Solving a pde in Matlab using Finite element method -

i trying solve pde in 1 dimension in matlab using finite element method. please me in solving. equation u,t + e*u,tt = u,yy here u,t means partial derivative of u w.r.t. t. u,tt means double partial derivative of u w.r.t. t. u,yy means double partial derivative of u w.r.t. y. boundary conditions u=1 @ y=0, u=0 @ y=1, initial condition: u= u,t=0 @ t=0. e= 0.01. --------------------------------------- e can take value between 0.01 0. user input value of e.

reactjs - React Redux Starter Kit with hot reloading and backend server -

i starting learn react redux , use https://github.com/davezuko/react-redux-starter-kit starter project journey. its clean, simple , build little bigger now. need backend server. have 1 written in express , been using angular app. cannot wrap head around how should make work starter kit. using koa running on port 3000 hot-reloading functionality , cant make 2 (hot-reloading/api) work @ same time. experienced should easy plug of simple express server 1 route running on port 3000 should able figure out rest. i share code have none because dont know start. there many plugins/moving parts need understand makes head spin:) plan start working on project using of , learn along way. there starter kits here , including few backend part implemented. suggest take different , try them out. imho, best way lear take simplest boilerplate , expand step-by-step ))

angularjs - Spring Security + Angular JS + Spring MVC Rest -

i trying build web application following frameworks: angular js on front end rest web services in backend using spring mvc i want use spring security authenticate requests going angular js spring rest web services. need manage session timeout/remember password etc. (all of typical functionalities of login functionality in web app) i have gone on hundreds of articles trying find out how none of them serving purpose asking for. any on (inline answer or external links) detailed steps highly appreciated. (note: don't want use spring boot. many tutorials including 1 provided spring using spring boot.) finally found way this. explained, step step process secure spring mvc based rest apis using spring security https://malalanayake.wordpress.com/2014/06/30/stateless-spring-security-on-rest-api/

javascript - Not insert but upsert if document is not found -

what need check if company did not add name insert company name else update company name. in project, user after registration can complete profile completly. when user fills "company name" input , clicks save button, company name should added list of companies, if user changes name of company, should changed list of companies. here code user form html: <template name="userformedit"> <form class="form new-company"> <div class="form-group"> <label for="companyname">comapany name</label> <input type="text" class="form-control" name="companyname" id="companyname" placeholder="" value="{{companyname}}"> </div> </form </template> <div class="container-fluid text-center bg-grey"> <h2>portfolio</h2> <h4>what have created</h4> <div class=

How to change the color of Listitems in Jquery Mobile? -

i trying change background color of list items in jquery mobile on button click adding css class list items not working here fiddle of work kindly me fix issue. fiddle function changelistbackground(){ $("#samplelist li").addclass("selectedli"); } the code have on jsfiddle button? no css? ensure div button located in has id "samplelist". you should remove current class when adding new class, presume new css wish use located in css file , targets class "selected li". you should switch classes add or remove functionality , can use built in functions of jquery following. $("#samplelist li").css("background-color", "yellow"); or multiple styles use $("#samplelist li").css({"background-color": "yellow", "font-size": "200%"}); you should read book or 2 how use jquery if wish use successfully. sean

rails subclass not found when trying to locate a specific phrase in a db table -

i'm trying make page show results in table have word ford inside type column. heres have controller: def type @type = brand.where(type: "ford") end and in view have: <% @type.each |t| %> this returning error on line above, the single-table inheritance mechanism failed locate subclass: 'ford'. error raised because column 'type' reserved storing class in case of inheritance. please rename column if didn't intend used storing inheritance class or overwrite brand.inheritance_column use column information. why getting error , how go fixing it? sam edit @type = brand.where(car_type: "ford") type reserved keyword in rails models. you can refer reserved keywords here . it work, if change column name type else

c# - Resize existing image in DocX using OpenXML sdk -

got template docx image placeholder replaced correct picture. private void setimagepartdata(imagepart imagepart, byte[] data) { if (imagepart != null) { using (var writer = new binarywriter(imagepart.getstream())) { writer.write(data); } } } but preserves placeholder size. how change actual image size? byte array aqquared image on server, size known. if mean content control placeholder can use following code once needed: //get sdtelement (can block, run... use base class) corresponding tag sdtelement block = doc.maindocumentpart.document.body.descendants<sdtelement>() .firstordefault(sdt => sdt.sdtproperties.getfirstchild<tag>()?.val == contentcontroltag); //get first drawing element , original sizes of placeholder sdt //i use sdt placeholder size maximum size calculate picture size correct ratios drawing sdtimage = block.descendants<drawing>().first(); double sdtwidth = sdtimage.inline.extent.cx

javascript - Set image in mobile angular ui website -

Image
i implement mobile website. using mobileangularui framework mobile website. want set image in home.html, not set image image folder.if put url of image exist in server works. show screen shot of code snippet. existing output: home.html <style> .bgimage { background-image: url('http://www.electricshop.com/editordocs/image/ourtopgiftideas231215_978x400.png'); height:330px; background-position: center center; } </style> <div class="jumbtron scrollable-content"> <div class="bgimage"> </div> <img src="../images/clocks.jpg"> <img src="http://1.bp.blogspot.com/-nfififmg8sa/ti0xrnqb4oi/aaaaaaaadno/fb_2wyqbiv4/s1600/silence-between-two-people.jpg"> </div> index.html <!doctype html> <html> <head> <meta charset="utf-8" /> <title>y</title> <meta http-equiv="x-ua-compatible" content="

javascript - Standard Full Screen Quad Setup not Working in Three.js -

i'm trying establish full screen quad using pass thru vertex shader in three.js. quad plane geometry dimension (2, 2) located @ origin. assigned shadermaterial. camera @ z = 1 aiming @ quad. the shaders quite simple: vertex shader: void main() { gl_position = vec4( position, 1.0 ); } fragment shader: void main() { gl_fragcolor = vec4(0.0, 1.0, 0.0, 1.0); } but nothing shows on screen. setup standard way of render-to-texture, why not working in three.js? i've tried plane.frustumculled = false , changing clip planes of camera no avail. any appreciated. upon further investigation, reason not seeing rendering result more involved , pointing odd behavior in three.js. i using planegeometry rotation matrix applied, wrapped object3d counter rotation. var geometry = new three.planegeometry(2, 2); var m4 = new three.matrix4().makerotationx(math.pi * 0.5); geometry.applymatrix(m4); var mesh = new three.mesh(geometry, material); var obj = new three

android - Border around transparent button -

Image
i trying create border round corners on transparent button this: here transparent.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/blue" android:state_pressed="true"/> <item android:drawable="@android:color/transparent"/> </selector> try this <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item><shape> <stroke android:width="1dp" android:color="#000000" /> <solid android:color="@android:color/transparent" /> <corners android:bottomleftradius="4dp" android:bottomrightradius="4dp" android:topleftradius="4dp&q

javascript - Is NodeJS required for a build Electron App? -

i have created own app using electron , built using electron-packager .app file. of course on mac — with nodejs installed — works. wonder if work if sent app friend doesn't have nodejs installed. question is: is nodejs required run packaged electron app? thank you! if you've packaged app correctly able send friend (you need zip / dmg app because contains symlinks). friend not need install electron nor node beforehand -- should packaged (including node modules).

c++ - Iterate over boost::shared_array -

how iterate on items in boost::shared_array ? get() on , use raw pointer iterator? since you're using boost, maybe this: #include <boost/shared_array.hpp> #include <boost/range.hpp> #include <iostream> int main() { boost::shared_array<int> arr(new int[10]()); int* ptr = arr.get(); (int : boost::make_iterator_range(ptr, ptr+10)) { std::cout << << ','; } } in case, need own bookeeping of array's size.

c - in strtok how to use char* as a arguement -

in program, allocating dyanamic memory variable buffer of type 'char *' using malloc. if using strtok(buffer,"+"); giving segmentation fault. got reason stackoverflow , same problem stackoverflow . neither post giving me desired solution. can't use static memory or array type according program. my problem in strtok, in arguements if use char array working , when use char * give error. how use char * in strtok arguements. char *buffer; int len; connection_t * conn; long addr = 0; file *fptr; if (!ptr) pthread_exit(0); conn = (connection_t *)ptr; const char *s = "+"; char *token; /* read length of message */ read(conn->sock, &len, sizeof(int)); if (len > 0) { addr = (long)((struct sockaddr_in *)&conn->address)->sin_addr.s_addr; buffer = (char *)malloc((len+1)*sizeof(char)); buffer[len] = 0; /* read message */ read(conn->sock, buffer, len); printf("%s , %d \n",buffer, addr); /* first token */ token = strtok(buff

smallbasic - small basic reset shape position after it got out of the screen -

please help!!!! i'm having little problem small basic i wanted make little game ufo has avoid asteroids, , made asteroid , animated it, , wanted make y position go 0 wen passed screen.. meteimg = "c:\users\user\desktop\meteo.png" meteorite = shapes.addimage(meteimg) meteoritex = math.getrandomnumber(graphicswindow.width) shapes.move(meteorite, meteoritex, 0) shapes.animate(meteorite, meteoritex, graphicswindow.height,math.getrandomnumber(2000)) and should add like if meteorite's y position > graphicswindow.height shapes.move(meteorite, meteoritex, 0) endif you shouldn't using shapes.animate this. can't position of object while moving. here code astroids: numastroids = 10 = 1 numastroids astroid[i] = shapes.addellipse(20,20) astroidx[i] = math.getrandomnumber(graphicswindow.width-20) astroidy[i] = -math.getrandomnumber(graphicswindow.height) astroidspeed[i] = math.getrandomnumber(4) + 1 '<- min speed 1 endfor while 1 = 1 pro

android - How to stop an animation -

i have created animation (by below code) of bouncing ball. i wanted know how stop animation on particular condition, after 10 seconds or when ball reaches @ particular coordinates. the code: public class mydemoview extends imageview{ private context mcontext; int x = -1; int y = -1; private int xvelocity = 10; private int yvelocity = 5; private handler h; private final int frame_rate = 30; public mydemoview(context context, attributeset attrs) { super(context, attrs); mcontext = context; h = new handler(); } private runnable r = new runnable() { @override public void run() { invalidate(); } }; protected void ondraw(canvas c) { bitmapdrawable ball = (bitmapdrawable) mcontext.getresources().getdrawable(r.drawable.ball); if (x<0 && y <0) { x = this.getwidth()/2; y = this.getheight()/2; } else {

Python multiple regex matching in a single statement -

i have large python string shown below. large_string = "the mit license (mit)\n\ncopyright (c) [year] [fullname]\n\npermission hereby granted, free of charge, person obtaining ...." i want replace "[year]" in string current year , "[fullname]" user provided name. using re library in python task. import re import datetime def pattern_replace(large_string, name): year = datetime.now().year large_string = re.sub('\[year\]', str(year), large_string) large_string = re.sub('\[fullname\]', name, large_string) return large_string but think it's not appropriate way. have never used regex matching before think there should more pythonic way combine 2 re.sub statements. the task simpler if 2 regular expressions, rather one. if combine them one, make more fragile (i.e. dependent on ordering of 2 things), , regular expression needs more complex. you like: large_string = re.sub('\[year\](.*?)\[fullname\