Posts

Showing posts from January, 2014

ruby on rails - mongodb unable to create/save double-byte languages -

i have model called review.rb class movienews::review include mongoid::document include mongoid::timestamps include mongoid::userstamp include mongoid::search field :story, type: string end when create instance of class review , tried saving local language telugu in field, im getting wrong output. ex1: review = movienews::review.new review.story = "నటవర్గం" after pasting here it's spelling goes worng "నటవర్.." review.save => true does mongodb supports local languages create collection? please me out. kumar try this review.story = "నటవర్గం\" after pasting here it's spelling goes worng \"నటవర్.." looks breaking both moments when use quotation marks without backslash

jquery - Making a variable in Javascript from AJAX return Value -

i scanned lot of pages here didn't find answer. i'm new php , javascript , seeking create variable (for comparison purpose) jquery return value. i'm creating registration system use check username availability: $(document).ready(function() { $("#username").keyup(function (e) { //removes spaces username $(this).val($(this).val().replace(/\s/g, '')); var username = $(this).val(); if(username.length < 2){$("#user-result").html('');return;} if(username.length >= 2){ $("#user-result").html('<i class="fa fa-refresh fa-spin"></i>'); $.post('core/check_username.php', {'username':username}, function(data) { $("#user-result").html(data); }); } }); }); i can display return value in span form validation purpose, need compare return value set of criteria. can please...

android - How to make a circular progressBar like telegram? -

Image
i want determinate circular progress bar telegram android app cant find in project sources. and rotating update: using material progress not rotate in determinate mode, want rotate while loading... telegram app. create rotate.xml in res/anim folder: <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1600" android:fromdegrees="0" android:interpolator="@android:anim/linear_interpolator" android:pivotx="50%" android:pivoty="50%" android:repeatcount="infinite" android:todegrees="360" /> load anim , run in code: view.startanimation(animationutils.loadanimation(activity, r.anim.rotate));

java - Using dynamic Wicket-Resources the right way -

i'm trying create simple application based on wicket. want place panel on page indicates if user logged in. sadly, unable find working example of problem: want label display username if logged on , message, if no user logged on. guess i'm missing something. here comes code: panel: public class header extends panel { imodel<stringresourcemodel> usernamemodel = new loadabledetachablemodel<stringresourcemodel>() { @override protected stringresourcemodel load() { final user user = mysession.get().getauthenticateduser(); if (user==null){ return new stringresourcemodel("username.nouser", header.this , null); }else{ return new stringresourcemodel("username.user", header.this, model.of(user)); } } }; public header(final string id) { super(id); } @override protected void oninitialize() { super.oninitialize(); add(new label("username", usernamemodel)); ...

javascript - Opening pdf in new tab using a png image with jspdf works in Mozilla, but not Chrome or Internet Explorer -

i create flot graph on html website , want able export pdf (on click of button) should open in new tab, people decide if want download computers or not. i started jpeg , working fine, background appears black because of transparency issues, changed png. after code crashes chrome browser, or opens new empty tab! same internet explorer... in mozilla seems work fine. saving pdf file rather opening in new window works perfect in browsers, i'd rather not fill people's download folders junk may not want. i created fiddle reproduce issue: http://jsfiddle.net/8tlt9yof/10/ jquery code inside "get pdf" button reads (plot name of flot graph): var canvas = plot.getcanvas(); var src = canvas.todataurl("image/png"); var doc = new jspdf('landscape'); doc.addimage(src, 'png', 10, 20, 280, 150); doc.output('dataurlnewwindow'); can me see i'm doing wrong?

haskell - RethinkDB: convert ReQL to an Integer type -

cannot figure out how convert reql type i insert document , result object "errors" key. need see if 0 or not? so simple function this: saveperson :: handler () saveperson = let load = fromjust . extract ["data", "attributes"] doc <- load <$> jsonbody' res <- rundb $ table "articles" # insert doc if (res r.! "errors") == 0 setstatus status204 else setstatus status500 this obveously not compile gives example of want. need convert reql integer comparison. how convert types reql haskell types? thanks edit apologies not providing data types. import web.spock (runquery) import database.rethinkdb.noclash rundb :: (result a, expr q) => q -> handler rundb act = runquery $ \hdl -> run hdl act rundb' :: expr q => q -> handler datum rundb' act = runquery $ \hdl -> run' hdl act edit2 thank atnnn answer first example works. still cannot figure out reql conversion. b...

Git uncommited changes not commitable -

i have weird file after last pull marked not committed , cannot commit it. seems file renamed contactnamefilter.ts -> contactnamefilter.ts on remote. $ git status on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: app/scripts/filters/contactnamefilter.ts no changes added commit (use "git add" and/or "git commit -a") $ git commit -a on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: modified: app/scripts/filters/contactnamefilter.ts no changes added commit $ git add -a $ git commit on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: modified: app/scripts/filters/contactnamefilter.ts no change...

Ordered associative arrays in bash -

i can following in bash : declare -a data data[a]="aaa" data[c]="ccc" data[b]="bbb" in "${!data[@]}" ; printf "%-20s ---> %s\n" "$i" "${data[$i]}" done which outputs: a ---> aaa b ---> bbb c ---> ccc that is, associative array reordered (i assume using lexicographic ordering on keys, not sure), , loses original order in created data. wanted instead: a ---> aaa c ---> ccc b ---> bbb in python use ordereddict instead of plain dict that. there similar concept in bash? as answered, associative arrays not ordered. if want ordering in array, use below work-around. declare -a data data_indices=() data[a]="aaa"; data_indices+=(a) data[c]="ccc"; data_indices+=(c) data[b]="bbb"; data_indices+=(b) in "${data_indices[@]}"...

javascript - Can't use chained locator in protractor -

i need test 2 textboxes. here's page view: <div class="wrap-ctrl ng-scope" ng-switch-when="input"> <input type="text" name="surnameinput" class="text-field ng-pristine ng-isolate-scope ng-pending ng-touched" data-ng-class="::surnamefeature ? 'box-ctrl_tooltip' : ''" placeholder="input surname" data-ng-model="input.surname" ng-model-options="{updateon: 'blur'}" data-input-type="fio-surname" data-dts-input="" data-ng-disabled="$root.isdisabled(prefix + 'surnameinput')" data-validator="restrictvalue, required, percentcyrillic=50" data-message-id="surnameerrors" data-warning="istruegendersurname" data-warning-id="surnamewarnings"> <!-- ngif: ::surnamefeature --> <!-- ngif: ::surnamefeature --> ...

php - Display subheading with excerpt -

i want display subheading , excerpt of blog post <?php { the_subheading(); the_excerpt(); } ?> when used above code displays subheading, follwed <p> , followed excerpt() . want remove <p> . possible? there other way? i found answer. <?php echo get_the_excerpt(); ?> instead of <?php the_excerpt(); ?> solved problem. hope useful someone!

Trouble using Functions for Hangman game in C -

i trying make hangman gave using c functions. able make game without using functions when try use functions running few problems. the main problem having in displayword() function. need function print out word screen letters have not been correctly guessed blanked out underscore. ~header fiiles #include <stdio.h> #include <stdlib.h> #include <string.h> /* constants. */ #define num_words 50 #define alphabet_size 26 #define good_guess 0 #define bad_guess 1 #define game_over 1 #define game_continue 0 #define max_guess 10 #define max_word_len 10 /* function prototypes. */ int init(char* word); void displayword(char* word, int* guessedletters, int* length); int guessletter(char* word, int* guessedletters); void displayhangman(unsigned wrongguesses); int isgameover(char* word, int* guessedletters, unsigned wrongguesses); void readrestofline(); ~main code #include "hangman.h" /************************************************************************...

php - $_POST Array = 0 after submit -

Image
on submit,i send form-data " log-reg-redirect.php " and when submit form returned error. i've checked many times don't know why problem occurred anybody me :((

Is that possible sharing one webroot for multiple cakephp app? -

i have 2 php applications. 1 main , 1 admin app. admin upload contents on folder , other app can fetch it. problem files stored in folder like: /home/user/files/... and must fetched both of application. to simplify admin can upload file /home/user/files/ , can see /home/user/files/ , applications stay on /var/html/.. can done without symbolic links? i suggest use virtualhosts configuration( example ). can keep data in folder changing documentroot <virtualhost *:80> documentroot /folder/whatever/you/want servername www.subdomain.example.com # other directives here might want allow single ip admin user options indexes multiviews followsymlinks allowoverride none order deny,allow deny allow your_ip </virtualhost> www.subdomain.example.com serve files uploaded(by admin app) in webroot(via http). can change upload point of cakcphp application bootstrap uploads variable. try way or admin routing usual method.

Unable to run Android - DeviceReady in cordova -

i unable run android's device ready function (not getting fired). how fix it? have target sdk 22 , cordova 5.1.1 , android studio 1.0.1. my index.html: <!doctype html> <html> <head> <title>device ready example</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> </head> <body onload="onload()"> </body> </html> index.js: function onload() { document.addeventlistener("deviceready", ondeviceready, false); } // device apis available // function ondeviceready() { window.addeventlistener("batterystatus", onbatterystatus, false); } // handle batterystatus event // function onbatterystatus(info) { console.log("level: " + info.level + " isplugged: " + info.isplugged); } and logged : console.log("level: " + info.level + " isplugged: " + info.isplugged); if ...

java - TestNG custom reporting for webservice (soapUI) -

i have soapui project can kicked off java testng.xml. have numerous assertion each steps. if run project testng, shows if passed or failed. debug this, have manually run testsuite in soapui. what set custom report can following. report should contain: - duration run each testcase - each step, soap request did send - soap response i found this: http://elekslabs.com/2015/02/make-the-most-of-your-test-report.html i tried use atu looks using selenium. use maven, testng, java code, , soapui. any appreciated. thanks gv testng providing need duration via logging reporter . testng providing api add want report too. what need find how can catch request/response soap.

Getting Roster from XMPP in Swift -

hi new iphone development , don't know in objective c. developing application using swift. added xmpp framework in project , xmpp connection successful. using following code set connection func setupstream () { xmppstream = xmppstream() xmppstream!.adddelegate(self, delegatequeue: dispatch_get_main_queue()) xmppreconnect = xmppreconnect(); xmpprosterstorage = xmpprostercoredatastorage(); xmpproster = xmpproster(rosterstorage: xmpprosterstorage); xmppvcardstorage = xmppvcardcoredatastorage.sharedinstance(); xmppvcardtempmodule = xmppvcardtempmodule(withvcardstorage:xmppvcardstorage); xmppvcardavatarmodule = xmppvcardavatarmodule(withvcardtempmodule:xmppvcardtempmodule); xmppcapabilitiesstorage = xmppcapabilitiescoredatastorage.sharedinstance(); xmppcapabilities = xmppcapabilities(capabilitiesstorage: xmppcapabilitiesstorage); // set xmpp modules xmpproster!.autofetchroster = ...

dll - c++ sqlite3_prepare_v2 is not working -

this first post excuse me if forget add information, or english mistakes. i working in c++ code:block(13.12) making dll of sqlite3 functions , using mingw toolchain. (windows 7) i using sqlite3_exec function want change sqlite3_prepare_v2 , sqlite_bind , sqlite3_step , etc because think easy return params. however, after calling new function program written in c++, crash giving me error: nombre del evento de problema: appcrash nombre de la aplicación: sql_try.exe versión de la aplicación: 0.0.0.0 marca de tiempo de la aplicación: 5594a5af nombre del módulo con errores: sqlite3.dll versión del módulo con errores: 3.8.10.2 marca de tiempo del módulo con errores: 555cd28a código de excepción: c0000005 desplazamiento de excepción: 0001ee21 versión del sistema operativo: 6.1.7601.2.1.0.768.3 id. de configuración regional: 3082 información adicional 1: 0a9e información adicional 2: 0a9e372d3b4ad19135b953a78882e789` informac...

php - Query did not want to execute -

why query didn't want execute ? can code. time, taking many time resolve this. here code : edited $nim = $_get['nim']; $conn = mysqli_connect($hostname_localhost,$username_localhost,$password_localhost, $database_localhost) or die(mysqli_error($conn)); $query = "select nama_user1,kelas,jurusan user1 kode_user1 = '".$nim."'"; $query_exec = mysqli_query($conn, $query) or die(mysqli_error($conn)); if($data = mysqli_fetch_array($query_exec)) { $kelas = $data['kelas']; $jurusan = $data['jurusan']; $nama = $data['nama']; echo $nama; } while run in mysql , show result query. when execute query didn't show when i'm echo it. please me. quick answer $nama = $data['nama']; should $nama = $data['nama_user1']; longer answer $query = mysql_prepare($conn, "select nama_user1, kelas, jurusan user1 kode_user1 = ?"); mysqli_stmt_bind_param($query, "i", $...

excel - VBA - Runtime Error 438 -

i using vba automate mailmerge 3 cases : please see code below : (1) need generate certificates based on each worksheet. (2) certificate name should "last thursday" & "aaa" / "bbb" / "ccc" (based on worksheet) respectively. eg. 25062015aaa.docx (for sheet1), 25062015bbb.docx (for sheet2), , 25062015ccc.docx (for sheet3) respectively. however currently, code either saving 1st generated mailmerge under different names. or throws runtime error: 438 - object required error , when code below. kindly tell me i'm going wrong? thank help, always! public function lastthurs(pdat date) date lastthurs = dateadd("ww", -1, pdat - (weekday(pdat, vbthursday) - 1)) end function sub generate_certificate() dim wd object dim integer dim wdoc object dim fname string dim ldate string dim strwbname string const wdformletters = 0, wdopenformatauto = 0 const wdsendtonewdocument = 0, wddefaultfirstr...

batch file - How to make %random% show up a negative result? -

i'm making game there stocks, , want them able go negative, know how limit positive random numbers, how %random% make negative value? and, making %random% generate negative numbers possible? to produce random number in range minrand maxrand use set /a selection=%random% %% (%maxrand% - %minrand% + 1) + %minrand% here's sampler : change values assigned minrand , maxrand test: @echo off setlocal set /a minrand=-3 set /a maxrand=3 /l %%a in (1,1,20) call :genshow goto :eof :genshow set /a selection=%random% %% (%maxrand% - %minrand% + 1) + %minrand% echo %selection% goto :eof

How to exclude jersey 1.x dependencies when running tests with gradle -

we have web service project relies on netflix's eureka , has dependency on jersey client 1.x. our project using gradle , in project have our src, unit, integration, , functional tests. our functional tests have jar import in testcompile gradle section wraps jersey client send requests web service. now question how can netflix jersey client dependency ignored in testcompile can use new jersey 2.x client functional tests? build scripts below: main service build script excerpt: dependencies { compile 'com.netflix.eureka:eureka-client:1.1.97' compile 'com.sun.jersey:jersey-bundle:1.18' testcompile 'some.domain:service-test-client:1.0.1' } service test client relevant parts: dependencies { compile 'org.glassfish.jersey.core:jersey-client:2.19' compile 'org.glassfish.jersey.connectors:jeresey-apache-connector:2.19' } relevant parts of eureka client gradle script github: ext { githubprojectname = 'eureka...

computer vision - Detecting objects and then computing pose of object/camera in OpenCV -

assuming there 2 cameras in 3d space, spaced apart, looking @ same scene. trying achieve following through opencv: (please correct me if approach wrong) camera1 fixed, looks @ object, computes pose of object through solvepnp. camera2's position noisy, there's noise in terms of both rotation , translation. looks @ same object, , computes pose @ every frame. frame-by-frame, solve pose of moving camera , use info stabilizing it. is possible detecting generic planar object in scene (not checkerboard), , using pose estimation? pointers or suggestions helpful. thanks, sai regardless of whether object checkerboard or not, need way reliably map 3d points (on object), 2d ones (on images). with setup describe, can pose of moving camera w.r.t fixed 1 object object-to-fixed * inverse(object-to-moving). work if object w.r.t either camera, provided cameras synchronized.

python - getattr and setattr on nested objects? -

this simple problem hopefuly easy point out mistake or if possible. i have object has multiple objects properties. want able dynamically set properties of these objects so: class person(object): def __init__(self): self.pet = pet() self.residence = residence() class pet(object): def __init__(self,name='fido',species='dog'): self.name = name self.species = species class residence(object): def __init__(self,type='house',sqft=none): self.type = type self.sqft=sqft if __name__=='__main__': p=person() setattr(p,'pet.name','sparky') setattr(p,'residence.type','apartment') print p.__dict__ the output is: {'pet': < main .pet object @ 0x10c5ec050>, 'residence': < main .residence object @ 0x10c5ec0d0>, 'pet.name': 'sparky', 'residence.type': 'apartment'} as can see, rather having n...

Validation backend with get Google Token on android -

i have problem when try google token in android balidation backend. create web application client id (i use http://localhost in url paths), android client id, , use code: public class googleoauthtask extends asynctask<void, void, string> { private static final string tag = googleoauthtask.class.getsimplename(); activity mactivity; string memail; private final static string scope = "audience:server:client_id:xxxxxxxxxxxxxxxxxxxaaaaaxxxxxxxxxxx.apps.googleusercontent.com"; public googleoauthtask(activity activity, string email) { this.mactivity = activity; this.memail = name; } @override protected string doinbackground(void... params) { string accountname = "myrandomvalidemail@gmail.com"; account account = new account(accountname, googleauthutil.google_account_type); string scopes = "audience:server:client_id:xxxxxasasxxxxx.apps.googleusercontent.com"; // web application client id try { return googleauthutil.g...

ruby on rails - Removing a validation at runtime -

below can add validation @ runtime mongoid: class abc include mongoid::document field :something, type: string end = abc.new a.valid? => true abc.class_eval validates_presence_of :something end => [mongoid::validatable::presencevalidator] b = abc.new => #<abc _id: 55948e466d616344a4010000, something: nil> b.valid? => false how remove validation? if possible, assume same both activerecord , mongoid. i'm looking this: abc.class_eval remove_validates_presence_of :something end i think you'll find want in blog post: http://gistflow.com/posts/749-canceling-validations-in-activerecord basically, validators information in class variable _validators , , can call skip_callback cancel it. should able remove with validators = abc._validators[:something] v = validators.first validators.delete v filter = abc._validate_callbacks.find { |c| c.raw_filter == v }.filter skip_callback :validate, filter

javascript - Typescript array map vs filter vs? -

here's typescript method wants walk through array of strings, , return array of strings, where, strings match regexp (formatted "[la la la]" become "la la la" , strings don't match dropped. if input array is: "[x]", "x", "[y]" it becomes "x", "y" here's code: questions(): string[] { var regexp = /\[(.*)\]/; return this.rawrecords[0].map((value) => { console.log(value); var match = regexp.exec(value); if (match) { return match[1]; } }); } i end output this: "x", undefined, "y" because of "if (match)". what's right typescript/javascript way of writing code? just filter them out: return this.rawrecords[0].map((value) => { console.log(value); var match = regexp.exec(value); if (match) { return match[1]; } }); }).filter(x=>!!x); ...

javascript - jssor onclick open larger version -

is possible using jssor click on photo in slideshow , on click make open larger photo (responsive/mobile-friendly), e.g. in popup? currently i'm using following code: <script> jquery(document).ready(function ($) { var _slideshowtransitions = [{ $duration: 500, $opacity: 2, $brother: { $duration: 1000, $opacity: 2 } }]; var options = { $fillmode: 1, $dragorientation: 3, $autoplay: true, $autoplayinterval: 5000, $slideshowoptions: { $class: $jssorslideshowrunner$, $transitions: _slideshowtransitions, $transitionsorder: 1, $showlink: true } }; var jssor_slider1 = new $jssorslider$('artikelphoto', options); }); </script> <div u="slides" style="position: absolute; overflow: hidden; left: 0px; top: 0px; width: 200px; height: 200px;"> ...

java - How to add submenu to MenuItem -

Image
i'm trying add submenu menuitem exists in popup menu in system tray. there way achieve this? i've found solutions submenus use jmenuitem , , trayicon accepts popupmenu accepts menuitem s. trying achieve menuitem : a jmenuitem doesn't support submenus, need use jmenu (add jpopupmenu ). see how use menus more details for example... jpopupmenu popupmenu = new jpopupmenu(); jmenu devicemenu = new jmenu("add device"); devicemenu.add(new jmenuitem("add more...")); popupmenu.add(devicemenu); popupmenu.add(new jmenuitem("delete device")); popupmenu.add(new jmenuitem("fire")); popupmenu.add(new jmenuitem("fault")); popupmenu.add(new jmenuitem("supress")); (obviously, you'll still need plugin functionality of this) and trayicon accepts popupmenu accepts menuitems. there's trick, have cheat little, take @ how popupmenu show when left-click on trayicon in java? example

Replicate rows based on id number in R -

i have dataframe ( mydf1 ) serial number(in serial column) repeated. want replicate rows in dataframe ( mydf2 ) based on number of counts serial appear in mydf1 , result table. thank help! mydf1 serial var1 var2 122 d 222 b e 321 c f 321 fd fs 222 bx eg mydf2 serial vara varb 122 ddf 222 cb edf 321 ff ffg result serial vara varb 122 ddf 222 cb edf 222 cb edf 321 ff ffg 321 ff ffg if i'm being tricky, using row indexing: `rownames<-`(mydf2,mydf2$serial)[sort(as.character(mydf1$serial)),] # serial vara varb #122 122 ddf #222 222 cb edf #222.1 222 cb edf #321 321 ff ffg #321.1 321 ff ffg same result in 2 steps: rownames(mydf2) <- mydf2$serial mydf2[sort(as.character(mydf1$serial)),] if want avoid having na values non-matching cases in mydf1 , change mi...

asp.net - .NET Mvc and Web Api Filter Authorization, How and Where? -

i have been reading , searching best practice doing this. i "learning" web asp .net mvc , web api 2.2. i in point of authentication , authorization, understand meanning , difference in 1 , another. problem come authorization, know allow/deny access using filter , use roles. but beside dont know implement logic authorize user action, or see data, example: a user authenticated , have role pilot this user enter controller/action example flight/getpassengers/1 where getpassengers action retreive passengers flight #1 let's imagine current logged user on role pilot wants view list of flight because allowed to, can't see passengers of flights, example flight/passengers/3 flight #3 user pilot . where best place put validation logic? inside action: getpassengers ? don't think so, because if later in controller (flight) need validate if same info belongs current user (pilot) have repeat piece of code (dry) so, maybe custom filter? i find articl...

ios - Bundle ID confusion -

when created app, bundle identifier set changed space of title of app hyphen(-) , app on appstore has bundle id hyphen. thing setting in app purchases new version of app , when create bundle id in app purchase same bundle id app ( app_identifier.iap_identifier ), error saying id cannot have hyphens. believe deleting hyphen on iap id acknowledge app before starting work want sure, think? there no problem if in app purchase id isn't same app id? xcode -> select project -> go target -> info tab -> add key named 'bundle display name (cfbundledisplayname)' if not there. enter desired name here. build & run. edit: as question iap id, correct - there no restriction on how set iap id - except should unique across app store. can ensure uniqueness basing off app id.

javascript - window.open with blank url wait for dynamic html to load then print -

<script> var win = window.open(); win.document.body.innerhtml = "this html want print"; win.onload = function () { win.print(); } </script> everything works print, how wait until page loads dynamic html blank url, print? i don't think there way it, user below me onload wont fire because window opened page loaded. i'm trying load entire page first print. script posted doesn't this. martin, using code: <script> var win = window.open(); win.document.body.innerhtml = "<img src='https://upload.wikimedia.org/wikipedia/commons/2/24/willaerts_adam_the_embarkation_of_the_elector_palantine_oil_canvas-huge.jpg'/>"; win.print(); </script> in chrome prints blank page. edit: martin, onload img attribute did trick. heres did modify script: <script> var win = window.open(); var html = "this test html <br><img src='https://upload.wikimedia.org/wikipedia/commons/2/24/willaerts_ad...

postgresql - "No relations found" in psql after rails db:migrate succeeds -

as rails novice, i'm following instructions in railscast #342 set postgres database connection on mac. i created new rails project $ rails new blog -d postgresql i edited database yaml file set username , password. i used psql add new user , password, , gave permission create tables: alter user blog create db i created db via rake db:create:all it succeeded , inside psql, doing \l list schemas, see 3 schemas blog_test, blog_development , blog_production i do $ rails g scaffold article name content:text all looks good i do $ rake db:migrate i messages showing success: $ rake db:migrate == 20150701220010 createarticles: migrating =================================== -- create_table(:articles) -> 0.0128s == 20150701220010 createarticles: migrated (0.0129s) ========================== i set search path @ schema: set search_path lcuff,public,blog_development; show search_path: search_path --------------------------------- lcuff, public, bl...

c# - Adding Spreadsheets with open XML SDK -

i'm attempting alter pre-existing office document inserting externally loaded image using open xml sdk 2.5. plan in excel appending worksheet workbook , doing of work there. however, can't seem around 1 error in particular. my code is: public void insert(string filepath) { spreadsheetdocument doc = spreadsheetdocument.open(filepath, false); // add worksheetpart workbookpart. worksheetpart worksheetpart = doc.workbookpart.addnewpart<worksheetpart>(); worksheetpart.worksheet = new worksheet(new sheetdata()); // add sheets workbook. sheets sheets = doc.workbookpart.workbook. appendchild<sheets>(new sheets()); // append new worksheet , associate workbook. sheet sheet = new sheet() { id = doc.workbookpart. getidofpart(worksheetpart), sheetid = 1, name = "mysheet" }; sheets.append(sheet); ...

jax rs - Demo login and logout app with AngularJS front end JAX-RS backend -

could please suggest me can find simple demo login , logout app angularjs front end , jax-rs end. i have build demo login , logout app jsf , ejb, have no idea how same using angularjs front end , jax-rs end (as becoming stateless want try hand @ this). could please suggest such demo app on github or anywhere else.

angularfire - Getting an undefined variable while trying to access a variable from another controller angularjs -

hi new angularjs , appreciated. authorising users service , service looks 'use strict'; app.factory('auth', function ($firebasesimplelogin, firebase_url, $rootscope, $firebase) { var ref = new firebase(firebase_url); var auth = $firebasesimplelogin(ref); var auth = { register: function (user) { return auth.$createuser(user.email, user.password); }, createprofile: function (user) { var profile = { userfirstname: user.fname, userlastname: user.lname, username: user.fname + " " + user.lname, userprofiletags: user.profiletags }; var profileref = $firebase(ref.child('profile')); return profileref.$set(user.uid, profile); }, login: function (user) { return auth.$login('password', user); }, logout: function () { auth.$logout(); ...

javascript - Stripping milliseconds from Extended ISO format -

javascript's date.toisostring() function returns string in following format: yyyy-mm-ddthh:mm:ss.sssz how can strip milliseconds such string? is, desire string in format: yyyy-mm-ddthh:mm:ssz since iso date format fixed width until millisecond portion, alternative splitting on '.' use substring , replace "z" timezone designator: var d = new date() d.toisostring().substring(0,19)+'z' "2015-07-01t21:27:45z"

scrapy - How do I write a form equivalent to this curl to send requests to my scrapyd instance? -

curl http://localhost:6800/addversion.json -f project=firstproject -f version=r2 -f egg=@/tmp/scrapydeploy-ffa46x/project-1.0-py2.7.egg response: {"status": "ok", "project": "firstproject", "version": "r2", "spiders": 2} i have tried <form action="http://localhost:6800/addversion.json" method="post"> <input type="text" name="project" placeholder="project"></input> <input type="text" name="version" placeholder="version"></input> <input type="file"name="egg" placeholder="version"></input> <input type="submit"</input> </form> with same strings first 2 parameters in curl, , same file selected third paramter. reponse: {"status": "error", "message": "valueerror: unknown or cor...

complete - Auto close end tag by typing ' </ ' in Sublime Text 2 -

sublime text 2 has default key binding close elements end tag automatically typing (alt + .) for example, <h1> + (alt + .), produces <h1></h1> default keybindings accessible through package controller, { "keys": ["alt+."], "command": "close_tag" } however, i'm not sure how write </ , 2 keys pressed consecutively appose 2 keys pressed @ same time. how can rewrite key binding use </ ? any insight helpful. thanks! check in preferences file if following line exists "auto_close_tags": true, it works me in sublime text 3.

c# - Dispatcher.Run generates Win32Exception only when application is run as published application in RDS -

i have legacy modal dialog need present windows wpf/c# application. works under specific circumstance of published application in rds if user waits few minutes between main application , invoking dialog crash rather cryptic error. i know how list of messages dispatcher running: if analyse messages being processed have shot @ understanding underlying problem. the actual exception win32exception. message "the system cannot find file specified". hresult x80004005. the complete error text is: system.componentmodel.win32exception (0x80004005): system cannot find file specified @ ms.win32.unsafenativemethods.getwindowtext(handleref hwnd, stringbuilder lpstring, int32 nmaxcount) @ system.windows.automation.peers.windowautomationpeer.getnamecore() @ system.windows.automation.peers.automationpeer.updatesubtree() @ system.windows.automation.peers.automationpeer.updatepeer(object arg) @ system.windows.threading.exceptionwrapper.internalrealcall(delegate callback, object args...

mobile - How to send push message from Kinvey and Delphi for a specific user -

does know how send push message particular user through kinvey service? today can send push uses application, need send single user. thanks i found comment in blog article : if select addons > messaging > push , select send message everyone, has app installed receive message. can setup specific users inside kinvey , select ‘specific users’ , define users want send message to.

javascript - Generate Keystone List Name Programmatically -

Image
how go generating keystone list name programmatically? i'm looking this... var font = new keystone.list('font', { // ↓↓↓ ↓↓↓ here ↓↓↓ map: { name: 'typefacename + weightname' }, track: true, schema: { collection: 'font' } }); font.add({ typefacename: { type: string, initial: true, required: true}, weightname: { type: string , initial: true, required: true} }); which generate name, so.

c# - Dictionary of large objects vs. Dictionary of array indices -

i have large objects want access via string identifier. current approach use dictionary containing those: var myobjects = new dictionary<string, largeobjectclass>(); var specificobject = myobjects["identifier"]; now wondering whether storing many of large objects in dictionary might bad performance , better off using dictionary store indices array stores objects: var myobjects = new largeobjectclass[size]; var objectindices = new dictionary<string, int>(); var specificobject = myobjects[objectindices["identifier"]]; this bad approach if size of myobjects unknown in advance or might change @ runtime, since dictionary smaller , read somewhere arrays more efficient dictionaries, thought approach might have better performance in cases size fixed. which of these approaches more efficient, assuming objects large? you're better off using dictionary<> in case. remember both dictionary , array storing references large objects be...

ember.js - Ember 1.12 Inject Route into Service -

i'm trying create service handle modal dialogs in ember 1.12 ember-cli. maybe service isn't best way approach this, want access anywhere in app, , able dynamically insert content popup, seemed right way go. here service: import ember 'ember'; export default ember.service.extend({ route: ember.inject.service('route'), open: function(content){ console.log('open popup', content); this.get('route').render('popup-box', { //popup-box component into: 'application', outlet: 'popup' }); }, close: function(){ //todo } }); when call open method, error: uncaught error: attempting inject unknown injection: service:route i'm not sure i'm missing. suggestions? you should check out ember-wormhole, https://github.com/yapplabs/ember-wormhole . let target section of template anchor somewhere else in dom. it's perfect moda...

java - How to write a json to add a list? -

i need create json this. { "list": [ { "description": "abc", "id": "music", "issent": "0" }, { "description": "abc", "id": "music", "issent": "0" } ] } this code i'm using write json. not display values i'm getting through database.it repeats data last column of database jsonobject jo = new jsonobject(); jsonarray ja = new jsonarray(); map<string, object> data = new hashmap<string, object>(); try { statement ac = dbl.getconnection().createstatement(); resultset r5 = ac.executequery("select * msg"); while (r5.next()) { system.out.println("value taken database" + r5.getstring("content")); data.put("description", r5.getstring("content")); ...

.net - PhantomJSDriver ignores local storage path -

i using phantomjs .net bindings in latest stable version (nuget). trying have multiple instances of phantom running @ same time. works fine, instances share local storage underneath. as far understand happens because instances use same folder store local storage data. trying change unique folder following code: var phantomjsdriverservice = phantomjsdriverservice.createdefaultservice(); phantomjsdriverservice.localstoragepath = @"c:/temp/localstorage"; this.driver = new phantomjsdriver(phantomjsdriverservice); phantom ignores setting , keeps using default folder. tried several combinations, different slashes, different folders, permissions.. non of them worked. has used different local storage path phantom? is there other way have multiple instances of phantom running independently? if you're using phantomjs on linux x64 can test binary has localstoragepath fix included: https://github.com/patrickhuetter/phantomjs/releases/tag/1.9.8-fixedstoragepath ...

LINUX ADDED SECOND ISSUE? php script works but when I execute using cron job it has double entries in database -

this perfect working system prior today. code has not been updated @ all. there cron job runs php script via curl. the problem: duplicate entries in database. tried: -turning off cron job , manually running curl (several iterations) success. -turned cron job on run curl (failed- duplicate entries) -checked duplicate cron jobs, there none. it makes no sense work independently cron job this. please help. ideas helpful. @ loss. i rebooted sever. leap second somehow affecting cron job -> mysql queries

git - Is it best practice to place Java project directly under the Source Code Repository -

any pros , cons or creating additional folders under repository ? the example scenario below elaborates question further:- e.g. using git scm. option 1 myrepository/my-favorite-maven-project-1 |____pom.xml /my-favorite-maven-project-2 |____pom.xml option 2 myrepository/somefolder1/my-favorite-maven-project-1 |____pom.xml /somefolder1/somefolder2/my-favorite-maven-project-2 |____pom.xml i pros , cons option 1 , option 2. putting multiple maven projects under single git repository makes sense if both of projects in fact modules of each other , released/branched @ same time. it's mistake if you're moving svn you've had single large svn repo , lots of projects next each other though. reason is, svn branches/tags work @ folder level, in git work @ repository level. if you're branching/releasing project-1 , project-2 separately, should in se...

lua - Premake5 Won't Build On FreeBSD 10.1 -

i'm trying build premake5 on freebsd 10.1 sources. got compile removing "-dl" option , using gmake explicitly build. built, can't spit out following error message. doesn't matter how invoke it. crashes on 'premake5 --help'. here's message: panic: unprotected error in call lua api (attempt call string value) the code buggy get-out. starts assuming linux posix not case. use linuxism on place converting posix going quite task, , until done never work satisfactorily on non-linux posix based systems. the -ldl first stumbling block. next in function premake_locate_executable in premake.c . in using /proc filesystem linuxism , since fails on bsd falling lua methods seem assuming lua_tostring pops corresponding value doesn't. since stack isn't balanced in function following lua_call trying call garbage they've left on stack rather function intended. even after fixed issue use getconf _nprocessors_onln number of c...

python - SyntaxError: EOL while scanning string literal while using backslash escape -

i know noob question, new python , trying understand following: why backslash escape work without error here: >>> print "this \\\ string" \\ string but when try: >>> print "\\\" i get: syntaxerror: eol while scanning string literal the first backslash escapes second backslash, , third escapes double quote, fails terminate string. need either print "\\\\" or print "\\\"" , depending on output trying get. (the first print \\ , second print \" .)

html - Polymer custom element tag appearing in the DOM -

i've started learning polymer custom elements. i've created simple custom element, usage of follows: <my_custom_element></my_custom_element> the template custom element is: <template> <span>hello</span> </template> if inspect dom using chrome dev tools, notice my_custom_element tag appears in dom. wasn't expecting this. expecting tag replaced template content. my_custom_element represent in own right? i read :host can used style custom element internally within definition , it's used style host element itself. again don't understand means style host element in own right. isn't host element defined template content? the web components model not use <my-custom-element> placeholder, actual , real html element complex behaviors , own contents.