Posts

Showing posts from July, 2014

How to create password protected database in visual studio? -

i want set password on .mdf file created in visual studio. what procedure? connection string? create database in microsoft access first. use datasets if have work databases directly in visual studio. make databases more easy manage via access. can password protect access databases via file menu. connection strings, sorry don't know here :(

android - NullPointerException in SupportAppCompat-v7 Library on API 15 -

a nullpointerexception thrown in supportappcompat library. seems happen devices running on api 15 (icecreamsandwich). api versions 16 22 work without issue. any ideas on cause crash? thank time , possible answers! here's stacktrace: java.lang.nullpointerexception @ android.graphics.drawable.layerdrawable$layerstate.(layerdrawable.java:625) @ android.graphics.drawable.layerdrawable.createconstantstate(layerdrawable.java:107) @ android.graphics.drawable.layerdrawable.(layerdrawable.java:99) @ android.graphics.drawable.layerdrawable$layerstate.newdrawable(layerdrawable.java:655) @ android.content.res.resources.getcacheddrawable(resources.java:2052) @ android.content.res.resources.loaddrawable(resources.java:1943) @ android.content.res.resources.getdrawable(resources.java:707) @ android.support.v4.content.contextcompat.getdrawable(contextcompat.java:321) @ android.support.v7.internal.widget.tintmanager.getdrawab...

javascript - jQuery Ajax File Upload -

can use following jquery code perform file upload using post method of ajax request ? $.ajax({ type: "post", timeout: 50000, url: url, data: datastring, success: function (data) { alert('success'); return false; } }); if possible, need fill "data" part? correct way? post file server side. i have been googling around, found plugin while in plan not want use it. @ least moment. file upload not possible through ajax. can upload file, without refreshing page using iframe. can check further detail here update: with xhr2, file upload through ajax supported. e.g. through formdata object, unfortunately not supported all/old browsers. formdata support starts following desktop browsers versions. ie 10+, firefox 4.0+, chrome 7+, safari 5+, opera 12+ for more detail, see mdn link

angularjs custom directive passing string attribute for templateUrl -

i have directive follows , want able pass templateurl in custom directive <div ng-if="box.key === 'experiences'" experiences-form template-url="'experiences.php'" // template url trying pass item="item" forms="forms" form-name="{{box.key}}{{item._id}}" onsave="updatemultipleuser(box.key, item._id, $data)" cancel="formaction($formname, 'cancel')" > </div> ddo directive { restrict: 'a', replace: true, scope: { onsave: '&', cancel: '&', formname: '@', forms: '=', item: '=' }, controller: controller, templateurl: function (telement, tattrs) { return tattrs.templateurl; // returns 'experiences.php' how rid of single quotes? } }; why putting quotes in templateurl attribute? should work that: <div ng-i...

java - read binary file and display content in Jlist -

how can read binary file , display in jpanel.up have initialized jframe,jpanel jbutton when run code button , frame appears when click show button need show data file here code have done. public class graphicaldisplay{ private jframe cframe; private jbutton showbutton; public graphicaldisplay() { } public void displaycompanylist() { //creating frame display of contents , containers , other elements jlabel , jbutton cframe = new jframe("list of companies"); cframe.setlocation(700,150); cframe.setsize(600,300); //creating button showbutton =new jbutton("show list"); //create panel hold button jpanel bpanel=new jpanel(); bpanel.add(showbutton); //add panel frame cframe.add(bpanel,borderlayout.center); cframe.setvisible(true); showbutton.addactionlistener(new actionlistener() { @override publ...

r - set size of a plot area in ggplot2 -

Image
this question has answer here: how achieve identical facet sizes , scales in several multi-facet ggplot2 graphics? 1 answer is there way directly specify width , height of plot area ggplot2 , example 3" , 4" figure below? sample code: library(ggplot2) x <- seq(-5,5,by=.1) d <- data.frame(x=x,y=cos(x)) p <- ggplot(d) + aes(x=x,y=y) + geom_line() ggsave(p,file='~/example.pdf') library(ggplot2) x <- seq(-5,5,by=.1) d <- data.frame(x=x,y=cos(x)) p <- ggplot(d) + aes(x=x,y=y) + geom_line() pdf(file="example.pdf", width=3, height=4) p dev.off()

Grails formRemote 404 Not Found -

i'm having difficulties getting ajaxform working properly. i'm using grails 2.4.4 , have following remoteform code. view usedproducts <div id="updateme"> <g:each in="${productlist}" var="product"> ${product.item} success1 </g:each> </div> <g:formremote name="myform" url="[controller:'product', action: 'save']" update="updateme"> <g:textfield name="item" required="" value="${newproduct?.item}" /> <g:submitbutton name="save" /> </g:formremote> controller productcontroller def usedproducts = { [productlist:product.findall()] } @transactional def save(product productinstance) { productinstance.save flush:true [productlist: product.findall()] } console error post http://localhost:8080/tekdays/product/save 404 not found 54ms jquery-...e=false (line 9631)...

javascript - jQuery PrintArea prints blank page -

i want print form using jquery print area, custom stylesheet, , javascript code. actual site's page is: http://dev.radioimagendigital.com/orden-de-servicio/ and button calls print area action "imprimir", css file passed parameter printarea plugin is: http://dev.radioimagendigital.com/wp-content/themes/stability/print1.css and actual javascript code is: jquery("div.b1").click(function(){ var print = ""; jquery("input.selpa:checked").each(function(){ print += (print.length > 0 ? "," : "") + ".content_orden_servicio" + jquery(this).val(); }); var template_uri = '<?php echo get_template_directory_uri(); ?>'; jquery(".content_orden_servicio").printarea({ mode : "iframe", standard : "html5", retainattr : ["id","class"], printdelay : 500, printalert : true, ...

encoding - Why are some of my HTML internal links working and others not? -

help, totally new world. i making menu bar on front page links other pages on site, here example of code: <ul id="menu"> <li><a href="file:///users/tamborine/downloads/about_page.htm">about</a></li> <li><a href=“file:///users/tamborine/downloads/the_therapist_page.html”>the therapist</a></li> <li><a href=“file:///users/tamborine/downloads/pay_what_you_can_page.htm”>pay can</a></li> <li><a href=“file:///users/tamborine/downloads/projects_we_support_page.htm”>projects support</a></li> <li><a href=“file:///users/tamborine/downloads/resources_page”>resources</a></li> <li><a href=“file:///users/tamborine/downloads/prices_page”>prices</a></li> <li><a href=“file:///users/tamborine/downloads/faq_page.htm”>faq</a></li> </ul> when open in browser first link (about) works, others show '...

PHP - How to add decimals , . to my number without adding 00? -

i have prices in db , want add . , , display them on site. i know number_format if use number_format($ctotal, 2, ".", ","); it add 2 additional 00 @ end. example: db: 100000 now: 100,000.00 should this: 1,000.00 looks easy task can't find solution ... thanks! you're better off storing numbers in format preferable math in database without floating-point issues, formatting numbers @ time of display. allow use source data calculations without needing reformat numbers (again) or encountering other problems floating-point calculations.

rodbc - sql in operator on multiple columns -

i have list of values , example id= ('10','20','30') want check if these values exisit in either columna, columnb or columnc this have , works fine "select * table1 columna in", id what trying is "select * table1 (columna or columnb or columnc) in", id i getting bunch of errors, need syntax try instead: select * table1 columna in ('10','20','30') or columnb in ('10','20','30') or columnc in ('10','20','30')

jquery - Unexpected Token Illegal for an array -

i cannot figure out why getting error chrome's developer tool. following line: var accessoriescats = [ “beaded accessories”, “cufflinks”, “flip flops”, “floral accessories”, “foot jewelry”, “hair accessories”, “hankies”, “jewelry”, “leg garters”, “purses”, “shoe stickers”, “something blue”, “tiaras”, “totes” ]; comes error: uncaught syntaxerror: unexpected token illegal. i'm not sure if indeed line problem, or else. here entire code: <script> if (window.location.href.indexof("category-s/2022.htm") != -1) { var accessoriescats = [ “beaded accessories”, “cufflinks”, “flip flops”, “floral accessories”, “foot jewelry”, “hair accessories”, “hankies”, “jewelry”, “leg garters”, “purses”, “shoe stickers”, “something blue”, “tiaras”, “totes” ]; $('#content_area > table:nth-child(6) > tbody > tr > td > table:nth-child(1) > tbody > tr > td > table > tbody').find('a').each(acc...

c# - Add login and password to Web Service -

first of one-week self taught when comes web service pardon if duh! question. given sample web service , asked re-create new 1 scratch. have been able understand , apply several of elements original web service ran wall one. web service has following element <s:element name="runqaas"> <s:complextype> <s:sequence> <s:element name="login" type="s:string"/> <s:element name="password" type="s:string"/> <s:element name="createdby" type="s:datetime" nillable="true"/> <s:element name="createdto" type="s:datetime" nillable="true"/> <s:element name="modifiedby" type="s:datetime" nillable="true"/> <s:element name="modifiedto" type="s:datetime" nillable="true...

Should I include original datatables css when using Bootstrap theme? -

following https://www.datatables.net/manual/styling/bootstrap-simple.html , doesn't include original datatables css. if remove script in source: (from comment reads not important?) <script type="text/javascript"> // demo fit datatables site builder... $('#example') .removeclass( 'display' ) .addclass('table table-striped table-bordered'); </script> there no styling table, see https://jsfiddle.net/glrf9o8t/ it appears demo cheating... mean datatables style classes become useless if don't include original css file? however if include orginal css in, paging bar looks weird, see https://jsfiddle.net/r45f6dt6/ if you're using datatables.bootstrap css, need manually apply bootstrap classes table. cannot change classes after datatables has been initialized script above because not applied datatables grid. if must change classes programmatically, init datatables callback on function. <...

mysql - auto_increment with the newly created column -

this question has answer here: insert auto increment primary key existing table 9 answers i using mysql, have table called transaction_detail the create table statement is create table transaction_detail( tx_code varchar(25), acct varchar(25), ltx varchar(25), crcy varchar(25)); i want add column called line_key auto_increment 1 in this. know way create table similar , add column auto_increment in , insert data table newly created table, looking easier way altering table , adding column incremented value. this way can insert 1 table another insert database.tablenamenew select * database.tablenameold; this way can copy table structure create table database.tablenamenew database.tablenameold; this table auto increament create table transaction_detail( `line_key` int(11) not null auto_increment, `tx_code` varchar(25), `ac...

AppBarLayout and Toolbar invisible on Android 4.x -

i using new appbarlayout , toolbar v22 design support library. appear invisible on 4.x devices. known issue? how fix it? here's xml: <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:title="insight source" app:popuptheme="@style/themeoverlay.appcompat.light" app:layout_scrollflags="scroll|enteralways"/> </android.support.design.widget.appbarlayout> they're in relativelayout. moving them coordinatorlayout did not fix issue. the appb...

r - Matrix multiplication giving NA -

i'm attempting simple matrix multiplication, has never given me issue before. i have x matrix (nxfe) , matrix of observations, y (nx1). purposes of example lets x <- matrix(c(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), nrow=4) y <- matrix(c(1, 2, 3, 4), nrow=4) simple code multiplication xt <- t(x) xy <- xt%*%y however, when this, matrix of na's (nx1). this has never happened before. have checked , there appropriate values in matrices. appreciated.

linux - Adding up certain values in a Column for certain Rows USING AWK -

i want sum up values in column 4 rows column 3 equal 1 using awk data given below. 13.804 2 1 0.128 14.10683054308584 13.805 4 1 0.1 16.404063320609485 13.845 4 1 0.1 18.88784810910845 13.887 3 0 0.5 15.885403793537332 13.900 2 1 0.128 17.432392753144814 13.910 0 1 0.15 14.065390777016884 13.919 2 1 0.128 14.303367876393343 13.925 0 1 0.15 99.709674389069306 13.967 4 0 0.1 16.166182416686354 13.987 2 0 0.128 27.678527587660298 13.990 0 0 0.15 16.335622854953012 13.991 3 0 0.5 18.135064819504496 14.017 2 0 0.128 32.702333086991857 14.034 1 0 0.25 23.747057691617819 14.042 1 0 0.25 21.28645813221631 14.042 4 0 0.1 32.412778602456548 14.042 4 0 0.1 16.355373059379346 14.049 4 0 0.1 16.9107377441049 14.061 4 0 0.1 14.247305256107564 14.068 3 0 0.5 17.503919428057454 14.085 0 0 0.15 15.027892690096117 14.098 0 0 0.15 18.872227052735838 14.098 1 0 0.25 32.769497723363287 14.100 0 0 0.15 14.169509642396147 14.123 0 0 0.15 15.384714430934654 14.127 0 0 0.15 16.186777071833166 14.159 ...

How can I use the Google Weather API? -

i want make app using google weather api, don't have knowledge it. how use api? explain step step how include in project? this broad answer should better check tutorial or documentation present online . edit : your script can this: import pywapi import string weather_com_result = pywapi.get_weather_from_weather_com('10001') yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('kjfk') print "weather.com says: " + string.lower(weather_com_result['current_conditions']['text']) + " , " + weather_com_result['current_conditions']['temperature'] + "c in new york.\n\n" print "yahoo says: " + string.lower(yahoo_result['condition']['text']) + " , " + yahoo_result['condition']['temp'] + "c in new york.\n\n" print "noaa says: " + string.lower(noaa_result['weather...

performance - R: efficiently identifying highest N values of variable Z by group X -

i have datatable looks this. id <- c(rep("abc",4), rep("def",4), rep("ghi",5)) x <- c(rep(c(1,2,3,4),3),5) set.seed(1234) z <- runif(13,min=0, max =1) <- data.table(id, x, z) id x z 1: abc 1 0.113703411 2: abc 2 0.622299405 3: abc 3 0.609274733 4: abc 4 0.623379442 5: def 1 0.860915384 6: def 2 0.640310605 7: def 3 0.009495756 8: def 4 0.232550506 9: ghi 1 0.666083758 10: ghi 2 0.514251141 11: ghi 3 0.693591292 12: ghi 4 0.544974836 13: ghi 5 0.282733584 i'd produce dataframe has n highest values of z within each x subgroup. lets n 2. i'd end dataset looks this: x id z 1: 1 def 0.8609154 2: 1 ghi 0.6660838 3: 2 def 0.6403106 4: 2 abc 0.6222994 5: 3 ghi 0.6935913 6: 3 abc 0.6092747 7: 4 abc 0.6233794 8: 4 ghi 0.5449748 9: 5 ghi 0.2827336 i've been using line achive it, i've found particularly slow when datatable large (i.e. on 1,500,000 lines or more.) top_n <- 2 <- a[o...

javascript - Directive's inner HTML interpolated value -

let's have piece of code: <div>{{somevalue}}</div> i want came generic directive append css class based on interpolated value of {{somevalue}} in above example. example: <div status>{{somevalue}}</div> would result in <div class="green">ok</div> when {{somevalue}} expression equal ok . otherwise stay untouched. i know other ways achieve same result (e.g. ngclass ) know whether it's possible achieve described above - based on interpolated value of directive's inner html. p.s.: don't want tie directive actual model - instead directive act based on interpolated value of inner html. hope clear enough... i suggest use somevalue attribute value, can available directive , make life lot easier. <div status="{{somevalue}}"></div> then, can loop through somevalue value inside directive's link function, , send appropriate status message.

mysql - Deleting dates with PHP -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i trying code below delete dates between 2 selected dates. showing error provided , not deleting database not sure why? if take look, appreciative. if(isset($_post['remove'])){ $servername = "localhost"; $username = "u779108225_admin"; $password = "password"; $dbname = "u779108225_main"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $date_from = $_post['date_from']; $date_from = strtotime($date_from); // convert date unix timestamp // specify end date. date can english textual format $date_to = $_post['date_to']; $date_to = strtotime($date...

xml - XSLT mode not being triggered -

i'm trying use xslt template matching combined mode functionality run particular template depending on condition. in case whether or not admin set true . <xsl:template match="*[//properties[@admin='true']]" mode="admin"> <!-- here --> <apply-templates select="self::node()[not(../personalisederrorinstance)]" mode="personalisation"/> </xsl:template> <xsl:template match="*[//properties[@admin='false']]" mode="admin"> <apply-templates select="self::node()" mode="personalisation"/> </xsl:template> <xsl:template match="*" mode="personalisation"> <!-- never here --> for reason never seem hit personalisation template match, regardless of whether admin true or false . there blatantly obvious i'm doing wrong? i've tried changing self::node() * i'm not sure causing issue. ...

PHP - Yii - dynamic properties CActiveRecord -

i have class person have properties {property}_{countrycode} . class can have 20 properties , each property country code. 20x3 = 60 properties defined in class. each language need define them manually in class. class person extends cactiverecord { public $name_sk; public $name_cz; public $name_de; public static function model($classname = __class__) { return parent::model($classname); } function tablename() { return 'person'; } } question: how generate/define these properties dynamically in class? example: public function __construct() { $langs = array('sk', 'cz', 'de'); $properties = array('name', 'surname', 'age'); foreach($langs $lang) { foreach ($properties $k => $value) { $this->{$value. "_". $lang} = null; } } } in yii 1.x can't . if override cactiverecord._get() extending it.

Simple node.js app deployed to Bluemix seems to be leaking memory -

i learning node.js, , have simple application seems leaking memory when deployed bluemix. need assistance in determining if caused code, or module using. when deployed monitoring , cloudant services crash out of memory error, , restarted bluemix every 12-14 hours - 256 megs of ram. upped ram 1 gig , still occurs (although less frequently). when deploy app bluemix , issue calls / route can see memory climb up. when testing locally in windows, not see same behavior (testing via process explorer , seeing amount of private bytes & working set) i have simplified app (and removed monitoring service) , can still reproduce, though increase slower simplified app. /*jshint node:true*/ //------------------------------------------------------------------------------ // app.js - middleware routing //------------------------------------------------------------------------------ // application uses express it's web server // more info, see: http://expressjs.com var express = r...

mongodb - Inserting JSON document into mongo error -

i'm trying insert twds1e1.json file mongodb through command prompt: db.collections.insert( twds1e1.json ) but getting error: twds1e1.json not defined. mongo not thing, doing wrong here? in command prompt directory path path mongoimport.exe available type commands for normal json mongoimport -d test -c docs --file example2.json for array type json mongoimport --jsonarray -d test -c docs --file example2.json please see docs more information

ios - Ping multiple host/ips objective C -

i want list of ip's connected in same wifi network . i manually trying ping ip range 0-255 based on allocated ip address , taking long time ping status. there optimised function library in objective c or c this? any appreciated. thanks, tushar sapkale try pinging broadcast address or use multicast socket. join multicast group first creating multicast socket desired port, invoking joinmulticastgroup method. when message send multicast group subscribing members receive message. you can refer stackoverflow link

javascript - Knockout JS overwriting all values with the last value in foreach binding -

Image
in knockoutjs app, looping on observable array , displaying stuff this: <div id="user-list-container" data-bind="foreach: users"> <div class="row order-line list-row"> <div class="medium-7 small-10 columns"> <i class="fi-torso tip-right"></i> <a href="javascript:void(0)" data-bind="text: user().name"></a> <a href="javascript:void(0)" data-bind="text: accountid"></a> </div> <div class="medium-3 columns"> <a href="#" class="button split tiny info radius"> <i data-bind="text:role"></i> <span data-dropdown="leftdrop" data-options="align:left"></span> </a> </div> <div class="medium-2 sma...

2457164.78236111 date in Sqlite. -

how convert 2457164.78236111 date readable date? or how compare date input date? reading date stored float on sqlite database using biometric diverse. trying come calculated reports used control students movement during 4 meals. breakfast, tea, lunch , dinner. please assist. couldn't write sample code using phone right now. in advance. 2457164.78236111 looks julian date. can use date , time functions convert it. example: sqlite> select datetime(2457164.78236111); 2015-05-22 06:46:36

Functions acting strange when run as thread in Kivy/Python -

i building app that, when user hits 'run' button, generates table of buttons. because process takes while, want add popup or progress bar alert user function running , not frozen. decided create popup , call function using threading screen updated when function starts (as opposed once done). mythread = threading.thread(target=run_function) mythread.start() the trouble when call function above code works strangely: columns of table wrong width, of buttons arbitrarily empty, , others have wrong fill color. fix this, need remove threading operation , call run_function() any idea why happening? i new python, dumb mistake, have no idea. different between process running thread , default operation? disclaimer: haven't worked kivy. not every framework works multithreading. but of gui frameworks have event loop responsible managing user events (mouse clicks, keyboard) , queued drawing operations (widgets). in case if don't want ui freezed, should r...

javascript - Counting up numbers that are not lost on page refresh -

i need number shown people registered on web site. nuber digits should counted without losing value. e.g. should start 1 , go on, if refresh page, shouldnt start again 1. should go on. example similar not saving: var minuteslabel = document.getelementbyid("minutes"); var secondslabel = document.getelementbyid("seconds"); var totalseconds = 0; setinterval(settime, 1000); function settime() { ++totalseconds; secondslabel.innerhtml = pad(totalseconds%60); minuteslabel.innerhtml = pad(parseint(totalseconds/60)); } function pad(val) { var valstring = val + ""; if(valstring.length < 2) { return "0" + valstring; } else { return valstring; } } when refresh page memory javascript has created lost. some options be: html5 local storage : http://www.w3schools.com/html/html5_webstorage.asp co...

django - What is a CSRF token ? What is its importance and how does it work? -

okay guys, writing django application , want idea of csrf token , how protects data. post data not safe if not use csrf tokens? i know how use csrf_token need information how works. cross-site request forgery (csrf) in simple words assume logged online banking @ www.mybank.com assume money transfer mybank.com result in request of (conceptually) form http://www.mybank.com/transfer?to=<someaccountnumber>;amount=<someamount> . (your account number not needed, because implied login.) you visit www.cute-cat-pictures.org , not knowing malicious site. if owner of site knows form of above request (easy!) , correctly guesses logged mybank.com (requires luck!), include on page request http://www.mybank.com/transfer?to=123456;amount=10000 (where 123456 number of cayman islands account , 10000 amount thought glad possess). you retrieved www.cute-cat-pictures.org page, your browser make request. your bank cannot recognize origin of request: web browser se...

java - How can I allow GET requests without authentication but secure other HTTP methods? -

i've created webservice spring roo , added spring security project. works fine far want allow access entities information via http requests without authentication. other http methods post, put etc. should stay secure. my applicationcontext-security.xml looks following when http on "/releaseupdates/" "accept: application/json" header returns login page (i think spring security redirects login page internally): <http auto-config="true" use-expressions="true"> <form-login login-processing-url="/resources/j_spring_security_check" login-page="/login" authentication-failure-url="/login?login_error=t" /> <logout logout-url="/resources/j_spring_security_logout" /> <!-- configure these elements secure uris in application --> <intercept-url pattern="/releaseupdates/**" access="permitall" method="get" /> ...

android - How to detect target on video feed from assets folder or URL using Augmented Reality sdk, instead of Camera -

i want detect target on saved video feed or url video. this, have been looking around ar sdks found no sdk support this. sdks supporting target detection on live camera not on saved video or url streaming video. is there way this? sdk support feature? i'm not aware of sdk doing natively instead of using camera frames need write piece of code reads stored video (or connects given url) , use frames. in other words, need replace input source. therefore assume sdk allows provide own frames suited need.

PHP laravel array error -

how using $myarray = [1,2]; instead of $myarray = array(1,2); does not show error parse error: syntax error, unexpected '[' in c:\...\laravel\public\index.php on line 3 like in laravel-framework? thank you! to use syntax need php >= 5.4.0: short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];. http://php.net/manual/en/migration54.new-features.php btw. it's 1 of laravel requrements : php >= 5.4 mcrypt php extension openssl php extension mbstring php extension tokenizer php extension

ruby on rails - How to correctly use Resque workers? -

i have following tasks in rails application: download video trim video ffmpeg between given duration (eg.: 00:02 - 00:09) convert video given format move converted video folder since wanted make happen in background jobs, used 1 resque worker processes queue. for first job, have created queue @queue = :download_video it's task, , @ end of task going forward next task calling resque.enqueue(convertvideo, name, itemid) . in way, have created chain of queues enqueued when 1 task finished. this wrong, since if first job starts enqueue other jobs (one another), get's blocked 1 worker until first list of queued jobs finished. how should optimised? tried adding more workers way of enqueueing jobs, results wrong , unpredictable. another aspect each job saving status in database , need jobs processed in right order. should each worker single job above , have @ least 4 workers? if double amount 8 workers, improvement? have considered using sidekiq ? as...

java - Enunciate Reporting - Error The 'assemble' goal requires 'war' packaging -

i getting error while running below command while generating enunciate report mvn clean pre-site site:site site:stage -pskipquality -dskiptests=true -u my pom.xml's enunciate plugin configuration below <plugin> <groupid>org.codehaus.enunciate</groupid> <artifactid>maven-enunciate-plugin</artifactid> <version>1.27</version> <executions> <execution> <goals> <goal>assemble</goal> </goals> </execution> </executions> </plugin> error - 'assemble' goal requires 'war' packaging you have package project war: <project> ... <packaging>war</packaging> ... </project>

swift - Content under a login View is visible for a fraction of second -

i have view displaying content, password protected. in viewwillappear variable gets checked, see if user logged in : override func viewwillappear(animated: bool) { if (!config.userloggedin) { let storyboard = uistoryboard(name: "main", bundle: nil) let loginvc = storyboard.instantiateviewcontrollerwithidentifier("loginvc") as! uiviewcontroller loginvc.modaltransitionstyle = uimodaltransitionstyle.crossdissolve self.navigationcontroller!.presentviewcontroller(loginvc ,animated: true, completion: nil) } } it works, content underneath visible short fraction of second. how can present loginvc without revealing content underneath. cannot put in viewdidload because part of tabbarcontroller, , views might in memory , viewdidload called once simple solution. hide whole view in viewdidload show in viewviewappear if user correctly logged in override func viewdidload(){ self.view.hidden = true } override func viewwillappear(an...

Java Swing GridBagLayout - adding buttons without space -

Image
how can remove spacing caused gridbaglayout , make them stick together? here code adding 3 buttons. read question there no complete solution how fix gap in gridbaglayout ; want put of buttons on top of jframe. import java.awt.borderlayout; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; public class myproblem { private jframe frame = new jframe(); public static void main(string[] args) { new myproblem(); } public myproblem() { frame.setlayout(new gridbaglayout()); gridbagconstraints gc = new gridbagconstraints(); gc.weightx = 1; gc.weighty = 1; gc.gridx = 0; gc.gridy = 0; gc.fill = gridbagconstraints.horizontal; gc.anchor = gridbagconstraints.north; (int = 0; < 3; i++) { jpanel jpanel = new jpanel(new borderlayout()); jpanel.setsize(80, 80); ...

How to insert raw json in Couchbase with the .NET client? -

Image
i'm working on rest api crud operations on couchbase. the idea send directly backend raw json coming request body. there should no serialization @ done couchbase client. can document store in simple string (no deserialization). as far can tell, not supported yet. am wrong ? couchbase treat valid raw json strings documents, have send string value , same way. here example latest .net sdk (2.1.1 @ moment): string json = "{\"a\":\"b\"}"; bucket.upsert<string>("my_id", json); var op = bucket.get<string>("my_id"); var str = op.value; debug.assert(string.equals(json, str)); looking in couchbase ui, can see our raw json string proper document:

java - How to get rid of the grey selection border in JavaFX -

Image
i'm working on project , use javafx 8 gui. when click text inside tab of tabpane, thin grey box appears around text seen in image below. when click somewhere else disappears. know how rid of box? preferably using css. thanks in advance. the css: .tab-pane { -fx-background-insets: 0; -fx-padding: 0; } .tab-pane .headers-region { -fx-padding: 0; -fx-background-insets: 0; } .tab-header-area { -fx-padding: 0; -fx-background-insets: 0; } .tab-header-background { -fx-background-color: #9a3838; } .tab { -fx-background-color: #8b3333; -fx-padding: 5px 10px 5px 10px; -fx-background-radius: 0px; -fx-focus-color: transparent; -fx-font-size: 14px; } .tab:top { -fx-background-insets: 0; } .tab:hover { -fx-background-color: #b54343; } .tab:selected { -fx-background-color: #c24848; } .tab label { -fx-text-fill: white; -fx-focus-color: transparent; -fx-font-weight: bold; } .tab #searchfield { -fx-background-inset...

sql server - Strange behaviour of two simple SQL Statement (Error) and one is crashing -

i have database table 50.000 customer data records. when run query: select * customer --> result is, 22.000 data records. when run query: select * customer customer_id < 50.001 --> result 50.000 data records i did checktable, there no error messages. does have idea? yesterday still fine in database , running. today have issue. thanks suggestions. error broken index on primary key of table. fine again.

linux - Signal not delivered for a very long time (about 20 seconds) -

a signal process has sent within signal handler not delivered 20 seconds , delivered. what probable causes? i know probable reasons in general. the actual code looking @ here most probably, you're calling function within signal handler mustn't call within signal handler. see man 7 signal details: async-signal-safe functions a signal handler function must careful, since processing elsewhere may interrupted @ arbitrary point in execution of program. posix has concept of "safe function". if signal interrupts execution of unsafe function, , handler calls unsafe function, behavior of program undefined.

php - Moodle login after signup -

i'm trying make first moodle auth extension want confirm , login users directly after signup. i've changed user_signup function in "email" auth plugin this: \core\event\user_created::create_from_userid($user->id)->trigger(); $db->set_field("user", "confirmed", 1, array("id"=>$user->id)); $user = get_complete_user_data('username', $username); $db->set_field("user", "firstaccess", time(), array("id"=>$user->id)); $db->set_field("user", "lastlogin", 0, array("id"=>$user->id)); update_user_login_times($user); complete_user_login($user); redirect("$cfg->wwwroot/enrol/index.php?id=2"); it works far user gets signed , confirmed. login following error: core\session\manager::login_user() must instance of stdclass, boolean given i might acting stupid here, don't know how login new user here. apprechiated. thanks! ...

r - Creating a generic function generating new objects from selected list of columns in a data frame -

i'm working on simple shinyapp enable end-users interrogate data use of various filters. of filters correspond unique values in data frame columns created using code corresponding example below: # source sample data data(mtcars) # put menu element mtcars$cyl <- as.character(mtcars$cyl) ui_list_cyl <- unique(mtcars$cyl) i' subsequently introducing elements created in manner shiny drop down widget, in code below: # sample widget elements provides access unique column values selectinput("select", label = h3("select box"), choices = ui_list_cyl, selected = 1), i'm repeating same procedure number of columns , creating function address requirement appears natural choice. in particular, envisage function to: be applicable set of columns pass onto it create objects corresponding interface elements names ui_list_originalcolumname my question be: how create function can dynamically applied arbitrary selection of columns in data f...

Use of "Pointers" or References for "memory management" in python? -

how might 1 go constructing linked list in python. realize python not low level. suppose have large object, , want contain reference large object in instances of class: class largeobject: def __init__(self): # use lots of memory class smallobject: def __init__(self, large_object_ref): self.large_object_ref = large_object_ref # ... largeobj = largeobject() smallobj = smallobject(largeobj) # happens in memory? i want ensure self.large_object_ref never becomes deep copied instance of largeobject in memory, how prevent this/ensure this? i admit know little python's memory model or management, 1 isn't supposed have in python. familiar c/++ though borrowing terms , ideas area. python pass-by-assignment equal pass-by-reference mutable objects (and of user-created objects mutable).

regex - Catchall rewrite rule after 1:1 301 redirect stops 1:1 redirect from working -

i implementing 1:1 redirect in htaccess this: redirect 301 /1.html site.com/folder/1 redirect 301 /2.html site.com/2 redirect 301 /3 site.com/vw-vans/another-folder/2 redirect 301 /3.html site.com/3 rewritecond %{request_uri} .*\.(html) rewriterule ^(.+\.html)$ site.com/folder? [r=301] what expecting here if 1.html matches redirected site.com/folder/1 , not site.com/folder. unless remove rewrite rule, happening. 'l' flag. is not possible or doing wrong if want 1:1 redirect work , if url not part of 1:1 redirects, apply rewrite condition. don't think there [l] flag 'redirect' method. don't mix mod_alias rules , mod_rewrite 1 both invoked @ different times apache. try in .htaccess: rewriteengine on rewriterule ^1\.html$ /folder/1 [r=301,l,nc] rewriterule ^2\.html$ /2 [r=301,l,nc] rewriterule ^3\.html$ /3 [r=301,l,nc] rewriterule ^3/?$ /vw-vans/another-folder/2 [r=301,l,nc] # catchall rule .html files rewriterule ^.+?\.html$ /folder? [r=...

I need a working tutorial on Isabelle and Sledgehammer -

i installed latest isabelle/jedit package windows computer. used official package isabelle website. opened tutorials on isabelle webpage , started computer experiments. realized many examples presented in these tutorials not work in installation! example, in tutorial on page 5 following basic example of isabelle program presented: theory test imports main begin lemma "[a]=[b] ⟹ a=b" sledgehammer nothing of worked in installation! isabelle complained formula "[a]═[b] ⟹ a=b" has inner lexical error: "failed parse prop" when replaced formula working 1 "(a & b) ⟹ a" command 'sledgehammer' did not work. received message in goals field goal (1 subgoal) ( a&b ⟹ a) &&& sledgehammer instead of applying strange sledgehammer. attempt call sledgehammer button of jedit failed, received error message "missing print function 'sledgehammer'" so, question community. there working tutorial...

c++ - boost geometry intersection give strange results -

Image
i want use intersection function boost geometry line , polygon. expect intersection part of line lies inside polygon. unfortunately boost geometry returns part of line lies outside of polygon. bug in boost geometry or wrong code? #include <boost/geometry/core/cs.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/ring.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/multi/geometries/multi_point.hpp> #include <boost/geometry/multi/geometries/multi_linestring.hpp> #include <boost/geometry/geometry.hpp> #include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/algorithms/intersection.hpp> namespace bg = boost::geometry; using value_type = double ; using cs_type = bg::cs::cartesian; using point_type = bg::model::point< value_type , 2...

select - listener for checking if value is set in extjs combobox -

i have combobox has 'select' listener in various tasks selected value. have add button adds value store of combobox , sets value of combobox newly added value. problem in step select listener not invoked , such tasks performing in listener not being executed. i need know how have newly added value selected , listener combobox invoked can use newly added value next steps.

angularfire - Firebase Security Rules Nesting -

i creating reddit-type app. have array of stories, , each story has title, description, , votecount. want have separate .write rules votecount, structured rules - "stories": { "$story_id": { "title": { ".write": "auth !== null" }, "description" { ".write": "auth !== null" }, "votecount": { ".write": "newdata.val() === data.val() + 1" }, } } this works existing stories.however, no longer allows me add new story, unless add .write rule directly $story_id node. , of course stops me having special .write rule votecount node. any ideas on why happens? so users have .write access on higher level, can write data follow specific rules? you'll want put in .validation rule, instead of .write rule. a simple way remember .write rules determine who can write data, while .validate rules determine what data can written.

ios - Share database and methods in apple watch -

can 1 know how share database , methods between iphone app , watch kit ? i have researched , checked below urls: http://koreyhinton.com/blog/communicate-between-watchkit-extension-and-app.html http://fancypixel.github.io/blog/2015/03/29/share-data-between-watchkit-and-your-app-with-realm/ but gives share textual data use of method "handlewatchkitextensionrequest". also of code in swift language. i want know share common database , methods between iphone app , apple watch , in objective c language. can has useful links or step-by-step guide achieve this. thanks in advance. but not getting clue display video on apple watch. so, possible display mp4 video on apple watch or not possible. please on this. thank you. to share data between parent ios app , watchkit extension, have set shared app group . here can use nsuserdefaults , coredata etc. normally, it's available both apps. setting long process, once hang of it's not hard. there...

Excel wrong date formats -

i have column of dates exported database, , dat's format dd/mm/yyyy , in excel reading them mm/dd/yyyy since when try following: =text('9/10/2015','dd-mmm-yy') 10-sep-15 wrong. have tried changing format of column english uk , chose format want, though placement of day , month have been reversed still considers 10 day , 9 month. what can change how excel reads dates?