Posts

Showing posts from June, 2012

java - JDBC returning a result set -

i have database few columns login screen, trying compare entered email persons password in database. i have following code, although keep getting error saying column email not exist, although in database. ideas? public string getplayerpassword(string emailparameter) throws sqlexception { loadsqldriver(); string playersemail = null; prestmt = con.preparestatement("select playerpassword players email = ?"); prestmt.setstring(1, emailparameter); rs = prestmt.executequery(); if(rs.next()){ playersemail = rs.getstring("email"); } return playersemail; } this may because dint select email in query prestmt = con.preparestatement("select playerpassword players email = ?"); and fetching it playersemail = rs.getstring("email");

refactoring - Python - refactor of try/except block - double call for super() method -

at beggining, sorry title of question - not came better one. suggestions welcome. i wrote __init__ method class, works great, looks ugly. can improved? mean duplicate line calling function super() . def __init__(self, *args, **kwargs): """ creates selenium driver. :param args: non-keyword variables passed selenium driver. :param kwargs: keyword variables passed selenium driver. """ try: phantomjs_path = 'node_modules/.bin/phantomjs' super().__init__(phantomjs_path, *args, **kwargs) except webdriverexception: phantomjs_path = 'phantomjs' super().__init__(phantomjs_path, *args, **kwargs) update: try: phantomjs_path = 'node_modules/.bin/phantomjs' except webdriverexception: phantomjs_path = 'phantomjs' finally: super().__init__(phantomjs_path, *args, **kwargs) it not work - seems obvious. you can use loop avoid writing super lin

negate boolean function in javascript -

how negate boolean function? such using like: _.filter = function(collection, test) { var tmp = [] _.each(collection, function(value){ if (test(value)) { tmp.push(value); } }) return tmp }; var bag = [1,2,3]; var evens = function(v) { return v % 2 === 0}; this wrong: // returns opposite of evens var result = _.filter(bag, !evens); result: [1,3] try making function returns function: function negate(other) { return function(v) {return !other(v)}; }; used this: var result = _.filter(bag, negate(evens)); or declare function when call it: var result = _.filter(bag, function(v) {return evens(v)});

web services - REST JSON specification -

i'm newbie both in soap , rest programming. in soap structure , fields of entities being exchanged , unambiguously documented in wsdl . i think same not happen in rest . how developer of rest api supposed document structure , fields of json objects, representing entities being exchanged? rest , soap can't compared directly, different things. can implement rest on soap if want, not opposite. recommend reading this answer . in restful apis supposed document media-types , let interaction driven underlying protocol, don't in of http apis call rest. using term buzzword , opposite of that, documenting protocol instead of media-types. for instance, if have user resource, supposed have proper media-type in format json or xml looks application/vnd.mycompany.user.v1+json , , documentation should describe json document looks client knows expect. doesn't have strict wsdl. in fact, can human readable documentation documenting class api or that. the cl

Best way to Run Spark -

there group project working on , want utilize spark. however, not know best way run on our computers. had thought maybe hortonworks, , suggested looking @ maven. aren't sure though. we students can't buy (at least expensive). when search ways run spark on computer (windows), pops compiling techniques or code help. you have lots of options: download source github or apache , run locally. readme has instructions or can download learning spark , read chapter 2. download cloudera distribution hadoop 5 quickstart virtual machine . requires virtual machine player vmware or virtualbox (make sure vt-x enabled in bios). runs spark in pseudo-distributed stand-alone mode , allows run inside yarn container configuration changes. can run spark locally out-of-the-box dependencies installed. download hortonworks virtual machine. works similar cloudera's offering not familiar it. i recommend cloudera if machine capable of running heavy-weight vm , want try r

winforms - how to get the value from a dateTime picker and combo box and set it as a dateTime variable? In c# -

i have windows form in c# user has pick date datetime picker , time combo box. how store them in same datetime variable? assuming have 2 separate fields, datetime picker returning datetime object (pickervalue) , combobox returning string value (dropdownvalue): datetime finalvalue; try { timespan ddvalue = timespan.parse(dropdownvalue); finalvalue = pickervalue.date.addticks(ddvalue.ticks); } catch (exception) { //handle exception // dropdownvalue not formatted timestring. finalvalue = pickervalue.date; //or handle }

javascript - How to get free local storage quota? -

Image
this question has answer here: how find size of localstorage 13 answers how amount of free quota in applications local storage? i need remaining storage amount in bytes, kilobytes, megabytes or in percentage. nice visual display of how free quota have in local storage. thanks! edit: please note "answer own guestion" style post , therefore cannot make better guestion. focus on answer because guestion in title , there not more that. here jsfiddle cross browser (including mobile browsers) solution. please note may need allow 'unsafe' scripts in order work in jsfiddle not require permission in own use. can remaining local storage quota using following code. alerts if local storage full. html <h2>remaining local storage quota</h2> <p id="quotaoutputtext"></p> <p id="quotaoutputpercenttext&

c# - UriFormatException was unhandled -

i have xml document returned web service transforming xml document using xsl schema . getting error 'uriformatexception unhandled. invalid uri: uri string long.' able required xml document if save samplereportxml in temp folder , read it. appreciated. thanks. stringbuilder sb = new stringbuilder(); xmldocument doc = new xmldocument(); string inputxml = @"c:\temp\samplereport.xml"; string transformxsl = @"c:\temp\transformschema.xsl"; xslcompiledtransform xslt = new xslcompiledtransform(); stringwriter writer = new stringwriter(); xslt.load(transformxsl); xmlwritersettings settings = new xmlwritersettings(); settings.indent = false; xmlwriter swriter = xmlwriter.create(sb, settings); xslt.transform(inputxml, null, swriter); sb.append(writer.tostring()); writer.close(); sb.replace("<?xml version=\"1.0\" encoding=\"

iOS WatchKit - Error launching watch app "SPErrorInvalidBundleNoGizmoBinaryMessage" -

i trying build watchkit app allow two-way communications between iphone app , watch app. have setup app groups , proper app certificates, provisioning profiles , entitlements set , match up. keep getting error when try run watch app (no error when running iphone app). error: error launching 'mywatchapp watchkit extension' sperrorinvalidbundlenogizmobinarymessage i think has bundle identifiers, far can tell looks correct. suggestions? here bundle identifiers: app group key: group.com.nitwitstudios.mywatchapp iphone app bundle identifier: com.nitwitstudios.mywatchapp watch app bundle identifier: com.nitwitstudios.mywatchapp.watchkit watch app wkcompanionappbundleidentifier: com.nitwitstudios.mywatchapp watch extension app bundle identifier: com.nitwitstudios.mywatchapp.watchkit.extension watch extension wkappbundleidentifier: com.nitwitstudios.mywatchapp.watchkit note - changing watch extension app bundle "com.nitwitstudios.mywatchapp.watchkit"

Android: Delete item from Listview that was populated using Parse in Custom Adapter -

i trying delete item in parse.com using button in listview. listview populated using custom adapter class , executing onclick delete it. great! update: delete module modulecode equal position's modulecode this part of adapter trying work error parseexception e is: 04-09 19:33:05.408 10425-10425/com.yupo.dominic.yupo e/error﹕ java.lang.illegalargumentexception: invalid type parseobject: class com.yupo.dominic.yupo.module button moduledeletebutton = (button)view.findviewbyid(r.id.moduledeletebutton); moduledeletebutton.setonclicklistener(new view.onclicklistener(){ @override public void onclick(view v) { parsequery<parseobject> query = new parsequery<parseobject>("module"); query.whereequalto("objectid", getitem(position)); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> module, parseexception e) {

javascript - JQuery merge two functions keyup and focusout -

on form-field work 2 active functions: keyup , focusout. functions execute same code, key-up uses delay-function. function delay: $(function() { var delay = (function(){ var timer = 0; return function(callback, ms){ cleartimeout (timer); timer = settimeout(callback, ms); }; })(); functions keyup , focusout: $("#name").on('keyup', function (){ var textn = $(this).val(); var nbrcharn = textn.length; delay(function(){ if(nbrcharn > '2'){ $('#namemsg').html('nice.'); }else { $('#namemsg').html(''); } }, 1000 ); }); $("#name").on('focusout', function (){ var textn = $(this).val(); var nbrcharn = textn.length; if(nbrcharn > '2'){ $('#namemsg').html('nice.'); }else { $('#namemsg').html(''); } }); the keyup needs delay, f

Show NULL value as pivoted column in SQL Server -

i need pivot count of values matches "animal type" in code sample below. unfortunately may missing records in col2 ('a','b'), need count animal type in 'a','b', or null. need pivot null column count value. doing sum across pivoted columns @ end of query, , null values in col2 not match total. declare @testdata table ( col1 varchar(10) , col2 varchar(10) ) insert @testdata values ('dog','a') insert @testdata values ('cat','b') insert @testdata values ('rabbit',null) select * @testdata select pvt.col1 [animal type] , pvt.a [a] , pvt.b [b] , total.records [total count] ( select col1 , col2 , count(*) records @testdata group col1 , col2 ) s pivo

connecting android app to mysql trough web service using soap -

i creating app places order. , have created web service is: using system; using system.collections.generic; using system.linq; using system.web; using system.web.services; namespace myservice { /// <summary> /// summary description service1 /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] // allow web service called script, using asp.net ajax, uncomment following line. // [system.web.script.services.scriptservice] public class service1 : system.web.services.webservice { [webmethod] public string helloworld() { return "hello world"; } [webmethod] public void order() { string fname, lname, email, shippingno, city, product, price; } } } but don't know how enter values in web methods this mai

insert - Navicat (MySQL) Character Encoding Error -

i using navicat 11.0.8 , trying insert values table using query when try insert values query works character encoding messed up! as can see on code, table 'table' , inserting id, vnum , name. vnum '体字' , name 'versão'. insert table values ('1', '体字', 'versão'); instead of showing '体字' on vnum , 'versão' on name, shows '体å­—' , 'versão'. this bad me because trying insert more 5000 lines alot of information. i have tried set character encoding of table using these commands: alter table table convert character set utf8 collate utf8_unicode_ci; & alter table table convert character set big5 collate big5_chinese_ci; & alter table table convert character set utf8 collate utf8_general_ci; i have tried delete table , create new 1 character encoding utf-8 , send values.. set foreign_key_checks=0; drop table if exists `table`; create table `table` ( `vnum` int(11) unsigned not null

knockout.js - Javascript test for blur event -

i'm working knockout. i'm trying test enter key press or blur event. html: <input class="percent-text" data-bind="numeric: percent, value: percent, event: { keypress: $root.percentupdate, blur: $root.percentupdate }" type="number" min="1" max="100" oninput="maxlength(this)" maxlength="3" /> knockout model: self.percentupdate = function (data, event) { if (event.keycode === 13 || test blur here) { .... not sure how test blur event. thanks not familiar knockout, assume regular javascript work: self.percentupdate = function (data, event) { if (event.keycode === 13 || event.type==='blur') {

c++ - Display text inside QGraphicsPolygonItem without copying std::string to QString? -

i using qgraphicsscene draw millions of polygons. plan use qt+opengl later, not drawing more 1 million polygons , qt handles fine. problem arises when try display text inside polygons. each polygon (a custom class inheriting qgraphicspolygonitem) visual representation of object, , has pointer object associated it. each object has std::string identifier. if display that string inside polygons, should fine memory-wise. however, qt seems need qstring instead, , takes lot of time , space convert every string. creating qgraphicstextobject each polygon , each of needs qstring copy of std::string . there way bypass copy using qt? cropping scene not desirable. there polygons small text fit inside them, , 1 can see them zooming in scene. these polygons (and text) need not displayed (unless user zooms in), don't think without creating various other issues first. p.s.: displaying text on-demand (as user hovers mouse on each polygon, instance) possible, it'd ideal if text rea

c++ - How do I automatically add threads to a pool based on the computational needs of the program? -

we have c++ program which, depending on way user configures it, may cpu bound or io bound. purpose of loose coupling program configuration, i'd have thread pool automatically realize when program benefit more threads (i.e. cpu bound). nice if realized when i/o bound , reduced number of workers, bonus (i.e. i'd happy automatically grows without automatic shrinkage). we use boost if there's there can use it. realize solution platform specific, we're interested in windows , linux, tertiary interest in os x or other *nix. short answer: use distinct fixed-size thread pools cpu intensive operations , ios. in addition pool sizes, further regulation of number of active threads done bounded-buffer (producer/consumer) synchronizes computer , io steps of workflow. for compute- , data-intensive problems bottlenecks moving target between different resources (e.g. cpu vs io), can useful make clear distinction between thread , thread, particularly, first approximation

sql - Selecting everything but not a specific value -

i have table called proofs has columns (id, proof) trying select id , proof, value in proof column example "all proofs" want see except "all proofs" in execution, sql query have do? select p.* proofs p p.proof <> 'all proofs'

loops - Reading a delimited text file by line and by delimiter in C# -

i apologise mposting this, there lot of questions here can't find 1 specific this. i have list , each item contains datetime, int , string. have written list items .txt file delimited commas. example 09/04/2015 22:12:00,10,posting on stackoverflow. i need loop through file line line, each line starting @ index 0, through index 2. @ moment able call index 03, returns datetime of second list item in text file. file written line line, struggling read delimiters , line breaks. i sorry if not making sense, appreciate help, thank you. string[] lines = file.readalllines( filename ); foreach ( string line in lines ) { string[] col = line.split( new char[] {','} ); // process col[0], col[1], col[2] }

c++ - Call function when child dialog window is closed in Qt -

after trying multitude of combinations i'm unable qt call function in main window dialog when dialog closed. i looked , tried few things signal , slot no avail: qobject::connect( edit_dialog, signal( finished(int) ), this, refresh_table() ); in short i've got table displays data custom container. edit_dialog enables editing of values , sending changes directly database through set of external functions (they work). once dialog closed have table reloaded updated data container pulls database. db->container->gui table i realize qt has native libraries read/write dbs that's no purpose. need way automatically call refresh_table() function i've tried putting inside 'public slots' without more success. you have connect refresh table function slot( ) connect( edit_dialog, signal( finished(int) ), this, slot( refresh_table() ) ); other there seems nothing wrong approach. you can create own signal , connect refresh_table() function using

excel vba - VBA auto increament number -

i want add auto incrementing number end of value each row of information returned. here have. want have j1.1 first row , j1.2, j1.3, etc. ' j1 bars curcol = 2 lastcol if .cells(22, curcol).value = "" ' nothing else destrow = sheets("barlist").range("b" & rows.count).end(xlup).row + 1 'quantity sheets("barlist").range("a" & destrow).value = "1" 'bar size sheets("barlist").range("b" & destrow).value = .range("b16") 'bar mark sheets("barlist").range("d" & destrow).value = "j1.1" 'shape sheets("barlist").range("e" & destrow).value = "17" 'b dimension sheets("barlist").range("g" & destrow).value = .range("c20") 'c dimension sheets("barlist").range("h" & destrow).value = .c

css - 3D transforms take up space even if taken out of flow? -

i'm rotating div in 3d space. it's pretty simple: <div class="holder"> <div class="box"> <p>this text.</p> </div> </div> .box { background: orange; color: #fff; font-size: 6em; transform: rotatey(60deg); padding: 20px; position: absolute; } .holder { perspective: 300px; max-width: 600px; margin: 0 auto; } i notice in ie11 , firefox, if transform makes shape run out of viewport, display scrollbars. happens if item out of flow, setting position: absolute. in chrome, no scrollbars displayed. my understanding 3d transforms don't take additional space non-3d version of item, i'm not sure whey scrollbars appearing in browsers. correct behavior? yes, correct behavior per spec: http://dev.w3.org/csswg/css-transforms-1/#transform-rendering for elements layout governed css box model, transform property not affect flow of content surrounding transformed eleme

javascript - can I get the correct format -

i new extjs my fiddle doesn't solve problem if have currency if want format amount according particular currency, need format it. with moneycolumn, have store contains currency codes, currency symbol , amount format. since cannot use moneycolumn, looking see if there else can used format amount if pass currency code the fiddle provided, have pass format how can correct format providing code below.. it great if guys provide inputs... http://jsfiddle.net/yy77ja65/ { text : "number without dots", flex : 2, dataindex : "numberwithoutdots", renderer: ext.util.format.numberrenderer('€ 0') } you use custom renderer function rendermoney(value,b,records){ return ext.util.format.number(value, records.data.currency + ' ' + records.data.format) } ... { text : "number dots", flex : 1, dataindex : "numberwithdots", renderer: rendermoney } .... ht

Qt database(mysql) application does not connect to database when deployed on another computer -

i new qt bare me . built qt application connects , queries database using mysql . works fine on development computer (the computer qt creator on it). when deploy using windeployqt.exe , run on computer doesn't connect database odd reason. note have working database (mysql aswell) on other computer (the 1 fails connect database) i'm not sure , tried using addlibrarypaths didn't work (im not sure if did correctly). i'm using : mysql server 5.5.36 workbench 6.0 qt creator 5.4.0 i tried looking statically building application failed understand procedures in doing so. i appreciate if of qt gods this. i found problem , solved it. problem: reason target computer wasnt recognizing or reading libmysql.dll in c:\windows ,and @marco used db.lasterror , got application display error , "driver not loaded driver not loaded" meant there wrong libmysql.dll (note copied dll mysql folder installed on target machine ) solution : had copy libm

parallel processing - python multiprocessing slow -

i have code parallelizes calls function. inside function, check if file exists, if not create it, else nothing. i find if files exist, calling multiprocessing.process has huge time penalty compared simple loop. expected or there can reduce penalty? def fn(): # check if file exists, if yes return else make file if(not(os.path.isfile(fl))): # processing takes enough time make paralleization worth else: print 'file exists' pkg_num = 0 total_runs = 2500 threads = [] while pkg_num < total_runs or len(threads): if(len(threads) < 3 , pkg_num < total_runs): t = multiprocessing.process(target=fn,args=[]) pkg_num = pkg_num + 1 t.start() threads.append(t) else: thread in threads: if not thread.is_alive(): threads.remove(thread) there's fair bit of overhead bringing processes -- you've got weigh overhead of creating processes against performance be

ios - Objective C - TextView Number of Lines -

Image
i have problem. know how can exact number of written lines of text in text view . not want number of lines possible, have been used , filled characters. for example: you try going along lines of [textfield sizetofit]; //get minimum height , width text nsinteger numlines = textfield.frame.size.height / textfield.font.linehieght however haven't tried myself

javascript - Mirth Write to SFTP server Error -

i having hard time writing file sftp server. when use channel.put(filebody) error wrapped 5: bad message , when try use filesutil.write not define. great. var channel = session.openchannel('sftp'); channel.connect(); channel.cd("/test"); //channel.put(connectormessage.getrawdata()); var filename = $('filename'); var filebody = connectormessage.getrawdata(); channel.put(filebody); //filesutil.write(filename, filebody);

php - Order Arabic data by alphabet letters -

how can order data grabbed mysql arabic alphabet ? note: use utf8_general_ci collation in mysql, , encoding fine, want know how sort data alphabet. in order sort arabic text in mysql database using php, have make sure that: mysql charset: utf-8 unicode ( utf8 ) mysql connection collation: utf8_general_ci your database , table collations set to: utf8_general_ci or utf8_unicode_ci so when create table set charset utf8 : create table my_table ( id int(11) not null auto_increment, name varchar(20) character set utf8 collate utf8_general_ci not null, primary key (id) ) default charset=utf8; if have table encoded in latin1 , convert : alter table `my_table` convert character set utf8 see : character set in mysql . then, need add line in php when setup database connection : mysql_query ('set names \'utf8\''); or : mysql_set_charset ('utf8'); // php 5.2.3 or greater. or if you're using pdo , can pass 4th parameter :

database - Naming PK and FK -

i have login form student app, since create tbl_user (for login) , tbl_teacher (for biodata) , tbl_student (for biodata). tbl_user have columns (username (pk), password, role, status). tbl_teacher have columns (bio_teacher_id (pk), teacher_id (fk), name, address, etc). tbl_student have columns (bio_student_id (pk), student_number (fk), name, address, etc). explanation : login, teacher use "teacher_id" username, student use "student_number" username. question : can suggest me ebook/ journal/ supporting document explain can use different naming fk pk of parent table ? lot all database systems know of allow fk have different name pk point to. i'm not aware of statement says because very, few people ever imagined not case. a simple test try create fk relation columns have different names , see whether words or not. say, don't know of dbms won't - if find 1 i'd interested in knowing!

c++ - How to specialize a template sub-class? -

i'm trying specialize template class inside class compiler won't let me. code works outside of class foo not inside , want struct bla private class foo. class foo { template<typename ... ts> struct bla; template<> struct bla<> { static constexpr int x = 1; }; }; error: explicit specialization in non-namespace scope 'class foo' you cannot specialize inside class, use: class foo { public: // can test template<typename ... ts> struct bla; }; // specialize outside class template<> class foo::bla<> { static constexpr int x = 1; }; int main() { std::cout << foo::bla<>::x; }

Android alarmmanager cancel and start not working -

i have following code set alarm when main activity starts , cancel when logging out @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); ... // schedule alarm intent intent = new intent(this, myreceiver.class); alarmintent = pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_update_current); alarmmanager = (alarmmanager) getsystemservice(context.alarm_service); if (pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_no_create) == null) { alarmmanager.setinexactrepeating(alarmmanager.elapsed_realtime, 0, alarmmanager.interval_day, alarmintent); } } private void logout() { if (alarmmanager != null) { alarmintent.cancel(); alarmmanager.cancel(alarmintent); } intent = new intent(mainactivity.this, loginactivity.class); i.addflags(intent.flag_activity_clear_task); startactivity(i); finish(); } but when log out, log in, , enter main

forms - Silverstripe Login params -

im trying style login page. login url website/security/login. im trying locate 'login' piece of url. have done wrong below? public function displaypagetype() { $param = $this->request->param('action'); if ($param === 'login') { return 'login'; } thanks i think won't work since controller during render page_controller , not security controller. $action param not equal login . index , i'm not sure. if want check if you're in login page, can add page_controller : public function getisloginpage() { return $_request['url'] == '/security/login'; } then in template: <body class="<%if $isloginpage %>login-page<% end_if %>"> a bit dirty it's quickest way know. another way leverage silverstripe's legacy support. can add css file called tabs.css @ mysite/css/tabs.css . if file exists, silverstripe include in page. you can create template

c - select() with const timeout parameter? -

the select(2) system call defined follows in chapter 6.3 of unix network programming (2003) stevens, fenner , rudoff: #include <sys/select.h> #include <sys/time.h> int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, const struct timeval *timeout); but none of modern unixes such freebsd, openbsd, netbsd, linux, , posix[1] standard, define system call such. however, noted in book "posix specifies const qualifier". error in book? or, because of historical reason? systems define pselect(2) have constant timeout parameter, though. http://pubs.opengroup.org/onlinepubs/009695399/functions/pselect.html the book errata page not list error: http://www.unixnetworkprogramming.com/errata.html posix defines interface select() as: int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout); the select() function shall equival

sql - Creating one line of output for my result using a CURSOR -

i'm successful acquire data need wish put results continuous string separated pipes here sample code connect mgs/mgs; set serveroutput on; declare cursor product_summary_cursor select product_name ,list_price products order list_price desc; product_summary_row products%rowtype; begin product_summary_row in product_summary_cursor loop if (product_summary_row.list_price > 700) dbms_output.put_line ('"' || product_summary_row.product_name || '",' || '"' || product_summary_row.list_price || '"' || '|'); end if; end loop; end; / depending on how many products going processing below should work. if string gets long might need @ using clob rather varchar2. connect mgs/mgs; set serveroutput on; declare v_output_string varchar2(4000) default null; cursor product_summary_cursor select product_name ,list_price products order list_price desc; product_summa

c# - Can't remove hidden characters from string -

i'm trying remove hidden characters string represents date time. i'm using .net fiddle , can see line tries parseexact fails. here snippet. please refer fiddle link working code. var datetime = "2015-04-14 07:30:00 pm"; //<= throws error hidden char datetime = regex.replace(datetime, @"[^\w:\s-]", ""); console.writeline(datetime); datetime datewithtime = datetime.parseexact(datetime, "yyyy-mm-dd hh:mm:ss tt", cultureinfo.invariantculture); console.writeline("ok"); the hh in format string refers 24-hour clock hours, doesn't work when using am/pm in format string pm times. change hh hh .

css - markdown adjust the column size and add a break line between rows -

i using | title | details | |-------|---------| |today sunday| today 2014-01-01| |tmr monday| today 2014-01-02| weird thing is, seems first column has fix width. when text length greater width, break text 2 rows. like in example: show |today is| |sunday | rather |today sunday| in same row. can tell me change width of first column , add border between first row , second row? (add solid line between) |today sunday| today 2014-01-01| |tmr monday| today 2014-01-02| if define fixed width column in table, text inside wrap if large fit horizontally. if want table size largest element of row, remove fixed column width. in css can't give tr's border properties need set "border-bottom: 1px solid black;" each td element of row. i suggest post code if want fixing it.

excel - VLOOKUP not returning right value - no error -

i have 2 worksheets inside of workbook use formulate report management. a part of report includes override function in-case source data wrong / inaccurate, allows override data correct values. i use vlookups check if resource name found in override tab, if is, return override value. working except 2 cells returning 0%. there no change in formula across sheet, other cells working except 1 cell , i'm totally stumped problem be. formula used determine override value =if($a2="","",if($b2<=c$1,0%,1)) (where c$1 date in header) formula used in main sheet pick override =if($a2 = "","",if(iserror(vlookup($a2,'manual override'!$a:f,6,false)),sumif('config pivots'!$d:$d,$a2,'config pivots'!bv:bv),vlookup($a2,'manual override'!$a:f,6,false))) the issue seems in following line vlookup($a2,'manual override'!$a:f,6,false) <-- returns 0 rather 100% 1 cell. sample data below

Can't submit Facebook Ad with api, new error code Your ad is ineligible for News Feed targeting -

i having trouble submitting ad through facebook ads api, doing before. it seems new problem has come up. api of course gives me generic error "invalid parameter" in past noted this comes reason ad creation fails , not tell specific. in different situation used curl facebook graph because noted give additional information. not more in case. note error message below code. curl -x post -f "name=ad administrator_15" -f "campaign_id=xxxxxxxxxx995" -f "creative={'creative_id': xxxxxxxxxx795}" / -f "adgroup_status=paused" / -f "access_token={access_token}" / "https://graph.facebook.com/v2.2/act_{account_id}/adgroups" this error received {"error":{"message":"invalid parameter","type":"facebookapiexception","code":100,"error_subcode":1487757,"is_transient":false,"error_user_title":"ad ineligible feed

rails semantic ui jquery not updating field -

i've run strange problem can't date picker update field in rails app. i've tried few different date pickers, it's not problem jquery plugin. same results. there's nothing strange i'm trying do. <div class="datepicker field"> <label>date of birth</label> <%= f.text_field :dob %> </div> i have tried both manual turbolinks workarounds.. var ready; ready = function() { .... in here } $(document).ready(ready); $(document).on('page:load', ready); and jquery-turbolinks gem. gives me same result - jquery load picker, field not updated. i believe i've got narrowed down semantic ui @ point, i'm happy proven wrong. application.js : //= require jquery //= require jquery.turbolinks //= require jquery_ujs //= require semantic-ui //= require pickadate/picker //= require pickadate/picker.date //= require turbolinks //= require_tree . relevant portion of local js: $(function() { $('.dat

php - How to pass a full MySQL query to Datatables? -

i trying use datatables.net build out table on website. have basic table generating ok using example , 1 table have complex query joins, clause, subquery, etc. , can't figure out how create table results. their basic example looks this: // db table use $table = 'tablenametoquery'; // table's primary key $primarykey = 'pk'; with @ end: echo json_encode( ssp::simple( $_get, $sql_details, $table, $primarykey, $columns ) the mysql query looks along lines of: select t1.col1, col2, col3, col4 table1 t1 left join table 2 t2 on t1.col1 = t2.col1 t2.col5 = 'complete' server-side processing php script included in datatables distribution ( examples/server_side/scripts/ssp.class.php ) simplistic , doesn't support joins , sub-queries right out of box. emran ul hadi released modified ssp class supports need, please visit repository @ github.com/emran/ssp . also in original ssp class in addition ssp::simple there ssp::complex met

c# - In Function Import, The selected stored procedure returns no columns -

i have written stored procedure insert values table primary key auto incremented. when try import in visual studio 2013, in function imports when select "get column information" says "the selected procedure or function" returns no columns. i read many articles , included set fmtonly off in code still not work. amateur in asp.net , c#. can explain me in clear manner use [db_name] go /****** object: storedprocedure [dbo].[usp_makepost] script date: 04-04-2015 19:16:04 ******/ set fmtonly off go set ansi_nulls on go set quoted_identifier on go create procedure [dbo].[usp_makepost] @fk_struser_id varchar(11), @strpost_title varchar(100), @strpost_content varchar(1000), @dtime_of_post datetime, @iup_vote int, @idown_vote int, @fk_strrootword_id varchar(11) begin declare @pk_strpost_id varchar(11); declare @prefix varchar(10) = &

c - Implicit Casting to Const -

this question has answer here: double pointer const-correctness warnings in c 2 answers why is: int *a = 0; int const *b = a; /* totally fine. */ int **c = 0; int const **d = c; /* generates nasty warning. */ shouldn't okay implicitly cast more const type? is there way work around it? have following array: int **a; and want call following functions without ugly explicit cast: void foo1(int const **a); void foo2(int const * const *a); it's complicated. the reason cannot assign char ** value const char ** pointer obscure. given const qualifier exists @ all, compiler keep promises not modify const values. that's why can assign char * const char *, not other way around: it's safe ``add'' const-ness simple pointer, dangerous take away. however, suppose performed following more complicated series of assignments: const

c# - register NT service in transaction -

i have built nt service deployed on group of servers in our organization. central application, web application, able register, unregister, start , stop services. if possible, reliably, in transaction, if 1 operation fails rolled back, similar how transaction in sql service work. there mechanism manage os resources in transaction? if so, how? building on .net 4.5.1 framework.

ios - Custom PFTableViewCell getting 'squished' - Constraint error in Swift + Parse -

i have set parse pftableviewcontroller , want fill table custom cells. when view loads, pftableview populated cells of custom cell type have cell height greater default 44 (i made class custom cell subclass of pftableviewcell etc.) , when tap on one, fires segue detail view have made. but! when tap "< back" go pftableviewcontroller custom cells, cell height changes 44 , gets squished! (i post screenshot, not yet have enough reputation) i following error when first load pftableviewcontroller : unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints) ( "<nslayoutconstraint:0x7fc859f82d90 h:[uilabel:0x7f

selenium - Webdriver verify order of floats descending - Python -

i trying verify floats ("data" attribute) find in descending order. here have far: list = self.driver.find_elements(by.css_selector, "locator") in list: data = i.get_attribute("data") should doing in loop? i'm pretty new webdriver , coding in general. thanks! don't use variable name list it's python keyword. if data indeed attribute of i can do: for in my_list: data = i.data or more usefully, like: data = [] in my_list: data.append(i.data) or shorter: data = [i.data in my_list] you can check descending order comparing data sorted version of itself: print 'data in descending order:', data == sorted(data, reverse = true)

Android-image upload issue to a REST server: Image format not supported -

i'm trying upload image android app rest server. images uploaded ,on server machine, photo viewer or image app can't open uploaded images. i'm using glassfish 3 in netbeans 7 on server machine. i'm not using maven , i'd prefer non-moven solution. here's code use uploading images android in runnable @override public void run() { // todo auto-generated method stub try{ httpclient httpclient = new defaulthttpclient(); httpcontext httpcontext = new basichttpcontext(); bitmap original = bitmapfactory.decodefile(path); bytearrayoutputstream out = new bytearrayoutputstream(); original.compress(bitmap.compressformat.jpeg, 77, out); byte[] data = out.tobytearray(); bytearraybody bab = new bytearraybody(data,"image.jpg"); multipartentitybuilder mpeb = multipartentitybuilder.create(); mpeb.s

android - Vector Drawable is memory efficient? -

sorry putting obvious question (?) troubling me sometime. using glide image loading , find quite in memory management. thinking move vector drawables of mrvector. need worry memory management? for further info, each of image in jpg of size 200kb-300kb become 20- 30 kb in vector drawables. if info helps in answering question. thanks yes. we had png images 20kb because stretched them size of screen, , android converts them bitmap in memory, more 50mb! switching vectors saved of memory.

Kernel Build Logs location -

is there location kernel build logs found while doing standard kernel compilation. 1 way redirect output file. source <build_script> > build_log_file.txt it goes stdout , stderr. if want go file instead can: make > <logfile> 1>&2 if want output go file , screen can make 2>&1 | tee <logfile>

jquery - Validation on Masked Input Plugin -

i using masked input plugin validate following time format: $("#time").inputmask( 'h:s' ); how can disallow time greater '12:00'? you can split string , add if statement first item of array. this. var str = $("#time").val(), parts; parts = str.split(':'); if(parseint(parts[0])>12){ console.log('greater 12'); }

expandablelistview - Android : what happens when I re-launch my app after a long break -

i'm developing app main activity 3 tab actionbar. 1 of tabs handles expandablelistview want indicator stay on right, in mainactivity got : public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); if (tab != null){ lv.setindicatorrightfunction(); //sets indicator on right side } } my problem sometimes, function not called , indicator remains left! added setindicatorrightfunction() in onresume() , seemed work fine when app onpause(). the problem when go afk while, or switches on multiple other apps on phone. then, when relaunch app, indicator appears on left side ! setindicatorrightfunction() not called! there method can call solve problem ? doing wrong ? edit : i figured out function wasn't called because tab equals null. why ? how can solve ? @override public fragment getitem(int position) { // getitem called instantiate fragment given page. switch (position) { case 0:

PERL How to connect to SQLite database -

i have following html + perl code connecting sqlite database , retrieving value, incrementing it, , updating new value in database. however, code giving internal server error when ran on browser. i'm using apache server. error log tells me check html code there's nothing wrong it. please help: <html> <body> <form action="/cgi-bin/a.pl" method="post"> <input type="submit" value="visit"/> </form> </body> </html> #!c:/perl/bin/perl.exe use dbi; use strict; use cgi; $cgi = cgi->new(); $driver = "sqlite"; $database = "my.db"; $dsn = "dbi:$driver:db:$database"; $userid = ""; $password = ""; $dbh = dbi->connect($dsn, $userid, $password) or die $dbi::errstr; $st

javascript - Adding a transition effect in EventDrops D3 -

i using eventdrops displaying event series. new d3 , having tough time understanding code. using eventdrops can zoom in , out in time series. want add transition on load events should zoomed in , zoom out. how can that? not able trigger zoom effect on svg element.

java - org.json.JSONObject cannot be converted to JSONArray -

i unable display values coming in form of json response and failed convert these values , display textview.. my json reponse : {"calculate":{"persons":"148429","cost":25232.93}} and main activity java file : import android.app.progressdialog; import android.os.asynctask; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.textview; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; public class mainactivity extends actionbaractivity { textview uid; textview name1; textview email1; button btngetdata; //url json array private static string url = "http://urls.p/getdata.php?"; //json node names private static final string tag_user = "calculate"; //private static final string tag_id = "