Posts

Showing posts from August, 2015

asp.net - Javascript confirm method not working -

i have button delete record in asp.net grid view <asp:button id="btndelete" cssclass="btn btn-delete" tooltip="delete" runat="server" commandname="delete" commandargument='<%#eval("idjob")%>' usesubmitbehavior="false" onclientclick="return confirm('are sure?')" /> when click on rowcommand not fire. if remove onclientclick works. can me please. in place of onclientclick use onclick. onclick execute javascript when button clicked. <asp:button id="btndelete" cssclass="btn btn-delete" tooltip="delete" runat="server" commandname="delete" commandargument='<%#eval("idjob")%>' usesubmitbehavior="false" onclick="return confirm('are sure?')" />

How to process multiple levels of results with a single loop in bash? -

i need create loop extend describe network nodes. loop part of else not relevant topic. know in network 1 node connected , on. have these nodes in separate files , need process them loop. each loop produce more results within need perform more loops , number increases exponentially until breaking point reach. know how solve problem 50 nested loop's this: declare loopvarnode=($(some command list of nodes)) in ${loopvarnode[@]} declare check1=($(grep ${a[@]} results.file)) if [[ "$a" == "breaking point" ]] echo "match found"; break elif [[ ! $check1 -z ]] continue fi echo ${a[@]} >> results.file declare loopvarnode1=($(same thing results in provided variable $a)) b in ${loopvarnode1[@]} declare check2=($(grep ${b[@]} results.file)) if [[ "$b" == "breaking point" ]] echo "match found"; br

python - Keep User and Group in same section in Django admin panel -

i have made own user model in django 1.8 with from django.contrib.auth.models import abstractuser, group, permission class myuser(abstractuser): pass but not figure in admin longer. i have tried adding admin page with from django.contrib.auth import get_user_model, models auth_models django.contrib.auth.admin import useradmin usermodel = get_user_model() class myuseradmin(useradmin): pass admin.site.register(usermodel, myuseradmin) and figure in admin in different 'section' group . how can keep user in default section in admin panel? you need add app_label meta class of myuser. class myuser(abstractuser): pass class meta: app_label = 'auth' official documentation on app_label .

javascript - AngularJS Inheritance between services -

i'm quite new angular world , have gotten problem want implement interface(isch) behavior. i have "core" factory part of domain , looks following: (function() { 'use strict'; var domainmodel = angular.module('my.model'); domainmodel.factory('ivehicle', function(timezone) { function ivehicle(dto) { this.timezone = new timezone(); this.dto = dto; this.engine = dto.engine; this.descriptor = this.getdescriptor(); } ivehcile.prototype.getdescriptor = function() { if (this.type === -1) { return "this diesel vehicle"; } else if (this.type === 0) { return "this fuel vehicle"; } else { return "this environment vehicle"; } }; ivehicle.prototype.isgenericactivity = function() { return true;

apache - Recommendations based on product view history using Mahout -

i working on e-commerce website. want create recommender based on user's product view history using apache mahout. right now, able generate recommendations based on rating data user provides. right now, input recommender user_id, item_id , ratings. want create recommender generates recommendations based on products viewed user. can tell me how can achieved? ps. need use apache mahout. mahout can handle boolean preferences implicit ratings are. boolean datamodels can created csv files or databases postgresqlbooleanprefjdbcdatamodel or mysqlbooleanprefjdbcdatamodel classes. main difference recommendations non-boolean ratings boolean preferences, similarities should tanimoto or log likelihood similarities. example code mahout homepage this: datamodel model = new filedatamodel(new file("booleanpref.dat")); usersimilarity usersimilarity = new tanimotocoefficientsimilarity( model); userneighborhood neighb

graph - how to count the repetition of the relationships in neo4j -

i trying calculate number of relationships between 2 nodes repeated more 1 time. using merge clause . so, there possibility calculate if relationships repeated more 1 time. graphically can not see because while using merge clause relationships merge if nodes , relations same. in data repetitions exist. example, if node a calls node b , call relationship more 10 times. when use merge clause appear 1 time avoid repetitions in graph. can count repetitions cypher query or not? in advance if have (a)-[:calls]->(b) way count number of calls relationships between , b be match (a)-[r:calls]->(b) return count(r) however, you're using merge should create 1 calls relation between , b. if you're sure there multiple calls relationships between , b either usage of merge incorrect, or these relationships existed earlier before started using merge . either way, neo4j browser (post 2.2) show nice curved relationships between , b if more 1 exist, , query ab

jquery - How can i hide shown div if user did not hover mouse on shown div -

i have 2 divs close each other. when hover on div one, div 2 showing. if don't mouse hover on div 2 should fadeout. or if move mouse div 1 elsewhere div 2 should fadeout. $(".one").mouseover(function () { $(".two").show(); }); $(".two").mouseleave(function () { $(".two").fadeout(1); }); js fiddle you can add mouseover event on body , act according current target. close/hide element, if mouse hovers anywhere in body excpet .one , .two $("body").mouseover(function (e) { if(!($(e.target).is('.one') || $(e.target).is('.two'))){ $(".two").fadeout(); } }); updated fiddle

Android weightsum not working as expected -

i have 1 horizontal linear layout width = match_parent , weightsum=5. if insert 5 vertical linear layouts each width=0 , weight=1 looks expected, layouts each same width. if add 2 vertical each width=0 , weight=1 take more space should. expected them take 1/5 of space. maybe correct behaviour take more space , understood concept of weight/weightsum wrong. thanks help! edit: try add code linearlayout linear=null; linearlayout.layoutparams layoutparams= new linearlayout.layoutparams(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content); linear=new linearlayout(getapplicationcontext()); linear.setorientation(linearlayout.horizontal); linear.setlayoutparams(layoutparams); linear.setpadding(15, 0, 15, 10); linear.setweightsum(float.valueof(modulo)); //modulo 5 in example linearlayout linear2=new linearlayout(getapplicationcontext()); li

add functions to javascript / JQuery object -

$(".box").each(function(){ $(this).distance_left = function() { return $(this).offset().left - $(this).parent().offset().left; } $(this).distance_top = function() { return $(this).offset().top - $(this).parent().offset().top; } }); when call distance_left or distance_top on .box object, box.distance_left not function . why? you need extend prototype: $.fn.distance_left = function() { return -1; }; and can use on jquery objects: $('#myid').distance_left(); // -1 anyway particually case can use $(this).position().left; $(this).position().top;

c# - Using SerialPort to discard RF Device Buffer -

i'm writting small application automatically connects correct serial port sending list of commands, , waiting response serial device (rf transmitter). serial port objects sends commands in decimal format, reset, login , query command. when query command sent, device replies response - when response received know have correct serial port connection. all of works fine, receive error device - error 130: tx queue overflow . error can resolved restarted device (rf transmitter), frequency of error silly. am correct in thinking tx overflow error caused when buffer on hardware becomes full? thought simple discardinbuffer after opening connection device fix - doesn't. when should use discardinbuffer , using in correct context? -- edit after more comments , thoughts, i've come conclusion serialport.discardinbuffer won't current situation, rather need discard buffer on actual rf device - hence why inplugging works. you've sent data device, , output

view - Rails tagging fail when printing the name of the tag -

i busy building tagging system in ror. system i've coded according to: http://tutorials.jumpstartlab.com/projects/blogger.html#i3:-tagging when print out tag.name works looks entire tag_list object printed out directly next it. view render in browser clarifies problem: # post tags: [ tag1 tag2 tag3 [#, #, #] ] where each bracket shows as: tag id: 27, name: "tag1", created_at: "2015-05-12 09:24:02", updated_at: "2015-05-12 09:24:02"> ... times 3 (in case.) # (somehow stackoverflow doesn't show completeness of mess dealing in browser brackets.) ... direct consequence of piece of code in show.html.haml: tags: [ = @post.tags.each |tag| = link_to tag.name, tag_path(tag) ] and want this: # post tags: [ tag1 tag2 tag3 ] # or without brackets. doesn't matter. post.rb model looks this: has_many :taggings has_many :tags, through: :taggings def tag_list=(tags_string) tag_names = tags_string.s

.net - Initialize MongoClient with MongoClientSettings in C# -

i'm trying initialize mongoclient mongo 2.0 driver follows: mongoclientsettings settings = new mongoclientsettings(); settings.waitqueuesize = int.maxvalue; settings.waitqueueutimeout = new timespan(0,2,0); settings.minconnectionpoolsize = 1; settings.maxconnectionpoolsize = 25; settings.server = new mongoserveraddress("mongodb://localhost"); client = new mongoclient(settings) however, when try insert document code: db = client.getdatabase("local"); col = db.getcollection<bsondocument>(collectionname); col.insertoneasync(new bsondocument().add(new bsonelement("id",bsonvalue.create(1)))).wait(); it doesn't anything. doesn't inserted, , no error message (although after while first chance exception of system.timeout appears in output). if initialize client with client = new mongoclient("mongodb://localhost") it work , uploads document intended. i want client able handle high write throughput, tried these settings

css - Rails Sass: variables arenot passed with @import -

i have rails project uses twitter bootstrap , sass. scss files structured folders have better overview. want define file global variables contains colors etc. , pass values down other files have less redundant code. while code imported , applied, variables don't work. here current setup: stylesheets/application.css.scss @import "main"; /* stylesheets/ | |– base/ | |– _typography.scss # typography rules | |– components/ | |– _buttons.scss # buttons | |– _messages.scss # nachrichten | |– _dropdown.scss # dropdown | |– helpers/ | |– _globals.scss # sass variables | |– _functions.scss # sass functions | |– _mixins.scss # sass mixins | |– _helpers.scss # class & placeholders helpers //more files omitted | |– vendors/ | |– _bootstrap_and_overrides.css # bootstrap | |– _scaffolds.scss # bootstrap | | `– main.scss # primary sass file */ im not using =require method not allow use variables , mixins (w

How can I best implement feature flags in AngularJS / Rails? -

for app rails backend , angularjs @ front, how implement feature flags or in other words conditional features per user? this video gave glimpse on how that, looks quite crude me. i using rollout gem authorization. in case, feature flags implemented totally on client side, feel "not secure , robust way of disabling/enabling features" i can't use <% if $rollout.active?(:chat, current_user) %> in partials since not erbs, html pages used angular templates. thank in advance. so use jwt . jwt token can use rails app authenticate users. imagine hotel card. depending on how paid, access services or others. let access garage or breakfast. going technical details, when user logs in in app, rails create 1 of tokens , rails can put there flag want, can send token containing: {user_id: 3, rollout: true, admin: true} so in angular side, can parse token , activate sections need, along lines: <div ng-if="user.rollout"></div> s

Java: Classes do not find each other in package (factory design pattern) -

i have 3 different classes: woman.java package human; public class woman extends human{ private final string pnr; private final string namn; public woman(string n, string p){ namn = n; pnr = p; } public string tostring(){ return "my name "+namn+" , woman."; } } man.java package human; public class man extends human{ private final string pnr; private final string namn; public man(string n, string p){ namn = n; pnr = p; } public string tostring(){ return "my name "+namn+" , man."; } } human.java package human; public abstract class human{ public static human create(string namn, string pnr){ char nastsist_char = pnr.charat(9); // takes second last char in pnr string nastsist_string = character.tostring(nastsist_char); float siffra = float.parsefloat(nastsist_string); //converts float if ((siffra

javascript - How do I get the value of td and pass it on input in each td element? -

i'm still newbie in jquery world :) making looks , problem getting text in each <td> , passing input. i have code: <div class="grid-l1"> <table> <tr> <td> testing <input type="text"> </td> </tr> <tr> <td> testing 2 <input type="text"> </td> </tr> </table> <span class="edit">edit</span> <span class="update">update</span> </div> here's jquery code: <script> $(document).ready(function(){ $('body').on('click', '.edit', function() { $(this).hide(); $('table tr td input').show(); $('.update').show(); }); $('.update').click(function(){ $(this).hide(); $('table tr td input').hide()

java - Android two-way service communication -

i have activity , local bound service. i've got bound service , running fine, can handle communication client server, through functions on server/binder interface. however need 2 way communication, service @ point need notify activity (and user) happened, , needs wait user action before proceeding. in other words, need servers calls clients synchronous or blocking. i.e. when service calls function pass few parameters on client, trigger alertdialog user use, , options determine return status code sent service. until point, want service halt , wait until has recieved response, determine there (service continues run, service shuts down etc.) so there way in android this? need reference activity, , needs expose these blocking methods can call them service , wait response. i've got interface client activity, i'm struggling on how on service. don't want use serialization , add reference intent extra, both client , service have many members not want serializable. tha

wireless - In 802.11, is it possible to send authentication request packets from a device to the access point without sending probe requests? -

i trying send authentication requests several spoofed mac addresses ap. when ran wireshark, able see authentication responses ap. how possible no probe requests packets have been sent these spoofed mac addresses. this looks stateless. have read, have understand, there 3 states - unauthenticated, unassociated authenticated, unassociated authenticated, associated simply, answer "yes, possible send authentication request packets without sending probe requests". as far know, probe requests necessary allow mobile devices obtain information aps @ (i.e. instead of waiting beacons).

ios - Deploying ad-hoc apps on ipad without knowing the clients UDID -

i'm developing exclusive app clients. app distributed them specifically, don't want have uploaded on app store. problem is: when packing app .ipa file, need specify udids of devices able run app. trying pry them out of clients inconvinient and, frankly, practically impossible. originally, thought impossible because of apple's strict safety policy, we've found out it's possible somehow if have enterprise account, do. can somehow make work installing .mobileprovision file along .ipa on arbitrary device , make work. we've seen our competition this: http://www.devicepharm.com/2011/08/how-to-install-enterprise-applications-on-the-ipad/ what kind of certificates/mobileprovisions must create make work? how make app distribuable this? if use beta fabric distribute builds. need obtain email ids invite them beta. once accept invitation on mobile device. missing udids shown when try send build email ids through fabric plugin can include in adhoc provisio

android - ExoPlayer doesn't show video Warning message -

i try run exoplayer demo app on test device android 4.2.2 , kernel version 3.0.50. video not showing, progress bar moving. in logcat have same messages until cancel video: 05-12 10:58:36.910 9027-9291/com.google.android.exoplayer.demo w/﹕ warning message amessage(what = 'omx ', target = 1) = { int32_t type = 0 void *node = 0x9 int32_t event = 2130706433 int32_t data1 = 0 int32_t data2 = 0 } unhandled in root state. someone has similar problems , messages? maybe not exoplayer. i've found solution. device used other default codecs need. in mediacodec.java function getmediacodecinfointernal filter available codecs "omx." prefics. need omx.google. filtering choose software decoder.

html - Making a 960px wide site mobile friendly -

i updating website meet google mobile friendlyness requirements. website has been designed fixed width of 960px if set viewport width=960, initial-scale=1 mobile friendly checker extension reports following problems: score: 61 viewport configuration 10 font legibility 40 size , proximity of links 18 if set viewport width=device-width, initial-scale=1 website flows outside of viewport , following errors: score: 64 content viewport 50 size , proximity of links 7 in order google verify mobile friendly need go down width=device-width, initial-scale=1 route , update styles accordingly? there other workaround? if try trick google benefit of rankings should prepared 'punished' google it. fast become same links issue sites drop out of ranks altogether because of dodgy practices. so, don't it! perhaps temp fix should include adding new classes css reshape [/hack] ever going out of viewport area, e.g. @media (max-width: 767px) { .rightsideb

csh - foreach random no match -

this code: set source_failed = `cat mine.log` set dest_failed = `cat their.log` foreach t ($source_failed) set isdiff = 0 set sflag = 0 foreach t2 ($dest_failed) if ($t2 == $t) set sflag = 1 break endif end ... end problem inner foreach loop runs okay first few 10 iterations. after iteration, got foreach: no match moreover, iterating on array of strings, not files. reason behind error? the problem (probably) mine.log and/or their.log contain special globbing characters, such * or ? . shell try expand file. there no matches accidental pattern, , hence error "no match". the easiest way prevent behaviour add set noglob top. tcsh(1) : noglob if set, filename substitution , directory stack substitution (q.v.) inhibited. useful in shell scripts not deal filenames, or after list of filenames has been obtained , further expansions not desirable. you can re-enable behaviour usin

postgresql - multi byte character issue in Redshift -

i unable convert multibyte characters in redshift. create table temp2 (city varchar); insert temp2 values('г. красноярск'); // lower value insert temp2 values('Г. Красноярск'); //upper value select * temp2 city ilike 'Г. Красноярск' city ------------- Г. Красноярск i tried below, utf-8 characters converting lower. select lower('Г. Красноярск') lower ------------- г. красноярск in vertica working fine using lowerb() function. internally like , ilike operators use postgresql's regular expression support. support proper handling of utf-8 multibyte chars in regular expressions added in postgresql 9.2. redshift based on postgresql 8.2 (?) , looks haven't backported support forked version. see postgresql regex match uppercase, unicode-aware you can work around this, limitations, using like lower('Г. Красноярск') instead. expression index may useful.

C function pointer callback as struct member with "self" reference parameter -

this question has answer here: forward declaration of struct in c? 2 answers want create task struct containing function pointer callback execute said task. task contains parameters pass "this/self" pointer of struct callback executor function. creates circular dependencies , i've been digging around trying various forward declarations etc can't seem right. missing makes impossible, or c syntax wizardry horribly weak. changing task* void* seems cheating? in task.h : // create function pointer type signature executing task typedef int (*executor) (task* self); // create task type typedef struct { executor exec; // callback execute task ... // various data task } task; forward declare struct task , declare function pointer using struct task , declare struct task , typedef task . struct task; typedef int (*executor) (struct t

How to reuse a File Handler to open multiple files -

i have write piece of code can't predetermine filename creating. due keep single file handler. close this. create file using same file handler. sample code: public void sample(string input) { // value of string changes dynamically // , accordingly new file needs created. string filename = input; file file = new file(filename); filewriter fw = new filewriter(file); bufferedwriter bw= new bufferedwriter(fw); // code write contents file. bw.close(); } now, invoking function "sample" multiple times different file names. when tried above sample code, getting nullpointerexception. can guide me going wrong? regards, harish

c++ - Qt with qwt runtime error: QWidget: Must construct a QApplication before a QWidget -

i trying make app using qt 5.4.1(and qwt 6.1.2).here environment: windows 7 x64 visual studio 2012 qt5.4.1 static qwt6.1.2 and have built qwt qt static libs successfully. creat widget class inherited qwtplot,and creat mainwindow has object of widget. build project. however,there runtime error: qwidget: must construct qapplication before qwidget . this widget class inherited qwtplot: #pragma once #include <qwt/qwt_plot.h> #include <qwt/qwt_plot_curve.h> class drawwidget: public qwtplot { public: drawwidget(qwidget *parent ); ~drawwidget(void); }; drawwidget::drawwidget(qwidget *parent ) : qwtplot( parent ), carve(null) { } and follow mainwindow class: #ifndef mainwindow_h #define mainwindow_h #include "drawwidget.h" #include <qtwidgets/qmainwindow> class mainwindow : public qmainwindow { q_object public: mainwindow(qwidget *parent = 0); ~mainwindow()

Oracle APEX 5 nested Label not selecting input -

i have upgraded oracle apex 5 , had strange issue of inputs not being selected. i narrowed down controls nested within label. it seems if there no 'for' attribute , 'id' on control fails. //this not check input <label><input type="checkbox"><span>this test</span></label> so can manually change prove works. <label for="chktest"><input id="chktest" type="checkbox"><span>this test</span></label> however if save above html file , load , both work. i noticed in older apps in apex 4 inputs work , wrapped in label element....

Can an app post in a facebook group -

i want learn how make facebook app, not sure possible want. know possible in app post messages on user's wall. want know if possible post message in facebook group user member of ? and recommend: javascript or php app? yes possible. see documentation here: https://developers.facebook.com/docs/graph-api/reference/v2.3/group/feed use whichever solution best meets needs , easiest code. both solutions can post edge.

caching - Google Ajax feed cache -

i getting pinterest board feed via ajax call. changes on wall not visible in result. have searched solution around caching. seem have problem implementing it. //url feed var url = 'http://pinterest.com/' + this.options.username + '/feed.rss?nocache=' + (new date).gettime(); ///google service var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=" + encodeuricomponent(this.url) + "&num=" + this.options.limit + "&output=json_xml&callback=?"; this trows error: uncaught typeerror: cannot read property 'feed' of null {"responsedata": null, "responsedetails": "feed not loaded.", "responsestatus": 400} when leave out '?nocache='+(new date).gettime(). cached feed loaded.

jmeter - CPU usage of Jboss JVM goes upto 99% and stays there -

Image
i doing load testing on application using jmeter , have situation cpu usage applications jvm goes 99% , stays there. application still work, able login , activity. but, it’s understandably slower. details of environment: server: amd optrom, 2.20 ghz, 8 core, 64bit, 24 gb ram. windows server 2008 r2 standard application server: jboss-4.0.4.ga java: jdk1.6.0_25, java hotspot(tm) 64-bit server vm jvm settings: -xms1g -xmx10g -xx:maxnewsize=3g -xx:maxpermsize=12g -xx:+useconcmarksweepgc -xx:+useparnewgc -xx:+usecompressedoops -dsun.rmi.dgc.client.gcinterval=1800000 -dsun.rmi.dgc.server.gcinterval=1800000 database: mysql 5.6 (in different machine) jmeter: 2.13 my scenario that, make 20 users of application log , perform normal activity should not bringing huge load. some, minutes process, jvm of jboss goes , never comes back. cpu usage remain till jvm killed. to better understand, here few screen shots. i found few post had cup @ 100%, nothing there same situatio

mysql - how to do a full text search with php pdo? -

so i'm having trouble current search website. current search achieve this; user inputs "crik" , return "cricket" search. if user inputs "crickets" wont return "cricket" search. how work? current php code is; $searchq = $_get['search']; $ssss = $pdo->prepare('select * listing name :search'); $ssss->bindvalue(':search', "%" . $searchq . "%"); $ssss->execute(); i've tried didnt return anything; $ssss = $pdo->prepare('select * listing match(name) against (:search in boolean mode) '); you can change search string $searchq = $_get['search']; $searcharr = str_split($searchq ); $searchq_new = ""; foreach($searcharr $alpha) { $searchq_new .= $alpha . "%"; } now can use code search $searchq_new

how to send push notification to arduino -

i know if there gcm arduino. i'm working on project need send push notifications arduino connected wifi shield. arduino action based on notification gets or sync server data. advice on how need proceed helpful. thank you. yes can send push notification arduino. there multiple ways can send push notification arduino. i using push notification parse.com.to send push notification parse register parse.com , create account there. once create account,you can send push notification parse dashboard. to receive notification on arduino need write sketch on arduino, following sketch help. include parse library make sure following code work. /*************************************************************************************************************************** setup function ****************************************************************************************************************************/ void setup() { bridge.begin(); serial.begin(9600); while

java - Amazon SnS push notifications are not sent -

i trying send push notifications through amazon sns. when manually created gcm application @ amazon , application endpoint gives following error {message body: {"gcm":"{\"collapse_key\":\"welcome\",\"data\":{\"message\":\"hello world!\"},\"delay_while_idle\":true,\"time_to_live\":125,\"dry_run\":false}"}} {message attributes:} may 12, 2015 11:10:09 com.amazonaws.http.amazonhttpclient logrequestid info: x-amzn-requestid: 60749365-b72d-5a0e-8eca-deae2ca89839 caught amazonserviceexception, means request made amazon sns, rejected error response reason. error message: invalid parameter: targetarn reason: no endpoint found target arn specified (service: amazonsns; status code: 400; error code: invalidparameter; request id: 60749365-b72d-5a0e-8eca-deae2ca89839) http status code: 400 aws error code: invalidparameter error type: client request id: 60749365-b72d-5a0e-8eca-de

Android - File Chooser modules cannot show directories and files inside storage in KitKat -

i want application load file file chooser. i'd tried modules implements it, strangely kitkat rooted phone, , unrooted earlier version can read directories , files inside storage, unrooted kitkat version cannot read inside storage. here's module tried , code used : android-file-chooser intent intent = new intent(this, filechooser.class); arraylist<string> extensions = new arraylist<>(); extensions.add(".csv"); intent.putstringarraylistextra("filterfileextension", extensions); startactivityforresult(intent, 0);` afiledialog intent intent = new intent(this, filechooseractivity.class); intent.putextra(filechooseractivity.input_start_folder, environment.getexternalstoragedirectory()); intent.putextra(filechooseractivity.input_regex_filter, ".*csv|.*csv"); this.startactivityforresult(intent, 0); also, here's permissions used inside androidmanifest <uses-permission android:name="android.permission.camera" /&g

mysql - SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known -

Image
i download https://github.com/luciddreamz/laravel laravel openshift upload on repository on github . code connect database not work. problem load variable .env file locate in root of project for solve problem change .env # local environment # production, see .openshift/.env app_env=application_env app_debug=true app_url=openshift_app_dns app_key=openshift_secret_token db_driver=mysql db_host=openshift_mysql_db_host db_port=openshift_mysql_db_port db_database=openshift_app_name db_username=openshift_mysql_db_username db_password=openshift_mysql_db_password cache_driver=apc session_driver=file my error :sqlstate[hy000] [2002] php_network_getaddresses: getaddrinfo failed: name or service not known createconnection('mysql:host=openshift_mysql_db_host;port=openshift_mysql_db_port;dbname=openshift_app_name', array('driver' => 'mysql', 'host' => 'openshift_mysql_db_host', 'port' => 'openshift_mys

javascript - Angular Directive to ScrollLeft on Drag Bug -

i wrote angular directive called dragscroll scrolls horizontal overflowing element right or left based on dragging on canvas. please refer fiddle how works: 1. horizontal scroll @ 0. 2. mousedown @ right end of div , while holding 3. mousemove left 4. page scrolls right. 5. mouseup stops dragging. , vice versa. however there bug. this occurs when 1. horizontal scrollbar in middle of div, 2. "mousedown" on part of canvas (pink) part , 3. mousemove left edge, , hold it, scroll happens continuously, not desired behavior. have not coded scrollleft behavior kind of event. dont know why happening. please help. the problem seems because of default behavior of scrolling event outside of windows browser. can stop default behavior adding e.preventdefault() inside horizontalscroll method. working fiddle

Eclipse diff viewer to use as standalone application -

is possible use eclipse standalone application can use external diff viewer tortoise svn example ? needs 'path executable takes 2 command line arguments' file paths compare. reasonable start-up timing. most eclipse operations work on files in workspace not possible. in general have write 'headless' (no gui) eclipse rcp use eclipse plugins. ensures eclipse osgi plugin system , workspace initialized properly.

javascript - How to animate the list? -

this jsfiddle as can see fiddle there list being scrolled of arrows.. want animate transition when list visible , hidden. i don't know animation. have seen many examples , tried adjust them example it's not working... how list animate? $(document).ready(function(){ var code=''; for(var i=1;i<=20;i++) { code+="<li>list item "+i+"</li>"; } $('#list-items').html(code); }); var list_items = []; var index = 0; var list_length = 0; function getalllistitems() { var temp = document.getelementsbytagname('li'); (i = 0; < temp.length; i++) { list_items.push(temp[i]); } list_length = temp.length; } getalllistitems(); function move(dir) { if (dir == left) { list_items[index].style.display = 'block'; index--; if (index < 0) { index = 0; } }

ios - how to load two tableview in same view controller with cell for index row? -

i facing 1 module consists load 2 different uitableview in same uiviewcontroller know doing mistake, problem cell row atindexpath in table view method. getting 1 uitableview in uiviewcontroller secondviewcontroller not return values in cell. here sample code ur reference: - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (tableview==table) { return [self.arrydata count]; } else return [tblarr count]; nslog(@"tabecount==>%lu",(unsigned long)tblarr.count); } - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 55; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; static nsstring *cellidentifier1 = @"cell"; dequeuereusablecellwithidentifier:cellidentifier]; uitableviewcell *cell; mobileplandetailscelltableviewcell *plan_cel

Facebook comments plugin not showing up (while the codes are present) -

the blank area on lower right side facebook comments should not showing. correct codes there. here url: http://dev16.thinqcloud.com/videos/bb4a0c4313ad9f6e3dacdc2236552ac2 if can me out, appreciated!

How to show nested pri files in project pane of Qt Creator? -

Image
this question has answer here: proper (tree) display of qt project using .pro , .pri in qtcreator 2 answers i have .pri file named deploy.pri in project .pro file. deploy.pri : include(part1.pri) include(part2.pri) as see includes 2 other .pri files. these pri files displayed in qt creator project pane in same level : i want know if there way show them nested , in hierarchical way tree? first nest modules subdirs . template = subdirs subdirs += project1 \ project2 then include part1.pri , part2.pri using ../ depending on depth of subdirectories include(../part1.pri)

asp.net - Kendo Grid not binding to JSON result from ASMX Web Service -

i have problem binding kendo grid asp.net asmx web service. following html code <!doctype html> <html> <head> <title></title> <link rel="stylesheet" href="styles/kendo.common.min.css" /> <link rel="stylesheet" href="styles/kendo.default.min.css" /> <link rel="stylesheet" href="styles/kendo.dataviz.min.css" /> <link rel="stylesheet" href="styles/kendo.dataviz.default.min.css" /> <link href="styles/kendo.common-bootstrap.min.css" rel="stylesheet" /> <link href="styles/kendo.bootstrap.min.css" rel="stylesheet" /> <link href="../bootstrap/bootstrap.min.css" rel="stylesheet" /> <script src="../scripts/jquery-2.0.3.min.js"></script> <script src="js/kendo.all.min.js"></script> <script sr

php - HTML select default value from database -

i trying add html " select dropdown list " gender. want default value database php framework. can that? pseudo code: $default_gender = getdefaultgendervaluefromdb; <select name="genderselected"> <option value="m"<?php echo ($default_gender == 'm')? selected:'';?>>male</option> <option value="f"<?php echo ($default_gender== 'f')? selected:'';?>>female</option> </select> valid code snippet: <?php $default_gender = 'm'; ?> <select name="genderselected"> <option value="m" <?php echo ($default_gender == 'm')? 'selected="selected"':'';?>>male</option> <option value="f" <?php echo ($default_gender == 'f')? 'selected="selected"':'';?>>female</option> </select>

Java - printing one character at a time using recursion -

i'm trying print 1 character @ time string recursively such as: va ava java java o java lo java llo java ello java hello java but code below: public static string displaystuffr(string x){ return displaystuffr(0,x); } public static string displaystuffr(int i,string x){ if (i<x.length()){ return x.substring(x.length()-1-i) + displaystuffr(i+1,x);} return x; } public static void main(string args[]){ system.out.print(displaystuffr("hello java")); } displays: avaavajava javao javalo javallo javaello javahello javahello java much appreciated when return string @ time use new line string returned in display function return x.substring(x.length()-1-i)+"\n" + displaystuffr(i+1,x); and update if condition i < x.length()-1

liferay - How to update custom field expando values for all users? -

i have 1 boolean custom field expando values each user. on events want update field. currently below code inside hook works fine: for (user user : users) { user.getexpandobridge().setattribute("myfield", false); } and have tried below code wont work: expandotable expandotable = expandotablelocalserviceutil.gettable(companyid); expandocolumn expandocolumn = expandocolumnlocalserviceutil.getcolumn(companyid, classnameid, expandotable.getname(), "myfield"); expandovaluelocalserviceutil.addvalues(classnameid, expandotable.gettableid(),expandocolumn.getcolumnid(), classnameid, "myfield"); the working code (e.g. loop) give solution question. if you're looking single-sql instruction update of fields: note might leave stale caches. if don't have large number of users loop shouldn't run long. if, on other hand, have significant amount of users, assumption portal rather busy - , in case i'd not clear caches make sure th

How to rescale the intensity range of a grayscale 3 dimension image (x,y,z) using Matlab -

Image
i can't find information online intensity rescaling of 3d image made of several 2d images. i'm looking same function imadjust works 2d images. my 3d image combination of 2d images stacked have process 3d image , not 2d images 1 one. i can't loop imadjust because want process images one, consider information available, in directions. for applying imadjust set of 2d grayscale images taking whole value account, trick might work a = imread('pout.tif'); = imresize(a,[256 256]); %// re-sizing match image b's dimension b = imread('cameraman.tif'); im = cat(3,a,b); %//where a,b separate grayscale images of same dimensions %// if have images separately edit line %// im = cat(2,a,b); %// , avoid next step %// reshaping 2d matrix apply imadjust im = reshape(im,size(im,1),[]); out = imadjust(im); %// applying imadjust %// reshaping original shape out = reshape(out,size(a,1),size(a,2),[]); to check: x = out(:,:,1); y = ou

shiny - Deploy R app in shinyapps.io- Error:parsing manifest [SOLVED] -

i want publish app in shinyapps.io website. when run deployapp() got message: error: unhandled exception: child task 32916512 failed: error parsing manifest: unsupported locale: 4409_4409.utf-8 execution halted preparing deploy application...done uploading application bundle...done deploying application: 42336... waiting task: 32916511 error: parsing manifest ################################## begin log ################################## ################################### end log ################################### error: unhandled exception: child task 32916512 failed: error parsing manifest: unsupported locale: 4409_4409.utf-8 execution halted i read data txt file i tried r version 3.1.1, 3.1.3, 3.0.2 still error there. edit: found out, error appears when publish blank server.r simple ui.r here codes , server.r library(shiny) library(ggplot2) shinyserver(function(input,output){ output$graph <- renderplot({ if(input$radiobutton=="tools"){

How to supress page header on report footer in Crystal reports -

i have 4 page header section , terms , conditions appear on page 3 onwards. 3-6 pages terms , conditions in page footer. need suppress header on page footer.fyi, had issue of last section of page duplicating on nextpage.henceforth conditionally suppressed text object in page header section. i'm unable use pagecount on section -> sectionexpert -> formula due duplication.

c++ - Want to debug Pintos with Eclipse -

pintos: http://courses.mpi-sws.org/os-ss11/assignments/pintos/pintos_11.html goal: execute instructions in link under "f2: eclipse". don't work spit. can communicate between 2 terminals via "target remote localhost:1234", apparently not between terminal , eclipse (without gnu debugging server). alternatively, if it's not possible host , target machine simultaneously without gdbserver, can stop going in circles. please help!

android - Do we need to specific its UI components (Spinner, EditText) colors explicitly when using AppCompat -

Image
previously, have dialogfragment , doesn't specific ui components (spinner, edittext) colors explicitly. dialog_fragment_layout.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingtop="10dp" android:paddingbottom="10dp" android:paddingleft="10dp" android:paddingright="10dp" android:orientation="vertical" > <spinner android:id="@+id/country_spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minwidth="200dp" android:layout_marginbottom="10dp" /> <edittext android:id="@+id/name_edit_text" android:layout_width=&q

Why onClick event not work on dojo MenuItem? -

i'm studying dojo 1.10.4, problem onclick event not work on dijit/menuitem . tried on other item widgets dijit/checkedmenuitem , dijit/radiomenuitem , none of click events work, , api docs didn't give tips it. at last, found works if it's contained in dijit/menubar . should item widgets contained in dijit/menubar or dijit/menu ? how events processed on dojo widgets? for example: <html> <head> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/claro/claro.css"> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="async:true,parseonload: true"></script> <script> require(["dojo/parser"],function(parser){ parser.parse(); }); </script> </head> <body class="claro"> <div data-dojo-type="dijit/menubar" > <div data-dojo-

mysql - Select where field in values (if field in value not exist return as null) -

i want select data in clause. have $values: 1,2,3,4 and want select rows table in values. select `date` another_table id in (1,2,3,4) if another_table have rows id 1,2 , 3 only, mean id of 4 not exist. want id of 4 still selected return of null or nol or never. another_table -------+-------------+ | id | date | ---------------------- 1 yesterday 2 today 3 tomorow 5 today the expected result be -------+-------------+ | id | date | ---------------------- 1 yesterday 2 today 3 tomorow 4 never how this? thanks in advance as 1 option use inline view rowsource, , perform outer join operation. can use if expression check whether matching row returned another_table , know id value not null if there matching row, join predicate (in on clause) guarantees that.) as example: select n.id

java - org.eclipse.swt.SWTException: Graphic in Eclipse Graphiti when executing feature -

i working graphiti application , implemented feature modifies attribute of resource. upon changing, notifies implemented resourcesetlistener class , updates respective shape in diagram editor. doing fine , want do, except display popup error saying "graphic disposed". org.eclipse.swt.swtexception: graphic disposed @ org.eclipse.swt.swt.error(swt.java:4441) @ org.eclipse.swt.swt.error(swt.java:4356) @ org.eclipse.swt.swt.error(swt.java:4327) @ org.eclipse.swt.graphics.font.getfontdata(font.java:184) @ org.eclipse.draw2d.scaledgraphics.getcachedfontdata(scaledgraphics.java:533) @ org.eclipse.draw2d.scaledgraphics.zoomfont(scaledgraphics.java:922) @ org.eclipse.draw2d.scaledgraphics.setlocalfont(scaledgraphics.java:848) @ org.eclipse.draw2d.scaledgraphics.setfont(scaledgraphics.java:767) @ org.eclipse.draw2d.figure.paint(figure.java:1111) @ org.eclipse.draw2d.figure.paintchildren(figure.java:1167) @ org.eclipse.draw2d.figure.paintclientarea(figure.java:1202) @ org.eclipse.