Posts

Showing posts from January, 2011

amazon web services - Manual acknolwedgement of sqs? -

currently using 'rabbitmq' reliable messaging delivery,we have plan move sqs.rmqp monitors consumers through tcp when consumer of queue goes down automatically re-queue messaging processing. will sqs monitor slaves? message visible in queue if 1 of consumer goes down while processing message? i have tried find out same documentation,i not find any. if 'slaves', mean sqs consumers, no, sqs not monitor consumers queue. in nutshell, sqs works this: a consumer requests message queue. sqs sends message consumer process , makes message temporarily invisible other consumers. when consumer finished processing message, sends 'deletemessage' requests sqs , sqs removes item queue. if consumer not send deletemessage enough (within configurable timeout period), sqs put message queue automatically. so sqs doesn't monitor consumers, if consumer requests messages - , nothing them - end in queue processed else. but if queue doesn't have c...

java - How to create multiple notification? -

this myreceiver.java class , here have written code display single notification. how create multiple notification here. public class myreceiver extends broadcastreceiver{ string reqpopending; int mid=0; @override public void onreceive(context context, intent intent) { // todo auto-generated method stub long when = system.currenttimemillis(); notificationmanager notificationmanager = (notificationmanager) context .getsystemservice(context.notification_service); intent notificationintent = new intent(context, splashscreen.class); notificationintent.setflags(intent.flag_activity_clear_top); pendingintent pendingintent = pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current); uri alarmsound = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); notificationcompat.builder mnotifybuilder = new notificationcompat.builder( context).setsmallicon(r.drawable...

linux - How to close a luks container that has sub partitions -

for example creates 1 partition on /dev/sda, /dev/sda1, turned luks container, further partitioned 2 sub partitions: sgdisk -z /dev/sda sgdisk -n 1:0:0 -t 1:8300 -c 1:"test partition" /dev/sda cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 1000 --use-urandom luksformat /dev/sda1 cryptsetup luksopen --allow-discards "test_encrypted" sgdisk -z /dev/mapper/test_encrypted sgdisk -n 1:0:+6gb -t 1:8300 -c 1:"sub_test_1" /dev/mapper/test_encrypted sgdisk -n 2:0:0 -t 2:8300 -c 2:"sub_test_2" /dev/mapper/test_encrypted partprobe -s /dev/mapper/test_encrypted lsblk cryptsetup luksclose test_encrypted trying so, gives back: device-mapper: remove ioctl on test_encrypted failed: device or resource busy , device test_encrypted still in use . the sub partitioning works, 1 cannot close anymore once partprobe has reported kernel sub partitions. kpartx allows deletion of partition mappings -d argument. rec...

dvcs - How to find the revision of a bazaar working copy? (like hg parent) -

in case have un-updated working tree in bazaar reported by bzr st working tree out of date, run 'bzr update' how find out working copy's revision number? (or latest commit applied) with mercurial can hg parents , i'm looking it's bazaar counterpart, or workaround. got it, it's bzr version-info . what's nice in can format it's output via --custom --template='your settings' parameter. update: even more simply, can use bzr revno --tree well.

php - Regex issue unicode chars, is it safe to parse a Post to preg_match? -

im trying thing working accept unicode letters, can cover languages urdu , other special letters around world. tried : /^[\p{l}\p{zs}\p{n}]+$/uix but gets me no heck doing wrong? tried of regex tools , cant work in way. got working found out htmlentities messing result safe use $_post preg_match ? !preg_match("/^[\\p{l}\\p{zs}\\p{n}\\p{m}]+$/u", $_post['firstname']) you can use '/^[\p{l}\p{m}\p{zs}\p{n}]+$/u' note urdu , lot of other languages have diacritics , \p{m} matches them. you not need double backslash when using single quoted literal. with post, seems need make sure value set , use string. if ( isset( $_post[ 'firstname' ] ) ) { $name = strip_tags( trim( $_post[ 'firstname' ] ) ); } see this article .

Paypal profile sharing Consent in android gives invalid_request error -

while integrating profile sharing consent paypal getting below error: {"error":"invalid_request","error_description":"invalid scope requested"} when using config_environment=paypalconfiguration.environment_sandbox .

angularjs - ng-show not working with ng-include -

http://plnkr.co/edit/0cagxsx847n9lfig4fzj?p=preview i have 2 files: -index.html (this uses ng-include - doesnt work) -index_embedded.html (uses same code without using include - works) hi, problem here when hit "click me", hit "close", try hit "click me" again, no longer works. when use same code without using ng-include, i'm able hit "click me", "close", , "click me" again. why not working when code in include file? <h2 ng-click="asdf = !asdf">click me</h2> <!-- <div ng-include="'partials/audiencenav.html'"></div> --> <!-- extracted code include , pasted below, i'm able click, close, , click again --> <div class="" ng-show="asdf"> <div ng-click="asdf = !asdf"><h2>close</h2></div> </div> the problem when code used placed in include file, breaks after hitting "...

custom fields - Wordpress Add actions and filters only if certain condition met -

i customizing wordpress comments add multiple custom fields. have added filters , actions show fields, validate them, process them , show them in comments. have written these , working fine. however need them post belongs specific category , comment not reply of other comment. i tried few things nothing seems work. can provide me working solution. just start, think put conditions inside filters , not filters inside conditions. said, posts in category , category archives can use 'conditional tags' is category (for archive) , in_category (for posts): https://codex.wordpress.org/function_reference/is_category https://codex.wordpress.org/function_reference/in_category

Interactive Flowchart Like Code Map in Visual Studio -

Image
i looking tool make clickable flowchart. code map found in visual studio (i've been using 2015 enterprise). i want have clickable boxes see more detailed content, kind of flowchart diagram, not code. there's lot of solutions creating kinds of diagrams , flowcharts available: see here .net , here javascript/html5 here java visual studio using ms' own implementation. jetbrains' resharper visual studio plugin uses yfiles wpf

image - How to remove salt&pepper noise in MatLab -

hi need remove salt&pepper noise image. function has 3 parameters input_img_path, mask(i j)==1 , output_img_path. need explain how mask work , how remove noise. noise filtering use recorded voice in ‘ wavread’ command…… this how remove noise audio, try on images yourself.. use medfilt2 remove noise images.. hope it'll work fine u. [y,fs]=wavread('c:\users\user\downloads\bugsbunny1.wav'); y=imnoise(y,'salt & pepper',0.02); k= medfilt2(y,[5 1]) wavplay(k)

c# - Little utility to add element in .config app file -

i need make little utility upgrade xml .config c# application file outside application. i need add element: <?xml version="1.0"?> <configuration> ... ... <startup uselegacyv2runtimeactivationpolicy="true"> <supportedruntime version="v4.0" sku=".netframework,version=v4.5.2"/> </startup> </configuration> wich easy way? i use xslt. example: source <?xml version="1.0"?> <configuration> <somexml/> </configuration> transformation <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output encoding="utf-8" indent="yes" method="xml"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/...

join - Call center Calculating monthly and annual percentage -

i'm trying put management information call center. i've got following info on every call gets logged: [createdon] = date & time of creation [case_status_name] = reason closing call (answered 1st line, transferred 2nd, call request etc.) now i'm looking make graph show in 1 line % of calls answered 1st line , annual average% of calls closed first line during last 12 months. i can months [createdon] extract function, same goes year. can group [case_status_name] in 1st line answered , else simple if statement. i'm having trouble getting percentages right both month , year together. i can sensible data if calculate yearly average or if calcluate monthly average. when try them together, wind getting kinds of crazy values. what proper way monthly , annual percentage in same table? create query add column [month] expression _first_of_month([createdon]) add query item [total] expression 1 add query item [answered 1st line] expression case wh...

Request and Response Headers Override using Restler -

i new restler , trying following things, can't seem hold of it i have class , method exposed via restler class account { protected $api_version = array('version' => "1.0.2.1234", 'href' => "/"); // returns version of service // content-type: application/vnd.cust.version+json function version() { return json_encode($this->version); } // accepts content type: application/vnd.cust.account+json function postcreate() { } } 1) want return own content-type client in 'version' method instead of default application/json. in case 'application/vnd.cust.version+json' 2) method postcreate should accept request if contet-type set 'application/vnd.cust.account+json'. how check if header set in request. 3) in restler api explorer, methond name, how can show method name instead of 'version.json'. want show 'version' method name thank help. narsi 1) maybe write own format? take @ http:...

Multiple cases with the same instructions in Haskell -

well code: fct 1 b = a+b fct 3 b = a+b fct 8 b = a+b fct x b = a-b `for rest : 2,4,5,6,7,9..16` my question is, there way combine 3 first lines, same thing, "case x of" ? multiple values. appreciated you can use guard syntax different matching functions: fct' x b | x `elem` [1, 3, 8] = + b | otherwise = - b

qt - QToolButton - html text -

is possible format qtoolbutton text html in qlabel ? toolbutton.settext("text <b>test</b>") doesn't work i don't think possible without subclassing qtoolbutton , overriding paintevent , if want style text in button, can use qt style sheets this: toolbutton->setstylesheet("font-weight: bold");

Can not execute the MySQL query using PHP and MySQL -

i have issue when executing sql query.i explaining code below. complain.php: require_once("./include/dbconfig.php"); if($_request['typeofapp']=="web"){ $sent_form="web"; $ticket_id=generateticketid('w1'); } function generateticketid($code){ $sql="select * db_ticket order id desc "; $qrylast=mysqli_query($con,$sql); echo mysqli_num_rows($qrylast);exit; } here trying check number of rows.but not getting anything.i giving dbconfig.php below. dbconfig.php $con = new mysqli("localhost", "root", "****", "************"); if ($con->connect_error)die("connection failed: "); here need check no of rows present inside table.please me. you need define connection variable global have access in inside function or need pass in function parameter require_once("./include/dbconfig.php"); //global $con; if...

c++ - What does it mean when one says something is SFINAE-friendly? -

i can't grasp of means when 1 mentions particular function, struct or ... sfinae-friendly . would please explain it? when allows substitution failure without hard error (as static_assert ). for example template <typename t> void call_f(const t& t) { t.f(); } the function declared t , don't have f , cannot sfinae on call_f<withoutf> method exist. ( demo of non compiling code). with following change: template <typename t> auto call_f(const t& t) ->decltype(t.f(), void()) { t.f(); } the method exists only valid t. can use sfinae as template<typename t> auto call_f_if_available_impl(const t& t, int) -> decltype(call_f(t)) { call_f(t); } template<typename t> auto call_f_if_available_impl(const t& t, ...) { // nothing; } template<typename t> auto call_f_if_available(const t& t) { call_f_if_available_impl(t, 0); } note int = 0 , ... order overload. demo -- an...

php - Laravel 5.2 add Auth::id() to Posted data -

i started learn working laravel 5.2 framework 3 hours ago ^^ i did add task form , works made task_starter_id column in database and data posted form task title , content input values and question want add starter id auth::id(); can't it i know old way post data in laravel 4 $task = new app\tasks(); // inputs $task->save(); but want laravel 5 way if it's possible here's route.php route::post('tasks', function(request $req) { $data = $req::all(); $data['task_starter_id'] = auth::id(); $task = app\tasks::create($data); return redirect('tasks'); }); blade template : <div class="panel-body"> {!! form::open() !!} <div class="form-group"> {!! form::label('task_title', 'task title :') !!} {!! form::text('task_title', null, array( ...

c# - Alternatives for languages that ad sense doesn't support -

Image
introduction: i working local website displays local contents in local language. problem: unfortunately local language not supported google ads per: so 1 way thought convert text/string image , display images instead.(server side) question i using c# method convert text image. dont understand implementation multi-line text? or there better way support languages ad sense doesn't support without images? c# code string text = str.trim(); bitmap bitmap = new bitmap(1, 1); font font = new font("arial", 12, fontstyle.regular, graphicsunit.pixel); graphics graphics = graphics.fromimage(bitmap); int width = (int)graphics.measurestring(text, font).width; int height = (int)graphics.measurestring(text, font).height; bitmap = new bitmap(bitmap, new size(width, height)); graphics = graphics.fromimage(bitmap); graphics.clear(color.white); graph...

list - python 2.7:iterate dictionary and map values to a file -

i have list of dictionaries build .xml file : list_1=[{'lat': '00.6849879', 'phone': '+3002201600', 'amenity': 'restaurant', 'lon': '00.2855850', 'name': 'telegraf'},{'lat': '00.6850230', 'addr:housenumber': '6', 'lon': '00.2844493', 'addr:city': 'xxx', 'addr:street': 'yyy.'},{'lat': '00.6860304', 'crossing': 'traffic_signals', 'lon': '00.2861978', 'highway': 'crossing'}] my aim build text file values (not keys) in such order : lat,lon,'addr:street','addr:housenumber','addr:city','amenity','crossing' etc... 00.6849879,00.2855850, , , ,restaurant, ,'\n'00.6850230,00.2844493,yyy,6,xxx, , ,'\n'00.6860304,00.2861978, , , , ,traffic_signals,'\n' if value not exists there should empty space. i...

debugging - Android Studio: how to create a second debug build type -

Image
i want create second build type should work existing debug type. have 2 build types: debug , release. debug 1 can run single click, , automatically signed debug keystore. manually compile release build through build -> generate signed apk wizard. so clone debug build type, first added second build type named "local" app build.graddle file: buildtypes { ... debug { debuggable true minifyenabled false } local { debuggable true minifyenabled false } } then created app/src/local/res , added files. then gradle resync , select new build type in left tab: finally click run button , expected work. intellij article says debug signing config default: this means if not configure artifact manually , select deploy default apk option in run/debug configuration: android application dialog box, intellij idea use predefined values in certificate generated instead, dialog shown: when click fix button, ope...

Custom iOS UIView Class MvvmCross Constraints - Draw(CGRect rect) Method Never Called -

i have situation cannot seem work out specific problem lies , i'm hoping little input. i have simple view @ moment has uiscrollview . in viewdidload method register listen view models propertychanged event this: public override void viewdidload() { base.viewdidload(); viewmodel.propertychanged += viewmodel_propertychanged; } private void viewmodel_propertychanged(object sender, system.componentmodel.propertychangedeventargs e) { if (e.propertyname == "mycollection") { buildui(); } } when event fired kicks off building view since data available within view model. in buildui method have code: view code private void buildui() { _mainscrollview = new uiscrollview(view.frame) { showshorizontalscrollindicator = false, autoresizingmask = uiviewautoresizing.all }; add(_mainscrollview); view.subviewsdonottranslateautoresizingmaskintoconstraints(); view.addconstraints( _mainscrollview....

Find the inverse of a Matrix in MATLAB, is inv(A) or A\eye(size(A)) more precise? -

this question has answer here: why matlab's inv slow , inaccurate? 3 answers the title explains already. if need find inverse of matrix, there reason should use a\eye(size(a)) instead of inv(a) ? , before ask: yes, need inverse, not calculations. ps: isequal(inv(a), a\eye(size(a))) ans = 0 so 1 more precise? update : question closed appeard duplicate of question " why inv in matlab slow , inaccurate ". question here differs not addressing speed, nor accuarcy of function inv difference of inv , .\eye calculate true inverse of matrix. if need inverse, should use inv . the inverse calculated via lu decomposition, whereas backslash operator mldivide calculates solution linear system using different methods depending on properties of matrix a (see https://scicomp.stackexchange.com/a/1004 ), can yield less accurate results inverse. ...

django - How to convert many to many field to foreign key? -

lets have model class like; class samplingquery(models.model): brands = models.manytomanyfield(brand) after while realize need convert manytomanyfield foreignkey need convert class foreignkey; class samplingquery(models.model): brands = models.foreignkey(brand) is there way without losing data? thank you there no simple mechanism, can following: create new foreignkey (say, brand ) copy existing data brands (by slicing first result since there can multiple manytomany relation) brand delete field brands

mysql - Issue with exceeding db queries in drupal -

we having drupal based website hosted @ www.fatcow.com. started giving error of exceeding maximum number of 'max_questions' resource error. described http://drupal.org/node/38996#comment-6295156 increased number of users. fatcow has limitation that. considering of moving vps. how find optimum plan our site? thanks ! i drupal tends quite resource hungry start adding modules , takes more efforts have scale. @ least 1 gig of ram in vps, set memory limit @ least 128m, customize mysql server query cache , max packet size. turn on content caching - if have lot of content not change much, may option. pressflow might option. option if using drupal 7 sqlite instead, depends on user usage scenario.

java - NullPointer Exception while read audio files -

i made program read audio files. @ first did absolute path because it's easyer develop. then cahnge relative path because want compress *jar . code method(at first short later code: 1.: @ first make filearray save files 2.: make array save audioclip 3.: loop read clips now code: private audioclip[] liesaudiodateien (file inputfile) { file[] datefilearray; audioclip[] tracks; datefilearray = inputfile.listfiles(); tracks = new audioclip[datefilearray.length]; (int = 0; < tracks.length; i++) { if (datefilearray[i].isfile()) { try { tracks[i] = applet.newaudioclip(datefilearray[i].tourl()); } catch (ioexception ex) { system.err.println("error!: -- " + ex.tostring()); } } } return tracks; } inputfile.listfiles() returns null, seems path isn't ok. path ok, because let print on c...

javascript - Materialize inputs not triggering onChange in React? -

i have materialize input so: <input type="date" classname="datepicker" onchange={this.props.handlechange} /> it being correctly initialised materialize, not firing onchange when value of datepicker changes. doing wrong here? problem seems extend materialize inputs.

c# - How to exclude property name in Xml serialization in web api response -

i have class named getunitresponse definition follows public partial class getunitresponse { [system.servicemodel.messagebodymemberattribute(name = "getunitresponse", namespace = "", order = 0)] [system.xml.serialization.xmlarrayitemattribute("unit", isnullable=false)] public unitout[]getunitresponse1; public getunitresponse() { } public getunitresponse(unitout[] getunitresponse1) { this.getunitresponse1 = getunitresponse1; } } i'm getting following xml response(getunitresponse) object <pre> <getunitresponse xmlns:xsi="" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <getunitresponse1> <unit day="2016-01-27" id="572"> </unit> <unit day="2016-01-27" id="573"> </unit> <unit day="2016-01-27" id="574"> </unit> ...

plot - changing pch with lines in R -

i plot several lines on graph , have them use different pch : plot(1:10, sample(1:10,10), pch=3) lines(1:10, sample(1:10,10), pch=1) lines(1:10, sample(1:10,10), pch=2) lines(1:10, sample(1:10,10), pch=3) lines(1:10, sample(1:10,10), pch=4) lines(1:10, sample(1:10,10), pch=5) however, of lines commands seem plot using same plotting character ignoring pch parameter. correct way of doing this? thanks default type= lines l makes line. plot line , symbol add type="b" or type="o" function lines() . plot(1:10, sample(1:10,10), pch=3) lines(1:10, sample(1:10,10), pch=1,type="o") type="o" means line go "inside" symbol , type="b" means line end before symbol.

c# - Trun off third party SDK after process exit/close/kill -

i've written c# application uses system.diagnostics.process class create process, using var process = process.start(startinfo); the process invoked serviceinvoker. service calls third party dll in cource of duration. after waiting time kill process using, process.kill(); even after killing process if dll executing wont stop. kill not invoke onexit event of process. how can stop dll execution in case. any in matter appreciable . maybe need kill process , children? /// <summary> /// kill process, , of children, grandchildren, etc. /// </summary> /// <param name="pid">process id.</param> private static void killprocessandchildren(int pid) { managementobjectsearcher searcher = new managementobjectsearcher ("select * win32_process parentprocessid=" + pid); managementobjectcollection moc = searcher.get(); foreach (managementobject mo in moc) { ...

angularjs - auto run a service function when a page is visited -

the routing.js code below injects given page using $routeprovider. each page has it's own controller uses service togglefactory. is there way automatically fire function "menutoggle" of service "togglerfactory" whenever page visited? thanks //---routing.js---------------------------- (function () { 'use strict'; angular .module('appmodule') .config(['$routeprovider', routing]); function routing ($routeprovider) { $routeprovider .when('/page1', { url: "/page1", templateurl: 'views/page1.html', controller: 'page1ctrl' }) .when('/page2', { url: "/page2", templateurl: 'views/page2.html', controller: 'page2ctrl' }) } })(); //---page1ctrl.js------------------------ (function ...

c# - Binding or Style setter to get the default value of another control Type's property -

while generic question , ask if possible scenario, specific problem want create datagrid header looks this: .------.-----------------.--------. | | name | | | sno. |-----------------| age | | | first | second | | |------|--------|--------|--------| |1 | joe | montana| 96 | |2 | mario | luigi | 69 | '------'------'----------'--------' however, cant seem border under "name" cell has same borderbrush similar datagrid's default headers. is there (hypothetical syntax): <border borderbrush="{binding elementtype={x:type datagridcolumnheader}, path=borderbrush}" borderthickness="0 0 0 1" > <textblock text="name" grid.column="0" grid.row="0" grid.columnspan="2" /> </border> if this, can bind property's value of control type , if changes theme, christmas! edit: looking xaml solution...i can ofcourse hac...

javascript - Cocos2D-JS can't load json file exported from CocosStudio -

i'm trying load json file exported cocosstudio v2.3.2 var myscene = ccs.scenereader.createnodewithscenefile('res/scene.json'); i got code sample-cocos2d-js-scene-gui-master problem is, error: can't find parser : undefined how fix issue? i'm new using javascript , hope can me this. thank you. try use ccs.load("") it's new api. function returns table {node, action} node it's scene "node" , "action" it's time line action it's optional. code this: var sceneres = ccs.load("res/scene.json"); this.addchild(sceneres.node); and if want use action, run node. sceneres.node.runaction(sceneres.action); sceneres.action.gotoframeandplay(0, true); hope help, , sorry english

Spring Boot and CORS -

i facing issue cors in spring boot. have configured cors this @configuration @enablewebmvc public class webconfig extends webmvcconfigureradapter { @override public void addcorsmappings(corsregistry registry) { registry.addmapping("/**"); } } which suppose enables header , other stuff. it works excellently request $.get("someurl, function(data, status){ console.log(data[0].latitude); }); but whenever make post request this $.ajax({ url: 'someurl', type: 'post', datatype: 'json', crossdomain: true, contenttype: "application/json; charset=utf-8", success: function (data) { console.log(data); }, data: object }); i following options xhr "someurl" [http/1.1 403 forbidden 4ms] cross-origin request blocked: same origin policy disallows reading remote resource @ "someurl". (reason: cors header ...

java - Cucumber get name of test runner class -

i'm trying name of current executing runner class, e.g. for: @runwith(cucumber.class) @cucumberoptions( features={"features"}, glue={"src.stepdefinition"}, monochrome=false ) public class helloworld { } i need have class name "helloworld" available in java code. know how it? i've tried this: http://ramblingsofaswtester.com/2013/04/15/cucumber-test-name-and-tags-on-feature/ , definitly goes right direction, doesn't contains runner class name. edit: because use maven can access system.getproperty("test") which contains package name class name.

linux - C# Graphics.DrawImage() transparent png background -

Image
i'm developing image editor application using c# of system.drawing.graphics class. app must able operate on windows , linux well. the scenario simple, have background image (jpeg, 24bpp, not progressive), , have draw transparent png images onto it. i'm using following pattern (with other coordinates , more images): bitmap backgroundjpg = new bitmap("bg.jpg"); bitmap transparentpng = new bitmap("transp.png"); using (var g = graphics.fromimage(backgroundjpg)) { g.drawimage(transparentpng, new point(0, 0)); } backgroundjpg.save("test.jpg"); on windows , result of process ok. on linux , looks png images not being handled correctly, looks not "transparent well" when being drawn graphics instance. (edit: i've checked, transparent, not way on windows.) edit: i'm interested in alternative solutions well, if runs both on windows , linux. edit 2: looks the transparency bad if transparent image has background behind ...

Create base Django model class for DB-view related models setting all ForeignKey-fields to on_delete=DO_NOTHING -

in django (1.6+) application, have many django models point (read only) db views. these models contain foreign key relations. if django application tries delete related fk-models, lead db errors ("cannot delete view") if don't set cascade=do_nothing on all foreign key fields. example: class personview(models.model): person = models.foreignkey(person, db_column='fk_person', on_delete=do_nothing) class meta: db_table = 'view_persons' managed = false since db-view-model-foreignkey-fields should have cascade=do_nothing default, i'd create db-view model base class automatically set foreign-key-fields on_delete=do_nothing, need care inheriting model - otherwise it's easy forget (and redundant) setting attribute fields. in end want end code this: class viewmodel(models.model): class meta: abstract = true def __init__(self, *args, **kwargs): super(viewmodel, self).__init__(*args, **kwargs) ...

android - how to add google play services in export library project -

i know question has been asked here before unable execute dex: multiple dex files define but didn't answer yet. export android location library using google play services when add google play services in client project then unable execute dex: multiple dex files define lcom/google/android/gms/r$attr; conversion dalvik format failed: unable execute dex: multiple dex files define lcom/google/android/gms/r$attr; exceptions occur. please suggest solution . advance p.s : develop on eclipse.

java - I want to display image using rest web services -

i need display image using rest web services have around 100 images in web content-->images folder want display using url @get @path("/get/{filename}") public bufferedimage getfile(@pathparam("filename") string filename) throws exception { return imageio.read(new file("e:/koticons/images/" + filename)); }

javascript - Show jquery value in HTML -

i'm approaching problem had yesterday different angle jquery/js skills basic least. i have div want increase transform value of every 5s: <div style="transform: translatex(0px);" id="slide_images"> ... </div> and using jquery code attempt can't work out how showpixels value work in html: jquery(document).ready(function($) { $(document).ready(function(){ var pixelarr = ['-1100px','-2200px','-3300px','-4400px'], counter = 0, timer = setinterval(function(){ pixeltimer(pixelarr[counter]); counter++ if (counter === pixelarr.length) { clearinterval(timer); } }, 5000); function pixeltimer(showpixels) { $("#slide_images").css("transform", "translatex(showpixels)"); } }); }); i know simple reason brain having hard ...

linux - Can't send mail from ubuntu -

i can't send mail ubuntu , when cat /var/log/apache2/error.log see following error: sh: 1: /usr/sbin/sendmail: permission denied note :- selinux disabled $ stat /usr/sbin/sendmail file: ‘/usr/sbin/sendmail’ -> ‘/etc/alternatives/sendmail’ size: 26 blocks: 0 io block: 4096 symbolic link device: 801h/2049d inode: 1318147 links: 1 access: (0777/lrwxrwxrwx) uid: ( 0/ root) gid: ( 0/ root) you need superuser use binaries found @ sbin . sendmail in /usr/sbin/ , have superuser , if not, permission denied error

html - Bootstrap pull-right not working as expected -

simple question here using bootstrap3 . wanted create sort of small filter reloads page below it. requirement align filter (two inputs , small button) content sitting below it, making fall to rightest position possible . i tried using pull-right class , indeed pulled filter right there's still more room fill. if check example provided below, you'll see my objective align button right side of purple row , fails. i don't understand why happens, assume it's related margin/padding issues rows.. i'm looking answer explaining why happens can understand problem , won't deal again :). you can check markup by clicking here on bootply also i'll post markup right here: <div class="container"> <div class="row" style="background:slateblue;"> <div class="col-xs-12"> <form role="form" class="form-horizontal"> <div class="form-group pull-right...

Prestashop: display "Choose language" inline in admin -

Image
i wanna simplify life , display language flags inline next input fields in admin panel. example: turn this: into this: i tried override abstract class modulecore { public function displayflags() } but no effect. then modify admin\themes\default\template\helpers\options\options.tpl to: <div class="displayed_flag"> {foreach $languages $language} <img src="../img/l/{$language.id_lang}.jpg" class="pointer" alt="{$language.name}" title="{$language.name}" onclick="changelanguage('{$key}', '{if isset($custom_key)}{$custom_key}{else}{$key}{/if}', {$language.id_lang}, '{$language.iso_code}');" /> {/foreach} </div> but still nothing. of course deleted class_index.php , clear cache etc... i using prestashop 1.5.5 , default theme. you're searching displayflags function inside /js/admin.js file. here works on installation...

css3 - Fluid Grid - How do I use them in Responsive Web Design? -

please forgive me, can please explain me purpose of fluid grid, featured on cssgrid, example. grid, refer columns, 9, others 12, others 24 columns... 1). grid used background, or stencil, correct sizing , positioning of divs? 2). essential fluid grid (9, 12, 24 columns) used in designing responsive website, or can use css3 , media queries define break points? 3). what's difference between number of columns, , why use 9, instead of 24 columns, example. higher column count better more content? 4). why there many fluid grid generators available? because each 1 better or different in way? thank you 1). grid used background, or stencil, correct sizing , positioning of divs? yes, that's more or less it. picture grid invisible stencil sizing , positioning of divs. since talking responsive design, widths of grid columns vary, depending on width of veiwer's browser window. 2). essential fluid grid (9, 12, 24 columns) used in designing responsive ...

What is the meaning of onsubmit="return false"? (JavaScript, jQuery) -

i know onsubmit event occurs when form submitted. generally is, calling method on onsubmit event <form action="" onsubmit="myfunction()"> today saw this, "<form action="" onsubmit="return false">" . how works? not understand meaning of onsubmit="return false" . ps : found when learning ajax. tutorial explains how submit data database without refresh page. this done manually handle form submission. for example - for validation purpose see below code , see how can beneficial: <script language="javascript"> myfunctionname() { if (document.myform.mytext.value == '') return false; //when return false - form not submit , not redirect else return true; //when return true- form submit , redirect // (actually part of submit) id have mentioned in action } </script> <form name="myform" onsubmit="return myfunct...

variables - What language is used in this '.format' file -

i have piece of code here used in custom program developing small assessments called "layout.format": # display assessment time limit timed=<time_limit>%session.timelimitmin%</time_limit> nottimed=<time_limit/> # display randomization key used generate assessment print_random_key=%print_random_key_text% print_no_random_key=%no_print_random_key_text% # page break definitions pagebreak= start_page_break= end_page_break= # definitions show answer boxes different question types answer_box_mc=<input type="radio"> answer_box_mr=<input type="checkbox"> answer_box_num=<input type="text" size=%choice.width%> answer_box_tm=<textarea cols="%choice.width%" rows="%choice.height%" >%choice.value%</textarea> answer_box_fib=<input type="text" size=%choice.width%> i can tell using html parts generate html page end user, wondered main language in snippet haven't see...

ruby - What is the Rails way to work with polymorphic associations? -

i have few models in rails application, are: user photo album comment i need make comments belog either photo or album , , belong user . i'm going use polymorphic associations that. # models/comment.rb class comment < activerecord::base belongs_to :user belongs_to :commentable, :polymorphic => true end the question is, rails way describe #create action new comment. see 2 options that. 1. describe comment creation in each controller but ths not dry solution. can make 1 common partial view displaying , creating comments have repeat myself writing comments logic each controller. doesn't work 2. create new commentscontroller this right way guess, aware: to make work, need declare both foreign key column , type column in model declares polymorphic interface like this: # schema.rb create_table "comments", force: :cascade |t| t.text "body" t.integer "user_id" t.integer "commentab...

tfs2015 - Is it possible to customize TFS to provide user friendly forms for registering bugs? -

i need let users register bugs similar how done in bug tracking systems. i'd create user friendly form layout guide user. standard create new workitem interface overloaded users. today manually through inbox , register bugs in tfs ourselves. pain. users not mark message in subject bug. need read understand user has problem. need ask them criticality level , deadlines fixing are. it easy miss important message , process distracts main activity. (based on having visual studio , having connected tfs in there) in visual studio, via menu, choose tools > process editor > work item types > open wit server edit: need install microsoft visual studio team foundation server 2015 power tools extension in visual studio gain access menu option above you presented popup box. @ point need navigate project collection wish make changes in. once selected presented list of forms can edit. e.g. task, bug, code review etc. if select task taken form have 3 tabs. field...

osx - Use https on localhost xampp on mac -

Image
i have been trying use xampp in localhost https. 1/ first step (certificate creation) seems okay. generated crt & key using openssl. using *.frenchpie.com common name. 2/ copied 2 respectively in /etc/ssl.crt/ & /etc/ssl.key/ folders. 3/ did following in httpd-vhosts.conf using found on stackoverflow <virtualhost *:443> documentroot c:/xampp/htdocs/frenchpie servername local.frenchpie.com sslengine on sslcertificatefile "conf/ssl.crt/frenchpie.crt" sslcertificatekeyfile "conf/ssl.key/frenchpie.key" </virtualhost> 4/ of course restarted xampp please note did not change else. website main folder "frenchpie" in htdocs. 127.0.0.1 mapped local.frenchpie.com using http://local.frenchpie.com/frenchpie works usual (homepage). using https://local.frenchpie.com/frenchpie gives me certificate error (see picture). any appreciated. if generate certificate openssl, when visit page browser have erro...

javascript - how to apply if statement for form's <select> relation -

in real, want make this: have 2 select field options in form, , want: if in first select option (for example id="2"), second select filed changes auto pay attention first field selected option. <form> <select> <option id="1"></option> <option id="2"></option> <option id="3"></option> </select> #in here if select option 1 id show select field 1th id: <select id="1th"> #options here... </select> #if select option 2 id show select field 2th id: <select id="2th"> #options here... </select> #if select option 3 id show select field 3th id: <select id="3th"> #options here... </select> </form> (change form other fields changing form select field). if can make jquery. better even. thanks. using jquery , value of first select element, easy create. <select id="first-select...

javascript - How to redirect all Angular request to index.html in Nginx -

i have create simple nginx config file server angular so: server { listen 80; listen [::]:80; root /path/to/apps/myapp/current/dist; access_log /path/to/apps/myapp/current/log/nginx.access.log; error_log /path/to/apps/myapp/current/log/nginx.error.log info; index index.html; location ^~ /assets/ { gzip_static on; expires max; add_header cache-control public; } location / { try_files $uri $uri/ =404; } } and works fine expected. because i'm using angular ui router , i'd forward pages index.html angular take on (so request example.com/users/new redirect nginx index.html , angular ui handle it) pages reloads, links, etc. how can achieve this? i've playing around options like: server { #implemented default, change if need different ip or port #listen *:80 | *:8000; server_name test.com; return 301 $scheme://www.test.com$request_uri; } as specified in this answer. couldn't similar work based on reques...

ruby on rails - RoR Impressionist capture external click -

i'm using impressionist gem record page views. let's have question model , answer model: question.rb: class question< activerecord::base has_many :answers is_impressionable answer.rb: class answer< activerecord::base belongs_to :question is_impressionable in questions\show.html.erb, have list of answers. when user hovers on answer, see 2 links appear: details , go to. details link opens answer show page (which provides more details) , records show impression , works correctly: answers_controller.rb: impressionist(@answer) the go page tricker. when user clicks on link: <%= link_to "go to", :class => 'answer_link', :remote=>:true, :data=>{outval: answer.type_url, cuid: answer.id.to_s, refval: user_question_path(@question.user, @question), txtval: answer.img_url} %> <span class="small_image"> <%= image_tag(answer.img_url, :alt => 'go answer', ...

linux - Android PID issue -

i've found interesting fact 1 of development. i tried use pid of installed application in phone. it able use information of installed application using getinstalledapplications of packagemanager class. pid not seen. pid provided runningappprocessinfo of activitymanager class. there questions. does pid generated when application executed? is pid of each application fixed value? 1. yes . pids assigned @ runtime of app. 2. no . pid of each app not fixed value, changes during runtime. uid of each app fixed value assigned during installation of app.

Hyperlink in excel macro -

i want method create hyperlink of variable in excel macro. requirement have capture link in variable ex: abc = inputbox("enter path") now want use abc parameter hyperlink function , create hyperlink name xyz. can me solve issue? ok, here code. doing 1. asking url want 2. storing url in variable called url 3. going sheet 1, adding hyperlink function cell a5, linking url input 4. displaying friendly name give in code let me know if have questions | need modify code url want or place links want. tested , working. please vote answer :) sub createhyperlink() dim url string url = inputbox("enter link") worksheets("sheet1") .hyperlinks.add anchor:=.range("a5"), _ address:="http://www." & url, _ texttodisplay:="google" end end sub

Android send Data from fragment to Activity -

i'm working on android app, datas in fragment , want use them in other fragment. looking create bundle, in activity simple getbasicinfos() method return bundle send other fragment. problem can't use method in activity. fragment = new dashboardfragment(); fragment.getbasicinfos(); //does not recognize method toolbar.settitle(getresources().getstring(r.string.dashboard)); break; i want know if there better way, or more simple. create interface in fragment , implement interface in activity while instantiating fragment = new dashboardfragment(this); pass listener , in fragment constructor save this public dashboardfragment(fragmentlistener listener) { this.listener = listener; } and use listener pass data activity . hope helps.

vba - All reference values in Excel sheet becomes '!#REF! when refering values from another sheet -

one of our excel program stops working , trying figure out why. in program, there multiple sheets. 1 cannot calculate value called "piston", , reason reference values sheet called "general input" fail refer. the following failed cells in "piston" sheets: ='general input'!#ref!*(0.0063/0.0111)*exp(-1*0.0214*$c$9) ='general input'!#ref!*exp(-1*0.0214*$c$9) =ab5*(ad5+ac5*dg5)/(ad5+ab5*dg5)/'general input'!#ref! =$c$8*0.0000032/('general input'!#ref!*piston!$c$4*piston!n10*(2*$c$6/1000)^2*('general input'!$c$16/1000)^2) =((bv9^3)*(bq9^2)/dj9/8+(bw9^3)*(br9^2)/dk9/4+(bx9^3)*(bs9^2)/ae9/4+(by9^3)*(bt9^2)/dl9/4+(bz9^3)*(bu9^2)/dm9/8)/12/'general input'!#ref!*$g$26/(1000000)^3 apparantly different values in "general input" fail @ same time. not 1 wrote code, , don't use well. asked fix bug. but want ask, there reason make referred value fail sheet? sorry if information provided vague. ...

cocoa - Why is an empty drawRect interfering with a simple animation? -

Image
i'm trying put own take on cocoa's nspathcontrol . in bid figure out best way handle expand-contract animation when mouse on component in control, put simple sample app. things going - mouse or out of view containing path components , you'd simple animation using following code: // code belongs pathview (not pathcomponentview) override func mouseentered(theevent: nsevent) { nsanimationcontext.runanimationgroup({ (ctx) -> void in self.animatetoproportions([cgfloat](arrayliteral: 0.05, 0.45, 0.45, 0.05)) }, completionhandler: { () -> void in // }) } // animating subviews func animatetoproportions(proportions: [cgfloat]) { let height = self.bounds.height let width = self.bounds.width var xoffset: cgfloat = 0 (i, proportion) in enumerate(proportions) { let subview = self.subviews[i] as! nsview let newframe = cgrect(x: xoffset, y: 0, width: width * proportion, height: height) subview.an...