Posts

Showing posts from July, 2012

C++ QT QFileDialog does not close when using system() in triggered action -

void obj_loader::on_actionopen_triggered() { qstring filename = qfiledialog::getopenfilename(this, tr("open file")); if (!filename.isempty()) { filepath=filename.toutf8().constdata(); command.append(filepath); int tempnumone=command.size(); (int a=0;a<=tempnumone;a++) { //get letters char list can used system(); cmd[a]=command[a]; } openfile=true; if (openfile) { openfile=false; system(cmd); } } } when system(cmd); called qfiledialog window not close till system command finishes. know if can close search window after clicking open. the system function blocks event loop: user interaction requires event loop run, , runs when code isn't running. since system invocation in code, can't have block process. need use qprocess has asynchronous interface. this answer provides complete example of 1 process calling -- done single executable.

bluetooth - Can you use Nest for devices not directly related to smarthome? -

our company creates activity trackers family (like fitbit or jawbone), track steps (there no sleep feature or anything). i wondering if possible , allowed use nest central hub sync via bluetooth physical activity of family members entering house , send data server or app, if doesn't impact thermostats. nest documentation doesn't seem mention aspect, wasn't sure if possible. thanks! i don't believe nest has bluetooth hardware. , purpose of api enable control , reading of nest specific data.

Can Azure VM snapshots be deleted safely? -

i used cloudxplorer create snapshot on vhd of vm doing installs on. installs went okay, okay delete snapshots or need somehow merge them in ensure can backup current vm state? snapshots point-in-time representation of blob (in case, page blob storing vhd). it's read-only, , it's disposable. if page in vhd's page blob changed, new page created snapshot, represent original state of blob. once delete snapshot, list of pages, along created pages preserve snapshot's state, deleted (and no impact on original blob). note won't able delete original blob until first delete of snapshots (and can delete blob+snapshots @ once).

Embedded mongodb in camel service -

is there way can use embedded mongodb in camel peoject. know there camel-mongodb . couldn't find example of using embed mongodb . db should able use throughout camel service life time. camel java, can't embed native applications without serious efforts. technical issues put aside, have worry struggle license (agpl). i'd answer no. see following mongodb embedded in java

ios - Hide device Volume HUD view while adjusitng volume with MPVolumeView slider -

Image
i implementing video player mpmovieplayer in ipad application, used mpvolumeview volume control. problem when scroll volume view adjust volume showing device's volume hud overlay in screenshot below. how can disable system volume indicator hud? code : @property (weak, nonatomic) iboutlet mpvolumeview *playbackmpvolumeview; //customizing controller - (void)customizevolumecontroller { _playbackmpvolumeview.showsroutebutton = yes; _playbackmpvolumeview.showsvolumeslider = yes; [_playbackmpvolumeview setvolumethumbimage:[uiimage imagenamed:@"volume_slider_thumb.png"] forstate:uicontrolstatenormal]; } swift 3 let volumeview = mpvolumeview(frame: .zero) view.addsubview(volumeview)

graph - ISO C++ forbids intilization of member maxY -

that's code using graphs in arduino i'm getting error saying iso c++ forbids intilization of member maxy. can know why? class graph { float maxy = 0; float maxx = 0; int maxi = 0; boolean dot=true; boolean rightaxis; boolean errorflag=false; boolean showmouselines=true; because c++ forbids initialisation of instance members in-line that. you should initialise them in constructor or, if they're meant class variables (one shared across all instances) rather instance variables, make them static.

php - Call to undefined method DB::prepare() -

i using pdo statement fetch details db, below pdo using <?php define('db_host', 'localhost'); define('db_name', 's_ao'); define('db_user', 'sd'); define('db_pass', '****'); define('db_char', 'utf8'); class db { protected static $instance = null; final private function __construct() {} final private function __clone() {} public static function instance() { if (self::$instance === null) { $opt = array( pdo::attr_errmode => pdo::errmode_exception, pdo::attr_default_fetch_mode => pdo::fetch_assoc, pdo::attr_emulate_prepares => true, pdo::attr_statement_class => array('mypdostatement'), ); $dsn = 'mysql:host='.db_host.';dbname='.db_name.';charset='.db_char; self::$i

linux - PHP crashed on server -

This summary is not available. Please click here to view the post.

jquery - How to display a image from a table in a div when i mouse hover to the table row? -

consider have table 2 rows. each rows contains user image. ( have populated table data json using ajax call). , when mouse hover particular row, should display particular rows image in div. how achieve using jquery ? i think want show image in div. have solved in fiddle. here jsfiddle html code <table> <tr> <td><img src="http://www.mentoringminds.com/images/linkedinicon.png" alt="" /></td> </tr> <tr> <td><img src="https://cdn4.iconfinder.com/data/icons/pictype-free-vector-icons/16/view-256.png" alt="" /></td> </tr> </table> <div id="displaydiv"> <img src="" alt=""/> </div> js code $("td img").mouseover(function(){ $("#displaydiv img").attr("src",$(this).attr("src")); }); hop, may you. have nice day. :)

elasticsearch - Elastic search find sum of two fields in single query -

i have requirement of find sum of 2 fields in single query. have managed find sum of 1 field, facing difficulty add 2 aggression in single query. my json following way { "_index": "outboxprov1", "_type": "message", "_id": "jxpdpnefskko-hij3t9m4w", "_score": 1, "_source": { "team_id": "1fa86701af05a863f59dd0f4b6546b32", "created_user": "1a9d05586a8dc3f29b4c8147997391f9", "created_ip": "192.168.2.245", "folder": 1, "post_count": 5, "sent": 3, "failed": 2, "status": 6, "message_date": "2014-08-20t14:30z", "created_date": "2014-06-27t04:34:30.885z" } } my search query { "query": { "filtered": { "query": {

sql - How do I display DATE in 'DD MON YYYY' format? -

i newbie oracle database programming , wish insert date (also display) in 'dd mon yyyy' format. (ps: involves insert event). data type (date or timestamp) suitable option me in order accomplish format? how supposed that? thanks. a date column not have format. so format use when inserting or updating data irrelevant displaying data (that's 1 of reasons why should never store date in varchar column). any formatted output see date column in sql tool (e.g. sql*plus) applied tool. not part of data stored in column. when providing date literal should either use to_date() function explicit format mask: insert some_table (some_date_column) values (to_date('27-06-2014', 'dd-mm-yyyy')); i not recommend using formats written month names (27-jun-2014) when supplying date literal because also depend on nls settings of client computer , might produce (random) errors due different languages. using numbers more robust. i prefer use ansi date li

Date Extracted from datetime in sql server 2008 -

i have column of datetime , give date stored procedure , check against column in sql table. entries in column contains time date have compare date part of column given input. please reply alter procedure [dbo].[db] @date datetime begin select * [dbo].[production_schedule] datepart('yyyy',date)= datepart('yyyy-mm-dd',@date) end; exec [dbo].[db] '2002-07-01',1,0 i have give date in procedure have select rows have same date in column date. try this select * [dbo].[production_schedule] convert(date,date)= convert(date,@date)

from mysql to javascript -

i'm trying draw polyline coordinates mysql through javascript function within jsp file tried code below doesn't work! <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialisation(){ var centrecarte = new google.maps.latlng( 47.381381, 0.687503 ); var optionscarte = { zoom: 12, center: centrecarte, maptypeid: google.maps.maptypeid.roadmap } class.forname("com.mysql.jdbc.driver"); connection conn = null; statement state = null; resultset resul= null; conn = drivermanager.getconnection("jdbc:mysql://localhost:3306/new","root","pass"); state=connection.createstatement(); string sql ="select lat, lng route "; result = statement.executequery(sql); while(result.next()){ s1= result.getfloat(lat); s2= result.

Exact use of abstract class and Interface in java -

i have gone through many examples abstract classes , interface not getting wats use of doing so, because both doing same job .can give me easy example figure out riddle first of all,revision of basic diffferences :- variables declared in java interface default final. abstract class may contain non-final variables. members of java interface public default. java abstract class can have usual flavors of class members private, protected, etc.. java interface should implemented using keyword “implements”; java abstract class should extended using keyword “extends”. an interface can extend java interface only, abstract class can extend java class , implement multiple java interfaces. a java class can implement multiple interfaces can extend 1 abstract class. interface absolutely abstract , cannot instantiated; java abstract class cannot instantiated, can invoked if main() exists. in comparison java abstract classes, java interfaces slow requires indirection. cons

vb.net - Making SQL password query case sensitive using COLLATE -

i using following sql code in vb in vs2013. want create login form using database of users stored userlist. query not case sensitive. how change query string use collate or other case sensitive comparison dim check string = _ "select count(*) expr1 userlist having (username = '" & _ _usernametextbox.text & "') , ([password]= '" & _passwordtextbox.text & _ "') , (usertype = '" & user.tostring & "')" search .commandtext = check .connection = cn if .executescalar() = 1 me.hide() if user = "trader" trader.show() elseif user = "broker" broker.show() elseif user = "corporate" corporate.show() elseif user = "system" systemmanager.show() end if else : msgbox("incorrectinput

Count null diagonals in a matrix -

i'm trying create program counts number of null diagonals in square matrix, can't seem find correct way of making index run correctly through matrix. here's incorrect code i've got far: # include<stdio.h> # define max 100 int diagonnull (int n, int a[max][max]) { int i, j, count, null; banda = 0; for(i = n - 1; >= 0; i--){ count = 0; for(j = 0; j <= n && j < - 1; j++){ if (a[i][j] == 0) count++; } if (count == n - i) /* n - = number of elements in diagonal */ null++; else = - 1; } return null; } int main () { int n, a[max][max], i, j, null; printf ("enter value of n create square matrix of order n: "); scanf ("%d", &n); printf ("enter elements of matrix a: "); (i = 0; < n; i++){ (j = 0; j < n; j++){ scanf("%d", &a[i][j]); } } null = diagonnull (n, a); printf ("matrix has null %d diagonals", null);

Html to pdf some characters are missing (itextsharp) in Asp.Net MVC Application -

i want export razor view pdf using itextsharp library. problem turkish characters such İ,ı,Ş,ş etc... missing in pdf document. code used export pdf is: public pdfactionresult(object model) { model = model; } public override void executeresult(controllercontext context) { iview viewengineresult; viewcontext viewcontext; if (viewname == null) { viewname = context.routedata.getrequiredstring("action"); } context.controller.viewdata.model = model; var workstream = new memorystream(); var document = new document(); pdfwriter writer = pdfwriter.getinstance(document, workstream); writer.closestream = false; document.open(); viewengineresult = viewengines.engines.findview(context, viewname, null).view; var sb = new stringbuilder(); textwriter tr = new stringwriter(sb); viewcontext = new viewcontext(context, viewengine

android - How to properly set log level to verbose in Google Analytics? -

in folder res/xml , have file analytics.xml containing line: <string name="ga_loglevel">verbose</string> however, in oncreate() method of activity , when call this: googleanalytics.getinstance(this).newtracker(r.xml.analytics); log.d("abc",""+(googleanalytics.getinstance(this).getlogger().getloglevel() == logger.loglevel.verbose)); the output false, not true. why that? this should trick: googleanalytics.getinstance(this).getlogger().setloglevel(loglevel.verbose);

lua - Corona runtime addEventListener to be execute inside if else condition -

how run function "runtime:addeventlistener("notification", onnotification)" inside if else condition. function register gcm, default keep registering everytime open app. wanted is, call remote db save regid of device, , if exist, dont register again gcm. how do that? local function networklistener( event ) if ( event.iserror ) print( "network error!") else local json = require "json" local t = json.decode(event.response) local status = t.status local isreg = t.isregistered print(event.response) if (isreg == "1") native.showalert("success",isreg,{"ok"}) else native.showalert("fail",isreg,{"ok"}) runtime:addeventlistener("notification", onnotification) end end end below onnotification runtime function -- called wh

Need to use captcha validation for mobile app forms? -

i making html5 mobile app via xdk. have forms use captcha validation in website. in prospective, comment spam mobile app doesn't make scenes. see comment spam mobile apps? think need use captcha validation in mobile app form or leave not bother users? comment spam happens on both mobile , desktop websites or applications. commonly used text captcha validation helps remedy problem. when comes mobile apps, harder automate data submission within native apps. reason due in part inability write malicious foreign scripts discover elements within source code , invoke form submissions. plus, mobile applications must purchased (free or paid) , installed on physical device or in simulator. captchas more ideal mobile apps: slidercaptcha , imagecaptcha , motioncaptcha , ringcaptcha , , nucaptcha .

html - 2 button's open in same iframe with JavaScript -

i want 2 button's open in same iframe. when button 1 active need button 2 empty frame , load link in there. possible? code (so far): <body> <input type="button" id="knopsql1" type="submit" value="1e klasse"></input> <script> document.getelementbyid('knopsql1').onclick = function() { var iframe = frames[0] || document.createelement('iframe'); iframe.src='http://www.example.com/sql.php'; document.body.appendchild(iframe); }; </script> <input type="button" id="knopsql2" type="submit" value="2e klasse"></input> <script> document.getelementbyid('knopsql2').onclick = function() { var iframe = document.createelement('iframe'); iframe.src='http://www.example.com/sql2.php'; document.body.appendchild(iframe); }; </script> </body>

android - How to display preview thumbnail while scrubbing the video. -

i trying display preview thumbnail when user move finger on video scrubber. the solution m finding extract thumbnails using 3rd party tool , save server or pass app via json. what m trying similar jwplayer ( http://jwplayer.electroteque.org/controls-preview ) any idea start? or here standard protocol support manual generated thumbnails? or need go own feed format. i don't quite know configuration of project is, 1 possibility instantiate mini player , display progress of video user slides. "mini player" appear when user begins drag, , skip whatever time specified, , pause. similar project working on now. great reference well: http://www.autodeskresearch.com/pdf/p1159-matejka.pdf . technique different 1 suggested, alternative depending on scenario.

python - Why the following is allowed in C? -

why following behavior allowed implementations of c ? if use variable define it, this: #include <stdio.h> int main() { int = 9; int b = ( +b ); printf("%d",b); } i know garbage value of b used there should compile time warnings . sounds little weird me. in languages python illegal such stuff : >>> b = 9 >>> = + b traceback (most recent call last): file "<pyshell#2>", line 1, in <module> = + b nameerror: name 'a' not defined i guess python not put variable current namespace until well-defined (i.e. has value within current scope) while in c above statement breaks this: int b = 9; int a; // put namespace or whatever lookup table garbage value = + b; it nice if points out philosophy behind this. explanation in c function, of local variable declarations happen straight away. essentially, compiler translates code into: int a; int b; // start of function = 9; b = + b; // end

java - "NetworkError: 415 Unsupported Media Type -

i getting networkerror: 415 unsupported media type error when trying hit service. have , let me know wrong. here rest service definition @post @produces(mediatype.application_json) @consumes("application/json") @path("/searchpackage") public jsonarray searchpackages(jsonobject obj) throws jsonexception { and here jquery client code. var description=$('#description').val().trim(); var jsonobject= {"searchaction":"search", "description":description); var request = $.ajax({ url: restserviceurl+'searchpackage', type: 'post', contenttype: 'application/json', data: jsondata, datatype : 'json', error: function(data) { console.log(data.responsetext); } }); here output appllication.wadl <resource path="/searchpackage"> <method id="searchpackages" name="post"> <request><representation mediatype="applicatio

java - How to send received jsessionid via spring 4 resttemplate -

i'm writing messenger javafx , spring4 on client-site , spring4 on server-site. secured server spring-security 3.2. problem: have loginpage on client witch sends login information spring-security , receive jsessionid cookie. works fine when try send jsessionid request become org.springframework.web.client.restclientexception: not extract response: no suitable httpmessageconverter found response type [class org.messenger.rest.jsonconversationresult] , content type [text/html;charset=utf-8] server inizializer public class springmvcinitializer extends abstractannotationconfigdispatcherservletinitializer { @override protected class<?>[] getrootconfigclasses() { return new class[] {applicationconfig.class}; } @override protected class<?>[] getservletconfigclasses() { return new class[] {webconfig.class}; } @override protected string[] getservletmappings() { return new string[] {"/"}; } }

javascript - escaping when passing a variable to the data option -

i trying enter rails variable in data option code not work expected. html , javascript escaping didn't work me. the code: <% @fields = render(partial: 'participations_fields', locals: {f: f})%> #its part of form <%= link_to_function("addy","addy()", data: {try:@try, content: @fields}, id: "try")%> the participation_fields partial: <p>hello</p> <%= f.label(:name,"feast name")%><br /><br /> <%= f.text_field(:name) %> <br /><br /> the code not work expected. get: feast name #here text input field# #this showed on screen:# " data-try="10" href="#" id="try" onclick="addy(); return false;">addy escape_javascript , h() didn't work. how should escape code variable go content data? if put html rails generates this: <%= link_to_function("addy","addy()", data: {tr

Eclipse Android Development src folder empty -

i aware question has been asked before answers didn't solve problem wanted ask again. quite new @ android development. using 3.7.2 indigo version of eclipse right now. launched adt plugin when try create new android application project src , layout folders created empty. tried solutions such clicking on "install new software" , paste adt link error "duplicate location" then. can offer me solution? make sure have checked create activity checkbox, otherwise activity not created default. incase haven't ,you may still create activity right-clicking on project , new > other > android > android activity . have make sure check launcher activity checkbox in case first activity of application.

c# - How to use TransmitFile with HttpListener -

i have http server written using httplistener , want zero-copy technology sending files clients. is there option use transmitfile respond? i assume you're referring httpresponse.transmitfile ? httplistener doesn't buffer response content, need write directly output stream. you can use extension method mimic asp.net behavior: public static void transmitfile(this httplistenerresponse response, string filename) { using (var filestream = file.openread(filename)) { response.contentlength64 = filestream.length; filestream.copyto(response.outputstream); } }

html - how can make gridview align on top of table cell -

Image
if records on "gv1" less "gv2" (on image), "gv1" aligned center , keeps jumpy when tick checkbox, want gridview on top of table cell. how can write css gridview set on top of table cell? !!!! <style type="text/css"> .top { vertical-align:top; } </style> <table border="2" style="width: 1050px"> <tr> <td class="style9">building </td> <td class="style10" colspan="2">dropdownlist </td> </tr> <tr> <td >unit</td> <td > <div class="top"> update panel &gridview </div> </td> <td > <div class="top">

Parse json arrays using HIVE -

i have many json arrays stored in table (jt) looks this: [{"ts":1403781896,"id":14,"log":"show"},{"ts":1403781896,"id":14,"log":"start"}] [{"ts":1403781911,"id":14,"log":"press"},{"ts":1403781911,"id":14,"log":"press"}] each array record. i parse table in order new table (logs) 3 fields: ts, id, log. tried use get_json_object method, seems method not compatible json arrays because null values. this code have tested: create table logs select get_json_object(jt.value, '$.ts') ts, get_json_object(jt.value, '$.id') id, get_json_object(jt.value, '$.log') log jt; i tried use other functions seem complicated. thank you! :) update! solved issue performing regexp: create table jt_reg select regexp_replace(regexp_replace(value,'\\}\\,\\{','\\}\\\n\\{'),'\\[|\\]','&

Python - login to website using requests -

i have admit complitely clueless this: need login site https://segreteriaonline.unisi.it/home.do , perform actions. problem cannot find form use in source of webpage, , have never tried login website via python. simple code wrote. import requests url_from = 'https://segreteriaonline.unisi.it/home.do' url_in = 'https://segreteriaonline.unisi.it/auth/logon.do' data = {'form':'1', 'username':'myuser', 'password':'mypass'} s = requests.session() s.get(url_from) r = s.post(url_in, data) print r obviously, is: <response [401]> any suggestions? in advance. you need use requests authentication header. please check here : from requests.auth import httpbasicauth requests.get('https://api.github.com/user', auth=httpbasicauth('user', 'pass')) <response [200]>

javascript - How to return a default property of JS literal object? -

one js object defined this: var obj = { key1 : {on:'value1', off:'value2'}, key2 : {on:'value3', off:'value4'} } is there tricky way, pick default key1 'on' property, when obj.key1 passed without property? var key1state = obj.key1; // want receive 'value1' here, not obj.key1{...} is somehow possible recognize in object definition body property (if @ all) passed/asked during object call? i'm not sure if need, messing valueof or tostring may you're looking for. for example: var obj = { key1 : {on:'value1', off:'value2', tostring : function(){ return this.on; }}, key2 : {on:'value3', off:'value4', tostring : function(){ return this.on; }} } var key1state = obj.key1; // object var key1statestr = '' + obj.key1; // string "value1" obj.key1 == "value1" // true obj.key1.tostring() === "value1" // true so if going u

groovy - Saving argument method with MOP -

i doing integration tests spock 3rd party apps. struggling problem not sure wether approaching issue or not. in 1 of tests connecting 3rd party service information in array. each of these items passed method process them individually. def get3rdpartyitems = { [item1, item2, item3] } def processitem = { item -> //do item } get3rdpartyitems.each { processitem(it) } then have test connects real 3rd party service using method get3rdpartyitems() in testing processitem called many times items has returned method get3rdpartyitems() . what trying save 1 of items @shared variable write test know item processed don't want mock content retrieved 3rd party service want real data. basically, doing: @shared def globalitem myclass.metaclass.processitem = { -> if (!globalitem) globalitem = //and need call original method processitem } any clue how achieve this? overheading open change solution. not sure if want, it's hard see existing s

MySQL Call Recent Timestamp in PHP -

i've seen similar types of questions on so, however, have not been able find solution specific issue. want recent timestamp , call in php code. (fyi, these not real columns, shortened example). my_table row_1 row_2 timestamp ====================================================== 01 04 2014-06-24 22:00:00 02 01 2014-06-25 19:00:00 03 93 2014-06-27 14:00:00 04 83 2014-06-27 14:31:20 <=== return row (latest time) so, want able to: 1) select "newest" row, based on timestamp , 2) select 'row_2' column accordingly timestamp any on great. thanks in advanced! select `newest`, `user_2` `your_table` order `timestamp` desc limit 1 the limit 1 there in order fetch 1 set of data.

javascript - Selectbox change content using jQuery/AJAX -

i trying find best solution this: have categories, subcategories, sub-subcategories etc. , need have in different selectboxes. example: first there be: <select> <option value="cars">cars</option> <option value="electronic">electronic</option> <option value="garden">garden</option> </select> after when user choose example cars select box changes <select> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> concept of page 1 box in middle of page , after choose first category box disappear , there come new box subcategory. best solution , how in ajax? i wrote jsfiddle: http://jsfiddle.net/thauwa/xgfqn/ basically, have use code this: html <select id=&

orm - Hibernate Criteria One to Many -

i have sentence: list l=getsessionfactory().getcurrentsession().createquery( "from domain d d.location.idlocation=?"). setparameter(0, idlocation).list(); and need query using criteria, don't know how use criteria in relation 1 many. thx try this, criteria criteria = getdatabasesession().createcriteria(domain.class); criteria.createalias("location","loc"); criteria.add(restrictions.eq("loc.idlocation", idlocation)); list<domain> l=(list<domain>)criteria.list();

sql - Rails MySQL query using where statement -

i have users: name _____ role _________ status user1 -------- role1 ---------------- true user2 -------- role2 ---------------- true user3 -------- role2 ---------------- false user4 -------- role3 ---------------- false user5 -------- role4 ---------------- true i have query: user.where("role = ? or role = ? or role = ? , status = ?", "role1", "role2", "role3", true) and expect data retrieve is: user1 user2 but system retrieve user3 if status false. i try change and or retrieves all. what's wrong query? what's wrong query lack of parentheses around 'or groups' user.where("(role = ? or role = ? or role = ?) , status = ?", "role1", "role2", "role3", true) however, stated in answer, can done in easier way this. user.where(status: true).where(role: %w{role1 role2 role3})

php - Printing an Array in Bootstrap -

Image
i have multidimensional array. i use php & bootstrap, creating data structures application. i have used var_dump(), print_r(), echo '' , , tried wrapping array in <pre></pre> , inline version of array. my current output is: i want output following image: how can array output such latter image using components in bootstrap? how use pre tag ? you should use <pre> html tag display var_dump output : <pre><?php var_dump($arr); ?></pre> http://getbootstrap.com/css/#code

android - change placing of child views dynamically using onDraw? -

is there way dynamically change position(like manually translation animation) on child view thats been defined , places inside onlayout? i have onlayout defined here: @override protected void onlayout(boolean changed, int left, int top, int right, int bottom) { //place topview @ top of layout removing yspace value defined fro height // of view , dividing height topview takes half space // height of view container topview.layout(0, 0, getwidth(), (getheight() - yspace) / 2); } i want manually change y axis position of topview dynamically . i thinking ofabout ondraw ondraw doesnt childviews , draws them. instead gives blank canvas manually draw items in it. currently implementing custom viewgroup takes x amount of child views , dynamically moves them around. question how move them around?

android - how to make group by in listview -

i have custom list view custom array adapter.. fill list view array data base... the problems = how can show list view distinct in database / group by... want listview, not data base because reason... here snipcode public void setlistview(){ int jumlahdata = a_bonrokok_main.count; int jumlahdatadetail = a_bonrokok_main.countdetail; log.d("jumlah data : ", ""+jumlahdata); log.d("jumlah data detail : ", ""+jumlahdatadetail); if(jumlahdata > 0){ tabitemlist = new arraylist<bonrokok_salesplandetail_model>(); final bonrokok_tabitem_adapter adapter = new bonrokok_tabitem_adapter(getactivity(), tabitemlist); (int = 0; < jumlahdatadetail; i++) { string namarokok = a_bonrokok_main.namarokok[i]; string jumlah = a_bonrokok_main.jumlah[i]; string satuan = a_bonrokok_main.satuan[i]; tabitemlist.add(new bonrokok_salesplandetail_model(nama

Unable to INSERT any records in MYSQL from PHP -

so trying develop app , need api, trying php in order pass variables app mysql. trying $_get first in order see if works fine. tried pass variables database through mysql workbench , app , worked fine. but, when emptied table , tried again didn't work! guessing loop doesn't respond fact table empty(?) this code checks email , username if exists , if not insert variables: $result = 'notset'; $query=mysql_query("select * project"); while ($row = mysql_fetch_assoc($query)) { if(strcmp($row['email'],$email)==0){ //strcmp uses 2 strings , returns integer, if 0 no differences if more 0 there $result = 'email exists'; }else{ if(strcmp($row['username'],$username)==0){ $result = 'username exists'; }else{ //encryption $insert = mysql_query("insert project values ('$userid', '$fullname','$username','$password','$course',&#

c++ - Is there a way to get userstack for all heap userptr -

i reading through article detecting memory leak using windbg . trying find way print userstack userptrs appear when heap filtered block of memory particular size. possible ? looking achieve like: foreach(userptr) dump_to_a_file !heap -p -a userptr where userptr is: userptr under heap_entry size prev flags userptr usersize - state 003360e0 03f0 0000 [07] 003360e8 01f64 - (busy) 00338060 03f0 03f0 [07] 00338068 01f64 - (busy) 00339fe0 03f0 03f0 [07] 00339fe8 01f64 - (busy) i trying in order avoid manual checking thousands of such userptr. give. this output of !heap -flt s xxx command contains lot of text before , after heap entry table. let's rid of additional text doing hack .shell -ci "!heap -flt s xxx" find "[" now it's quite stable output, can used in foreach loop: .foreach (userptr {.shell -ci "!heap -flt s xxx" find "["}) { .echo ${userptr}} see how spl

css - Adding icon to Extjs toolbar -

i trying add icon toolbar (arbitrary - not associated button). in css define url : .mycoollookingicon { background-image: url('../ext-theme-gray/images/grid/columns.gif'); } and works fine if setting icons buttons using iconcls . i icon in label or image i have tried : xtype: 'label', iconcls: 'mycoollookingicon ' and xtype: 'image', html: '<img class="mycoollookingicon "/>' but doesn't seem work in either case. this 1 of way of achieving want (not using iconcls) xtype:'label', html: '<img src=\"path_to_icon\">' try this: xtype:'label', html: '<img class="classname" width="20" height="20">' giving width , height, makes work.

iphone - AMSlideMenu, AMSlideMenuContentSegue hiding top of the view -

Image
i'm new xcode , objective-c. want implement simple slide menu amslidemenu. i've got 1 left menu, , need go logout screen clicking on logout (amslidemenucontentsegue) that. don't want menu there. hiding button , disabling pangesture not problem. i've added: // used disabling gesture menu , disabling left button [self disableslidepangestureforleftmenu]; [self removeleftmenubutton]; but still can see layer above top of view. how rid of ? thanks using amslidemenu :) if mean how hide navigation bar, in view controller, want navigate tapping on logout, - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [self.navigationcontroller setnavigationbarhidden:yes animated:yes]; } - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; // if want bring when view controller disappearing [self.navigationcontroller setnavigationbarhidden:yes animated:yes]; } or, basically, in storyboard select na

java - How to write a data into database using outputstream UTF-8 -

system.out.println("record:::" + recordxml); url url = new url(constants + tablename + "/update?commit=true"); conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod("post"); conn.setrequestproperty("content-type", "application/xml"); outputstream os = conn.getoutputstream(); system.out.println("insertorupdate"); os.write(recordxml.getbytes()); os.flush(); here put utf-8 chracter support you can use outputstreamwriter. outputstream os = conn.getoutputstream(); outputstreamwriter ow = new outputstreamwriter(os, "utf-8"); ow.write(recordxml); // note: don't use getbytes() here ow.flush(); ow.close();

javascript - How to create a word checker with jquery -

i'm trying develop simple script reads words of string, , compare dictionary .txt or array of correct words. the format of string this: <data> <value>testy</value> </data> <data> <value>helllo wordi</value> </data> <data> <value>gren titl</value> </data> <data> <value>nanme</value> </data> he can apply fix on words have within <value> tag. have me return should same structure words corrected. form. <data> <value>test</value> </data> <data> <value>hello word</value> </data> <data> <value>green title</value> </data> <data> <value>name</value> </data> is possible this? if yes how can doing in code? example? demo code $('button').click(function () { var code = $('textarea[name=message]').val(); if ($('#output&

php - creating dates+times every 15 minutes does not work -

my php code below supposed create list of following dates + times. // code goes here $maxdays = 1; for($daynumber=0;$daynumber<$maxdays;$daynumber++){ $currentdayval = "+".(string)($daynumber-$maxdays)." days"; $minutes=0; for($quarter=0;$quarter<24*4;$quarter++){ $minutes += $quarter*15; $currentminutesval = $minutes." minutes"; $date_sql = date("y-m-d h:i:s",strtotime($currentdayval." + ".$currentminutesval)); //current date echo $date_sql. "\n"; }//for $quarter }//for $daynr but output below shows not every date/time follows 15 minutes after previous date/time. not sure code goes wrong(?) 2014-06-26 12:44:15 2014-06-26 12:59:15 2014-06-26 13:29:15 2014-06-26 14:14:15 2014-06-26 15:14:15 2014-06-26 16:29:15 2014-06-26 17:59:15 2014-06-26 19:44:15 2014-06-26 21:44:15 2014-06-26 23:59:15 2014-06-27 02:29:15 2014-06-27 05:14:15 2014-06-27 08:14:15 2014-06-27 11:29

java - Eclipse. Set minimum JDK version for JAR library -

i've developed java jar-library , simple java program test library. works on machine jdk 7, doesn't work on machines oldest jre. how can make run minimum jre it's required? jar library generated using eclipse: file/export/jar. right click on project > properties > java compiler , set compiler compliance settings project. try setting this earlier jre version , make changes based on warnings / errors manifest.

html - Grouping placeholder color styling -

how come works: input { color: #807e82; } input:-moz-placeholder { color: #807e82; } input::-moz-placeholder { color: #807e82; } input:-ms-input-placeholder { color: #807e82; } input::-webkit-input-placeholder { color: #807e82; } but doesn't: input, input:-moz-placeholder, input::-moz-placeholder, input:-ms-input-placeholder, input::-webkit-input-placeholder { color: #807e82; } seems bit of pain if want change input colors , placeholder colors on quickly. that's because how css error handling works : if single rule in selector invalid (not recognized user agent, precise), whole selector , rule discarded user agent. in second example, each browser have own indigestible part of selector (firefox won't know -ms-input... , chrome , ie - -moz-... etc). whole rule ignored.

ServiceStack Custom Registration Validator Issue -

i want override default registration validator enabled when registration feature added. have added own customregistrationvalidator per servicestack documentation (basic rules now, expanded later): public class customregistrationvalidator : registrationvalidator { public customregistrationvalidator() { ruleset(applyto.post, () => { rulefor(x => x.firstname).notempty(); rulefor(x => x.lastname).notempty(); rulefor(x => x.email).notempty(); rulefor(x => x.password).notempty(); }); } } i have overridden default registration validator in configure method per following snippet: plugins.add(new authfeature( () => new authusersession(), new iauthprovider[] { new basicauthprovider(), new credentialsauthprovider() })); plugins.add(new validationfeature());

angularjs - alert box isn't raised in the code, its written for conform msg -

function fcontroller($scope,$window) { $scope.persons=[]; $window.alert("hi in body"); $scope.saveit = function () { $window.alert("alert in save"); //$scope.persons.push({ }); }; } <button id="bt1" ng-click="saveit()">save</button> $window.alert not correct. window.alert is. don't need include $window in dependency injections.

c# - Check if an azure message has a property -

i've added custom properties azure brokeredmessage such message.properties["staffdealingwith"]; i'm looking find out if message contains property (e.g. staffdealingwith). if (message.properties.contains("staffdealingwith")) { tm.staffdealingwith = (string)message.properties["staffdealingwith"]; } however giving me compile error. 'system.collections.generic.icollection>.contains(system.collections.generic.keyvaluepair)' has invalid arguments c:\codetfsarklepos\arkle\roboweb.azure\messagefetcher.cs 180 17 roboweb.azure the type of message microsoft.servicebus.messaging.brokeredmessage you don't specify type message suspect message.properties dictionary<string, object> need use containskey instead. dictionary<string, object> implements icollection<keyvaluepair<string, object>> exposes contains method well!

apache - localhost redirects to one of local websites -

i added c:/windows/system32/drivers/etc/hosts: 127.0.0.1 mywebiste and in httpd-vhosts.conf added: <virtualhost *:80> serveradmin webmaster@dummy-host2.example.com documentroot "c:/xampp/htdocs/mywebiste" servername mywebsite errorlog "logs/error.log" customlog "logs/access.log" common <directory "c:/xampp/htdocs/mywebiste"> options indexes followsymlinks multiviews options -indexes allowoverride none order allow,deny allow #redirectmatch ^/$ / index.php options +followsymlinks indexignore */* rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php </directory> </virtualhost> and when want add new website hosts file , httpd-vhosts.conf renders 'mywebsite' , cant access website, if delete virtualhost in httpd-vhosts.conf , r

Scrapy and Start URLs -

i'm scraping text title tags off of bunch of pages want include start url field in item. know how that? when export data csv want see start url next title i'm pulling. here's code spider--- class quadnumbers(basespider): name = "quad_numbers" allowed_domains = ["quadratec.com"] start_urls = ["http://www.example.com/abc", "http://www.example.com/abc",] def parse(self, response): sel = selector(response) sites = sel.xpath('//title') items = [] site in sites: item = quadnumbersitem() item['title'] = site.xpath('text()').extract() item['start_url'] = __________?? items.append(item) return items you can this: item['start_url'] = response.url

java - Is there any Jetty IIS Connector available for IIS server? -

there web application in sharepoint. have html i-frame (colorbox) shows page, different url, java web application deployed in jetty. there 'close' button in java web application should close i-frame opened sharepoint i.e access parent element close given below settimeout(function () {parent.$.fn.colorbox.close();}, 1500); while accessing parent element, getting permission error in firebug error: permission denied access property 'parent' ($ or tostring) what internet says regarding this: 1) cross domain issue: application in single domain, there application deployed in tomcat using above method , able achieve functionality. there tomcat iis connector installed , configured on iis sharepoint server, looks permitting requests. 2) javascript issue: have tried multiple available on internet return same exception so watching concluded must jetty iis connector or other settings need done if can provide valuable suggestion in case shall thankful it due

jquery - Insert specific image every 10 images in a php slideshow -

i made simple php loop loads images directory , puts them in jquery slideshow. here's php code: <?php function scd($dir){$files=scandir($dir);sort($files);reset($files);return $files;} $output='<script>$.backstretch(['; $dir='images'; $files=scd($dir); foreach($files $file){ if($file==='.'||$file==='..'){continue;} $output.='"'.$dir.'/'.$file.'" , '; } echo $output.' ], {duration: 10000, fade: 1000});</script>'; ?> i'd insert specific image external directory (i.e. advertisement company) every 10 slides have no clue on how it. any appreciated ! thanks in advance, martin use counter of sort keep track of how many images you've displayed , display advertisement when counter%10 ==0 $counter = 1 foreach($files $file){ if($file==='.'||$file==='..'){continue;} if($counter%10 == 0) $output .= //advertisement link

html5 - Javascript HTML Progress Bar to monitor the running of whole Perl CGI script: -

i have been unable find solution can understand. have form in html, submits perl cgi script, script runs number of processes can take approximately 5 minutes, before returns results page. have attempted have found on internet cgi::progressbar ajax, attempting simple timed progress bar html5. take solution basing length of time (15,000kb per minute fro script running time), how can implement progress bar run input file size in form submission on timer? alternatively, how can set progress bar begin upon clicking submit button, , run set maximum time, whilst printing statements though in real time? have no experience in javascript, please kind, learning here. thank in advance.

python 2.7 - Scons AttributeError: 'builtin_function_or_method' object has no attribute 'dispatch' -

i have sconstruct script instantiating object.this object internally calls method run multiprocessing module. example shown below this object before calling function unpickles file , pass inputs multiprocessing module. def run_scons(self,inpfile,outfile): # unpickle input parameter fid=open(inpfile,'rb') input_data=pkls.load(fid) my_results=[] #run solver in loop my_data in input_data: work_ers=len(my_data) pool = pool(processes=work_ers) a_result=pool.map_async(my_solver, my_data) pool.close() pool.join() my_results.append(a_result.get()) fid.close() fid_out=open(outfile,'wb+') pkls.dump(rot_full_results,fid_out) i following error when executing same function via scons. pool = pool(processes=work_ers) file "c:\python27\lib\multiprocessing\__init__.py", line 232, in pool return pool(processes, initi