Posts

Showing posts from July, 2014

Javascript image timout -

good day, i'm having problem code, can't show loading image few seconds, while post code getting in database , gives backinformation show. $("#poll_vote").click(function(){ var answer = $("input.panswer:checked").val(); var p_id = $("#p_id").val(); $("#poll_load").html("<tr><td align='center'><img src='/images/ajax/ajax4.gif'/></td></tr>"); $.ajax({ type: "post", data: "action=poll_vote&p_id="+p_id+"&answer="+answer+"&module="+module+"", datatype: 'html', url: "/ajax.php", success: function(data) { $("#poll_content").html(data); } }); }); i hope on fast help, i'm begginer in java, can't dicide myself. if want create delay loading animation shows (i believe is... mmm different, i'm going that...) what need se

c# - Hiding SuperSU and Kingo Root -

i'm trying hide root , supersu icons android devices. company wants hide them keep our app tidy without having icons on our phones. i've tried shelling pm hide com.kingoroot.com pm hide com.kingouser.com but icons remain, tried rebooting after same result. it should straight-forward: adb shell pm hide "package.name" ex: adb shell pm hide "com.jondouglas.application" after kicks in, should see: package com.jondouglas.application new hidden state: true after 5-10 seconds, icon disappear screens.

c# - Should I declare variables accesed by a SerialPort's callback as synchronized? -

i have callback added datareceived event of serialport . callback accesses class' properties. so, must these properties declared synchronized ? in other words, possible main thread accesses property while callback writing on it? here put example: class { private serialport serialport; [methodimpl(methodimploptions.synchronized)] // <-- necessary? public int prop { get; set; } public a(serialport sp){ serialport = sp; serialport.datareceived += (object sender, serialdatareceivedeventargs e) => { prop++; }; } } that's possible don't know whether happens because code of main thread not visible here. if 2 threads access prop must synchronized in form. in demo code [methodimpl(methodimploptions.synchronized)] enough. want protect more state single value. in case need lock manually using lock . [methodimpl(methodimploptions.synchronized)] code smell anyway. believe it's there java compati

reporting services - embedding existing tablix with several group levels into a main tablix - detail member with inner members -

in new ssrs 2008 report, embedding 18 tablixes 1 main tablix due data related particular student. each of 18 tablixes unique report user utilizes report parameter determine report(s) want have executed. process has 1 dataset being used. rows selected each report based upon column called report_number. each tablix (report) has filter parameter used determine rows dataset apply particular report. columns in dataset not being used particular report have value of spaces or zeroes in columns. this process has worked fine until existing report has embedded in main tablix. executing report has 4 levels of groupings summarization counts made @ different levels. error message displayed is, 'the tablix 'tablix1' has detail member inner members. detail members can contain static inner members'. to solve problem far, have used following links: http://blogs.lessthandot.com/index.php/datamgmt/dbprogramming/reporting-services-error-the-tablix/ , http://forum.mibuso.com/

javascript - jscript dropdown menu doesn't work on other buttons -

im creating navigation bar using button dropmenu. 1 button functions (abou button). clicking other button (blog) displays same dropmenu though put different menu it. here's code. thank help. javascript: function myfunction(){ document.getelementbyid("mydropdown").classlist.toggle("show"); } window.onclick = function(event){ if(!event.target.matches('.dropbtn')){ var dropdowns = document.getelementsbyclassname("dropdown-content"); var i; for(i = 0; < dropdowns.length; i++){ var opendropdown = dropdowns[i]; if(opendropdown.classlist.contains('show')){ opendropdown.classlist.remove('show'); } } } } html: <div class="dropdown"> <button onclick="myfunction()" class="dropbtn"> <img src="images/whitearrow.png" width="10" height="10" ></bu

how to file.write() an empty string if dictionary produces a KeyError in python -

i have particular problem json files. following code reads json, , writes txt file. have shortened code readability, in real code hundereds of fields , write statements. import os import json def _getjson(filename): """ returns list of dictionaries """ if not os.path.exists(filename): return [] open(filename, 'r') openfileobject: data = json.loads(openfileobject.read()) return data def writefile(filename, data): """writes file""" open(filename, 'w') f: d in data: f.write(d['field1'] + ' ' + d['field2'] + ' ' + d['field3'] + '\n') ## lot more code here def main(): filename = r'c:\input.json' data = _getjson(filename) outfile = r'c:\output.txt' writefile(outfile, data) if __name__ == '__main__': main() the problem is, field not in json, , produce

testing - How to Test the two stage translation in ARMv7 MMU? -

i have configured ttbcr , ttbr stage 1 translation. configured vtcr , vttbr stage 2 translation. faced issues abort solved now. know testing perspective how 2 stage translation in mmu tested when goes verification stage. need sure have done in application code correct. the strategy followed follows 1.) configure ttbcr , ttbr0 , ttbr1 2.) switch non secure world 3) configure vtcr , vttbr

angularjs - Error messages are not shown on clicking submit button using angular validation -

i working on angular form validations. apart rest of validations, want if submit form without touching field, error messages should shown in form.here using below code in name field if click on submit button without touching name field error in name field should shown red border not working- <div class="form-group" ng-class="{ 'has-error' : myform.name.$invalid && (myform.submitted || myform.name.$touched ) }"> <label for="username" style="color:#767676" class="" ng-hide="myform.name.$invalid && (myform.submitted || myform.name.$touched )">name</label> <label class="error_message_text" ng-show="myform.name.$invalid && (myform.submitted || myform.name.$touched )"> please enter name </label><br> <input type="text" name="name&quo

Bring the app to foreground and if it is already running rather than creating new instance of it in android -

in app want launch apps(messaging,contacts,etc)if launched app(messaging,contacts,etc) running in background want bring front.i tried using movetasktofront() doesn't implement above api 23(lollipop).so,i ended code: intent intent=getpackagemanager().getlaunchintentforpackage("com.android.mms"); intent.setflags(intent.flag_activity_new_task); startactivity(intent); by using code if launch messaging inside app launches,and if again launches same app inside app resumes , continue left it. when launches same messaging app default android launcher create new instance of messaging app on above of running messaging app launched app. don't know solution this.please me ... use below approach invoke intents within app this. intent intent = new intent(context, target_activity.class); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top | intent.flag_activity_new_task); startactivity(intent);

json - Ignore the "Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token" error -

i using api external partner. unfortunately, returned response not seem have fixed structure. ideally, api contract means won't violated keeps happening. anyways, happening field in json response map sometimes, out of blue list. for example, suppose following response get: { "majorinfo" : { "a" : "b" }, "minorinfo" : { "c" : "d" } } but on rare occasion i'd list instead of map or other violation of contract. for example: { "majorinfo" : { "a" : "b" }, "minorinfo" : [] } i using jackson map response pojo. in cases, when contract violated, error, exception in thread "main" com.fasterxml.jackson.databind.jsonmappingexception: can not deserialize instance of java.util.linkedhashmap out of start_array token in case, lose information in field majorinfo though adhered contract. there way can ignore field when not adhere

java - Spring boot dependency injection error -

i'm new spring , tried performing simple crud operation using spring boot i'm having issues dependency injection here's code: package com.teamapt.alm.model; import javax.persistence.*; import java.io.serializable; /** * created abayomi on 03/12/2015. */ @entity @table(name = "report") public class report implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) @column(name = "id", nullable = false) private integer id; @column(name = "type", nullable = false) private string type; @column(name = "query", nullable = false) private string query; @column(name = "summary", nullable = true) private string summary; public integer getid() { return id; } public void setid(integer id) { this.id = id; } public string gettype() { return type; } public void

MusicPlayer in Android status bar -

i have android app plays mp3 files. have programmed main functions play/pause forward, backward buttons, manipulating seekbar, getting current position , on. want make app continue playing closed app. , when close it, want appear thing widget in status bar basic actions (displaying app icon, track name, play/pause button). , also, want seekbar work when reopen app. can me. i'm beginner in android java, perfect if answer contains steps. beforehand i think tutorial match query android custom notification music player example

mysql - Table with date, then next date -

i looking generate table 1 date followed next date in set, given criteria. raw data: id date 1 2000-01-01 1 2000-01-02 1 2000-01-04 1 2000-01-10 1 2000-01-14 1 2000-01-15 1 2000-01-16 1 2000-01-18 2 2000-02-01 2 2000-02-02 2 2000-02-04 2 2000-02-10 2 2000-02-14 2 2000-02-15 2 2000-02-16 2 2000-02-18 would result in: id date date 1 2000-01-01 2000-01-02 1 2000-01-02 2000-01-04 1 2000-01-04 2000-01-10 1 2000-01-10 2000-01-14 1 2000-01-14 2000-01-15 1 2000-01-15 2000-01-16 1 2000-01-16 2000-01-18 1 2000-01-18 null 2 2000-02-01 2000-02-02 2 2000-02-02 2000-02-04 2 2000-02-04 2000-02-10 2 2000-02-10 2000-02-14 2 2000-02-14 2000-02-15 2 2000-02-15 2000-02-16 2 2000-02-16 2000-02-18 2 2000-02-18 null i know have use se

c# - How to get the value of the last element of property in repeater -

Image
<asp:repeater id="reptservices" runat="server" onitemdatabound="reptservices_onitemdatabound"> <b> <td> <%# eval("applicationsteps") %></td> <td><%# eval("service.servicename") %></td> <td> <b><%# eval("beneficiaryuserunitjob.user.namear") %> </b> </td> <td><%# eval("datecreated") %></td> </b> </asp:repeater> this repeater filled in c# reptservices.datasource = new applicationlogic(applicationtype.web).getalloutboxapplication(_currentuserunitjob); "applicationsteps"property contains many elements,which contains property called submitactiontypeid image shows: i want value of s

javascript - Use require & es6 import side by side -

is there pitfalls of using webpack's require , es6's imports in same file? example (two imports in same file): import view1 'mobilecomponents/view1'; //because if statement impossible in es6 imports static const view2 = require(process.env.project === 'mobile' ? 'mobilecomponents/view2' : 'desktopcomponents/view2'); i'm using es6 imports. started desktop version of project , want reuse of code. want import desktop version of code , don't want totally downgrade webpack requires.

jquery - Getting status 0 and statusMessage "n/a" in IE7 after ajaxForm.submit() -

i'm uploading file using hayageek upload plugin, uses ajaxform plugin. problems start when want handle upload errors ie7. works fine in firefox, chrome , ie10, in ie7 status 0 in response's xhr object, no matter if server returns error or not. this controller's code: response.statuscode = 400; //no matter code return, 0 return json(new {errorid = 400, level = 1, message = "error message"}, jsonrequestbehavior.allowget); and i'm getting in xhr object using ie7: {aborted: 0, responsetext: "<div class=...", responsexml: object {...}, status: 0, statustext: "n/a"} notice in responsetext entire view, instead of "error message". happens when specify response.statuscode. if comment line response.statuscode = 400; correct message in responsetext , still status : 0 . i've tried datatype: 'json' , status : parseerror , because it's trying parse responsetext, entire view in html instead of error message i

Convert from one date format to another in javascript -

this question has answer here: convert date 1 format format in javascript 4 answers i want convert date 16:07:19 format july 19, 2016 in javascript. should implement complete functionality or have readily available thing use in javascript same? kindly help. in advance! you use moment.js than instance moment('2016-01-01').format('mm/dd/yyyy');

r - Fail to use boxplot in ggplot2 -

Image
given such data frame: dt val 02-09 0.1 02-09 0.2 02-09 0.15 02-10 0.3 02-10 -0.1 ... i want use boxplot show medium, variance of val in each dt : ggplot(data = df,aes(y=val,x=dt)) + geom_boxplot() but got : it can observed there 1 box. when tried outlier.colour = "red" , points red. why? values in interval of (-1,1) this should explain problem: set.seed(42) x <- rnorm(10) x <- c(x, rep(0, 100)) #add 100 0 values boxplot(x) quantile(x, c(0.25, 0.5, 0.75)) #25% 50% 75% # 0 0 0 if have many (almost) identical values, quartiles (almost) identical.

c++ - QTreeView, style each level differently -

my problem similar this question . i have qtreeview connected model. possible style each level of tree in different way? need change background color of each line. different level have different background. expanded items have different color well. i have tried http://doc.qt.io/qt-4.8/stylesheet-examples.html#customizing-qtreeview seems not possible using css. qproxystyle help? how used? thank you, martin. if using custom model (derived qabstractitemmodel or similar), can achieve returning appropriate value qabstractitemmodel::data() when data appearance role requested: qvariant mymodel::data(const qmodelindex& index, int role) const { switch(role) { case qt::displayrole: { ... break; } case qt::backgroundrole: return qcolor(qt::red); case ... } return qvariant(); } using qstandardmodel can set data these roles qstandarditem::setdata() .

Importing Docker Images Images From The Public Registry Into OpenShift -

Image
i trying deploy ubuntu image here on openshift online (next generation). these steps followed in doing so $ oc new-project test $ oc new-app jedisct1/phusion-baseimage-latest deployed webconsole however failed deploy , error status of "image pulled off" on pod page. particular thing may doing wrong? below logs of entire proccess. root@home:~# oc new-project test using project "test" on server "https://api.preview.openshift.com:443". can add applications project 'new-app' command. example, try: $ oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git build new hello-world application in ruby. root@home:~# oc new-app jedisct1/phusion-baseimage-latest --> found docker image 7ff0885 (14 hours old) docker hub "jedisct1/phusion-baseimage-latest" * image stream created "phusion-baseimage-latest:latest" track image * image deployed in deployment config "phusion-baseimag

Maps in Android CardView in Recycler View -

i'm trying inflate card view in recycler adapter view , error no such instance kasualjob im. here adapter public class kasualjobadapter extends recyclerview.adapter<kasualjobadapter.myviewholder> { private googlemap mmap; protected latlng mmaplocation; private list<kasualjob> kasualjoblist; private fragmentmanager fragmentmanager; public kasualjobadapter(list<kasualjob> kasualjoblist, fragmentmanager fragmentmanager) { this.kasualjoblist = kasualjoblist; this.fragmentmanager = fragmentmanager; } public class myviewholder extends recyclerview.viewholder { public textview kasualjobtitle, kasualjobdescription, kasualjoblocation, kasualjobdateposted, kasualjobuser; public supportmapfragment kasualjobmap; public myviewholder(final view view) { super(view); kasualjobtitle = (textview) view.findviewbyid(r.id.textview_kasual_job_name); kasualjobdescription = (t

javascript - Excluding extra pages appeared while converting data-table to pdf using jsPDF-AutoTable plugin -

i have been trying print minimal data-table using jspdf-autotable plugin. here live demo . my codes - html <button id="cmd">generate pdf</button> <div id="content"> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>name</th> <th>position</th> <th>office</th> <th>age</th> <th>start date</th> <th>salary</th> </tr> </thead> <tfoot> <tr> <th>name</th> <th>position</th> <th>office</th> <th>age</th> <th>start date</th> <th>salary</th> </t

twitter bootstrap - password validation using jquery issue -

i have app validating passwords. have popup(bootstrap) lists rules , change x check based on meeting conditions. working fine except 1 scenario. i type in password1 , check happens , fine, type in 2nd password , fine. if move away password fields , come password field, invalid. technically matching password.(i tried change class glyphicon-ok in both password fields, issue reverse) password fields <form:input id="password1" type="password" class="form-control" path="password11" title="password check" data-toggle="popover" data-placement="bottom" data-html="true" data-content="<span id=&quot;char&quot; class=&quot;glyphicon glyphicon-remove&quot; style=&quot;color:#ff0004;&quot;></span>10-30chars</li></ul><br>" /> <form:input id="password2" type="password" class="form-control" pa

java - Lights out game using 2d arrays -

i'm trying make lights out game, simplified change 1 tile @ time i'm still encountering 1 bug. can click change yellow black can't click , have opposite happen. here game if unfamiliar: http://www.logicgamesonline.com/lightsout/ my code: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.net.*; public class lightsoutpanel extends jpanel implements mouselistener { private boolean[][] lights; public static void main(string[] args) throws exception { jframe frame = new jframe(); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.settitle("lights out!"); frame.setresizable(false); frame.setvisible(true); lightsoutpanel panel = new lightsoutpanel(); if (panel.lights == null) { system.out.println("you did not initialize light array!" + "it's still null..."); system.exit(-1);

sql server - SQL: Struggling to join 3 tables from a many-to-many relationship -

i have 3 tables: users - username procedures - seriesnum,procnum (composite pkey),description,currentrev usersprocedures - username,seriesnum,procnum,revtrained,leveltrained,datetrained how query shows, each user, procedures, , if trained in procedures, values in usersprocedures table (and if they're not trained, values come null because they're not present). the closest i've got query: select procedures.seriesnum,procedures.procnum,description,currentrev,revtrained,leveltrained,datetrained,users.username procedures,users left join usersprocedures on usersprocedures.username = users.username however doesn't work because values it's pulling usersprocedures table same each procedure, rather being unique each procedure. -- select whatever columns select p.*, u*, pu.* -- cross join conmbines rows both tables procedures p cross join users u -- add exp mix left join usersprocedures pu on pu.username = u.username , p.seriesnum = pu.seri

nginx - Why google drive change permission of the file and how to solve it? -

i sharing project non technical team , share using google drive. have nginx docker mount html folder in google drive. every time run docker 403 access denied. , google drive add ^m character @ end of each line of index.html. i using osx. there way can solve this? running docker exec chmod files mounted trick solve forbidden error. learnt google drive not suitable purpose , consider move git.

html - Why does an overflow:auto scrollbar take width out of my div? -

i have absolutely positioned div , overflow:auto . when overflows vertically, vertical scrollbar appears. appears within div (even though isn't fixed width), shrinks space available div's contents. in case, causes text wrap unnecessarily, undesirable. see https://jsfiddle.net/hktgcrj0/ - shrink page until div overflows , scroll bar appears - see text wrap. is there way make scrollbar appear outside of div , or increase width of div accommodate scroll bar? note application (the fiddle massively simplified) giving div fixed width not option, , disabling text wrapping not option. try adding: div { white-space: nowrap; } or wrap inner elements in <p> tags , apply white-space: nowrap; that.

gradle - Android Studio Export jar not exporting any jar -

i new android studio, , trying export jar out of android studio project unity project. i followed instruction given on link create android plugin unity using android studio but whenever i'm trying export showing "build successful" , "external task execution finished 'exportjar'" not able find jar in specified folder of gradle file. i looked folders "app/release" empty , "app/build/intermediates/bundles/release/" contains folder named "instant-run". so bit confused whether skipping step or looking on wrong path. i m using android studio v2.1.2 app.build file apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "24.0.0" defaultconfig { applicationid "com.example.merchantapp" minsdkversion 8 targetsdkversion 19 } buildtypes { release { minifyenabled false proguardfile

Android 2-way sync-ing approach -

i'm developing app list shops around area category. have rest api results returned in paginated mode (page=2, limit=20 etc) , users need login app in order view listing. i'm thinking incorporate offline 2 way sync app. moment when user logs in first time has connected internet , subsequently once has logged in should able proceed straight main screen eventhough app offline. user has ability post review offline in suppose should cache post request in db , listen network state changed event? once there's network query in cache , send server. i understand how can achieved @ high level i'm still new android , not exposed popular libraries out there. wondering there library doing magic me? i stumble across sync adapter , content provider seems quite complicated beginner. there simpler library can achieve similar results? also understanding way how works be.. there service periodically poll server changes - , fetch when there's store sqlite. on poll retrieve

apache - Direct or indirect contact, between web client and socket server without using Node.js -

Image
information socket server needs passed client. (and vice versa) the client doesn't have reload page. each client needs have own (indirect) connection. a connection socket server cannot broken. i'd rather not use node.js i haven't come across solutions here don't involve node.js. ajax doesn't seem option because breaks connection. have send requests php page , keep track of client send data back, not good, way recource intensive. has got ideas, should use? btw: socket.io seems good, involves node.js. host doesn't support , i'd need learn first. i'd rather find else. creating connection directly client socket server better, don't think clients can user browsers connect socket server doesn't use get/post etc. the way open continous socket browser using websockets api . api uses websocket protocol enable bi-directional continous sockets opened browser. cannot open socket server though, need connect server capable of sp

javascript - Lightbox like a popup -

this code lightbox, it's necessary click show content, , need appearing without click. automatic. kind pop up. $(document).ready(function() { $('.lightbox').click(function() { $('.background, .box').animate({ 'opacity': '.60' }, 500, 'linear'); $('.box').animate({ 'opacity': '1.00' }, 500, 'linear'); $('.background, .box').css('display', 'block'); }); $('.close').click(function() { $('.background, .box').animate({ 'opacity': '0' }, 500, 'linear', function() { $('.background, .box').css('display', 'none'); });; }); $('.background').click(function() { $('.background, .box').animate({ 'opacity': '0' }, 500, 'linear', function() { $('.background, .box').css('display', 'none'

angularjs - How to sort list using Angular Sortable and Rails -

i'm stuck problem. i;ve built api in rails , client in angular. i've got model called todo has property called order . when create new todo, automatically assign newly created todo value order so: @todo = todo.create(todo_params) @todo.order = todo.count + 1 and display todos: @todos = todo.where(...).order(:order.desc) in client i'm using sortable ui manipulation , there's method called onupdate gives me new indexes array. the problem i'm having indexes considerably different value i've in order property. when aforementioned function called item , 2 more values: newindex , oldindex , problem doesn't give me index of other todos, how can reorganise on database? i'd appreciate i'm bit @ loss here. ps: please note rails api only, no views. edit output wanted: let's imagine this: have 3 items in database: {name: a, order: 1}, {name: b, order: 2}, {name: c, order: 3} . in front-end, while using ng-repeat, each item have $

c++ - Why is trying to store a pointer to function ambiguous -

here code: #include <functional> #include <iostream> #include<vector> using namespace std; // vector iterator template <class t> class vit { private: //vector<t>::iterator it; vector<t> m_v; function<bool (t, t)> m_fptr; int len, pos; public: vit(vector<t> &v) { this->m_v = v; len = v.size(); pos = 0;}; // it= v.begin(); }; bool next(t &i) { //if(it == m_v.end()) return false; if(pos==len) return false; //i = *it; = m_v[pos]; //if(idle) { idle = false ; return true; } //it++; pos++; return true;}; //bool idle = true; void set_same(function<bool (t,t)> fptr) { m_fptr = fptr ;}; //void

sql - Get number of constraints associated with a column -

i have been trying number of constraints associated column using sql command. i know if there exists column.number_of_constraints how can information? i'm working oracle database. the answer in regard oracle database. thanks all_cons_columns describes columns accessible current user , specified in constraints. https://docs.oracle.com/cd/b28359_01/server.111/b28320/statviews_1042.htm you need query data dictionary see table columns , corresponding constraints. can try below query: select * user_cons_columns table_name = '<your table name>';

html - Code for making a drop down navigation bar responsive -

so have tried code drop down responsive navigation bar, navigation bar there problem not responsive. put code down below. appreciated if tell me additional code needed add appreciated. if needed add javascript fine. html <!doctype html> <html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=us-ascii"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link rel="stylesheet" type="text/css" href="style.css"> <title>home|tourist advice|explore new zealand</title> </head> <body> <ul class="css3menu"> <li class="active"><a href=""><span>home</span></a></li> <li class="has-sub"><a href="aboutne